public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: "Arınç ÜNAL" <arinc.unal@arinc9.com>
Cc: Luiz Angelo Daros de Luca <luizluca@gmail.com>,
	linus.walleij@linaro.org, alsi@bang-olufsen.dk, andrew@lunn.ch,
	f.fainelli@gmail.com, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org
Subject: Re: [PATCH net-next v2 5/7] net: dsa: realtek: Migrate user_mii_bus setup to realtek-dsa
Date: Fri, 22 Dec 2023 12:48:31 +0200	[thread overview]
Message-ID: <20231222104831.js4xiwdklazytgeu@skbuf> (raw)
In-Reply-To: <d74e47b6-ff02-41f4-9929-02109ce39e12@arinc9.com>

On Thu, Dec 21, 2023 at 09:34:52PM +0300, Arınç ÜNAL wrote:
> On 21.12.2023 20:47, Vladimir Oltean wrote:
> > ds->user_mii_bus helps when
> > (1) the switch probes with platform_data (not on OF), or
> > (2) the switch probes on OF but its MDIO bus is not described in OF
> > 
> > Case (2) is also eliminated because realtek_smi_setup_mdio() bails out
> > if it cannot find the "mdio" node described in OF. So the ds->user_mii_bus
> > assignment is only ever executed when the bus has an OF node, aka when
> > it is not useful.
> 
> I don't like the fact that the driver bails out if it doesn't find the
> "mdio" child node. This basically forces the hardware design to use the
> MDIO bus of the switch. Hardware designs which don't use the MDIO bus of
> the switch are perfectly valid.
> 
> It looks to me that, to make all types of hardware designs work, we must
> not use ds->user_mii_bus for switch probes on OF. Case (2) is one of the
> cases of the ethernet controller lacking link definitions in OF so we
> should enforce link definitions on ethernet controllers. This way, we make
> sure all types of hardware designs work and are described in OF properly.
> 
> Arınç

The bindings for the realtek switches can be extended in compatible ways,
e.g. by making the 'mdio' node optional. If we want that to mean "there
is no internal PHY that needs to be used", there is no better time than
now to drop the driver's linkage to ds->user_mii_bus, while its bindings
still strictly require an 'mdio' node.

If we don't drop that linkage _before_ making 'mdio' optional, there
is no way to disprove the existence of device trees which lack a link
description on user ports (which is now possible). So the driver will
always have to pay the penalty of mdiobus_register(ds->user_mii_bus),
which will always enumerate the internal PHYs even if they will end up
unused, as you say should be possible. Listing the MDIO bus in OF
deactivates bus scanning, which speeds up probing and booting in most
cases.

There are other ways to reduce that PHY enumeration pain, like manually
setting the bus->phy_mask and moving code around such that it gets
executed only once in the presence of -EPROBE_DEFER. This is what Klaus
Kudielka had to go through with mv88e6xxx, all because the Turris Omnia
device tree lacks phy-handle to the internal PHYs, his boot time shot up
by a wide margin.
https://lore.kernel.org/lkml/449bde236c08d5ab5e54abd73b645d8b29955894.camel@gmail.com/
commit 2c7e46edbd03 ("net: dsa: mv88e6xxx: mask apparently non-existing phys during probing")
commit 2cb0658d4f88 ("net: dsa: mv88e6xxx: move call to mv88e6xxx_mdios_register()")

We support device trees with 'hidden' switch internal MDIO buses and it
would be unwise to break them. But they are a self-inflicted pain and it
would be even more unwise for me to go on record not discouraging their use.
Honestly, I don't want any more of them.

  reply	other threads:[~2023-12-22 10:48 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-20  4:24 [PATCH net-next v2 0/7] net: dsa: realtek: variants to drivers, interfaces to a common module Luiz Angelo Daros de Luca
2023-12-20  4:24 ` [PATCH net-next v2 1/7] net: dsa: realtek: drop cleanup from realtek_ops Luiz Angelo Daros de Luca
2023-12-20 13:57   ` Alvin Šipraga
2023-12-21 17:04     ` Vladimir Oltean
2023-12-21 20:05       ` Alvin Šipraga
2023-12-22 22:32         ` Luiz Angelo Daros de Luca
2023-12-20  4:24 ` [PATCH net-next v2 2/7] net: dsa: realtek: convert variants into real drivers Luiz Angelo Daros de Luca
2023-12-21 17:08   ` Vladimir Oltean
2023-12-20  4:24 ` [PATCH net-next v2 3/7] net: dsa: realtek: common realtek-dsa module Luiz Angelo Daros de Luca
2023-12-20 10:40   ` Alvin Šipraga
2023-12-20 15:50     ` Alvin Šipraga
2023-12-21  3:25       ` Luiz Angelo Daros de Luca
2023-12-21  3:11     ` Luiz Angelo Daros de Luca
2023-12-20  4:24 ` [PATCH net-next v2 4/7] net: dsa: realtek: merge common and interface modules into realtek-dsa Luiz Angelo Daros de Luca
2023-12-20  4:24 ` [PATCH net-next v2 5/7] net: dsa: realtek: Migrate user_mii_bus setup to realtek-dsa Luiz Angelo Daros de Luca
2023-12-20  4:51   ` Luiz Angelo Daros de Luca
2023-12-21 17:47     ` Vladimir Oltean
2023-12-21 18:34       ` Arınç ÜNAL
2023-12-22 10:48         ` Vladimir Oltean [this message]
2023-12-22 11:13           ` Alvin Šipraga
2023-12-22 17:04             ` Arınç ÜNAL
2023-12-22 20:28               ` Luiz Angelo Daros de Luca
2023-12-22 20:59                 ` Arınç ÜNAL
2023-12-22 16:56           ` Arınç ÜNAL
2024-01-03 18:44             ` Vladimir Oltean
2024-01-05 18:43               ` Arınç ÜNAL
2023-12-22 20:03       ` Luiz Angelo Daros de Luca
2023-12-22 22:09         ` Vladimir Oltean
2023-12-22 22:12           ` Luiz Angelo Daros de Luca
2023-12-20 13:17   ` Alvin Šipraga
2023-12-21  3:03     ` Luiz Angelo Daros de Luca
2023-12-20  4:24 ` [PATCH net-next v2 6/7] net: dsa: realtek: embed dsa_switch into realtek_priv Luiz Angelo Daros de Luca
2023-12-20  4:24 ` [PATCH net-next v2 7/7] Revert "net: dsa: OF-ware slave_mii_bus" Luiz Angelo Daros de Luca
2023-12-20 13:19   ` Alvin Šipraga
2023-12-21  3:45     ` Luiz Angelo Daros de Luca
2023-12-21  0:41   ` kernel test robot
2023-12-21 15:21 ` [PATCH net-next v2 0/7] net: dsa: realtek: variants to drivers, interfaces to a common module Vladimir Oltean
2023-12-22 21:32   ` Luiz Angelo Daros de Luca

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231222104831.js4xiwdklazytgeu@skbuf \
    --to=olteanv@gmail.com \
    --cc=alsi@bang-olufsen.dk \
    --cc=andrew@lunn.ch \
    --cc=arinc.unal@arinc9.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=luizluca@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox