[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YshMT3KP/B6BiEIg@shell.armlinux.org.uk>
Date: Fri, 8 Jul 2022 16:25:03 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Vladimir Oltean <olteanv@...il.com>
Cc: Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Alvin __ipraga <alsi@...g-olufsen.dk>,
Claudiu Manoil <claudiu.manoil@....com>,
"David S. Miller" <davem@...emloft.net>,
DENG Qingfang <dqfext@...il.com>,
Eric Dumazet <edumazet@...gle.com>,
Florian Fainelli <f.fainelli@...il.com>,
George McCollister <george.mccollister@...il.com>,
Hauke Mehrtens <hauke@...ke-m.de>,
Jakub Kicinski <kuba@...nel.org>,
Kurt Kanzenbach <kurt@...utronix.de>,
Landen Chao <Landen.Chao@...iatek.com>,
Linus Walleij <linus.walleij@...aro.org>,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org,
Matthias Brugger <matthias.bgg@...il.com>,
netdev@...r.kernel.org, Paolo Abeni <pabeni@...hat.com>,
Sean Wang <sean.wang@...iatek.com>,
UNGLinuxDriver@...rochip.com,
Vivien Didelot <vivien.didelot@...il.com>,
Woojung Huh <woojung.huh@...rochip.com>,
Marek BehĂșn <kabel@...nel.org>
Subject: Re: [PATCH RFC net-next 5/5] net: dsa: always use phylink for CPU
and DSA ports
Hi,
On Thu, Jul 07, 2022 at 10:37:53PM +0300, Vladimir Oltean wrote:
> +static int dsa_port_fixup_broken_dt(struct dsa_port *dp)
As I mentioned, I doubt that Andrew considers this "broken DT" as he's
been promoting this as a standard DSA feature.
> +{
> + struct property_entry fixed_link_props[] = {
> + PROPERTY_ENTRY_BOOL("full-duplex"),
> + PROPERTY_ENTRY_U32("speed", 1000), /* TODO determine actual speed */
> + {},
> + };
> + struct property_entry port_props[3] = {};
> + struct fwnode_handle *fixed_link_fwnode;
> + struct fwnode_handle *new_port_fwnode;
> + struct device_node *dn = dp->dn;
> + phy_interface_t mode;
> + int err;
> +
> + if (of_parse_phandle(dn, "phy-handle", 0) ||
> + of_phy_is_fixed_link(dn))
> + /* Nothing broken, nothing to fix.
> + * TODO: As discussed with Russell, maybe phylink could provide
> + * a more comprehensive helper to determine what constitutes a
> + * valid fwnode binding than this guerilla kludge.
> + */
> + return 0;
I think this is sufficient. Yes, phylink accepts "phy" and "phy-device"
because it has to for compatibility with other drivers, but the binding
document for DSA quite clearly states that "phy-handle" is what DSA
accepts, so DT in the kernel will be validated against the yaml file
and enforce correctness here.
We do need to check for "sfp" being present as well.
> +
> + err = of_get_phy_mode(dn, &mode);
> + if (err)
> + /* TODO this may be missing too, ask the driver for the
> + * max-speed interface mode for this port
> + */
> + mode = PHY_INTERFACE_MODE_NA;
I think it would be easier to omit the phy-mode property in the swnode
if it isn't present in DT, because then we can handle that in
dsa_port_phylink_create() as I've done in my patch series via the
ds->ops->phylink_get_caps() method.
> +
> + port_props[0] = PROPERTY_ENTRY_U32("reg", dp->index);
You said in one of your other replies that this node we're constructing
is only for phylink, do we need the "reg" property? phylink doesn't care
about it.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists