Message ID | 20220610080059.2333501-2-joel@jms.id.au |
---|---|
State | New |
Headers | show |
Series | Better NCSI support | expand |
On Fri, 10 Jun 2022 at 08:01, Joel Stanley <joel@jms.id.au> wrote: > > From: Cédric Le Goater <clg@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@kaod.org> > Signed-off-by: Joel Stanley <joel@jms.id.au> I've merged this too. > --- > 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 >
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;