Skip to contentSkip to conversation

ARM: dts: aspeed: Add a palmetto board (AST2400)

PATCH Superseded Cédric Le Goater 3 participants 6 messages Jun 8, 2022 – Jun 10, 2022

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ARM: dts: aspeed: Add a palmetto board (AST2400)

Palmettos were the first OpenPOWER systems built by Tyan with the product name: GN70-BP010. They contained an IBM POWER8 Turismo SCM processor and an Aspeed AST2400 SoC.

The ast2400_openbmc_defconfig defconfig is based on the evb-ast2400 defconfig, plus these extras :

CONFIG_BOOTCOMMAND="bootm 20080000"
CONFIG_DEFAULT_DEVICE_TREE="ast2400-palmetto"
CONFIG_PHY_NCSI=y

---

Changes in v2 :

- device tree cleanups to match HW
- renamed defconfig to ast2400_openbmc_defconfig

 arch/arm/dts/Makefile             |  1 +
 arch/arm/dts/ast2400-palmetto.dts | 74 +++++++++++++++++++++++++++++++
 configs/ast2400_openbmc_defconfig | 72 ++++++++++++++++++++++++++++++
 3 files changed, 147 insertions(+)
 create mode 100644 arch/arm/dts/ast2400-palmetto.dts
 create mode 100644 configs/ast2400_openbmc_defconfig
arch/arm/dts/Makefile +1 -0
index 8f876a0aa0d7..1d523c5d5da0 100755
@@ -676,6 +676,7 @@ dtb-$(CONFIG_ARCH_BCM6858) += \
 
 dtb-$(CONFIG_ARCH_ASPEED) += \
 	ast2400-evb.dtb \
+	ast2400-palmetto.dtb \
 	ast2400-ahe-50dc.dtb \
 	ast2500-evb.dtb \
 	ast2600a0-evb.dtb \
arch/arm/dts/ast2400-palmetto.dts new file +74 -0

74 lines not on this page · raw message

configs/ast2400_openbmc_defconfig new file +72 -0

72 lines not on this page · raw message

Signature · 1 line
2.35.3
#1 lore raw
Quoted 32 lines · Cédric Le Goater

Palmettos were the first OpenPOWER systems built by Tyan with the product name: GN70-BP010. They contained an IBM POWER8 Turismo SCM processor and an Aspeed AST2400 SoC.

The ast2400_openbmc_defconfig defconfig is based on the evb-ast2400 defconfig, plus these extras :

CONFIG_BOOTCOMMAND="bootm 20080000"
CONFIG_DEFAULT_DEVICE_TREE="ast2400-palmetto"
CONFIG_PHY_NCSI=y

---

Changes in v2 :

- device tree cleanups to match HW
- renamed defconfig to ast2400_openbmc_defconfig

arch/arm/dts/Makefile             |  1 +
arch/arm/dts/ast2400-palmetto.dts | 74 +++++++++++++++++++++++++++++++
configs/ast2400_openbmc_defconfig | 72 ++++++++++++++++++++++++++++++
3 files changed, 147 insertions(+)

create mode 100644 arch/arm/dts/ast2400-palmetto.dts create mode 100644 configs/ast2400_openbmc_defconfig

arch/arm/dts/Makefile +0 -0
index 8f876a0aa0d7..1d523c5d5da0 100755

arch/arm/dts/Makefile dtb-$(CONFIG_ARCH_BCM6858) += \ · line 680

Quoted 5 lines
arch/arm/dts/Makefile +1 -0
@@ -676,6 +676,7 @@ dtb-$(CONFIG_ARCH_BCM6858) += \
 
 dtb-$(CONFIG_ARCH_ASPEED) += \
 	ast2400-evb.dtb \
+	ast2400-palmetto.dtb \
 	ast2400-ahe-50dc.dtb \

Sort? (palmetto after ahe-50dc)

Quoted 15 lines
arch/arm/dts/Makefile +0 -0
 	ast2500-evb.dtb \
 	ast2600a0-evb.dtb \
arch/arm/dts/ast2400-palmetto.dts new file +7 -0
new file mode 100644
index 000000000000..2a49ded27b43
@@ -0,0 +1,74 @@
+// SPDX-License-Identifier: GPL-2.0+
+/dts-v1/;
+
+#include "ast2400-u-boot.dtsi"
+
+/ {
+	model = "Palmetto BMC";

arch/arm/dts/ast2400-palmetto.dts line 17

Quoted 10 lines
arch/arm/dts/ast2400-palmetto.dts new file +10 -0
+	compatible = "tyan,palmetto-bmc", "aspeed,ast2400";
+
+	memory@40000000 {
+		device_type = "memory";
+		reg = <0x40000000 0x10000000>;
+	};
+
+	chosen {
+		stdout-path = &uart5;
+		bootargs = "console=ttyS4,115200 earlyprintk";

Does bootargs serve a particular purpose here? (The other ast2x00 device-trees don't appear to include it.)

configs/ast2400_openbmc_defconfig

Quoted 62 lines
arch/arm/dts/ast2400-palmetto.dts new file +57 -0
+	};
+
+	aliases {
+		spi0 = &fmc;
+		spi1 = &spi1;
+		ethernet0 = &mac0;
+	};
+};
+
+&uart5 {
+	u-boot,dm-pre-reloc;
+	status = "okay";
+};
+
+&sdrammc {
+	clock-frequency = <200000000>;
+};
+
+&wdt1 {
+	u-boot,dm-pre-reloc;
+	status = "okay";
+};
+
+&wdt2 {
+	u-boot,dm-pre-reloc;
+	status = "okay";
+};
+
+&mac0 {
+	status = "okay";
+	phy-mode = "rgmii";
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_mac1link_default &pinctrl_mdio1_default>;
+};
+
+&fmc {
+	status = "okay";
+	flash@0 {
+		status = "okay";
+		spi-max-frequency = <50000000>;
+		spi-tx-bus-width = <2>;
+		spi-rx-bus-width = <2>;
+	};
+};
+
+&spi1 {
+	status = "okay";
+	flash@0 {
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_spi1_default>;
+		status = "okay";
+		spi-max-frequency = <50000000>;
+		spi-tx-bus-width = <2>;
+		spi-rx-bus-width = <2>;
+	};
+};
configs/ast2400_openbmc_defconfig new file +0 -0
new file mode 100644
index 000000000000..d09358777304

Is the implication here that the testing discussed in the v1 thread (using the existing evb defconfig instead of an entirely new one) didn't work out?

Quoted 76 lines
configs/ast2400_openbmc_defconfig new file +72 -0
@@ -0,0 +1,72 @@
+CONFIG_ARM=y
+CONFIG_ARCH_ASPEED=y
+CONFIG_SYS_TEXT_BASE=0x0
+CONFIG_ASPEED_AST2400=y
+CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_ENV_SIZE=0x10000
+CONFIG_ENV_OFFSET=0xF0000
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_FIT=y
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="console=ttyS4,115200n8 root=/dev/ram rw"
+CONFIG_USE_BOOTCOMMAND=y
+CONFIG_BOOTCOMMAND="bootm 20080000"
+CONFIG_PRE_CONSOLE_BUFFER=y
+CONFIG_PRE_CON_BUF_ADDR=0x1e720000
+CONFIG_SYS_CONSOLE_ENV_OVERWRITE=y
+CONFIG_HUSH_PARSER=y
+# CONFIG_AUTO_COMPLETE is not set
+CONFIG_SYS_PROMPT="ast# "
+# CONFIG_CMD_IMI is not set
+# CONFIG_CMD_XIMG is not set
+CONFIG_CMD_MEMTEST=y
+CONFIG_SYS_ALT_MEMTEST=y
+CONFIG_CMD_CLK=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_SF=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
+CONFIG_DEFAULT_DEVICE_TREE="ast2400-palmetto"
+CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_USE_ENV_SPI_BUS=y
+CONFIG_ENV_SPI_BUS=0
+CONFIG_USE_ENV_SPI_CS=y
+CONFIG_ENV_SPI_CS=0
+CONFIG_USE_ENV_SPI_MAX_HZ=y
+CONFIG_ENV_SPI_MAX_HZ=100000000
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_REGMAP=y
+CONFIG_CLK=y
+CONFIG_DM_GPIO=y
+CONFIG_ASPEED_GPIO=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_ASPEED=y
+CONFIG_MISC=y
+CONFIG_DM_MMC=y
+# CONFIG_MMC_HW_PARTITIONING is not set
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_ASPEED=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_MACRONIX=y
+CONFIG_SPI_FLASH_SPANSION=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_PHY_REALTEK=y
+CONFIG_PHY_NCSI=y
+CONFIG_DM_ETH=y
+CONFIG_PHY_GIGE=y
+CONFIG_FTGMAC100=y
+CONFIG_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_DM_SERIAL=y
+CONFIG_SYS_NS16550=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_SYSRESET=y
+CONFIG_TIMER=y
+CONFIG_WDT=y
+# CONFIG_EFI_LOADER is not set
Signature · 1 line
2.35.3
#2 lore raw
Quoted 34 lines · Zev Weiss
Quoted 33 lines · Cédric Le Goater

Palmettos were the first OpenPOWER systems built by Tyan with the product name: GN70-BP010. They contained an IBM POWER8 Turismo SCM processor and an Aspeed AST2400 SoC.

The ast2400_openbmc_defconfig defconfig is based on the evb-ast2400 defconfig, plus these extras :

CONFIG_BOOTCOMMAND="bootm 20080000"
CONFIG_DEFAULT_DEVICE_TREE="ast2400-palmetto"
CONFIG_PHY_NCSI=y

---

Changes in v2 :

- device tree cleanups to match HW
- renamed defconfig to ast2400_openbmc_defconfig

arch/arm/dts/Makefile             |  1 +
arch/arm/dts/ast2400-palmetto.dts | 74 +++++++++++++++++++++++++++++++
configs/ast2400_openbmc_defconfig | 72 ++++++++++++++++++++++++++++++
3 files changed, 147 insertions(+)

create mode 100644 arch/arm/dts/ast2400-palmetto.dts create mode 100644 configs/ast2400_openbmc_defconfig

arch/arm/dts/Makefile +0 -0
index 8f876a0aa0d7..1d523c5d5da0 100755
@@ -676,6 +676,7 @@ dtb-$(CONFIG_ARCH_BCM6858) += \
 
Quoted 6 lines

arch/arm/dts/Makefile dtb-$(CONFIG_ARCH_BCM6858) += \ · line 680

Quoted 4 lines
arch/arm/dts/Makefile +1 -0
 dtb-$(CONFIG_ARCH_ASPEED) += \
 	ast2400-evb.dtb \
+	ast2400-palmetto.dtb \
 	ast2400-ahe-50dc.dtb \

Sort? (palmetto after ahe-50dc)

yes.

Quoted 21 lines
Quoted 21 lines
arch/arm/dts/Makefile +0 -0
 	ast2500-evb.dtb \
 	ast2600a0-evb.dtb \
arch/arm/dts/ast2400-palmetto.dts new file +12 -0
new file mode 100644
index 000000000000..2a49ded27b43
@@ -0,0 +1,74 @@
+// SPDX-License-Identifier: GPL-2.0+
+/dts-v1/;
+
+#include "ast2400-u-boot.dtsi"
+
+/ {
+	model = "Palmetto BMC";
+	compatible = "tyan,palmetto-bmc", "aspeed,ast2400";
+
+	memory@40000000 {
+		device_type = "memory";
+		reg = <0x40000000 0x10000000>;
Quoted 8 lines

arch/arm/dts/ast2400-palmetto.dts line 17

Quoted 5 lines
arch/arm/dts/ast2400-palmetto.dts new file +5 -0
+	};
+
+	chosen {
+		stdout-path = &uart5;
+		bootargs = "console=ttyS4,115200 earlyprintk";

Does bootargs serve a particular purpose here? (The other ast2x00 device-trees don't appear to include it.)

It is useless indeed.

Quoted 58 lines
Quoted 58 lines
arch/arm/dts/ast2400-palmetto.dts new file +57 -0
+	};
+
+	aliases {
+		spi0 = &fmc;
+		spi1 = &spi1;
+		ethernet0 = &mac0;
+	};
+};
+
+&uart5 {
+	u-boot,dm-pre-reloc;
+	status = "okay";
+};
+
+&sdrammc {
+	clock-frequency = <200000000>;
+};
+
+&wdt1 {
+	u-boot,dm-pre-reloc;
+	status = "okay";
+};
+
+&wdt2 {
+	u-boot,dm-pre-reloc;
+	status = "okay";
+};
+
+&mac0 {
+	status = "okay";
+	phy-mode = "rgmii";
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_mac1link_default &pinctrl_mdio1_default>;
+};
+
+&fmc {
+	status = "okay";
+	flash@0 {
+		status = "okay";
+		spi-max-frequency = <50000000>;
+		spi-tx-bus-width = <2>;
+		spi-rx-bus-width = <2>;
+	};
+};
+
+&spi1 {
+	status = "okay";
+	flash@0 {
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_spi1_default>;
+		status = "okay";
+		spi-max-frequency = <50000000>;
+		spi-tx-bus-width = <2>;
+		spi-rx-bus-width = <2>;
+	};
+};
configs/ast2400_openbmc_defconfig +0 -0
Quoted 8 lines

configs/ast2400_openbmc_defconfig

Quoted 4 lines

new file mode 100644
index 000000000000..d09358777304

configs/ast2400_openbmc_defconfig new file +0 -0

Is the implication here that the testing discussed in the v1 thread (using the existing evb defconfig instead of an entirely new one) didn't work out?

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,

C.

From b621c15390719197357554f52f340aaa87dc80d4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= <[email protected]>
Date: Wed, 8 Jun 2022 15:06:53 +0200
Subject: [PATCH] net: phy: ncsi: Add phy_interface_is_ncsi() helper
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

and use it to avoid configuring NCSI in net_loop() when the DT has no support for it.

---
 include/phy.h         | 2 ++
 drivers/net/phy/phy.c | 7 +++++++
 net/net.c             | 2 +-
 3 files changed, 10 insertions(+), 1 deletion(-)
include/phy.h +2 -0
index ed21775f3bbc..a759d04038a3 100644
@@ -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
drivers/net/phy/phy.c +7 -0
index daea26c451fe..a0f7b7964464 100644
@@ -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;
+}
net/net.c +1 -1
index f0f9cd4d946b..8449445bf65c 100644
@@ -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;
Signature · 1 line
2.35.3
#3 lore raw
Quoted 4 lines

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

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

Quoted 35 lines

Subject: [PATCH] net: phy: ncsi: Add phy_interface_is_ncsi() helper

drivers/net/phy/phy.c +7 -0
@@ -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;
+}
net/net.c +1 -2
index f0f9cd4d946b..8449445bf65c 100644
@@ -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

#4 lore raw
Quoted 28 lines · Joel Stanley
Quoted 4 lines

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;
Quoted 7 lines
#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.

Quoted 2 lines

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.

Quoted 35 lines
Quoted 35 lines

Subject: [PATCH] net: phy: ncsi: Add phy_interface_is_ncsi() helper

drivers/net/phy/phy.c +7 -0
@@ -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;
+}
net/net.c +1 -2
index f0f9cd4d946b..8449445bf65c 100644
@@ -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

#5 lore raw
Quoted 62 lines · Cédric Le Goater
Quoted 28 lines · Joel Stanley
Quoted 4 lines

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;
Quoted 7 lines
#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.

Quoted 2 lines

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

yes. Something like :

(quoted diff) +7 -1
@@ -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)
Quoted 1 line

?

I have something a little different. I'll send it out in a moment.

Quoted 40 lines

C.

Quoted 35 lines
Quoted 35 lines

Subject: [PATCH] net: phy: ncsi: Add phy_interface_is_ncsi() helper

drivers/net/phy/phy.c +7 -0
@@ -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;
+}
net/net.c +1 -2
index f0f9cd4d946b..8449445bf65c 100644
@@ -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