BUG report: sun4i-emac and mdio-sun4i

Maxime Ripard maxime at cerno.tech
Wed May 10 08:22:18 PDT 2023


Hi,

On Wed, May 10, 2023 at 05:40:25PM +0800, qianfan wrote:
> Hi:
> 
> Now the linux driver for allwinner sun4i emac has split two seprate drivers,
> emac and mdio. But there has minor problem.
> 
> Most of resources such as clk are prepared when emac driver loaded, and the mdio
> driver can't work if the clk is not enabled.
> 
> So if we reigster mdio driver before emac driver, the top level will read phy's
> id right now when mdio driver registed. But the emac resoure have not prepared
> that will cause sun4i_mdio_read always return zero.
> 
> Listen mdio_access trace event, and then 'insmod mdio-sun4i.ko' you can find
> the read result: (all of the register are read as zero)
> 
> insmod-3744 ..: mdio_access: 1c0b080.mdio-mii read  phy:0x00 reg:0x02 val:0x0000
> insmod-3744 ..: mdio_access: 1c0b080.mdio-mii read  phy:0x00 reg:0x03 val:0x0000
> 
> That will cause phy_id always zero, the phy's special driver can not loaded:
> $ cat /sys/bus/mdio_bus/devices/1c0b080.mdio-mii\:00/phy_id
> 0x00000000
> 
> I had tried capture the mdc/mdio bus signal, noting is sent.
> 
> If both mdio-sun4i.c and sun4i-emac.c drivers are built with Y, the kernel
> will always load mdio-sun4i.c first.
> 
> So can we find a easy was to make sure mdio driver are loaded later, at least
> after emac driver? Or merge those two drivers?

Why not enable the clock from the MDIO driver as well?

Maxime
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20230510/21a408d9/attachment.sig>


More information about the linux-arm-kernel mailing list