[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230127142621.1761278-2-yoshihiro.shimoda.uh@renesas.com>
Date: Fri, 27 Jan 2023 23:26:18 +0900
From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>
To: linux@...linux.org.uk, andrew@...n.ch, hkallweit1@...il.com,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com
Cc: netdev@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>
Subject: [PATCH net-next v4 1/4] net: phylink: Set host_interfaces for a non-sfp PHY
If a new flag (ovr_host_interfaces) in the phylink_config is set,
overwrite the host_interfaces in the phy_device by link_interface.
Note that an ethernet PHY driver like marvell10g will check
PHY_INTERFACE_MODE_SGMII in the host_interfaces whther the host
controller supports a rate matching interface mode or not. So, set
PHY_INTERFACE_MODE_SGMII to the host_interfaces if it is set in
the supported_interfaces.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>
---
drivers/net/phy/phylink.c | 11 +++++++++++
include/linux/phylink.h | 3 +++
2 files changed, 14 insertions(+)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 319790221d7f..dee64b4a1175 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1814,6 +1814,17 @@ int phylink_fwnode_phy_connect(struct phylink *pl,
pl->link_config.interface = pl->link_interface;
}
+ if (pl->config->ovr_host_interfaces) {
+ __set_bit(pl->link_interface, phy_dev->host_interfaces);
+
+ /* An ethernet PHY driver will check PHY_INTERFACE_MODE_SGMII
+ * in the host_interfaces whether the host controller supports
+ * a rate matching interface mode or not.
+ */
+ if (test_bit(PHY_INTERFACE_MODE_SGMII, pl->config->supported_interfaces))
+ __set_bit(PHY_INTERFACE_MODE_SGMII, phy_dev->host_interfaces);
+ }
+
ret = phy_attach_direct(pl->netdev, phy_dev, flags,
pl->link_interface);
if (ret) {
diff --git a/include/linux/phylink.h b/include/linux/phylink.h
index c492c26202b5..c8dd53b1e857 100644
--- a/include/linux/phylink.h
+++ b/include/linux/phylink.h
@@ -124,6 +124,8 @@ enum phylink_op_type {
* if MAC link is at %MLO_AN_FIXED mode.
* @mac_managed_pm: if true, indicate the MAC driver is responsible for PHY PM.
* @ovr_an_inband: if true, override PCS to MLO_AN_INBAND
+ * @ovr_host_interfaces: if true, override host_interfaces of phy_device from
+ * link_interface.
* @get_fixed_state: callback to execute to determine the fixed link state,
* if MAC link is at %MLO_AN_FIXED mode.
* @supported_interfaces: bitmap describing which PHY_INTERFACE_MODE_xxx
@@ -137,6 +139,7 @@ struct phylink_config {
bool poll_fixed_state;
bool mac_managed_pm;
bool ovr_an_inband;
+ bool ovr_host_interfaces;
void (*get_fixed_state)(struct phylink_config *config,
struct phylink_link_state *state);
DECLARE_PHY_INTERFACE_MASK(supported_interfaces);
--
2.25.1
Powered by blists - more mailing lists