BUG report: sun4i-emac and mdio-sun4i

qianfan qianfanguijin at 163.com
Wed May 10 18:59:02 PDT 2023



在 2023/5/10 23:22, Maxime Ripard 写道:
> 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?
I am not sure the mdio driver can work if noly enable the clock.
There are some emac registers init when sun4i-emac driver is loaded.
>
> Maxime




More information about the linux-arm-kernel mailing list