Skip to contentSkip to conversation

airoha: Add initial support AN7581

PATCH Superseded Christian Marangi 2 participants 7 messages Mar 9, 2025 – Mar 10, 2025

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover airoha: Add initial support AN7581

This little series adds initial support for Airoha AN7581 SoC.

All driver are created with OF_UPSTREAM support in mind and the very same binding and include are used as reference.

Posting this to have the targer and the very basic driver.

Ethernet, SNAND and eMMC support is already ready downstream and will be posted shortly after this gets approved.

Having the first driver ready permits to separately push dedicate series for SNAND, eMMC and Ethrnet as they all depends on basic support of clock and reset and nothing else.

Christian Marangi (4):
airoha: Add initial support for Airoha AN7581 SoC
clk: airoha: Add support for Airoha AN7581 SoC clock
reset: airoha: Add driver for controlling reset line of AN7581
arch: arm: dts: an7581-evb: Add clock and reset nodes

 arch/arm/Kconfig                              |   9 +
 arch/arm/Makefile                             |   1 +
 arch/arm/dts/an7581-evb.dts                   | 162 +++++++
 arch/arm/mach-airoha/Kconfig                  |  44 ++
 arch/arm/mach-airoha/Makefile                 |   5 +
 arch/arm/mach-airoha/an7581/Makefile          |   3 +
 arch/arm/mach-airoha/an7581/init.c            |  47 ++
 arch/arm/mach-airoha/cpu.c                    |  20 +
 board/airoha/an7581/MAINTAINERS               |   6 +
 board/airoha/an7581/Makefile                  |   3 +
 board/airoha/an7581/an7581_rfb.c              |  16 +
 configs/an7581_evb_defconfig                  | 137 ++++++
 drivers/clk/Makefile                          |   1 +
 drivers/clk/airoha/Makefile                   |   3 +
 drivers/clk/airoha/clk-airoha.c               | 454 ++++++++++++++++++
 drivers/reset/Kconfig                         |   7 +
 drivers/reset/Makefile                        |   1 +
 drivers/reset/reset-airoha.c                  | 173 +++++++
 include/configs/an7581.h                      |  19 +
 include/dt-bindings/clock/en7523-clk.h        |  17 +
 .../dt-bindings/reset/airoha,en7581-reset.h   |  66 +++
 21 files changed, 1194 insertions(+)
 create mode 100644 arch/arm/dts/an7581-evb.dts
 create mode 100644 arch/arm/mach-airoha/Kconfig
 create mode 100644 arch/arm/mach-airoha/Makefile
 create mode 100644 arch/arm/mach-airoha/an7581/Makefile
 create mode 100644 arch/arm/mach-airoha/an7581/init.c
 create mode 100644 arch/arm/mach-airoha/cpu.c
 create mode 100644 board/airoha/an7581/MAINTAINERS
 create mode 100644 board/airoha/an7581/Makefile
 create mode 100644 board/airoha/an7581/an7581_rfb.c
 create mode 100644 configs/an7581_evb_defconfig
 create mode 100644 drivers/clk/airoha/Makefile
 create mode 100644 drivers/clk/airoha/clk-airoha.c
 create mode 100644 drivers/reset/reset-airoha.c
 create mode 100644 include/configs/an7581.h
 create mode 100644 include/dt-bindings/clock/en7523-clk.h
 create mode 100644 include/dt-bindings/reset/airoha,en7581-reset.h
Signature · 1 line
2.48.1
#1 lore raw

PATCH 1/4 airoha: Add initial support for Airoha AN7581 SoC

Add initial support for Airoha AN7581 SoC. This adds the initial Kconfig and Makefile entry for the SoC, an initial RFB DTS and initial config for it. Also add the initial code for cpu and RAM initialization.

---
 arch/arm/Kconfig                     |   9 ++
 arch/arm/Makefile                    |   1 +
 arch/arm/dts/an7581-evb.dts          | 144 +++++++++++++++++++++++++++
 arch/arm/mach-airoha/Kconfig         |  44 ++++++++
 arch/arm/mach-airoha/Makefile        |   5 +
 arch/arm/mach-airoha/an7581/Makefile |   3 +
 arch/arm/mach-airoha/an7581/init.c   |  47 +++++++++
 arch/arm/mach-airoha/cpu.c           |  20 ++++
 board/airoha/an7581/MAINTAINERS      |   6 ++
 board/airoha/an7581/Makefile         |   3 +
 board/airoha/an7581/an7581_rfb.c     |  16 +++
 configs/an7581_evb_defconfig         | 137 +++++++++++++++++++++++++
 include/configs/an7581.h             |  19 ++++
 13 files changed, 454 insertions(+)
 create mode 100644 arch/arm/dts/an7581-evb.dts
 create mode 100644 arch/arm/mach-airoha/Kconfig
 create mode 100644 arch/arm/mach-airoha/Makefile
 create mode 100644 arch/arm/mach-airoha/an7581/Makefile
 create mode 100644 arch/arm/mach-airoha/an7581/init.c
 create mode 100644 arch/arm/mach-airoha/cpu.c
 create mode 100644 board/airoha/an7581/MAINTAINERS
 create mode 100644 board/airoha/an7581/Makefile
 create mode 100644 board/airoha/an7581/an7581_rfb.c
 create mode 100644 configs/an7581_evb_defconfig
 create mode 100644 include/configs/an7581.h
arch/arm/Kconfig +9 -0
index da6f1174934..4729ac39257 100644
@@ -600,6 +600,13 @@ choice
 	prompt "Target select"
 	default TARGET_HIKEY
 
+config ARCH_AIROHA
+	bool "Airoha SoCs"
+	select DM
+	select OF_CONTROL
+	help
+	  Support for the Airoha soc.
+
 config ARCH_AT91
 	bool "Atmel AT91"
 	select GPIO_EXTRA_HEADER
@@ -2251,6 +2258,8 @@ config SYS_KWD_CONFIG
 	  Path within the source directory to the kwbimage.cfg file to use
 	  when packaging the U-Boot image for use.
 
+source "arch/arm/mach-airoha/Kconfig"
+
 source "arch/arm/mach-apple/Kconfig"
 
 source "arch/arm/mach-aspeed/Kconfig"
arch/arm/Makefile +1 -0
index 7334e79965f..5ecadb2ef1b 100644
@@ -51,6 +51,7 @@ PLATFORM_CPPFLAGS += $(arch-y) $(tune-y)
 
 # Machine directory name.  This list is sorted alphanumerically
 # by CONFIG_* macro name.
+machine-$(CONFIG_ARCH_AIROHA)		+= airoha
 machine-$(CONFIG_ARCH_APPLE)		+= apple
 machine-$(CONFIG_ARCH_ASPEED)		+= aspeed
 machine-$(CONFIG_ARCH_AT91)		+= at91
arch/arm/dts/an7581-evb.dts new file +144 -0

144 lines not on this page · raw message

arch/arm/mach-airoha/Kconfig new file +44 -0

44 lines not on this page · raw message

arch/arm/mach-airoha/Makefile new file +5 -0
new file mode 100644
index 00000000000..215a300373b
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y	+= cpu.o
+
+obj-$(CONFIG_TARGET_AN7581) += an7581/
arch/arm/mach-airoha/an7581/Makefile new file +3 -0
new file mode 100644
index 00000000000..886ab7e4eb9
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y += init.o
arch/arm/mach-airoha/an7581/init.c new file +47 -0

47 lines not on this page · raw message

arch/arm/mach-airoha/cpu.c new file +20 -0
new file mode 100644
index 00000000000..a578e964664
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <cpu_func.h>
+#include <dm.h>
+#include <init.h>
+#include <wdt.h>
+#include <dm/uclass-internal.h>
+
+int arch_cpu_init(void)
+{
+	icache_enable();
+
+	return 0;
+}
+
+void enable_caches(void)
+{
+	/* Enable D-cache. I-cache is already enabled in start.S */
+	dcache_enable();
+}
board/airoha/an7581/MAINTAINERS new file +6 -0
new file mode 100644
index 00000000000..480b89a73aa
@@ -0,0 +1,6 @@
+AN7581
+M:	Christian Marangi <[email protected]>
+S:	Maintained
+F:	board/airoha/an7581
+F:	include/configs/an7581.h
+F:	configs/an7581_rfb_defconfig
board/airoha/an7581/Makefile new file +3 -0
new file mode 100644
index 00000000000..70f8db7bce9
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y	+= an7581_rfb.o
board/airoha/an7581/an7581_rfb.c new file +16 -0
new file mode 100644
index 00000000000..d38f7342949
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Author: Christian Marangi <[email protected]>
+ */
+
+#include <asm/global_data.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int board_init(void)
+{
+	/* address of boot parameters */
+	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
+
+	return 0;
+}
configs/an7581_evb_defconfig new file +137 -0

137 lines not on this page · raw message

include/configs/an7581.h new file +19 -0
new file mode 100644
index 00000000000..901d99b3456
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Configuration for Airoha AN7581
+ */
+
+#ifndef __AN7581_H
+#define __AN7581_H
+
+#include <linux/sizes.h>
+
+#define CONFIG_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 CONFIG_SYS_SDRAM_BASE		0x80000000
+
+#endif
Signature · 1 line
2.48.1
#2 lore raw

Re: [PATCH 1/4] airoha: Add initial support for Airoha AN7581 SoC

Quoted 5 lines · Christian Marangi

Add initial support for Airoha AN7581 SoC. This adds the initial Kconfig and Makefile entry for the SoC, an initial RFB DTS and initial config for it. Also add the initial code for cpu and RAM initialization.

[snip]

Quoted 37 lines
arch/arm/mach-airoha/Kconfig new file +31 -0
new file mode 100644
index 00000000000..0470a01034f
@@ -0,0 +1,44 @@
+if ARCH_AIROHA
+
+config SYS_SOC
+	default "airoha"
+
+config SYS_VENDOR
+	default "airoha"
+
+choice
+	prompt "Airoha board select"
+
+config TARGET_AN7581
+	bool "Airoha AN7581 SoC"
+	select ARM64
+	help
+	  The Airoha EN7581 is a ARM-based SoC with a quad-core Cortex-A7
+	  including NEON and GPU, Mali-450 graphics, several DDR3 options,
+	  crypto engine, built-in Wi-Fi / Bluetooth combo chip, JPEG decoder,
+	  video interfaces supporting HDMI and MIPI, and video codec support.
+	  Peripherals include Gigabit Ethernet, switch, USB3.0 and OTG, PCIe,
+	  I2S, PCM, S/PDIF, UART, SPI, I2C, IR TX/RX, and PWM.
+
+endchoice
+
+config SYS_BOARD
+	string "Board name"
+	default "an7581" if TARGET_AN7581
+	default ""
+	help
+	  This option contains information about board name.
+	  Based on this option board/<CONFIG_SYS_VENDOR>/<CONFIG_SYS_BOARD> will

arch/arm/mach-airoha/Kconfig line 41

Quoted 10 lines
arch/arm/mach-airoha/Kconfig new file +10 -0
+	  be used.
+
+config SYS_CONFIG_NAME
+	string "Board configuration name"
+	default "an7581" if TARGET_AN7581
+	default ""
+	help
+	  This option contains information about board configuration name.
+	  Based on this option include/configs/<CONFIG_SYS_CONFIG_NAME>.h header
+	  will be used for board configuration.

We shouldn't prompt for SYS_BOARD / SYS_CONFIG_NAME and instead just provide the values here.

[snip]

board/airoha/an7581/MAINTAINERS line 6

Quoted 12 lines
board/airoha/an7581/MAINTAINERS new file +6 -0
new file mode 100644
index 00000000000..480b89a73aa
@@ -0,0 +1,6 @@
+AN7581
+M:	Christian Marangi <[email protected]>
+S:	Maintained
+F:	board/airoha/an7581
+F:	include/configs/an7581.h
+F:	configs/an7581_rfb_defconfig

You should probably use the "N:" syntax here and say "N: an7581" to catch all the files later on too. Perhaps also "N: airoha" to catch the drivers you add later.

configs/an7581_evb_defconfig

Quoted 5 lines
configs/an7581_evb_defconfig new file +0 -0
new file mode 100644
index 00000000000..b37511c026e

This doesn't appear to be the output of "make savedefconfig" so please re-sync it with that.

Quoted 13 lines
include/configs/an7581.h new file +7 -0
new file mode 100644
index 00000000000..901d99b3456
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Configuration for Airoha AN7581
+ */
+
+#ifndef __AN7581_H
+#define __AN7581_H

include/configs/an7581.h line 17

Quoted 10 lines
include/configs/an7581.h new file +10 -0
+
+#include <linux/sizes.h>
+
+#define CONFIG_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 CONFIG_SYS_SDRAM_BASE		0x80000000

You cannot set CONFIG symbols in this file anymore.

Signature · 1 line
Tom
#3 lore raw

PATCH 2/4 clk: airoha: Add support for Airoha AN7581 SoC clock

In reply to Christian Marangi

Add support for Airoha AN7581 SoC clock driver. This mainly needed for eMMC support to correctly get the current clock applied.

Based on the Linux clk-en7523.c but majorly reworked for U-Boot that doesn't require CCF subsystem.

Major modification, support for set_rate, realtime get_rate and split for reset part to a different driver.

---
 drivers/clk/Makefile                   |   1 +
 drivers/clk/airoha/Makefile            |   3 +
 drivers/clk/airoha/clk-airoha.c        | 438 +++++++++++++++++++++++++
 include/dt-bindings/clock/en7523-clk.h |  17 +
 4 files changed, 459 insertions(+)
 create mode 100644 drivers/clk/airoha/Makefile
 create mode 100644 drivers/clk/airoha/clk-airoha.c
 create mode 100644 include/dt-bindings/clock/en7523-clk.h
drivers/clk/Makefile +1 -0
index fe0e49f6112..8411205ee04 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_$(PHASE_)CLK_GPIO) += clk-gpio.o
 obj-$(CONFIG_$(PHASE_)CLK_STUB) += clk-stub.o
 
 obj-y += adi/
+obj-y += airoha/
 obj-y += analogbits/
 obj-y += imx/
 obj-$(CONFIG_CLK_JH7110) += starfive/
drivers/clk/airoha/Makefile new file +3 -0
new file mode 100644
index 00000000000..1744c5f7236
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+# Core
+obj-$(CONFIG_ARCH_AIROHA) += clk-airoha.o
drivers/clk/airoha/clk-airoha.c new file +438 -0

438 lines not on this page · raw message

include/dt-bindings/clock/en7523-clk.h new file +17 -0
new file mode 100644
index 00000000000..edfa64045f5
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+
+#ifndef _DT_BINDINGS_CLOCK_AIROHA_EN7523_H_
+#define _DT_BINDINGS_CLOCK_AIROHA_EN7523_H_
+
+#define EN7523_CLK_GSW		0
+#define EN7523_CLK_EMI		1
+#define EN7523_CLK_BUS		2
+#define EN7523_CLK_SLIC		3
+#define EN7523_CLK_SPI		4
+#define EN7523_CLK_NPU		5
+#define EN7523_CLK_CRYPTO	6
+#define EN7523_CLK_PCIE		7
+
+#define EN7581_CLK_EMMC		8
+
+#endif /* _DT_BINDINGS_CLOCK_AIROHA_EN7523_H_ */
Signature · 1 line
2.48.1
#4 lore raw

PATCH 3/4 reset: airoha: Add driver for controlling reset line of AN7581

In reply to Christian Marangi

Add driver for controlling the reset lines of AN7581. This is a detached version of the clock controller driver present in Linux only used to control reset lines. Driver gets loaded with the bind of the clock driver and doesn't require a compatible. This is needed as they share the same registers.

---
 drivers/clk/airoha/clk-airoha.c               |  16 ++
 drivers/reset/Kconfig                         |   7 +
 drivers/reset/Makefile                        |   1 +
 drivers/reset/reset-airoha.c                  | 173 ++++++++++++++++++
 .../dt-bindings/reset/airoha,en7581-reset.h   |  66 +++++++
 5 files changed, 263 insertions(+)
 create mode 100644 drivers/reset/reset-airoha.c
 create mode 100644 include/dt-bindings/reset/airoha,en7581-reset.h
drivers/clk/airoha/clk-airoha.c +16 -0
index 96d120feba7..1b2c4c98de5 100644
@@ -416,6 +416,21 @@ static int airoha_clk_probe(struct udevice *dev)
 	return 0;
 }
 
+static int airoha_clk_bind(struct udevice *dev)
+{
+	struct udevice *rst_dev;
+	int ret = 0;
+
+	if (CONFIG_IS_ENABLED(RESET_AIROHA)) {
+		ret = device_bind_driver_to_node(dev, "airoha-reset", "reset",
+						 dev_ofnode(dev), &rst_dev);
+		if (ret)
+			debug("Warning: failed to bind reset controller\n");
+	}
+
+	return ret;
+}
+
 static const struct airoha_clk_soc_data en7581_data = {
 	.num_clocks = ARRAY_SIZE(en7581_base_clks),
 	.descs = en7581_base_clks,
@@ -433,6 +448,7 @@ U_BOOT_DRIVER(airoha_clk) = {
 	.id = UCLASS_CLK,
 	.of_match = airoha_clk_ids,
 	.probe = airoha_clk_probe,
+	.bind = airoha_clk_bind,
 	.priv_auto = sizeof(struct airoha_clk_priv),
 	.ops = &airoha_clk_ops,
 };
drivers/reset/Kconfig +7 -0
index fe5c1214f57..ee923c19f41 100644
@@ -49,6 +49,13 @@ config TEGRA186_RESET
 	  Enable support for manipulating Tegra's on-SoC reset signals via IPC
 	  requests to the BPMP (Boot and Power Management Processor).
 
+config RESET_AIROHA
+	bool "Reset controller driver for Airoha SoCs"
+	depends on DM_RESET && ARCH_AIROHA
+	default y
+	help
+	  Support for reset controller on Airoha SoCs.
+
 config RESET_TI_SCI
 	bool "TI System Control Interface (TI SCI) reset driver"
 	depends on DM_RESET && TI_SCI_PROTOCOL
drivers/reset/Makefile +1 -0
index d99a78c9828..524fc064417 100644
@@ -10,6 +10,7 @@ obj-$(CONFIG_STI_RESET) += sti-reset.o
 obj-$(CONFIG_STM32_RESET) += stm32-reset.o
 obj-$(CONFIG_TEGRA_CAR_RESET) += tegra-car-reset.o
 obj-$(CONFIG_TEGRA186_RESET) += tegra186-reset.o
+obj-$(CONFIG_RESET_AIROHA) += reset-airoha.o
 obj-$(CONFIG_RESET_TI_SCI) += reset-ti-sci.o
 obj-$(CONFIG_RESET_HSDK) += reset-hsdk.o
 obj-$(CONFIG_RESET_BCM6345) += reset-bcm6345.o
drivers/reset/reset-airoha.c new file +173 -0

173 lines not on this page · raw message

include/dt-bindings/reset/airoha,en7581-reset.h new file +66 -0

66 lines not on this page · raw message

Signature · 1 line
2.48.1
#5 lore raw

PATCH 4/4 arch: arm: dts: an7581-evb: Add clock and reset nodes

In reply to Christian Marangi

Add clock ande reset nodes in preparation for adding support for Ethernet and eMMC.

---
 arch/arm/dts/an7581-evb.dts | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm/dts/an7581-evb.dts +18 -0
index be600ad0664..7b886e1ec14 100644
@@ -4,6 +4,8 @@
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
+#include <dt-bindings/reset/airoha,en7581-reset.h>
+#include <dt-bindings/clock/en7523-clk.h>
 /dts-v1/;
 
 / {
@@ -141,4 +143,20 @@
 		clock-frequency = <1843200>;
 		bootph-all;
 	};
+
+	chip_scu: syscon@1fa20000 {
+		compatible = "airoha,en7581-chip-scu", "syscon";
+		reg = <0x0 0x1fa20000 0x0 0x388>;
+	};
+
+	scuclk: reset-controller@1fa20000 {
+		compatible = "airoha,en7581-scu", "syscon";
+		reg = <0x0 0x1fb00000 0x0 0x970>;
+		#clock-cells = <1>;
+		#reset-cells = <1>;
+
+		scu_ssr: system-controller {
+			compatible = "airoha,an7581-scu-ssr";
+		};
+	};
 };
Signature · 1 line
2.48.1
#6 lore raw
In reply to Christian Marangi
Quoted 4 lines · Christian Marangi

This little series adds initial support for Airoha AN7581 SoC.

All driver are created with OF_UPSTREAM support in mind and the very same binding and include are used as reference.

Please re-work the driver patches so that they use the bindings / includes from OF_UPSTREAM then, thanks.

Signature · 1 line
Tom