Linux clock framework development
 help / color / mirror / Atom feed
* [PATCH v2 0/5] clk: en7523: add support for Airoha AN7589
@ 2026-12-01 19:36 John Crispin
  2026-12-01 19:36 ` [PATCH v2 1/5] dt-bindings: arm: airoha: add AN7589 chip SCU John Crispin
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: John Crispin @ 2026-12-01 19:36 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

This adds the clocks and resets of the Airoha AN7589 to the en7523
driver. The SCU is close to the EN7581 one, with wider mux fields,
different base rates, a few new clocks and a third reset bank.

Patches 1 and 2 are the bindings, patch 3 is the driver side. Patches 4
and 5 are for the MDIO controllers, which sit inside the SCU register
space as children of the clock controller: 4 allows the child nodes and
5 creates the devices. The AN7583 needs the same.

This is now based on clk-pile with the AN7583 series applied
(536104a3ba8c).

Tested on the AN7589 EVB.

Changes in v2:
- rebased on the applied AN7583 series, which made "decouple base clock
  count from clock ID count" obsolete, so that patch is gone
- reworked the reset header, a few names and bits changed (2/5)
- the AN7589 gets its own rule forbidding #phy-cells (2/5)
- MDIO2 reset is bit 12, not 13 (3/5)
- dropped the SSTR/PCIC writes at probe (3/5)
- fixed the commit messages, the chip SCU has the clock source and
  divider registers, not the PCIe ones (1/5, 3/5, 5/5)
- v1: https://lore.kernel.org/r/20261124101220.3888170-1-john@phrozen.org

John Crispin (5):
  dt-bindings: arm: airoha: add AN7589 chip SCU
  dt-bindings: clock: airoha: add AN7589
  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     |  34 +-
 drivers/clk/clk-en7523.c                      | 340 +++++++++++++++++-
 include/dt-bindings/clock/en7523-clk.h        |   9 +
 .../dt-bindings/reset/airoha,an7589-reset.h   |  88 +++++
 5 files changed, 468 insertions(+), 4 deletions(-)
 create mode 100644 include/dt-bindings/reset/airoha,an7589-reset.h


base-commit: 536104a3ba8cae659daa734ccecf6c65707e1442
--
2.34.1


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

* [PATCH v2 1/5] dt-bindings: arm: airoha: add AN7589 chip SCU
  2026-12-01 19:36 [PATCH v2 0/5] clk: en7523: add support for Airoha AN7589 John Crispin
@ 2026-12-01 19:36 ` John Crispin
  2026-12-01 19:36 ` [PATCH v2 2/5] dt-bindings: clock: airoha: add AN7589 John Crispin
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: John Crispin @ 2026-12-01 19:36 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

Add the compatible for the AN7589 chip SCU. As on the EN7581 and AN7583
it carries the clock source and divider registers used by the SCU clock
controller.

Signed-off-by: John Crispin <john@phrozen.org>
---
v2: fixed the commit message, the chip SCU has the clock source and
    divider registers, not the PCIe ones

 .../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:

base-commit: 536104a3ba8cae659daa734ccecf6c65707e1442
-- 
2.34.1


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

* [PATCH v2 2/5] dt-bindings: clock: airoha: add AN7589
  2026-12-01 19:36 [PATCH v2 0/5] clk: en7523: add support for Airoha AN7589 John Crispin
  2026-12-01 19:36 ` [PATCH v2 1/5] dt-bindings: arm: airoha: add AN7589 chip SCU John Crispin
@ 2026-12-01 19:36 ` John Crispin
  2026-12-01 19:36 ` [PATCH v2 3/5] clk: en7523: add support for Airoha AN7589 John Crispin
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: John Crispin @ 2026-12-01 19:36 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

Add the AN7589 SCU. Like the AN7583 it has a single register range and
needs the chip SCU phandle, but it has no serdes PHY. So only require
'#phy-cells' on the AN7583 and forbid it on the AN7589.

Add the eight new clock IDs after the AN7583 MDIO clocks and a reset
header for reset control registers 2, 1 and 3. The layout is close to
the EN7581 one but not identical. Most notably bits 3 to 5 of register
2 are UART3, HSUART and HSUART2 on this SoC. Reserved bits get no ID.

The PERST outputs in PCIC are left out for now, nothing uses them.

Signed-off-by: John Crispin <john@phrozen.org>
---
v2:
- rebased on the applied AN7583 series
- reworked the reset header, a few names and bits changed
- the AN7589 gets its own rule forbidding #phy-cells

 .../bindings/clock/airoha,en7523-scu.yaml     | 22 ++++-
 include/dt-bindings/clock/en7523-clk.h        |  9 ++
 .../dt-bindings/reset/airoha,an7589-reset.h   | 88 +++++++++++++++++++
 3 files changed, 117 insertions(+), 2 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..7dc929f8586a 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,27 @@ 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:
+          const: airoha,an7589-scu
+    then:
+      properties:
+        '#phy-cells': false
+
   - if:
       properties:
         compatible:
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..2eafff5aa452
--- /dev/null
+++ b/include/dt-bindings/reset/airoha,an7589-reset.h
@@ -0,0 +1,88 @@
+/* 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_UART3_RST		 3
+#define AN7589_HSUART_RST		 4
+#define AN7589_HSUART2_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_USB1_QP_RST		12
+#define AN7589_USB0_QP_RST		13
+#define AN7589_HSDMA_RST		14
+#define AN7589_EMMC_RST			15
+#define AN7589_SOE_RST			16
+#define AN7589_PCIE2_RST		17
+#define AN7589_USB_HOST_P1_RST		18
+#define AN7589_MDIO0_RST		19
+#define AN7589_MDIO1_RST		20
+/* RST_CTRL1 */
+#define AN7589_PCM1_ZSI_ISI_RST		21
+#define AN7589_FE_PDMA_RST		22
+#define AN7589_FE_QDMA_RST		23
+#define AN7589_PCM_SPIWP_RST		24
+#define AN7589_EIP_RST			25
+#define AN7589_TIMER_RST		26
+#define AN7589_PCM1_RST			27
+#define AN7589_UART_RST			28
+#define AN7589_GPIO_RST			29
+#define AN7589_GDMA_RST			30
+#define AN7589_I2C_MASTER_RST		31
+#define AN7589_PCM2_ZSI_ISI_RST		32
+#define AN7589_SFC_RST			33
+#define AN7589_UART2_RST		34
+#define AN7589_GDMP_RST			35
+#define AN7589_FE_RST			36
+#define AN7589_USB_HOST_P0_RST		37
+#define AN7589_GSW_RST			38
+#define AN7589_SFC2_PCM_RST		39
+#define AN7589_PCIE0_RST		40
+#define AN7589_PCIE1_RST		41
+#define AN7589_CPU_TIMER_RST		42
+#define AN7589_PCIE_HB_RST		43
+#define AN7589_XPON_MAC_RST		44
+/* RST_CTRL3 */
+#define AN7589_I2C3_RST			45
+#define AN7589_I2C4_RST			46
+#define AN7589_I2C5_RST			47
+#define AN7589_OPTL_SYS_RST		48
+#define AN7589_MCPP_DISPATCH1_RST	49
+#define AN7589_MCPP_DISPATCH2_RST	50
+#define AN7589_MCPP_DISPATCH3_RST	51
+#define AN7589_MCPP_REORDER1_RST	52
+#define AN7589_MCPP_REORDER2_RST	53
+#define AN7589_MCPP_REFILLER_RST	54
+#define AN7589_NPU_NIQ_RST		55
+#define AN7589_NPU_NEQ_RST		56
+#define AN7589_MDIO2_RST		57
+#define AN7589_XPON_BM_RST		58
+#define AN7589_ETH0_10G_MAC_PM_RST	59
+#define AN7589_ETH0_10G_MAC_TOD_RST	60
+#define AN7589_ETH0_10G_MAC_RST		61
+#define AN7589_ETH0_10G_PHY_RST		62
+#define AN7589_ETH0_10G_PHY_RG_RST	63
+#define AN7589_ETH1_10G_MAC_PM_RST	64
+#define AN7589_ETH1_10G_MAC_TOD_RST	65
+#define AN7589_ETH1_10G_MAC_RST		66
+#define AN7589_ETH1_10G_PHY_RST		67
+#define AN7589_ETH1_10G_PHY_RG_RST	68
+#define AN7589_AI_NPU_RST		69
+#define AN7589_TIMER2_RST		70
+#define AN7589_SPIM0_RST		71
+#define AN7589_SPIM1_RST		72
+#define AN7589_SPIM2_RST		73
+#define AN7589_SPIM3_RST		74
+
+#endif /* __DT_BINDINGS_RESET_CONTROLLER_AIROHA_AN7589_H_ */
-- 
2.34.1


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

* [PATCH v2 3/5] clk: en7523: add support for Airoha AN7589
  2026-12-01 19:36 [PATCH v2 0/5] clk: en7523: add support for Airoha AN7589 John Crispin
  2026-12-01 19:36 ` [PATCH v2 1/5] dt-bindings: arm: airoha: add AN7589 chip SCU John Crispin
  2026-12-01 19:36 ` [PATCH v2 2/5] dt-bindings: clock: airoha: add AN7589 John Crispin
@ 2026-12-01 19:36 ` John Crispin
  2026-12-01 19:36 ` [PATCH v2 4/5] dt-bindings: clock: airoha: allow MDIO controllers under the SCU John Crispin
  2026-12-01 19:36 ` [PATCH v2 5/5] clk: en7523: populate SCU child devices John Crispin
  4 siblings, 0 replies; 6+ messages in thread
From: John Crispin @ 2026-12-01 19:36 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 is laid out like the EN7581 one. As on the AN7583 the
clock source and divider registers live in the chip SCU and are reached
through the airoha,chip-scu regmap, while the PCIe reference clock gate
stays in PCIC in the SCU itself.

Compared to the EN7581 the mux fields are wider, the base rate tables
differ and there are new clocks in REG_CRYPTO_CLKSRC2 and
REG_PM_UPS_CLKSRC, plus a third MDIO clock with its divider in
REG_NPU_CLK_DIV_SEL. There is no GSW clock, so that ID has no
descriptor and the provider returns -ENOENT for it.

A few things worth pointing out:

- pm_ups has a two bit source select that is split over two registers,
  with the high bit in RG_CKGEN_REV_1. struct en_clk_desc can only
  describe a field in one register, so only the low bit (400 or
  480 MHz) is handled. The high bit selects 540 MHz and is 0 out of
  reset.

- The MDIO2 reset is bit 12 of reset control register 3.

- Unlike the EN7581 path nothing is written to SSTR and PCIC at probe.
  The serdes mux stays at its reset value and PCIe, USB and Ethernet
  work without these writes.

Signed-off-by: John Crispin <john@phrozen.org>
---
v2:
- ported to the clk_hw rework of the AN7583 series, which also made
  "decouple base clock count from clock ID count" obsolete
- reset map follows the new header
- MDIO2 reset is bit 12, not 13
- dropped the SSTR/PCIC writes at probe

 drivers/clk/clk-en7523.c | 331 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 331 insertions(+)

diff --git a/drivers/clk/clk-en7523.c b/drivers/clk/clk-en7523.c
index cb0628d630bb..775caa54d89c 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
 
@@ -262,6 +266,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[] = {
 	{
@@ -565,12 +586,198 @@ 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,
+	}, {
+		.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_table = bus_div,
+	}, {
+		.id = EN7523_CLK_SLIC,
+		.name = "slic",
+
+		.base_reg = REG_SPI_CLK_FREQ_SEL,
+		.base_bits = 1,
+		.base_shift = 1,
+		.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_table = slic_div,
+	}, {
+		.id = EN7523_CLK_SPI,
+		.name = "spi",
+
+		.base_reg = REG_SPI_CLK_FREQ_SEL,
+		.base_bits = 1,
+		.base_shift = 0,
+		.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_table = spi_div,
+	}, {
+		.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,
+	}, {
+		.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,
+	}, {
+		.id = AN7583_CLK_MDIO1,
+		.name = "mdio1",
+
+		.base_reg = REG_CRYPTO_CLKSRC2,
+
+		.base_value = 25000000,
+
+		.div_bits = 4,
+		.div_shift = 22,
+	}, {
+		.id = AN7589_CLK_MDIO2,
+		.name = "mdio2",
+
+		.base_reg = REG_NPU_CLK_DIV_SEL,
+
+		.base_value = 25000000,
+
+		.div_bits = 4,
+		.div_shift = 16,
+	}, {
+		.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,
@@ -798,6 +1005,87 @@ 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_UART3_RST]		= 3,
+	[AN7589_HSUART_RST]		= 4,
+	[AN7589_HSUART2_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_USB1_QP_RST]		= 13,
+	[AN7589_USB0_QP_RST]		= 14,
+	[AN7589_HSDMA_RST]		= 22,
+	[AN7589_EMMC_RST]		= 25,
+	[AN7589_SOE_RST]		= 26,
+	[AN7589_PCIE2_RST]		= 27,
+	[AN7589_USB_HOST_P1_RST]	= 29,
+	[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_EIP_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_MCPP_DISPATCH1_RST]	= 2 * RST_NR_PER_BANK + 4,
+	[AN7589_MCPP_DISPATCH2_RST]	= 2 * RST_NR_PER_BANK + 5,
+	[AN7589_MCPP_DISPATCH3_RST]	= 2 * RST_NR_PER_BANK + 6,
+	[AN7589_MCPP_REORDER1_RST]	= 2 * RST_NR_PER_BANK + 7,
+	[AN7589_MCPP_REORDER2_RST]	= 2 * RST_NR_PER_BANK + 8,
+	[AN7589_MCPP_REFILLER_RST]	= 2 * RST_NR_PER_BANK + 9,
+	[AN7589_NPU_NIQ_RST]		= 2 * RST_NR_PER_BANK + 10,
+	[AN7589_NPU_NEQ_RST]		= 2 * RST_NR_PER_BANK + 11,
+	[AN7589_MDIO2_RST]		= 2 * RST_NR_PER_BANK + 12,
+	[AN7589_XPON_BM_RST]		= 2 * RST_NR_PER_BANK + 13,
+	[AN7589_ETH0_10G_MAC_PM_RST]	= 2 * RST_NR_PER_BANK + 14,
+	[AN7589_ETH0_10G_MAC_TOD_RST]	= 2 * RST_NR_PER_BANK + 15,
+	[AN7589_ETH0_10G_MAC_RST]	= 2 * RST_NR_PER_BANK + 16,
+	[AN7589_ETH0_10G_PHY_RST]	= 2 * RST_NR_PER_BANK + 17,
+	[AN7589_ETH0_10G_PHY_RG_RST]	= 2 * RST_NR_PER_BANK + 18,
+	[AN7589_ETH1_10G_MAC_PM_RST]	= 2 * RST_NR_PER_BANK + 19,
+	[AN7589_ETH1_10G_MAC_TOD_RST]	= 2 * RST_NR_PER_BANK + 20,
+	[AN7589_ETH1_10G_MAC_RST]	= 2 * RST_NR_PER_BANK + 21,
+	[AN7589_ETH1_10G_PHY_RST]	= 2 * RST_NR_PER_BANK + 22,
+	[AN7589_ETH1_10G_PHY_RG_RST]	= 2 * RST_NR_PER_BANK + 23,
+	[AN7589_AI_NPU_RST]		= 2 * RST_NR_PER_BANK + 24,
+	[AN7589_TIMER2_RST]		= 2 * RST_NR_PER_BANK + 25,
+	[AN7589_SPIM0_RST]		= 2 * RST_NR_PER_BANK + 26,
+	[AN7589_SPIM1_RST]		= 2 * RST_NR_PER_BANK + 27,
+	[AN7589_SPIM2_RST]		= 2 * RST_NR_PER_BANK + 28,
+	[AN7589_SPIM3_RST]		= 2 * RST_NR_PER_BANK + 29,
+};
+
 static int en7581_reset_register(struct device *dev, void __iomem *base,
 				 const u16 *rst_map, int nr_resets,
 				 const u16 *rst_reg_ofs);
@@ -1686,6 +1974,36 @@ 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 en_clk_priv *priv = platform_get_drvdata(pdev);
+	struct device *dev = &pdev->dev;
+	struct regmap *map;
+	void __iomem *base;
+	int ret;
+
+	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);
+
+	priv->base = base;
+
+	ret = en7581_register_clocks(dev, clk_data, map, base);
+	if (ret)
+		return ret;
+
+	clk_data->hws[EN7523_CLK_GSW] = ERR_PTR(-ENOENT);
+
+	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));
@@ -1855,6 +2173,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_clocks = ARRAY_SIZE(an7589_base_clks),
+	.num_clocks = AN7589_CLK_MDIO2 + 1,
+	.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 = {
 	.num_clocks = EN751221_MAX_CLKS,
 	.pcie_ops = {
@@ -1870,6 +2200,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] 6+ messages in thread

* [PATCH v2 4/5] dt-bindings: clock: airoha: allow MDIO controllers under the SCU
  2026-12-01 19:36 [PATCH v2 0/5] clk: en7523: add support for Airoha AN7589 John Crispin
                   ` (2 preceding siblings ...)
  2026-12-01 19:36 ` [PATCH v2 3/5] clk: en7523: add support for Airoha AN7589 John Crispin
@ 2026-12-01 19:36 ` John Crispin
  2026-12-01 19:36 ` [PATCH v2 5/5] clk: en7523: populate SCU child devices John Crispin
  4 siblings, 0 replies; 6+ messages in thread
From: John Crispin @ 2026-12-01 19:36 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>
---
v2: rebased, no other change

 .../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 7dc929f8586a..5fa885e02544 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] 6+ messages in thread

* [PATCH v2 5/5] clk: en7523: populate SCU child devices
  2026-12-01 19:36 [PATCH v2 0/5] clk: en7523: add support for Airoha AN7589 John Crispin
                   ` (3 preceding siblings ...)
  2026-12-01 19:36 ` [PATCH v2 4/5] dt-bindings: clock: airoha: allow MDIO controllers under the SCU John Crispin
@ 2026-12-01 19:36 ` John Crispin
  4 siblings, 0 replies; 6+ messages in thread
From: John Crispin @ 2026-12-01 19:36 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 sit in the SCU register space
and are described as children of the clock controller node, but nothing
creates their platform devices. Populate the children once the clock
and reset providers are registered, since they consume both. SoCs
without child nodes are not affected.

While at it, switch to devm_of_clk_add_hw_provider() so the provider
does not stay registered if populating the children fails.

Signed-off-by: John Crispin <john@phrozen.org>
---
v2: rebased, reworded the commit message

 drivers/clk/clk-en7523.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/clk-en7523.c b/drivers/clk/clk-en7523.c
index 775caa54d89c..195b33f010fa 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>
@@ -2106,7 +2107,6 @@ static int en751221_clk_hw_init(struct platform_device *pdev,
 
 static int en7523_clk_probe(struct platform_device *pdev)
 {
-	struct device_node *node = pdev->dev.of_node;
 	const struct en_clk_soc_data *soc_data;
 	struct clk_hw_onecell_data *clk_data;
 	struct en_clk_priv *priv;
@@ -2133,7 +2133,12 @@ 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 = devm_of_clk_add_hw_provider(&pdev->dev, 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] 6+ messages in thread

end of thread, other threads:[~2026-12-01 19:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 19:36 [PATCH v2 0/5] clk: en7523: add support for Airoha AN7589 John Crispin
2026-12-01 19:36 ` [PATCH v2 1/5] dt-bindings: arm: airoha: add AN7589 chip SCU John Crispin
2026-12-01 19:36 ` [PATCH v2 2/5] dt-bindings: clock: airoha: add AN7589 John Crispin
2026-12-01 19:36 ` [PATCH v2 3/5] clk: en7523: add support for Airoha AN7589 John Crispin
2026-12-01 19:36 ` [PATCH v2 4/5] dt-bindings: clock: airoha: allow MDIO controllers under the SCU John Crispin
2026-12-01 19:36 ` [PATCH v2 5/5] 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