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 <mikhail.kshevetskiy@iopsys.eu>
This commit is contained in:
Mikhail Kshevetskiy
2025-11-07 16:00:58 -06:00
committed by Tom Rini
parent 97aa00e021
commit 9aa3e440c6
4 changed files with 45 additions and 0 deletions
@@ -0,0 +1,13 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Author: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
*/
#ifndef __AIROHA_SCU_REGMAP__
#define __AIROHA_SCU_REGMAP__
#include <regmap.h>
struct regmap *airoha_get_scu_regmap(void);
struct regmap *airoha_get_chip_scu_regmap(void);
#endif
+1
View File
@@ -0,0 +1 @@
arch-airoha
+1
View File
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: GPL-2.0
obj-y += init.o
obj-y += scu-regmap.o
+30
View File
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Author: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
*/
#include <syscon.h>
#include <linux/err.h>
#include <asm/arch/scu-regmap.h>
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);
}