RE: [PATCH] net: stmmac: platform: Fix MDIO init for platforms without PHY

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Heiko Stübner <heiko@xxxxxxxxx>
> Subject: Re: [PATCH] net: stmmac: platform: Fix MDIO init for platforms
without
> PHY
> 
> Hi Florian,
> 
> Am Sonntag, 5. Januar 2020, 23:22:00 CET schrieb Florian Fainelli:
> > On 1/5/2020 12:43 PM, Heiko Stübner wrote:
> > > Am Samstag, 21. Dezember 2019, 06:29:18 CET schrieb David Miller:
> > >> From: Padmanabhan Rajanbabu <p.rajanbabu@xxxxxxxxxxx>
> > >> Date: Thu, 19 Dec 2019 15:47:01 +0530
> > >>
> > >>> The current implementation of "stmmac_dt_phy" function initializes
> > >>> the MDIO platform bus data, even in the absence of PHY. This fix
> > >>> will skip MDIO initialization if there is no PHY present.
> > >>>
> > >>> Fixes: 7437127 ("net: stmmac: Convert to phylink and remove phylib
> > >>> logic")
> > >>> Acked-by: Jayati Sahu <jayati.sahu@xxxxxxxxxxx>
> > >>> Signed-off-by: Sriram Dash <sriram.dash@xxxxxxxxxxx>
> > >>> Signed-off-by: Padmanabhan Rajanbabu <p.rajanbabu@xxxxxxxxxxx>
> > >>
> > >> Applied and queued up for -stable, thanks.
> > >
> > > with this patch applied I now run into issues on multiple rockchip
> > > platforms using a gmac interface.
> >
> > Do you have a list of DTS files that are affected by any chance? For
> > the 32-bit platforms that I looked it, it seems like:
> >

Hi Florian, 
We have listed down the platforms which will break for as they don?t have
the mdio / snps,dwmac-mdio node.
Arm32 spear* , Arm32 ox820*, arm32 rv1108, arc abilis* , arc axs10x*, arc
vdk_axs10x*, mips pistachio, arm64 rockchip/px30* There might be more
platforms.

> > arch/arm/boot/dts/rk3228-evb.dts is OK because it has a MDIO bus node
> > arch/arm/boot/dts/rk3229-xms6.dts is also OK
> >
> > arch/arm/boot/dts/rk3229-evb.dts is probably broken, there is no
> > phy-handle property or MDIO bus node, so it must be relying on
> > auto-scanning of the bus somehow that this patch broke.
> >
> > And likewise for most 64-bit platforms except a1 and nanopi4.
> 
> I primarily noticed that on the px30-evb.dts and the internal board I'm
working
> on right now. Both don't have that mdio bus node right now.
> 
> 
> > > When probing the driver and trying to establish a connection for a
> > > nfsroot it always runs into a null pointer in mdiobus_get_phy():
> > >
> > > [   26.878839] rk_gmac-dwmac ff360000.ethernet: IRQ eth_wake_irq not
> found
> > > [   26.886322] rk_gmac-dwmac ff360000.ethernet: IRQ eth_lpi not found
> > > [   26.894505] rk_gmac-dwmac ff360000.ethernet: PTP uses main clock
> > > [   26.908209] rk_gmac-dwmac ff360000.ethernet: clock input or output?
> (output).

... snip ...

> > >
> > >
> > > This is torvalds git head and it was still working at -rc1 and all
> > > kernels before that. When I just revert this commit, things also
> > > start working again, so I guess something must be wrong here?
> >
> > Yes, this was also identified to be problematic by the kernelci boot
> > farms on another platform, see [1].
> >
> > [1]:
> > https://lore.kernel.org/linux-arm-kernel/5e0314da.1c69fb81.a7d63.29c1@
> > mx.google.com/
> >
> > Do you mind trying this patch and letting me know if it works for you.
> > Sriram, please also try it on your platforms and let me know if solves
> > the problem you were after. Thanks
> 
> Works on both boards I had that were affected, so
> Tested-by: Heiko Stuebner <heiko@xxxxxxxxx>

Nacked-by : Sriram Dash <Sriram.dash@xxxxxxxxxxx>

> 
> 
> Thanks
> Heiko
> 
> >
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> > b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> > index cc8d7e7bf9ac..e192b8e0809e 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> > @@ -320,7 +320,7 @@ static int stmmac_mtl_setup(struct platform_device
> > *pdev,  static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
> >                          struct device_node *np, struct device *dev)
> > {
> > -       bool mdio = false;
> > +       bool mdio = true;
> >         static const struct of_device_id need_mdio_ids[] = {
> >                 { .compatible = "snps,dwc-qos-ethernet-4.10" },
> >                 {},
> > @@ -341,8 +341,9 @@ static int stmmac_dt_phy(struct
> > plat_stmmacenet_data *plat,
> >         }
> >
> >         if (plat->mdio_node) {

For the platforms which neither have mdio nor snps,dwmac-mdio property in
dt, they will not enter the block.
plat->mdio_node will always be false for them. Which, essentially, preserves
the mdio variable Boolean value defined at the start of the function.

> > -               dev_dbg(dev, "Found MDIO subnode\n");
> > -               mdio = true;
> > +               mdio = of_device_is_available(plat->mdio_node);
> > +               dev_dbg(dev, "Found MDIO subnode, status: %sabled\n",
> > +                       mdio ? "en" : "dis");
> >         }
> >
> >         if (mdio) {
> >
> 
> 
> 

There is a proposal for this problem solution. You can refer it at :
https://lkml.org/lkml/2020/1/7/14







[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux