[PATCH u-boot v2019.04-aspeed-openbmc 1/4] net: phy: ncsi: Add phy_interface_is_ncsi() helper
Joel Stanley
joel at jms.id.au
Fri Jun 10 18:00:56 AEST 2022
From: Cédric Le Goater <clg at kaod.org>
and use it to avoid configuring NCSI in net_loop() when the DT has no
support for it.
Signed-off-by: Cédric Le Goater <clg at kaod.org>
Signed-off-by: Joel Stanley <joel at jms.id.au>
---
include/phy.h | 2 ++
drivers/net/phy/phy.c | 7 +++++++
net/net.c | 2 +-
3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/include/phy.h b/include/phy.h
index ed21775f3bbc..a759d04038a3 100644
--- a/include/phy.h
+++ b/include/phy.h
@@ -287,6 +287,8 @@ static inline bool phy_interface_is_sgmii(struct phy_device *phydev)
phydev->interface <= PHY_INTERFACE_MODE_QSGMII;
}
+bool phy_interface_is_ncsi(void);
+
/* PHY UIDs for various PHYs that are referenced in external code */
#define PHY_UID_CS4340 0x13e51002
#define PHY_UID_CS4223 0x03e57003
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index daea26c451fe..a0f7b7964464 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -988,3 +988,10 @@ int phy_get_interface_by_name(const char *str)
return -1;
}
+
+bool phy_interface_is_ncsi(void)
+{
+ struct eth_pdata *pdata = dev_get_platdata(eth_get_dev());
+
+ return pdata->phy_interface == PHY_INTERFACE_MODE_NCSI;
+}
diff --git a/net/net.c b/net/net.c
index f0f9cd4d946b..8449445bf65c 100644
--- a/net/net.c
+++ b/net/net.c
@@ -409,7 +409,7 @@ int net_loop(enum proto_t protocol)
debug_cond(DEBUG_INT_STATE, "--- net_loop Entry\n");
#ifdef CONFIG_PHY_NCSI
- if (protocol != NCSI && !ncsi_active()) {
+ if (phy_interface_is_ncsi() && protocol != NCSI && !ncsi_active()) {
printf("Configuring NCSI\n");
if (net_loop(NCSI) < 0)
return ret;
--
2.35.1
More information about the openbmc
mailing list