From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C54C0C433E0 for ; Fri, 10 Jul 2020 23:25:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A43242065F for ; Fri, 10 Jul 2020 23:25:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726796AbgGJXZV (ORCPT ); Fri, 10 Jul 2020 19:25:21 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:45877 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726465AbgGJXZV (ORCPT ); Fri, 10 Jul 2020 19:25:21 -0400 X-Originating-IP: 90.65.108.121 Received: from localhost (lfbn-lyo-1-1676-121.w90-65.abo.wanadoo.fr [90.65.108.121]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id A241060002; Fri, 10 Jul 2020 23:25:16 +0000 (UTC) Date: Sat, 11 Jul 2020 01:25:16 +0200 From: Alexandre Belloni To: Andrew Lunn Cc: Oleksij Rempel , Florian Fainelli , Heiner Kallweit , David Jander , "David S. Miller" , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Philippe Schenker , Russell King Subject: Re: [PATCH net-next v3] net: phy: micrel: add phy-mode support for the KSZ9031 PHY Message-ID: <20200710232516.GE3759@piout.net> References: <20200422072137.8517-1-o.rempel@pengutronix.de> <20200710223610.GC3759@piout.net> <20200710225453.GK1014141@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200710225453.GK1014141@lunn.ch> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/07/2020 00:54:53+0200, Andrew Lunn wrote: > On Sat, Jul 11, 2020 at 12:36:10AM +0200, Alexandre Belloni wrote: > > Hi Oleksij, > > > > This patch breaks Ethernet on the sama5d3 Xplained and I have not been > > able to unbreak it. > > Hi Alexandre > > macb0: ethernet@f0028000 { > phy-mode = "rgmii"; > #address-cells = <1>; > #size-cells = <0>; > status = "okay"; > > ethernet-phy@7 { > reg = <0x7>; > }; > }; > > So DT says it wants rgmii. How are the delays being added? Could the > bootloader be configuring the PHY into rgmii-id mode, which is now > getting cleared? Or by strapping of pins on the PHY? > > Also, looking at macb_main.c is seen: > > if (!(bp->caps & MACB_CAPS_USRIO_DISABLED)) { > val = 0; > if (bp->phy_interface == PHY_INTERFACE_MODE_RGMII) > val = GEM_BIT(RGMII); > else if (bp->phy_interface == PHY_INTERFACE_MODE_RMII && > (bp->caps & MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII)) > val = MACB_BIT(RMII); > else if (!(bp->caps & MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII)) > val = MACB_BIT(MII); > > if (bp->caps & MACB_CAPS_USRIO_HAS_CLKEN) > val |= MACB_BIT(CLKEN); > > macb_or_gem_writel(bp, USRIO, val); > } > > I don't know if this applies for your hardware, but if you tried > fixing the PHY by setting phy-mode to "rgmii-id", it could be macb > then did not set GEM_BIT(RGMII) and so broken even more? > This is exactly what happens. I'll send patches. Thanks Andrew! > Rather than bp->phy_interface == PHY_INTERFACE_MODE_RGMII, > phy_interface_mode_is_rgmii() might work better. -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com