All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ARM: dts: aspeed: Add a palmetto board (AST2400)
@ 2022-06-08  8:22 Cédric Le Goater
  2022-06-08 10:17 ` Zev Weiss
  0 siblings, 1 reply; 6+ messages in thread
From: Cédric Le Goater @ 2022-06-08  8:22 UTC (permalink / raw)
  To: openbmc; +Cc: Joel Stanley, 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

Cc: Joel Stanley <joel@jms.id.au>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---

 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

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 8f876a0aa0d7..1d523c5d5da0 100755
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -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 \
diff --git a/arch/arm/dts/ast2400-palmetto.dts b/arch/arm/dts/ast2400-palmetto.dts
new file mode 100644
index 000000000000..2a49ded27b43
--- /dev/null
+++ b/arch/arm/dts/ast2400-palmetto.dts
@@ -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>;
+	};
+
+	chosen {
+		stdout-path = &uart5;
+		bootargs = "console=ttyS4,115200 earlyprintk";
+	};
+
+	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>;
+	};
+};
diff --git a/configs/ast2400_openbmc_defconfig b/configs/ast2400_openbmc_defconfig
new file mode 100644
index 000000000000..d09358777304
--- /dev/null
+++ b/configs/ast2400_openbmc_defconfig
@@ -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
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] ARM: dts: aspeed: Add a palmetto board (AST2400)
  2022-06-08  8:22 [PATCH v2] ARM: dts: aspeed: Add a palmetto board (AST2400) Cédric Le Goater
@ 2022-06-08 10:17 ` Zev Weiss
  2022-06-08 13:08   ` Cédric Le Goater
  0 siblings, 1 reply; 6+ messages in thread
From: Zev Weiss @ 2022-06-08 10:17 UTC (permalink / raw)
  To: Cédric Le Goater; +Cc: openbmc, Joel Stanley

On Wed, Jun 08, 2022 at 01:22:21AM PDT, Cédric Le Goater wrote:
>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
>
>Cc: Joel Stanley <joel@jms.id.au>
>Signed-off-by: Cédric Le Goater <clg@kaod.org>
>---
>
> 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
>
>diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
>index 8f876a0aa0d7..1d523c5d5da0 100755
>--- a/arch/arm/dts/Makefile
>+++ b/arch/arm/dts/Makefile
>@@ -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)

> 	ast2500-evb.dtb \
> 	ast2600a0-evb.dtb \
>diff --git a/arch/arm/dts/ast2400-palmetto.dts b/arch/arm/dts/ast2400-palmetto.dts
>new file mode 100644
>index 000000000000..2a49ded27b43
>--- /dev/null
>+++ b/arch/arm/dts/ast2400-palmetto.dts
>@@ -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>;
>+	};
>+
>+	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.)

>+	};
>+
>+	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>;
>+	};
>+};
>diff --git a/configs/ast2400_openbmc_defconfig b/configs/ast2400_openbmc_defconfig
>new file mode 100644
>index 000000000000..d09358777304
>--- /dev/null
>+++ b/configs/ast2400_openbmc_defconfig

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?

>@@ -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
>-- 
>2.35.3
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] ARM: dts: aspeed: Add a palmetto board (AST2400)
  2022-06-08 10:17 ` Zev Weiss
@ 2022-06-08 13:08   ` Cédric Le Goater
  2022-06-10  6:49     ` Joel Stanley
  0 siblings, 1 reply; 6+ messages in thread
From: Cédric Le Goater @ 2022-06-08 13:08 UTC (permalink / raw)
  To: Zev Weiss; +Cc: openbmc, Joel Stanley

On 6/8/22 12:17, Zev Weiss wrote:
> On Wed, Jun 08, 2022 at 01:22:21AM PDT, Cédric Le Goater wrote:
>> 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
>>
>> Cc: Joel Stanley <joel@jms.id.au>
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>> ---
>>
>> 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
>>
>> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
>> index 8f876a0aa0d7..1d523c5d5da0 100755
>> --- a/arch/arm/dts/Makefile
>> +++ b/arch/arm/dts/Makefile
>> @@ -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)

yes.

> 
>> 	ast2500-evb.dtb \
>> 	ast2600a0-evb.dtb \
>> diff --git a/arch/arm/dts/ast2400-palmetto.dts b/arch/arm/dts/ast2400-palmetto.dts
>> new file mode 100644
>> index 000000000000..2a49ded27b43
>> --- /dev/null
>> +++ b/arch/arm/dts/ast2400-palmetto.dts
>> @@ -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>;
>> +	};
>> +
>> +	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.

>> +	};
>> +
>> +	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>;
>> +	};
>> +};
>> diff --git a/configs/ast2400_openbmc_defconfig b/configs/ast2400_openbmc_defconfig
>> new file mode 100644
>> index 000000000000..d09358777304
>> --- /dev/null
>> +++ b/configs/ast2400_openbmc_defconfig
> 
> 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?= <clg@kaod.org>
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.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
  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.3




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] ARM: dts: aspeed: Add a palmetto board (AST2400)
  2022-06-08 13:08   ` Cédric Le Goater
@ 2022-06-10  6:49     ` Joel Stanley
  2022-06-10  7:54       ` Cédric Le Goater
  0 siblings, 1 reply; 6+ messages in thread
From: Joel Stanley @ 2022-06-10  6:49 UTC (permalink / raw)
  To: Cédric Le Goater; +Cc: openbmc, Zev Weiss

> 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.

> 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
>
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] ARM: dts: aspeed: Add a palmetto board (AST2400)
  2022-06-10  6:49     ` Joel Stanley
@ 2022-06-10  7:54       ` Cédric Le Goater
  2022-06-10  7:59         ` Joel Stanley
  0 siblings, 1 reply; 6+ messages in thread
From: Cédric Le Goater @ 2022-06-10  7:54 UTC (permalink / raw)
  To: Joel Stanley; +Cc: openbmc, Zev Weiss

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
>>
>>
>>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] ARM: dts: aspeed: Add a palmetto board (AST2400)
  2022-06-10  7:54       ` Cédric Le Goater
@ 2022-06-10  7:59         ` Joel Stanley
  0 siblings, 0 replies; 6+ messages in thread
From: Joel Stanley @ 2022-06-10  7:59 UTC (permalink / raw)
  To: Cédric Le Goater; +Cc: openbmc, Zev Weiss

On Fri, 10 Jun 2022 at 07:54, Cédric Le Goater <clg@kaod.org> wrote:
>
> 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)
>
>
> ?

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

>
> 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
> >>
> >>
> >>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-10  8:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08  8:22 [PATCH v2] ARM: dts: aspeed: Add a palmetto board (AST2400) Cédric Le Goater
2022-06-08 10:17 ` Zev Weiss
2022-06-08 13:08   ` Cédric Le Goater
2022-06-10  6:49     ` Joel Stanley
2022-06-10  7:54       ` Cédric Le Goater
2022-06-10  7:59         ` Joel Stanley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.