[PATCH v2] ARM: dts: aspeed: Add a palmetto board (AST2400)

Cédric Le Goater clg at kaod.org
Fri Jun 10 17:54:29 AEST 2022


On 6/10/22 08:49, Joel Stanley wrote:
>> No because of NCSI support. net_loop() would need some tweak to
>> avoid configuring NCSI if the DT has no advertise support.
>>
>> Here is a tentative try below, tested on the AST2500 EVB.
> 
> Thanks for the patch. I tested it in qemu for rainier (p10bmc) and
> ast2600 evb + CONFIG_PHY_NCSI=y and it worked.
> 
>   I then tested on hardware and it failed, as it seems we're still
> trying to talk ncsi. Here's the call stack when running 'dhcp' from
> the u-boot command line:
> 
> #0  ncsi_startup (phydev=0xbcf76bc8) at ../drivers/net/phy/ncsi.c:862
> #1  0xbef95e28 in ftgmac100_start (dev=<optimized out>) at
> ../drivers/net/ftgmac100.c:378
> #2  0xbefbf488 in eth_init () at ../net/eth-uclass.c:275
> #3  0xbefc0814 in net_loop (protocol=DHCP) at ../net/net.c:426
> 
> ftgmac100_phy_init is calling phy_connect, and it's connecting the
> ncsi phy driver:
> 
> struct phy_device *phy_connect(struct mii_dev *bus, int addr,
>                                 struct eth_device *dev,
>                                 phy_interface_t interface)
> {
>          struct phy_device *phydev = NULL;
>          uint mask = (addr > 0) ? (1 << addr) : 0xffffffff;
> 
> #ifdef CONFIG_PHY_FIXED
>          phydev = phy_connect_fixed(bus, dev, interface);
> #endif
> 
> #ifdef CONFIG_PHY_NCSI
>          phydev = phy_device_create(bus, 0, PHY_NCSI_ID, false, interface);
> #endif

That's ugly :/ and we have the ncsi information in the caller.

> This logic will need to be fixed so we only set ncsi if the device
> tree specifies it.

yes. Something like :

@@ -932,7 +932,13 @@ struct phy_device *phy_connect(struct mi
  #endif
  
  #ifdef CONFIG_PHY_NCSI
-	phydev = phy_device_create(bus, 0, PHY_NCSI_ID, false, interface);
+	{
+		struct eth_pdata *pdata = dev_get_platdata(dev);
+
+		if (pdata->phy_interface == PHY_INTERFACE_MODE_NCSI)
+			phydev = phy_device_create(bus, 0, PHY_NCSI_ID,
+						   false, interface);
+	}
  #endif
  
  	if (!phydev)


?

C.


>> Subject: [PATCH] net: phy: ncsi: Add phy_interface_is_ncsi() helper
> 
>> --- 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.3
>>
>>
>>



More information about the openbmc mailing list