Received: by 2002:a05:7412:3210:b0:e2:908c:2ebd with SMTP id eu16csp648825rdb; Thu, 31 Aug 2023 23:10:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHidW0CoI8SVGX10G3/SvG0F93hXdQWaHBf9gjqmV8aYeQF/2qnbg35J6GFwen1HCCLjKVk X-Received: by 2002:a05:6a20:3254:b0:12d:23ea:9ccc with SMTP id hm20-20020a056a20325400b0012d23ea9cccmr1548877pzc.39.1693548658690; Thu, 31 Aug 2023 23:10:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693548658; cv=none; d=google.com; s=arc-20160816; b=sGv86yqqkhxA/lAHLs9rHF0jCxfy1XjKfy/GmYPjPf7yVkWkRfy1YFqudEV7K43HU3 DaUhmHKg1mcDgs6l6T89V8itH+Jm+K09GdJr1NrBIY4RIq07bPvwDb0ECzUmc1bsCQqM gDD6J1QYe/sQc+DtmU/xFloiUAS8BOVGoVFKFEHiCrPxhOk/rcf/uENHY5te54D616Tp D6FWnCytWuQzkIvey4pHr8nSCA1PPzBHUl+47c1CbPrnwRRTTC16BaOqIODgOhPkrFYo LlSh0ekgYIwu0yMTGAgDsCZmSklJR/QgBvCOy/XfDEguKwope4ecTVhJvgq4FbqzzBhM oUhA== 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=hDSfLc9K5SyiOPLg9+K1lA75f80oYOUlJz9LcrTK/Hw=; fh=cdTQSf6lk7qdn3BMdJzX9zC1+DO2AwKOTWXtbI7pexE=; b=Clr8tIM9QnLWH1YTQK9XYUBrRvIjR64gL4fBXX4UWexxR6vSmBzSYgfIT79BsCmQIY qrSq/GkInhbCJUoK0t+M954MAUJshetM8S7RQWwEJRg/P8LNm1byGKem0WOzEyrqg8V5 xp17IcGr49i0SdKUk+JNSZQ9/e8NB67N4dWzAp8TVgENCz9+QyykTMEt3rvrGVMR7Y7E 9lZxRFKyrosNT3N65gTO5vlKeQO9CIzZZtw8nlAO8x26qmYcHbT1HRuY/v78Uw6pbHyy w4j4iKDYBnrrPNHhX9b+xdeXH2Pgi5PNgi/WdY+9ngv0Mq0UwxgZKn3RhrFSa7BTHK/B KJdQ== 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 jj17-20020a170903049100b001bba53994acsi2297050plb.243.2023.08.31.23.10.53; Thu, 31 Aug 2023 23:10:58 -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 S242792AbjHaKhk (ORCPT + 28 others); Thu, 31 Aug 2023 06:37:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229613AbjHaKhj (ORCPT ); Thu, 31 Aug 2023 06:37:39 -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 18236CF3 for ; Thu, 31 Aug 2023 03:37:36 -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 1qbf31-0002Kq-EB; Thu, 31 Aug 2023 12:37:11 +0200 Received: from ore by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1qbf2z-00067y-Fd; Thu, 31 Aug 2023 12:37:09 +0200 Date: Thu, 31 Aug 2023 12:37:09 +0200 From: Oleksij Rempel To: "Russell King (Oracle)" Cc: Lukasz Majewski , Tristram.Ha@microchip.com, Eric Dumazet , Andrew Lunn , davem@davemloft.net, Woojung Huh , Vladimir Oltean , Florian Fainelli , Jakub Kicinski , Paolo Abeni , UNGLinuxDriver@microchip.com, Heiner Kallweit , Michael Walle , Horatiu Vultur , Arun Ramadoss , Oleksij Rempel , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] net: phy: Provide Module 4 KSZ9477 errata (DS80000754C) Message-ID: <20230831103709.GC17603@pengutronix.de> References: <20230831072527.537839-1-lukma@denx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 Thu, Aug 31, 2023 at 11:28:00AM +0100, Russell King (Oracle) wrote: > On Thu, Aug 31, 2023 at 09:25:27AM +0200, Lukasz Majewski wrote: > > diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h > > index 8bef1ab62bba..eed474fc7308 100644 > > --- a/include/linux/micrel_phy.h > > +++ b/include/linux/micrel_phy.h > > @@ -44,6 +44,7 @@ > > #define MICREL_PHY_50MHZ_CLK 0x00000001 > > #define MICREL_PHY_FXEN 0x00000002 > > #define MICREL_KSZ8_P1_ERRATA 0x00000003 > > +#define MICREL_NO_EEE 0x00000004 > > Erm... Maybe someone should clarify this... we have in the code the > following tests for these "flags": > > /* Support legacy board-file configuration */ > if (phydev->dev_flags & MICREL_PHY_50MHZ_CLK) { > priv->rmii_ref_clk_sel = true; > priv->rmii_ref_clk_sel_val = true; > } > > /* Skip auto-negotiation in fiber mode */ > if (phydev->dev_flags & MICREL_PHY_FXEN) { > phydev->speed = SPEED_100; > return 0; > } > > if (phydev->dev_flags & MICREL_KSZ8_P1_ERRATA) > return -EOPNOTSUPP; > > /* According to KSZ9477 Errata DS80000754C (Module 4) all EEE modes > * in this switch shall be regarded as broken. > */ > if (phydev->dev_flags & MICREL_NO_EEE) > phydev->eee_broken_modes = -1; > > Is it intentional that setting MICREL_PHY_50MHZ_CLK on its own also > activates the MICREL_KSZ8_P1_ERRATA and vice versa? Is it intentional > that setting MICREL_PHY_FXEN also activates MICREL_KSZ8_P1_ERRATA and > vice versa? > > To me, this looks horribly broken, and this patch just perpetuates the > brokenness (but at least 0x4 doesn't overlap with the other flags.) > > If it is intentional, then MICREL_KSZ8_P1_ERRATA should be defined to > make it explicit - in other words, as > (MICREL_PHY_FXEN|MICREL_PHY_50MHZ_CLK). If not, all these flags should > be defined using (1 << n) or BIT() to make it explicit that they're a > bit, and not just a hex number that gets incremented when the next flag > is added. Indeed, it is broken. I'll send a fix for this one. MICREL_KSZ8_P1_ERRATA should be BIT(3) and MICREL_NO_EEE BIT(4) Thx! Regards, Oleksij -- 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 |