From patchwork Tue Nov 16 10:06:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 12621913 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC2D2C433F5 for ; Tue, 16 Nov 2021 10:07:20 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A5ED7619E3 for ; Tue, 16 Nov 2021 10:07:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A5ED7619E3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:Date:Message-Id: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=cOEuFjGNE752obMEQYYvNJyVmdpFZEw/P3HTLTxTtO8=; b=SBEbdj8kNNzW05 edmr1I/FvSoL2mJS0dzjYmdd5JLecb6XNJYkxjB9IShq5gQ7lWwfRTyvUYLpdQodC+Ip4acgFS7Xu ++LQ1rzWp/vFTWUbL+R88HOhYOEtS7fnhMu0whBdBiGMh5i4TiEFq0hHyMCnujEzvG/4EHnrfxBRZ /fqhsK/HSKF/drGA61HSupMbUQeQHD/O+qqBPEDvReBD41ggbYlYu4nBbY55J9Kr7tdLBAWwQbkru xr01tUSqDG2+StMLnU0nw2IzCTrNZhDQjCVA75+2ySW+4+gyL7yGPiOX2pIGsUoWgsbmVogISb2yQ 0dnBD7ku1WFH329ptKeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmvMv-0015jV-Oh; Tue, 16 Nov 2021 10:07:13 +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 1mmvMV-0015Y2-0P; Tue, 16 Nov 2021 10:06:50 +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=/xVCdcDW8Mbm2vM87DhKbJgb/YxbcKCCa5R3z5x+TQM=; b=A2CMIytkS9zbOYYtzLVOC6emci r6ySneX9dY8Abwi8MHJ3ieDwErIvk9Cbhfrdcx2zy4jHiqj+wjDvk/UQjIv+P9jbBGu2iQJWkrKsU 4iXpSTZeoaXUkfiMJnDdBq06CzPVD4Qz0PnhiVyOy3QwTmI5Kbp/1mcHeDtC5cJyEvDLC87l2V0I5 svX+dxpQsuQfkzRyz/TVurtPbUCbn7cOis4KyQXlZOV45j4vmWpxPY1le1mhba9Zm45B5uVIN9MN3 8j9NyWQn20AC2QgvEqu87HZGr2JCpM13U9lqwb1pOZBbTgYLa897+0TH5ZCxfNcuj4oJOxq7WuEjw iOf3gvmA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:39838 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 1mmvMR-0000Ln-Ve; Tue, 16 Nov 2021 10:06:43 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1mmvMR-0078bF-Hd; Tue, 16 Nov 2021 10:06:43 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Felix Fietkau , John Crispin , Mark Lee , Matthias Brugger , Sean Wang Cc: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH net-next 1/4] net: mtk_eth_soc: populate supported_interfaces member MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 16 Nov 2021 10:06:43 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211116_020647_085996_0C4DE99B X-CRM114-Status: UNSURE ( 8.46 ) 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 Populate the phy interface mode bitmap for the Mediatek driver with interfaces modes supported by the MAC. Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 75d67d1b5f6b..7f62298bc983 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -3009,6 +3009,26 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) mac->phylink_config.dev = ð->netdev[id]->dev; mac->phylink_config.type = PHYLINK_NETDEV; + __set_bit(PHY_INTERFACE_MODE_MII, + mac->phylink_config.supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_GMII, + mac->phylink_config.supported_interfaces); + + if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_RGMII)) + phy_interface_set_rgmii(mac->phylink_config.supported_interfaces); + + if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_TRGMII) && !mac->id) + __set_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); + __set_bit(PHY_INTERFACE_MODE_1000BASEX, + mac->phylink_config.supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_2500BASEX, + mac->phylink_config.supported_interfaces); + } phylink = phylink_create(&mac->phylink_config, of_fwnode_handle(mac->of_node), From patchwork Tue Nov 16 10:06:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 12621915 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C47CC433F5 for ; Tue, 16 Nov 2021 10:07:50 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 3143C619E3 for ; Tue, 16 Nov 2021 10:07:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3143C619E3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:Date:Message-Id: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=fZc2sIpxwFEZTfJBINjbOLqe/+ExdQTXkrd8KtfFBCI=; b=hscmhHvBWkJyXS wzrATcfyccxiZq2+82vVyTzQurFbZQxa4pljxTyG3RcA3Ll6zVOlvo6a5iBxTXKXqKmvsw/J64ixG 0GHSrD0jZ2JJge75e58+hmHFxsN5lnrinANTqcrZ2FGr6lH3iCCtHXpNkKTM3EGRCw4AKddEbQ/PH 9J1jKCjuy7tE5qOdn98PJ8JHQQxp65KpuJb3K25vs+C6JFlN5fhrV3ahja0q7CBfE+taOI57EYwjF XM4hLPp4i8CrYNNN89Zm0ZakrABWBmFjPis5GFvPU6cg+PAg6AzAisp6Nvlr4fYbcd6y92b9+m4vs SyThyYjfsVa+B4RXKltA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmvNP-0015xQ-7O; Tue, 16 Nov 2021 10:07:43 +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 1mmvMa-0015Zz-A5; Tue, 16 Nov 2021 10:06:53 +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=FS4ajOcnofb6bnRQXQZpb59B3t3pfaH82+SxdC9NXcU=; b=eZZ0bvcAdeo0g/tAZTPnhqCEqE im5eeP2xeZFqx+8RFO8+xrmKNBbOYKX4IhhDcZw4M1wc0CfnHhOjo+FMaV9HfyEl/ekZ056uhXuTH erYQEBPHALHxyLk0q6n/QibduyiaOLlP1n1Ax25jst7z1d7b67InAJwrAsp2cI8xBX/sMwziHpxsE OqK2Z1Zwy7APbyJcVrC2d7i66vKNpw3SleCkP1WV/MBCjbYGB7cMy0uuemyJZVNf1xMm9e/rolo/+ EzR2he6DsLRCcalwn25E+gEm9+pkm3Tgu+zExoUi88v3KNVvQMKF24zO5Zh2x8uOzQPLkw2lsHBDh 4/WG4Qqg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:39840 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 1mmvMX-0000M0-2V; Tue, 16 Nov 2021 10:06:49 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1mmvMW-0078bO-LN; Tue, 16 Nov 2021 10:06:48 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Felix Fietkau , John Crispin , Mark Lee , Matthias Brugger , Sean Wang Cc: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH net-next 2/4] net: mtk_eth_soc: remove interface checks in mtk_validate() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 16 Nov 2021 10:06:48 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211116_020652_416060_9AA91505 X-CRM114-Status: UNSURE ( 9.88 ) 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 As phylink checks the interface mode against the supported_interfaces bitmap, we no longer need to validate the interface mode, nor handle PHY_INTERFACE_MODE_NA in the validation function. Remove these to simplify the implementation. Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 34 --------------------- 1 file changed, 34 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 7f62298bc983..31872594c790 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -467,24 +467,8 @@ static void mtk_validate(struct phylink_config *config, unsigned long *supported, struct phylink_link_state *state) { - struct mtk_mac *mac = container_of(config, struct mtk_mac, - phylink_config); __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; - if (state->interface != PHY_INTERFACE_MODE_NA && - state->interface != PHY_INTERFACE_MODE_MII && - state->interface != PHY_INTERFACE_MODE_GMII && - !(MTK_HAS_CAPS(mac->hw->soc->caps, MTK_RGMII) && - phy_interface_mode_is_rgmii(state->interface)) && - !(MTK_HAS_CAPS(mac->hw->soc->caps, MTK_TRGMII) && - !mac->id && state->interface == PHY_INTERFACE_MODE_TRGMII) && - !(MTK_HAS_CAPS(mac->hw->soc->caps, MTK_SGMII) && - (state->interface == PHY_INTERFACE_MODE_SGMII || - phy_interface_mode_is_8023z(state->interface)))) { - linkmode_zero(supported); - return; - } - phylink_set_port_modes(mask); phylink_set(mask, Autoneg); @@ -511,7 +495,6 @@ static void mtk_validate(struct phylink_config *config, case PHY_INTERFACE_MODE_MII: case PHY_INTERFACE_MODE_RMII: case PHY_INTERFACE_MODE_REVMII: - case PHY_INTERFACE_MODE_NA: default: phylink_set(mask, 10baseT_Half); phylink_set(mask, 10baseT_Full); @@ -520,23 +503,6 @@ static void mtk_validate(struct phylink_config *config, break; } - if (state->interface == PHY_INTERFACE_MODE_NA) { - if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_SGMII)) { - phylink_set(mask, 1000baseT_Full); - phylink_set(mask, 1000baseX_Full); - phylink_set(mask, 2500baseX_Full); - } - if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_RGMII)) { - phylink_set(mask, 1000baseT_Full); - phylink_set(mask, 1000baseT_Half); - phylink_set(mask, 1000baseX_Full); - } - if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_GEPHY)) { - phylink_set(mask, 1000baseT_Full); - phylink_set(mask, 1000baseT_Half); - } - } - phylink_set(mask, Pause); phylink_set(mask, Asym_Pause); From patchwork Tue Nov 16 10:06:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 12621917 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2030CC433EF for ; Tue, 16 Nov 2021 10:08:24 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id E34EB619E3 for ; Tue, 16 Nov 2021 10:08:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E34EB619E3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:Date:Message-Id: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=fjD9D2iCDpp8Ro6HiLKQj6xBBnMqkcnm+myAJBr9/+0=; b=zRkqKH6QuDbNAe W0KPXguL8XHJQJjCXpdjEFBaAPFpRvDwA9S0x9Ec/fl0nJqEovejqhcNtdNIcJF5wgZRyQSoEXZyr x5EuQuj3WxCqMY9IyS4yL5VQ7l/HcRi1aZQy88QYAzKlB1Nrob+09oovyTu/sTR+bioiavNJIb8G1 xOeJM8h/qlDP5cCFCyjIhF8B9uyaLjxSiC8/L2keTZzPK96gTre6zyjWrEtKteIDgCnra42e2NfGy tWjdIP616ql1wFcRslTtWQ39p4xpKEieg+fsmznojrbUgXl84NHt0T+LTR1/4Hf2Zpg7HzgI7i0TX RMVlky+kDxvfOFwU1Bxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmvNw-0016Ex-QB; Tue, 16 Nov 2021 10:08:16 +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 1mmvMf-0015cB-H0; Tue, 16 Nov 2021 10:07:02 +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=1UffHZf+PQn8gcJrkq9n0w/iIiec6NH9F4LRAB/vcKk=; b=joQnlDOCr3NRdzEfijqKIFferF KX+/szz/wmNbp/f1JiRKY0Bm+Bi3YEmoLezrYMZft5QIV/PV0YlnU9ji3+fjJ9yckhZztT3uuk/Pe PpAOGDe8tBENujcg7vKKtdOvN2SS2f3UqIscl6UO0Jek7QoXbz/JqU4wkffxU61pp8+vKLuelE5gC kifNjqjphLxKn0IYv5on1CQMqsQExau2noDU79PfiWlWXCT+JVRXbKD9aX8lrTtYBbF0iLbM8SNSF MY+6FrwpBOuey2uTVtbYR8iw/Z9xKQmnn4tbvPOvC6DmMtq70J9gJfGSYxa5icfMBygwk2Sub30x4 K6Hat7eA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:39842 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 1mmvMc-0000MF-7g; Tue, 16 Nov 2021 10:06:54 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1mmvMb-0078bU-Oe; Tue, 16 Nov 2021 10:06:53 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Felix Fietkau , John Crispin , Mark Lee , Matthias Brugger , Sean Wang Cc: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH net-next 3/4] net: mtk_eth_soc: drop use of phylink_helper_basex_speed() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 16 Nov 2021 10:06:53 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211116_020657_758629_E8AB1640 X-CRM114-Status: GOOD ( 11.08 ) 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 Now that we have a better method to select SFP interface modes, we no longer need to use phylink_helper_basex_speed() in a driver's validation function, and we can also get rid of our hack to indicate both 1000base-X and 2500base-X if the comphy is present to make that work. Remove this hack and use of phylink_helper_basex_speed(). Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 31872594c790..98f9a6ed9584 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -477,8 +477,9 @@ static void mtk_validate(struct phylink_config *config, phylink_set(mask, 1000baseT_Full); break; case PHY_INTERFACE_MODE_1000BASEX: - case PHY_INTERFACE_MODE_2500BASEX: phylink_set(mask, 1000baseX_Full); + break; + case PHY_INTERFACE_MODE_2500BASEX: phylink_set(mask, 2500baseX_Full); break; case PHY_INTERFACE_MODE_GMII: @@ -508,11 +509,6 @@ static void mtk_validate(struct phylink_config *config, linkmode_and(supported, supported, mask); linkmode_and(state->advertising, state->advertising, mask); - - /* We can only operate at 2500BaseX or 1000BaseX. If requested - * to advertise both, only report advertising at 2500BaseX. - */ - phylink_helper_basex_speed(state); } static const struct phylink_mac_ops mtk_phylink_ops = { From patchwork Tue Nov 16 10:06:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 12621929 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54F2DC433EF for ; Tue, 16 Nov 2021 10:09:02 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 178E961101 for ; Tue, 16 Nov 2021 10:09:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 178E961101 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:Date:Message-Id: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=bPTmaBQMi3zg9mYtTfduY504GZaw6SvcjuwdOJCQzjU=; b=EUG8Zhra5/l4tQ 3BUdkRxsYg7SqAnDCQfSQ8uN3TPKKPMOnji8ZhioOhlrEDu15Z/r9cj2mOzoMtjWOGxOGCDOtqs85 GtTFRbmklgeHawTUqehu8iDgPyZzGxxSh8ui+D6vO1RTMowE6CtPJEi2MRet1Nv7X/EFXIz9l7rnU KRY7u8iGHcX7mW5tGB4Zh+cXxGi3Pt9EYKt4gNK3W7eNJWE8htufOllUpmB7jCfxwOpSmTQ8eAh22 wmZNVSY7AZzMwPJAiGhsnxaMJ+btxRakxm9jlz6MIvmAMgfvSXewHqqUGH0GiyWLE0e/pBb/M7qOo OEl31aQPolWE/kOq83Lg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmvOY-0016Yo-Pi; Tue, 16 Nov 2021 10:08:54 +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 1mmvMl-0015fP-Bf; Tue, 16 Nov 2021 10:07:04 +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=8TJ/OIeRdkM1oox30eLvG8HWV1qjoPaDdEdnXNcCfTY=; b=cWWKPBpeI6a1kenNYlA8SYs0Zc uwKjqrkch6Dxbk2fopgWlmYBwlwrPlzwOxYtOHsYWfqdi+9VpdUlof7osWXkh9zExM3obMz1ZQYJd R/stSYw9leyWzsalB8Ym0PyxXs2l8EWNabBhi05W3rNUbcwty6ha5x6I0wjkyvAImW1BgJef0+Cfd P3FV107a1SL8VdfVmwv0HvYxpUsjrTFAFuSQPdOD1EK9diTgJItnWtnFP0ymprYRjtOq1YfZ/NHrz Y2altkWI+3Nvf0xU6nYwGriqkQTdgkPDLvqVtpdydlu0jTOKnzA8BviUa/550Oy44o8gwZbXO9TPe Ih1p5+Iw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:39844 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 1mmvMh-0000MT-AN; Tue, 16 Nov 2021 10:06:59 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1mmvMg-0078ba-Se; Tue, 16 Nov 2021 10:06:58 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Felix Fietkau , John Crispin , Mark Lee , Matthias Brugger , Sean Wang Cc: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH net-next 4/4] net: mtk_eth_soc: use phylink_generic_validate() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 16 Nov 2021 10:06:58 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211116_020703_454239_638657A4 X-CRM114-Status: GOOD ( 10.07 ) 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_eth_soc has no special behaviour in its validation implementation, so can be switched to phylink_generic_validate(). Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 53 ++------------------- 1 file changed, 4 insertions(+), 49 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 98f9a6ed9584..de4152e2e3e4 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -463,56 +463,8 @@ static void mtk_mac_link_up(struct phylink_config *config, mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id)); } -static void mtk_validate(struct phylink_config *config, - unsigned long *supported, - struct phylink_link_state *state) -{ - __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; - - phylink_set_port_modes(mask); - phylink_set(mask, Autoneg); - - switch (state->interface) { - case PHY_INTERFACE_MODE_TRGMII: - phylink_set(mask, 1000baseT_Full); - break; - case PHY_INTERFACE_MODE_1000BASEX: - phylink_set(mask, 1000baseX_Full); - break; - case PHY_INTERFACE_MODE_2500BASEX: - phylink_set(mask, 2500baseX_Full); - break; - case PHY_INTERFACE_MODE_GMII: - case PHY_INTERFACE_MODE_RGMII: - case PHY_INTERFACE_MODE_RGMII_ID: - case PHY_INTERFACE_MODE_RGMII_RXID: - case PHY_INTERFACE_MODE_RGMII_TXID: - phylink_set(mask, 1000baseT_Half); - fallthrough; - case PHY_INTERFACE_MODE_SGMII: - phylink_set(mask, 1000baseT_Full); - phylink_set(mask, 1000baseX_Full); - fallthrough; - case PHY_INTERFACE_MODE_MII: - case PHY_INTERFACE_MODE_RMII: - case PHY_INTERFACE_MODE_REVMII: - default: - phylink_set(mask, 10baseT_Half); - phylink_set(mask, 10baseT_Full); - phylink_set(mask, 100baseT_Half); - phylink_set(mask, 100baseT_Full); - break; - } - - phylink_set(mask, Pause); - phylink_set(mask, Asym_Pause); - - linkmode_and(supported, supported, mask); - linkmode_and(state->advertising, state->advertising, mask); -} - static const struct phylink_mac_ops mtk_phylink_ops = { - .validate = mtk_validate, + .validate = phylink_generic_validate, .mac_pcs_get_state = mtk_mac_pcs_get_state, .mac_an_restart = mtk_mac_an_restart, .mac_config = mtk_mac_config, @@ -2971,6 +2923,9 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) mac->phylink_config.dev = ð->netdev[id]->dev; mac->phylink_config.type = PHYLINK_NETDEV; + mac->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | + MAC_10 | MAC_100 | MAC_1000 | MAC_2500FD; + __set_bit(PHY_INTERFACE_MODE_MII, mac->phylink_config.supported_interfaces); __set_bit(PHY_INTERFACE_MODE_GMII,