On Thu, Sep 9, 2021 at 10:49 AM Geert Uytterhoeven <geert+renesas@xxxxxxxxx> wrote: > If an Ethernet PHY reset is asserted when the Ethernet driver is > initialized, the PHY cannot be probed: > > mdio_bus ee700000.ethernet-ffffffff: MDIO device at address 1 is missing > > This happens because the Linux PHY subsystem tries to read the PHY > Identifier registers before handling PHY reset. Hence if the PHY reset > was asserted before, identification fails. > > An easy way to reproduce this issue is by using kexec to launch a new > kernel (the PHY reset will be asserted before starting the new kernel), > or by unbinding and rebinding the Ethernet driver (the PHY reset will be > asserted during unbind), e.g. on koelsch: > > echo ee700000.ethernet > /sys/bus/platform/drivers/sh-eth/unbind > $ echo ee700000.ethernet > /sys/bus/platform/drivers/sh-eth/bind > > The recommended approach[1][2] seems to be working around this issue by > adding compatible values to all ethernet-phy nodes, so Linux can > identify the PHY at any time, without reading the PHY ID from the > device, and regardless of the state of the PHY reset line. > > Hence this patch series adds such compatible values to all Ethernet PHY > subnodes representing PHYs on all boards with Renesas ARM and ARM64 > SoCs. For easier review, I have split the series in one patch per PHY > model. > > On most boards, I could verify the actual PHY ID at runtime[3], on other > boards I had to resort to schematics. > > Kexec and Ethernet driver rebind have been tested on Koelsch and > Salvator-XS. > > I plan to queue these in renesas-devel for v5.16. > > Thanks for your comments! I'd be very grateful for comments (e.g. Acked-by) from the Ethernet PHY people. Thanks again! > [1] "Re: [PATCH] RFC: net: phy: of phys probe/reset issue" > https://lore.kernel.org/r/ade12434-adf2-6ea7-24ce-ce45ad2e1b5e@xxxxxxxxx/ > [2] "PHY reset may still be asserted during MDIO probe" > https://lore.kernel.org/r/CAMuHMdXno2OUHqsAfO0z43JmGkFehD+FJ2dEjEsr_P53oAAPxA@xxxxxxxxxxxxxx > [3] The easiest way to obtain the PHY ID is by adding a debug print to > drivers/net/phy/phy_device.c:get_phy_c22_id(), _before_ applying > this patch. > > Geert Uytterhoeven (9): > ARM: dts: renesas: Add compatible properties to KSZ8041 Ethernet PHYs > ARM: dts: renesas: Add compatible properties to KSZ8081 Ethernet PHYs > ARM: dts: renesas: Add compatible properties to KSZ9031 Ethernet PHYs > iARM: dts: renesas: Add compatible properties to LAN8710A Ethernet > PHYs > ARM: dts: renesas: Add compatible properties to RTL8201FL Ethernet > PHYs > ARM: dts: renesas: Add compatible properties to uPD6061x Ethernet PHYs > arm64: dts: renesas: Add compatible properties to AR8031 Ethernet PHYs > arm64: dts: renesas: Add compatible properties to KSZ9031 Ethernet > PHYs > arm64: dts: renesas: Add compatible properties to RTL8211E Ethernet > PHYs Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds