Re: SoCFPGA ethernet broken

From: Florian Fainelli
Date: Fri Oct 16 2015 - 14:18:31 EST


On 16/10/15 08:56, Andrew Lunn wrote:
>> So I think I'll move to inspect what Florian had suggested, and that was to look
>> at: drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c::stmmac_mdio_register
>
> I have a suspicion. If you look at the phy driver it does:
>
> static int ksz9021_config_init(struct phy_device *phydev)
> {
> const struct device *dev = &phydev->dev;
> const struct device_node *of_node = dev->of_node;
>
> if (!of_node && dev->parent->of_node)
> of_node = dev->parent->of_node;
>
>
> In your case, you don't have a phy node in your device tree, so of_node
> is NULL. So it looks in the parent device.
>
> phylib: Make PHYs children of their MDIO bus, not the bus' parent.
>
> changed what the parent is. It is now the mdio device. Before, i
> suspect it was the MAC. Hence it found your properties in the MAC
> node.
>
> What i think you might want to do is change this code. Rather than
> look a dev->parent->of_node; you might want
> phydev->attached_dev->dev->of_node.

Yes, that would work, by the time config_init() executes, you are
guaranteed to have a valid attached_dev pointer.

>
> This assumes the phy has been attached to the MAC. I've no idea of the
> ordering, so maybe it has not been attached yet?
>
> dp83867.c has similar code. However quick grep did not find any
> mainline users with properties in the MAC node. If that is true, i
> would suggest removing the code looking in the parent for that phy
> driver.

I think we should fix these drivers to look for these properties where
they were used to, as a short term plan, and then make sure that their
binding document is very specific about the fact that these properties,
are by definition, properties of the Ethernet PHY, not the Ethernet MAC.
--
Florian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/