From patchwork Wed Aug 30 09:21:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 13370069 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 436D21C08 for ; Wed, 30 Aug 2023 09:21:40 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19A1819A; Wed, 30 Aug 2023 02:21:38 -0700 (PDT) Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lukma@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 90B5A80275; Wed, 30 Aug 2023 11:21:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1693387296; bh=8gcFOC/2uBV9d6Zh6OBWuDG8T9992HsFPQ8XUQ9AYYc=; h=From:To:Cc:Subject:Date:From; b=kx5VvspDtHYkAP1o9+LbpHM5F8xUEufZhJ1X6vmAffyF62M7m6bKwuVi/dNTw2Qg5 n/b+GxJXmMWndywlIhvmrLQprYUSMKrGe9G6JFEID4vcElNrbPqBp6VOib7gWlTsFX WxI+uEYgWDsPS9sYPpCbbIg36EckkxU4ZxEh2xwRP4RRZ5/bGfweReU2U2Ln0BmHnB 6piHv2M5XAQWtqTxKcrlBa4DKctObjD2qEnbGk7AgtlZ0/dB7ZwRYijoTmxzSmzQ6C nWDgIUd5VA0PJbTozwTBipBaVvUZFk42B/XsJycVF9F7A+aDN9XVtdHGmJot79qPEq UY0xRm5K4otfw== From: Lukasz Majewski To: Eric Dumazet , Andrew Lunn , davem@davemloft.net, Woojung Huh , Vladimir Oltean , Oleksij Rempel Cc: Tristram.Ha@microchip.com, Florian Fainelli , Jakub Kicinski , Paolo Abeni , UNGLinuxDriver@microchip.com, Russell King , Heiner Kallweit , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Lukasz Majewski Subject: [PATCH 1/2] net: phy: Rename KSZ9477 get features function (to ksz9131_get_features) Date: Wed, 30 Aug 2023 11:21:18 +0200 Message-Id: <20230830092119.458330-1-lukma@denx.de> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org The KSZ9131 differs in supported features from KSZ9477 - namely in the EEE (Energy Efficient Ethernet) support. To prepare the code for upcoming changes the ksz9477_get_features has been renamed to ksz9131_get_features. Signed-off-by: Lukasz Majewski --- drivers/net/phy/micrel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index b6d7981b2d1e..87b090ad2874 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -1398,7 +1398,7 @@ static int ksz9131_config_aneg(struct phy_device *phydev) return genphy_config_aneg(phydev); } -static int ksz9477_get_features(struct phy_device *phydev) +static int ksz9131_get_features(struct phy_device *phydev) { int ret; @@ -4829,7 +4829,7 @@ static struct phy_driver ksphy_driver[] = { .resume = kszphy_resume, .cable_test_start = ksz9x31_cable_test_start, .cable_test_get_status = ksz9x31_cable_test_get_status, - .get_features = ksz9477_get_features, + .get_features = ksz9131_get_features, }, { .phy_id = PHY_ID_KSZ8873MLL, .phy_id_mask = MICREL_PHY_ID_MASK, @@ -4871,7 +4871,7 @@ static struct phy_driver ksphy_driver[] = { .handle_interrupt = kszphy_handle_interrupt, .suspend = genphy_suspend, .resume = genphy_resume, - .get_features = ksz9477_get_features, + .get_features = ksz9131_get_features, } }; module_phy_driver(ksphy_driver); From patchwork Wed Aug 30 09:21:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 13370070 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 48DEB1C10 for ; Wed, 30 Aug 2023 09:21:40 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73338CCB; Wed, 30 Aug 2023 02:21:38 -0700 (PDT) Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lukma@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 428BA864EF; Wed, 30 Aug 2023 11:21:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1693387296; bh=8vxd2qPCpP6m2nYudlDH5tbegJ9wBVvB3PF1O86stzU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C1DJodv45zfCQqRv/NeXJL8jLT/pbfn0bfkbs8hXNptSsHmq/vP7KSPgrZV33woan i8LP/1OQVxiBVWzSRZTomxKGwPMa4kGcDqDc3/7vDGrVP5exdGMekrlSl0Mf9ZEYkR DpfkVTAmbnbhsrBkZv5vz2YOroZZQwxrDAxOK+xAnzx7BQoJSeQ+esNML7kiBBfyLh 7d092I8jtm8xcxyuc1r3hHf81SF0QinLrmUAp64+wn4KxNhcIsnPdcy8grALUbKYBB E1j+hVPghC/qoSEAPdNr/7JOJ+mxayC8agS2Qey2SC3DeO7lypYHxVKvLE4VVawbbz vvDw2rHEl7NsQ== From: Lukasz Majewski To: Eric Dumazet , Andrew Lunn , davem@davemloft.net, Woojung Huh , Vladimir Oltean , Oleksij Rempel Cc: Tristram.Ha@microchip.com, Florian Fainelli , Jakub Kicinski , Paolo Abeni , UNGLinuxDriver@microchip.com, Russell King , Heiner Kallweit , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Lukasz Majewski Subject: [PATCH 2/2] net: phy: Provide Module 4 KSZ9477 errata (DS80000754C) Date: Wed, 30 Aug 2023 11:21:19 +0200 Message-Id: <20230830092119.458330-2-lukma@denx.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230830092119.458330-1-lukma@denx.de> References: <20230830092119.458330-1-lukma@denx.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org The KSZ9477 errata points out (in 'Module 4') the link up/down problem when EEE (Energy Efficient Ethernet) is enabled in the device to which the KSZ9477 tries to auto negotiate. The suggested workaround is to clear advertisement of EEE for PHYs in this chip driver. Signed-off-by: Lukasz Majewski --- drivers/net/phy/micrel.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 87b090ad2874..469dcd8a5711 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -1418,6 +1418,35 @@ static int ksz9131_get_features(struct phy_device *phydev) return 0; } +static int ksz9477_get_features(struct phy_device *phydev) +{ + __ETHTOOL_DECLARE_LINK_MODE_MASK(zero) = { 0, }; + int ret; + + ret = genphy_read_abilities(phydev); + if (ret) + return ret; + + /* KSZ9477 Errata DS80000754C + * + * Module 4: Energy Efficient Ethernet (EEE) feature select must be + * manually disabled + * The EEE feature is enabled by default, but it is not fully + * operational. It must be manually disabled through register + * controls. If not disabled, the PHY ports can auto-negotiate + * to enable EEE, and this feature can cause link drops when linked + * to another device supporting EEE. + * + * Although, the KSZ9477 MMD register + * (MMD_DEVICE_ID_EEE_ADV.MMD_EEE_ADV) advertise that EEE is + * operational one needs to manualy clear them to follow the chip + * errata. + */ + linkmode_and(phydev->supported_eee, phydev->supported, zero); + + return 0; +} + #define KSZ8873MLL_GLOBAL_CONTROL_4 0x06 #define KSZ8873MLL_GLOBAL_CONTROL_4_DUPLEX BIT(6) #define KSZ8873MLL_GLOBAL_CONTROL_4_SPEED BIT(4) @@ -4871,7 +4900,7 @@ static struct phy_driver ksphy_driver[] = { .handle_interrupt = kszphy_handle_interrupt, .suspend = genphy_suspend, .resume = genphy_resume, - .get_features = ksz9131_get_features, + .get_features = ksz9477_get_features, } }; module_phy_driver(ksphy_driver);