[PATCH v4 0/6] Enable ICSSG Ethernet Driver for AM65x

The series introduces device tree and config changes and AM65x to enable ICSSG driver. The series also enables SPL_LOAD_FIT_APPLY_OVERLAY for AM65x in order to load overlay over spl.
The ICSSG2 node is added in device tree overlay so that it remains in sync with linux kernel.
This series has been tested on AM65x SR2.0, and the ICSSG interface is able to ping / dhcp and boot kernel using tftp in uboot.
The users need to set env variables fw_storage_interface, fw_dev_part, fw_ubi_mtdpart, fw_ubi_volume to indicate which storage medium and partition they want to use to load firmware files from. By default the env fw_storage_interface=mmc and fw_dev_part=1:2 but users can modify these envs as per their requirements.
This is the v4 of the series [1]. The series doesn't depend on any patch and can be applied cleanly on u-boot/master
Changes from v3 to v4: *) Separated the device tree and board specific changes into this series from the main series [1]. *) Added check for TARGET_AM654_A53_EVM config in board file as suggested by Dan Carpenter dan.carpenter@linaro.org *) Rebased on latest u-boot/master.
[1] https://lore.kernel.org/all/20240124064930.1787929-1-danishanwar@ti.com/
MD Danish Anwar (6): arm: dts: k3-am654-base-board: Add ICSSG2 Ethernet support arm: dts: k3-am65x-binman: Add ICSSG2 overlay and configuration configs: am65x_evm_a53: Enable ICSSG Driver configs: am65x_evm_a53: add SPL_LOAD_FIT_APPLY_OVERLAY board: ti: am65x: Add check for k3-am654-icssg2 in board_fit_config_match() board: ti: am65x: Set fw_storage_interface and fw_dev_part ENVs
arch/arm/dts/Makefile | 4 +- arch/arm/dts/k3-am654-icssg2.dtso | 145 ++++++++++++++++++++++++++++++ arch/arm/dts/k3-am65x-binman.dtsi | 65 +++++++++++++- board/ti/am65x/am65x.env | 4 + board/ti/am65x/evm.c | 9 +- configs/am65x_evm_a53_defconfig | 2 + 6 files changed, 221 insertions(+), 8 deletions(-) create mode 100644 arch/arm/dts/k3-am654-icssg2.dtso
base-commit: 6e316e3f397b5e01e98c5dd56cdbaab961daeedf

ICSSG2 provides dual Gigabit Ethernet support. Add ICSSG2 ethernet node to an overlay k3-am654-icssg2.dtso
Signed-off-by: MD Danish Anwar danishanwar@ti.com --- arch/arm/dts/Makefile | 4 +- arch/arm/dts/k3-am654-icssg2.dtso | 145 ++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/k3-am654-icssg2.dtso
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 08dfbdd557..a58e700bf7 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -1326,7 +1326,9 @@ dtb-$(CONFIG_SOC_K3_AM654) += \ k3-am6548-iot2050-advanced-pg2.dtb \ k3-am6548-iot2050-advanced-m2.dtb \ k3-am6548-iot2050-advanced-m2-bkey-usb3-overlay.dtbo \ - k3-am6548-iot2050-advanced-m2-bkey-ekey-pcie-overlay.dtbo + k3-am6548-iot2050-advanced-m2-bkey-ekey-pcie-overlay.dtbo \ + k3-am654-icssg2.dtbo + dtb-$(CONFIG_SOC_K3_J721E) += k3-j721e-common-proc-board.dtb \ k3-j721e-r5-common-proc-board.dtb \ k3-j7200-common-proc-board.dtb \ diff --git a/arch/arm/dts/k3-am654-icssg2.dtso b/arch/arm/dts/k3-am654-icssg2.dtso new file mode 100644 index 0000000000..faefa2febc --- /dev/null +++ b/arch/arm/dts/k3-am654-icssg2.dtso @@ -0,0 +1,145 @@ +// SPDX-License-Identifier: GPL-2.0 +/** + * DT overlay for enabling ICSSG2 on AM654 EVM + * + * Copyright (C) 2018-2023 Texas Instruments Incorporated - https://www.ti.com/ + */ + +/dts-v1/; +/plugin/; + +#include <dt-bindings/net/ti-dp83867.h> +#include "k3-pinctrl.h" + +&{/} { + aliases { + ethernet1 = "/icssg2-eth/ethernet-ports/port@0"; + ethernet2 = "/icssg2-eth/ethernet-ports/port@1"; + }; + + /* Ethernet node on PRU-ICSSG2 */ + icssg2_eth: icssg2-eth { + compatible = "ti,am654-icssg-prueth"; + pinctrl-names = "default"; + pinctrl-0 = <&icssg2_rgmii_pins_default>; + sram = <&msmc_ram>; + ti,prus = <&pru2_0>, <&rtu2_0>, <&tx_pru2_0>, + <&pru2_1>, <&rtu2_1>, <&tx_pru2_1>; + firmware-name = "ti-pruss/am65x-sr2-pru0-prueth-fw.elf", + "ti-pruss/am65x-sr2-rtu0-prueth-fw.elf", + "ti-pruss/am65x-sr2-txpru0-prueth-fw.elf", + "ti-pruss/am65x-sr2-pru1-prueth-fw.elf", + "ti-pruss/am65x-sr2-rtu1-prueth-fw.elf", + "ti-pruss/am65x-sr2-txpru1-prueth-fw.elf"; + + ti,pruss-gp-mux-sel = <2>, /* MII mode */ + <2>, + <2>, + <2>, /* MII mode */ + <2>, + <2>; + + ti,mii-g-rt = <&icssg2_mii_g_rt>; + ti,mii-rt = <&icssg2_mii_rt>; + ti,iep = <&icssg2_iep0>, <&icssg2_iep1>; + + interrupt-parent = <&icssg2_intc>; + interrupts = <24 0 2>, <25 1 3>; + interrupt-names = "tx_ts0", "tx_ts1"; + + dmas = <&main_udmap 0xc300>, /* egress slice 0 */ + <&main_udmap 0xc301>, /* egress slice 0 */ + <&main_udmap 0xc302>, /* egress slice 0 */ + <&main_udmap 0xc303>, /* egress slice 0 */ + <&main_udmap 0xc304>, /* egress slice 1 */ + <&main_udmap 0xc305>, /* egress slice 1 */ + <&main_udmap 0xc306>, /* egress slice 1 */ + <&main_udmap 0xc307>, /* egress slice 1 */ + <&main_udmap 0x4300>, /* ingress slice 0 */ + <&main_udmap 0x4301>; /* ingress slice 1 */ + + dma-names = "tx0-0", "tx0-1", "tx0-2", "tx0-3", + "tx1-0", "tx1-1", "tx1-2", "tx1-3", + "rx0", "rx1"; + ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + icssg2_emac0: port@0 { + reg = <0>; + phy-handle = <&icssg2_phy0>; + phy-mode = "rgmii-id"; + ti,syscon-rgmii-delay = <&scm_conf 0x4120>; + /* Filled in by bootloader */ + local-mac-address = [00 00 00 00 00 00]; + }; + icssg2_emac1: port@1 { + reg = <1>; + phy-handle = <&icssg2_phy1>; + phy-mode = "rgmii-id"; + ti,syscon-rgmii-delay = <&scm_conf 0x4124>; + /* Filled in by bootloader */ + local-mac-address = [00 00 00 00 00 00]; + }; + }; + }; +}; + +&main_pmx0 { + + icssg2_mdio_pins_default: icssg2-mdio-default-pins { + pinctrl-single,pins = < + AM65X_IOPAD(0x0094, PIN_INPUT, 2) /* (AC19) PRG2_PRU0_GPO7.PRG2_MDIO0_MDIO */ + AM65X_IOPAD(0x00c8, PIN_OUTPUT, 2) /* (AE15) PRG2_PRU1_GPO7.PRG2_MDIO0_MDC */ + >; + }; + + icssg2_rgmii_pins_default: icssg2-rgmii-default-pins { + pinctrl-single,pins = < + AM65X_IOPAD(0x00ac, PIN_INPUT, 2) /* (AH15) PRG2_PRU1_GPO0.PRG2_RGMII2_RD0 */ + AM65X_IOPAD(0x00b0, PIN_INPUT, 2) /* (AC16) PRG2_PRU1_GPO1.PRG2_RGMII2_RD1 */ + AM65X_IOPAD(0x00b4, PIN_INPUT, 2) /* (AD17) PRG2_PRU1_GPO2.PRG2_RGMII2_RD2 */ + AM65X_IOPAD(0x00b8, PIN_INPUT, 2) /* (AH14) PRG2_PRU1_GPO3.PRG2_RGMII2_RD3 */ + AM65X_IOPAD(0x00cc, PIN_OUTPUT, 2) /* (AD15) PRG2_PRU1_GPO8.PRG2_RGMII2_TD0 */ + AM65X_IOPAD(0x00d0, PIN_OUTPUT, 2) /* (AF14) PRG2_PRU1_GPO9.PRG2_RGMII2_TD1 */ + AM65X_IOPAD(0x00d4, PIN_OUTPUT, 2) /* (AC15) PRG2_PRU1_GPO10.PRG2_RGMII2_TD2 */ + AM65X_IOPAD(0x00d8, PIN_OUTPUT, 2) /* (AD14) PRG2_PRU1_GPO11.PRG2_RGMII2_TD3 */ + AM65X_IOPAD(0x00dc, PIN_INPUT, 2) /* (AE14) PRG2_PRU1_GPO16.PRG2_RGMII2_TXC */ + AM65X_IOPAD(0x00c4, PIN_OUTPUT, 2) /* (AC17) PRG2_PRU1_GPO6.PRG2_RGMII2_TX_CTL */ + AM65X_IOPAD(0x00c0, PIN_INPUT, 2) /* (AG15) PRG2_PRU1_GPO5.PRG2_RGMII2_RXC */ + AM65X_IOPAD(0x00bc, PIN_INPUT, 2) /* (AG14) PRG2_PRU1_GPO4.PRG2_RGMII2_RX_CTL */ + + AM65X_IOPAD(0x0078, PIN_INPUT, 2) /* (AF18) PRG2_PRU0_GPO0.PRG2_RGMII1_RD0 */ + AM65X_IOPAD(0x007c, PIN_INPUT, 2) /* (AE18) PRG2_PRU0_GPO1.PRG2_RGMII1_RD1 */ + AM65X_IOPAD(0x0080, PIN_INPUT, 2) /* (AH17) PRG2_PRU0_GPO2.PRG2_RGMII1_RD2 */ + AM65X_IOPAD(0x0084, PIN_INPUT, 2) /* (AG18) PRG2_PRU0_GPO3.PRG2_RGMII1_RD3 */ + AM65X_IOPAD(0x0098, PIN_OUTPUT, 2) /* (AH16) PRG2_PRU0_GPO8.PRG2_RGMII1_TD0 */ + AM65X_IOPAD(0x009c, PIN_OUTPUT, 2) /* (AG16) PRG2_PRU0_GPO9.PRG2_RGMII1_TD1 */ + AM65X_IOPAD(0x00a0, PIN_OUTPUT, 2) /* (AF16) PRG2_PRU0_GPO10.PRG2_RGMII1_TD2 */ + AM65X_IOPAD(0x00a4, PIN_OUTPUT, 2) /* (AE16) PRG2_PRU0_GPO11.PRG2_RGMII1_TD3 */ + AM65X_IOPAD(0x00a8, PIN_INPUT, 2) /* (AD16) PRG2_PRU0_GPO16.PRG2_RGMII1_TXC */ + AM65X_IOPAD(0x0090, PIN_OUTPUT, 2) /* (AE17) PRG2_PRU0_GPO6.PRG2_RGMII1_TX_CTL */ + AM65X_IOPAD(0x008c, PIN_INPUT, 2) /* (AF17) PRG2_PRU0_GPO5.PRG2_RGMII1_RXC */ + AM65X_IOPAD(0x0088, PIN_INPUT, 2) /* (AG17) PRG2_PRU0_GPO4.PRG2_RGMII1_RX_CTL */ + >; + }; +}; + +&icssg2_mdio { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&icssg2_mdio_pins_default>; + #address-cells = <1>; + #size-cells = <0>; + + icssg2_phy0: ethernet-phy@0 { + reg = <0>; + ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>; + ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>; + }; + + icssg2_phy1: ethernet-phy@3 { + reg = <3>; + ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>; + ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>; + }; +};

Add ICSSG2 overlay and configuration to tispl and u-boot images.
Signed-off-by: MD Danish Anwar danishanwar@ti.com --- arch/arm/dts/k3-am65x-binman.dtsi | 65 +++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 4 deletions(-)
diff --git a/arch/arm/dts/k3-am65x-binman.dtsi b/arch/arm/dts/k3-am65x-binman.dtsi index 8cc24da1f3..d0cd4889cd 100644 --- a/arch/arm/dts/k3-am65x-binman.dtsi +++ b/arch/arm/dts/k3-am65x-binman.dtsi @@ -98,6 +98,8 @@ #define SPL_AM654_EVM_DTB "spl/dts/k3-am654-base-board.dtb" #define AM654_EVM_DTB "u-boot.dtb"
+#define AM654_EVM_ICSSG2_DTBO "arch/arm/dts/k3-am654-icssg2.dtbo" + &binman { ti-spl { insert-template = <&ti_spl_template>; @@ -124,6 +126,20 @@ filename = SPL_AM654_EVM_DTB; }; }; + + fdt-1 { + description = "k3-am654-icssg2 overlay"; + type = "flat_dt"; + arch = "arm"; + compression = "none"; + ti-secure { + content = <&spl_am65x_evm_icssg2_dtb>; + keyfile = "custMpk.pem"; + }; + spl_am65x_evm_icssg2_dtb: blob-ext { + filename = AM654_EVM_ICSSG2_DTBO; + }; + }; };
configurations { @@ -133,7 +149,7 @@ description = "k3-am654-base-board"; firmware = "atf"; loadables = "tee", "dm", "spl"; - fdt = "fdt-0"; + fdt = "fdt-0", "fdt-1"; }; }; }; @@ -168,6 +184,24 @@ }; };
+ fdt-1 { + description = "k3-am654-icssg2 overlay"; + type = "flat_dt"; + arch = "arm"; + compression = "none"; + ti-secure { + content = <&am65x_evm_icssg2_dtb>; + keyfile = "custMpk.pem"; + + }; + am65x_evm_icssg2_dtb: blob-ext { + filename = AM654_EVM_ICSSG2_DTBO; + }; + hash { + algo = "crc32"; + }; + }; + };
configurations { @@ -177,7 +211,7 @@ description = "k3-am654-base-board"; firmware = "uboot"; loadables = "uboot"; - fdt = "fdt-0"; + fdt = "fdt-0", "fdt-1"; }; }; }; @@ -205,6 +239,16 @@ filename = SPL_AM654_EVM_DTB; }; }; + + fdt-1 { + description = "k3-am654-icssg2 overlay"; + type = "flat_dt"; + arch = "arm"; + compression = "none"; + blob { + filename = AM654_EVM_ICSSG2_DTBO; + }; + }; };
configurations { @@ -214,7 +258,7 @@ description = "k3-am654-base-board"; firmware = "atf"; loadables = "tee", "dm", "spl"; - fdt = "fdt-0"; + fdt = "fdt-0", "fdt-1"; }; }; }; @@ -243,6 +287,19 @@ algo = "crc32"; }; }; + + fdt-1 { + description = "k3-am654-icssg2"; + type = "flat_dt"; + arch = "arm"; + compression = "none"; + blob { + filename = AM654_EVM_ICSSG2_DTBO; + }; + hash { + algo = "crc32"; + }; + }; };
configurations { @@ -252,7 +309,7 @@ description = "k3-am654-base-board"; firmware = "uboot"; loadables = "uboot"; - fdt = "fdt-0"; + fdt = "fdt-0", "fdt-1"; }; }; };

Enable ICSSG driver in am65x_evm_a53_defconfig
Signed-off-by: MD Danish Anwar danishanwar@ti.com --- configs/am65x_evm_a53_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/am65x_evm_a53_defconfig b/configs/am65x_evm_a53_defconfig index 3afa80f45a..f06186ed8d 100644 --- a/configs/am65x_evm_a53_defconfig +++ b/configs/am65x_evm_a53_defconfig @@ -129,6 +129,7 @@ CONFIG_PHY_FIXED=y CONFIG_E1000=y CONFIG_CMD_E1000=y CONFIG_TI_AM65_CPSW_NUSS=y +CONFIG_TI_ICSSG_PRUETH=y CONFIG_PCI_KEYSTONE=y CONFIG_PHY=y CONFIG_SPL_PHY=y

We want SPL to apply DTB overlays (e.g. ICSSG2 overlay) so enable SPL_LOAD_FIT_APPLY_OVERLAY.
Signed-off-by: MD Danish Anwar danishanwar@ti.com --- configs/am65x_evm_a53_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/am65x_evm_a53_defconfig b/configs/am65x_evm_a53_defconfig index f06186ed8d..d2f35dc2fb 100644 --- a/configs/am65x_evm_a53_defconfig +++ b/configs/am65x_evm_a53_defconfig @@ -68,6 +68,7 @@ CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_PCI=y CONFIG_CMD_REMOTEPROC=y +CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY=y CONFIG_CMD_USB=y CONFIG_CMD_TIME=y CONFIG_MTDIDS_DEFAULT="nor0=47040000.spi.0"

When CONFIG_TI_ICSSG_PRUETH is enabled, add config name check for the icssg2 overlay in board_fit_config_match() API.
Signed-off-by: MD Danish Anwar danishanwar@ti.com --- board/ti/am65x/evm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/board/ti/am65x/evm.c b/board/ti/am65x/evm.c index 3109c9a2ac..07073a5940 100644 --- a/board/ti/am65x/evm.c +++ b/board/ti/am65x/evm.c @@ -91,10 +91,13 @@ int dram_init_banksize(void) #ifdef CONFIG_SPL_LOAD_FIT int board_fit_config_name_match(const char *name) { -#ifdef CONFIG_TARGET_AM654_A53_EVM - if (!strcmp(name, "k3-am654-base-board")) + if (IS_ENABLED(CONFIG_TI_ICSSG_PRUETH) && + strcmp(name, "k3-am654-icssg2") == 0) + return 0; + + if (IS_ENABLED(CONFIG_TARGET_AM654_A53_EVM) && + strcmp(name, "k3-am654-base-board") == 0) return 0; -#endif
return -1; }

When ICSSG driver is enabled (CONFIG_TI_ICSSG_PRUETH=y) set storage_interface and fw_dev_part env variables.
These variables need be set appropriately in order to load differnet ICSSG firmwares needed for ICSSG driver. By default the storage interface is mmc and the partition is 1:2. User can modify this based on their needs.
Signed-off-by: MD Danish Anwar danishanwar@ti.com --- board/ti/am65x/am65x.env | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/board/ti/am65x/am65x.env b/board/ti/am65x/am65x.env index 814374d68c..631997e4c9 100644 --- a/board/ti/am65x/am65x.env +++ b/board/ti/am65x/am65x.env @@ -27,3 +27,7 @@ get_fdt_ubi=ubifsload ${fdtaddr} ${bootdir}/${name_fdt} args_ubi=setenv bootargs console=${console} ${optargs} rootfstype=ubifs root=ubi0:rootfs rw ubi.mtd=ospi.rootfs
+#if CONFIG_TI_ICSSG_PRUETH +storage_interface=mmc +fw_dev_part=1:2 +#endif

On 4/16/2024 2:50 PM, MD Danish Anwar wrote:
The series introduces device tree and config changes and AM65x to enable ICSSG driver. The series also enables SPL_LOAD_FIT_APPLY_OVERLAY for AM65x in order to load overlay over spl.
The ICSSG2 node is added in device tree overlay so that it remains in sync with linux kernel.
This series has been tested on AM65x SR2.0, and the ICSSG interface is able to ping / dhcp and boot kernel using tftp in uboot.
The users need to set env variables fw_storage_interface, fw_dev_part, fw_ubi_mtdpart, fw_ubi_volume to indicate which storage medium and partition they want to use to load firmware files from. By default the env fw_storage_interface=mmc and fw_dev_part=1:2 but users can modify these envs as per their requirements.
This is the v4 of the series [1]. The series doesn't depend on any patch and can be applied cleanly on u-boot/master
Changes from v3 to v4: *) Separated the device tree and board specific changes into this series from the main series [1]. *) Added check for TARGET_AM654_A53_EVM config in board file as suggested by Dan Carpenter dan.carpenter@linaro.org *) Rebased on latest u-boot/master.
[1] https://lore.kernel.org/all/20240124064930.1787929-1-danishanwar@ti.com/
MD Danish Anwar (6): arm: dts: k3-am654-base-board: Add ICSSG2 Ethernet support arm: dts: k3-am65x-binman: Add ICSSG2 overlay and configuration configs: am65x_evm_a53: Enable ICSSG Driver configs: am65x_evm_a53: add SPL_LOAD_FIT_APPLY_OVERLAY board: ti: am65x: Add check for k3-am654-icssg2 in board_fit_config_match() board: ti: am65x: Set fw_storage_interface and fw_dev_part ENVs
arch/arm/dts/Makefile | 4 +- arch/arm/dts/k3-am654-icssg2.dtso | 145 ++++++++++++++++++++++++++++++ arch/arm/dts/k3-am65x-binman.dtsi | 65 +++++++++++++- board/ti/am65x/am65x.env | 4 + board/ti/am65x/evm.c | 9 +- configs/am65x_evm_a53_defconfig | 2 + 6 files changed, 221 insertions(+), 8 deletions(-) create mode 100644 arch/arm/dts/k3-am654-icssg2.dtso
base-commit: 6e316e3f397b5e01e98c5dd56cdbaab961daeedf
For the series, Acked-by: Ravi Gunasekaran r-gunasekaran@ti.com
Regards, Ravi

On Tue, 16 Apr 2024 14:50:12 +0530, MD Danish Anwar wrote:
The series introduces device tree and config changes and AM65x to enable ICSSG driver. The series also enables SPL_LOAD_FIT_APPLY_OVERLAY for AM65x in order to load overlay over spl.
The ICSSG2 node is added in device tree overlay so that it remains in sync with linux kernel.
[...]
Applied to u-boot/master, thanks!
participants (3)
-
MD Danish Anwar
-
Ravi Gunasekaran
-
Tom Rini