Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp4045458rdb; Wed, 30 Aug 2023 13:51:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFAppnMLczALaQ57+K2kKeoqAuKp1EjOklL6v3K72/doYZlVEJmvYbnJcD5wqI8rbY/GyPW X-Received: by 2002:a17:90a:4982:b0:26c:f9a5:4493 with SMTP id d2-20020a17090a498200b0026cf9a54493mr3265850pjh.5.1693428689183; Wed, 30 Aug 2023 13:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693428689; cv=none; d=google.com; s=arc-20160816; b=eZ+B0/YRNvbHUZeJXfCsM88WsABf+Yohi9wBk69H4lsQiy0+nJLpoTLFuMKvGrCpqA v/f1vZozWzZRQFmRkDKNrcl7Vyec4uATTPWVf/dSJAdwkPa0O3apbXH2S5qfvz+gDUe5 PRujJADDU3CEAcKbpDMItELY/TzyfHd8mkqdLxC/OQQbzBmbviKhpiblt2IM/mOxdpe7 mo595B+gpoILhYtP2ofe2IyIrI3fuJIkH81U2hqSXf6XG2W/7KnQWTRuQRGtKrMsPeKD YFoFMfKh54Ud3qxy7kscS0FKYGarPbTP7+v0uIk+RT9TrJLny1qbp3CpiRc6BhBlq+9c j4HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=yoHvd6PxXFofdplCvUrbGZyd9gC30oXsz8mYClwsGCU=; fh=5DdKXyzHrDcxbf4UC8XWA9cYxHBN+cpxZrdTPX2S8gk=; b=wvJLfj3ItmcCVRhPd/+H0qcB+jCvwF1R9CycoSGYjTbmV/c+fpsf/vwa1deLjMLT3Z j0RR4sRu6ZGoripdDVoXqklrpjDGzw3PBvamehssyqDOTRsLZ1NiiQS33DaTjGOZGKEa o1xnDwkA8FXg5la+KkXGMHYy97FxWDcq65ZodaKgjJBE7vkmap/Tcep0o1tHgdvHnS3Z HtG2iEVNUUM4311uyathWrhl4guW0RmbQYsHLXc9Yt/ZdthBgWtZKN5D8fWFfrdfQnXa FHQYq5cmnsjM5fiFeNL5/oIX8hmLeesHVfYXmRlr+K+3KP0+Yz4bLyyb8rTYRkFUTMmT E83w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v17-20020a17090a899100b00263aff4ccf0si80302pjn.3.2023.08.30.13.51.13; Wed, 30 Aug 2023 13:51:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231819AbjH3S5e (ORCPT + 99 others); Wed, 30 Aug 2023 14:57:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243435AbjH3LAB (ORCPT ); Wed, 30 Aug 2023 07:00:01 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D82A11BF for ; Wed, 30 Aug 2023 03:59:58 -0700 (PDT) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qbIvG-000610-89; Wed, 30 Aug 2023 12:59:42 +0200 Received: from ore by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1qbIvF-000544-3I; Wed, 30 Aug 2023 12:59:41 +0200 Date: Wed, 30 Aug 2023 12:59:41 +0200 From: Oleksij Rempel To: Lukasz Majewski Cc: Eric Dumazet , Andrew Lunn , davem@davemloft.net, Woojung Huh , Vladimir Oltean , 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 Subject: Re: [PATCH 2/2] net: phy: Provide Module 4 KSZ9477 errata (DS80000754C) Message-ID: <20230830105941.GH31399@pengutronix.de> References: <20230830092119.458330-1-lukma@denx.de> <20230830092119.458330-2-lukma@denx.de> <20230830101813.GG31399@pengutronix.de> <20230830125224.1012459f@wsk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230830125224.1012459f@wsk> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 30, 2023 at 12:52:24PM +0200, Lukasz Majewski wrote: > Hi Oleksij, > > > On Wed, Aug 30, 2023 at 11:21:19AM +0200, Lukasz Majewski wrote: > > > 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, > > > > Sorry, i didn't described all details how to implement it. > > > > This code will break EEE support for the KSZ8563R switch. > > > > And then another switch (KSZ8563R) pops up.... with regression.... Initially ksz9477_get_features() was introduced to fix KSZ8563R. > In the micrel.c the ksz9477_get_features was only present in: > https://elixir.bootlin.com/linux/latest/source/drivers/net/phy/micrel.c#L4832 > https://elixir.bootlin.com/linux/latest/source/drivers/net/phy/micrel.c#L4874 > so I only changed it there. > > Apparently the KSZ8563R re-uses the KSZ9477 code. Most (all?) switch variant support by the ksz9477 DSA driver share the same PHYid, so it is not possible to identify it by the micrel.c PHY driver. As far as a know, the only commonly accepted way to notify about some quirks between this both drivers is not user dev_flags. Regards, Oleskij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |