[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM4PR11MB6095E66B71484D942DFDB5EDCAAA9@DM4PR11MB6095.namprd11.prod.outlook.com>
Date: Tue, 14 Jun 2022 06:55:34 +0000
From: "Ong, Boon Leong" <boon.leong.ong@...el.com>
To: Alexandre Torgue <alexandre.torgue@...s.st.com>,
Jose Abreu <Jose.Abreu@...opsys.com>,
Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
Paolo Abeni <pabeni@...hat.com>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Vladimir Oltean <olteanv@...il.com>,
Vivien Didelot <vivien.didelot@...il.com>,
"Florian Fainelli" <f.fainelli@...il.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Giuseppe Cavallaro <peppe.cavallaro@...com>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-stm32@...md-mailman.stormreply.com"
<linux-stm32@...md-mailman.stormreply.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Riva, Emilio" <emilio.riva@...csson.com>
Subject: RE: [PATCH net-next v4 5/5] net: stmmac: make mdio register skips PHY
scanning for fixed-link
>diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>index 73cae2938f6..bc8edd88175 100644
>--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>@@ -1141,19 +1141,20 @@ static void stmmac_check_pcs_mode(struct
>stmmac_priv *priv)
> */
> static int stmmac_init_phy(struct net_device *dev)
> {
>+ struct fwnode_handle *fwnode = of_fwnode_handle(priv->plat-
>>phylink_node);
This is an obvious mistake and will be fixed in next revision.
> struct stmmac_priv *priv = netdev_priv(dev);
>- struct device_node *node;
> int ret;
>
>- node = priv->plat->phylink_node;
>+ if (!fwnode)
>+ fwnode = dev_fwnode(priv->device);
>
>- if (node)
>- ret = phylink_of_phy_connect(priv->phylink, node, 0);
>+ if (fwnode)
>+ ret = phylink_fwnode_phy_connect(priv->phylink, fwnode, 0);
>
> /* Some DT bindings do not set-up the PHY handle. Let's try to
> * manually parse it
> */
>- if (!node || ret) {
>+ if (!fwnode || ret) {
> int addr = priv->plat->phy_addr;
> struct phy_device *phydev;
>
>diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
>b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
>index 03d3d1f7aa4..5f177ea8072 100644
>--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
>+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
>@@ -434,9 +434,11 @@ int stmmac_mdio_register(struct net_device *ndev)
> int err = 0;
> struct mii_bus *new_bus;
> struct stmmac_priv *priv = netdev_priv(ndev);
>+ struct fwnode_handle *fwnode = of_fwnode_handle(priv->plat-
>>phylink_node);
> struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat-
>>mdio_bus_data;
> struct device_node *mdio_node = priv->plat->mdio_node;
> struct device *dev = ndev->dev.parent;
>+ struct fwnode_handle *fixed_node;
> int addr, found, max_addr;
>
> if (!mdio_bus_data)
>@@ -490,6 +492,18 @@ int stmmac_mdio_register(struct net_device *ndev)
> if (priv->plat->has_xgmac)
> stmmac_xgmac2_mdio_read(new_bus, 0, MII_ADDR_C45);
>
>+ /* If fixed-link is set, skip PHY scanning */
>+ if (!fwnode)
>+ fwnode = dev_fwnode(priv->device);
>+
>+ if (fwnode) {
>+ fixed_node = fwnode_get_named_child_node(fwnode, "fixed-
>link");
>+ if (fixed_node) {
>+ fwnode_handle_put(fixed_node);
>+ goto bus_register_done;
>+ }
>+ }
>+
> if (priv->plat->phy_node || mdio_node)
> goto bus_register_done;
>
>--
>2.25.1
Powered by blists - more mailing lists