Re: [PATCH net-next] net: dsa: mt7530: register OF node for internal MDIO bus

From: Arınç ÜNAL
Date: Wed Dec 27 2023 - 14:51:31 EST


On 27.12.2023 22:11, Vladimir Oltean wrote:
On Sun, Dec 24, 2023 at 10:37:12AM +0300, Arınç ÜNAL wrote:
If the MDIO bus of the switch is defined on the devicetree, the
(!ds->user_mii_bus && ds->ops->phy_read) check in dsa_switch_setup will be
true so the MDIO bus will be attempted to be registered again, resulting in
a kernel panic.

Where does mt7530 provide ds->ops->phy_read() in upstream?

Sorry, that's a misdiagnosis from my part. There's indeed no
ds->ops->phy_read() or ds->ops->phy_write(). I should know that as I have
intensively studied the MDIO bus registration on all DSA subdrivers. The
issue is at mt7530_setup_mdio_irq():

ds->user_mii_bus->irq[p] = irq;

I didn't realise ds->user_mii_bus is also used to store irq mapping for
each PHY. Should we agree that user_mii_bus is needed for all cases or make
another way to store the irq mappings?

Arınç