Devicetree
 help / color / mirror / Atom feed
* [PATCH 0/6] clk: en7523: add support for Airoha AN7589
@ 2026-11-24 10:12 John Crispin
  2026-11-24 10:12 ` [PATCH 1/6] dt-bindings: arm: airoha: add AN7589 chip SCU John Crispin
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: John Crispin @ 2026-11-24 10:12 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Stephen Boyd,
	Brian Masney, Jerome Brunet, Philipp Zabel
  Cc: Daniel Lezcano, Christian Marangi, Vitaliy Sochnev,
	Lorenzo Bianconi, Felix Fietkau, devicetree, linux-clk,
	linux-kernel, lei.dong, Linqi.zhang, Rajeev.kumar, upstream,
	Weifeng.xu, zhengping.zhang

The Airoha AN7589 SCU is the EN7581 one with wider mux fields, new
base rate tables, new clocks and a third reset bank. This series adds
its clocks and resets to the en7523 driver.

Patch 1 adds the compatible of the AN7589 chip SCU. Patch 2 adds the
binding of the clock controller, the clock IDs and the reset header.
Patch 3 lets a SoC have fewer clock descriptors than clock IDs, which
the AN7589 needs because it has no GSW clock. Patch 4 adds the AN7589
clocks and resets.

Patches 5 and 6 are for the MDIO controllers, which live in the SCU
register space and are children of the clock controller node. Patch 5
allows the child nodes in the binding and patch 6 creates their
devices. The AN7583 MDIO controllers use the same path.

The series depends on the series "clk: add support for Airoha AN7583
clock" v15 [1]. That series makes #phy-cells required for the AN7583.
The AN7589 provides no serdes PHY, so patch 2 moves this requirement
into a rule for the AN7583 alone.

[1] https://lore.kernel.org/r/20261121212738.170775-1-ansuelsmth@gmail.com

John Crispin (6):
  dt-bindings: arm: airoha: add AN7589 chip SCU
  dt-bindings: clock: airoha: add AN7589
  clk: en7523: decouple base clock count from clock ID count
  clk: en7523: add support for Airoha AN7589
  dt-bindings: clock: airoha: allow MDIO controllers under the SCU
  clk: en7523: populate SCU child devices

 .../bindings/arm/airoha,en7581-chip-scu.yaml  |   1 +
 .../bindings/clock/airoha,en7523-scu.yaml     |  30 +-
 drivers/clk/clk-en7523.c                      | 335 +++++++++++++++++-
 include/dt-bindings/clock/en7523-clk.h        |   9 +
 .../dt-bindings/reset/airoha,an7589-reset.h   |  68 ++++
 5 files changed, 438 insertions(+), 5 deletions(-)
 create mode 100644 include/dt-bindings/reset/airoha,an7589-reset.h


base-commit: 3191063649dbf7c0d0b768e1f3655e4c5fc6edb5
prerequisite-patch-id: cb7f4047f6de36dd2c1eb612c407847cb48b3be7
prerequisite-patch-id: 94ab63d8aa9fd575c8addab53d7fe6ab6064a31d
prerequisite-patch-id: 6ef84d4bdb8a219a1a0677cfb372b229c3ef6c0a
prerequisite-patch-id: 463419d96297c209bff6ce0e587c470877e547d7
prerequisite-patch-id: cdf4f7496650724d242508706b4857ce4ca6d6ef
-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/6] dt-bindings: arm: airoha: add AN7589 chip SCU
  2026-11-24 10:12 [PATCH 0/6] clk: en7523: add support for Airoha AN7589 John Crispin
@ 2026-11-24 10:12 ` John Crispin
  2026-11-24 10:12 ` [PATCH 2/6] dt-bindings: clock: airoha: add AN7589 John Crispin
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: John Crispin @ 2026-11-24 10:12 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Stephen Boyd,
	Brian Masney, Jerome Brunet, Philipp Zabel
  Cc: Daniel Lezcano, Christian Marangi, Vitaliy Sochnev,
	Lorenzo Bianconi, Felix Fietkau, devicetree, linux-clk,
	linux-kernel, lei.dong, Linqi.zhang, Rajeev.kumar, upstream,
	Weifeng.xu, zhengping.zhang

The AN7589 has a chip SCU like the EN7581 and AN7583. Its SCU clock
controller reaches the PCIe clock registers through it, by the
airoha,chip-scu phandle. Document its compatible.

Signed-off-by: John Crispin <john@phrozen.org>
---
 .../devicetree/bindings/arm/airoha,en7581-chip-scu.yaml          | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/arm/airoha,en7581-chip-scu.yaml b/Documentation/devicetree/bindings/arm/airoha,en7581-chip-scu.yaml
index 4a10d024f5fa..a0b9c426a595 100644
--- a/Documentation/devicetree/bindings/arm/airoha,en7581-chip-scu.yaml
+++ b/Documentation/devicetree/bindings/arm/airoha,en7581-chip-scu.yaml
@@ -20,6 +20,7 @@ properties:
       - enum:
           - airoha,en7581-chip-scu
           - airoha,an7583-chip-scu
+          - airoha,an7589-chip-scu
       - const: syscon
 
   reg:
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/6] dt-bindings: clock: airoha: add AN7589
  2026-11-24 10:12 [PATCH 0/6] clk: en7523: add support for Airoha AN7589 John Crispin
  2026-11-24 10:12 ` [PATCH 1/6] dt-bindings: arm: airoha: add AN7589 chip SCU John Crispin
@ 2026-11-24 10:12 ` John Crispin
  2026-11-24 10:12 ` [PATCH 3/6] clk: en7523: decouple base clock count from clock ID count John Crispin
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: John Crispin @ 2026-11-24 10:12 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Stephen Boyd,
	Brian Masney, Jerome Brunet, Philipp Zabel
  Cc: Daniel Lezcano, Christian Marangi, Vitaliy Sochnev,
	Lorenzo Bianconi, Felix Fietkau, devicetree, linux-clk,
	linux-kernel, lei.dong, Linqi.zhang, Rajeev.kumar, upstream,
	Weifeng.xu, zhengping.zhang

Document the AN7589 SCU. Like the AN7583 it needs the chip SCU phandle
and has a single register range. It provides resets but no serdes
PHY, so #reset-cells stays required for both SoCs and the requirement
of #phy-cells moves to a rule for the AN7583 alone.

Add the eight AN7589 specific clock IDs after the AN7583 MDIO clocks, and
a reset header. The AN7589 reset lines are those of the AN7583 plus a
third bank with the I2C3, I2C4, I2C5, OPTL_SYS and MDIO2 resets, and an
I2S reset in the first bank. It has no PCIC bank, since the AN7589
drives PCIe PERST from the PCIe MAC. IDs are numbered densely in bank
order.

Signed-off-by: John Crispin <john@phrozen.org>
---
 .../bindings/clock/airoha,en7523-scu.yaml     | 18 ++++-
 include/dt-bindings/clock/en7523-clk.h        |  9 +++
 .../dt-bindings/reset/airoha,an7589-reset.h   | 68 +++++++++++++++++++
 3 files changed, 92 insertions(+), 3 deletions(-)
 create mode 100644 include/dt-bindings/reset/airoha,an7589-reset.h

diff --git a/Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml b/Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml
index 0d5f89187525..947f8b939449 100644
--- a/Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml
+++ b/Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml
@@ -32,6 +32,7 @@ properties:
     items:
       - enum:
           - airoha,an7583-scu
+          - airoha,an7589-scu
           - airoha,en7523-scu
           - airoha,en7581-scu
           - econet,en751221-scu
@@ -73,7 +74,9 @@ allOf:
   - if:
       properties:
         compatible:
-          const: airoha,an7583-scu
+          enum:
+            - airoha,an7583-scu
+            - airoha,an7589-scu
 
     then:
       properties:
@@ -83,12 +86,19 @@ allOf:
       required:
         - airoha,chip-scu
         - '#reset-cells'
-        - '#phy-cells'
 
     else:
       properties:
         airoha,chip-scu: false
 
+  - if:
+      properties:
+        compatible:
+          const: airoha,an7583-scu
+    then:
+      required:
+        - '#phy-cells'
+
   - if:
       properties:
         compatible:
@@ -103,7 +113,9 @@ allOf:
   - if:
       properties:
         compatible:
-          const: econet,en751221-scu
+          enum:
+            - airoha,an7589-scu
+            - econet,en751221-scu
     then:
       properties:
         reg:
diff --git a/include/dt-bindings/clock/en7523-clk.h b/include/dt-bindings/clock/en7523-clk.h
index 0fbbcb7b1b25..136cbbea1f81 100644
--- a/include/dt-bindings/clock/en7523-clk.h
+++ b/include/dt-bindings/clock/en7523-clk.h
@@ -17,4 +17,13 @@
 #define AN7583_CLK_MDIO0	9
 #define AN7583_CLK_MDIO1	10
 
+#define AN7589_CLK_EFUSE	11
+#define AN7589_CLK_TINY_NPU	12
+#define AN7589_CLK_ECC		13
+#define AN7589_CLK_PM_UPS	14
+#define AN7589_CLK_DQ_UPS	15
+#define AN7589_CLK_TM_UPS	16
+#define AN7589_CLK_ACP		17
+#define AN7589_CLK_MDIO2	18
+
 #endif /* _DT_BINDINGS_CLOCK_AIROHA_EN7523_H_ */
diff --git a/include/dt-bindings/reset/airoha,an7589-reset.h b/include/dt-bindings/reset/airoha,an7589-reset.h
new file mode 100644
index 000000000000..9b098db488c5
--- /dev/null
+++ b/include/dt-bindings/reset/airoha,an7589-reset.h
@@ -0,0 +1,68 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+/*
+ * Author: John Crispin <john@phrozen.org>
+ */
+
+#ifndef __DT_BINDINGS_RESET_CONTROLLER_AIROHA_AN7589_H_
+#define __DT_BINDINGS_RESET_CONTROLLER_AIROHA_AN7589_H_
+
+/* RST_CTRL2 */
+#define AN7589_XPON_PHY_RST		 0
+#define AN7589_GPON_OLT_RST		 1
+#define AN7589_CPU_TIMER2_RST		 2
+#define AN7589_HSUART_RST		 3
+#define AN7589_UART4_RST		 4
+#define AN7589_UART5_RST		 5
+#define AN7589_I2C2_RST			 6
+#define AN7589_XSI_MAC_RST		 7
+#define AN7589_XSI_PHY_RST		 8
+#define AN7589_NPU_RST			 9
+#define AN7589_I2S_RST			10
+#define AN7589_TRNG_MSTART_RST		11
+#define AN7589_DUAL_HSI0_RST		12
+#define AN7589_DUAL_HSI1_RST		13
+#define AN7589_DUAL_HSI0_MAC_RST	14
+#define AN7589_DUAL_HSI1_MAC_RST	15
+#define AN7589_XPON_XFI_RST		16
+#define AN7589_WDMA_RST			17
+#define AN7589_WOE0_RST			18
+#define AN7589_HSDMA_RST		19
+#define AN7589_TDMA_RST			20
+#define AN7589_EMMC_RST			21
+#define AN7589_SOE_RST			22
+#define AN7589_XFP_MAC_RST		23
+#define AN7589_MDIO0_RST		24
+#define AN7589_MDIO1_RST		25
+/* RST_CTRL1 */
+#define AN7589_PCM1_ZSI_ISI_RST		26
+#define AN7589_FE_PDMA_RST		27
+#define AN7589_FE_QDMA_RST		28
+#define AN7589_PCM_SPIWP_RST		29
+#define AN7589_CRYPTO_RST		30
+#define AN7589_TIMER_RST		31
+#define AN7589_PCM1_RST			32
+#define AN7589_UART_RST			33
+#define AN7589_GPIO_RST			34
+#define AN7589_GDMA_RST			35
+#define AN7589_I2C_MASTER_RST		36
+#define AN7589_PCM2_ZSI_ISI_RST		37
+#define AN7589_SFC_RST			38
+#define AN7589_UART2_RST		39
+#define AN7589_GDMP_RST			40
+#define AN7589_FE_RST			41
+#define AN7589_USB_HOST_P0_RST		42
+#define AN7589_GSW_RST			43
+#define AN7589_SFC2_PCM_RST		44
+#define AN7589_PCIE0_RST		45
+#define AN7589_PCIE1_RST		46
+#define AN7589_CPU_TIMER_RST		47
+#define AN7589_PCIE_HB_RST		48
+#define AN7589_XPON_MAC_RST		49
+/* RST_CTRL3 */
+#define AN7589_I2C3_RST			50
+#define AN7589_I2C4_RST			51
+#define AN7589_I2C5_RST			52
+#define AN7589_OPTL_SYS_RST		53
+#define AN7589_MDIO2_RST		54
+
+#endif /* __DT_BINDINGS_RESET_CONTROLLER_AIROHA_AN7589_H_ */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/6] clk: en7523: decouple base clock count from clock ID count
  2026-11-24 10:12 [PATCH 0/6] clk: en7523: add support for Airoha AN7589 John Crispin
  2026-11-24 10:12 ` [PATCH 1/6] dt-bindings: arm: airoha: add AN7589 chip SCU John Crispin
  2026-11-24 10:12 ` [PATCH 2/6] dt-bindings: clock: airoha: add AN7589 John Crispin
@ 2026-11-24 10:12 ` John Crispin
  2026-11-24 10:12 ` [PATCH 4/6] clk: en7523: add support for Airoha AN7589 John Crispin
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: John Crispin @ 2026-11-24 10:12 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Stephen Boyd,
	Brian Masney, Jerome Brunet, Philipp Zabel
  Cc: Daniel Lezcano, Christian Marangi, Vitaliy Sochnev,
	Lorenzo Bianconi, Felix Fietkau, devicetree, linux-clk,
	linux-kernel, lei.dong, Linqi.zhang, Rajeev.kumar, upstream,
	Weifeng.xu, zhengping.zhang

en7581_register_clocks() walks num_clocks entries of base_clks[], and
num_clocks also sizes hws[]. That holds only while every clock ID below
num_clocks has a descriptor. A SoC that leaves an ID unused, or whose
largest ID is not the last descriptor, either reads past the array or
writes hws[] past its allocation.

Carry the descriptor count separately. num_clocks keeps sizing hws[].

No functional change.

Signed-off-by: John Crispin <john@phrozen.org>
---
 drivers/clk/clk-en7523.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-en7523.c b/drivers/clk/clk-en7523.c
index d044841cdc05..2799b550401e 100644
--- a/drivers/clk/clk-en7523.c
+++ b/drivers/clk/clk-en7523.c
@@ -149,6 +149,7 @@ struct en_clk_priv {
 struct en_clk_soc_data {
 	u32 num_clocks;
 	const struct en_clk_desc *base_clks;
+	unsigned int num_base_clks;
 	const struct clk_ops pcie_ops;
 	int (*hw_init)(struct platform_device *pdev,
 		       struct clk_hw_onecell_data *clk_data);
@@ -1006,7 +1007,7 @@ static void en7581_register_clocks(struct device *dev, struct clk_hw_onecell_dat
 
 	soc_data = device_get_match_data(dev);
 
-	for (i = 0; i < soc_data->num_clocks; i++) {
+	for (i = 0; i < soc_data->num_base_clks; i++) {
 		const struct en_clk_desc *desc = &soc_data->base_clks[i];
 		u32 val, reg = desc->div_reg ? desc->div_reg : desc->base_reg;
 		int err;
@@ -1527,6 +1528,7 @@ static const struct en_clk_soc_data en7523_data = {
 
 static const struct en_clk_soc_data en7581_data = {
 	.base_clks = en7581_base_clks,
+	.num_base_clks = ARRAY_SIZE(en7581_base_clks),
 	.num_clocks = ARRAY_SIZE(en7581_base_clks),
 	.pcie_ops = {
 		.is_enabled = en7581_pci_is_enabled,
@@ -1538,6 +1540,7 @@ static const struct en_clk_soc_data en7581_data = {
 
 static const struct en_clk_soc_data an7583_data = {
 	.base_clks = an7583_base_clks,
+	.num_base_clks = ARRAY_SIZE(an7583_base_clks),
 	.num_clocks = ARRAY_SIZE(an7583_base_clks),
 	.pcie_ops = {
 		.is_enabled = en7581_pci_is_enabled,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/6] clk: en7523: add support for Airoha AN7589
  2026-11-24 10:12 [PATCH 0/6] clk: en7523: add support for Airoha AN7589 John Crispin
                   ` (2 preceding siblings ...)
  2026-11-24 10:12 ` [PATCH 3/6] clk: en7523: decouple base clock count from clock ID count John Crispin
@ 2026-11-24 10:12 ` John Crispin
  2026-11-24 10:12 ` [PATCH 5/6] dt-bindings: clock: airoha: allow MDIO controllers under the SCU John Crispin
  2026-11-24 10:12 ` [PATCH 6/6] clk: en7523: populate SCU child devices John Crispin
  5 siblings, 0 replies; 7+ messages in thread
From: John Crispin @ 2026-11-24 10:12 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Stephen Boyd,
	Brian Masney, Jerome Brunet, Philipp Zabel
  Cc: Daniel Lezcano, Christian Marangi, Vitaliy Sochnev,
	Lorenzo Bianconi, Felix Fietkau, devicetree, linux-clk,
	linux-kernel, lei.dong, Linqi.zhang, Rajeev.kumar, upstream,
	Weifeng.xu, zhengping.zhang

The AN7589 SCU sits at the EN7581 register addresses with wider mux
fields, new base rate tables, new clocks in REG_CRYPTO_CLKSRC2 and
REG_PM_UPS_CLKSRC, and a third reset bank at REG_RST_CTRL3. Like the
AN7583 it reaches the PCIe clock registers through the chip SCU.

The GSW clock has no mux field in the Airoha SDK and is left out, so
the clock IDs are sparse. num_clocks is set from the largest ID,
AN7589_CLK_MDIO2, and the descriptor count is carried separately.

The rates and register fields come from the Airoha SDK.

Signed-off-by: John Crispin <john@phrozen.org>
---
 drivers/clk/clk-en7523.c | 323 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 323 insertions(+)

diff --git a/drivers/clk/clk-en7523.c b/drivers/clk/clk-en7523.c
index 2799b550401e..800de9a48594 100644
--- a/drivers/clk/clk-en7523.c
+++ b/drivers/clk/clk-en7523.c
@@ -14,6 +14,7 @@
 #include <linux/spinlock.h>
 #include <dt-bindings/clock/en7523-clk.h>
 #include <dt-bindings/reset/airoha,an7583-reset.h>
+#include <dt-bindings/reset/airoha,an7589-reset.h>
 #include <dt-bindings/reset/airoha,en7523-reset.h>
 #include <dt-bindings/reset/airoha,en7581-reset.h>
 #include <dt-bindings/clock/econet,en751221-scu.h>
@@ -62,6 +63,8 @@
 #define REG_USB_PCIE_SEL_PCIE		FIELD_PREP_CONST(REG_USB_PCIE_SEL_MASK, 0x0)
 #define REG_USB_PCIE_SEL_USB		FIELD_PREP_CONST(REG_USB_PCIE_SEL_MASK, 0x1)
 #define REG_CRYPTO_CLKSRC2		0x20c
+/* AN7589 */
+#define REG_PM_UPS_CLKSRC		0x210
 /* EN751221 */
 #define EN751221_REG_SPI_DIV		0x0cc
 #define EN751221_REG_SPI_DIV_MASK	GENMASK(31, 8)
@@ -76,6 +79,7 @@
 #define REG_RST_CTRL2			0x830
 #define REG_RST_CTRL1			0x834
 #define   REG_PCIE_HB_RST		BIT(29)
+#define REG_RST_CTRL3			0x838
 #define EN751221_REG_RST_DMT		0x84
 #define EN751221_REG_RST_USB		0xec
 
@@ -177,6 +181,23 @@ static const u32 spi7583_base[] = { 400000000, 12500000 };
 static const u32 npu7583_base[] = { 666000000, 800000000, 720000000, 600000000 };
 static const u32 crypto7583_base[] = { 540672000, 400000000 };
 static const u32 emmc7583_base[] = { 150000000, 200000000 };
+/* AN7589 */
+static const u32 emi7589_base[] = { 400000000, 540672000, 480000000, 600000000,
+				    685000000, 720000000, 800000000, 800000000 };
+static const u32 bus7589_base[] = { 540672000, 600000000, 720000000, 800000000,
+				    850000000, 960000000, 960000000, 960000000 };
+static const u32 npu7589_base[] = { 540000000, 685000000, 720000000, 800000000,
+				    850000000, 600000000, 960000000, 960000000 };
+static const u32 crypto7589_base[] = { 480000000, 720000000, 960000000, 850000000 };
+static const u32 emmc7589_base[] = { 360000000, 400000000 };
+static const u32 efuse7589_base[] = { 200000000, 100000000 };
+static const u32 tinynpu7589_base[] = { 425000000, 480000000, 540000000, 720000000 };
+static const u32 ecc7589_base[] = { 300000000, 600000000 };
+static const u32 pm_ups7589_base[] = { 400000000, 480000000 };
+static const u32 dq_ups7589_base[] = { 200000000, 270000000, 480000000, 540000000 };
+static const u32 tm_ups7589_base[] = { 400000000, 540000000, 720000000, 800000000,
+				       720000000, 850000000, 600000000, 685000000 };
+static const u32 acp7589_base[] = { 480000000, 720000000 };
 
 static const struct en_clk_desc en7523_base_clks[] = {
 	{
@@ -511,12 +532,211 @@ static const struct en_clk_desc an7583_base_clks[] = {
 	}
 };
 
+static const struct en_clk_desc an7589_base_clks[] = {
+	{
+		.id = EN7523_CLK_EMI,
+		.name = "emi",
+
+		.base_reg = REG_EMI_CLK_DIV_SEL,
+		.base_bits = 3,
+		.base_shift = 8,
+		.base_values = emi7589_base,
+		.n_base_values = ARRAY_SIZE(emi7589_base),
+
+		.div_bits = 3,
+		.div_shift = 0,
+		.div_step = 1,
+		.div_offset = 1,
+	}, {
+		.id = EN7523_CLK_BUS,
+		.name = "bus",
+
+		.base_reg = REG_BUS_CLK_DIV_SEL,
+		.base_bits = 3,
+		.base_shift = 8,
+		.base_values = bus7589_base,
+		.n_base_values = ARRAY_SIZE(bus7589_base),
+
+		.div_bits = 3,
+		.div_shift = 0,
+		.div_step = 1,
+		.div_offset = 1,
+	}, {
+		.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,
+	}, {
+		.id = EN7523_CLK_SPI,
+		.name = "spi",
+
+		.base_reg = REG_SPI_CLK_FREQ_SEL,
+		.base_bits = 1,
+		.base_shift = 1,
+		.base_values = spi7583_base,
+		.n_base_values = ARRAY_SIZE(spi7583_base),
+
+		.div_reg = REG_SPI_CLK_DIV_SEL,
+		.div_bits = 5,
+		.div_shift = 8,
+		.div_val0 = 40,
+		.div_step = 2,
+	}, {
+		.id = EN7523_CLK_NPU,
+		.name = "npu",
+
+		.base_reg = REG_NPU_CLK_DIV_SEL,
+		.base_bits = 3,
+		.base_shift = 9,
+		.base_values = npu7589_base,
+		.n_base_values = ARRAY_SIZE(npu7589_base),
+
+		.div_bits = 3,
+		.div_shift = 0,
+		.div_step = 1,
+		.div_offset = 1,
+	}, {
+		.id = EN7523_CLK_CRYPTO,
+		.name = "crypto",
+
+		.base_reg = REG_CRYPTO_CLKSRC2,
+		.base_bits = 2,
+		.base_shift = 0,
+		.base_values = crypto7589_base,
+		.n_base_values = ARRAY_SIZE(crypto7589_base),
+	}, {
+		.id = EN7581_CLK_EMMC,
+		.name = "emmc",
+
+		.base_reg = REG_CRYPTO_CLKSRC2,
+		.base_bits = 1,
+		.base_shift = 16,
+		.base_values = emmc7589_base,
+		.n_base_values = ARRAY_SIZE(emmc7589_base),
+	}, {
+		.id = AN7583_CLK_MDIO0,
+		.name = "mdio0",
+
+		.base_reg = REG_CRYPTO_CLKSRC2,
+
+		.base_value = 25000000,
+
+		.div_bits = 4,
+		.div_shift = 18,
+		.div_step = 1,
+		.div_offset = 1,
+	}, {
+		.id = AN7583_CLK_MDIO1,
+		.name = "mdio1",
+
+		.base_reg = REG_CRYPTO_CLKSRC2,
+
+		.base_value = 25000000,
+
+		.div_bits = 4,
+		.div_shift = 22,
+		.div_step = 1,
+		.div_offset = 1,
+	}, {
+		.id = AN7589_CLK_MDIO2,
+		.name = "mdio2",
+
+		.base_reg = REG_NPU_CLK_DIV_SEL,
+
+		.base_value = 25000000,
+
+		.div_bits = 4,
+		.div_shift = 16,
+		.div_step = 1,
+		.div_offset = 1,
+	}, {
+		.id = AN7589_CLK_EFUSE,
+		.name = "efuse",
+
+		.base_reg = REG_CRYPTO_CLKSRC2,
+		.base_bits = 1,
+		.base_shift = 6,
+		.base_values = efuse7589_base,
+		.n_base_values = ARRAY_SIZE(efuse7589_base),
+	}, {
+		.id = AN7589_CLK_TINY_NPU,
+		.name = "tinynpu",
+
+		.base_reg = REG_PM_UPS_CLKSRC,
+		.base_bits = 2,
+		.base_shift = 14,
+		.base_values = tinynpu7589_base,
+		.n_base_values = ARRAY_SIZE(tinynpu7589_base),
+	}, {
+		.id = AN7589_CLK_ECC,
+		.name = "ecc",
+
+		.base_reg = REG_PM_UPS_CLKSRC,
+		.base_bits = 1,
+		.base_shift = 8,
+		.base_values = ecc7589_base,
+		.n_base_values = ARRAY_SIZE(ecc7589_base),
+	}, {
+		.id = AN7589_CLK_PM_UPS,
+		.name = "pm_ups",
+
+		.base_reg = REG_PM_UPS_CLKSRC,
+		.base_bits = 1,
+		.base_shift = 0,
+		.base_values = pm_ups7589_base,
+		.n_base_values = ARRAY_SIZE(pm_ups7589_base),
+	}, {
+		.id = AN7589_CLK_DQ_UPS,
+		.name = "dq_ups",
+
+		.base_reg = REG_PM_UPS_CLKSRC,
+		.base_bits = 2,
+		.base_shift = 1,
+		.base_values = dq_ups7589_base,
+		.n_base_values = ARRAY_SIZE(dq_ups7589_base),
+	}, {
+		.id = AN7589_CLK_TM_UPS,
+		.name = "tm_ups",
+
+		.base_reg = REG_PM_UPS_CLKSRC,
+		.base_bits = 3,
+		.base_shift = 3,
+		.base_values = tm_ups7589_base,
+		.n_base_values = ARRAY_SIZE(tm_ups7589_base),
+	}, {
+		.id = AN7589_CLK_ACP,
+		.name = "acp",
+
+		.base_reg = REG_PM_UPS_CLKSRC,
+		.base_bits = 1,
+		.base_shift = 7,
+		.base_values = acp7589_base,
+		.n_base_values = ARRAY_SIZE(acp7589_base),
+	}
+};
+
 static const u16 en7581_rst_ofs[] = {
 	REG_RST_CTRL2,
 	REG_RST_CTRL1,
 	REG_NP_SCU_PCIC,
 };
 
+static const u16 an7589_rst_ofs[] = {
+	REG_RST_CTRL2,
+	REG_RST_CTRL1,
+	REG_RST_CTRL3,
+};
+
 static const u16 en751221_rst_ofs[] = {
 	REG_RST_CTRL2,
 	REG_RST_CTRL1,
@@ -744,6 +964,67 @@ static const u16 an7583_rst_map[] = {
 	[AN7583_PCIC_PERSTOUT1_RST]	= 2 * RST_NR_PER_BANK + 26,
 };
 
+static const u16 an7589_rst_map[] = {
+	/* RST_CTRL2 */
+	[AN7589_XPON_PHY_RST]		= 0,
+	[AN7589_GPON_OLT_RST]		= 1,
+	[AN7589_CPU_TIMER2_RST]		= 2,
+	[AN7589_HSUART_RST]		= 3,
+	[AN7589_UART4_RST]		= 4,
+	[AN7589_UART5_RST]		= 5,
+	[AN7589_I2C2_RST]		= 6,
+	[AN7589_XSI_MAC_RST]		= 7,
+	[AN7589_XSI_PHY_RST]		= 8,
+	[AN7589_NPU_RST]		= 9,
+	[AN7589_I2S_RST]		= 10,
+	[AN7589_TRNG_MSTART_RST]	= 12,
+	[AN7589_DUAL_HSI0_RST]		= 13,
+	[AN7589_DUAL_HSI1_RST]		= 14,
+	[AN7589_DUAL_HSI0_MAC_RST]	= 16,
+	[AN7589_DUAL_HSI1_MAC_RST]	= 17,
+	[AN7589_XPON_XFI_RST]		= 18,
+	[AN7589_WDMA_RST]		= 19,
+	[AN7589_WOE0_RST]		= 20,
+	[AN7589_HSDMA_RST]		= 22,
+	[AN7589_TDMA_RST]		= 24,
+	[AN7589_EMMC_RST]		= 25,
+	[AN7589_SOE_RST]		= 26,
+	[AN7589_XFP_MAC_RST]		= 28,
+	[AN7589_MDIO0_RST]		= 30,
+	[AN7589_MDIO1_RST]		= 31,
+	/* RST_CTRL1 */
+	[AN7589_PCM1_ZSI_ISI_RST]	= RST_NR_PER_BANK + 0,
+	[AN7589_FE_PDMA_RST]		= RST_NR_PER_BANK + 1,
+	[AN7589_FE_QDMA_RST]		= RST_NR_PER_BANK + 2,
+	[AN7589_PCM_SPIWP_RST]		= RST_NR_PER_BANK + 4,
+	[AN7589_CRYPTO_RST]		= RST_NR_PER_BANK + 6,
+	[AN7589_TIMER_RST]		= RST_NR_PER_BANK + 8,
+	[AN7589_PCM1_RST]		= RST_NR_PER_BANK + 11,
+	[AN7589_UART_RST]		= RST_NR_PER_BANK + 12,
+	[AN7589_GPIO_RST]		= RST_NR_PER_BANK + 13,
+	[AN7589_GDMA_RST]		= RST_NR_PER_BANK + 14,
+	[AN7589_I2C_MASTER_RST]		= RST_NR_PER_BANK + 16,
+	[AN7589_PCM2_ZSI_ISI_RST]	= RST_NR_PER_BANK + 17,
+	[AN7589_SFC_RST]		= RST_NR_PER_BANK + 18,
+	[AN7589_UART2_RST]		= RST_NR_PER_BANK + 19,
+	[AN7589_GDMP_RST]		= RST_NR_PER_BANK + 20,
+	[AN7589_FE_RST]			= RST_NR_PER_BANK + 21,
+	[AN7589_USB_HOST_P0_RST]	= RST_NR_PER_BANK + 22,
+	[AN7589_GSW_RST]		= RST_NR_PER_BANK + 23,
+	[AN7589_SFC2_PCM_RST]		= RST_NR_PER_BANK + 25,
+	[AN7589_PCIE0_RST]		= RST_NR_PER_BANK + 26,
+	[AN7589_PCIE1_RST]		= RST_NR_PER_BANK + 27,
+	[AN7589_CPU_TIMER_RST]		= RST_NR_PER_BANK + 28,
+	[AN7589_PCIE_HB_RST]		= RST_NR_PER_BANK + 29,
+	[AN7589_XPON_MAC_RST]		= RST_NR_PER_BANK + 31,
+	/* RST_CTRL3 */
+	[AN7589_I2C3_RST]		= 2 * RST_NR_PER_BANK + 0,
+	[AN7589_I2C4_RST]		= 2 * RST_NR_PER_BANK + 1,
+	[AN7589_I2C5_RST]		= 2 * RST_NR_PER_BANK + 2,
+	[AN7589_OPTL_SYS_RST]		= 2 * RST_NR_PER_BANK + 3,
+	[AN7589_MDIO2_RST]		= 2 * RST_NR_PER_BANK + 13,
+};
+
 static int en7581_reset_register(struct device *dev, void __iomem *base,
 				 const u16 *rst_map, int nr_resets,
 				 const u16 *rst_reg_ofs);
@@ -1381,6 +1662,35 @@ static int an7583_clk_hw_init(struct platform_device *pdev,
 	return en7581_serdes_phy_register(dev);
 }
 
+static int an7589_clk_hw_init(struct platform_device *pdev,
+			      struct clk_hw_onecell_data *clk_data)
+{
+	struct device *dev = &pdev->dev;
+	struct regmap *map;
+	void __iomem *base;
+	u32 val;
+
+	map = syscon_regmap_lookup_by_phandle(dev->of_node, "airoha,chip-scu");
+	if (IS_ERR(map))
+		return PTR_ERR(map);
+
+	base = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(base))
+		return PTR_ERR(base);
+
+	en7581_register_clocks(dev, clk_data, map, base);
+
+	val = readl(base + REG_NP_SCU_SSTR);
+	val &= ~(REG_PCIE_XSI0_SEL_MASK | REG_PCIE_XSI1_SEL_MASK);
+	writel(val, base + REG_NP_SCU_SSTR);
+	val = readl(base + REG_NP_SCU_PCIC);
+	writel(val | 3, base + REG_NP_SCU_PCIC);
+
+	return en7581_reset_register(dev, base, an7589_rst_map,
+				     ARRAY_SIZE(an7589_rst_map),
+				     an7589_rst_ofs);
+}
+
 static enum en_hir get_hw_id(void __iomem *np_base)
 {
 	u32 val = FIELD_GET(REG_HIR_MASK, readl(np_base + REG_HIR));
@@ -1550,6 +1860,18 @@ static const struct en_clk_soc_data an7583_data = {
 	.hw_init = an7583_clk_hw_init,
 };
 
+static const struct en_clk_soc_data an7589_data = {
+	.base_clks = an7589_base_clks,
+	.num_base_clks = ARRAY_SIZE(an7589_base_clks),
+	.num_clocks = AN7589_CLK_MDIO2,
+	.pcie_ops = {
+		.is_enabled = en7581_pci_is_enabled,
+		.enable = en7581_pci_enable,
+		.disable = en7581_pci_disable,
+	},
+	.hw_init = an7589_clk_hw_init,
+};
+
 static const struct en_clk_soc_data en751221_data = {
 	/* Decrease of one as PCIe is incremented internally with PCIe OPs */
 	.num_clocks = EN751221_MAX_CLKS - 1,
@@ -1566,6 +1888,7 @@ static const struct of_device_id of_match_clk_en7523[] = {
 	{ .compatible = "airoha,en7523-scu", .data = &en7523_data },
 	{ .compatible = "airoha,en7581-scu", .data = &en7581_data },
 	{ .compatible = "airoha,an7583-scu", .data = &an7583_data },
+	{ .compatible = "airoha,an7589-scu", .data = &an7589_data },
 	{ .compatible = "econet,en751221-scu", .data = &en751221_data },
 	{ /* sentinel */ }
 };
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/6] dt-bindings: clock: airoha: allow MDIO controllers under the SCU
  2026-11-24 10:12 [PATCH 0/6] clk: en7523: add support for Airoha AN7589 John Crispin
                   ` (3 preceding siblings ...)
  2026-11-24 10:12 ` [PATCH 4/6] clk: en7523: add support for Airoha AN7589 John Crispin
@ 2026-11-24 10:12 ` John Crispin
  2026-11-24 10:12 ` [PATCH 6/6] clk: en7523: populate SCU child devices John Crispin
  5 siblings, 0 replies; 7+ messages in thread
From: John Crispin @ 2026-11-24 10:12 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Stephen Boyd,
	Brian Masney, Jerome Brunet, Philipp Zabel
  Cc: Daniel Lezcano, Christian Marangi, Vitaliy Sochnev,
	Lorenzo Bianconi, Felix Fietkau, devicetree, linux-clk,
	linux-kernel, lei.dong, Linqi.zhang, Rajeev.kumar, upstream,
	Weifeng.xu, zhengping.zhang

The AN7583 and AN7589 MDIO controllers live in the SCU register space
and take their registers as offsets into the SCU node. Allow them as
children of the clock controller.

Signed-off-by: John Crispin <john@phrozen.org>
---
 .../devicetree/bindings/clock/airoha,en7523-scu.yaml | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml b/Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml
index 947f8b939449..f3172ab9ce78 100644
--- a/Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml
+++ b/Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml
@@ -65,6 +65,18 @@ properties:
       for configuring and read the base clock sources, dividers  and
       clock gates.
 
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+patternProperties:
+  '^mdio-bus@[0-9a-f]+$':
+    type: object
+    $ref: /schemas/net/airoha,an7583-mdio.yaml#
+    description: MDIO controller living in the SCU register space.
+
 required:
   - compatible
   - reg
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 6/6] clk: en7523: populate SCU child devices
  2026-11-24 10:12 [PATCH 0/6] clk: en7523: add support for Airoha AN7589 John Crispin
                   ` (4 preceding siblings ...)
  2026-11-24 10:12 ` [PATCH 5/6] dt-bindings: clock: airoha: allow MDIO controllers under the SCU John Crispin
@ 2026-11-24 10:12 ` John Crispin
  5 siblings, 0 replies; 7+ messages in thread
From: John Crispin @ 2026-11-24 10:12 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Stephen Boyd,
	Brian Masney, Jerome Brunet, Philipp Zabel
  Cc: Daniel Lezcano, Christian Marangi, Vitaliy Sochnev,
	Lorenzo Bianconi, Felix Fietkau, devicetree, linux-clk,
	linux-kernel, lei.dong, Linqi.zhang, Rajeev.kumar, upstream,
	Weifeng.xu, zhengping.zhang

The AN7583 and AN7589 MDIO controllers live in the SCU register space
and are described as children of the clock controller node, taking the
SCU regmap from their parent. Nothing creates their platform devices.

Populate the children once the clock and reset providers are
registered, since the children consume both. SoCs without children are
unaffected.

Signed-off-by: John Crispin <john@phrozen.org>
---
 drivers/clk/clk-en7523.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-en7523.c b/drivers/clk/clk-en7523.c
index 800de9a48594..bdc5b378d1a4 100644
--- a/drivers/clk/clk-en7523.c
+++ b/drivers/clk/clk-en7523.c
@@ -5,6 +5,7 @@
 #include <linux/clk-provider.h>
 #include <linux/io.h>
 #include <linux/mfd/syscon.h>
+#include <linux/of_platform.h>
 #include <linux/platform_device.h>
 #include <linux/phy.h>
 #include <linux/phy/phy.h>
@@ -1822,7 +1823,11 @@ static int en7523_clk_probe(struct platform_device *pdev)
 	if (r)
 		return r;
 
-	return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
+	r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
+	if (r)
+		return r;
+
+	return devm_of_platform_populate(&pdev->dev);
 }
 
 static const struct en_clk_soc_data en7523_data = {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-11-24 10:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 10:12 [PATCH 0/6] clk: en7523: add support for Airoha AN7589 John Crispin
2026-11-24 10:12 ` [PATCH 1/6] dt-bindings: arm: airoha: add AN7589 chip SCU John Crispin
2026-11-24 10:12 ` [PATCH 2/6] dt-bindings: clock: airoha: add AN7589 John Crispin
2026-11-24 10:12 ` [PATCH 3/6] clk: en7523: decouple base clock count from clock ID count John Crispin
2026-11-24 10:12 ` [PATCH 4/6] clk: en7523: add support for Airoha AN7589 John Crispin
2026-11-24 10:12 ` [PATCH 5/6] dt-bindings: clock: airoha: allow MDIO controllers under the SCU John Crispin
2026-11-24 10:12 ` [PATCH 6/6] clk: en7523: populate SCU child devices John Crispin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox