[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231207171941.dhgch5fs6mmke7v7@skbuf>
Date: Thu, 7 Dec 2023 19:19:41 +0200
From: Vladimir Oltean <olteanv@...il.com>
To: Luiz Angelo Daros de Luca <luizluca@...il.com>
Cc: Alvin Šipraga <ALSI@...g-olufsen.dk>,
Krzysztof Kozlowski <krzk@...nel.org>,
"linus.walleij@...aro.org" <linus.walleij@...aro.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"andrew@...n.ch" <andrew@...n.ch>,
"f.fainelli@...il.com" <f.fainelli@...il.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"kuba@...nel.org" <kuba@...nel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"arinc.unal@...nc9.com" <arinc.unal@...nc9.com>
Subject: Re: [net-next 2/2] net: dsa: realtek: load switch variants on demand
On Mon, Nov 27, 2023 at 07:24:16PM -0300, Luiz Angelo Daros de Luca wrote:
> The "realtek_smi_setup_mdio()" used in setup_interface isn't really
> necessary (like it happens in realtek-mdio). It could be used (or not)
> by both interfaces. The "realtek,smi-mdio" compatible string is
> misleading, indicating it might be something specific to the SMI
> interface HW while it is just how the driver was implemented. A
> "realtek,slave_mdio" or "realtek,user_mii" would be better.
The compatible string is about picking a driver for a device. It is
supposed to uniquely describe the register layout and functionality of
that IP block, not its functional role in the kernel. "slave_mdio" and
"user_mii" are too ingrained with "this MDIO controller gives access to
internal PHY ports of DSA slave ports".
Even if the MDIO controller doesn't currently have its own struct device
and driver, you'd have to think of the fact that it could, when picking
an appropriate compatible string.
If you have very specific information that the MDIO controller is based on
some reusable/licensable IP block and there were no modifications made
to it, you could use that compatible string.
Otherwise, another sensible choice would be "realtek,<precise-soc-name>-mdio",
because it leaves room for future extensions with other compatible
strings, more generic or just as specific, that all bind to the same
driver.
It's always good to start being too specific rather than too generic,
because a future Realtek switch might have a different IP block for its
MDIO controller. Then a driver for your existing "realtek,smi-mdio" or
"realtek,slave_mdio" or "realtek,user_mii" compatible string sounds like
it could handle it, but it can't.
You can always add secondary compatible strings to a node, but changing
the existing one breaks the ABI between the kernel and the DT.
Powered by blists - more mailing lists