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=-4.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 A2CFFC433E4 for ; Fri, 17 Jul 2020 15:52:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7F975204EA for ; Fri, 17 Jul 2020 15:52:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hD1B+kLP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726691AbgGQPwX (ORCPT ); Fri, 17 Jul 2020 11:52:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726393AbgGQPwX (ORCPT ); Fri, 17 Jul 2020 11:52:23 -0400 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE5FEC0619D2 for ; Fri, 17 Jul 2020 08:52:22 -0700 (PDT) Received: by mail-lj1-x231.google.com with SMTP id e4so13248894ljn.4 for ; Fri, 17 Jul 2020 08:52:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/6HnM0rm17Hp6WXcEsIjk3YzzVDb/nE/1mH/ciSCW7w=; b=hD1B+kLPfGOipFnSpqzLH+rKbsvSwd5vFf4VVVt0G/0hMoA0g9RNdPZTwuJT8YML5V rZ598Hnmy92grmSggWgkExsWceCu7y2gkA8QT6jlDRhQToPUJ3+uGkQTWvExXx4dn8Fo HAD919WTFakkaYxOXzXPJxGUyCgobAMUhtBTwwnv2tUb6da+dJ76gbOQ7GdR5IznDBg8 4l5j+yFI0OGMuyHcQenz4gClEQJL6UFLJA+Cw4HKTTjplduvLcHzmX+vgcRvdwg0Ayi2 mcjuQPps20mlKAw3TKzo7O7MGoKSAzp25+yEa8T0Eug6UKM1KxOa3FBZ5bwPfVaxxu4n iOWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/6HnM0rm17Hp6WXcEsIjk3YzzVDb/nE/1mH/ciSCW7w=; b=Lu5GTTC58Dkl3ujxxgdrp8/KGqRytKemrroB1kKO1mIDs/vBwZVT6sW9sHtL+CAmVN QimpHhprXQBLQjx8/RzZN0rfg9P+gwRkXOuPe0X1W+tGgMpCJ3UINnJ20aGVt2VQ/Ps1 8xsteHBN/UwZkQLLqW0blbIr601oUjcvX7xyDsAGsXhWlPJgTKjjx0X8njE3D9DkK8Ti r4EK++s5o3k6NEatbUynrSDMU2hyirMiSGUxFkCBJI3V5AfKZkKtxwd7CdaaqES4gQn3 c6YY1XUQkBAvZ+FibzUCOtbPnr+YLkUNZZpAhUsI/R0bL0O6amqaJwZxqjTDMDR/3rdk vboQ== X-Gm-Message-State: AOAM530iBzmwpRg7ao9HPUe6ybrSZSH0HZvqX/52ZLRsZH9S3SUpN+S9 BA7+QSfD4vsIkL5zGOTq8LPg6d5oHyiQdKHdEveav80M X-Google-Smtp-Source: ABdhPJwnsIH5nV3seB9F+zMKTG6rEAAHFog2gD+4nxJrJqNNxUk/baStwohSkAwagalmgX+IY4c0psQuolmgiKV6LpU= X-Received: by 2002:a2e:808d:: with SMTP id i13mr4939787ljg.452.1595001140080; Fri, 17 Jul 2020 08:52:20 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Fabio Estevam Date: Fri, 17 Jul 2020 12:52:08 -0300 Message-ID: Subject: Re: fec: micrel: Ethernet PHY type ID auto-detection issue To: netdev , Andrew Lunn , Florian Fainelli , Russell King - ARM Linux , Heiner Kallweit Cc: Bruno Thomsen , Lars Alex Pedersen Content-Type: text/plain; charset="UTF-8" Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi Bruno, Adding netdev and the Ethernet PHY folks. On Fri, Jul 17, 2020 at 12:48 PM Bruno Thomsen wrote: > > Hi > > I have been having issues with Ethernet PHY type ID > auto-detection when changing from the deprecated fec > phy-reset-{gpios,duration,post-delay} properties to the > modern mdio reset-{assert-us,deassert-us,gpios} > properties in the device tree. > > Hardware: > SoC: i.MX7D > PHY: Mircrel KSZ8081RNB > PHY address: 1 > RMII clock is generated by the Micrel PHY. > > Micrel pin wiring: > CONFIG0: 4k75 PU > CONFIG1: 1k PD > PHYAD0: 4k75 PU > PHYAD1: 1k PD > PHYAD2/RXD1: 1k PD > REXT: 6k49 PD > INTRP: 1k PU > XO+XI: 25MHz xtal > > Kernel trace from working (deprecated fec reset): > kernel: Micrel KSZ8081 or KSZ8091 30be0000.ethernet-1:01: attached PHY driver > [Micrel KSZ8081 or KSZ8091] (mii_bus:phy_addr=30be0000.ethernet-1:01, irq=POLL) > > This way has been working with the mainline kernel 5.2.x-5.7.8. > > Kernel error messages (modem mdio reset): > mdio_bus 30be0000.ethernet-1: MDIO device at address 1 is missing. > fec 30be0000.ethernet eth0: Unable to connect to phy > > When debugging it I end up with the get_phy_device() call not > working inside of_mdiobus_register_phy(). > > A known workaround with modern mdio properties is > to add "ethernet-phy-id0022.1560" as compatible, > but it would be nice to know the root cause of this issue, > so I can enable auto PHY id detection again. > > I have inserted snippets of the device tree below. > > DT common pin mux: > &iomuxc { > pinctrl_enet1: enet1grp { > fsl,pins = < > MX7D_PAD_GPIO1_IO10__ENET1_MDIO > 0x03 /* X2-48 */ > MX7D_PAD_GPIO1_IO11__ENET1_MDC > 0x03 /* X2-46 */ > MX7D_PAD_ENET1_RGMII_TD0__ENET1_RGMII_TD0 > 0x71 /* X2-53 */ > MX7D_PAD_ENET1_RGMII_TD1__ENET1_RGMII_TD1 > 0x71 /* X2-55 */ > MX7D_PAD_ENET1_RGMII_TX_CTL__ENET1_RGMII_TX_CTL > 0x71 /* X2-61 */ > MX7D_PAD_ENET1_RGMII_RD0__ENET1_RGMII_RD0 > 0x79 /* X2-56 */ > MX7D_PAD_ENET1_RGMII_RD1__ENET1_RGMII_RD1 > 0x79 /* X2-58 */ > MX7D_PAD_ENET1_RGMII_RX_CTL__ENET1_RGMII_RX_CTL > 0x79 /* X2-64 */ > MX7D_PAD_ENET1_RGMII_RXC__ENET1_RX_ER > 0x73 /* X2-52 */ > /* PHY reset: SION, 100kPU, SRE_FAST, DSE_X1 */ > MX7D_PAD_ENET1_COL__GPIO7_IO15 > 0x40000070 /* X1-96 */ > /* Clock from PHY to MAC */ > MX7D_PAD_GPIO1_IO12__CCM_ENET_REF_CLK1 > 0x40000073 /* X3-4 */ > >; > }; > }; > > DT working: > &fec1 { > pinctrl-names = "default"; > pinctrl-0 = <&pinctrl_enet1>; > phy-mode = "rmii"; > phy-reset-gpios = <&gpio7 15 GPIO_ACTIVE_LOW>; > phy-reset-duration = <100>; > phy-reset-post-delay = <1000>; > phy-handle = <ðphy>; > status = "okay"; > > mdio { > #address-cells = <1>; > #size-cells = <0>; > ethphy: ethernet-phy@1 { > compatible = "ethernet-phy-ieee802.3-c22"; > reg = <1>; > }; > }; > }; > > DT unable to detect PHY type ID: > &fec1 { > pinctrl-names = "default"; > pinctrl-0 = <&pinctrl_enet1>; > phy-mode = "rmii"; > phy-handle = <ðphy>; > status = "okay"; > > mdio { > #address-cells = <1>; > #size-cells = <0>; > > ethphy: ethernet-phy@1 { > compatible = "ethernet-phy-ieee802.3-c22"; > reg = <1>; > max-speed = <100>; > reset-assert-us = <100000>; > reset-deassert-us = <1000000>; > reset-gpios = <&gpio7 15 GPIO_ACTIVE_LOW>; > }; > }; > }; > > I had a suspicion that it might be caused by a missing interrupt > signal as it runs in poll mode and not irq mode. But fixing that > with the following additions did not fix phy id auto-detection. > > ethphy: ethernet-phy@1 { > interrupt-parent = <&gpio1>; > interrupts = <9 IRQ_TYPE_LEVEL_LOW>; > }; > > pinctrl_enet1: enet1grp { > fsl,pins = < > MX7D_PAD_GPIO1_IO09__GPIO1_IO9 0x40000078 /* X1-80 */ > >; > }; > > But with the mdio reset workaround from above it now uses irq. > > Kernel trace: > kernel: Micrel KSZ8081 or KSZ8091 30be0000.ethernet-1:01: attached PHY driver > [Micrel KSZ8081 or KSZ8091] (mii_bus:phy_addr=30be0000.ethernet-1:01, irq=66) > > Any suggestions that could help locate the root cause of the issue? > > Thanks in advance. > > /Bruno