net: dsa: felix: add functionality when not all ports are supported
authorColin Foster <colin.foster@in-advantage.com>
Fri, 27 Jan 2023 19:35:54 +0000 (11:35 -0800)
committerJakub Kicinski <kuba@kernel.org>
Tue, 31 Jan 2023 05:07:20 +0000 (21:07 -0800)
When the Felix driver would probe the ports and verify functionality, it
would fail if it hit single port mode that wasn't supported by the driver.

The initial case for the VSC7512 driver will have physical ports that
exist, but aren't supported by the driver implementation. Add the
OCELOT_PORT_MODE_NONE macro to handle this scenario, and allow the Felix
driver to continue with all the ports that are currently functional.

Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com> # regression
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/ocelot/felix.c
drivers/net/dsa/ocelot/felix.h

index d3ff6e8..d4cc9e6 100644 (file)
@@ -1273,10 +1273,15 @@ static int felix_parse_ports_node(struct felix *felix,
 
                err = felix_validate_phy_mode(felix, port, phy_mode);
                if (err < 0) {
-                       dev_err(dev, "Unsupported PHY mode %s on port %d\n",
-                               phy_modes(phy_mode), port);
+                       dev_info(dev, "Unsupported PHY mode %s on port %d\n",
+                                phy_modes(phy_mode), port);
                        of_node_put(child);
-                       return err;
+
+                       /* Leave port_phy_modes[port] = 0, which is also
+                        * PHY_INTERFACE_MODE_NA. This will perform a
+                        * best-effort to bring up as many ports as possible.
+                        */
+                       continue;
                }
 
                port_phy_modes[port] = phy_mode;
index 9e1ae1d..d5d0b30 100644 (file)
@@ -7,6 +7,7 @@
 #define ocelot_to_felix(o)             container_of((o), struct felix, ocelot)
 #define FELIX_MAC_QUIRKS               OCELOT_QUIRK_PCS_PERFORMS_RATE_ADAPTATION
 
+#define OCELOT_PORT_MODE_NONE          0
 #define OCELOT_PORT_MODE_INTERNAL      BIT(0)
 #define OCELOT_PORT_MODE_SGMII         BIT(1)
 #define OCELOT_PORT_MODE_QSGMII                BIT(2)