Hi Dave,

I made a bit of a mistake; I did not realize there is a new clocks binding 
already mainline:
https://lore.kernel.org/netdev/20230605154010.49611-2-detlev.casan...@collabora.com/T/#u

That patch puts the clock under control of the PHY driver, so in theory it 
should have worked without Andre's patch at all, as long as the clock was a 
property of the PHY node. It seems only the Realtek driver handles it for now, 
but that wouldn't be a problem in your case.

> Dave Johnson writes:
> > If I list the phy as discoverable, it isn't detected as the
> > clocks/reset aren't setup: 
> > 
> >     compatible = "ethernet-phy-ieee802.3-c22";
> > 
> >   [    1.273000] mdio_bus stmmac-0: MDIO device at address 0 is missing.
> > 

While looking through the netdev archives, I found someone is already working 
on this, too, but it looks like it's not going to be mainline anytime soon:
https://lore.kernel.org/netdev/13590315.F0gNSz5aLb@diego/T/#t

> > 
> > Or if I list the phy specifically, mdiobus_register_clock() does get
> > called, but mdio_device_toggle_clock() is never called:
> > 
> >     compatible = "ethernet-phy-id001c.c816";
> > 
> >   [    1.448000] mdio_bus stmmac-0:00: Resources present before probing
> > 
> 
> OK, I've found the problem.
> 
> The patch mentioned https://oftc.irclog.whitequark.org/linux-sunxi/
2023-02-14 seems incomplete.
> 
> The assumption that clocks only need to be enabled/disabled at
> mdio_probe()/mdio_remove() isn't correct. mdio_device_reset() is also
> called from phy_device_reset() and those calls are the only ones prior
> to probe, so probing for the phy needs the clocks too.
> 
> When mdio_device_reset() is called from phy_device_reset() we also
> need to enable/disable clocks along with the reset.
> 
> The previous mdio_device_toggle_clock() also resulted in some warnings
> as it tried to disable clocks when they were already disabled,
> something the clock subsystem doesn't like.
> 
> Will throw together a patch shortly.

Still haven't been able to test locally yet, but hopefully tomorrow.

Kind regards,
Matt


-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/22132610.EfDdHjke4D%40mt-dell-tumbleweed.

Reply via email to