Thread (7 messages) 7 messages, 4 authors, 2019-10-16

Re: lan78xx and phy_state_machine

From: Heiner Kallweit <hkallweit1@gmail.com>
Date: 2019-10-14 20:20:46
Also in: linux-arm-kernel

On 14.10.2019 21:51, Stefan Wahren wrote:
[add more recipients]

Am 14.10.19 um 21:25 schrieb Daniel Wagner:
quoted
On Mon, Oct 14, 2019 at 05:30:04PM +0100, Russell King - ARM Linux admin wrote:
quoted
On Mon, Oct 14, 2019 at 04:06:04PM +0200, Daniel Wagner wrote:
quoted
Hi,

I've trying to boot a RPi 3 Model B+ in 64 bit mode. While I can get
my configuratin booting with v5.2.20, the current kernel v5.3.6 hangs
when initializing the eth interface.

Is this a know issue? Some configuration issues?
I don't see any successfully probed ethernet devices in the boot log, so
I've no idea which of the multitude of ethernet drivers to look at.  I
thought maybe I could look at the DT, but I've no idea where
"arm/bcm2837-rpi-3-b-plus.dts" is located, included by
arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b-plus.dts.
Sorry about being so terse. I thought, the RPi devices are well known. My bad.
Anyway, the kernel reports that is the lan78xx driver.

ls -1 /sys/class/net/ | grep -v lo | xargs -n1 -I{} bash -c 'echo -n {} :" " ; basename `readlink -f /sys/class/net/{}/device/driver`'
eth0 : lan78xx
quoted
The oops is because the PHY state machine has been started, but there
is no phydev->adjust_link set.  Can't say much more than that without
knowing what the driver is doing.
This was a good tip! After a few printks I figured out what is happening.

phy_connect_direct()
   phy_attach_direct()
     workqueue
       phy_check_link_status()
         phy_link_change
Interesting is just what is special with your config that this issue
didn't occur yet on other systems.
quoted
Moving the phy_prepare_link() up in phy_connect_direct() ensures that
phydev->adjust_link is set when the phy_check_link_status() is called.
diff --git a/drivers/net/phy/phy_device.c
b/drivers/net/phy/phy_device.c index 9d2bbb13293e..2a61812bcb0d 100644
--- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c
@@ -951,11 +951,12 @@ int phy_connect_direct(struct net_device *dev,
struct phy_device *phydev, if (!dev) return -EINVAL;

+       phy_prepare_link(phydev, handler);
+
        rc = phy_attach_direct(dev, phydev, phydev->dev_flags, interface);
        if (rc)
If phy_attach_direct() fails we may have to reset phydev->adjust_link to NULL,
as we do in phy_disconnect(). Apart from that change looks good to me.
quoted
                return rc;

-       phy_prepare_link(phydev, handler);
        if (phy_interrupt_is_valid(phydev))
                phy_request_interrupt(phydev);

_______________________________________________
linux-rpi-kernel mailing list
linux-rpi-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rpi-kernel
Heiner
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help