[PATCH v1] net: phy: fix motorcomm module automatic loading

Peter Geis pgwipeout at gmail.com
Sat Apr 30 09:31:27 PDT 2022


On Sat, Apr 30, 2022 at 11:52 AM Andrew Lunn <andrew at lunn.ch> wrote:
>
> > Good Morning,
> >
> > After testing various configurations I found what is actually
> > happening here. When libphy is built in but the phy drivers are
> > modules and not available in the initrd, the generic phy driver binds
> > here. This allows the phy to come up but it is not functional.
>
> What MAC are you using?

Specifically Motorcomm, but I've discovered it can happen with any of
the phy drivers with the right kconfig.

>
> Why is you interface being brought up by the initramfs? Are you using
> NFS root from within the initramfs?

This was discovered with embedded programming. It's common to have a
small initramfs, or forgo an initramfs altogether. Another cause is a
mismatch in kernel config where phylib is built in because of a
dependency, but the rest of the phy drivers are modular.
The key is:
- phylib is built in
- ethernet driver is built in
- the phy driver is a module
- modules aren't available at probe time (for any reason).

In this case phylib assumes there is no driver, when the vast majority
of phys now have device specific drivers.It seems this is an unsafe
assumption as this means there is now an implicit dependency of the
device specific phy drivers and phylib. It just so happens to work
simply because both broadcom and realtek, some of the more common
phys, have explicit dependencies elsewhere that cause them to be built
in as well.

>
> What normally happens is that the kernel loads, maybe with the MAC
> driver and phylib loading, as part of the initramfs. The other modules
> in the initramfs allow the root filesystem to be found, mounted, and
> pivoted into it. The MAC driver is then brought up by the initscripts,
> which causes phylib to request the needed PHY driver modules, it loads
> and all is good.
>
> If you are using NFS root, then the load of the PHY driver happens
> earlier, inside the initramfs. If this is you situation, maybe the
> correct fix is to teach the initramfs tools to include the PHY drivers
> when NFS root is being used?
>
>      Andrew



More information about the Linux-rockchip mailing list