BUG report: sun4i-emac and mdio-sun4i
Florian Fainelli
f.fainelli at gmail.com
Wed May 10 19:38:12 PDT 2023
On 5/10/2023 7:01 PM, qianfan wrote:
>
>
> 在 2023/5/11 1:27, Florian Fainelli 写道:
>> On 5/10/23 08:22, Maxime Ripard wrote:
>>> 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?
>>
>> Another option is to use a a module soft dependency, e.g.:
>>
>> MODULE_SOFTDEP("pre: mdio-bcm-unimac");
> But MODULE_SOFTDEP can not work if all of the drivers are build with Y
> option.
Yes indeed, Maxime's suggestion is better, or you can explore using
device links maybe?
--
Florian
More information about the linux-arm-kernel
mailing list