[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <E1o4hhH-004Aor-AF@rmk-PC.armlinux.org.uk>
Date: Fri, 24 Jun 2022 12:41:59 +0100
From: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>
To: Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>
Cc: 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>,
Vladimir Oltean <olteanv@...il.com>,
Woojung Huh <woojung.huh@...rochip.com>
Subject: [PATCH RFC net-next 2/4] net: dsa: mv88e6xxx: report the default
interface mode for the port
Report the maximum speed interface mode for the port, or if we don't
have that information, the hardware configured interface mode for
the port.
This allows phylink to know which interface mode CPU and DSA ports
are operating, which will be necessary when we want to select the
maximum speed for the port (required for such ports without a PHY or
fixed-link specified in firmware.)
Signed-off-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>
---
drivers/net/dsa/mv88e6xxx/chip.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index f98be98551ef..1c6b4b00d58d 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -823,6 +823,7 @@ static void mv88e6xxx_get_caps(struct dsa_switch *ds, int port,
phy_interface_t *default_interface)
{
struct mv88e6xxx_chip *chip = ds->priv;
+ u8 cmode = chip->ports[port].cmode;
chip->info->ops->phylink_get_caps(chip, port, config);
@@ -830,6 +831,14 @@ static void mv88e6xxx_get_caps(struct dsa_switch *ds, int port,
if (mv88e6xxx_phy_is_internal(ds, port))
__set_bit(PHY_INTERFACE_MODE_GMII,
config->supported_interfaces);
+
+ if (chip->info->ops->port_max_speed_mode)
+ *default_interface = chip->info->ops->port_max_speed_mode(port);
+ else if (cmode < ARRAY_SIZE(mv88e6xxx_phy_interface_modes) &&
+ mv88e6xxx_phy_interface_modes[cmode])
+ *default_interface = mv88e6xxx_phy_interface_modes[cmode];
+ else if (cmode == MV88E6XXX_PORT_STS_CMODE_RGMII)
+ *default_interface = PHY_INTERFACE_MODE_RGMII;
}
static void mv88e6xxx_mac_config(struct dsa_switch *ds, int port,
--
2.30.2
Powered by blists - more mailing lists