From patchwork Fri Nov 25 13:17:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Chevallier X-Patchwork-Id: 13055930 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DD5C2C4332F for ; Fri, 25 Nov 2022 13:19:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9ih8kwwpIJPhJXsNE53nRULud5ArpianKEQusyb+ohw=; b=XDKSmJ262zYdLL zDZXLBP8YccV0e3lXVHD4gUUDfe9O9l+OZ4efyFuZanG8/jc0OVxx2ch7mZ7aCIa+xCaevzUJGC78 riFmoCibGMd7PTyuhjl/K0DLxS2KV8XcaDeYMTVUS+mQdtnlQxLyc1r0ZllRoahjStNCgA8/oBwBk AtGwaYP1DXg/TGMyurNOi0lqUnnpKBqGH0mQ6GQ/NW0Syg+xLznBl4/iGQwk0gv25beLJ7iB4cIVV 6e2UTBFgXVzMzkJLi2G/pQi2cZRNhnCBEOEAD0jxHzpTrnGeiHKmAWux0cuVLw7SAY7R2aaYN2fQU +z24vOiuoQa1yTZmtZag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyYbA-00Gczn-Sc; Fri, 25 Nov 2022 13:18:33 +0000 Received: from relay11.mail.gandi.net ([217.70.178.231]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyYar-00GcsJ-1c for linux-arm-kernel@lists.infradead.org; Fri, 25 Nov 2022 13:18:15 +0000 Received: (Authenticated sender: maxime.chevallier@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 91A2910000C; Fri, 25 Nov 2022 13:18:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1669382289; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=55j9+pE5serVzhnMTbv/yWHlwVqG0P8aXjk+91N8pmo=; b=SiOXIiLYraXwB85aZtJFfKRo6XCjpwXBNzHzXLTa1n1xVN9B4F4cVUdYoUL5xzUDi5aD8C mamEZ7hnUlvXa2l0lcG0A5M7Zg6Q8NohX8z9aNt8X8XcH28q5SGdwwiZeCN/3RhvmTMt9W rdKT+qb/vBD1ddGSoC9TKCw9tdjcoTskdaPB5e4lst2JvsPsG8k7vxTb1a76sCLqgf2OzT cuUSHHetIhIu52TSdgwzYLkmuvGdx1J7NqAmPQwDxrQup2/GcoyyNOBPVniPJ8WBqcAS8A 6KbMxbEpwSMpNa/ZiDj0eAjf5/EWyd6iMB8QtiFIr60CG3/gEmikL/BelB23AA== From: Maxime Chevallier To: davem@davemloft.net, Rob Herring Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Florian Fainelli , Heiner Kallweit , Russell King , linux-arm-kernel@lists.infradead.org, Krzysztof Kozlowski , devicetree@vger.kernel.org Subject: [PATCH net-next 1/3] net: pcs: altera-tse: use read_poll_timeout to wait for reset Date: Fri, 25 Nov 2022 14:17:59 +0100 Message-Id: <20221125131801.64234-2-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221125131801.64234-1-maxime.chevallier@bootlin.com> References: <20221125131801.64234-1-maxime.chevallier@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221125_051813_237040_46569F61 X-CRM114-Status: GOOD ( 11.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Software resets on the TSE PCS don't clear registers, but rather reset all internal state machines regarding AN, comma detection and encoding/decoding. Use read_poll_timeout to wait for the reset to clear instead of manually polling the register. Signed-off-by: Maxime Chevallier --- drivers/net/pcs/pcs-altera-tse.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/net/pcs/pcs-altera-tse.c b/drivers/net/pcs/pcs-altera-tse.c index 97a7cabff962..e86cadc391e8 100644 --- a/drivers/net/pcs/pcs-altera-tse.c +++ b/drivers/net/pcs/pcs-altera-tse.c @@ -60,7 +60,6 @@ static void tse_pcs_write(struct altera_tse_pcs *tse_pcs, int regnum, static int tse_pcs_reset(struct altera_tse_pcs *tse_pcs) { - int i = 0; u16 bmcr; /* Reset PCS block */ @@ -68,13 +67,9 @@ static int tse_pcs_reset(struct altera_tse_pcs *tse_pcs) bmcr |= BMCR_RESET; tse_pcs_write(tse_pcs, MII_BMCR, bmcr); - for (i = 0; i < SGMII_PCS_SW_RESET_TIMEOUT; i++) { - if (!(tse_pcs_read(tse_pcs, MII_BMCR) & BMCR_RESET)) - return 0; - udelay(1); - } - - return -ETIMEDOUT; + return read_poll_timeout(tse_pcs_read, bmcr, (bmcr & BMCR_RESET), + 10, SGMII_PCS_SW_RESET_TIMEOUT, 1, + tse_pcs, MII_BMCR); } static int alt_tse_pcs_validate(struct phylink_pcs *pcs, From patchwork Fri Nov 25 13:18:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Chevallier X-Patchwork-Id: 13055929 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF93EC4167D for ; Fri, 25 Nov 2022 13:19:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+LiNe2kord3M7w1/7k1aAKgTqTVdvO9/EhgUQ0YBzVk=; b=ItPkcwcBB1LzUx Ps4NBvwz55QZWZ4v2Bv831ZmdRzUs573vAGedaNCAviU5V99kkDPXawx7PnktB1xAHsA17xqd7ML1 stnqcO+5l3ld3TnVYtSqfuGLJGzM/CQ7S2wg5NlOdosFR71qE56jWIS+u0tCvn22tDqbA+kbTn/Zy tpc90h9FkguI9P7qixprQNcFafN9iENHhHQbELbxPby3FUUcazKdopslOkRk/G0oCWxdgZlnE/MSW jOPkwvKBKp8BPPkFcH9suye5pL1tlx27ytkL88NZ9r1RdJsaymfe1Lq+Gnp6WGJRmlxPCKoDWO94K eZZ03M4oHskO4mTk+4UQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyYb2-00GcyK-W0; Fri, 25 Nov 2022 13:18:25 +0000 Received: from relay11.mail.gandi.net ([217.70.178.231]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyYaq-00Gct0-Ot for linux-arm-kernel@lists.infradead.org; Fri, 25 Nov 2022 13:18:14 +0000 Received: (Authenticated sender: maxime.chevallier@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id AC810100004; Fri, 25 Nov 2022 13:18:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1669382291; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0vN53Jicp2EQLGwxHenx0pNuudpw6RE4UZUcHo5SquA=; b=FZdFGvNZ+6wfMb4AaDqlr+5u/y02N0LfnuwXdaIOqZbpRmii5u/VTHguLkaR2klLjp06Za FT4x8kZTrcAkyyMcyE+jtQpMdch88/iLNOmAB9rUeR/DfnEDb6CkJmzXUULesE7wKU5It4 /WDvLmsF5guHQNjIh7daVXMXkpqrEFvVEVjohe7jlyE+eHpEvyCPRSZBH1qXzPdotJDLSX 8ZsMn4Fke+SZE0Cu+v+7H5+mwALAxhvUym2Vg7ZGOvCmnN9fkZ7FRkEPULzMo+IG/jDJs9 gwDwdJ/1bKwA+DDQDBmNaqFuc3hg3UOQJTGyVkkGP3mMDfEln3y8pYWrLAkn3Q== From: Maxime Chevallier To: davem@davemloft.net, Rob Herring Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Florian Fainelli , Heiner Kallweit , Russell King , linux-arm-kernel@lists.infradead.org, Krzysztof Kozlowski , devicetree@vger.kernel.org Subject: [PATCH net-next 2/3] net: pcs: altera-tse: don't set the speed for 1000BaseX Date: Fri, 25 Nov 2022 14:18:00 +0100 Message-Id: <20221125131801.64234-3-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221125131801.64234-1-maxime.chevallier@bootlin.com> References: <20221125131801.64234-1-maxime.chevallier@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221125_051812_958432_93BE2521 X-CRM114-Status: GOOD ( 10.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When disabling the SGMII mode bit, the PCS defaults to 1000BaseX mode. In that mode, we don't need to set the speed since it's always 1000Mbps. Signed-off-by: Maxime Chevallier --- drivers/net/pcs/pcs-altera-tse.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/pcs/pcs-altera-tse.c b/drivers/net/pcs/pcs-altera-tse.c index e86cadc391e8..be65271ff5de 100644 --- a/drivers/net/pcs/pcs-altera-tse.c +++ b/drivers/net/pcs/pcs-altera-tse.c @@ -102,7 +102,6 @@ static int alt_tse_pcs_config(struct phylink_pcs *pcs, unsigned int mode, if_mode |= PCS_IF_MODE_USE_SGMII_AN | PCS_IF_MODE_SGMII_ENA; } else if (interface == PHY_INTERFACE_MODE_1000BASEX) { if_mode &= ~(PCS_IF_MODE_USE_SGMII_AN | PCS_IF_MODE_SGMII_ENA); - if_mode |= PCS_IF_MODE_SGMI_SPEED_1000; } ctrl |= (BMCR_SPEED1000 | BMCR_FULLDPLX | BMCR_ANENABLE); From patchwork Fri Nov 25 13:18:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Chevallier X-Patchwork-Id: 13055931 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7E828C4332F for ; Fri, 25 Nov 2022 13:19:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9OBP8eAe6wOHUbLvtkCTmAMhMvKo60/O4SjzIKRyEdY=; b=vdHCYzzasQRBT7 VRC6W+DdTDO7McSaQr/YmDfBSB/7zHItrTU6Qv0mUwKjPH4Kug2IICGc/W8NDLF7lgHc13fEz69Ua TLR8Q0fvVZN4JIZoiKWUnV61FSwpeaKiOLeSIquemfcqw34bGineO1Mv/AXljQlFpFKKm/Tt0LIkd +ZynrDAjiwL45ty/y1ODQxZBfEtpiwneaY+ydBIDpa+6k609rcDUZKTHrXXBYNPo8Upy8WCgYJrd6 ApVB9VbTiawGSf6nqu916EFmmBChSJgR99/4gPd6tirAhGCl6uLp1Wv/Am2i39y22hMy0JfwKn15M RwdJyfbAnMapGBx8MHlw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyYbJ-00Gd19-3X; Fri, 25 Nov 2022 13:18:41 +0000 Received: from relay11.mail.gandi.net ([217.70.178.231]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyYat-00GcuD-Qh for linux-arm-kernel@lists.infradead.org; Fri, 25 Nov 2022 13:18:17 +0000 Received: (Authenticated sender: maxime.chevallier@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id B329110000E; Fri, 25 Nov 2022 13:18:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1669382294; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kr/Cj9zfcDB4yuNR0P+NcVj8Izrqtu5VXnRoj3YeWog=; b=MmSIlxSTGhG1vopnsc3kSCU2v2yKidY5zAz+i/WM5SPO/Il7hWSrz6oQ/P+nsX7zZD85tq RCakvZ2swc64GvvKN3bXVudaxMj3uDHPtcKzGUhj7kVnYOz/kRN9MKl8Dk5YN18xUJbYhu mRmfIUw7Z9ntF0Ou/gAZwnEn4mKLH/f0DkM1eHofTLwInFEXEbE9qDIS3j/FRadAzwuppm UjTVMERSURu9oTfjtViGOSTo2pylhg4DcbGO9eAeFkuLGnRngfeqERckGhSlDTvm7rWxHW UpuKzWcIsGeZsQp49gmR+Xm6bpe3gP4nKPyH3rhPXxzUSGZDXpsbohClRtLF6Q== From: Maxime Chevallier To: davem@davemloft.net, Rob Herring Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Florian Fainelli , Heiner Kallweit , Russell King , linux-arm-kernel@lists.infradead.org, Krzysztof Kozlowski , devicetree@vger.kernel.org Subject: [PATCH net-next 3/3] net: pcs: altera-tse: remove unnecessary register definitions Date: Fri, 25 Nov 2022 14:18:01 +0100 Message-Id: <20221125131801.64234-4-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221125131801.64234-1-maxime.chevallier@bootlin.com> References: <20221125131801.64234-1-maxime.chevallier@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221125_051816_018031_3E5DE753 X-CRM114-Status: UNSURE ( 7.99 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org remove unused register definitions, left from the split with the altera-tse mac driver. Signed-off-by: Maxime Chevallier --- drivers/net/pcs/pcs-altera-tse.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/net/pcs/pcs-altera-tse.c b/drivers/net/pcs/pcs-altera-tse.c index be65271ff5de..d616749761f4 100644 --- a/drivers/net/pcs/pcs-altera-tse.c +++ b/drivers/net/pcs/pcs-altera-tse.c @@ -12,22 +12,13 @@ /* SGMII PCS register addresses */ -#define SGMII_PCS_SCRATCH 0x10 -#define SGMII_PCS_REV 0x11 #define SGMII_PCS_LINK_TIMER_0 0x12 -#define SGMII_PCS_LINK_TIMER_REG(x) (0x12 + (x)) #define SGMII_PCS_LINK_TIMER_1 0x13 #define SGMII_PCS_IF_MODE 0x14 #define PCS_IF_MODE_SGMII_ENA BIT(0) #define PCS_IF_MODE_USE_SGMII_AN BIT(1) -#define PCS_IF_MODE_SGMI_SPEED_MASK GENMASK(3, 2) -#define PCS_IF_MODE_SGMI_SPEED_10 (0 << 2) -#define PCS_IF_MODE_SGMI_SPEED_100 (1 << 2) -#define PCS_IF_MODE_SGMI_SPEED_1000 (2 << 2) #define PCS_IF_MODE_SGMI_HALF_DUPLEX BIT(4) #define PCS_IF_MODE_SGMI_PHY_AN BIT(5) -#define SGMII_PCS_DIS_READ_TO 0x15 -#define SGMII_PCS_READ_TO 0x16 #define SGMII_PCS_SW_RESET_TIMEOUT 100 /* usecs */ struct altera_tse_pcs {