summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>2025-11-01 03:44:48 +0300
committerTom Rini <trini@konsulko.com>2025-11-07 16:00:58 -0600
commit8e21740b68d06f71b4f9fb13b908a8828c5c7e2d (patch)
tree32069034364493fb02367f5c8ff834b63e871640
parent9aa3e440c6e64b9af6a8e679d08686b9e816eecf (diff)
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 <mikhail.kshevetskiy@iopsys.eu>
l---------arch/arm/include/asm/arch-en75231
-rw-r--r--arch/arm/mach-airoha/en7523/Makefile1
-rw-r--r--arch/arm/mach-airoha/en7523/scu-regmap.c38
3 files changed, 40 insertions, 0 deletions
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 <mikhail.kshevetskiy@iopsys.eu>
+ */
+
+#include <dm/ofnode.h>
+#include <linux/err.h>
+#include <asm/arch/scu-regmap.h>
+
+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);
+}