diff mbox series

[u-boot,v2019.04-aspeed-openbmc,2/4] phy: Only create NCSI PHY when it's present

Message ID 20220610080059.2333501-3-joel@jms.id.au
State New
Headers show
Series Better NCSI support | expand

Commit Message

Joel Stanley June 10, 2022, 8 a.m. UTC
phy_connect would unconditionally create a NCSI PHY device if the driver
was configured.

By detecting what the phy type is at runtime we can support NCSI and
non-NCSI system with the same defconfig,

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 drivers/net/phy/phy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Cédric Le Goater June 10, 2022, 8:37 a.m. UTC | #1
On 6/10/22 10:00, Joel Stanley wrote:
> phy_connect would unconditionally create a NCSI PHY device if the driver
> was configured.
> 
> By detecting what the phy type is at runtime we can support NCSI and
> non-NCSI system with the same defconfig,
> 
> Signed-off-by: Joel Stanley <joel@jms.id.au>

Reviewed-by: Cédric Le Goater <clg@kaod.org>


Thanks,

C.


> ---
>   drivers/net/phy/phy.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index a0f7b7964464..8e70746a1e76 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -932,7 +932,8 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr,
>   #endif
>   
>   #ifdef CONFIG_PHY_NCSI
> -	phydev = phy_device_create(bus, 0, PHY_NCSI_ID, false, interface);
> +	if (interface == PHY_INTERFACE_MODE_NCSI)
> +		phydev = phy_device_create(bus, 0, PHY_NCSI_ID, false, interface);
>   #endif
>   
>   	if (!phydev)
Joel Stanley June 16, 2022, 12:37 p.m. UTC | #2
On Fri, 10 Jun 2022 at 08:37, Cédric Le Goater <clg@kaod.org> wrote:
>
> On 6/10/22 10:00, Joel Stanley wrote:
> > phy_connect would unconditionally create a NCSI PHY device if the driver
> > was configured.
> >
> > By detecting what the phy type is at runtime we can support NCSI and
> > non-NCSI system with the same defconfig,
> >
> > Signed-off-by: Joel Stanley <joel@jms.id.au>
>
> Reviewed-by: Cédric Le Goater <clg@kaod.org>

Merged, thanks.
diff mbox series

Patch

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index a0f7b7964464..8e70746a1e76 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -932,7 +932,8 @@  struct phy_device *phy_connect(struct mii_dev *bus, int addr,
 #endif
 
 #ifdef CONFIG_PHY_NCSI
-	phydev = phy_device_create(bus, 0, PHY_NCSI_ID, false, interface);
+	if (interface == PHY_INTERFACE_MODE_NCSI)
+		phydev = phy_device_create(bus, 0, PHY_NCSI_ID, false, interface);
 #endif
 
 	if (!phydev)