]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
arm: mach-sunxi: add syscon driver for system-control nodes
authorJunhui Liu <junhui.liu@pigmoral.tech>
Tue, 19 May 2026 12:58:29 +0000 (20:58 +0800)
committerAndre Przywara <andre.przywara@arm.com>
Sun, 26 Jul 2026 22:30:21 +0000 (00:30 +0200)
The upstream Linux kernel relies on the sunxi_sram driver to bind the
system-control nodes as syscon devices. Since U-Boot lacks this SRAM
driver, peripheral drivers may fail to resolve the syscon node unless an
explicit "syscon" compatible is added into the device tree.

To address this, add a bare UCLASS_SYSCON driver that matches all
Allwinner system-control and SRAM controller compatibles listed in the
Linux kernel to provide the necessary regmap access to the system
controller.

Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
arch/arm/mach-sunxi/Kconfig
arch/arm/mach-sunxi/Makefile
arch/arm/mach-sunxi/syscon.c [new file with mode: 0644]

index 5ace74567dd56f2428679ff276066e33ee216d42..b0c5d3cd90391c408fbe2fc4206ad0af060a5160 100644 (file)
@@ -209,6 +209,13 @@ config SUN6I_PRCM
          Support for the PRCM (Power/Reset/Clock Management) unit available
          in A31 SoC.
 
+config SUNXI_SYSCON
+       bool
+       select SYSCON
+       help
+         Enable syscon driver for Allwinner system controllers, which provides
+         access to the SRAM/system-control node for drivers.
+
 config AXP_PMIC_BUS
        bool
        select DM_PMIC if DM_I2C
index 9c79b55abf3661710aa0925bf6815a4437bc15a3..ff475d8fff5fc8da3706edf70049cfe52ab4bf82 100644 (file)
@@ -10,6 +10,7 @@ obj-y += board.o
 obj-y  += cpu_info.o
 obj-y  += dram_helpers.o
 obj-$(CONFIG_SUN6I_PRCM)       += prcm.o
+obj-$(CONFIG_SUNXI_SYSCON)     += syscon.o
 obj-$(CONFIG_AXP_PMIC_BUS)     += pmic_bus.o
 obj-$(CONFIG_MACH_SUNIV)       += clock_sun6i.o
 obj-$(CONFIG_MACH_SUN4I)       += clock_sun4i.o
diff --git a/arch/arm/mach-sunxi/syscon.c b/arch/arm/mach-sunxi/syscon.c
new file mode 100644 (file)
index 0000000..e27110d
--- /dev/null
@@ -0,0 +1,28 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2026 Junhui Liu <junhui.liu@pigmoral.tech>
+ */
+
+#include <dm.h>
+#include <syscon.h>
+
+static const struct udevice_id sunxi_syscon_ids[] = {
+       { .compatible = "allwinner,sun4i-a10-sram-controller" },
+       { .compatible = "allwinner,sun4i-a10-system-control" },
+       { .compatible = "allwinner,sun5i-a13-system-control" },
+       { .compatible = "allwinner,sun8i-a23-system-control" },
+       { .compatible = "allwinner,sun8i-h3-system-control" },
+       { .compatible = "allwinner,sun20i-d1-system-control" },
+       { .compatible = "allwinner,sun50i-a64-sram-controller" },
+       { .compatible = "allwinner,sun50i-a64-system-control" },
+       { .compatible = "allwinner,sun50i-h5-system-control" },
+       { .compatible = "allwinner,sun50i-h616-system-control" },
+       { .compatible = "allwinner,sun55i-a523-system-control" },
+       { /* sentinel */ },
+};
+
+U_BOOT_DRIVER(sunxi_syscon) = {
+       .name = "sunxi_syscon",
+       .id = UCLASS_SYSCON,
+       .of_match = sunxi_syscon_ids,
+};