From patchwork Fri Feb 24 12:36:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13151221 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 3705CC61DA3 for ; Fri, 24 Feb 2023 12:38:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:Content-Type :Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=yi14cTdYANNPEap3pqdxxJ1hsHfM+r9CN0mSG8FKdBA=; b=mdD/oZiNq8VKD/FFkPqKfoousJ W23ucq14talgrA/F2LoSN32Af7yEU5b/H0Fe/OUg8X1LKBnsYFf1Zt/ck8MeEQveysyVMccvD++jY uoA4P3a4Mv5K3QKuSWbDBIVSiWNqPI2iUqnCszyYmjh94YR8qnksfDIenI60yLaqgzfnyIhJnLMv1 lgZfP3xc5xikC2GDdHZBDZ23tI/LIr9dvFLpIXXkgYXvSWLNDEn9R9VUFehqwCJlNGbBc9IrIcitU UazqRY+SC29zTSYKvjiiN2+cwKDFFgD2kff8fhrhlUPMvZNSJteAj7qg/M7inSuDctjQKgfOyW+FF fBFyPfCg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pVXLT-002Qhi-54; Fri, 24 Feb 2023 12:38:39 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pVXLE-002PWz-Jl; Fri, 24 Feb 2023 12:38:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=yi14cTdYANNPEap3pqdxxJ1hsHfM+r9CN0mSG8FKdBA=; b=14UfcOsBa6nbww2NhPSDz98UyC +sFNmp9pAjgVPiU7itFTJ8ULwVo44eVKET6hhwcpDD9Ac85eLDe1GACqUf9OGWjD6FTYEM/5jE8Al zAkAa2nqiOzIrCe41tOYLlf4Yyz1TL2M+jCPM7m0Hb1fEec7gjX7nQdW+KrSyeEt561a8VH1cW1Qj PlP01S1KwGMV50TSql80FwfcOunRRZp9Cnye1PWNbaXd7pOO9Blm1mW+z8qGFO9ielq5nBHDPKEVf JiRKF+BWhR4Str2km1OS56pv4aAzeNsieIYJ20mfcknAkdYNSfmb7Mek3M3KBR7jW7iSfjfZBBtZd Uob2NqrA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:49018 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pVXJ6-0000dF-68; Fri, 24 Feb 2023 12:36:12 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pVXJ5-00CT9m-CT; Fri, 24 Feb 2023 12:36:11 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Daniel Golle , Daniel Golle Cc: Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH RFC net-next 1/4] net: mtk_eth_soc: tidy mtk_gmac0_rgmii_adjust() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Fri, 24 Feb 2023 12:36:11 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230224_043824_672783_81613FEA X-CRM114-Status: GOOD ( 10.49 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Get rid of the multiple tenary operators in mtk_gmac0_rgmii_adjust() replacing them with a single if(), thus making the code easier to read. Signed-off-by: Russell King (Oracle) Reviewed-by: Simon Horman --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 34 ++++++++++++--------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 14be6ea51b88..c63f17929ccf 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -397,38 +397,42 @@ static int mt7621_gmac0_rgmii_adjust(struct mtk_eth *eth, static void mtk_gmac0_rgmii_adjust(struct mtk_eth *eth, phy_interface_t interface, int speed) { - u32 val; + unsigned long rate; + u32 tck, rck, intf; int ret; if (interface == PHY_INTERFACE_MODE_TRGMII) { mtk_w32(eth, TRGMII_MODE, INTF_MODE); - val = 500000000; - ret = clk_set_rate(eth->clks[MTK_CLK_TRGPLL], val); + ret = clk_set_rate(eth->clks[MTK_CLK_TRGPLL], 500000000); if (ret) dev_err(eth->dev, "Failed to set trgmii pll: %d\n", ret); return; } - val = (speed == SPEED_1000) ? - INTF_MODE_RGMII_1000 : INTF_MODE_RGMII_10_100; - mtk_w32(eth, val, INTF_MODE); + if (speed == SPEED_1000) { + intf = INTF_MODE_RGMII_1000; + rate = 250000000; + rck = RCK_CTRL_RGMII_1000; + tck = TCK_CTRL_RGMII_1000; + } else { + intf = INTF_MODE_RGMII_10_100; + rate = 500000000; + rck = RCK_CTRL_RGMII_10_100; + tck = TCK_CTRL_RGMII_10_100; + } + + mtk_w32(eth, intf, INTF_MODE); regmap_update_bits(eth->ethsys, ETHSYS_CLKCFG0, ETHSYS_TRGMII_CLK_SEL362_5, ETHSYS_TRGMII_CLK_SEL362_5); - val = (speed == SPEED_1000) ? 250000000 : 500000000; - ret = clk_set_rate(eth->clks[MTK_CLK_TRGPLL], val); + ret = clk_set_rate(eth->clks[MTK_CLK_TRGPLL], rate); if (ret) dev_err(eth->dev, "Failed to set trgmii pll: %d\n", ret); - val = (speed == SPEED_1000) ? - RCK_CTRL_RGMII_1000 : RCK_CTRL_RGMII_10_100; - mtk_w32(eth, val, TRGMII_RCK_CTRL); - - val = (speed == SPEED_1000) ? - TCK_CTRL_RGMII_1000 : TCK_CTRL_RGMII_10_100; - mtk_w32(eth, val, TRGMII_TCK_CTRL); + mtk_w32(eth, rck, TRGMII_RCK_CTRL); + mtk_w32(eth, tck, TRGMII_TCK_CTRL); } static struct phylink_pcs *mtk_mac_select_pcs(struct phylink_config *config, From patchwork Fri Feb 24 12:36:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13151218 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 43578C61DA4 for ; Fri, 24 Feb 2023 12:36:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:Content-Type :Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9OIhci/zYM8WVXXXP4dJ8pS/3BNyD1Ofot8GqQvSd7Y=; b=SpyYsJL0JvWV75HxTqmficRdFq PU9G8TU/j9WV8jGecWAi+hZCKKM86/a8LVtjSXGnHlyjwf4bSwRvy/0Het8S3remvInPjD1c6+UFB TUjYWALi7ISlQIhT3LwDJzs1t06oOWkqCs6nsoM/DRy4o9fxPcnfwXL/PlxjX5UullgCmN0pUCmvF JW8VylNiNU4EHUuBvLxXe/8Xr8VQNVQEfGOMGc0DfW5BcPQzI0yKgfOJaZEfMKtWcP35nnxeYcBPJ tIFUoRVvV2YkMt8/edpidphRcf214RWUYP/0AGcOfuGSgj7dfne3EsEBjw+Ux0+hzNiydpbBwRA+G INgZ/OEw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pVXJa-002Pea-F2; Fri, 24 Feb 2023 12:36:42 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pVXJO-002PYR-WE; Fri, 24 Feb 2023 12:36:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=9OIhci/zYM8WVXXXP4dJ8pS/3BNyD1Ofot8GqQvSd7Y=; b=O/bOruc92YWbZ9DyTj5xYI6z8t lHDHvCMpc232LTY/oy4+PJ6F8luxZYxz5iVrGzWqlMK1D7OvdVXH2/KoMFAnIIPR/DCX/xhgO+Dh6 xIaJTS4Oi4h4FB20NfmBgstq3u5PB3x4JgaUn5OteTUgn46MKYMdvr87/tPrUfCLdyS47LQ3xyC42 2T/vKAsAAbV3fWx8xOSule8Ms6QpQW6SabtOtmrpI9y3DN3MD2LrTtOtMf5grpbZ9SMsGPD8/4lw3 4ZwQLxRyEaPvhsfBRK31S+YmLFvcivmoVhRMLjBpt2KHN6dXjmgr/AY1p2n8EtI9YlLBl3nye19GJ ZE27T0PQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:42320 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pVXJB-0000dR-Bv; Fri, 24 Feb 2023 12:36:17 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pVXJA-00CTAX-NA; Fri, 24 Feb 2023 12:36:16 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Daniel Golle , Daniel Golle Cc: Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH RFC net-next 2/4] net: mtk_eth_soc: move trgmii ddr2 check to probe function MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Fri, 24 Feb 2023 12:36:16 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230224_043631_055699_4733B17E X-CRM114-Status: GOOD ( 13.70 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org If TRGMII mode is not permitted when using DDR2 mode, we should handle that when setting up phylink's ->supported_interfaces so phylink knows that this is not supported by the hardware. Move this check to mtk_add_mac(). Signed-off-by: Russell King (Oracle) Reviewed-by: Simon Horman --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index c63f17929ccf..1b385dfe620f 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -374,17 +374,6 @@ static int mt7621_gmac0_rgmii_adjust(struct mtk_eth *eth, { u32 val; - /* Check DDR memory type. - * Currently TRGMII mode with DDR2 memory is not supported. - */ - regmap_read(eth->ethsys, ETHSYS_SYSCFG, &val); - if (interface == PHY_INTERFACE_MODE_TRGMII && - val & SYSCFG_DRAM_TYPE_DDR2) { - dev_err(eth->dev, - "TRGMII mode with DDR2 memory is not supported!\n"); - return -EOPNOTSUPP; - } - val = (interface == PHY_INTERFACE_MODE_TRGMII) ? ETHSYS_TRGMII_MT7621_DDR_PLL : 0; @@ -4333,6 +4322,7 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) struct mtk_mac *mac; int id, err; int txqs = 1; + u32 val; if (!_id) { dev_err(eth->dev, "missing mac id\n"); @@ -4409,6 +4399,15 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) __set_bit(PHY_INTERFACE_MODE_TRGMII, mac->phylink_config.supported_interfaces); + /* TRGMII is not permitted on MT7621 if using DDR2 */ + if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_GMAC1_TRGMII) && + MTK_HAS_CAPS(mac->hw->soc->caps, MTK_TRGMII_MT7621_CLK)) { + regmap_read(eth->ethsys, ETHSYS_SYSCFG, &val); + if (val & SYSCFG_DRAM_TYPE_DDR2) + __clear_bit(PHY_INTERFACE_MODE_TRGMII, + mac->phylink_config.supported_interfaces); + } + if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_SGMII)) { __set_bit(PHY_INTERFACE_MODE_SGMII, mac->phylink_config.supported_interfaces); From patchwork Fri Feb 24 12:36:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13151219 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 0E968C61DA3 for ; Fri, 24 Feb 2023 12:37:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:Content-Type :Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dNuvrGSIwTA5NXb6MRBDQvk5XI9567Ybm3Y4p+pxJr8=; b=FLznbtlReuKXiOmBe8MUA0Jrnd RQMu5R+dj/u8RWik1BPiQgCkl9y1IiLd1sVxyC2RycG9Pg98b+Zd3qx5Jigng3U+trsYbJGQQj50w 2lXrQYQisJ2L4pyXiTVY5qM+qHRG+lN3k0qjVzB1aoVelrVXNN58MO/A0mYoaIsrlPfcLqg2w2FFY n0WzdB39uDCp8R4vhsymO4C64e31p5mqzwDNrnsGBiocgA/vzsbm6g5EZ7EuJJ6yDmEZOA9ik0nzX AymACqJzmORkin0uUr5eVm3yXOVPKGEs42IIXA4ljXIXgnExJJHgDmhlTIXR9YV0HClQsBuUQzwZa MamZS2Eg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pVXJo-002PmJ-Ch; Fri, 24 Feb 2023 12:36:56 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pVXJS-002PaS-6s; Fri, 24 Feb 2023 12:36:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=dNuvrGSIwTA5NXb6MRBDQvk5XI9567Ybm3Y4p+pxJr8=; b=qat1waqG+EQvm+f1yKAxBEHyZP ozECbjI+yFfLN7bEtDbPZF8VKA5fjiiZJ7zvTo51pIa4rJParXVOIDxvhImeUDWyRORXxyOYFQz5m fHUkjqj4tsaV5cIz0PCfZNrw4cTUaPkHUxrDQcp8bJ7t0DBqVFWQLm2fnOkMV1SmyR8i16q9U92TS pWYqKVSCPcVSskQKHN2y+5bq9NpYE7HlfriL6cSwzAd0UZ6zavaRX9jOxULcr0v96B0Qx9SZGWYNY 4/ra3IaMstM+m+CDE7VLrsKpJWZRZ8/QVWIRWDDfykoylTWCNePRgwJ/eL4c0Fsm8Tws7meBd1cSR CIxWlXcg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:42332 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pVXJG-0000dh-Hx; Fri, 24 Feb 2023 12:36:22 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pVXJF-00CTAf-Qu; Fri, 24 Feb 2023 12:36:21 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Daniel Golle , Daniel Golle Cc: Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH RFC net-next 3/4] net: mtk_eth_soc: remove unnecessary checks in mtk_mac_config() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Fri, 24 Feb 2023 12:36:21 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230224_043634_282238_BE6720A7 X-CRM114-Status: GOOD ( 11.38 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org mtk_mac_config() checks that the interface mode is permitted for the capabilities, but we already do these checks in mtk_add_mac() when initialising phylink's supported_interfaces bitmap. Remove the unnecessary tests. Signed-off-by: Russell King (Oracle) Reviewed-by: Simon Horman --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 1b385dfe620f..f78810717f66 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -458,12 +458,6 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode, /* Setup soc pin functions */ switch (state->interface) { case PHY_INTERFACE_MODE_TRGMII: - if (mac->id) - goto err_phy; - if (!MTK_HAS_CAPS(mac->hw->soc->caps, - MTK_GMAC1_TRGMII)) - goto err_phy; - fallthrough; case PHY_INTERFACE_MODE_RGMII_TXID: case PHY_INTERFACE_MODE_RGMII_RXID: case PHY_INTERFACE_MODE_RGMII_ID: @@ -480,11 +474,9 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode, case PHY_INTERFACE_MODE_1000BASEX: case PHY_INTERFACE_MODE_2500BASEX: case PHY_INTERFACE_MODE_SGMII: - if (MTK_HAS_CAPS(eth->soc->caps, MTK_SGMII)) { - err = mtk_gmac_sgmii_path_setup(eth, mac->id); - if (err) - goto init_err; - } + err = mtk_gmac_sgmii_path_setup(eth, mac->id); + if (err) + goto init_err; break; case PHY_INTERFACE_MODE_GMII: if (MTK_HAS_CAPS(eth->soc->caps, MTK_GEPHY)) { From patchwork Fri Feb 24 12:36:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13151220 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 841C3C61DA3 for ; Fri, 24 Feb 2023 12:37:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:Content-Type :Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=D28DDJH9u+51fbuNH6FlD2OnOZeG3P4gcCfgY7q18CY=; b=u6NxdlT/vLGbZqciUw1uXTb69x lWJSFhx4vj++Lx1Z/fzBcxhyTEhXFaGDiJWvY0F42vkeSqjTR1ftP719bzHPCWw7DOrWcVeDgnWRu H9PJovS/ctiTVI8TDrop3D3F5gOCRoY0g45dS/bg5oXZLuc8J41tE757k5fG00XFMJyFYT4G/xTo4 S2Nocn4AJIM4ty7SW/pes1EdZFqsoIDNGlpKGfqC+8oa0vvjymwa4uu4vXQhQQPbsSnzn2tMt8chB zpYPaLAbYORNLO5IgzGUN1NQuL3kd5eUWR2/v5Jhyqed0SOZQFpu/09kZX1nTeA2/JBcf4MhHl1ld Gh5+Zcag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pVXK3-002Pun-GD; Fri, 24 Feb 2023 12:37:11 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pVXJU-002PbZ-EI; Fri, 24 Feb 2023 12:36:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=D28DDJH9u+51fbuNH6FlD2OnOZeG3P4gcCfgY7q18CY=; b=BNE/u4RIuLfquJUUW/5GHhr5xb 6IMOtvCE8YP+oPn2pV0vtPN76WPlcEfgEvdu/UoULGVQctoQVafOl7MoMj1uto8Ys9KULGeNVAvA4 30WEk/kA+xyILfnuGLP3Yk122pvgMTZbpvrgfArx2c/H+2RKP2ce/pZ3jeAEi585GO7jtjxWc1ysC 3cwFMcgb0PbGnf7EN6jFY/4ghQyq2+rtw5fgy7ewpkWe0et5+5xLXI2SB76yPTMqy9CzuSopgWYQ9 WnSQipgMl5iWRi4q/majMecLnck4tOJlXQRgHwiVeaSuuV6uVvGytYqzL92RKhBksO9UER0OlFyiG qeJp4FDQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:47980 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pVXJL-0000dz-KN; Fri, 24 Feb 2023 12:36:27 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pVXJK-00CTAl-V7; Fri, 24 Feb 2023 12:36:27 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Daniel Golle , Daniel Golle Cc: Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH RFC net-next 4/4] net: mtk_eth_soc: note interface modes not set in supported_interfaces MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Fri, 24 Feb 2023 12:36:26 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230224_043636_525538_6905DECD X-CRM114-Status: UNSURE ( 9.35 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index f78810717f66..280490942fa4 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -530,9 +530,11 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode, case PHY_INTERFACE_MODE_GMII: ge_mode = 1; break; + /* FIXME: RMII is not set in the phylink capabilities */ case PHY_INTERFACE_MODE_REVMII: ge_mode = 2; break; + /* FIXME: RMII is not set in the phylink capabilities */ case PHY_INTERFACE_MODE_RMII: if (mac->id) goto err_phy;