From ec0cd37f67bffa3e9729605ecedbb5aa093a5e30 Mon Sep 17 00:00:00 2001 From: Mikhail Kshevetskiy Date: Sat, 1 Nov 2025 03:44:45 +0300 Subject: airoha/an7581: add CONFIG_TARGET_AN7581=y to the defconfig This is required because airoha/en7523 will be added with the following patches. Without this line config for en7523 will be created instead of an7581. Signed-off-by: Mikhail Kshevetskiy --- configs/an7581_evb_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/an7581_evb_defconfig b/configs/an7581_evb_defconfig index baa3fc3f5de..73af30cd693 100644 --- a/configs/an7581_evb_defconfig +++ b/configs/an7581_evb_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_ARCH_AIROHA=y +CONFIG_TARGET_AN7581=y CONFIG_TEXT_BASE=0x81E00000 CONFIG_SYS_MALLOC_F_LEN=0x4000 CONFIG_NR_DRAM_BANKS=1 -- cgit v1.3.1 From 97aa00e0211d1d0b387e69e4a568ec2ceec7815f Mon Sep 17 00:00:00 2001 From: Mikhail Kshevetskiy Date: Sat, 1 Nov 2025 03:44:46 +0300 Subject: arm/airoha: add support for airoha en7523 SoC family Basic support for en7523/en7529/en7562 SoCs. Within a patch only serial console will be supported. Signed-off-by: Mikhail Kshevetskiy --- arch/arm/dts/en7523-evb-u-boot.dtsi | 11 +++++++ arch/arm/dts/en7523-u-boot.dtsi | 26 ++++++++++++++++ arch/arm/mach-airoha/Kconfig | 14 +++++++++ arch/arm/mach-airoha/Makefile | 1 + arch/arm/mach-airoha/en7523/Makefile | 3 ++ arch/arm/mach-airoha/en7523/init.c | 33 +++++++++++++++++++++ board/airoha/en7523/Makefile | 3 ++ board/airoha/en7523/en7523_rfb.c | 16 ++++++++++ configs/en7523_evb_defconfig | 57 ++++++++++++++++++++++++++++++++++++ include/configs/en7523.h | 21 +++++++++++++ 10 files changed, 185 insertions(+) create mode 100644 arch/arm/dts/en7523-evb-u-boot.dtsi create mode 100644 arch/arm/dts/en7523-u-boot.dtsi create mode 100644 arch/arm/mach-airoha/en7523/Makefile create mode 100644 arch/arm/mach-airoha/en7523/init.c create mode 100644 board/airoha/en7523/Makefile create mode 100644 board/airoha/en7523/en7523_rfb.c create mode 100644 configs/en7523_evb_defconfig create mode 100644 include/configs/en7523.h diff --git a/arch/arm/dts/en7523-evb-u-boot.dtsi b/arch/arm/dts/en7523-evb-u-boot.dtsi new file mode 100644 index 00000000000..c109d6794fb --- /dev/null +++ b/arch/arm/dts/en7523-evb-u-boot.dtsi @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/ { + /* When running as a first-stage bootloader this isn't filled in automatically */ + memory@80000000 { + device_type = "memory"; + reg = <0x80000000 0x10000000>; + }; +}; + +#include "en7523-u-boot.dtsi" diff --git a/arch/arm/dts/en7523-u-boot.dtsi b/arch/arm/dts/en7523-u-boot.dtsi new file mode 100644 index 00000000000..34fa8069f9e --- /dev/null +++ b/arch/arm/dts/en7523-u-boot.dtsi @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/ { + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + atf-reserved-memory@80000000 { + no-map; + reg = <0x80000000 0x40000>; + }; + }; + + scu: system-controller@1fa20000 { + compatible = "airoha,en7523-scu"; + reg = <0x1fa20000 0x400>, + <0x1fb00000 0x1000>; + #clock-cells = <1>; + }; + +}; + +&uart1 { + bootph-all; +}; diff --git a/arch/arm/mach-airoha/Kconfig b/arch/arm/mach-airoha/Kconfig index be3562ae3ff..b9cd0a413e1 100644 --- a/arch/arm/mach-airoha/Kconfig +++ b/arch/arm/mach-airoha/Kconfig @@ -6,6 +6,17 @@ config SYS_VENDOR choice prompt "Airoha board select" +config TARGET_EN7523 + bool "Airoha EN7523 SoC" + select CPU_V7A + select ARMV7_SET_CORTEX_SMPEN + help + The Airoha EN7523 family (en7523/en7529/en7562) is an ARM-based + SoCs with a dual-core CPU. It comes with Wi-Fi 5/6 support and + connectivity to Ethernet PHY, DDR, PCIe, USB, UART and VoIP. + With advanced hardware design, EN7523 provides high processing + performance and low power consumption. + config TARGET_AN7581 bool "Airoha AN7581 SoC" select ARM64 @@ -20,12 +31,15 @@ config TARGET_AN7581 endchoice config SYS_SOC + default "en7523" if TARGET_EN7523 default "an7581" if TARGET_AN7581 config SYS_BOARD + default "en7523" if TARGET_EN7523 default "an7581" if TARGET_AN7581 config SYS_CONFIG_NAME + default "en7523" if TARGET_EN7523 default "an7581" if TARGET_AN7581 endif diff --git a/arch/arm/mach-airoha/Makefile b/arch/arm/mach-airoha/Makefile index 215a300373b..91395b8a850 100644 --- a/arch/arm/mach-airoha/Makefile +++ b/arch/arm/mach-airoha/Makefile @@ -2,4 +2,5 @@ obj-y += cpu.o +obj-$(CONFIG_TARGET_EN7523) += en7523/ obj-$(CONFIG_TARGET_AN7581) += an7581/ diff --git a/arch/arm/mach-airoha/en7523/Makefile b/arch/arm/mach-airoha/en7523/Makefile new file mode 100644 index 00000000000..886ab7e4eb9 --- /dev/null +++ b/arch/arm/mach-airoha/en7523/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-y += init.o diff --git a/arch/arm/mach-airoha/en7523/init.c b/arch/arm/mach-airoha/en7523/init.c new file mode 100644 index 00000000000..c1c1eeabdf5 --- /dev/null +++ b/arch/arm/mach-airoha/en7523/init.c @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Author: Mikhail Kshevetskiy + */ +#include +#include +#include +#include +#include + +int print_cpuinfo(void) +{ + printf("CPU: Airoha EN7523/EN7529/EN7562\n"); + return 0; +} + +int dram_init(void) +{ + return fdtdec_setup_mem_size_base(); +} + +int dram_init_banksize(void) +{ + return fdtdec_setup_memory_banksize(); +} + +void __noreturn reset_cpu(void) +{ + writel(0x80000000, 0x1FB00040); + while (1) { + /* loop forever */ + } +} diff --git a/board/airoha/en7523/Makefile b/board/airoha/en7523/Makefile new file mode 100644 index 00000000000..c6629486f21 --- /dev/null +++ b/board/airoha/en7523/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-y += en7523_rfb.o diff --git a/board/airoha/en7523/en7523_rfb.c b/board/airoha/en7523/en7523_rfb.c new file mode 100644 index 00000000000..aa73679d929 --- /dev/null +++ b/board/airoha/en7523/en7523_rfb.c @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Author: Christian Marangi + */ + +#include + +DECLARE_GLOBAL_DATA_PTR; + +int board_init(void) +{ + /* address of boot parameters */ + gd->bd->bi_boot_params = CFG_SYS_SDRAM_BASE + 0x100; + + return 0; +} diff --git a/configs/en7523_evb_defconfig b/configs/en7523_evb_defconfig new file mode 100644 index 00000000000..0730136b041 --- /dev/null +++ b/configs/en7523_evb_defconfig @@ -0,0 +1,57 @@ +CONFIG_ARM=y +CONFIG_SYS_ARCH_TIMER=y +CONFIG_ARCH_AIROHA=y +CONFIG_TARGET_EN7523=y +CONFIG_TEXT_BASE=0x81E00000 +CONFIG_SYS_MALLOC_F_LEN=0x4000 +CONFIG_NR_DRAM_BANKS=1 +CONFIG_DM_GPIO=y +CONFIG_DEFAULT_DEVICE_TREE="airoha/en7523-evb" +CONFIG_SYS_LOAD_ADDR=0x81800000 +CONFIG_BUILD_TARGET="u-boot.bin" +# CONFIG_EFI_LOADER is not set +CONFIG_FIT=y +CONFIG_FIT_VERBOSE=y +CONFIG_BOOTDELAY=3 +CONFIG_DEFAULT_FDT_FILE="en7523-evb" +CONFIG_SYS_PBSIZE=1049 +CONFIG_SYS_CONSOLE_IS_IN_ENV=y +# CONFIG_DISPLAY_BOARDINFO is not set +CONFIG_HUSH_PARSER=y +CONFIG_SYS_PROMPT="U-Boot> " +CONFIG_SYS_MAXARGS=8 +CONFIG_CMD_BOOTZ=y +CONFIG_CMD_BOOTMENU=y +# CONFIG_CMD_ELF is not set +# CONFIG_CMD_XIMG is not set +CONFIG_CMD_BIND=y +CONFIG_CMD_GPIO=y +CONFIG_CMD_MTD=y +# CONFIG_CMD_SETEXPR is not set +CONFIG_CMD_PING=y +CONFIG_CMD_EXT4=y +CONFIG_CMD_FAT=y +CONFIG_CMD_FS_GENERIC=y +CONFIG_CMD_MTDPARTS=y +CONFIG_CMD_LOG=y +CONFIG_OF_UPSTREAM=y +CONFIG_ENV_OVERWRITE=y +CONFIG_ENV_IS_NOWHERE=y +# CONFIG_ENV_IS_IN_MTD is not set +CONFIG_ENV_RELOC_GD_ENV_ADDR=y +CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y +CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_SYS_RX_ETH_BUFFER=8 +CONFIG_REGMAP=y +CONFIG_DMA=y +CONFIG_LED=y +CONFIG_LED_GPIO=y +# CONFIG_MMC is not set +CONFIG_MTD=y +CONFIG_DM_MTD=y +CONFIG_PINCTRL=y +CONFIG_PINCONF=y +CONFIG_RAM=y +CONFIG_DM_SERIAL=y +CONFIG_SYS_NS16550=y +CONFIG_SHA512=y diff --git a/include/configs/en7523.h b/include/configs/en7523.h new file mode 100644 index 00000000000..2d27b3626ae --- /dev/null +++ b/include/configs/en7523.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Configuration for Airoha EN7523 + * + * Author: Mikhail Kshevetskiy + */ + +#ifndef __EN7523_H +#define __EN7523_H + +#include + +#define CFG_SYS_UBOOT_BASE CONFIG_TEXT_BASE + +#define CFG_SYS_INIT_RAM_ADDR CONFIG_TEXT_BASE +#define CFG_SYS_INIT_RAM_SIZE SZ_2M + +/* DRAM */ +#define CFG_SYS_SDRAM_BASE 0x80000000 + +#endif -- cgit v1.3.1 From 9aa3e440c6e64b9af6a8e679d08686b9e816eecf Mon Sep 17 00:00:00 2001 From: Mikhail Kshevetskiy Date: Sat, 1 Nov 2025 03:44:47 +0300 Subject: arm: airoha: introduce AN7581 helpers to get SCU and CHIP_SCU regmaps We need access SCU and CHIP_SCU regmaps in several places (clk-airoha, reset-airoha, airoha_eth). Unfortunately these regmaps can't be easily retrieved with a common code, because of different Airoha SoCs uses a different dts structure. To make life easy we can write a commonly named SoC specific helpers for these tasks. This patch implements helpers for Airoha AN7581 SoC. Signed-off-by: Mikhail Kshevetskiy --- arch/arm/include/asm/arch-airoha/scu-regmap.h | 13 ++++++++++++ arch/arm/include/asm/arch-an7581 | 1 + arch/arm/mach-airoha/an7581/Makefile | 1 + arch/arm/mach-airoha/an7581/scu-regmap.c | 30 +++++++++++++++++++++++++++ 4 files changed, 45 insertions(+) create mode 100644 arch/arm/include/asm/arch-airoha/scu-regmap.h create mode 120000 arch/arm/include/asm/arch-an7581 create mode 100644 arch/arm/mach-airoha/an7581/scu-regmap.c diff --git a/arch/arm/include/asm/arch-airoha/scu-regmap.h b/arch/arm/include/asm/arch-airoha/scu-regmap.h new file mode 100644 index 00000000000..31fc23d8c4d --- /dev/null +++ b/arch/arm/include/asm/arch-airoha/scu-regmap.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Author: Mikhail Kshevetskiy + */ +#ifndef __AIROHA_SCU_REGMAP__ +#define __AIROHA_SCU_REGMAP__ + +#include + +struct regmap *airoha_get_scu_regmap(void); +struct regmap *airoha_get_chip_scu_regmap(void); + +#endif diff --git a/arch/arm/include/asm/arch-an7581 b/arch/arm/include/asm/arch-an7581 new file mode 120000 index 00000000000..d2317ed3bc3 --- /dev/null +++ b/arch/arm/include/asm/arch-an7581 @@ -0,0 +1 @@ +arch-airoha \ No newline at end of file diff --git a/arch/arm/mach-airoha/an7581/Makefile b/arch/arm/mach-airoha/an7581/Makefile index 886ab7e4eb9..51f978aa101 100644 --- a/arch/arm/mach-airoha/an7581/Makefile +++ b/arch/arm/mach-airoha/an7581/Makefile @@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 obj-y += init.o +obj-y += scu-regmap.o diff --git a/arch/arm/mach-airoha/an7581/scu-regmap.c b/arch/arm/mach-airoha/an7581/scu-regmap.c new file mode 100644 index 00000000000..7beeaecccc1 --- /dev/null +++ b/arch/arm/mach-airoha/an7581/scu-regmap.c @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Author: Mikhail Kshevetskiy + */ + +#include +#include +#include + +struct regmap *airoha_get_scu_regmap(void) +{ + ofnode node; + + node = ofnode_by_compatible(ofnode_null(), "airoha,en7581-scu"); + if (!ofnode_valid(node)) + return ERR_PTR(-EINVAL); + + return syscon_node_to_regmap(node); +} + +struct regmap *airoha_get_chip_scu_regmap(void) +{ + ofnode node; + + node = ofnode_by_compatible(ofnode_null(), "airoha,en7581-chip-scu"); + if (!ofnode_valid(node)) + return ERR_PTR(-EINVAL); + + return syscon_node_to_regmap(node); +} -- cgit v1.3.1 From 8e21740b68d06f71b4f9fb13b908a8828c5c7e2d Mon Sep 17 00:00:00 2001 From: Mikhail Kshevetskiy Date: Sat, 1 Nov 2025 03:44:48 +0300 Subject: arm: airoha: introduce EN7523 helpers to get SCU and CHIP_SCU regmaps We need access SCU and CHIP_SCU regmaps in several places (clk-airoha, reset-airoha, airoha_eth). Unfortunately these regmaps can't be easily retrieved with a common code, because of different Airoha SoCs uses a different dts structure. To make life easy we can write a commonly named SoC specific helpers for these tasks. This patch implements helpers for Airoha EN7523 SoC. Signed-off-by: Mikhail Kshevetskiy --- arch/arm/include/asm/arch-en7523 | 1 + arch/arm/mach-airoha/en7523/Makefile | 1 + arch/arm/mach-airoha/en7523/scu-regmap.c | 38 ++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 120000 arch/arm/include/asm/arch-en7523 create mode 100644 arch/arm/mach-airoha/en7523/scu-regmap.c diff --git a/arch/arm/include/asm/arch-en7523 b/arch/arm/include/asm/arch-en7523 new file mode 120000 index 00000000000..d2317ed3bc3 --- /dev/null +++ b/arch/arm/include/asm/arch-en7523 @@ -0,0 +1 @@ +arch-airoha \ No newline at end of file diff --git a/arch/arm/mach-airoha/en7523/Makefile b/arch/arm/mach-airoha/en7523/Makefile index 886ab7e4eb9..51f978aa101 100644 --- a/arch/arm/mach-airoha/en7523/Makefile +++ b/arch/arm/mach-airoha/en7523/Makefile @@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 obj-y += init.o +obj-y += scu-regmap.o diff --git a/arch/arm/mach-airoha/en7523/scu-regmap.c b/arch/arm/mach-airoha/en7523/scu-regmap.c new file mode 100644 index 00000000000..1e201cb060c --- /dev/null +++ b/arch/arm/mach-airoha/en7523/scu-regmap.c @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Author: Mikhail Kshevetskiy + */ + +#include +#include +#include + +static struct regmap *airoha_scu_node_regmap_by_index(unsigned int index) +{ + struct regmap *map; + ofnode node; + int err; + + node = ofnode_by_compatible(ofnode_null(), "airoha,en7523-scu"); + if (!ofnode_valid(node)) + return ERR_PTR(-EINVAL); + + /* CHIP_SCU (index=0), SCU (index=1) */ + err = regmap_init_mem_index(node, &map, index); + if (err) + return ERR_PTR(err); + + return map; +} + +struct regmap *airoha_get_scu_regmap(void) +{ + /* CHIP_SCU (index=0), SCU (index=1) */ + return airoha_scu_node_regmap_by_index(1); +} + +struct regmap *airoha_get_chip_scu_regmap(void) +{ + /* CHIP_SCU (index=0), SCU (index=1) */ + return airoha_scu_node_regmap_by_index(0); +} -- cgit v1.3.1 From f8cef0b7435b65b0a33b541c28081b357a76d4c3 Mon Sep 17 00:00:00 2001 From: Mikhail Kshevetskiy Date: Sat, 1 Nov 2025 03:44:49 +0300 Subject: clk: airoha: use CHIP_SCU regmap helper Use common helper to get CHIP_SCU registers. Signed-off-by: Mikhail Kshevetskiy --- drivers/clk/airoha/clk-airoha.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/clk/airoha/clk-airoha.c b/drivers/clk/airoha/clk-airoha.c index 1b2c4c98de5..8e2f2c08923 100644 --- a/drivers/clk/airoha/clk-airoha.c +++ b/drivers/clk/airoha/clk-airoha.c @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include @@ -400,14 +400,8 @@ const struct clk_ops airoha_clk_ops = { static int airoha_clk_probe(struct udevice *dev) { struct airoha_clk_priv *priv = dev_get_priv(dev); - ofnode chip_scu_node; - chip_scu_node = ofnode_by_compatible(ofnode_null(), - "airoha,en7581-chip-scu"); - if (!ofnode_valid(chip_scu_node)) - return -EINVAL; - - priv->chip_scu_map = syscon_node_to_regmap(chip_scu_node); + priv->chip_scu_map = airoha_get_chip_scu_regmap(); if (IS_ERR(priv->chip_scu_map)) return PTR_ERR(priv->chip_scu_map); -- cgit v1.3.1 From ee82f804dd52c62cef0d6e4101a9fd897064409d Mon Sep 17 00:00:00 2001 From: Mikhail Kshevetskiy Date: Sat, 1 Nov 2025 03:44:50 +0300 Subject: clk: airoha: add support for airoha en7523 SoC family This adds clock driver for airoha en7523/en7529/en7562 SoCs. The code is based on corresponding linux driver. Signed-off-by: Mikhail Kshevetskiy --- drivers/clk/airoha/clk-airoha.c | 117 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 116 insertions(+), 1 deletion(-) diff --git a/drivers/clk/airoha/clk-airoha.c b/drivers/clk/airoha/clk-airoha.c index 8e2f2c08923..49dbca82135 100644 --- a/drivers/clk/airoha/clk-airoha.c +++ b/drivers/clk/airoha/clk-airoha.c @@ -26,6 +26,7 @@ #define REG_SPI_CLK_DIV_SEL 0x1c4 #define REG_SPI_CLK_FREQ_SEL 0x1c8 #define REG_NPU_CLK_DIV_SEL 0x1fc +#define REG_CRYPTO_CLKSRC 0x200 #define REG_NP_SCU_PCIC 0x88 #define REG_NP_SCU_SSTR 0x9c @@ -33,6 +34,7 @@ #define REG_PCIE_XSI1_SEL_MASK GENMASK(12, 11) #define REG_CRYPTO_CLKSRC2 0x20c +#define EN7523_MAX_CLKS 8 #define EN7581_MAX_CLKS 9 struct airoha_clk_desc { @@ -66,14 +68,119 @@ struct airoha_clk_soc_data { }; static const u32 gsw_base[] = { 400000000, 500000000 }; +static const u32 emi_base[] = { 333000000, 400000000 }; +static const u32 bus_base[] = { 500000000, 540000000 }; static const u32 slic_base[] = { 100000000, 3125000 }; - +static const u32 npu_base[] = { 333000000, 400000000, 500000000 }; +/* EN7581 */ static const u32 emi7581_base[] = { 540000000, 480000000, 400000000, 300000000 }; static const u32 bus7581_base[] = { 600000000, 540000000 }; static const u32 npu7581_base[] = { 800000000, 750000000, 720000000, 600000000 }; static const u32 crypto_base[] = { 540000000, 480000000 }; static const u32 emmc7581_base[] = { 200000000, 150000000 }; +static const struct airoha_clk_desc en7523_base_clks[EN7523_MAX_CLKS] = { + [EN7523_CLK_GSW] = { + .id = EN7523_CLK_GSW, + .name = "gsw", + + .base_reg = REG_GSW_CLK_DIV_SEL, + .base_bits = 1, + .base_shift = 8, + .base_values = gsw_base, + .n_base_values = ARRAY_SIZE(gsw_base), + + .div_bits = 3, + .div_shift = 0, + .div_step = 1, + .div_offset = 1, + }, + [EN7523_CLK_EMI] = { + .id = EN7523_CLK_EMI, + .name = "emi", + + .base_reg = REG_EMI_CLK_DIV_SEL, + .base_bits = 1, + .base_shift = 8, + .base_values = emi_base, + .n_base_values = ARRAY_SIZE(emi_base), + + .div_bits = 3, + .div_shift = 0, + .div_step = 1, + .div_offset = 1, + }, + [EN7523_CLK_BUS] = { + .id = EN7523_CLK_BUS, + .name = "bus", + + .base_reg = REG_BUS_CLK_DIV_SEL, + .base_bits = 1, + .base_shift = 8, + .base_values = bus_base, + .n_base_values = ARRAY_SIZE(bus_base), + + .div_bits = 3, + .div_shift = 0, + .div_step = 1, + .div_offset = 1, + }, + [EN7523_CLK_SLIC] = { + .id = EN7523_CLK_SLIC, + .name = "slic", + + .base_reg = REG_SPI_CLK_FREQ_SEL, + .base_bits = 1, + .base_shift = 0, + .base_values = slic_base, + .n_base_values = ARRAY_SIZE(slic_base), + + .div_reg = REG_SPI_CLK_DIV_SEL, + .div_bits = 5, + .div_shift = 24, + .div_val0 = 20, + .div_step = 2, + }, + [EN7523_CLK_SPI] = { + .id = EN7523_CLK_SPI, + .name = "spi", + + .base_reg = REG_SPI_CLK_DIV_SEL, + + .base_value = 400000000, + + .div_bits = 5, + .div_shift = 8, + .div_val0 = 40, + .div_step = 2, + }, + [EN7523_CLK_NPU] = { + .id = EN7523_CLK_NPU, + .name = "npu", + + .base_reg = REG_NPU_CLK_DIV_SEL, + .base_bits = 2, + .base_shift = 8, + .base_values = npu_base, + .n_base_values = ARRAY_SIZE(npu_base), + + .div_bits = 3, + .div_shift = 0, + .div_step = 1, + .div_offset = 1, + }, + [EN7523_CLK_CRYPTO] = { + .id = EN7523_CLK_CRYPTO, + .name = "crypto", + + .base_reg = REG_CRYPTO_CLKSRC, + .base_bits = 1, + .base_shift = 0, + .base_values = emi_base, + .n_base_values = ARRAY_SIZE(emi_base), + } +}; + static const struct airoha_clk_desc en7581_base_clks[EN7581_MAX_CLKS] = { [EN7523_CLK_GSW] = { .id = EN7523_CLK_GSW, @@ -425,12 +532,20 @@ static int airoha_clk_bind(struct udevice *dev) return ret; } +static const struct airoha_clk_soc_data en7523_data = { + .num_clocks = ARRAY_SIZE(en7523_base_clks), + .descs = en7523_base_clks, +}; + static const struct airoha_clk_soc_data en7581_data = { .num_clocks = ARRAY_SIZE(en7581_base_clks), .descs = en7581_base_clks, }; static const struct udevice_id airoha_clk_ids[] = { + { .compatible = "airoha,en7523-scu", + .data = (ulong)&en7523_data, + }, { .compatible = "airoha,en7581-scu", .data = (ulong)&en7581_data, }, -- cgit v1.3.1 From 7a656020d8eb9e51d56f778d81722531e38f295a Mon Sep 17 00:00:00 2001 From: Mikhail Kshevetskiy Date: Sat, 1 Nov 2025 03:44:51 +0300 Subject: configs: airoha: en7523: enable clk support This patch activates clk support for en7523 based boards Signed-off-by: Mikhail Kshevetskiy --- configs/en7523_evb_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/en7523_evb_defconfig b/configs/en7523_evb_defconfig index 0730136b041..b7675d822b0 100644 --- a/configs/en7523_evb_defconfig +++ b/configs/en7523_evb_defconfig @@ -43,6 +43,7 @@ CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SYS_RX_ETH_BUFFER=8 CONFIG_REGMAP=y +CONFIG_CLK=y CONFIG_DMA=y CONFIG_LED=y CONFIG_LED_GPIO=y -- cgit v1.3.1 From ea9b7975378a1ab216a28d2851335a3db5c2d445 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sat, 1 Nov 2025 03:44:52 +0300 Subject: reset: airoha: convert to regmap API In preparation for support for Airoha AN7583, convert the driver to regmap API. This is needed as Airoha AN7583 will use syscon to access reset registers. Signed-off-by: Christian Marangi --- drivers/reset/reset-airoha.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/reset/reset-airoha.c b/drivers/reset/reset-airoha.c index e878af6167c..a618bf62b4d 100644 --- a/drivers/reset/reset-airoha.c +++ b/drivers/reset/reset-airoha.c @@ -10,6 +10,7 @@ #include #include #include +#include #include @@ -21,7 +22,7 @@ struct airoha_reset_priv { const u16 *bank_ofs; const u16 *idx_map; - void __iomem *base; + struct regmap *map; }; static const u16 en7581_rst_ofs[] = { @@ -90,17 +91,11 @@ static const u16 en7581_rst_map[] = { static int airoha_reset_update(struct airoha_reset_priv *priv, unsigned long id, bool assert) { - void __iomem *addr = priv->base + priv->bank_ofs[id / RST_NR_PER_BANK]; - u32 val; - - val = readl(addr); - if (assert) - val |= BIT(id % RST_NR_PER_BANK); - else - val &= ~BIT(id % RST_NR_PER_BANK); - writel(val, addr); + u16 offset = priv->bank_ofs[id / RST_NR_PER_BANK]; - return 0; + return regmap_update_bits(priv->map, offset, + BIT(id % RST_NR_PER_BANK), + assert ? BIT(id % RST_NR_PER_BANK) : 0); } static int airoha_reset_assert(struct reset_ctl *reset_ctl) @@ -123,11 +118,16 @@ static int airoha_reset_status(struct reset_ctl *reset_ctl) { struct airoha_reset_priv *priv = dev_get_priv(reset_ctl->dev); int id = reset_ctl->id; - void __iomem *addr; + u16 offset; + u32 val; + int ret; - addr = priv->base + priv->bank_ofs[id / RST_NR_PER_BANK]; + offset = priv->bank_ofs[id / RST_NR_PER_BANK]; + ret = regmap_read(priv->map, offset, &val); + if (ret) + return ret; - return !!(readl(addr) & BIT(id % RST_NR_PER_BANK)); + return !!(val & BIT(id % RST_NR_PER_BANK)); } static int airoha_reset_xlate(struct reset_ctl *reset_ctl, @@ -153,10 +153,11 @@ static struct reset_ops airoha_reset_ops = { static int airoha_reset_probe(struct udevice *dev) { struct airoha_reset_priv *priv = dev_get_priv(dev); + int ret; - priv->base = dev_remap_addr(dev); - if (!priv->base) - return -ENOMEM; + ret = regmap_init_mem(dev_ofnode(dev), &priv->map); + if (ret) + return ret; priv->bank_ofs = en7581_rst_ofs; priv->idx_map = en7581_rst_map; -- cgit v1.3.1 From f1cae1f63d9a483853fb28e9b74607d27a7ed2cc Mon Sep 17 00:00:00 2001 From: Mikhail Kshevetskiy Date: Sat, 1 Nov 2025 03:44:53 +0300 Subject: reset: airoha: unify code using SCU regmap helper This patch unify probing code using airoha SCU regmap helper, thus a common function can be used instead of an7581/an7583 specific ones. Signed-off-by: Mikhail Kshevetskiy --- drivers/reset/reset-airoha.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/reset/reset-airoha.c b/drivers/reset/reset-airoha.c index a618bf62b4d..58b868d9855 100644 --- a/drivers/reset/reset-airoha.c +++ b/drivers/reset/reset-airoha.c @@ -11,6 +11,7 @@ #include #include #include +#include #include @@ -153,11 +154,10 @@ static struct reset_ops airoha_reset_ops = { static int airoha_reset_probe(struct udevice *dev) { struct airoha_reset_priv *priv = dev_get_priv(dev); - int ret; - ret = regmap_init_mem(dev_ofnode(dev), &priv->map); - if (ret) - return ret; + priv->map = airoha_get_scu_regmap(); + if (IS_ERR(priv->map)) + return PTR_ERR(priv->map); priv->bank_ofs = en7581_rst_ofs; priv->idx_map = en7581_rst_map; -- cgit v1.3.1 From 168af8e4f4de77053fa7abc60c8e24aeeff858ec Mon Sep 17 00:00:00 2001 From: Mikhail Kshevetskiy Date: Sat, 1 Nov 2025 03:44:54 +0300 Subject: dt-bindings: reset: Add reset support for Airoha EN7523 Introduce reset capability for EN7523 device-tree binding Signed-off-by: Mikhail Kshevetskiy --- include/dt-bindings/reset/airoha,en7523-reset.h | 61 +++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 include/dt-bindings/reset/airoha,en7523-reset.h diff --git a/include/dt-bindings/reset/airoha,en7523-reset.h b/include/dt-bindings/reset/airoha,en7523-reset.h new file mode 100644 index 00000000000..bb0a28673d6 --- /dev/null +++ b/include/dt-bindings/reset/airoha,en7523-reset.h @@ -0,0 +1,61 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */ +/* + * Copyright (C) 2024 iopsys Software Solutions AB. + * Copyright (C) 2025 Genexis AB. + * + * Author: Mikhail Kshevetskiy + * + * based on + * dts/upstream/include/dt-bindings/reset/airoha,en7581-reset.h + * by Lorenzo Bianconi + */ + +#ifndef __DT_BINDINGS_RESET_CONTROLLER_AIROHA_EN7523_H_ +#define __DT_BINDINGS_RESET_CONTROLLER_AIROHA_EN7523_H_ + +/* RST_CTRL2 */ +#define EN7523_XPON_PHY_RST 0 +#define EN7523_XSI_MAC_RST 1 +#define EN7523_XSI_PHY_RST 2 +#define EN7523_NPU_RST 3 +#define EN7523_I2S_RST 4 +#define EN7523_TRNG_RST 5 +#define EN7523_TRNG_MSTART_RST 6 +#define EN7523_DUAL_HSI0_RST 7 +#define EN7523_DUAL_HSI1_RST 8 +#define EN7523_HSI_RST 9 +#define EN7523_DUAL_HSI0_MAC_RST 10 +#define EN7523_DUAL_HSI1_MAC_RST 11 +#define EN7523_HSI_MAC_RST 12 +#define EN7523_WDMA_RST 13 +#define EN7523_WOE0_RST 14 +#define EN7523_WOE1_RST 15 +#define EN7523_HSDMA_RST 16 +#define EN7523_I2C2RBUS_RST 17 +#define EN7523_TDMA_RST 18 +/* RST_CTRL1 */ +#define EN7523_PCM1_ZSI_ISI_RST 19 +#define EN7523_FE_PDMA_RST 20 +#define EN7523_FE_QDMA_RST 21 +#define EN7523_PCM_SPIWP_RST 22 +#define EN7523_CRYPTO_RST 23 +#define EN7523_TIMER_RST 24 +#define EN7523_PCM1_RST 25 +#define EN7523_UART_RST 26 +#define EN7523_GPIO_RST 27 +#define EN7523_GDMA_RST 28 +#define EN7523_I2C_MASTER_RST 29 +#define EN7523_PCM2_ZSI_ISI_RST 30 +#define EN7523_SFC_RST 31 +#define EN7523_UART2_RST 32 +#define EN7523_GDMP_RST 33 +#define EN7523_FE_RST 34 +#define EN7523_USB_HOST_P0_RST 35 +#define EN7523_GSW_RST 36 +#define EN7523_SFC2_PCM_RST 37 +#define EN7523_PCIE0_RST 38 +#define EN7523_PCIE1_RST 39 +#define EN7523_PCIE_HB_RST 40 +#define EN7523_XPON_MAC_RST 41 + +#endif /* __DT_BINDINGS_RESET_CONTROLLER_AIROHA_EN7523_H_ */ -- cgit v1.3.1 From 1b333e40630f42173270b964ed69be494c2df53a Mon Sep 17 00:00:00 2001 From: Mikhail Kshevetskiy Date: Sat, 1 Nov 2025 03:44:55 +0300 Subject: reset: airoha: add support for airoha en7523 SoC family This adds reset controller support for airoha en7523/en7529/en7562 SoCs. Signed-off-by: Mikhail Kshevetskiy --- drivers/reset/reset-airoha.c | 71 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 3 deletions(-) diff --git a/drivers/reset/reset-airoha.c b/drivers/reset/reset-airoha.c index 58b868d9855..ef8c47a067b 100644 --- a/drivers/reset/reset-airoha.c +++ b/drivers/reset/reset-airoha.c @@ -13,6 +13,7 @@ #include #include +#include #include #define RST_NR_PER_BANK 32 @@ -23,6 +24,7 @@ struct airoha_reset_priv { const u16 *bank_ofs; const u16 *idx_map; + int num_rsts; struct regmap *map; }; @@ -31,6 +33,53 @@ static const u16 en7581_rst_ofs[] = { REG_RESET_CONTROL1, }; +static const u16 en7523_rst_map[] = { + /* RST_CTRL2 */ + [EN7523_XPON_PHY_RST] = 0, + [EN7523_XSI_MAC_RST] = 7, + [EN7523_XSI_PHY_RST] = 8, + [EN7523_NPU_RST] = 9, + [EN7523_I2S_RST] = 10, + [EN7523_TRNG_RST] = 11, + [EN7523_TRNG_MSTART_RST] = 12, + [EN7523_DUAL_HSI0_RST] = 13, + [EN7523_DUAL_HSI1_RST] = 14, + [EN7523_HSI_RST] = 15, + [EN7523_DUAL_HSI0_MAC_RST] = 16, + [EN7523_DUAL_HSI1_MAC_RST] = 17, + [EN7523_HSI_MAC_RST] = 18, + [EN7523_WDMA_RST] = 19, + [EN7523_WOE0_RST] = 20, + [EN7523_WOE1_RST] = 21, + [EN7523_HSDMA_RST] = 22, + [EN7523_I2C2RBUS_RST] = 23, + [EN7523_TDMA_RST] = 24, + /* RST_CTRL1 */ + [EN7523_PCM1_ZSI_ISI_RST] = RST_NR_PER_BANK + 0, + [EN7523_FE_PDMA_RST] = RST_NR_PER_BANK + 1, + [EN7523_FE_QDMA_RST] = RST_NR_PER_BANK + 2, + [EN7523_PCM_SPIWP_RST] = RST_NR_PER_BANK + 4, + [EN7523_CRYPTO_RST] = RST_NR_PER_BANK + 6, + [EN7523_TIMER_RST] = RST_NR_PER_BANK + 8, + [EN7523_PCM1_RST] = RST_NR_PER_BANK + 11, + [EN7523_UART_RST] = RST_NR_PER_BANK + 12, + [EN7523_GPIO_RST] = RST_NR_PER_BANK + 13, + [EN7523_GDMA_RST] = RST_NR_PER_BANK + 14, + [EN7523_I2C_MASTER_RST] = RST_NR_PER_BANK + 16, + [EN7523_PCM2_ZSI_ISI_RST] = RST_NR_PER_BANK + 17, + [EN7523_SFC_RST] = RST_NR_PER_BANK + 18, + [EN7523_UART2_RST] = RST_NR_PER_BANK + 19, + [EN7523_GDMP_RST] = RST_NR_PER_BANK + 20, + [EN7523_FE_RST] = RST_NR_PER_BANK + 21, + [EN7523_USB_HOST_P0_RST] = RST_NR_PER_BANK + 22, + [EN7523_GSW_RST] = RST_NR_PER_BANK + 23, + [EN7523_SFC2_PCM_RST] = RST_NR_PER_BANK + 25, + [EN7523_PCIE0_RST] = RST_NR_PER_BANK + 26, + [EN7523_PCIE1_RST] = RST_NR_PER_BANK + 27, + [EN7523_PCIE_HB_RST] = RST_NR_PER_BANK + 29, + [EN7523_XPON_MAC_RST] = RST_NR_PER_BANK + 31, +}; + static const u16 en7581_rst_map[] = { /* RST_CTRL2 */ [EN7581_XPON_PHY_RST] = 0, @@ -136,7 +185,7 @@ static int airoha_reset_xlate(struct reset_ctl *reset_ctl, { struct airoha_reset_priv *priv = dev_get_priv(reset_ctl->dev); - if (args->args[0] >= ARRAY_SIZE(en7581_rst_map)) + if (args->args[0] >= priv->num_rsts) return -EINVAL; reset_ctl->id = priv->idx_map[args->args[0]]; @@ -151,7 +200,7 @@ static struct reset_ops airoha_reset_ops = { .rst_status = airoha_reset_status, }; -static int airoha_reset_probe(struct udevice *dev) +static int reset_init(struct udevice *dev, const u16 *rst_map, int num_rsts) { struct airoha_reset_priv *priv = dev_get_priv(dev); @@ -160,11 +209,27 @@ static int airoha_reset_probe(struct udevice *dev) return PTR_ERR(priv->map); priv->bank_ofs = en7581_rst_ofs; - priv->idx_map = en7581_rst_map; + priv->idx_map = rst_map; + priv->num_rsts = num_rsts; return 0; } +static int airoha_reset_probe(struct udevice *dev) +{ + if (ofnode_device_is_compatible(dev_ofnode(dev), + "airoha,en7523-scu")) + return reset_init(dev, en7523_rst_map, + ARRAY_SIZE(en7523_rst_map)); + + if (ofnode_device_is_compatible(dev_ofnode(dev), + "airoha,en7581-scu")) + return reset_init(dev, en7581_rst_map, + ARRAY_SIZE(en7581_rst_map)); + + return -ENODEV; +} + U_BOOT_DRIVER(airoha_reset) = { .name = "airoha-reset", .id = UCLASS_RESET, -- cgit v1.3.1 From 4dd7df70b8415b98d4bfcf23adb018ac39e3dcd0 Mon Sep 17 00:00:00 2001 From: Mikhail Kshevetskiy Date: Sat, 1 Nov 2025 03:44:56 +0300 Subject: dts: airoha: en7523: add reset controller support This patch adds reset controller support to en7523 dts Signed-off-by: Mikhail Kshevetskiy --- arch/arm/dts/en7523-u-boot.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/dts/en7523-u-boot.dtsi b/arch/arm/dts/en7523-u-boot.dtsi index 34fa8069f9e..e5a84dc56eb 100644 --- a/arch/arm/dts/en7523-u-boot.dtsi +++ b/arch/arm/dts/en7523-u-boot.dtsi @@ -1,5 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ +#include + / { reserved-memory { #address-cells = <1>; @@ -17,6 +19,7 @@ reg = <0x1fa20000 0x400>, <0x1fb00000 0x1000>; #clock-cells = <1>; + #reset-cells = <1>; }; }; -- cgit v1.3.1 From 4d6da602e3ee7907dc33cadc225f6ab06117f845 Mon Sep 17 00:00:00 2001 From: Mikhail Kshevetskiy Date: Sat, 1 Nov 2025 03:44:57 +0300 Subject: configs: airoha: en7523: enable reset controller support This patch activates reset controller support for en7523 based boards Signed-off-by: Mikhail Kshevetskiy --- configs/en7523_evb_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/en7523_evb_defconfig b/configs/en7523_evb_defconfig index b7675d822b0..2a57f50e851 100644 --- a/configs/en7523_evb_defconfig +++ b/configs/en7523_evb_defconfig @@ -44,6 +44,7 @@ CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SYS_RX_ETH_BUFFER=8 CONFIG_REGMAP=y CONFIG_CLK=y +CONFIG_DM_RESET=y CONFIG_DMA=y CONFIG_LED=y CONFIG_LED_GPIO=y -- cgit v1.3.1 From 801a84b1a46ac70f49772a2c7069a33cd30cf720 Mon Sep 17 00:00:00 2001 From: Mikhail Kshevetskiy Date: Sat, 1 Nov 2025 03:44:58 +0300 Subject: net: airoha: unify code using SCU regmap helper This allow us remove some an7581/an7583 specific code and use a common code instead. Signed-off-by: Mikhail Kshevetskiy --- drivers/net/airoha_eth.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/airoha_eth.c b/drivers/net/airoha_eth.c index 19c3d60044c..62dd7f7353d 100644 --- a/drivers/net/airoha_eth.c +++ b/drivers/net/airoha_eth.c @@ -21,6 +21,7 @@ #include #include #include +#include #define AIROHA_MAX_NUM_GDM_PORTS 1 #define AIROHA_MAX_NUM_QDMA 1 @@ -720,14 +721,9 @@ static int airoha_eth_probe(struct udevice *dev) { struct airoha_eth *eth = dev_get_priv(dev); struct regmap *scu_regmap; - ofnode scu_node; int ret; - scu_node = ofnode_by_compatible(ofnode_null(), "airoha,en7581-scu"); - if (!ofnode_valid(scu_node)) - return -EINVAL; - - scu_regmap = syscon_node_to_regmap(scu_node); + scu_regmap = airoha_get_scu_regmap(); if (IS_ERR(scu_regmap)) return PTR_ERR(scu_regmap); -- cgit v1.3.1 From 251e27fcc209f840b4f33615f89e4859ddb44242 Mon Sep 17 00:00:00 2001 From: Mikhail Kshevetskiy Date: Sat, 1 Nov 2025 03:44:59 +0300 Subject: net: airoha: add support for airoha en7523 SoC family Add support for Ethernet controller present in Airoha en7523/en7529/en7562. Signed-off-by: Mikhail Kshevetskiy --- drivers/net/airoha_eth.c | 70 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/drivers/net/airoha_eth.c b/drivers/net/airoha_eth.c index 62dd7f7353d..3234d875887 100644 --- a/drivers/net/airoha_eth.c +++ b/drivers/net/airoha_eth.c @@ -313,6 +313,25 @@ struct airoha_eth { struct airoha_gdm_port *ports[AIROHA_MAX_NUM_GDM_PORTS]; }; +struct airoha_eth_soc_data { + int num_xsi_rsts; + const char * const *xsi_rsts_names; + const char *switch_compatible; +}; + +static const char * const en7523_xsi_rsts_names[] = { + "hsi0-mac", + "hsi1-mac", + "hsi-mac", +}; + +static const char * const en7581_xsi_rsts_names[] = { + "hsi0-mac", + "hsi1-mac", + "hsi-mac", + "xfp-mac", +}; + static u32 airoha_rr(void __iomem *base, u32 offset) { return readl(base + offset); @@ -679,10 +698,12 @@ static int airoha_hw_init(struct udevice *dev, static int airoha_switch_init(struct udevice *dev, struct airoha_eth *eth) { + struct airoha_eth_soc_data *data = (void *)dev_get_driver_data(dev); ofnode switch_node; fdt_addr_t addr; - switch_node = ofnode_by_compatible(ofnode_null(), "airoha,en7581-switch"); + switch_node = ofnode_by_compatible(ofnode_null(), + data->switch_compatible); if (!ofnode_valid(switch_node)) return -EINVAL; @@ -719,9 +740,10 @@ static int airoha_switch_init(struct udevice *dev, struct airoha_eth *eth) static int airoha_eth_probe(struct udevice *dev) { + struct airoha_eth_soc_data *data = (void *)dev_get_driver_data(dev); struct airoha_eth *eth = dev_get_priv(dev); struct regmap *scu_regmap; - int ret; + int i, ret; scu_regmap = airoha_get_scu_regmap(); if (IS_ERR(scu_regmap)) @@ -743,11 +765,11 @@ static int airoha_eth_probe(struct udevice *dev) return -ENOMEM; eth->rsts.count = AIROHA_MAX_NUM_RSTS; - eth->xsi_rsts.resets = devm_kcalloc(dev, AIROHA_MAX_NUM_XSI_RSTS, + eth->xsi_rsts.resets = devm_kcalloc(dev, data->num_xsi_rsts, sizeof(struct reset_ctl), GFP_KERNEL); if (!eth->xsi_rsts.resets) return -ENOMEM; - eth->xsi_rsts.count = AIROHA_MAX_NUM_XSI_RSTS; + eth->xsi_rsts.count = data->num_xsi_rsts; ret = reset_get_by_name(dev, "fe", ð->rsts.resets[0]); if (ret) @@ -761,21 +783,12 @@ static int airoha_eth_probe(struct udevice *dev) if (ret) return ret; - ret = reset_get_by_name(dev, "hsi0-mac", ð->xsi_rsts.resets[0]); - if (ret) - return ret; - - ret = reset_get_by_name(dev, "hsi1-mac", ð->xsi_rsts.resets[1]); - if (ret) - return ret; - - ret = reset_get_by_name(dev, "hsi-mac", ð->xsi_rsts.resets[2]); - if (ret) - return ret; - - ret = reset_get_by_name(dev, "xfp-mac", ð->xsi_rsts.resets[3]); - if (ret) - return ret; + for (i = 0; i < data->num_xsi_rsts; i++) { + ret = reset_get_by_name(dev, data->xsi_rsts_names[i], + ð->xsi_rsts.resets[i]); + if (ret) + return ret; + } ret = airoha_hw_init(dev, eth); if (ret) @@ -969,8 +982,25 @@ static int arht_eth_write_hwaddr(struct udevice *dev) return 0; } +static const struct airoha_eth_soc_data en7523_data = { + .xsi_rsts_names = en7523_xsi_rsts_names, + .num_xsi_rsts = ARRAY_SIZE(en7523_xsi_rsts_names), + .switch_compatible = "airoha,en7523-switch", +}; + +static const struct airoha_eth_soc_data en7581_data = { + .xsi_rsts_names = en7581_xsi_rsts_names, + .num_xsi_rsts = ARRAY_SIZE(en7581_xsi_rsts_names), + .switch_compatible = "airoha,en7581-switch", +}; + static const struct udevice_id airoha_eth_ids[] = { - { .compatible = "airoha,en7581-eth" }, + { .compatible = "airoha,en7523-eth", + .data = (ulong)&en7523_data, + }, + { .compatible = "airoha,en7581-eth", + .data = (ulong)&en7581_data, + }, { } }; -- cgit v1.3.1 From 760063efb04dc997e70dd7fd825c7aab0b1d982e Mon Sep 17 00:00:00 2001 From: Mikhail Kshevetskiy Date: Sat, 1 Nov 2025 03:45:00 +0300 Subject: dts: airoha: en7523: add ethernet controller support This patch adds integrated ethernet controller support to en7523 dts Signed-off-by: Mikhail Kshevetskiy --- arch/arm/dts/en7523-u-boot.dtsi | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/arch/arm/dts/en7523-u-boot.dtsi b/arch/arm/dts/en7523-u-boot.dtsi index e5a84dc56eb..e22938ac5d7 100644 --- a/arch/arm/dts/en7523-u-boot.dtsi +++ b/arch/arm/dts/en7523-u-boot.dtsi @@ -22,6 +22,27 @@ #reset-cells = <1>; }; + eth: ethernet@1fb50000 { + compatible = "airoha,en7523-eth"; + reg = <0x1fb50000 0x2600>, + <0x1fb54000 0x2000>, + <0x1fb56000 0x2000>; + reg-names = "fe", "qdma0", "qdma1"; + + resets = <&scu EN7523_FE_RST>, + <&scu EN7523_FE_PDMA_RST>, + <&scu EN7523_FE_QDMA_RST>, + <&scu EN7523_DUAL_HSI0_MAC_RST>, + <&scu EN7523_DUAL_HSI1_MAC_RST>, + <&scu EN7523_HSI_MAC_RST>; + reset-names = "fe", "pdma", "qdma", + "hsi0-mac", "hsi1-mac", "hsi-mac"; + }; + + switch: switch@1fb58000 { + compatible = "airoha,en7523-switch"; + reg = <0x1fb58000 0x8000>; + }; }; &uart1 { -- cgit v1.3.1 From 2ccd4b4efb44134a6ebda9c90aaf64e9573f0b66 Mon Sep 17 00:00:00 2001 From: Mikhail Kshevetskiy Date: Sat, 1 Nov 2025 03:45:01 +0300 Subject: configs: airoha: en7523: enable ethernet controller support This patch activates ethernet controller support for en7523 based boards Signed-off-by: Mikhail Kshevetskiy --- configs/en7523_evb_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/en7523_evb_defconfig b/configs/en7523_evb_defconfig index 2a57f50e851..11b7e85f731 100644 --- a/configs/en7523_evb_defconfig +++ b/configs/en7523_evb_defconfig @@ -51,6 +51,8 @@ CONFIG_LED_GPIO=y # CONFIG_MMC is not set CONFIG_MTD=y CONFIG_DM_MTD=y +CONFIG_AIROHA_ETH=y +CONFIG_PHY=y CONFIG_PINCTRL=y CONFIG_PINCONF=y CONFIG_RAM=y -- cgit v1.3.1 From 4fabdc415c4a4a2a79d88c1d73e69d3d463ef631 Mon Sep 17 00:00:00 2001 From: Mikhail Kshevetskiy Date: Sat, 1 Nov 2025 03:45:02 +0300 Subject: dts: airoha: en7523: add spinand flash support This patch adds spinand flashes support to en7523 dts Signed-off-by: Mikhail Kshevetskiy --- arch/arm/dts/en7523-u-boot.dtsi | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/arm/dts/en7523-u-boot.dtsi b/arch/arm/dts/en7523-u-boot.dtsi index e22938ac5d7..90838c00a85 100644 --- a/arch/arm/dts/en7523-u-boot.dtsi +++ b/arch/arm/dts/en7523-u-boot.dtsi @@ -43,6 +43,26 @@ compatible = "airoha,en7523-switch"; reg = <0x1fb58000 0x8000>; }; + + snfi: spi@1fa10000 { + compatible = "airoha,en7523-snand", "airoha,en7581-snand"; + reg = <0x1fa10000 0x140>, + <0x1fa11000 0x600>; + + clocks = <&scu EN7523_CLK_SPI>; + clock-names = "spi"; + + #address-cells = <1>; + #size-cells = <0>; + + spi_nand: nand@0 { + compatible = "spi-nand"; + reg = <0>; + spi-max-frequency = <50000000>; + spi-tx-bus-width = <1>; + spi-rx-bus-width = <1>; + }; + }; }; &uart1 { -- cgit v1.3.1 From 475dec28805bf0c84ce83ec06d452b4ee8b5f9a9 Mon Sep 17 00:00:00 2001 From: Mikhail Kshevetskiy Date: Sat, 1 Nov 2025 03:45:03 +0300 Subject: configs: airoha: en7523: enable spinand flashes support This patch enable spinand flashes support for en7523 based boards Signed-off-by: Mikhail Kshevetskiy --- configs/en7523_evb_defconfig | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/configs/en7523_evb_defconfig b/configs/en7523_evb_defconfig index 11b7e85f731..76e829a8e99 100644 --- a/configs/en7523_evb_defconfig +++ b/configs/en7523_evb_defconfig @@ -5,6 +5,9 @@ CONFIG_TARGET_EN7523=y CONFIG_TEXT_BASE=0x81E00000 CONFIG_SYS_MALLOC_F_LEN=0x4000 CONFIG_NR_DRAM_BANKS=1 +CONFIG_ENV_MTD_DEV="spi-nand0" +CONFIG_ENV_SIZE=0x4000 +CONFIG_ENV_OFFSET=0x7c000 CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="airoha/en7523-evb" CONFIG_SYS_LOAD_ADDR=0x81800000 @@ -36,8 +39,7 @@ CONFIG_CMD_MTDPARTS=y CONFIG_CMD_LOG=y CONFIG_OF_UPSTREAM=y CONFIG_ENV_OVERWRITE=y -CONFIG_ENV_IS_NOWHERE=y -# CONFIG_ENV_IS_IN_MTD is not set +CONFIG_ENV_IS_IN_MTD=y CONFIG_ENV_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_NET_RANDOM_ETHADDR=y @@ -51,6 +53,7 @@ CONFIG_LED_GPIO=y # CONFIG_MMC is not set CONFIG_MTD=y CONFIG_DM_MTD=y +CONFIG_MTD_SPI_NAND=y CONFIG_AIROHA_ETH=y CONFIG_PHY=y CONFIG_PINCTRL=y @@ -58,4 +61,7 @@ CONFIG_PINCONF=y CONFIG_RAM=y CONFIG_DM_SERIAL=y CONFIG_SYS_NS16550=y +CONFIG_SPI=y +CONFIG_DM_SPI=y +CONFIG_AIROHA_SNFI_SPI=y CONFIG_SHA512=y -- cgit v1.3.1