* [PATCH 0/9] clk: realtek: Add RTD1625 Clock Support
@ 2025-12-29 7:53 Yu-Chun Lin
2025-12-29 7:53 ` [PATCH 1/9] dt-bindings: clock: Add Realtek RTD1625 Clock & Reset Controller Yu-Chun Lin
` (8 more replies)
0 siblings, 9 replies; 20+ messages in thread
From: Yu-Chun Lin @ 2025-12-29 7:53 UTC (permalink / raw)
To: mturquette, sboyd, robh, krzk+dt, conor+dt, p.zabel, cylee12,
jyanchou
Cc: devicetree, linux-clk, linux-kernel, james.tai, cy.huang,
stanley_chang, eleanor.lin
Hello,
This patch series adds clock support for Realtek's RTD1625 platform
The series includes:
1. Infrastructure: reset controller, basic clocks, PLLs, gate clocks, mux
clocks, and MMC-tuned PLLs.
2. Platform drivers: two clock controller drivers for RTD1625-CRT and
RTD1625-ISO.
I welcome feedback and suggestions.
Best regards,
Yu-Chun Lin
Yu-Chun Lin (9):
dt-bindings: clock: Add Realtek RTD1625 Clock & Reset Controller
clk: realtek: Add basic reset support
clk: realtek: Introduce a common probe()
clk: realtek: Add support for phase locked loops (PLLs)
clk: realtek: Add support for gate clock
clk: realtek: Add support for mux clock
clk: realtek: Add support for MMC-tuned PLL clocks
clk: realtek: Add RTD1625-CRT clock controller driver
clk: realtek: Add RTD1625-ISO clock controller driver
.../bindings/clock/realtek,rtd1625-clk.yaml | 53 ++
MAINTAINERS | 17 +
drivers/clk/Kconfig | 1 +
drivers/clk/Makefile | 1 +
drivers/clk/realtek/Kconfig | 44 +
drivers/clk/realtek/Makefile | 14 +
drivers/clk/realtek/clk-pll-mmc.c | 410 +++++++++
drivers/clk/realtek/clk-pll.c | 191 +++++
drivers/clk/realtek/clk-pll.h | 68 ++
drivers/clk/realtek/clk-regmap-gate.c | 72 ++
drivers/clk/realtek/clk-regmap-gate.h | 65 ++
drivers/clk/realtek/clk-regmap-mux.c | 46 +
drivers/clk/realtek/clk-regmap-mux.h | 43 +
drivers/clk/realtek/clk-rtd1625-crt.c | 788 ++++++++++++++++++
drivers/clk/realtek/clk-rtd1625-iso.c | 150 ++++
drivers/clk/realtek/common.c | 72 ++
drivers/clk/realtek/common.h | 40 +
drivers/clk/realtek/freq_table.c | 35 +
drivers/clk/realtek/freq_table.h | 23 +
drivers/clk/realtek/reset.c | 138 +++
drivers/clk/realtek/reset.h | 36 +
.../dt-bindings/clock/realtek,rtd1625-clk.h | 165 ++++
22 files changed, 2472 insertions(+)
create mode 100644 Documentation/devicetree/bindings/clock/realtek,rtd1625-clk.yaml
create mode 100644 drivers/clk/realtek/Kconfig
create mode 100644 drivers/clk/realtek/Makefile
create mode 100644 drivers/clk/realtek/clk-pll-mmc.c
create mode 100644 drivers/clk/realtek/clk-pll.c
create mode 100644 drivers/clk/realtek/clk-pll.h
create mode 100644 drivers/clk/realtek/clk-regmap-gate.c
create mode 100644 drivers/clk/realtek/clk-regmap-gate.h
create mode 100644 drivers/clk/realtek/clk-regmap-mux.c
create mode 100644 drivers/clk/realtek/clk-regmap-mux.h
create mode 100644 drivers/clk/realtek/clk-rtd1625-crt.c
create mode 100644 drivers/clk/realtek/clk-rtd1625-iso.c
create mode 100644 drivers/clk/realtek/common.c
create mode 100644 drivers/clk/realtek/common.h
create mode 100644 drivers/clk/realtek/freq_table.c
create mode 100644 drivers/clk/realtek/freq_table.h
create mode 100644 drivers/clk/realtek/reset.c
create mode 100644 drivers/clk/realtek/reset.h
create mode 100644 include/dt-bindings/clock/realtek,rtd1625-clk.h
--
2.34.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 1/9] dt-bindings: clock: Add Realtek RTD1625 Clock & Reset Controller
2025-12-29 7:53 [PATCH 0/9] clk: realtek: Add RTD1625 Clock Support Yu-Chun Lin
@ 2025-12-29 7:53 ` Yu-Chun Lin
2025-12-30 12:11 ` Krzysztof Kozlowski
2025-12-29 7:53 ` [PATCH 2/9] clk: realtek: Add basic reset support Yu-Chun Lin
` (7 subsequent siblings)
8 siblings, 1 reply; 20+ messages in thread
From: Yu-Chun Lin @ 2025-12-29 7:53 UTC (permalink / raw)
To: mturquette, sboyd, robh, krzk+dt, conor+dt, p.zabel, cylee12,
jyanchou
Cc: devicetree, linux-clk, linux-kernel, james.tai, cy.huang,
stanley_chang, eleanor.lin
Add DT binding schema for Realtek RTD1625 clock and reset controller
Signed-off-by: Cheng-Yu Lee <cylee12@realtek.com>
Signed-off-by: Yu-Chun Lin <eleanor.lin@realtek.com>
---
.../bindings/clock/realtek,rtd1625-clk.yaml | 53 ++++++
MAINTAINERS | 9 +
.../dt-bindings/clock/realtek,rtd1625-clk.h | 165 ++++++++++++++++++
3 files changed, 227 insertions(+)
create mode 100644 Documentation/devicetree/bindings/clock/realtek,rtd1625-clk.yaml
create mode 100644 include/dt-bindings/clock/realtek,rtd1625-clk.h
diff --git a/Documentation/devicetree/bindings/clock/realtek,rtd1625-clk.yaml b/Documentation/devicetree/bindings/clock/realtek,rtd1625-clk.yaml
new file mode 100644
index 000000000000..dd636c6e9c66
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/realtek,rtd1625-clk.yaml
@@ -0,0 +1,53 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/realtek,rtd1625-clk.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Realtek RTD1625 Clock & Reset Controller
+
+maintainers:
+ - Yu-Chun Lin <eleanor.lin@realtek.com>
+
+description: |
+ The Realtek RTD1625 Clock Controller manages and distributes clock
+ signals to various controllers and implements a Reset Controller for the
+ SoC peripherals.
+
+ Clocks are referenced by unique identifiers, which are defined as
+ preprocessor macros in dt-bindings/clock/realtek,rtd1625-clk.h. Client
+ device nodes within the Device Tree use these identifiers to specify the
+ specific clock and reset signals they require.
+
+properties:
+ compatible:
+ enum:
+ - realtek,rtd1625-crt-clk
+ - realtek,rtd1625-iso-clk
+ - realtek,rtd1625-iso-s-clk
+
+ reg:
+ maxItems: 1
+
+ "#clock-cells":
+ const: 1
+
+ "#reset-cells":
+ const: 1
+
+required:
+ - compatible
+ - reg
+ - "#clock-cells"
+ - "#reset-cells"
+
+additionalProperties: false
+
+examples:
+ - |
+ clock-controller@98000000 {
+ compatible = "realtek,rtd1625-crt-clk";
+ reg = <98000000 0x1000>;
+ #clock-cells = <1>;
+ #reset-cells = <1>;
+ };
diff --git a/MAINTAINERS b/MAINTAINERS
index 12f49de7fe03..9cc78e867a4e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -21968,6 +21968,15 @@ S: Maintained
F: Documentation/devicetree/bindings/net/dsa/realtek.yaml
F: drivers/net/dsa/realtek/*
+REALTEK SOC CLOCK AND RESET BINDINGS
+M: Cheng-Yu Lee <cylee12@realtek.com>
+M: Yu-Chun Lin <eleanor.lin@realtek.com>
+L: devicetree@vger.kernel.org
+L: linux-clk@vger.kernel.org
+S: Supported
+F: Documentation/devicetree/bindings/clock/realtek*
+F: include/dt-bindings/clock/realtek*
+
REALTEK SPI-NAND
M: Chris Packham <chris.packham@alliedtelesis.co.nz>
S: Maintained
diff --git a/include/dt-bindings/clock/realtek,rtd1625-clk.h b/include/dt-bindings/clock/realtek,rtd1625-clk.h
new file mode 100644
index 000000000000..553884d7806a
--- /dev/null
+++ b/include/dt-bindings/clock/realtek,rtd1625-clk.h
@@ -0,0 +1,165 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+/*
+ * Copyright (C) 2025 Realtek Semiconductor Corp.
+ */
+#ifndef __DT_BINDINGS_RTK_CLOCK_RTD1625_H
+#define __DT_BINDINGS_RTK_CLOCK_RTD1625_H
+
+#define RTD1625_CRT_CLK_EN_MISC 0
+#define RTD1625_CRT_CLK_EN_PCIE0 1
+#define RTD1625_CRT_CLK_EN_DIP 2
+#define RTD1625_CRT_CLK_EN_GSPI 3
+#define RTD1625_CRT_CLK_EN_ISO_MISC 5
+#define RTD1625_CRT_CLK_EN_SDS 6
+#define RTD1625_CRT_CLK_EN_HDMI 7
+#define RTD1625_CRT_CLK_EN_GPU 9
+#define RTD1625_CRT_CLK_EN_VE1 10
+#define RTD1625_CRT_CLK_EN_VE2 11
+#define RTD1625_CRT_CLK_EN_MD 18
+#define RTD1625_CRT_CLK_EN_TP 19
+#define RTD1625_CRT_CLK_EN_RCIC 20
+#define RTD1625_CRT_CLK_EN_NF 21
+#define RTD1625_CRT_CLK_EN_EMMC 22
+#define RTD1625_CRT_CLK_EN_SD 23
+#define RTD1625_CRT_CLK_EN_SDIO_IP 24
+#define RTD1625_CRT_CLK_EN_MIPI_CSI 25
+#define RTD1625_CRT_CLK_EN_EMMC_IP 26
+#define RTD1625_CRT_CLK_EN_SDIO 27
+#define RTD1625_CRT_CLK_EN_SD_IP 28
+#define RTD1625_CRT_CLK_EN_TPB 30
+#define RTD1625_CRT_CLK_EN_MISC_SC1 31
+#define RTD1625_CRT_CLK_EN_MISC_I2C_3 32
+#define RTD1625_CRT_CLK_EN_ACPU 33
+#define RTD1625_CRT_CLK_EN_JPEG 34
+#define RTD1625_CRT_CLK_EN_MISC_SC0 37
+#define RTD1625_CRT_CLK_EN_HDMIRX 45
+#define RTD1625_CRT_CLK_EN_HSE 46
+#define RTD1625_CRT_CLK_EN_FAN 49
+#define RTD1625_CRT_CLK_EN_SATA_WRAP_SYS 52
+#define RTD1625_CRT_CLK_EN_SATA_WRAP_SYSH 53
+#define RTD1625_CRT_CLK_EN_SATA_MAC_SYSH 54
+#define RTD1625_CRT_CLK_EN_R2RDSC 55
+#define RTD1625_CRT_CLK_EN_TPC 56
+#define RTD1625_CRT_CLK_EN_PCIE1 57
+#define RTD1625_CRT_CLK_EN_MISC_I2C_4 58
+#define RTD1625_CRT_CLK_EN_MISC_I2C_5 59
+#define RTD1625_CRT_CLK_EN_TSIO 60
+#define RTD1625_CRT_CLK_EN_VE4 61
+#define RTD1625_CRT_CLK_EN_EDP 62
+#define RTD1625_CRT_CLK_EN_TSIO_TRX 63
+#define RTD1625_CRT_CLK_EN_PCIE2 64
+#define RTD1625_CRT_CLK_EN_EARC 66
+#define RTD1625_CRT_CLK_EN_LITE 67
+#define RTD1625_CRT_CLK_EN_MIPI_DSI 68
+#define RTD1625_CRT_CLK_EN_NPUPP 69
+#define RTD1625_CRT_CLK_EN_NPU 70
+#define RTD1625_CRT_CLK_EN_AUCPU0 71
+#define RTD1625_CRT_CLK_EN_AUCPU1 72
+#define RTD1625_CRT_CLK_EN_NSRAM 73
+#define RTD1625_CRT_CLK_EN_HDMITOP 74
+#define RTD1625_CRT_CLK_EN_AUCPU_ISO_NPU 76
+#define RTD1625_CRT_CLK_EN_KEYLADDER 77
+#define RTD1625_CRT_CLK_EN_IFCP_KLM 78
+#define RTD1625_CRT_CLK_EN_IFCP 79
+#define RTD1625_CRT_CLK_EN_MDL_GENPW 80
+#define RTD1625_CRT_CLK_EN_MDL_CHIP 81
+#define RTD1625_CRT_CLK_EN_MDL_IP 82
+#define RTD1625_CRT_CLK_EN_MDLM2M 83
+#define RTD1625_CRT_CLK_EN_MDL_XTAL 84
+#define RTD1625_CRT_CLK_EN_TEST_MUX 85
+#define RTD1625_CRT_CLK_EN_DLA 86
+#define RTD1625_CRT_CLK_EN_TPCW 88
+#define RTD1625_CRT_CLK_EN_GPU_TS_SRC 89
+#define RTD1625_CRT_CLK_EN_VI 91
+#define RTD1625_CRT_CLK_EN_LVDS1 92
+#define RTD1625_CRT_CLK_EN_LVDS2 93
+#define RTD1625_CRT_CLK_EN_AUCPU 94
+#define RTD1625_CRT_CLK_EN_UR1 96
+#define RTD1625_CRT_CLK_EN_UR2 97
+#define RTD1625_CRT_CLK_EN_UR3 98
+#define RTD1625_CRT_CLK_EN_UR4 99
+#define RTD1625_CRT_CLK_EN_UR5 100
+#define RTD1625_CRT_CLK_EN_UR6 101
+#define RTD1625_CRT_CLK_EN_UR7 102
+#define RTD1625_CRT_CLK_EN_UR8 103
+#define RTD1625_CRT_CLK_EN_UR9 104
+#define RTD1625_CRT_CLK_EN_UR_TOP 105
+#define RTD1625_CRT_CLK_EN_MISC_I2C_7 110
+#define RTD1625_CRT_CLK_EN_MISC_I2C_6 111
+#define RTD1625_CRT_CLK_EN_SPI0 112
+#define RTD1625_CRT_CLK_EN_SPI1 113
+#define RTD1625_CRT_CLK_EN_SPI2 114
+#define RTD1625_CRT_CLK_EN_LSADC0 120
+#define RTD1625_CRT_CLK_EN_LSADC1 121
+#define RTD1625_CRT_CLK_EN_ISOMIS_DMA 122
+#define RTD1625_CRT_CLK_EN_DPTX 124
+#define RTD1625_CRT_CLK_EN_NPU_MIPI_CSI 125
+#define RTD1625_CRT_CLK_EN_EDPTX 126
+#define RTD1625_CRT_CLK_HIFI 128
+#define RTD1625_CRT_CLK_NPU_MIPI_CSI 129
+#define RTD1625_CRT_CLK_NPU 130
+#define RTD1625_CRT_CLK_NPU_SYSH 132
+#define RTD1625_CRT_CLK_HIFI_SCPU 133
+#define RTD1625_CRT_CLK_GPU 134
+#define RTD1625_CRT_CLK_GPU2D 135
+#define RTD1625_CRT_CLK_MIPI_DSI_PCLK 136
+#define RTD1625_CRT_CLK_VE1 137
+#define RTD1625_CRT_CLK_VE2 138
+#define RTD1625_CRT_CLK_VE4 139
+#define RTD1625_CRT_CLK_SYS 141
+#define RTD1625_CRT_CLK_SYSH 142
+#define RTD1625_CRT_PLL_SDIO_REF 145
+#define RTD1625_CRT_PLL_CR_REF 146
+#define RTD1625_CRT_PLL_EMMC_REF 147
+#define RTD1625_CRT_CLK_MIS_SC0 148
+#define RTD1625_CRT_CLK_MIS_SC1 149
+#define RTD1625_CRT_PLL_SCPU 150
+#define RTD1625_CRT_PLL_VE1 151
+#define RTD1625_CRT_PLL_DDSA 152
+#define RTD1625_CRT_PLL_PSAUDA1 153
+#define RTD1625_CRT_PLL_PSAUDA2 154
+#define RTD1625_CRT_PLL_BUS 155
+#define RTD1625_CRT_PLL_SDIO 156
+#define RTD1625_CRT_PLL_SDIO_VP0 157
+#define RTD1625_CRT_PLL_SDIO_VP1 158
+#define RTD1625_CRT_PLL_DCSB 159
+#define RTD1625_CRT_PLL_GPU 160
+#define RTD1625_CRT_PLL_NPU 161
+#define RTD1625_CRT_PLL_VE2 162
+#define RTD1625_CRT_PLL_HIFI 163
+#define RTD1625_CRT_PLL_SD 164
+#define RTD1625_CRT_PLL_SD_VP0 165
+#define RTD1625_CRT_PLL_SD_VP1 166
+#define RTD1625_CRT_PLL_EMMC 167
+#define RTD1625_CRT_PLL_EMMC_VP0 168
+#define RTD1625_CRT_PLL_EMMC_VP1 169
+#define RTD1625_CRT_PLL_ACPU 170
+#define RTD1625_CRT_CLK_DET 171
+#define RTD1625_CRT_CLK_MAX 172
+#define RTD1625_ISO_CLK_EN_USB_P4 0
+#define RTD1625_ISO_CLK_EN_USB_P3 1
+#define RTD1625_ISO_CLK_EN_MISC_CEC0 2
+#define RTD1625_ISO_CLK_EN_CBUSRX_SYS 3
+#define RTD1625_ISO_CLK_EN_CBUSTX_SYS 4
+#define RTD1625_ISO_CLK_EN_CBUS_SYS 5
+#define RTD1625_ISO_CLK_EN_CBUS_OSC 6
+#define RTD1625_ISO_CLK_EN_MISC_UR0 8
+#define RTD1625_ISO_CLK_EN_I2C0 9
+#define RTD1625_ISO_CLK_EN_I2C1 10
+#define RTD1625_ISO_CLK_EN_ETN_250M 11
+#define RTD1625_ISO_CLK_EN_ETN_SYS 12
+#define RTD1625_ISO_CLK_EN_USB_DRD 13
+#define RTD1625_ISO_CLK_EN_USB_HOST 14
+#define RTD1625_ISO_CLK_EN_USB_U3_HOST 15
+#define RTD1625_ISO_CLK_EN_USB 16
+#define RTD1625_ISO_CLK_EN_VTC 17
+#define RTD1625_ISO_CLK_EN_MISC_VFD 18
+#define RTD1625_ISO_CLK_MAX 19
+#define RTD1625_ISO_S_CLK_EN_ISOM_MIS 0
+#define RTD1625_ISO_S_CLK_EN_ISOM_GPIOM 1
+#define RTD1625_ISO_S_CLK_EN_TIMER7 2
+#define RTD1625_ISO_S_CLK_EN_IRDA 3
+#define RTD1625_ISO_S_CLK_EN_UR10 4
+#define RTD1625_ISO_S_CLK_MAX 5
+
+#endif /* __DT_BINDINGS_RTK_CLOCK_RTD1625_H */
--
2.34.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 2/9] clk: realtek: Add basic reset support
2025-12-29 7:53 [PATCH 0/9] clk: realtek: Add RTD1625 Clock Support Yu-Chun Lin
2025-12-29 7:53 ` [PATCH 1/9] dt-bindings: clock: Add Realtek RTD1625 Clock & Reset Controller Yu-Chun Lin
@ 2025-12-29 7:53 ` Yu-Chun Lin
2025-12-30 12:20 ` Krzysztof Kozlowski
2025-12-29 7:53 ` [PATCH 3/9] clk: realtek: Introduce a common probe() Yu-Chun Lin
` (6 subsequent siblings)
8 siblings, 1 reply; 20+ messages in thread
From: Yu-Chun Lin @ 2025-12-29 7:53 UTC (permalink / raw)
To: mturquette, sboyd, robh, krzk+dt, conor+dt, p.zabel, cylee12,
jyanchou
Cc: devicetree, linux-clk, linux-kernel, james.tai, cy.huang,
stanley_chang, eleanor.lin
Define the reset operations backed by a regmap-based register
interface and prepare the reset controller to be registered
through the reset framework.
Signed-off-by: Cheng-Yu Lee <cylee12@realtek.com>
Signed-off-by: Yu-Chun Lin <eleanor.lin@realtek.com>
---
drivers/clk/Kconfig | 1 +
drivers/clk/Makefile | 1 +
drivers/clk/realtek/Kconfig | 27 +++++++
drivers/clk/realtek/Makefile | 4 +
drivers/clk/realtek/reset.c | 138 +++++++++++++++++++++++++++++++++++
drivers/clk/realtek/reset.h | 36 +++++++++
6 files changed, 207 insertions(+)
create mode 100644 drivers/clk/realtek/Kconfig
create mode 100644 drivers/clk/realtek/Makefile
create mode 100644 drivers/clk/realtek/reset.c
create mode 100644 drivers/clk/realtek/reset.h
diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 3a1611008e48..2f2cacf87c38 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -530,6 +530,7 @@ source "drivers/clk/nuvoton/Kconfig"
source "drivers/clk/pistachio/Kconfig"
source "drivers/clk/qcom/Kconfig"
source "drivers/clk/ralink/Kconfig"
+source "drivers/clk/realtek/Kconfig"
source "drivers/clk/renesas/Kconfig"
source "drivers/clk/rockchip/Kconfig"
source "drivers/clk/samsung/Kconfig"
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index 61ec08404442..075a1c410b90 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -141,6 +141,7 @@ obj-$(CONFIG_COMMON_CLK_PISTACHIO) += pistachio/
obj-$(CONFIG_COMMON_CLK_PXA) += pxa/
obj-$(CONFIG_COMMON_CLK_QCOM) += qcom/
obj-y += ralink/
+obj-$(CONFIG_COMMON_CLK_REALTEK) += realtek/
obj-y += renesas/
obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/
obj-$(CONFIG_COMMON_CLK_SAMSUNG) += samsung/
diff --git a/drivers/clk/realtek/Kconfig b/drivers/clk/realtek/Kconfig
new file mode 100644
index 000000000000..8577dce93ba6
--- /dev/null
+++ b/drivers/clk/realtek/Kconfig
@@ -0,0 +1,27 @@
+# SPDX-License-Identifier: GPL-2.0-only
+config COMMON_CLK_REALTEK
+ bool "Clock driver for Realtek SoCs"
+ depends on ARCH_REALTEK || COMPILE_TEST
+ select MFD_SYSCON
+ default y
+ help
+ Enable the common clock framework infrastructure for Realtek
+ system-on-chip platforms.
+
+ This provides the base support required by individual Realtek
+ clock controller drivers to expose clocks to peripheral devices.
+
+ If you have a Realtek-based platform, say Y.
+
+if COMMON_CLK_REALTEK
+
+config RTK_CLK_COMMON
+ tristate "Realtek Clock Common"
+ select RESET_CONTROLLER
+ help
+ Common helper code shared by Realtek clock controller drivers.
+
+ This provides utility functions and data structures used by
+ multiple Realtek clock implementations, and include integration
+ with reset controllers where required.
+endif
diff --git a/drivers/clk/realtek/Makefile b/drivers/clk/realtek/Makefile
new file mode 100644
index 000000000000..52267de2eef4
--- /dev/null
+++ b/drivers/clk/realtek/Makefile
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_RTK_CLK_COMMON) += clk-rtk.o
+
+clk-rtk-y += reset.o
diff --git a/drivers/clk/realtek/reset.c b/drivers/clk/realtek/reset.c
new file mode 100644
index 000000000000..0c1925216bbf
--- /dev/null
+++ b/drivers/clk/realtek/reset.c
@@ -0,0 +1,138 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2019 Realtek Semiconductor Corporation
+ */
+
+#include <linux/of.h>
+#include <linux/device.h>
+#include "reset.h"
+
+#define RTK_RESET_BANK_SHIFT 8
+#define RTK_RESET_ID_MASK 0xff
+#define to_rtk_reset_controller(r) container_of(r, struct rtk_reset_data, rcdev)
+
+static inline struct rtk_reset_bank *
+rtk_reset_get_bank(struct rtk_reset_data *data, unsigned long idx)
+{
+ int bank_id = idx >> RTK_RESET_BANK_SHIFT;
+
+ return &data->banks[bank_id];
+}
+
+static inline int rtk_reset_get_id(struct rtk_reset_data *data,
+ unsigned long idx)
+{
+ return idx & RTK_RESET_ID_MASK;
+}
+
+static int rtk_reset_update_bits(struct rtk_reset_data *data, u32 offset,
+ u32 mask, u32 val)
+{
+ int ret;
+
+ ret = regmap_update_bits(data->regmap, offset, mask, val);
+ return ret;
+}
+
+static int rtk_reset_read(struct rtk_reset_data *data, u32 offset, u32 *val)
+{
+ int ret;
+
+ ret = regmap_read(data->regmap, offset, val);
+ return ret;
+}
+
+static int rtk_reset_assert(struct reset_controller_dev *rcdev,
+ unsigned long idx)
+{
+ struct rtk_reset_data *data = to_rtk_reset_controller(rcdev);
+ struct rtk_reset_bank *bank = rtk_reset_get_bank(data, idx);
+ u32 id = rtk_reset_get_id(data, idx);
+ u32 mask = bank->write_en ? (0x3 << id) : BIT(id);
+ u32 val = bank->write_en ? (0x2 << id) : 0;
+
+ return rtk_reset_update_bits(data, bank->ofs, mask, val);
+}
+
+static int rtk_reset_deassert(struct reset_controller_dev *rcdev,
+ unsigned long idx)
+{
+ struct rtk_reset_data *data = to_rtk_reset_controller(rcdev);
+ struct rtk_reset_bank *bank = rtk_reset_get_bank(data, idx);
+ u32 id = rtk_reset_get_id(data, idx);
+ u32 mask = bank->write_en ? (0x3 << id) : BIT(id);
+ u32 val = mask;
+
+ return rtk_reset_update_bits(data, bank->ofs, mask, val);
+}
+
+static int rtk_reset_reset(struct reset_controller_dev *rcdev,
+ unsigned long idx)
+{
+ int ret;
+
+ ret = rtk_reset_assert(rcdev, idx);
+ if (ret)
+ return ret;
+ return rtk_reset_deassert(rcdev, idx);
+}
+
+static int rtk_reset_status(struct reset_controller_dev *rcdev,
+ unsigned long idx)
+{
+ struct rtk_reset_data *data = to_rtk_reset_controller(rcdev);
+ struct rtk_reset_bank *bank = &data->banks[idx >> 8];
+ u32 id = idx & 0xff;
+ u32 val;
+
+ rtk_reset_read(data, bank->ofs, &val);
+
+ return !((val >> id) & 1);
+}
+
+static const struct reset_control_ops rtk_reset_ops = {
+ .reset = rtk_reset_reset,
+ .assert = rtk_reset_assert,
+ .deassert = rtk_reset_deassert,
+ .status = rtk_reset_status,
+};
+
+static int rtk_of_reset_xlate(struct reset_controller_dev *rcdev,
+ const struct of_phandle_args *reset_spec)
+{
+ int val;
+
+ val = reset_spec->args[0];
+
+ if (val >= rcdev->nr_resets)
+ return -EINVAL;
+
+ return val;
+}
+
+int rtk_reset_controller_add(struct device *dev,
+ struct rtk_reset_initdata *initdata)
+{
+ struct rtk_reset_data *data;
+
+ data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
+
+ if (!data)
+ return -ENOMEM;
+
+ data->dev = dev;
+ data->num_banks = initdata->num_banks;
+ data->banks = initdata->banks;
+ data->regmap = initdata->regmap;
+ data->rcdev.owner = THIS_MODULE;
+ data->rcdev.ops = &rtk_reset_ops;
+ data->rcdev.dev = dev;
+ data->rcdev.of_node = dev->of_node;
+ data->rcdev.nr_resets = initdata->num_banks * 0x100;
+ data->rcdev.of_xlate = rtk_of_reset_xlate;
+ data->rcdev.of_reset_n_cells = 1;
+
+ return devm_reset_controller_register(dev, &data->rcdev);
+}
+EXPORT_SYMBOL_GPL(rtk_reset_controller_add);
+
diff --git a/drivers/clk/realtek/reset.h b/drivers/clk/realtek/reset.h
new file mode 100644
index 000000000000..cd446b098429
--- /dev/null
+++ b/drivers/clk/realtek/reset.h
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2019 Realtek Semiconductor Corporation
+ * Author: Cheng-Yu Lee <cylee12@realtek.com>
+ */
+
+#ifndef __CLK_REALTEK_RESET_H
+#define __CLK_REALTEK_RESET_H
+
+#include <linux/regmap.h>
+#include <linux/reset-controller.h>
+#include <linux/hwspinlock.h>
+
+struct rtk_reset_bank {
+ u32 ofs;
+ u32 write_en;
+};
+
+struct rtk_reset_data {
+ struct device *dev;
+ struct reset_controller_dev rcdev;
+ struct rtk_reset_bank *banks;
+ u32 num_banks;
+ struct regmap *regmap;
+};
+
+struct rtk_reset_initdata {
+ struct rtk_reset_bank *banks;
+ u32 num_banks;
+ struct regmap *regmap;
+};
+
+int rtk_reset_controller_add(struct device *dev,
+ struct rtk_reset_initdata *initdata);
+
+#endif /* __CLK_REALTEK_RESET_H */
--
2.34.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 3/9] clk: realtek: Introduce a common probe()
2025-12-29 7:53 [PATCH 0/9] clk: realtek: Add RTD1625 Clock Support Yu-Chun Lin
2025-12-29 7:53 ` [PATCH 1/9] dt-bindings: clock: Add Realtek RTD1625 Clock & Reset Controller Yu-Chun Lin
2025-12-29 7:53 ` [PATCH 2/9] clk: realtek: Add basic reset support Yu-Chun Lin
@ 2025-12-29 7:53 ` Yu-Chun Lin
2025-12-30 12:17 ` Krzysztof Kozlowski
` (2 more replies)
2025-12-29 7:53 ` [PATCH 4/9] clk: realtek: Add support for phase locked loops (PLLs) Yu-Chun Lin
` (5 subsequent siblings)
8 siblings, 3 replies; 20+ messages in thread
From: Yu-Chun Lin @ 2025-12-29 7:53 UTC (permalink / raw)
To: mturquette, sboyd, robh, krzk+dt, conor+dt, p.zabel, cylee12,
jyanchou
Cc: devicetree, linux-clk, linux-kernel, james.tai, cy.huang,
stanley_chang, eleanor.lin
Add rtk_clk_probe() to set up the shared regmap, register clock hardware,
add the clock provider, and optionally register a reset controller when
reset bank data is provided.
Signed-off-by: Cheng-Yu Lee <cylee12@realtek.com>
Signed-off-by: Yu-Chun Lin <eleanor.lin@realtek.com>
---
drivers/clk/realtek/Makefile | 1 +
drivers/clk/realtek/common.c | 72 ++++++++++++++++++++++++++++++++++++
drivers/clk/realtek/common.h | 40 ++++++++++++++++++++
3 files changed, 113 insertions(+)
create mode 100644 drivers/clk/realtek/common.c
create mode 100644 drivers/clk/realtek/common.h
diff --git a/drivers/clk/realtek/Makefile b/drivers/clk/realtek/Makefile
index 52267de2eef4..4041951b7c62 100644
--- a/drivers/clk/realtek/Makefile
+++ b/drivers/clk/realtek/Makefile
@@ -1,4 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_RTK_CLK_COMMON) += clk-rtk.o
+clk-rtk-y += common.o
clk-rtk-y += reset.o
diff --git a/drivers/clk/realtek/common.c b/drivers/clk/realtek/common.c
new file mode 100644
index 000000000000..df89d2a10291
--- /dev/null
+++ b/drivers/clk/realtek/common.c
@@ -0,0 +1,72 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2019 Realtek Semiconductor Corporation
+ * Author: Cheng-Yu Lee <cylee12@realtek.com>
+ */
+
+#include <linux/device.h>
+#include <linux/module.h>
+#include <linux/mfd/syscon.h>
+#include <linux/platform_device.h>
+#include "common.h"
+
+int rtk_clk_probe(struct platform_device *pdev, const struct rtk_clk_desc *desc)
+{
+ int i, ret;
+ struct device *dev = &pdev->dev;
+ struct rtk_reset_initdata reset_initdata = { 0 };
+
+ struct regmap *regmap = device_node_to_regmap(pdev->dev.of_node);
+
+ if (IS_ERR(regmap)) {
+ ret = PTR_ERR(regmap);
+ dev_err(dev, "Failed to get regmap: %d\n", ret);
+ return ret;
+ }
+
+ for (i = 0; i < desc->num_clks; i++)
+ desc->clks[i]->regmap = regmap;
+
+ for (i = 0; i < desc->clk_data->num; i++) {
+ struct clk_hw *hw = desc->clk_data->hws[i];
+
+ if (!hw)
+ continue;
+
+ ret = devm_clk_hw_register(dev, hw);
+
+ if (ret) {
+ dev_warn(dev, "failed to register hw of clk%d: %d\n", i,
+ ret);
+ desc->clk_data->hws[i] = NULL;
+ }
+ }
+
+ ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get,
+ desc->clk_data);
+
+ if (ret) {
+ dev_err(dev, "Failed to add clock provider\n");
+ return ret;
+ }
+
+ if (!desc->num_reset_banks)
+ return 0;
+
+ if (!desc->reset_banks) {
+ dev_err(dev,
+ "Missing reset banks data though num_reset_banks is %lu\n",
+ desc->num_reset_banks);
+ return -EINVAL;
+ }
+
+ reset_initdata.regmap = regmap;
+ reset_initdata.num_banks = desc->num_reset_banks;
+ reset_initdata.banks = desc->reset_banks;
+
+ return rtk_reset_controller_add(dev, &reset_initdata);
+}
+EXPORT_SYMBOL_GPL(rtk_clk_probe);
+
+MODULE_DESCRIPTION("Realtek clock infrastructure");
+MODULE_LICENSE("GPL");
diff --git a/drivers/clk/realtek/common.h b/drivers/clk/realtek/common.h
new file mode 100644
index 000000000000..7b700f144e9e
--- /dev/null
+++ b/drivers/clk/realtek/common.h
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2016-2019 Realtek Semiconductor Corporation
+ * Author: Cheng-Yu Lee <cylee12@realtek.com>
+ */
+
+#ifndef __CLK_REALTEK_COMMON_H
+#define __CLK_REALTEK_COMMON_H
+
+#include <linux/clk-provider.h>
+#include <linux/device.h>
+#include <linux/hwspinlock.h>
+#include <linux/io.h>
+#include <linux/of.h>
+#include <linux/regmap.h>
+#include "reset.h"
+
+struct device;
+struct platform_device;
+
+struct clk_regmap {
+ struct clk_hw hw;
+ struct regmap *regmap;
+};
+
+#define to_clk_regmap(_hw) container_of(_hw, struct clk_regmap, hw)
+#define __clk_regmap_hw(_p) ((_p)->hw)
+
+struct rtk_clk_desc {
+ struct clk_hw_onecell_data *clk_data;
+ struct clk_regmap **clks;
+ size_t num_clks;
+ struct rtk_reset_bank *reset_banks;
+ size_t num_reset_banks;
+};
+
+int rtk_clk_probe(struct platform_device *pdev,
+ const struct rtk_clk_desc *desc);
+
+#endif /* __CLK_REALTEK_COMMON_H */
--
2.34.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 4/9] clk: realtek: Add support for phase locked loops (PLLs)
2025-12-29 7:53 [PATCH 0/9] clk: realtek: Add RTD1625 Clock Support Yu-Chun Lin
` (2 preceding siblings ...)
2025-12-29 7:53 ` [PATCH 3/9] clk: realtek: Introduce a common probe() Yu-Chun Lin
@ 2025-12-29 7:53 ` Yu-Chun Lin
2025-12-30 20:18 ` kernel test robot
2025-12-29 7:53 ` [PATCH 5/9] clk: realtek: Add support for gate clock Yu-Chun Lin
` (4 subsequent siblings)
8 siblings, 1 reply; 20+ messages in thread
From: Yu-Chun Lin @ 2025-12-29 7:53 UTC (permalink / raw)
To: mturquette, sboyd, robh, krzk+dt, conor+dt, p.zabel, cylee12,
jyanchou
Cc: devicetree, linux-clk, linux-kernel, james.tai, cy.huang,
stanley_chang, eleanor.lin
Provide a full set of PLL operations for programmable PLLs and a read-only
variant for fixed or hardware-managed PLLs.
Signed-off-by: Cheng-Yu Lee <cylee12@realtek.com>
Signed-off-by: Yu-Chun Lin <eleanor.lin@realtek.com>
---
drivers/clk/realtek/Makefile | 2 +
drivers/clk/realtek/clk-pll.c | 191 +++++++++++++++++++++++++++++++
drivers/clk/realtek/clk-pll.h | 47 ++++++++
drivers/clk/realtek/freq_table.c | 35 ++++++
drivers/clk/realtek/freq_table.h | 23 ++++
5 files changed, 298 insertions(+)
create mode 100644 drivers/clk/realtek/clk-pll.c
create mode 100644 drivers/clk/realtek/clk-pll.h
create mode 100644 drivers/clk/realtek/freq_table.c
create mode 100644 drivers/clk/realtek/freq_table.h
diff --git a/drivers/clk/realtek/Makefile b/drivers/clk/realtek/Makefile
index 4041951b7c62..c173ea3b10e3 100644
--- a/drivers/clk/realtek/Makefile
+++ b/drivers/clk/realtek/Makefile
@@ -2,4 +2,6 @@
obj-$(CONFIG_RTK_CLK_COMMON) += clk-rtk.o
clk-rtk-y += common.o
+clk-rtk-y += clk-pll.o
+clk-rtk-y += freq_table.o
clk-rtk-y += reset.o
diff --git a/drivers/clk/realtek/clk-pll.c b/drivers/clk/realtek/clk-pll.c
new file mode 100644
index 000000000000..6eba30c5f2fa
--- /dev/null
+++ b/drivers/clk/realtek/clk-pll.c
@@ -0,0 +1,191 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2024 Realtek Semiconductor Corporation
+ * Author: Cheng-Yu Lee <cylee12@realtek.com>
+ */
+
+#include "clk-pll.h"
+
+#define TIMEOUT 2000
+
+static int wait_freq_ready(struct clk_pll *clkp)
+{
+ u32 pollval;
+
+ if (!clkp->freq_ready_valid)
+ return 0;
+
+ return regmap_read_poll_timeout_atomic(clkp->clkr.regmap, clkp->freq_ready_reg, pollval,
+ (pollval & clkp->freq_ready_mask) == clkp->freq_ready_val,
+ 0, TIMEOUT);
+}
+
+static bool is_power_on(struct clk_pll *clkp)
+{
+ u32 val;
+ int ret;
+
+ if (!clkp->power_reg)
+ return true;
+
+ ret = regmap_read(clkp->clkr.regmap, clkp->power_reg, &val);
+ if (ret)
+ return true;
+
+ return (val & clkp->power_mask) == clkp->power_val_on;
+}
+
+static int get_freq_val_raw(struct clk_pll *clkp, u32 *val)
+{
+ int ret;
+
+ ret = regmap_read(clkp->clkr.regmap, clkp->freq_reg, val);
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
+static int get_freq_val(struct clk_pll *clkp, u32 *val)
+{
+ int ret;
+ u32 raw_val;
+
+ ret = get_freq_val_raw(clkp, &raw_val);
+ if (ret)
+ return ret;
+
+ *val = raw_val & clkp->freq_mask;
+ return 0;
+}
+
+static void clk_pll_disable(struct clk_hw *hw)
+{
+ struct clk_pll *clkp = to_clk_pll(hw);
+
+ if (!clkp->seq_power_off)
+ return;
+
+ regmap_multi_reg_write(clkp->clkr.regmap, clkp->seq_power_off,
+ clkp->num_seq_power_off);
+}
+
+static void clk_pll_disable_unused(struct clk_hw *hw)
+{
+ clk_pll_disable(hw);
+}
+
+static int clk_pll_is_enabled(struct clk_hw *hw)
+{
+ struct clk_pll *clkp = to_clk_pll(hw);
+
+ return is_power_on(clkp);
+}
+
+static int clk_pll_determine_rate(struct clk_hw *hw,
+ struct clk_rate_request *req)
+{
+ struct clk_pll *clkp = to_clk_pll(hw);
+ const struct freq_table *ftblv = NULL;
+
+ ftblv = ftbl_find_by_rate(clkp->freq_tbl, req->rate);
+ return ftblv ? ftblv->rate : 0;
+}
+
+static unsigned long clk_pll_recalc_rate(struct clk_hw *hw,
+ unsigned long parent_rate)
+{
+ struct clk_pll *clkp = to_clk_pll(hw);
+ const struct freq_table *fv;
+ u32 freq_val;
+ int ret;
+
+ ret = get_freq_val(clkp, &freq_val);
+ if (ret)
+ return 0;
+
+ fv = ftbl_find_by_val_with_mask(clkp->freq_tbl, clkp->freq_mask,
+ freq_val);
+ return fv ? fv->rate : 0;
+}
+
+static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate,
+ unsigned long parent_rate)
+{
+ struct clk_pll *clkp = to_clk_pll(hw);
+ const struct freq_table *fv;
+ u32 freq_val;
+ int ret;
+
+ fv = ftbl_find_by_rate(clkp->freq_tbl, rate);
+ if (!fv || fv->rate != rate)
+ return -EINVAL;
+
+ ret = get_freq_val_raw(clkp, &freq_val);
+ if (ret)
+ return ret;
+
+ freq_val &= ~clkp->freq_mask;
+ freq_val |= (fv->val & clkp->freq_mask);
+
+ if (clkp->seq_pre_set_freq) {
+ ret = regmap_multi_reg_write(clkp->clkr.regmap, clkp->seq_pre_set_freq,
+ clkp->num_seq_pre_set_freq);
+ if (ret)
+ return ret;
+ }
+
+ ret = regmap_write(clkp->clkr.regmap, clkp->freq_reg, freq_val);
+ if (ret)
+ return ret;
+
+ if (clkp->seq_post_set_freq) {
+ ret = regmap_multi_reg_write(clkp->clkr.regmap, clkp->seq_post_set_freq,
+ clkp->num_seq_post_set_freq);
+ if (ret)
+ return ret;
+ }
+
+ if (is_power_on(clkp)) {
+ ret = wait_freq_ready(clkp);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+
+static int clk_pll_enable(struct clk_hw *hw)
+{
+ struct clk_pll *clkp = to_clk_pll(hw);
+ int ret;
+
+ if (!clkp->seq_power_on)
+ return 0;
+
+ if (is_power_on(clkp))
+ return 0;
+
+ ret = regmap_multi_reg_write(clkp->clkr.regmap, clkp->seq_power_on,
+ clkp->num_seq_power_on);
+ if (ret)
+ return ret;
+
+ return wait_freq_ready(clkp);
+}
+
+const struct clk_ops clk_pll_ops = {
+ .enable = clk_pll_enable,
+ .disable = clk_pll_disable,
+ .is_enabled = clk_pll_is_enabled,
+ .disable_unused = clk_pll_disable_unused,
+ .recalc_rate = clk_pll_recalc_rate,
+ .determine_rate = clk_pll_determine_rate,
+ .set_rate = clk_pll_set_rate,
+};
+EXPORT_SYMBOL_GPL(clk_pll_ops);
+
+const struct clk_ops clk_pll_ro_ops = {
+ .recalc_rate = clk_pll_recalc_rate,
+};
+EXPORT_SYMBOL_GPL(clk_pll_ro_ops);
diff --git a/drivers/clk/realtek/clk-pll.h b/drivers/clk/realtek/clk-pll.h
new file mode 100644
index 000000000000..c3e2e5ca641f
--- /dev/null
+++ b/drivers/clk/realtek/clk-pll.h
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2017-2019 Realtek Semiconductor Corporation
+ * Author: Cheng-Yu Lee <cylee12@realtek.com>
+ */
+
+#ifndef __CLK_REALTEK_CLK_PLL_H
+#define __CLK_REALTEK_CLK_PLL_H
+
+#include "common.h"
+#include "freq_table.h"
+
+struct clk_pll {
+ struct clk_regmap clkr;
+ const struct reg_sequence *seq_power_on;
+ u32 num_seq_power_on;
+ const struct reg_sequence *seq_power_off;
+ u32 num_seq_power_off;
+ const struct reg_sequence *seq_pre_set_freq;
+ u32 num_seq_pre_set_freq;
+ const struct reg_sequence *seq_post_set_freq;
+ u32 num_seq_post_set_freq;
+ const struct freq_table *freq_tbl;
+ u32 freq_reg;
+ u32 freq_mask;
+ u32 freq_ready_valid;
+ u32 freq_ready_mask;
+ u32 freq_ready_reg;
+ u32 freq_ready_val;
+ u32 power_reg;
+ u32 power_mask;
+ u32 power_val_on;
+};
+
+#define __clk_pll_hw(_ptr) __clk_regmap_hw(&(_ptr)->clkr)
+
+static inline struct clk_pll *to_clk_pll(struct clk_hw *hw)
+{
+ struct clk_regmap *clkr = to_clk_regmap(hw);
+
+ return container_of(clkr, struct clk_pll, clkr);
+}
+
+extern const struct clk_ops clk_pll_ops;
+extern const struct clk_ops clk_pll_ro_ops;
+
+#endif /* __CLK_REALTEK_CLK_PLL_H */
diff --git a/drivers/clk/realtek/freq_table.c b/drivers/clk/realtek/freq_table.c
new file mode 100644
index 000000000000..26a0d2d3e851
--- /dev/null
+++ b/drivers/clk/realtek/freq_table.c
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include "freq_table.h"
+
+const struct freq_table *ftbl_find_by_rate(const struct freq_table *ftbl,
+ unsigned long rate)
+{
+ unsigned long best_rate = 0;
+ const struct freq_table *best = NULL;
+
+ for (; !IS_FREQ_TABLE_END(ftbl); ftbl++) {
+ if (ftbl->rate == rate)
+ return ftbl;
+
+ if (ftbl->rate > rate)
+ continue;
+
+ if (ftbl->rate > best_rate) {
+ best_rate = ftbl->rate;
+ best = ftbl;
+ }
+ }
+
+ return best;
+}
+
+const struct freq_table *
+ftbl_find_by_val_with_mask(const struct freq_table *ftbl, u32 mask, u32 value)
+{
+ for (; !IS_FREQ_TABLE_END(ftbl); ftbl++) {
+ if ((ftbl->val & mask) == (value & mask))
+ return ftbl;
+ }
+ return NULL;
+};
diff --git a/drivers/clk/realtek/freq_table.h b/drivers/clk/realtek/freq_table.h
new file mode 100644
index 000000000000..66a0b0610e38
--- /dev/null
+++ b/drivers/clk/realtek/freq_table.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <linux/bitops.h>
+
+struct freq_table {
+ u32 val;
+ unsigned long rate;
+};
+
+/* ofs check */
+#define CLK_OFS_INVALID (-1)
+#define CLK_OFS_IS_VALID(_ofs) ((_ofs) != CLK_OFS_INVALID)
+
+#define FREQ_TABLE_END \
+ { \
+ .rate = 0 \
+ }
+#define IS_FREQ_TABLE_END(_f) ((_f)->rate == 0)
+
+const struct freq_table *ftbl_find_by_rate(const struct freq_table *ftbl,
+ unsigned long rate);
+const struct freq_table *
+ftbl_find_by_val_with_mask(const struct freq_table *ftbl, u32 mask, u32 value);
--
2.34.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 5/9] clk: realtek: Add support for gate clock
2025-12-29 7:53 [PATCH 0/9] clk: realtek: Add RTD1625 Clock Support Yu-Chun Lin
` (3 preceding siblings ...)
2025-12-29 7:53 ` [PATCH 4/9] clk: realtek: Add support for phase locked loops (PLLs) Yu-Chun Lin
@ 2025-12-29 7:53 ` Yu-Chun Lin
2025-12-29 7:53 ` [PATCH 6/9] clk: realtek: Add support for mux clock Yu-Chun Lin
` (3 subsequent siblings)
8 siblings, 0 replies; 20+ messages in thread
From: Yu-Chun Lin @ 2025-12-29 7:53 UTC (permalink / raw)
To: mturquette, sboyd, robh, krzk+dt, conor+dt, p.zabel, cylee12,
jyanchou
Cc: devicetree, linux-clk, linux-kernel, james.tai, cy.huang,
stanley_chang, eleanor.lin
Introduce clk_regmap_gate_ops supporting enable, disable, is_enabled, and
disable_unused for standard regmap gate clocks.
Add clk_regmap_gate_ro_ops as a read-only variant exposing only is_enabled.
Signed-off-by: Cheng-Yu Lee <cylee12@realtek.com>
Signed-off-by: Yu-Chun Lin <eleanor.lin@realtek.com>
---
drivers/clk/realtek/Makefile | 2 +
drivers/clk/realtek/clk-regmap-gate.c | 72 +++++++++++++++++++++++++++
drivers/clk/realtek/clk-regmap-gate.h | 65 ++++++++++++++++++++++++
3 files changed, 139 insertions(+)
create mode 100644 drivers/clk/realtek/clk-regmap-gate.c
create mode 100644 drivers/clk/realtek/clk-regmap-gate.h
diff --git a/drivers/clk/realtek/Makefile b/drivers/clk/realtek/Makefile
index c173ea3b10e3..97058d48a176 100644
--- a/drivers/clk/realtek/Makefile
+++ b/drivers/clk/realtek/Makefile
@@ -2,6 +2,8 @@
obj-$(CONFIG_RTK_CLK_COMMON) += clk-rtk.o
clk-rtk-y += common.o
+
clk-rtk-y += clk-pll.o
+clk-rtk-y += clk-regmap-gate.o
clk-rtk-y += freq_table.o
clk-rtk-y += reset.o
diff --git a/drivers/clk/realtek/clk-regmap-gate.c b/drivers/clk/realtek/clk-regmap-gate.c
new file mode 100644
index 000000000000..9a2e77c29924
--- /dev/null
+++ b/drivers/clk/realtek/clk-regmap-gate.c
@@ -0,0 +1,72 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2017 Realtek Semiconductor Corporation
+ * Author: Cheng-Yu Lee <cylee12@realtek.com>
+ */
+
+#include "clk-regmap-gate.h"
+
+static int clk_regmap_gate_enable(struct clk_hw *hw)
+{
+ struct clk_regmap_gate *clkg = to_clk_regmap_gate(hw);
+ unsigned int mask;
+ unsigned int val;
+
+ mask = BIT(clkg->bit_idx);
+ val = BIT(clkg->bit_idx);
+
+ if (clkg->write_en) {
+ mask |= BIT(clkg->bit_idx + 1);
+ val |= BIT(clkg->bit_idx + 1);
+ }
+
+ regmap_update_bits(clkg->clkr.regmap, clkg->gate_ofs, mask, val);
+
+ return 0;
+}
+
+static void clk_regmap_gate_disable(struct clk_hw *hw)
+{
+ struct clk_regmap_gate *clkg = to_clk_regmap_gate(hw);
+ unsigned int mask;
+ unsigned int val;
+
+ mask = BIT(clkg->bit_idx);
+ val = 0;
+
+ if (clkg->write_en) {
+ mask |= BIT(clkg->bit_idx + 1);
+ val |= BIT(clkg->bit_idx + 1);
+ }
+
+ regmap_update_bits(clkg->clkr.regmap, clkg->gate_ofs, mask, val);
+}
+
+static void clk_regmap_gate_disable_unused(struct clk_hw *hw)
+{
+ clk_regmap_gate_disable(hw);
+}
+
+static int clk_regmap_gate_is_enabled(struct clk_hw *hw)
+{
+ struct clk_regmap_gate *clkg = to_clk_regmap_gate(hw);
+ int ret;
+ u32 val;
+
+ regmap_read(clkg->clkr.regmap, clkg->gate_ofs, &val);
+ ret = val & BIT(clkg->bit_idx);
+ return !!ret;
+}
+
+const struct clk_ops clk_regmap_gate_ops = {
+ .enable = clk_regmap_gate_enable,
+ .disable = clk_regmap_gate_disable,
+ .is_enabled = clk_regmap_gate_is_enabled,
+ .disable_unused = clk_regmap_gate_disable_unused,
+};
+EXPORT_SYMBOL_GPL(clk_regmap_gate_ops);
+
+const struct clk_ops clk_regmap_gate_ro_ops = {
+ .is_enabled = clk_regmap_gate_is_enabled,
+};
+EXPORT_SYMBOL_GPL(clk_regmap_gate_ro_ops);
diff --git a/drivers/clk/realtek/clk-regmap-gate.h b/drivers/clk/realtek/clk-regmap-gate.h
new file mode 100644
index 000000000000..41cbe27865a7
--- /dev/null
+++ b/drivers/clk/realtek/clk-regmap-gate.h
@@ -0,0 +1,65 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2017 Realtek Semiconductor Corporation
+ * Author: Cheng-Yu Lee <cylee12@realtek.com>
+ */
+
+#ifndef __CLK_REALTEK_CLK_REGMAP_GATE_H
+#define __CLK_REALTEK_CLK_REGMAP_GATE_H
+
+#include "common.h"
+
+struct clk_regmap_gate {
+ struct clk_regmap clkr;
+ int gate_ofs;
+ u8 bit_idx;
+ u32 write_en : 1;
+};
+
+#define __clk_regmap_gate_hw(_p) __clk_regmap_hw(&(_p)->clkr)
+
+#define __CLK_REGMAP_GATE(_name, _parent, _ops, _flags, _ofs, _bit_idx, \
+ _write_en) \
+ struct clk_regmap_gate _name = { \
+ .clkr.hw.init = CLK_HW_INIT(#_name, _parent, _ops, _flags), \
+ .gate_ofs = _ofs, \
+ .bit_idx = _bit_idx, \
+ .write_en = _write_en, \
+ }
+
+#define CLK_REGMAP_GATE(_name, _parent, _flags, _ofs, _bit_idx, _write_en) \
+ __CLK_REGMAP_GATE(_name, _parent, &clk_regmap_gate_ops, _flags, _ofs, \
+ _bit_idx, _write_en)
+
+#define CLK_REGMAP_GATE_RO(_name, _parent, _flags, _ofs, _bit_idx, _write_en) \
+ __CLK_REGMAP_GATE(_name, _parent, &clk_regmap_gate_ro_ops, _flags, \
+ _ofs, _bit_idx, _write_en)
+
+#define __CLK_REGMAP_GATE_NO_PARENT(_name, _ops, _flags, _ofs, _bit_idx, \
+ _write_en) \
+ struct clk_regmap_gate _name = { \
+ .clkr.hw.init = CLK_HW_INIT_NO_PARENT(#_name, _ops, _flags), \
+ .gate_ofs = _ofs, \
+ .bit_idx = _bit_idx, \
+ .write_en = _write_en, \
+ }
+
+#define CLK_REGMAP_GATE_NO_PARENT(_name, _flags, _ofs, _bit_idx, _write_en) \
+ __CLK_REGMAP_GATE_NO_PARENT(_name, &clk_regmap_gate_ops, _flags, _ofs, \
+ _bit_idx, _write_en)
+
+#define CLK_REGMAP_GATE_NO_PARENT_RO(_name, _flags, _ofs, _bit_idx, _write_en) \
+ __CLK_REGMAP_GATE_NO_PARENT(_name, &clk_regmap_gate_ro_ops, _flags, \
+ _ofs, _bit_idx, _write_en)
+
+static inline struct clk_regmap_gate *to_clk_regmap_gate(struct clk_hw *hw)
+{
+ struct clk_regmap *clkr = to_clk_regmap(hw);
+
+ return container_of(clkr, struct clk_regmap_gate, clkr);
+}
+
+extern const struct clk_ops clk_regmap_gate_ops;
+extern const struct clk_ops clk_regmap_gate_ro_ops;
+
+#endif /* __CLK_REALTEK_CLK_REGMAP_GATE_H */
--
2.34.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 6/9] clk: realtek: Add support for mux clock
2025-12-29 7:53 [PATCH 0/9] clk: realtek: Add RTD1625 Clock Support Yu-Chun Lin
` (4 preceding siblings ...)
2025-12-29 7:53 ` [PATCH 5/9] clk: realtek: Add support for gate clock Yu-Chun Lin
@ 2025-12-29 7:53 ` Yu-Chun Lin
2026-01-05 12:04 ` Dan Carpenter
2025-12-29 7:53 ` [PATCH 7/9] clk: realtek: Add support for MMC-tuned PLL clocks Yu-Chun Lin
` (2 subsequent siblings)
8 siblings, 1 reply; 20+ messages in thread
From: Yu-Chun Lin @ 2025-12-29 7:53 UTC (permalink / raw)
To: mturquette, sboyd, robh, krzk+dt, conor+dt, p.zabel, cylee12,
jyanchou
Cc: devicetree, linux-clk, linux-kernel, james.tai, cy.huang,
stanley_chang, eleanor.lin
Add a simple regmap-based clk_ops implementation for Realtek mux clocks.
The implementation supports parent selection and rate determination through
regmap-backed register access.
Signed-off-by: Cheng-Yu Lee <cylee12@realtek.com>
Signed-off-by: Yu-Chun Lin <eleanor.lin@realtek.com>
---
drivers/clk/realtek/Makefile | 1 +
drivers/clk/realtek/clk-regmap-mux.c | 46 ++++++++++++++++++++++++++++
drivers/clk/realtek/clk-regmap-mux.h | 43 ++++++++++++++++++++++++++
3 files changed, 90 insertions(+)
create mode 100644 drivers/clk/realtek/clk-regmap-mux.c
create mode 100644 drivers/clk/realtek/clk-regmap-mux.h
diff --git a/drivers/clk/realtek/Makefile b/drivers/clk/realtek/Makefile
index 97058d48a176..b40dd5a26653 100644
--- a/drivers/clk/realtek/Makefile
+++ b/drivers/clk/realtek/Makefile
@@ -5,5 +5,6 @@ clk-rtk-y += common.o
clk-rtk-y += clk-pll.o
clk-rtk-y += clk-regmap-gate.o
+clk-rtk-y += clk-regmap-mux.o
clk-rtk-y += freq_table.o
clk-rtk-y += reset.o
diff --git a/drivers/clk/realtek/clk-regmap-mux.c b/drivers/clk/realtek/clk-regmap-mux.c
new file mode 100644
index 000000000000..10f677b3f26d
--- /dev/null
+++ b/drivers/clk/realtek/clk-regmap-mux.c
@@ -0,0 +1,46 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2017 Realtek Semiconductor Corporation
+ * Author: Cheng-Yu Lee <cylee12@realtek.com>
+ */
+
+#include "clk-regmap-mux.h"
+
+static u8 clk_regmap_mux_get_parent(struct clk_hw *hw)
+{
+ struct clk_regmap_mux *clkm = to_clk_regmap_mux(hw);
+ int num_parents = clk_hw_get_num_parents(hw);
+ u32 val;
+ int ret;
+
+ ret = regmap_read(clkm->clkr.regmap, clkm->mux_ofs, &val);
+ if (ret)
+ return ret;
+
+ val = val >> clkm->shift & clkm->mask;
+
+ if (val >= num_parents)
+ return -EINVAL;
+
+ return val;
+}
+
+static int clk_regmap_mux_set_parent(struct clk_hw *hw, u8 index)
+{
+ struct clk_regmap_mux *clkm = to_clk_regmap_mux(hw);
+
+ return regmap_update_bits(clkm->clkr.regmap, clkm->mux_ofs,
+ clkm->mask << clkm->shift, index << clkm->shift);
+}
+
+const struct clk_ops clk_regmap_mux_ops = {
+ .set_parent = clk_regmap_mux_set_parent,
+ .get_parent = clk_regmap_mux_get_parent,
+ .determine_rate = __clk_mux_determine_rate,
+};
+EXPORT_SYMBOL_GPL(clk_regmap_mux_ops);
+
+const struct clk_ops clk_regmap_mux_ro_ops = {
+ .get_parent = clk_regmap_mux_get_parent,
+};
+EXPORT_SYMBOL_GPL(clk_regmap_mux_ro_ops);
diff --git a/drivers/clk/realtek/clk-regmap-mux.h b/drivers/clk/realtek/clk-regmap-mux.h
new file mode 100644
index 000000000000..4855d4e94bc2
--- /dev/null
+++ b/drivers/clk/realtek/clk-regmap-mux.h
@@ -0,0 +1,43 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2017 Realtek Semiconductor Corporation
+ * Author: Cheng-Yu Lee <cylee12@realtek.com>
+ */
+
+#ifndef __CLK_REALTEK_CLK_REGMAP_MUX_H
+#define __CLK_REALTEK_CLK_REGMAP_MUX_H
+
+#include "common.h"
+
+struct clk_regmap_mux {
+ struct clk_regmap clkr;
+ int mux_ofs;
+ unsigned int mask;
+ unsigned int shift;
+};
+
+#define __clk_regmap_mux_hw(_p) __clk_regmap_hw(&(_p)->clkr)
+
+#define __CLK_REGMAP_MUX(_name, _parents, _ops, _flags, _ofs, _sft, _mask) \
+ struct clk_regmap_mux _name = { \
+ .clkr.hw.init = \
+ CLK_HW_INIT_PARENTS(#_name, _parents, _ops, _flags), \
+ .mux_ofs = _ofs, \
+ .shift = _sft, \
+ .mask = _mask, \
+ }
+
+#define CLK_REGMAP_MUX(_name, _parents, _flags, _ofs, _sft, _mask) \
+ __CLK_REGMAP_MUX(_name, _parents, &clk_regmap_mux_ops, _flags, _ofs, \
+ _sft, _mask)
+
+static inline struct clk_regmap_mux *to_clk_regmap_mux(struct clk_hw *hw)
+{
+ struct clk_regmap *clkr = to_clk_regmap(hw);
+
+ return container_of(clkr, struct clk_regmap_mux, clkr);
+}
+
+extern const struct clk_ops clk_regmap_mux_ops;
+
+#endif /* __CLK_REALTEK_CLK_REGMAP_MUX_H */
--
2.34.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 7/9] clk: realtek: Add support for MMC-tuned PLL clocks
2025-12-29 7:53 [PATCH 0/9] clk: realtek: Add RTD1625 Clock Support Yu-Chun Lin
` (5 preceding siblings ...)
2025-12-29 7:53 ` [PATCH 6/9] clk: realtek: Add support for mux clock Yu-Chun Lin
@ 2025-12-29 7:53 ` Yu-Chun Lin
2025-12-29 7:53 ` [PATCH 8/9] clk: realtek: Add RTD1625-CRT clock controller driver Yu-Chun Lin
2025-12-29 7:53 ` [PATCH 9/9] clk: realtek: Add RTD1625-ISO " Yu-Chun Lin
8 siblings, 0 replies; 20+ messages in thread
From: Yu-Chun Lin @ 2025-12-29 7:53 UTC (permalink / raw)
To: mturquette, sboyd, robh, krzk+dt, conor+dt, p.zabel, cylee12,
jyanchou
Cc: devicetree, linux-clk, linux-kernel, james.tai, cy.huang,
stanley_chang, eleanor.lin
Add clk_pll_mmc_ops for enable/disable, prepare, rate control, and status
operations on MMC PLL clocks.
Also add clk_pll_mmc_phase_ops to support phase get/set operations.
Signed-off-by: Cheng-Yu Lee <cylee12@realtek.com>
Signed-off-by: Jyan Chou <jyanchou@realtek.com>
Signed-off-by: Yu-Chun Lin <eleanor.lin@realtek.com>
---
MAINTAINERS | 8 +
drivers/clk/realtek/Kconfig | 4 +
drivers/clk/realtek/Makefile | 2 +
drivers/clk/realtek/clk-pll-mmc.c | 410 ++++++++++++++++++++++++++++++
drivers/clk/realtek/clk-pll.h | 21 ++
5 files changed, 445 insertions(+)
create mode 100644 drivers/clk/realtek/clk-pll-mmc.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 9cc78e867a4e..bc919a42c205 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -21977,6 +21977,14 @@ S: Supported
F: Documentation/devicetree/bindings/clock/realtek*
F: include/dt-bindings/clock/realtek*
+REALTEK SOC PLL CLOCK FOR MMC SUPPORT
+M: Cheng-Yu Lee <cylee12@realtek.com>
+M: Jyan Chou <jyanchou@realtek.com>
+M: Yu-Chun Lin <eleanor.lin@realtek.com>
+L: linux-clk@vger.kernel.org
+S: Supported
+F: drivers/clk/realtek/clk-pll-mmc.c
+
REALTEK SPI-NAND
M: Chris Packham <chris.packham@alliedtelesis.co.nz>
S: Maintained
diff --git a/drivers/clk/realtek/Kconfig b/drivers/clk/realtek/Kconfig
index 8577dce93ba6..de462c2bb892 100644
--- a/drivers/clk/realtek/Kconfig
+++ b/drivers/clk/realtek/Kconfig
@@ -24,4 +24,8 @@ config RTK_CLK_COMMON
This provides utility functions and data structures used by
multiple Realtek clock implementations, and include integration
with reset controllers where required.
+
+config RTK_CLK_PLL_MMC
+ bool
+
endif
diff --git a/drivers/clk/realtek/Makefile b/drivers/clk/realtek/Makefile
index b40dd5a26653..3d5c93e79dbd 100644
--- a/drivers/clk/realtek/Makefile
+++ b/drivers/clk/realtek/Makefile
@@ -8,3 +8,5 @@ clk-rtk-y += clk-regmap-gate.o
clk-rtk-y += clk-regmap-mux.o
clk-rtk-y += freq_table.o
clk-rtk-y += reset.o
+
+clk-rtk-$(CONFIG_RTK_CLK_PLL_MMC) += clk-pll-mmc.o
diff --git a/drivers/clk/realtek/clk-pll-mmc.c b/drivers/clk/realtek/clk-pll-mmc.c
new file mode 100644
index 000000000000..7beebf52b5bb
--- /dev/null
+++ b/drivers/clk/realtek/clk-pll-mmc.c
@@ -0,0 +1,410 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2021 Realtek Semiconductor Corporation
+ * Author: Cheng-Yu Lee <cylee12@realtek.com>
+ */
+
+#include "clk-pll.h"
+
+#define PLL_EMMC1_OFFSET 0x0
+#define PLL_EMMC2_OFFSET 0x4
+#define PLL_EMMC3_OFFSET 0x8
+#define PLL_EMMC4_OFFSET 0xc
+#define PLL_SSC_DIG_EMMC1_OFFSET 0x0
+#define PLL_SSC_DIG_EMMC3_OFFSET 0xc
+#define PLL_SSC_DIG_EMMC4_OFFSET 0x10
+
+#define PLL_PHRT0_MASK BIT(1)
+#define PLL_PHSEL_MASK GENMASK(4, 0)
+#define PLL_SSCPLL_RS_MASK GENMASK(12, 10)
+#define PLL_SSCPLL_ICP_MASK GENMASK(9, 5)
+#define PLL_SSC_DIV_EXT_F_MASK GENMASK(25, 13)
+#define PLL_PI_IBSELH_MASK GENMASK(28, 27)
+#define PLL_SSC_DIV_N_MASK GENMASK(23, 16)
+#define PLL_NCODE_SSC_EMMC_MASK GENMASK(20, 13)
+#define PLL_FCODE_SSC_EMMC_MASK GENMASK(12, 0)
+#define PLL_GRAN_EST_EM_MC_MASK GENMASK(20, 0)
+#define PLL_EN_SSC_EMMC_MASK BIT(0)
+#define PLL_FLAG_INITAL_EMMC_MASK BIT(1)
+
+#define PLL_PHRT0_SHIFT 1
+#define PLL_SSCPLL_RS_SHIFT 10
+#define PLL_SSCPLL_ICP_SHIFT 5
+#define PLL_SSC_DIV_EXT_F_SHIFT 13
+#define PLL_PI_IBSELH_SHIFT 27
+#define PLL_SSC_DIV_N_SHIFT 16
+#define PLL_NCODE_SSC_EMMC_SHIFT 13
+#define PLL_FLAG_INITAL_EMMC_SHIFT 8
+
+#define CYCLE_DEGREES 360
+#define PHASE_STEPS 32
+#define PHASE_SCALE_FACTOR 1125
+
+static inline int get_phrt0(struct clk_pll_mmc *clkm, u32 *val)
+{
+ u32 reg;
+ int ret;
+
+ ret = regmap_read(clkm->clkr.regmap, clkm->pll_ofs + PLL_EMMC1_OFFSET, ®);
+ if (ret)
+ return ret;
+
+ *val = (reg >> PLL_PHRT0_SHIFT) & PLL_PHRT0_MASK;
+ return 0;
+}
+
+static inline int set_phrt0(struct clk_pll_mmc *clkm, u32 val)
+{
+ return regmap_update_bits(clkm->clkr.regmap, clkm->pll_ofs + PLL_EMMC1_OFFSET,
+ PLL_PHRT0_MASK, val << PLL_PHRT0_SHIFT);
+}
+
+static inline int get_phsel(struct clk_pll_mmc *clkm, int id, u32 *val)
+{
+ int ret;
+ u32 raw_val;
+ u32 sft = id ? 8 : 3;
+
+ ret = regmap_read(clkm->clkr.regmap, clkm->pll_ofs + PLL_EMMC1_OFFSET, &raw_val);
+ if (ret)
+ return ret;
+
+ *val = (raw_val >> sft) & PLL_PHSEL_MASK;
+ return 0;
+}
+
+static inline int set_phsel(struct clk_pll_mmc *clkm, int id, u32 val)
+{
+ u32 sft = id ? 8 : 3;
+
+ return regmap_update_bits(clkm->clkr.regmap, clkm->pll_ofs + PLL_EMMC1_OFFSET,
+ PLL_PHSEL_MASK << sft, val << sft);
+}
+
+static inline int set_sscpll_rs(struct clk_pll_mmc *clkm, u32 val)
+{
+ return regmap_update_bits(clkm->clkr.regmap, clkm->pll_ofs + PLL_EMMC2_OFFSET,
+ PLL_SSCPLL_RS_MASK, val << PLL_SSCPLL_RS_SHIFT);
+}
+
+static inline int set_sscpll_icp(struct clk_pll_mmc *clkm, u32 val)
+{
+ return regmap_update_bits(clkm->clkr.regmap, clkm->pll_ofs + PLL_EMMC2_OFFSET,
+ PLL_SSCPLL_ICP_MASK, val << PLL_SSCPLL_ICP_SHIFT);
+}
+
+static inline int get_ssc_div_ext_f(struct clk_pll_mmc *clkm, u32 *val)
+{
+ u32 raw_val;
+ int ret;
+
+ ret = regmap_read(clkm->clkr.regmap, clkm->pll_ofs + PLL_EMMC2_OFFSET, &raw_val);
+ if (ret)
+ return ret;
+
+ *val = (raw_val & PLL_SSC_DIV_EXT_F_MASK) >> PLL_SSC_DIV_EXT_F_SHIFT;
+ return 0;
+}
+
+static inline int set_ssc_div_ext_f(struct clk_pll_mmc *clkm, u32 val)
+{
+ return regmap_update_bits(clkm->clkr.regmap, clkm->pll_ofs + PLL_EMMC2_OFFSET,
+ PLL_SSC_DIV_EXT_F_MASK,
+ val << PLL_SSC_DIV_EXT_F_SHIFT);
+}
+
+static inline int set_pi_ibselh(struct clk_pll_mmc *clkm, u32 val)
+{
+ return regmap_update_bits(clkm->clkr.regmap, clkm->pll_ofs + PLL_EMMC2_OFFSET,
+ PLL_PI_IBSELH_MASK, val << PLL_PI_IBSELH_SHIFT);
+}
+
+static inline int set_ssc_div_n(struct clk_pll_mmc *clkm, u32 val)
+{
+ return regmap_update_bits(clkm->clkr.regmap, clkm->pll_ofs + PLL_EMMC3_OFFSET,
+ PLL_SSC_DIV_N_MASK, val << PLL_SSC_DIV_N_SHIFT);
+}
+
+static inline int get_ssc_div_n(struct clk_pll_mmc *clkm, u32 *val)
+{
+ int ret;
+ u32 raw_val;
+
+ ret = regmap_read(clkm->clkr.regmap, clkm->pll_ofs + PLL_EMMC3_OFFSET, &raw_val);
+ if (ret)
+ return ret;
+
+ *val = (raw_val & PLL_SSC_DIV_N_MASK) >> PLL_SSC_DIV_N_SHIFT;
+ return 0;
+}
+
+static inline int set_pow_ctl(struct clk_pll_mmc *clkm, u32 val)
+{
+ return regmap_write(clkm->clkr.regmap, clkm->pll_ofs + PLL_EMMC4_OFFSET, val);
+}
+
+static inline int get_pow_ctl(struct clk_pll_mmc *clkm, u32 *val)
+{
+ int ret;
+ u32 raw_val;
+
+ ret = regmap_read(clkm->clkr.regmap, clkm->pll_ofs + PLL_EMMC4_OFFSET, &raw_val);
+
+ *val = raw_val;
+
+ return ret;
+}
+
+static int clk_pll_mmc_phase_set_phase(struct clk_hw *hw, int degrees)
+{
+ struct clk_hw *hwp = clk_hw_get_parent(hw);
+ struct clk_pll_mmc *clkm;
+ int phase_id;
+ u32 val;
+ int ret;
+
+ if (!hwp)
+ return -ENOENT;
+
+ clkm = to_clk_pll_mmc(hwp);
+ phase_id = (hw - &clkm->phase0_hw) ? 1 : 0;
+ val = DIV_ROUND_CLOSEST(degrees * 100, PHASE_SCALE_FACTOR);
+ ret = set_phsel(clkm, phase_id, val);
+ if (ret)
+ return ret;
+
+ usleep_range(10, 20);
+ return 0;
+}
+
+static int clk_pll_mmc_phase_get_phase(struct clk_hw *hw)
+{
+ struct clk_hw *hwp;
+ struct clk_pll_mmc *clkm;
+ int phase_id;
+ int ret;
+ u32 val;
+
+ hwp = clk_hw_get_parent(hw);
+ if (!hwp)
+ return -ENOENT;
+
+ clkm = to_clk_pll_mmc(hwp);
+ phase_id = (hw - &clkm->phase0_hw) ? 1 : 0;
+ ret = get_phsel(clkm, phase_id, &val);
+ if (ret)
+ return ret;
+
+ val = DIV_ROUND_CLOSEST(val * CYCLE_DEGREES, PHASE_STEPS);
+
+ return val;
+}
+
+const struct clk_ops clk_pll_mmc_phase_ops = {
+ .set_phase = clk_pll_mmc_phase_set_phase,
+ .get_phase = clk_pll_mmc_phase_get_phase,
+};
+EXPORT_SYMBOL_GPL(clk_pll_mmc_phase_ops);
+
+static int clk_pll_mmc_prepare(struct clk_hw *hw)
+{
+ struct clk_pll_mmc *clkm = to_clk_pll_mmc(hw);
+
+ return set_pow_ctl(clkm, 7);
+}
+
+static void clk_pll_mmc_unprepare(struct clk_hw *hw)
+{
+ struct clk_pll_mmc *clkm = to_clk_pll_mmc(hw);
+
+ set_pow_ctl(clkm, 0);
+}
+
+static int clk_pll_mmc_is_prepared(struct clk_hw *hw)
+{
+ struct clk_pll_mmc *clkm = to_clk_pll_mmc(hw);
+ u32 val;
+ int ret;
+
+ ret = get_pow_ctl(clkm, &val);
+ if (ret)
+ return 1;
+
+ return val != 0x0;
+}
+
+static void clk_pll_mmc_unprepare_unused(struct clk_hw *hw)
+{
+ /* This PLL has no unprepare_unused action */
+}
+
+static int clk_pll_mmc_enable(struct clk_hw *hw)
+{
+ struct clk_pll_mmc *clkm = to_clk_pll_mmc(hw);
+ int ret;
+
+ ret = set_phrt0(clkm, 1);
+ if (ret)
+ return ret;
+
+ udelay(10);
+ return 0;
+}
+
+static void clk_pll_mmc_disable(struct clk_hw *hw)
+{
+ struct clk_pll_mmc *clkm = to_clk_pll_mmc(hw);
+
+ set_phrt0(clkm, 0);
+ udelay(10);
+}
+
+static int clk_pll_mmc_is_enabled(struct clk_hw *hw)
+{
+ struct clk_pll_mmc *clkm = to_clk_pll_mmc(hw);
+ u32 val;
+ int ret;
+
+ ret = get_phrt0(clkm, &val);
+ if (ret)
+ return 1;
+
+ return val == 0x1;
+}
+
+static void clk_pll_mmc_disable_unused(struct clk_hw *hw)
+{
+ /* This PLL has no disable_unused action */
+}
+
+static unsigned long clk_pll_mmc_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
+{
+ struct clk_pll_mmc *clkm = to_clk_pll_mmc(hw);
+ u32 val, ext_f;
+ int ret;
+
+ ret = get_ssc_div_n(clkm, &val);
+ if (ret)
+ return ret;
+
+ ret = get_ssc_div_ext_f(clkm, &ext_f);
+ if (ret)
+ return ret;
+
+ return parent_rate / 4 * (val + 2) + (parent_rate / 4 * ext_f) / 8192;
+}
+
+static int clk_pll_mmc_determine_rate(struct clk_hw *hw, struct clk_rate_request *req)
+{
+ u32 val = DIV_ROUND_CLOSEST(req->rate * 4, req->best_parent_rate);
+
+ return req->best_parent_rate * val / 4;
+}
+
+static u32 eval_ssc_div_n(struct clk_pll_mmc *clkm, unsigned long rate)
+{
+ return 0x1b;
+}
+
+static int clk_pll_mmc_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate)
+{
+ struct clk_pll_mmc *clkm = to_clk_pll_mmc(hw);
+ u32 val = eval_ssc_div_n(clkm, rate);
+ int ret;
+
+ ret = regmap_update_bits(clkm->clkr.regmap,
+ clkm->ssc_dig_ofs + PLL_SSC_DIG_EMMC1_OFFSET,
+ PLL_FLAG_INITAL_EMMC_MASK, 0x0 << PLL_FLAG_INITAL_EMMC_SHIFT);
+ if (ret)
+ return ret;
+
+ ret = set_ssc_div_n(clkm, val);
+ if (ret)
+ return ret;
+
+ ret = set_ssc_div_ext_f(clkm, 1517);
+ if (ret)
+ return ret;
+
+ switch (val) {
+ case 31 ... 46:
+ ret |= set_pi_ibselh(clkm, 3);
+ ret |= set_sscpll_rs(clkm, 3);
+ ret |= set_sscpll_icp(clkm, 2);
+ break;
+ case 20 ... 30:
+ ret |= set_pi_ibselh(clkm, 2);
+ ret |= set_sscpll_rs(clkm, 3);
+ ret |= set_sscpll_icp(clkm, 1);
+ break;
+ case 10 ... 19:
+ ret |= set_pi_ibselh(clkm, 1);
+ ret |= set_sscpll_rs(clkm, 2);
+ ret |= set_sscpll_icp(clkm, 1);
+ break;
+ case 5 ... 9:
+ ret |= set_pi_ibselh(clkm, 0);
+ ret |= set_sscpll_rs(clkm, 2);
+ ret |= set_sscpll_icp(clkm, 0);
+ break;
+ }
+ if (ret)
+ return ret;
+
+ ret = regmap_update_bits(clkm->clkr.regmap,
+ clkm->ssc_dig_ofs + PLL_SSC_DIG_EMMC3_OFFSET,
+ PLL_NCODE_SSC_EMMC_MASK,
+ 27 << PLL_NCODE_SSC_EMMC_SHIFT);
+ if (ret)
+ return ret;
+
+ ret = regmap_update_bits(clkm->clkr.regmap,
+ clkm->ssc_dig_ofs + PLL_SSC_DIG_EMMC3_OFFSET,
+ PLL_FCODE_SSC_EMMC_MASK, 321);
+ if (ret)
+ return ret;
+
+ ret = regmap_update_bits(clkm->clkr.regmap,
+ clkm->ssc_dig_ofs + PLL_SSC_DIG_EMMC4_OFFSET,
+ PLL_GRAN_EST_EM_MC_MASK, 5985);
+ if (ret)
+ return ret;
+
+ ret = regmap_update_bits(clkm->clkr.regmap,
+ clkm->ssc_dig_ofs + PLL_SSC_DIG_EMMC1_OFFSET,
+ PLL_EN_SSC_EMMC_MASK, 0x1);
+ if (ret)
+ return ret;
+
+ ret = regmap_update_bits(clkm->clkr.regmap,
+ clkm->ssc_dig_ofs + PLL_SSC_DIG_EMMC1_OFFSET,
+ PLL_EN_SSC_EMMC_MASK, 0x0);
+ if (ret)
+ return ret;
+
+ ret = regmap_update_bits(clkm->clkr.regmap,
+ clkm->ssc_dig_ofs + PLL_SSC_DIG_EMMC1_OFFSET,
+ PLL_FLAG_INITAL_EMMC_MASK,
+ 0x1 << PLL_FLAG_INITAL_EMMC_SHIFT);
+ if (ret)
+ return ret;
+
+ usleep_range(10, 20);
+ return 0;
+}
+
+const struct clk_ops clk_pll_mmc_ops = {
+ .prepare = clk_pll_mmc_prepare,
+ .unprepare = clk_pll_mmc_unprepare,
+ .is_prepared = clk_pll_mmc_is_prepared,
+ .unprepare_unused = clk_pll_mmc_unprepare_unused,
+ .enable = clk_pll_mmc_enable,
+ .disable = clk_pll_mmc_disable,
+ .is_enabled = clk_pll_mmc_is_enabled,
+ .disable_unused = clk_pll_mmc_disable_unused,
+ .recalc_rate = clk_pll_mmc_recalc_rate,
+ .determine_rate = clk_pll_mmc_determine_rate,
+ .set_rate = clk_pll_mmc_set_rate,
+};
+EXPORT_SYMBOL_GPL(clk_pll_mmc_ops);
+MODULE_LICENSE("GPL");
diff --git a/drivers/clk/realtek/clk-pll.h b/drivers/clk/realtek/clk-pll.h
index c3e2e5ca641f..90c47279410b 100644
--- a/drivers/clk/realtek/clk-pll.h
+++ b/drivers/clk/realtek/clk-pll.h
@@ -44,4 +44,25 @@ static inline struct clk_pll *to_clk_pll(struct clk_hw *hw)
extern const struct clk_ops clk_pll_ops;
extern const struct clk_ops clk_pll_ro_ops;
+struct clk_pll_mmc {
+ struct clk_regmap clkr;
+ int pll_ofs;
+ int ssc_dig_ofs;
+ struct clk_hw phase0_hw;
+ struct clk_hw phase1_hw;
+ u32 set_rate_val_53_97_set_ipc: 1;
+};
+
+#define __clk_pll_mmc_hw(_ptr) __clk_regmap_hw(&(_ptr)->clkr)
+
+static inline struct clk_pll_mmc *to_clk_pll_mmc(struct clk_hw *hw)
+{
+ struct clk_regmap *clkr = to_clk_regmap(hw);
+
+ return container_of(clkr, struct clk_pll_mmc, clkr);
+}
+
+extern const struct clk_ops clk_pll_mmc_ops;
+extern const struct clk_ops clk_pll_mmc_phase_ops;
+
#endif /* __CLK_REALTEK_CLK_PLL_H */
--
2.34.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 8/9] clk: realtek: Add RTD1625-CRT clock controller driver
2025-12-29 7:53 [PATCH 0/9] clk: realtek: Add RTD1625 Clock Support Yu-Chun Lin
` (6 preceding siblings ...)
2025-12-29 7:53 ` [PATCH 7/9] clk: realtek: Add support for MMC-tuned PLL clocks Yu-Chun Lin
@ 2025-12-29 7:53 ` Yu-Chun Lin
2025-12-30 12:15 ` Krzysztof Kozlowski
2025-12-29 7:53 ` [PATCH 9/9] clk: realtek: Add RTD1625-ISO " Yu-Chun Lin
8 siblings, 1 reply; 20+ messages in thread
From: Yu-Chun Lin @ 2025-12-29 7:53 UTC (permalink / raw)
To: mturquette, sboyd, robh, krzk+dt, conor+dt, p.zabel, cylee12,
jyanchou
Cc: devicetree, linux-clk, linux-kernel, james.tai, cy.huang,
stanley_chang, eleanor.lin
Add support for the CRT (Clock, Reset, and Test) controller on the Realtek
RTD1625 SoC. This driver provides clock and reset management for the
system, allowing peripheral clients to request necessary resources for
operation.
Signed-off-by: Cheng-Yu Lee <cylee12@realtek.com>
Signed-off-by: Yu-Chun Lin <eleanor.lin@realtek.com>
---
drivers/clk/realtek/Kconfig | 13 +
drivers/clk/realtek/Makefile | 1 +
drivers/clk/realtek/clk-rtd1625-crt.c | 788 ++++++++++++++++++++++++++
3 files changed, 802 insertions(+)
create mode 100644 drivers/clk/realtek/clk-rtd1625-crt.c
diff --git a/drivers/clk/realtek/Kconfig b/drivers/clk/realtek/Kconfig
index de462c2bb892..9ac7f9a5d8f2 100644
--- a/drivers/clk/realtek/Kconfig
+++ b/drivers/clk/realtek/Kconfig
@@ -28,4 +28,17 @@ config RTK_CLK_COMMON
config RTK_CLK_PLL_MMC
bool
+config COMMON_CLK_RTD1625
+ tristate "RTD1625 Clock Controller"
+ select RTK_CLK_COMMON
+ select RTK_CLK_PLL_MMC
+ default y
+ help
+ Support for the clock controller on Realtek RTD1625 SoCs.
+
+ This driver provides clock sources, gating, multiplexing, and
+ reset control for peripherals on the RTD1625 platform.
+
+ Say Y here if your system is based on the RTD1625 and you need
+ its peripheral devices to function.
endif
diff --git a/drivers/clk/realtek/Makefile b/drivers/clk/realtek/Makefile
index 3d5c93e79dbd..3cda1e600172 100644
--- a/drivers/clk/realtek/Makefile
+++ b/drivers/clk/realtek/Makefile
@@ -10,3 +10,4 @@ clk-rtk-y += freq_table.o
clk-rtk-y += reset.o
clk-rtk-$(CONFIG_RTK_CLK_PLL_MMC) += clk-pll-mmc.o
+obj-$(CONFIG_COMMON_CLK_RTD1625) += clk-rtd1625-crt.o
diff --git a/drivers/clk/realtek/clk-rtd1625-crt.c b/drivers/clk/realtek/clk-rtd1625-crt.c
new file mode 100644
index 000000000000..bd7f7ffec1ac
--- /dev/null
+++ b/drivers/clk/realtek/clk-rtd1625-crt.c
@@ -0,0 +1,788 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2022 Realtek Semiconductor Corporation
+ * Author: Cheng-Yu Lee <cylee12@realtek.com>
+ */
+
+#include <linux/platform_device.h>
+#include <dt-bindings/clock/realtek,rtd1625-clk.h>
+#include "clk-pll.h"
+#include "clk-regmap-gate.h"
+#include "clk-regmap-mux.h"
+
+#define RTD1625_REG_PLL_ACPU1 0x10c
+#define RTD1625_REG_PLL_ACPU2 0x110
+#define RTD1625_REG_PLL_SSC_DIG_ACPU0 0x5c0
+#define RTD1625_REG_PLL_SSC_DIG_ACPU1 0x5c4
+#define RTD1625_REG_PLL_SSC_DIG_ACPU2 0x5c8
+#define RTD1625_REG_PLL_SSC_DIG_ACPU_DBG2 0x5dc
+
+#define RTD1625_REG_PLL_VE1_1 0x114
+#define RTD1625_REG_PLL_VE1_2 0x118
+#define RTD1625_REG_PLL_SSC_DIG_VE1_0 0x580
+#define RTD1625_REG_PLL_SSC_DIG_VE1_1 0x584
+#define RTD1625_REG_PLL_SSC_DIG_VE1_2 0x588
+#define RTD1625_REG_PLL_SSC_DIG_VE1_DBG2 0x59c
+
+#define RTD1625_REG_PLL_GPU1 0x1c0
+#define RTD1625_REG_PLL_GPU2 0x1c4
+#define RTD1625_REG_PLL_SSC_DIG_GPU0 0x5a0
+#define RTD1625_REG_PLL_SSC_DIG_GPU1 0x5a4
+#define RTD1625_REG_PLL_SSC_DIG_GPU2 0x5a8
+#define RTD1625_REG_PLL_SSC_DIG_GPU_DBG2 0x5bc
+
+#define RTD1625_REG_PLL_NPU1 0x1c8
+#define RTD1625_REG_PLL_NPU2 0x1cc
+#define RTD1625_REG_PLL_SSC_DIG_NPU0 0x800
+#define RTD1625_REG_PLL_SSC_DIG_NPU1 0x804
+#define RTD1625_REG_PLL_SSC_DIG_NPU2 0x808
+#define RTD1625_REG_PLL_SSC_DIG_NPU_DBG2 0x81c
+
+#define RTD1625_REG_PLL_VE2_1 0x1d0
+#define RTD1625_REG_PLL_VE2_2 0x1d4
+#define RTD1625_REG_PLL_SSC_DIG_VE2_0 0x5e0
+#define RTD1625_REG_PLL_SSC_DIG_VE2_1 0x5e4
+#define RTD1625_REG_PLL_SSC_DIG_VE2_2 0x5e8
+#define RTD1625_REG_PLL_SSC_DIG_VE2_DBG2 0x5fc
+
+#define RTD1625_REG_PLL_HIFI1 0x1d8
+#define RTD1625_REG_PLL_HIFI2 0x1dc
+#define RTD1625_REG_PLL_SSC_DIG_HIFI0 0x6e0
+#define RTD1625_REG_PLL_SSC_DIG_HIFI1 0x6e4
+#define RTD1625_REG_PLL_SSC_DIG_HIFI2 0x6e8
+#define RTD1625_REG_PLL_SSC_DIG_HIFI_DBG2 0x6fc
+
+#define RTD1625_REG_PLL_BUS1 0x524
+
+#define RTD1625_REG_PLL_SSC_DIG_DDSA1 0x564
+
+#define RTD1625_REG_PLL_SSC_DIG_DCSB1 0x544
+
+static const char * const clk_gpu_parents[] = { "pll_gpu", "clk_sys" };
+static CLK_REGMAP_MUX(clk_gpu, clk_gpu_parents, CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
+ 0x28, 12, 0x1);
+static const char * const clk_ve_parents[] = { "pll_vo", "clk_sysh", "pll_ve1", "pll_ve2" };
+static CLK_REGMAP_MUX(clk_ve1, clk_ve_parents, CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
+ 0x4c, 0, 0x3);
+static CLK_REGMAP_MUX(clk_ve2, clk_ve_parents, CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
+ 0x4c, 3, 0x3);
+static CLK_REGMAP_MUX(clk_ve4, clk_ve_parents, CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
+ 0x4c, 6, 0x3);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_misc, CLK_IS_CRITICAL, 0x50, 0, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_pcie0, CLK_IGNORE_UNUSED, 0x50, 2, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_gspi, CLK_IGNORE_UNUSED, 0x50, 6, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_iso_misc, CLK_IGNORE_UNUSED, 0x50, 10, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_sds, CLK_IGNORE_UNUSED, 0x50, 12, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_hdmi, CLK_IGNORE_UNUSED, 0x50, 14, 1);
+static CLK_REGMAP_GATE(clk_en_gpu, "clk_gpu", CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, 0x50, 18, 1);
+static CLK_REGMAP_GATE(clk_en_ve1, "clk_ve1", CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, 0x50, 20, 1);
+static CLK_REGMAP_GATE(clk_en_ve2, "clk_ve2", CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, 0x50, 22, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_se, CLK_IGNORE_UNUSED, 0x50, 30, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_md, CLK_IGNORE_UNUSED, 0x54, 4, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_tp, CLK_IS_CRITICAL, 0x54, 6, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_rcic, CLK_IGNORE_UNUSED, 0x54, 8, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_nf, CLK_IGNORE_UNUSED, 0x54, 10, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_emmc, CLK_IGNORE_UNUSED, 0x54, 12, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_sd, CLK_IGNORE_UNUSED, 0x54, 14, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_sdio_ip, CLK_IGNORE_UNUSED, 0x54, 16, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_mipi_csi, CLK_IGNORE_UNUSED, 0x54, 18, 1);
+static CLK_REGMAP_GATE(clk_en_emmc_ip, "pll_emmc", CLK_SET_RATE_PARENT, 0x54, 20, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_sdio, CLK_IGNORE_UNUSED, 0x54, 22, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_sd_ip, CLK_IGNORE_UNUSED, 0x54, 24, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_tpb, CLK_IGNORE_UNUSED, 0x54, 28, 1);
+static CLK_REGMAP_GATE(clk_en_misc_sc1, "clk_en_misc", CLK_IGNORE_UNUSED, 0x54, 30, 1);
+static CLK_REGMAP_GATE(clk_en_misc_i2c_3, "clk_en_misc", CLK_IGNORE_UNUSED, 0x58, 0, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_jpeg, CLK_IGNORE_UNUSED, 0x58, 4, 1);
+static CLK_REGMAP_GATE(clk_en_acpu, "pll_acpu", CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
+ 0x58, 6, 1);
+static CLK_REGMAP_GATE(clk_en_misc_sc0, "clk_en_misc", CLK_IGNORE_UNUSED, 0x58, 10, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_hdmirx, CLK_IGNORE_UNUSED, 0x58, 26, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_hse, CLK_IS_CRITICAL, 0x58, 28, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_fan, CLK_IGNORE_UNUSED, 0x5c, 2, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_sata_wrap_sys, CLK_IGNORE_UNUSED, 0x5c, 8, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_sata_wrap_sysh, CLK_IGNORE_UNUSED, 0x5c, 10, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_sata_mac_sysh, CLK_IGNORE_UNUSED, 0x5c, 12, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_r2rdsc, CLK_IGNORE_UNUSED, 0x5c, 14, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_pcie1, CLK_IGNORE_UNUSED, 0x5c, 18, 1);
+static CLK_REGMAP_GATE(clk_en_misc_i2c_4, "clk_en_misc", CLK_IGNORE_UNUSED, 0x5c, 20, 1);
+static CLK_REGMAP_GATE(clk_en_misc_i2c_5, "clk_en_misc", CLK_IGNORE_UNUSED, 0x5c, 22, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_tsio, CLK_IGNORE_UNUSED, 0x5c, 24, 1);
+static CLK_REGMAP_GATE(clk_en_ve4, "clk_ve4", CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
+ 0x5c, 26, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_edp, CLK_IGNORE_UNUSED, 0x5c, 28, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_tsio_trx, CLK_IGNORE_UNUSED, 0x5c, 30, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_pcie2, CLK_IGNORE_UNUSED, 0x8c, 0, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_earc, CLK_IGNORE_UNUSED, 0x8c, 4, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_lite, CLK_IGNORE_UNUSED, 0x8c, 6, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_mipi_dsi, CLK_IGNORE_UNUSED, 0x8c, 8, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_npupp, CLK_IGNORE_UNUSED, 0x8c, 10, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_npu, CLK_IGNORE_UNUSED, 0x8c, 12, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_aucpu0, CLK_IGNORE_UNUSED, 0x8c, 14, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_aucpu1, CLK_IGNORE_UNUSED, 0x8c, 16, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_nsram, CLK_IGNORE_UNUSED, 0x8c, 18, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_hdmitop, CLK_IGNORE_UNUSED, 0x8c, 20, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_aucpu_iso_npu, CLK_IGNORE_UNUSED, 0x8c, 24, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_keyladder, CLK_IGNORE_UNUSED, 0x8c, 26, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_ifcp_klm, CLK_IGNORE_UNUSED, 0x8c, 28, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_ifcp, CLK_IGNORE_UNUSED, 0x8c, 30, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_mdl_genpw, CLK_IGNORE_UNUSED, 0xb0, 0, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_mdl_chip, CLK_IGNORE_UNUSED, 0xb0, 2, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_mdl_ip, CLK_IGNORE_UNUSED, 0xb0, 4, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_mdlm2m, CLK_IGNORE_UNUSED, 0xb0, 6, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_mdl_xtal, CLK_IGNORE_UNUSED, 0xb0, 8, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_test_mux, CLK_IGNORE_UNUSED, 0xb0, 10, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_dla, CLK_IGNORE_UNUSED, 0xb0, 12, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_tpcw, CLK_IGNORE_UNUSED, 0xb0, 16, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_gpu_ts_src, CLK_IGNORE_UNUSED, 0xb0, 18, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_vi, CLK_IGNORE_UNUSED, 0xb0, 22, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_lvds1, CLK_IGNORE_UNUSED, 0xb0, 24, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_lvds2, CLK_IGNORE_UNUSED, 0xb0, 26, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_aucpu, CLK_IGNORE_UNUSED, 0xb0, 28, 1);
+static CLK_REGMAP_GATE(clk_en_ur1, "clk_en_ur_top", CLK_IGNORE_UNUSED, 0x884, 0, 1);
+static CLK_REGMAP_GATE(clk_en_ur2, "clk_en_ur_top", CLK_IGNORE_UNUSED, 0x884, 2, 1);
+static CLK_REGMAP_GATE(clk_en_ur3, "clk_en_ur_top", CLK_IGNORE_UNUSED, 0x884, 4, 1);
+static CLK_REGMAP_GATE(clk_en_ur4, "clk_en_ur_top", CLK_IGNORE_UNUSED, 0x884, 6, 1);
+static CLK_REGMAP_GATE(clk_en_ur5, "clk_en_ur_top", CLK_IGNORE_UNUSED, 0x884, 8, 1);
+static CLK_REGMAP_GATE(clk_en_ur6, "clk_en_ur_top", CLK_IGNORE_UNUSED, 0x884, 10, 1);
+static CLK_REGMAP_GATE(clk_en_ur7, "clk_en_ur_top", CLK_IGNORE_UNUSED, 0x884, 12, 1);
+static CLK_REGMAP_GATE(clk_en_ur8, "clk_en_ur_top", CLK_IGNORE_UNUSED, 0x884, 14, 1);
+static CLK_REGMAP_GATE(clk_en_ur9, "clk_en_ur_top", CLK_IGNORE_UNUSED, 0x884, 16, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_ur_top, CLK_IS_CRITICAL, 0x884, 18, 1);
+static CLK_REGMAP_GATE(clk_en_misc_i2c_7, "clk_en_misc", CLK_IGNORE_UNUSED, 0x884, 28, 1);
+static CLK_REGMAP_GATE(clk_en_misc_i2c_6, "clk_en_misc", CLK_IGNORE_UNUSED, 0x884, 30, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_spi0, CLK_IGNORE_UNUSED, 0x894, 0, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_spi1, CLK_IGNORE_UNUSED, 0x894, 2, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_spi2, CLK_IGNORE_UNUSED, 0x894, 4, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_lsadc0, CLK_IGNORE_UNUSED, 0x894, 16, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_lsadc1, CLK_IGNORE_UNUSED, 0x894, 18, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_isomis_dma, CLK_IGNORE_UNUSED, 0x894, 20, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_dptx, CLK_IGNORE_UNUSED, 0x894, 24, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_npu_mipi_csi, CLK_IGNORE_UNUSED, 0x894, 26, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_edptx, CLK_IGNORE_UNUSED, 0x894, 28, 1);
+
+#define FREQ_NF_MASK (0x7ffff)
+#define FREQ_NF(_r, _nf) { .rate = _r, .val = (_nf), }
+
+static const struct freq_table acpu_tbl[] = {
+ FREQ_NF(513000000, 0x11000),
+ FREQ_TABLE_END
+};
+
+static const struct freq_table ve_tbl[] = {
+ FREQ_NF(553500000, 0x12800),
+ FREQ_NF(661500000, 0x16800),
+ FREQ_NF(688500000, 0x17800),
+ FREQ_TABLE_END
+};
+
+static const struct freq_table bus_tbl[] = {
+ FREQ_NF(513000000, 0x11000),
+ FREQ_NF(540000000, 0x12000),
+ FREQ_NF(553500000, 0x12800),
+ FREQ_TABLE_END
+};
+
+static const struct freq_table ddsa_tbl[] = {
+ FREQ_NF(432000000, 0xe000),
+ FREQ_TABLE_END
+};
+
+static const struct freq_table gpu_tbl[] = {
+ FREQ_NF(405000000, 0xd000),
+ FREQ_NF(540000000, 0x12000),
+ FREQ_NF(661500000, 0x16800),
+ FREQ_NF(729000000, 0x19000),
+ FREQ_NF(810000000, 0x1c000),
+ FREQ_NF(850500000, 0x1d800),
+ FREQ_TABLE_END
+};
+
+static const struct freq_table hifi_tbl[] = {
+ FREQ_NF(756000000, 0x1a000),
+ FREQ_NF(810000000, 0x1c000),
+ FREQ_TABLE_END
+};
+
+static const struct freq_table npu_tbl[] = {
+ FREQ_NF(661500000, 0x16800),
+ FREQ_NF(729000000, 0x19000),
+ FREQ_NF(810000000, 0x1c000),
+ FREQ_TABLE_END
+};
+
+static const struct reg_sequence pll_acpu_seq_power_on[] = {
+ {RTD1625_REG_PLL_ACPU2, 0x5},
+ {RTD1625_REG_PLL_ACPU2, 0x7},
+ {RTD1625_REG_PLL_ACPU1, 0x54000},
+ {RTD1625_REG_PLL_SSC_DIG_ACPU2, 0x1e1f8e},
+ {RTD1625_REG_PLL_SSC_DIG_ACPU0, 0x4},
+ {RTD1625_REG_PLL_SSC_DIG_ACPU0, 0x5, 200},
+ {RTD1625_REG_PLL_ACPU2, 0x3},
+};
+
+static const struct reg_sequence pll_acpu_seq_power_off[] = {
+ {RTD1625_REG_PLL_ACPU2, 0x4},
+};
+
+static const struct reg_sequence pll_acpu_seq_pre_set_freq[] = {
+ {RTD1625_REG_PLL_SSC_DIG_ACPU0, 0x4},
+};
+
+static const struct reg_sequence pll_acpu_seq_post_set_freq[] = {
+ {RTD1625_REG_PLL_SSC_DIG_ACPU0, 0x5},
+};
+
+static struct clk_pll pll_acpu = {
+ .clkr.hw.init = CLK_HW_INIT("pll_acpu", "osc27m", &clk_pll_ops,
+ CLK_GET_RATE_NOCACHE | CLK_IGNORE_UNUSED),
+ .seq_power_on = pll_acpu_seq_power_on,
+ .num_seq_power_on = ARRAY_SIZE(pll_acpu_seq_power_on),
+ .seq_power_off = pll_acpu_seq_power_off,
+ .num_seq_power_off = ARRAY_SIZE(pll_acpu_seq_power_off),
+ .seq_pre_set_freq = pll_acpu_seq_pre_set_freq,
+ .num_seq_pre_set_freq = ARRAY_SIZE(pll_acpu_seq_pre_set_freq),
+ .seq_post_set_freq = pll_acpu_seq_post_set_freq,
+ .num_seq_post_set_freq = ARRAY_SIZE(pll_acpu_seq_post_set_freq),
+ .freq_reg = RTD1625_REG_PLL_SSC_DIG_ACPU1,
+ .freq_tbl = acpu_tbl,
+ .freq_mask = FREQ_NF_MASK,
+ .freq_ready_reg = RTD1625_REG_PLL_SSC_DIG_ACPU_DBG2,
+ .freq_ready_mask = BIT(20),
+ .freq_ready_val = BIT(20),
+ .power_reg = RTD1625_REG_PLL_ACPU2,
+ .power_mask = 0x7,
+ .power_val_on = 0x3,
+};
+
+static const struct reg_sequence pll_ve1_seq_power_on[] = {
+ {RTD1625_REG_PLL_VE1_2, 0x5},
+ {RTD1625_REG_PLL_VE1_2, 0x7},
+ {RTD1625_REG_PLL_VE1_1, 0x54000},
+ {RTD1625_REG_PLL_SSC_DIG_VE1_0, 0x4},
+ {RTD1625_REG_PLL_SSC_DIG_VE1_0, 0x5, 200},
+ {RTD1625_REG_PLL_VE1_2, 0x3},
+};
+
+static const struct reg_sequence pll_ve1_seq_power_off[] = {
+ {RTD1625_REG_PLL_VE1_2, 0x4},
+};
+
+static const struct reg_sequence pll_ve1_seq_pre_set_freq[] = {
+ {RTD1625_REG_PLL_SSC_DIG_VE1_0, 0x4},
+};
+
+static const struct reg_sequence pll_ve1_seq_post_set_freq[] = {
+ {RTD1625_REG_PLL_SSC_DIG_VE1_0, 0x5},
+};
+
+static struct clk_pll pll_ve1 = {
+ .clkr.hw.init = CLK_HW_INIT("pll_ve1", "osc27m", &clk_pll_ops,
+ CLK_GET_RATE_NOCACHE),
+ .seq_power_on = pll_ve1_seq_power_on,
+ .num_seq_power_on = ARRAY_SIZE(pll_ve1_seq_power_on),
+ .seq_power_off = pll_ve1_seq_power_off,
+ .num_seq_power_off = ARRAY_SIZE(pll_ve1_seq_power_off),
+ .seq_pre_set_freq = pll_ve1_seq_pre_set_freq,
+ .num_seq_pre_set_freq = ARRAY_SIZE(pll_ve1_seq_pre_set_freq),
+ .seq_post_set_freq = pll_ve1_seq_post_set_freq,
+ .num_seq_post_set_freq = ARRAY_SIZE(pll_ve1_seq_post_set_freq),
+ .freq_reg = RTD1625_REG_PLL_SSC_DIG_VE1_1,
+ .freq_tbl = ve_tbl,
+ .freq_mask = FREQ_NF_MASK,
+ .freq_ready_reg = RTD1625_REG_PLL_SSC_DIG_VE1_DBG2,
+ .freq_ready_mask = BIT(20),
+ .freq_ready_val = BIT(20),
+ .power_reg = RTD1625_REG_PLL_VE1_2,
+ .power_mask = 0x7,
+ .power_val_on = 0x3,
+};
+
+static struct clk_pll pll_ddsa = {
+ .clkr.hw.init = CLK_HW_INIT("pll_ddsa", "osc27m", &clk_pll_ro_ops, CLK_GET_RATE_NOCACHE),
+ .freq_reg = RTD1625_REG_PLL_SSC_DIG_DDSA1,
+ .freq_tbl = ddsa_tbl,
+ .freq_mask = FREQ_NF_MASK,
+};
+
+static struct clk_pll pll_bus = {
+ .clkr.hw.init = CLK_HW_INIT("pll_bus", "osc27m", &clk_pll_ro_ops, CLK_GET_RATE_NOCACHE),
+ .freq_reg = RTD1625_REG_PLL_BUS1,
+ .freq_tbl = bus_tbl,
+ .freq_mask = FREQ_NF_MASK,
+};
+
+static CLK_FIXED_FACTOR(clk_sys, "clk_sys", "pll_bus", 2, 1, 0);
+
+static struct clk_pll pll_dcsb = {
+ .clkr.hw.init = CLK_HW_INIT("pll_dcsb", "osc27m", &clk_pll_ro_ops, CLK_GET_RATE_NOCACHE),
+ .freq_reg = RTD1625_REG_PLL_SSC_DIG_DCSB1,
+ .freq_tbl = bus_tbl,
+ .freq_mask = FREQ_NF_MASK,
+};
+
+static CLK_FIXED_FACTOR(clk_sysh, "clk_sysh", "pll_dcsb", 1, 1, 0);
+
+static const struct reg_sequence pll_gpu_seq_power_on[] = {
+ {RTD1625_REG_PLL_GPU2, 0x5},
+ {RTD1625_REG_PLL_GPU2, 0x7},
+ {RTD1625_REG_PLL_GPU1, 0x54000},
+ {RTD1625_REG_PLL_SSC_DIG_GPU0, 0x4},
+ {RTD1625_REG_PLL_SSC_DIG_GPU0, 0x5, 200},
+ {RTD1625_REG_PLL_GPU2, 0x3},
+};
+
+static const struct reg_sequence pll_gpu_seq_power_off[] = {
+ {RTD1625_REG_PLL_GPU2, 0x4},
+};
+
+static const struct reg_sequence pll_gpu_seq_pre_set_freq[] = {
+ {RTD1625_REG_PLL_SSC_DIG_GPU0, 0x4},
+};
+
+static const struct reg_sequence pll_gpu_seq_post_set_freq[] = {
+ {RTD1625_REG_PLL_SSC_DIG_GPU0, 0x5},
+};
+
+static struct clk_pll pll_gpu = {
+ .clkr.hw.init = CLK_HW_INIT("pll_gpu", "osc27m", &clk_pll_ops, CLK_GET_RATE_NOCACHE),
+ .seq_power_on = pll_gpu_seq_power_on,
+ .num_seq_power_on = ARRAY_SIZE(pll_gpu_seq_power_on),
+ .seq_power_off = pll_gpu_seq_power_off,
+ .num_seq_power_off = ARRAY_SIZE(pll_gpu_seq_power_off),
+ .seq_pre_set_freq = pll_gpu_seq_pre_set_freq,
+ .num_seq_pre_set_freq = ARRAY_SIZE(pll_gpu_seq_pre_set_freq),
+ .seq_post_set_freq = pll_gpu_seq_post_set_freq,
+ .num_seq_post_set_freq = ARRAY_SIZE(pll_gpu_seq_post_set_freq),
+ .freq_reg = RTD1625_REG_PLL_SSC_DIG_GPU1,
+ .freq_tbl = gpu_tbl,
+ .freq_mask = FREQ_NF_MASK,
+ .freq_ready_reg = RTD1625_REG_PLL_SSC_DIG_GPU_DBG2,
+ .freq_ready_mask = BIT(20),
+ .freq_ready_val = BIT(20),
+ .power_reg = RTD1625_REG_PLL_GPU2,
+ .power_mask = 0x7,
+ .power_val_on = 0x3,
+};
+
+static const struct reg_sequence pll_npu_seq_power_on[] = {
+ {RTD1625_REG_PLL_NPU2, 0x5},
+ {RTD1625_REG_PLL_NPU2, 0x7},
+ {RTD1625_REG_PLL_NPU1, 0x54000},
+ {RTD1625_REG_PLL_SSC_DIG_NPU0, 0x4},
+ {RTD1625_REG_PLL_SSC_DIG_NPU0, 0x5, 200},
+ {RTD1625_REG_PLL_NPU2, 0x3},
+};
+
+static const struct reg_sequence pll_npu_seq_power_off[] = {
+ {RTD1625_REG_PLL_NPU2, 0x4},
+ {RTD1625_REG_PLL_NPU1, 0x54010},
+};
+
+static const struct reg_sequence pll_npu_seq_pre_set_freq[] = {
+ {RTD1625_REG_PLL_SSC_DIG_NPU0, 0x4},
+};
+
+static const struct reg_sequence pll_npu_seq_post_set_freq[] = {
+ {RTD1625_REG_PLL_SSC_DIG_NPU0, 0x5},
+};
+
+static struct clk_pll pll_npu = {
+ .clkr.hw.init = CLK_HW_INIT("pll_npu", "osc27m", &clk_pll_ops,
+ CLK_GET_RATE_NOCACHE | CLK_IGNORE_UNUSED),
+ .seq_power_on = pll_npu_seq_power_on,
+ .num_seq_power_on = ARRAY_SIZE(pll_npu_seq_power_on),
+ .seq_power_off = pll_npu_seq_power_off,
+ .num_seq_power_off = ARRAY_SIZE(pll_npu_seq_power_off),
+ .seq_pre_set_freq = pll_npu_seq_pre_set_freq,
+ .num_seq_pre_set_freq = ARRAY_SIZE(pll_npu_seq_pre_set_freq),
+ .seq_post_set_freq = pll_npu_seq_post_set_freq,
+ .num_seq_post_set_freq = ARRAY_SIZE(pll_npu_seq_post_set_freq),
+ .freq_reg = RTD1625_REG_PLL_SSC_DIG_NPU1,
+ .freq_tbl = npu_tbl,
+ .freq_mask = FREQ_NF_MASK,
+ .freq_ready_reg = RTD1625_REG_PLL_SSC_DIG_NPU_DBG2,
+ .freq_ready_mask = BIT(20),
+ .freq_ready_val = BIT(20),
+ .power_reg = RTD1625_REG_PLL_NPU2,
+ .power_mask = 0x7,
+ .power_val_on = 0x3,
+};
+
+static CLK_FIXED_FACTOR(clk_npu, "clk_npu", "pll_npu", 1, 1, CLK_SET_RATE_PARENT);
+static CLK_FIXED_FACTOR(clk_npu_mipi_csi, "clk_npu_mipi_csi", "pll_npu", 1, 1, CLK_SET_RATE_PARENT);
+
+static const struct reg_sequence pll_ve2_seq_power_on[] = {
+ {RTD1625_REG_PLL_VE2_2, 0x5},
+ {RTD1625_REG_PLL_VE2_2, 0x7},
+ {RTD1625_REG_PLL_VE2_1, 0x54000},
+ {RTD1625_REG_PLL_SSC_DIG_VE2_0, 0x4},
+ {RTD1625_REG_PLL_SSC_DIG_VE2_0, 0x5, 200},
+ {RTD1625_REG_PLL_VE2_2, 0x3},
+};
+
+static const struct reg_sequence pll_ve2_seq_power_off[] = {
+ {RTD1625_REG_PLL_VE2_2, 0x4},
+};
+
+static const struct reg_sequence pll_ve2_seq_pre_set_freq[] = {
+ {RTD1625_REG_PLL_SSC_DIG_VE2_0, 0x4},
+};
+
+static const struct reg_sequence pll_ve2_seq_post_set_freq[] = {
+ {RTD1625_REG_PLL_SSC_DIG_VE2_0, 0x5},
+};
+
+static struct clk_pll pll_ve2 = {
+ .clkr.hw.init = CLK_HW_INIT("pll_ve2", "osc27m", &clk_pll_ops,
+ CLK_GET_RATE_NOCACHE | CLK_IGNORE_UNUSED),
+ .seq_power_on = pll_ve2_seq_power_on,
+ .num_seq_power_on = ARRAY_SIZE(pll_ve2_seq_power_on),
+ .seq_power_off = pll_ve2_seq_power_off,
+ .num_seq_power_off = ARRAY_SIZE(pll_ve2_seq_power_off),
+ .seq_pre_set_freq = pll_ve2_seq_pre_set_freq,
+ .num_seq_pre_set_freq = ARRAY_SIZE(pll_ve2_seq_pre_set_freq),
+ .seq_post_set_freq = pll_ve2_seq_post_set_freq,
+ .num_seq_post_set_freq = ARRAY_SIZE(pll_ve2_seq_post_set_freq),
+ .freq_reg = RTD1625_REG_PLL_SSC_DIG_VE2_1,
+ .freq_tbl = ve_tbl,
+ .freq_mask = FREQ_NF_MASK,
+ .freq_ready_reg = RTD1625_REG_PLL_SSC_DIG_VE2_DBG2,
+ .freq_ready_mask = BIT(20),
+ .freq_ready_val = BIT(20),
+ .power_reg = RTD1625_REG_PLL_VE2_2,
+ .power_mask = 0x7,
+ .power_val_on = 0x3,
+};
+
+static const struct reg_sequence pll_hifi_seq_power_on[] = {
+ {RTD1625_REG_PLL_HIFI2, 0x5},
+ {RTD1625_REG_PLL_HIFI2, 0x7},
+ {RTD1625_REG_PLL_HIFI1, 0x54000},
+ {RTD1625_REG_PLL_SSC_DIG_HIFI0, 0x4},
+ {RTD1625_REG_PLL_SSC_DIG_HIFI0, 0x5, 200},
+ {RTD1625_REG_PLL_HIFI2, 0x3},
+};
+
+static const struct reg_sequence pll_hifi_seq_power_off[] = {
+ {RTD1625_REG_PLL_HIFI2, 0x4},
+};
+
+static const struct reg_sequence pll_hifi_seq_pre_set_freq[] = {
+ {RTD1625_REG_PLL_SSC_DIG_HIFI0, 0x4},
+};
+
+static const struct reg_sequence pll_hifi_seq_post_set_freq[] = {
+ {RTD1625_REG_PLL_SSC_DIG_HIFI0, 0x5},
+};
+
+static struct clk_pll pll_hifi = {
+ .clkr.hw.init = CLK_HW_INIT("pll_hifi", "osc27m", &clk_pll_ops,
+ CLK_GET_RATE_NOCACHE | CLK_IGNORE_UNUSED),
+ .seq_power_on = pll_hifi_seq_power_on,
+ .num_seq_power_on = ARRAY_SIZE(pll_hifi_seq_power_on),
+ .seq_power_off = pll_hifi_seq_power_off,
+ .num_seq_power_off = ARRAY_SIZE(pll_hifi_seq_power_off),
+ .seq_pre_set_freq = pll_hifi_seq_pre_set_freq,
+ .num_seq_pre_set_freq = ARRAY_SIZE(pll_hifi_seq_pre_set_freq),
+ .seq_post_set_freq = pll_hifi_seq_post_set_freq,
+ .num_seq_post_set_freq = ARRAY_SIZE(pll_hifi_seq_post_set_freq),
+ .freq_reg = RTD1625_REG_PLL_SSC_DIG_HIFI1,
+ .freq_tbl = hifi_tbl,
+ .freq_mask = FREQ_NF_MASK,
+ .freq_ready_reg = RTD1625_REG_PLL_SSC_DIG_HIFI_DBG2,
+ .freq_ready_mask = BIT(20),
+ .freq_ready_val = BIT(20),
+ .power_reg = RTD1625_REG_PLL_HIFI2,
+ .power_mask = 0x7,
+ .power_val_on = 0x3,
+};
+
+static CLK_FIXED_FACTOR(pll_emmc_ref, "pll_emmc_ref", "osc27m", 1, 1, 0);
+
+static struct clk_pll_mmc pll_emmc = {
+ .pll_ofs = 0x1f0,
+ .ssc_dig_ofs = 0x6b0,
+ .clkr.hw.init = CLK_HW_INIT("pll_emmc", "pll_emmc_ref", &clk_pll_mmc_ops, 0),
+ .phase0_hw.init = CLK_HW_INIT("pll_emmc_vp0", "pll_emmc", &clk_pll_mmc_phase_ops, 0),
+ .phase1_hw.init = CLK_HW_INIT("pll_emmc_vp1", "pll_emmc", &clk_pll_mmc_phase_ops, 0),
+};
+
+static struct clk_regmap *rtd1625_crt_regmap_clks[] = {
+ &clk_en_misc.clkr,
+ &clk_en_pcie0.clkr,
+ &clk_en_gspi.clkr,
+ &clk_en_iso_misc.clkr,
+ &clk_en_sds.clkr,
+ &clk_en_hdmi.clkr,
+ &clk_en_gpu.clkr,
+ &clk_en_ve1.clkr,
+ &clk_en_ve2.clkr,
+ &clk_en_se.clkr,
+ &clk_en_md.clkr,
+ &clk_en_tp.clkr,
+ &clk_en_rcic.clkr,
+ &clk_en_nf.clkr,
+ &clk_en_emmc.clkr,
+ &clk_en_sd.clkr,
+ &clk_en_sdio_ip.clkr,
+ &clk_en_mipi_csi.clkr,
+ &clk_en_emmc_ip.clkr,
+ &clk_en_sdio.clkr,
+ &clk_en_sd_ip.clkr,
+ &clk_en_tpb.clkr,
+ &clk_en_misc_sc1.clkr,
+ &clk_en_misc_i2c_3.clkr,
+ &clk_en_jpeg.clkr,
+ &clk_en_acpu.clkr,
+ &clk_en_misc_sc0.clkr,
+ &clk_en_hdmirx.clkr,
+ &clk_en_hse.clkr,
+ &clk_en_fan.clkr,
+ &clk_en_sata_wrap_sys.clkr,
+ &clk_en_sata_wrap_sysh.clkr,
+ &clk_en_sata_mac_sysh.clkr,
+ &clk_en_r2rdsc.clkr,
+ &clk_en_pcie1.clkr,
+ &clk_en_misc_i2c_4.clkr,
+ &clk_en_misc_i2c_5.clkr,
+ &clk_en_tsio.clkr,
+ &clk_en_ve4.clkr,
+ &clk_en_edp.clkr,
+ &clk_en_tsio_trx.clkr,
+ &clk_en_pcie2.clkr,
+ &clk_en_earc.clkr,
+ &clk_en_lite.clkr,
+ &clk_en_mipi_dsi.clkr,
+ &clk_en_npupp.clkr,
+ &clk_en_npu.clkr,
+ &clk_en_aucpu0.clkr,
+ &clk_en_aucpu1.clkr,
+ &clk_en_nsram.clkr,
+ &clk_en_hdmitop.clkr,
+ &clk_en_aucpu_iso_npu.clkr,
+ &clk_en_keyladder.clkr,
+ &clk_en_ifcp_klm.clkr,
+ &clk_en_ifcp.clkr,
+ &clk_en_mdl_genpw.clkr,
+ &clk_en_mdl_chip.clkr,
+ &clk_en_mdl_ip.clkr,
+ &clk_en_mdlm2m.clkr,
+ &clk_en_mdl_xtal.clkr,
+ &clk_en_test_mux.clkr,
+ &clk_en_dla.clkr,
+ &clk_en_tpcw.clkr,
+ &clk_en_gpu_ts_src.clkr,
+ &clk_en_vi.clkr,
+ &clk_en_lvds1.clkr,
+ &clk_en_lvds2.clkr,
+ &clk_en_aucpu.clkr,
+ &clk_en_ur1.clkr,
+ &clk_en_ur2.clkr,
+ &clk_en_ur3.clkr,
+ &clk_en_ur4.clkr,
+ &clk_en_ur5.clkr,
+ &clk_en_ur6.clkr,
+ &clk_en_ur7.clkr,
+ &clk_en_ur8.clkr,
+ &clk_en_ur9.clkr,
+ &clk_en_ur_top.clkr,
+ &clk_en_misc_i2c_7.clkr,
+ &clk_en_misc_i2c_6.clkr,
+ &clk_en_spi0.clkr,
+ &clk_en_spi1.clkr,
+ &clk_en_spi2.clkr,
+ &clk_en_lsadc0.clkr,
+ &clk_en_lsadc1.clkr,
+ &clk_en_isomis_dma.clkr,
+ &clk_en_dptx.clkr,
+ &clk_en_npu_mipi_csi.clkr,
+ &clk_en_edptx.clkr,
+ &clk_gpu.clkr,
+ &clk_ve1.clkr,
+ &clk_ve2.clkr,
+ &clk_ve4.clkr,
+ &pll_ve1.clkr,
+ &pll_ddsa.clkr,
+ &pll_bus.clkr,
+ &pll_dcsb.clkr,
+ &pll_gpu.clkr,
+ &pll_npu.clkr,
+ &pll_ve2.clkr,
+ &pll_hifi.clkr,
+ &pll_emmc.clkr,
+ &pll_acpu.clkr,
+};
+
+static struct rtk_reset_bank rtd1625_crt_reset_banks[] = {
+ { .ofs = 0x0, .write_en = 1, },
+ { .ofs = 0x4, .write_en = 1, },
+ { .ofs = 0x8, .write_en = 1, },
+ { .ofs = 0xc, .write_en = 1, },
+ { .ofs = 0x68, .write_en = 1, },
+ { .ofs = 0x90, .write_en = 1, },
+ { .ofs = 0xb8, .write_en = 1, },
+ { .ofs = 0x454, },
+ { .ofs = 0x458, },
+ { .ofs = 0x464, },
+ { .ofs = 0x880, .write_en = 1, },
+ { .ofs = 0x890, .write_en = 1, },
+};
+
+static struct clk_hw_onecell_data rtd1625_crt_hw_data = {
+ .num = RTD1625_CRT_CLK_MAX,
+ .hws = {
+ [RTD1625_CRT_CLK_EN_MISC] = &__clk_regmap_gate_hw(&clk_en_misc),
+ [RTD1625_CRT_CLK_EN_PCIE0] = &__clk_regmap_gate_hw(&clk_en_pcie0),
+ [RTD1625_CRT_CLK_EN_GSPI] = &__clk_regmap_gate_hw(&clk_en_gspi),
+ [RTD1625_CRT_CLK_EN_ISO_MISC] = &__clk_regmap_gate_hw(&clk_en_iso_misc),
+ [RTD1625_CRT_CLK_EN_SDS] = &__clk_regmap_gate_hw(&clk_en_sds),
+ [RTD1625_CRT_CLK_EN_HDMI] = &__clk_regmap_gate_hw(&clk_en_hdmi),
+ [RTD1625_CRT_CLK_EN_GPU] = &__clk_regmap_gate_hw(&clk_en_gpu),
+ [RTD1625_CRT_CLK_EN_VE1] = &__clk_regmap_gate_hw(&clk_en_ve1),
+ [RTD1625_CRT_CLK_EN_VE2] = &__clk_regmap_gate_hw(&clk_en_ve2),
+ [RTD1625_CRT_CLK_EN_MD] = &__clk_regmap_gate_hw(&clk_en_md),
+ [RTD1625_CRT_CLK_EN_TP] = &__clk_regmap_gate_hw(&clk_en_tp),
+ [RTD1625_CRT_CLK_EN_RCIC] = &__clk_regmap_gate_hw(&clk_en_rcic),
+ [RTD1625_CRT_CLK_EN_NF] = &__clk_regmap_gate_hw(&clk_en_nf),
+ [RTD1625_CRT_CLK_EN_EMMC] = &__clk_regmap_gate_hw(&clk_en_emmc),
+ [RTD1625_CRT_CLK_EN_SD] = &__clk_regmap_gate_hw(&clk_en_sd),
+ [RTD1625_CRT_CLK_EN_SDIO_IP] = &__clk_regmap_gate_hw(&clk_en_sdio_ip),
+ [RTD1625_CRT_CLK_EN_MIPI_CSI] = &__clk_regmap_gate_hw(&clk_en_mipi_csi),
+ [RTD1625_CRT_CLK_EN_EMMC_IP] = &__clk_regmap_gate_hw(&clk_en_emmc_ip),
+ [RTD1625_CRT_CLK_EN_SDIO] = &__clk_regmap_gate_hw(&clk_en_sdio),
+ [RTD1625_CRT_CLK_EN_SD_IP] = &__clk_regmap_gate_hw(&clk_en_sd_ip),
+ [RTD1625_CRT_CLK_EN_TPB] = &__clk_regmap_gate_hw(&clk_en_tpb),
+ [RTD1625_CRT_CLK_EN_MISC_SC1] = &__clk_regmap_gate_hw(&clk_en_misc_sc1),
+ [RTD1625_CRT_CLK_EN_MISC_I2C_3] = &__clk_regmap_gate_hw(&clk_en_misc_i2c_3),
+ [RTD1625_CRT_CLK_EN_ACPU] = &__clk_regmap_gate_hw(&clk_en_acpu),
+ [RTD1625_CRT_CLK_EN_JPEG] = &__clk_regmap_gate_hw(&clk_en_jpeg),
+ [RTD1625_CRT_CLK_EN_MISC_SC0] = &__clk_regmap_gate_hw(&clk_en_misc_sc0),
+ [RTD1625_CRT_CLK_EN_HDMIRX] = &__clk_regmap_gate_hw(&clk_en_hdmirx),
+ [RTD1625_CRT_CLK_EN_HSE] = &__clk_regmap_gate_hw(&clk_en_hse),
+ [RTD1625_CRT_CLK_EN_FAN] = &__clk_regmap_gate_hw(&clk_en_fan),
+ [RTD1625_CRT_CLK_EN_SATA_WRAP_SYS] = &__clk_regmap_gate_hw(&clk_en_sata_wrap_sys),
+ [RTD1625_CRT_CLK_EN_SATA_WRAP_SYSH] = &__clk_regmap_gate_hw(&clk_en_sata_wrap_sysh),
+ [RTD1625_CRT_CLK_EN_SATA_MAC_SYSH] = &__clk_regmap_gate_hw(&clk_en_sata_mac_sysh),
+ [RTD1625_CRT_CLK_EN_R2RDSC] = &__clk_regmap_gate_hw(&clk_en_r2rdsc),
+ [RTD1625_CRT_CLK_EN_PCIE1] = &__clk_regmap_gate_hw(&clk_en_pcie1),
+ [RTD1625_CRT_CLK_EN_MISC_I2C_4] = &__clk_regmap_gate_hw(&clk_en_misc_i2c_4),
+ [RTD1625_CRT_CLK_EN_MISC_I2C_5] = &__clk_regmap_gate_hw(&clk_en_misc_i2c_5),
+ [RTD1625_CRT_CLK_EN_TSIO] = &__clk_regmap_gate_hw(&clk_en_tsio),
+ [RTD1625_CRT_CLK_EN_VE4] = &__clk_regmap_gate_hw(&clk_en_ve4),
+ [RTD1625_CRT_CLK_EN_EDP] = &__clk_regmap_gate_hw(&clk_en_edp),
+ [RTD1625_CRT_CLK_EN_TSIO_TRX] = &__clk_regmap_gate_hw(&clk_en_tsio_trx),
+ [RTD1625_CRT_CLK_EN_PCIE2] = &__clk_regmap_gate_hw(&clk_en_pcie2),
+ [RTD1625_CRT_CLK_EN_EARC] = &__clk_regmap_gate_hw(&clk_en_earc),
+ [RTD1625_CRT_CLK_EN_LITE] = &__clk_regmap_gate_hw(&clk_en_lite),
+ [RTD1625_CRT_CLK_EN_MIPI_DSI] = &__clk_regmap_gate_hw(&clk_en_mipi_dsi),
+ [RTD1625_CRT_CLK_EN_NPUPP] = &__clk_regmap_gate_hw(&clk_en_npupp),
+ [RTD1625_CRT_CLK_EN_NPU] = &__clk_regmap_gate_hw(&clk_en_npu),
+ [RTD1625_CRT_CLK_EN_AUCPU0] = &__clk_regmap_gate_hw(&clk_en_aucpu0),
+ [RTD1625_CRT_CLK_EN_AUCPU1] = &__clk_regmap_gate_hw(&clk_en_aucpu1),
+ [RTD1625_CRT_CLK_EN_NSRAM] = &__clk_regmap_gate_hw(&clk_en_nsram),
+ [RTD1625_CRT_CLK_EN_HDMITOP] = &__clk_regmap_gate_hw(&clk_en_hdmitop),
+ [RTD1625_CRT_CLK_EN_AUCPU_ISO_NPU] = &__clk_regmap_gate_hw(&clk_en_aucpu_iso_npu),
+ [RTD1625_CRT_CLK_EN_KEYLADDER] = &__clk_regmap_gate_hw(&clk_en_keyladder),
+ [RTD1625_CRT_CLK_EN_IFCP_KLM] = &__clk_regmap_gate_hw(&clk_en_ifcp_klm),
+ [RTD1625_CRT_CLK_EN_IFCP] = &__clk_regmap_gate_hw(&clk_en_ifcp),
+ [RTD1625_CRT_CLK_EN_MDL_GENPW] = &__clk_regmap_gate_hw(&clk_en_mdl_genpw),
+ [RTD1625_CRT_CLK_EN_MDL_CHIP] = &__clk_regmap_gate_hw(&clk_en_mdl_chip),
+ [RTD1625_CRT_CLK_EN_MDL_IP] = &__clk_regmap_gate_hw(&clk_en_mdl_ip),
+ [RTD1625_CRT_CLK_EN_MDLM2M] = &__clk_regmap_gate_hw(&clk_en_mdlm2m),
+ [RTD1625_CRT_CLK_EN_MDL_XTAL] = &__clk_regmap_gate_hw(&clk_en_mdl_xtal),
+ [RTD1625_CRT_CLK_EN_TEST_MUX] = &__clk_regmap_gate_hw(&clk_en_test_mux),
+ [RTD1625_CRT_CLK_EN_DLA] = &__clk_regmap_gate_hw(&clk_en_dla),
+ [RTD1625_CRT_CLK_EN_TPCW] = &__clk_regmap_gate_hw(&clk_en_tpcw),
+ [RTD1625_CRT_CLK_EN_GPU_TS_SRC] = &__clk_regmap_gate_hw(&clk_en_gpu_ts_src),
+ [RTD1625_CRT_CLK_EN_VI] = &__clk_regmap_gate_hw(&clk_en_vi),
+ [RTD1625_CRT_CLK_EN_LVDS1] = &__clk_regmap_gate_hw(&clk_en_lvds1),
+ [RTD1625_CRT_CLK_EN_LVDS2] = &__clk_regmap_gate_hw(&clk_en_lvds2),
+ [RTD1625_CRT_CLK_EN_AUCPU] = &__clk_regmap_gate_hw(&clk_en_aucpu),
+ [RTD1625_CRT_CLK_EN_UR1] = &__clk_regmap_gate_hw(&clk_en_ur1),
+ [RTD1625_CRT_CLK_EN_UR2] = &__clk_regmap_gate_hw(&clk_en_ur2),
+ [RTD1625_CRT_CLK_EN_UR3] = &__clk_regmap_gate_hw(&clk_en_ur3),
+ [RTD1625_CRT_CLK_EN_UR4] = &__clk_regmap_gate_hw(&clk_en_ur4),
+ [RTD1625_CRT_CLK_EN_UR5] = &__clk_regmap_gate_hw(&clk_en_ur5),
+ [RTD1625_CRT_CLK_EN_UR6] = &__clk_regmap_gate_hw(&clk_en_ur6),
+ [RTD1625_CRT_CLK_EN_UR7] = &__clk_regmap_gate_hw(&clk_en_ur7),
+ [RTD1625_CRT_CLK_EN_UR8] = &__clk_regmap_gate_hw(&clk_en_ur8),
+ [RTD1625_CRT_CLK_EN_UR9] = &__clk_regmap_gate_hw(&clk_en_ur9),
+ [RTD1625_CRT_CLK_EN_UR_TOP] = &__clk_regmap_gate_hw(&clk_en_ur_top),
+ [RTD1625_CRT_CLK_EN_MISC_I2C_7] = &__clk_regmap_gate_hw(&clk_en_misc_i2c_7),
+ [RTD1625_CRT_CLK_EN_MISC_I2C_6] = &__clk_regmap_gate_hw(&clk_en_misc_i2c_6),
+ [RTD1625_CRT_CLK_EN_SPI0] = &__clk_regmap_gate_hw(&clk_en_spi0),
+ [RTD1625_CRT_CLK_EN_SPI1] = &__clk_regmap_gate_hw(&clk_en_spi1),
+ [RTD1625_CRT_CLK_EN_SPI2] = &__clk_regmap_gate_hw(&clk_en_spi2),
+ [RTD1625_CRT_CLK_EN_LSADC0] = &__clk_regmap_gate_hw(&clk_en_lsadc0),
+ [RTD1625_CRT_CLK_EN_LSADC1] = &__clk_regmap_gate_hw(&clk_en_lsadc1),
+ [RTD1625_CRT_CLK_EN_ISOMIS_DMA] = &__clk_regmap_gate_hw(&clk_en_isomis_dma),
+ [RTD1625_CRT_CLK_EN_DPTX] = &__clk_regmap_gate_hw(&clk_en_dptx),
+ [RTD1625_CRT_CLK_EN_NPU_MIPI_CSI] = &__clk_regmap_gate_hw(&clk_en_npu_mipi_csi),
+ [RTD1625_CRT_CLK_EN_EDPTX] = &__clk_regmap_gate_hw(&clk_en_edptx),
+ [RTD1625_CRT_CLK_GPU] = &__clk_regmap_mux_hw(&clk_gpu),
+ [RTD1625_CRT_CLK_VE1] = &__clk_regmap_mux_hw(&clk_ve1),
+ [RTD1625_CRT_CLK_VE2] = &__clk_regmap_mux_hw(&clk_ve2),
+ [RTD1625_CRT_CLK_VE4] = &__clk_regmap_mux_hw(&clk_ve4),
+ [RTD1625_CRT_PLL_VE1] = &__clk_pll_hw(&pll_ve1),
+ [RTD1625_CRT_PLL_DDSA] = &__clk_pll_hw(&pll_ddsa),
+ [RTD1625_CRT_PLL_BUS] = &__clk_pll_hw(&pll_bus),
+ [RTD1625_CRT_CLK_SYS] = &clk_sys.hw,
+ [RTD1625_CRT_PLL_DCSB] = &__clk_pll_hw(&pll_dcsb),
+ [RTD1625_CRT_CLK_SYSH] = &clk_sysh.hw,
+ [RTD1625_CRT_PLL_GPU] = &__clk_pll_hw(&pll_gpu),
+ [RTD1625_CRT_PLL_NPU] = &__clk_pll_hw(&pll_npu),
+ [RTD1625_CRT_PLL_VE2] = &__clk_pll_hw(&pll_ve2),
+ [RTD1625_CRT_PLL_HIFI] = &__clk_pll_hw(&pll_hifi),
+ [RTD1625_CRT_PLL_EMMC_REF] = &pll_emmc_ref.hw,
+ [RTD1625_CRT_PLL_EMMC] = &__clk_pll_mmc_hw(&pll_emmc),
+ [RTD1625_CRT_PLL_EMMC_VP0] = &pll_emmc.phase0_hw,
+ [RTD1625_CRT_PLL_EMMC_VP1] = &pll_emmc.phase1_hw,
+ [RTD1625_CRT_PLL_ACPU] = &__clk_pll_hw(&pll_acpu),
+ [RTD1625_CRT_CLK_NPU] = &clk_npu.hw,
+ [RTD1625_CRT_CLK_NPU_MIPI_CSI] = &clk_npu_mipi_csi.hw,
+
+ [RTD1625_CRT_CLK_MAX] = NULL,
+ },
+};
+
+static const struct rtk_clk_desc rtd1625_crt_desc = {
+ .clk_data = &rtd1625_crt_hw_data,
+ .clks = rtd1625_crt_regmap_clks,
+ .num_clks = ARRAY_SIZE(rtd1625_crt_regmap_clks),
+ .reset_banks = rtd1625_crt_reset_banks,
+ .num_reset_banks = ARRAY_SIZE(rtd1625_crt_reset_banks),
+};
+
+static int rtd1625_crt_probe(struct platform_device *pdev)
+{
+ const struct rtk_clk_desc *desc;
+
+ desc = of_device_get_match_data(&pdev->dev);
+ if (!desc)
+ return -EINVAL;
+
+ return rtk_clk_probe(pdev, desc);
+}
+
+static const struct of_device_id rtd1625_crt_match[] = {
+ { .compatible = "realtek,rtd1625-crt-clk", .data = &rtd1625_crt_desc,},
+ { /* sentinel */ }
+};
+
+static struct platform_driver rtd1625_crt_driver = {
+ .probe = rtd1625_crt_probe,
+ .driver = {
+ .name = "rtk-rtd1625-crt-clk",
+ .of_match_table = rtd1625_crt_match,
+ },
+};
+
+static int __init rtd1625_crt_init(void)
+{
+ return platform_driver_register(&rtd1625_crt_driver);
+}
+subsys_initcall(rtd1625_crt_init);
+
+MODULE_DESCRIPTION("Reatek RTD1625 CRT Controller Driver");
+MODULE_AUTHOR("Cheng-Yu Lee <cylee12@realtek.com>");
+MODULE_LICENSE("GPL");
--
2.34.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 9/9] clk: realtek: Add RTD1625-ISO clock controller driver
2025-12-29 7:53 [PATCH 0/9] clk: realtek: Add RTD1625 Clock Support Yu-Chun Lin
` (7 preceding siblings ...)
2025-12-29 7:53 ` [PATCH 8/9] clk: realtek: Add RTD1625-CRT clock controller driver Yu-Chun Lin
@ 2025-12-29 7:53 ` Yu-Chun Lin
8 siblings, 0 replies; 20+ messages in thread
From: Yu-Chun Lin @ 2025-12-29 7:53 UTC (permalink / raw)
To: mturquette, sboyd, robh, krzk+dt, conor+dt, p.zabel, cylee12,
jyanchou
Cc: devicetree, linux-clk, linux-kernel, james.tai, cy.huang,
stanley_chang, eleanor.lin
Add support for the ISO (Isolation) domain clock controller on the Realtek
RTD1625 SoC. This controller manages clocks in the always-on power domain,
ensuring essential services remain functional even when the main system
power is gated.
Signed-off-by: Cheng-Yu Lee <cylee12@realtek.com>
Signed-off-by: Yu-Chun Lin <eleanor.lin@realtek.com>
---
drivers/clk/realtek/Makefile | 1 +
drivers/clk/realtek/clk-rtd1625-iso.c | 150 ++++++++++++++++++++++++++
2 files changed, 151 insertions(+)
create mode 100644 drivers/clk/realtek/clk-rtd1625-iso.c
diff --git a/drivers/clk/realtek/Makefile b/drivers/clk/realtek/Makefile
index 3cda1e600172..e90fce42a85e 100644
--- a/drivers/clk/realtek/Makefile
+++ b/drivers/clk/realtek/Makefile
@@ -11,3 +11,4 @@ clk-rtk-y += reset.o
clk-rtk-$(CONFIG_RTK_CLK_PLL_MMC) += clk-pll-mmc.o
obj-$(CONFIG_COMMON_CLK_RTD1625) += clk-rtd1625-crt.o
+obj-$(CONFIG_COMMON_CLK_RTD1625) += clk-rtd1625-iso.o
diff --git a/drivers/clk/realtek/clk-rtd1625-iso.c b/drivers/clk/realtek/clk-rtd1625-iso.c
new file mode 100644
index 000000000000..eb942487befc
--- /dev/null
+++ b/drivers/clk/realtek/clk-rtd1625-iso.c
@@ -0,0 +1,150 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2024 Realtek Semiconductor Corporation
+ * Author: Cheng-Yu Lee <cylee12@realtek.com>
+ */
+
+#include <dt-bindings/clock/realtek,rtd1625-clk.h>
+#include <linux/clk-provider.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include "clk-regmap-gate.h"
+
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_usb_p4, 0, 0x08c, 0, 0);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_usb_p3, 0, 0x08c, 1, 0);
+static CLK_REGMAP_GATE(clk_en_misc_cec0, "clk_en_misc", 0, 0x08c, 2, 0);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_cbusrx_sys, 0, 0x08c, 3, 0);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_cbustx_sys, 0, 0x08c, 4, 0);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_cbus_sys, 0, 0x08c, 5, 0);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_cbus_osc, 0, 0x08c, 6, 0);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_i2c0, 0, 0x08c, 9, 0);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_i2c1, 0, 0x08c, 10, 0);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_etn_250m, 0, 0x08c, 11, 0);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_etn_sys, 0, 0x08c, 12, 0);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_usb_drd, 0, 0x08c, 13, 0);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_usb_host, 0, 0x08c, 14, 0);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_usb_u3_host, 0, 0x08c, 15, 0);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_usb, 0, 0x08c, 16, 0);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_vtc, 0, 0x08c, 17, 0);
+static CLK_REGMAP_GATE(clk_en_misc_vfd, "clk_en_misc", 0, 0x08c, 18, 0);
+
+static struct clk_regmap *rtd1625_clk_regmap_list[] = {
+ &clk_en_usb_p4.clkr,
+ &clk_en_usb_p3.clkr,
+ &clk_en_misc_cec0.clkr,
+ &clk_en_cbusrx_sys.clkr,
+ &clk_en_cbustx_sys.clkr,
+ &clk_en_cbus_sys.clkr,
+ &clk_en_cbus_osc.clkr,
+ &clk_en_i2c0.clkr,
+ &clk_en_i2c1.clkr,
+ &clk_en_etn_250m.clkr,
+ &clk_en_etn_sys.clkr,
+ &clk_en_usb_drd.clkr,
+ &clk_en_usb_host.clkr,
+ &clk_en_usb_u3_host.clkr,
+ &clk_en_usb.clkr,
+ &clk_en_vtc.clkr,
+ &clk_en_misc_vfd.clkr,
+};
+
+static struct clk_hw_onecell_data rtd1625_iso_clk_data = {
+ .num = RTD1625_ISO_CLK_MAX,
+ .hws = {
+ [RTD1625_ISO_CLK_EN_USB_P4] = &__clk_regmap_gate_hw(&clk_en_usb_p4),
+ [RTD1625_ISO_CLK_EN_USB_P3] = &__clk_regmap_gate_hw(&clk_en_usb_p3),
+ [RTD1625_ISO_CLK_EN_MISC_CEC0] = &__clk_regmap_gate_hw(&clk_en_misc_cec0),
+ [RTD1625_ISO_CLK_EN_CBUSRX_SYS] = &__clk_regmap_gate_hw(&clk_en_cbusrx_sys),
+ [RTD1625_ISO_CLK_EN_CBUSTX_SYS] = &__clk_regmap_gate_hw(&clk_en_cbustx_sys),
+ [RTD1625_ISO_CLK_EN_CBUS_SYS] = &__clk_regmap_gate_hw(&clk_en_cbus_sys),
+ [RTD1625_ISO_CLK_EN_CBUS_OSC] = &__clk_regmap_gate_hw(&clk_en_cbus_osc),
+ [RTD1625_ISO_CLK_EN_I2C0] = &__clk_regmap_gate_hw(&clk_en_i2c0),
+ [RTD1625_ISO_CLK_EN_I2C1] = &__clk_regmap_gate_hw(&clk_en_i2c1),
+ [RTD1625_ISO_CLK_EN_ETN_250M] = &__clk_regmap_gate_hw(&clk_en_etn_250m),
+ [RTD1625_ISO_CLK_EN_ETN_SYS] = &__clk_regmap_gate_hw(&clk_en_etn_sys),
+ [RTD1625_ISO_CLK_EN_USB_DRD] = &__clk_regmap_gate_hw(&clk_en_usb_drd),
+ [RTD1625_ISO_CLK_EN_USB_HOST] = &__clk_regmap_gate_hw(&clk_en_usb_host),
+ [RTD1625_ISO_CLK_EN_USB_U3_HOST] = &__clk_regmap_gate_hw(&clk_en_usb_u3_host),
+ [RTD1625_ISO_CLK_EN_USB] = &__clk_regmap_gate_hw(&clk_en_usb),
+ [RTD1625_ISO_CLK_EN_VTC] = &__clk_regmap_gate_hw(&clk_en_vtc),
+ [RTD1625_ISO_CLK_EN_MISC_VFD] = &__clk_regmap_gate_hw(&clk_en_misc_vfd),
+ [RTD1625_ISO_CLK_MAX] = NULL,
+ },
+};
+
+static struct rtk_reset_bank rtd1625_iso_reset_banks[] = {
+ { .ofs = 0x88, },
+};
+
+static const struct rtk_clk_desc rtd1625_iso_desc = {
+ .clk_data = &rtd1625_iso_clk_data,
+ .clks = rtd1625_clk_regmap_list,
+ .num_clks = ARRAY_SIZE(rtd1625_clk_regmap_list),
+ .reset_banks = rtd1625_iso_reset_banks,
+ .num_reset_banks = ARRAY_SIZE(rtd1625_iso_reset_banks),
+};
+
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_irda, 0, 0x314, 6, 1);
+static CLK_REGMAP_GATE_NO_PARENT(clk_en_ur10, CLK_IGNORE_UNUSED, 0x314, 8, 1);
+
+static struct clk_regmap *rtd1625_iso_s_clk_regmap_list[] = {
+ &clk_en_irda.clkr,
+ &clk_en_ur10.clkr,
+};
+
+static struct clk_hw_onecell_data rtd1625_iso_s_clk_data = {
+ .num = RTD1625_ISO_S_CLK_MAX,
+ .hws = {
+ [RTD1625_ISO_S_CLK_EN_IRDA] = &__clk_regmap_gate_hw(&clk_en_irda),
+ [RTD1625_ISO_S_CLK_EN_UR10] = &__clk_regmap_gate_hw(&clk_en_ur10),
+ [RTD1625_ISO_S_CLK_MAX] = NULL,
+ },
+};
+
+static struct rtk_reset_bank rtd1625_iso_s_reset_banks[] = {
+ { .ofs = 0x310, .write_en = 1, },
+};
+
+static const struct rtk_clk_desc rtd1625_iso_s_desc = {
+ .clk_data = &rtd1625_iso_s_clk_data,
+ .clks = rtd1625_iso_s_clk_regmap_list,
+ .num_clks = ARRAY_SIZE(rtd1625_iso_s_clk_regmap_list),
+ .reset_banks = rtd1625_iso_s_reset_banks,
+ .num_reset_banks = ARRAY_SIZE(rtd1625_iso_s_reset_banks),
+};
+
+static int rtd1625_iso_probe(struct platform_device *pdev)
+{
+ const struct rtk_clk_desc *desc;
+
+ desc = of_device_get_match_data(&pdev->dev);
+ if (!desc)
+ return -EINVAL;
+ return rtk_clk_probe(pdev, desc);
+}
+
+static const struct of_device_id rtd1625_iso_match[] = {
+ { .compatible = "realtek,rtd1625-iso-clk", .data = &rtd1625_iso_desc },
+ { .compatible = "realtek,rtd1625-iso-s-clk", .data = &rtd1625_iso_s_desc },
+ { /* sentinel */ }
+};
+
+static struct platform_driver rtd1625_iso_driver = {
+ .probe = rtd1625_iso_probe,
+ .driver = {
+ .name = "rtk-rtd1625-iso-clk",
+ .of_match_table = rtd1625_iso_match,
+ },
+};
+
+static int __init rtd1625_iso_init(void)
+{
+ return platform_driver_register(&rtd1625_iso_driver);
+}
+subsys_initcall(rtd1625_iso_init);
+
+MODULE_DESCRIPTION("Realtek RTD1625 ISO Controller Driver");
+MODULE_AUTHOR("Cheng-Yu Lee <cylee12@realtek.com>");
+MODULE_LICENSE("GPL");
--
2.34.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 1/9] dt-bindings: clock: Add Realtek RTD1625 Clock & Reset Controller
2025-12-29 7:53 ` [PATCH 1/9] dt-bindings: clock: Add Realtek RTD1625 Clock & Reset Controller Yu-Chun Lin
@ 2025-12-30 12:11 ` Krzysztof Kozlowski
2026-01-02 5:46 ` Yu-Chun Lin [林祐君]
0 siblings, 1 reply; 20+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-30 12:11 UTC (permalink / raw)
To: Yu-Chun Lin
Cc: mturquette, sboyd, robh, krzk+dt, conor+dt, p.zabel, cylee12,
jyanchou, devicetree, linux-clk, linux-kernel, james.tai,
cy.huang, stanley_chang
On Mon, Dec 29, 2025 at 03:53:05PM +0800, Yu-Chun Lin wrote:
> Add DT binding schema for Realtek RTD1625 clock and reset controller
>
> Signed-off-by: Cheng-Yu Lee <cylee12@realtek.com>
> Signed-off-by: Yu-Chun Lin <eleanor.lin@realtek.com>
> ---
> .../bindings/clock/realtek,rtd1625-clk.yaml | 53 ++++++
> MAINTAINERS | 9 +
> .../dt-bindings/clock/realtek,rtd1625-clk.h | 165 ++++++++++++++++++
> 3 files changed, 227 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/clock/realtek,rtd1625-clk.yaml
> create mode 100644 include/dt-bindings/clock/realtek,rtd1625-clk.h
>
> diff --git a/Documentation/devicetree/bindings/clock/realtek,rtd1625-clk.yaml b/Documentation/devicetree/bindings/clock/realtek,rtd1625-clk.yaml
> new file mode 100644
> index 000000000000..dd636c6e9c66
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/clock/realtek,rtd1625-clk.yaml
> @@ -0,0 +1,53 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/clock/realtek,rtd1625-clk.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Realtek RTD1625 Clock & Reset Controller
> +
> +maintainers:
> + - Yu-Chun Lin <eleanor.lin@realtek.com>
> +
> +description: |
> + The Realtek RTD1625 Clock Controller manages and distributes clock
> + signals to various controllers and implements a Reset Controller for the
> + SoC peripherals.
> +
> + Clocks are referenced by unique identifiers, which are defined as
> + preprocessor macros in dt-bindings/clock/realtek,rtd1625-clk.h. Client
This part is fine, although too long for simple refernce to clock IDs.
> + device nodes within the Device Tree use these identifiers to specify the
> + specific clock and reset signals they require.
This is completely redundant. Do not explain us how DTS works. We all
know that.
> +
> +properties:
> + compatible:
> + enum:
> + - realtek,rtd1625-crt-clk
> + - realtek,rtd1625-iso-clk
> + - realtek,rtd1625-iso-s-clk
What is the difference between iso and iso-s?
> +
> + reg:
> + maxItems: 1
> +
> + "#clock-cells":
> + const: 1
> +
> + "#reset-cells":
> + const: 1
> +
> +required:
> + - compatible
> + - reg
> + - "#clock-cells"
> + - "#reset-cells"
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + clock-controller@98000000 {
> + compatible = "realtek,rtd1625-crt-clk";
> + reg = <98000000 0x1000>;
> + #clock-cells = <1>;
> + #reset-cells = <1>;
> + };
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 12f49de7fe03..9cc78e867a4e 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -21968,6 +21968,15 @@ S: Maintained
> F: Documentation/devicetree/bindings/net/dsa/realtek.yaml
> F: drivers/net/dsa/realtek/*
>
> +REALTEK SOC CLOCK AND RESET BINDINGS
> +M: Cheng-Yu Lee <cylee12@realtek.com>
> +M: Yu-Chun Lin <eleanor.lin@realtek.com>
> +L: devicetree@vger.kernel.org
> +L: linux-clk@vger.kernel.org
> +S: Supported
> +F: Documentation/devicetree/bindings/clock/realtek*
> +F: include/dt-bindings/clock/realtek*
> +
> REALTEK SPI-NAND
> M: Chris Packham <chris.packham@alliedtelesis.co.nz>
> S: Maintained
> diff --git a/include/dt-bindings/clock/realtek,rtd1625-clk.h b/include/dt-bindings/clock/realtek,rtd1625-clk.h
> new file mode 100644
> index 000000000000..553884d7806a
> --- /dev/null
> +++ b/include/dt-bindings/clock/realtek,rtd1625-clk.h
> @@ -0,0 +1,165 @@
> +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
> +/*
> + * Copyright (C) 2025 Realtek Semiconductor Corp.
> + */
> +#ifndef __DT_BINDINGS_RTK_CLOCK_RTD1625_H
> +#define __DT_BINDINGS_RTK_CLOCK_RTD1625_H
> +
> +#define RTD1625_CRT_CLK_EN_MISC 0
> +#define RTD1625_CRT_CLK_EN_PCIE0 1
> +#define RTD1625_CRT_CLK_EN_DIP 2
> +#define RTD1625_CRT_CLK_EN_GSPI 3
> +#define RTD1625_CRT_CLK_EN_ISO_MISC 5
> +#define RTD1625_CRT_CLK_EN_SDS 6
> +#define RTD1625_CRT_CLK_EN_HDMI 7
> +#define RTD1625_CRT_CLK_EN_GPU 9
> +#define RTD1625_CRT_CLK_EN_VE1 10
> +#define RTD1625_CRT_CLK_EN_VE2 11
> +#define RTD1625_CRT_CLK_EN_MD 18
> +#define RTD1625_CRT_CLK_EN_TP 19
> +#define RTD1625_CRT_CLK_EN_RCIC 20
> +#define RTD1625_CRT_CLK_EN_NF 21
> +#define RTD1625_CRT_CLK_EN_EMMC 22
> +#define RTD1625_CRT_CLK_EN_SD 23
> +#define RTD1625_CRT_CLK_EN_SDIO_IP 24
> +#define RTD1625_CRT_CLK_EN_MIPI_CSI 25
> +#define RTD1625_CRT_CLK_EN_EMMC_IP 26
> +#define RTD1625_CRT_CLK_EN_SDIO 27
> +#define RTD1625_CRT_CLK_EN_SD_IP 28
> +#define RTD1625_CRT_CLK_EN_TPB 30
> +#define RTD1625_CRT_CLK_EN_MISC_SC1 31
> +#define RTD1625_CRT_CLK_EN_MISC_I2C_3 32
> +#define RTD1625_CRT_CLK_EN_ACPU 33
> +#define RTD1625_CRT_CLK_EN_JPEG 34
> +#define RTD1625_CRT_CLK_EN_MISC_SC0 37
> +#define RTD1625_CRT_CLK_EN_HDMIRX 45
> +#define RTD1625_CRT_CLK_EN_HSE 46
> +#define RTD1625_CRT_CLK_EN_FAN 49
> +#define RTD1625_CRT_CLK_EN_SATA_WRAP_SYS 52
> +#define RTD1625_CRT_CLK_EN_SATA_WRAP_SYSH 53
> +#define RTD1625_CRT_CLK_EN_SATA_MAC_SYSH 54
> +#define RTD1625_CRT_CLK_EN_R2RDSC 55
> +#define RTD1625_CRT_CLK_EN_TPC 56
> +#define RTD1625_CRT_CLK_EN_PCIE1 57
> +#define RTD1625_CRT_CLK_EN_MISC_I2C_4 58
> +#define RTD1625_CRT_CLK_EN_MISC_I2C_5 59
> +#define RTD1625_CRT_CLK_EN_TSIO 60
> +#define RTD1625_CRT_CLK_EN_VE4 61
> +#define RTD1625_CRT_CLK_EN_EDP 62
> +#define RTD1625_CRT_CLK_EN_TSIO_TRX 63
> +#define RTD1625_CRT_CLK_EN_PCIE2 64
> +#define RTD1625_CRT_CLK_EN_EARC 66
> +#define RTD1625_CRT_CLK_EN_LITE 67
> +#define RTD1625_CRT_CLK_EN_MIPI_DSI 68
> +#define RTD1625_CRT_CLK_EN_NPUPP 69
> +#define RTD1625_CRT_CLK_EN_NPU 70
> +#define RTD1625_CRT_CLK_EN_AUCPU0 71
> +#define RTD1625_CRT_CLK_EN_AUCPU1 72
> +#define RTD1625_CRT_CLK_EN_NSRAM 73
> +#define RTD1625_CRT_CLK_EN_HDMITOP 74
> +#define RTD1625_CRT_CLK_EN_AUCPU_ISO_NPU 76
> +#define RTD1625_CRT_CLK_EN_KEYLADDER 77
> +#define RTD1625_CRT_CLK_EN_IFCP_KLM 78
> +#define RTD1625_CRT_CLK_EN_IFCP 79
> +#define RTD1625_CRT_CLK_EN_MDL_GENPW 80
> +#define RTD1625_CRT_CLK_EN_MDL_CHIP 81
> +#define RTD1625_CRT_CLK_EN_MDL_IP 82
> +#define RTD1625_CRT_CLK_EN_MDLM2M 83
> +#define RTD1625_CRT_CLK_EN_MDL_XTAL 84
> +#define RTD1625_CRT_CLK_EN_TEST_MUX 85
> +#define RTD1625_CRT_CLK_EN_DLA 86
> +#define RTD1625_CRT_CLK_EN_TPCW 88
> +#define RTD1625_CRT_CLK_EN_GPU_TS_SRC 89
> +#define RTD1625_CRT_CLK_EN_VI 91
> +#define RTD1625_CRT_CLK_EN_LVDS1 92
> +#define RTD1625_CRT_CLK_EN_LVDS2 93
> +#define RTD1625_CRT_CLK_EN_AUCPU 94
> +#define RTD1625_CRT_CLK_EN_UR1 96
> +#define RTD1625_CRT_CLK_EN_UR2 97
> +#define RTD1625_CRT_CLK_EN_UR3 98
> +#define RTD1625_CRT_CLK_EN_UR4 99
> +#define RTD1625_CRT_CLK_EN_UR5 100
> +#define RTD1625_CRT_CLK_EN_UR6 101
> +#define RTD1625_CRT_CLK_EN_UR7 102
> +#define RTD1625_CRT_CLK_EN_UR8 103
> +#define RTD1625_CRT_CLK_EN_UR9 104
> +#define RTD1625_CRT_CLK_EN_UR_TOP 105
> +#define RTD1625_CRT_CLK_EN_MISC_I2C_7 110
> +#define RTD1625_CRT_CLK_EN_MISC_I2C_6 111
> +#define RTD1625_CRT_CLK_EN_SPI0 112
> +#define RTD1625_CRT_CLK_EN_SPI1 113
> +#define RTD1625_CRT_CLK_EN_SPI2 114
> +#define RTD1625_CRT_CLK_EN_LSADC0 120
> +#define RTD1625_CRT_CLK_EN_LSADC1 121
> +#define RTD1625_CRT_CLK_EN_ISOMIS_DMA 122
> +#define RTD1625_CRT_CLK_EN_DPTX 124
> +#define RTD1625_CRT_CLK_EN_NPU_MIPI_CSI 125
> +#define RTD1625_CRT_CLK_EN_EDPTX 126
> +#define RTD1625_CRT_CLK_HIFI 128
> +#define RTD1625_CRT_CLK_NPU_MIPI_CSI 129
> +#define RTD1625_CRT_CLK_NPU 130
> +#define RTD1625_CRT_CLK_NPU_SYSH 132
> +#define RTD1625_CRT_CLK_HIFI_SCPU 133
> +#define RTD1625_CRT_CLK_GPU 134
> +#define RTD1625_CRT_CLK_GPU2D 135
> +#define RTD1625_CRT_CLK_MIPI_DSI_PCLK 136
> +#define RTD1625_CRT_CLK_VE1 137
> +#define RTD1625_CRT_CLK_VE2 138
> +#define RTD1625_CRT_CLK_VE4 139
> +#define RTD1625_CRT_CLK_SYS 141
> +#define RTD1625_CRT_CLK_SYSH 142
> +#define RTD1625_CRT_PLL_SDIO_REF 145
> +#define RTD1625_CRT_PLL_CR_REF 146
> +#define RTD1625_CRT_PLL_EMMC_REF 147
> +#define RTD1625_CRT_CLK_MIS_SC0 148
> +#define RTD1625_CRT_CLK_MIS_SC1 149
> +#define RTD1625_CRT_PLL_SCPU 150
> +#define RTD1625_CRT_PLL_VE1 151
> +#define RTD1625_CRT_PLL_DDSA 152
> +#define RTD1625_CRT_PLL_PSAUDA1 153
> +#define RTD1625_CRT_PLL_PSAUDA2 154
> +#define RTD1625_CRT_PLL_BUS 155
> +#define RTD1625_CRT_PLL_SDIO 156
> +#define RTD1625_CRT_PLL_SDIO_VP0 157
> +#define RTD1625_CRT_PLL_SDIO_VP1 158
> +#define RTD1625_CRT_PLL_DCSB 159
> +#define RTD1625_CRT_PLL_GPU 160
> +#define RTD1625_CRT_PLL_NPU 161
> +#define RTD1625_CRT_PLL_VE2 162
> +#define RTD1625_CRT_PLL_HIFI 163
> +#define RTD1625_CRT_PLL_SD 164
> +#define RTD1625_CRT_PLL_SD_VP0 165
> +#define RTD1625_CRT_PLL_SD_VP1 166
> +#define RTD1625_CRT_PLL_EMMC 167
> +#define RTD1625_CRT_PLL_EMMC_VP0 168
> +#define RTD1625_CRT_PLL_EMMC_VP1 169
> +#define RTD1625_CRT_PLL_ACPU 170
> +#define RTD1625_CRT_CLK_DET 171
> +#define RTD1625_CRT_CLK_MAX 172
Drop, not a binding (explained also many times on the mailing lists).
Blank line.
> +#define RTD1625_ISO_CLK_EN_USB_P4 0
> +#define RTD1625_ISO_CLK_EN_USB_P3 1
> +#define RTD1625_ISO_CLK_EN_MISC_CEC0 2
> +#define RTD1625_ISO_CLK_EN_CBUSRX_SYS 3
> +#define RTD1625_ISO_CLK_EN_CBUSTX_SYS 4
> +#define RTD1625_ISO_CLK_EN_CBUS_SYS 5
> +#define RTD1625_ISO_CLK_EN_CBUS_OSC 6
> +#define RTD1625_ISO_CLK_EN_MISC_UR0 8
> +#define RTD1625_ISO_CLK_EN_I2C0 9
> +#define RTD1625_ISO_CLK_EN_I2C1 10
> +#define RTD1625_ISO_CLK_EN_ETN_250M 11
> +#define RTD1625_ISO_CLK_EN_ETN_SYS 12
> +#define RTD1625_ISO_CLK_EN_USB_DRD 13
> +#define RTD1625_ISO_CLK_EN_USB_HOST 14
> +#define RTD1625_ISO_CLK_EN_USB_U3_HOST 15
> +#define RTD1625_ISO_CLK_EN_USB 16
> +#define RTD1625_ISO_CLK_EN_VTC 17
> +#define RTD1625_ISO_CLK_EN_MISC_VFD 18
> +#define RTD1625_ISO_CLK_MAX 19
Ditto
> +#define RTD1625_ISO_S_CLK_EN_ISOM_MIS 0
> +#define RTD1625_ISO_S_CLK_EN_ISOM_GPIOM 1
> +#define RTD1625_ISO_S_CLK_EN_TIMER7 2
> +#define RTD1625_ISO_S_CLK_EN_IRDA 3
> +#define RTD1625_ISO_S_CLK_EN_UR10 4
> +#define RTD1625_ISO_S_CLK_MAX 5
Drop
> +
> +#endif /* __DT_BINDINGS_RTK_CLOCK_RTD1625_H */
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 8/9] clk: realtek: Add RTD1625-CRT clock controller driver
2025-12-29 7:53 ` [PATCH 8/9] clk: realtek: Add RTD1625-CRT clock controller driver Yu-Chun Lin
@ 2025-12-30 12:15 ` Krzysztof Kozlowski
0 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-30 12:15 UTC (permalink / raw)
To: Yu-Chun Lin
Cc: mturquette, sboyd, robh, krzk+dt, conor+dt, p.zabel, cylee12,
jyanchou, devicetree, linux-clk, linux-kernel, james.tai,
cy.huang, stanley_chang
On Mon, Dec 29, 2025 at 03:53:12PM +0800, Yu-Chun Lin wrote:
> Add support for the CRT (Clock, Reset, and Test) controller on the Realtek
> RTD1625 SoC. This driver provides clock and reset management for the
> system, allowing peripheral clients to request necessary resources for
> operation.
>
> Signed-off-by: Cheng-Yu Lee <cylee12@realtek.com>
> Signed-off-by: Yu-Chun Lin <eleanor.lin@realtek.com>
> ---
> drivers/clk/realtek/Kconfig | 13 +
> drivers/clk/realtek/Makefile | 1 +
> drivers/clk/realtek/clk-rtd1625-crt.c | 788 ++++++++++++++++++++++++++
> 3 files changed, 802 insertions(+)
> create mode 100644 drivers/clk/realtek/clk-rtd1625-crt.c
>
> diff --git a/drivers/clk/realtek/Kconfig b/drivers/clk/realtek/Kconfig
> index de462c2bb892..9ac7f9a5d8f2 100644
> --- a/drivers/clk/realtek/Kconfig
> +++ b/drivers/clk/realtek/Kconfig
> @@ -28,4 +28,17 @@ config RTK_CLK_COMMON
> config RTK_CLK_PLL_MMC
> bool
>
> +config COMMON_CLK_RTD1625
> + tristate "RTD1625 Clock Controller"
> + select RTK_CLK_COMMON
> + select RTK_CLK_PLL_MMC
> + default y
> + help
Messed indentation.
> + Support for the clock controller on Realtek RTD1625 SoCs.
> +
> + This driver provides clock sources, gating, multiplexing, and
> + reset control for peripherals on the RTD1625 platform.
> +
> + Say Y here if your system is based on the RTD1625 and you need
> + its peripheral devices to function.
Blank line
> endif
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 3/9] clk: realtek: Introduce a common probe()
2025-12-29 7:53 ` [PATCH 3/9] clk: realtek: Introduce a common probe() Yu-Chun Lin
@ 2025-12-30 12:17 ` Krzysztof Kozlowski
2025-12-30 18:03 ` kernel test robot
2025-12-30 18:14 ` kernel test robot
2 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-30 12:17 UTC (permalink / raw)
To: Yu-Chun Lin
Cc: mturquette, sboyd, robh, krzk+dt, conor+dt, p.zabel, cylee12,
jyanchou, devicetree, linux-clk, linux-kernel, james.tai,
cy.huang, stanley_chang
On Mon, Dec 29, 2025 at 03:53:07PM +0800, Yu-Chun Lin wrote:
> Add rtk_clk_probe() to set up the shared regmap, register clock hardware,
> add the clock provider, and optionally register a reset controller when
> reset bank data is provided.
>
> Signed-off-by: Cheng-Yu Lee <cylee12@realtek.com>
> Signed-off-by: Yu-Chun Lin <eleanor.lin@realtek.com>
> ---
> drivers/clk/realtek/Makefile | 1 +
> drivers/clk/realtek/common.c | 72 ++++++++++++++++++++++++++++++++++++
> drivers/clk/realtek/common.h | 40 ++++++++++++++++++++
> 3 files changed, 113 insertions(+)
> create mode 100644 drivers/clk/realtek/common.c
> create mode 100644 drivers/clk/realtek/common.h
>
> diff --git a/drivers/clk/realtek/Makefile b/drivers/clk/realtek/Makefile
> index 52267de2eef4..4041951b7c62 100644
> --- a/drivers/clk/realtek/Makefile
> +++ b/drivers/clk/realtek/Makefile
> @@ -1,4 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0-only
> obj-$(CONFIG_RTK_CLK_COMMON) += clk-rtk.o
>
> +clk-rtk-y += common.o
> clk-rtk-y += reset.o
> diff --git a/drivers/clk/realtek/common.c b/drivers/clk/realtek/common.c
> new file mode 100644
> index 000000000000..df89d2a10291
> --- /dev/null
> +++ b/drivers/clk/realtek/common.c
> @@ -0,0 +1,72 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Copyright (C) 2019 Realtek Semiconductor Corporation
> + * Author: Cheng-Yu Lee <cylee12@realtek.com>
> + */
> +
> +#include <linux/device.h>
> +#include <linux/module.h>
> +#include <linux/mfd/syscon.h>
> +#include <linux/platform_device.h>
> +#include "common.h"
> +
> +int rtk_clk_probe(struct platform_device *pdev, const struct rtk_clk_desc *desc)
> +{
> + int i, ret;
> + struct device *dev = &pdev->dev;
> + struct rtk_reset_initdata reset_initdata = { 0 };
> +
There is never blank line between declarations.
> + struct regmap *regmap = device_node_to_regmap(pdev->dev.of_node);
This is not supposed to be declaration with initialization.
> +
There is never blank line between get and if().
> + if (IS_ERR(regmap)) {
> + ret = PTR_ERR(regmap);
> + dev_err(dev, "Failed to get regmap: %d\n", ret);
> + return ret;
Syntax is just return dev_err_probe. Don't send us 2022 code, but
completely rework this to match upstream style.
> + }
> +
> + for (i = 0; i < desc->num_clks; i++)
> + desc->clks[i]->regmap = regmap;
> +
> + for (i = 0; i < desc->clk_data->num; i++) {
> + struct clk_hw *hw = desc->clk_data->hws[i];
> +
> + if (!hw)
> + continue;
> +
> + ret = devm_clk_hw_register(dev, hw);
> +
> + if (ret) {
> + dev_warn(dev, "failed to register hw of clk%d: %d\n", i,
> + ret);
> + desc->clk_data->hws[i] = NULL;
> + }
> + }
> +
> + ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get,
> + desc->clk_data);
> +
> + if (ret) {
> + dev_err(dev, "Failed to add clock provider\n");
Really... 2022 code...
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/9] clk: realtek: Add basic reset support
2025-12-29 7:53 ` [PATCH 2/9] clk: realtek: Add basic reset support Yu-Chun Lin
@ 2025-12-30 12:20 ` Krzysztof Kozlowski
2026-01-02 5:56 ` Yu-Chun Lin [林祐君]
0 siblings, 1 reply; 20+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-30 12:20 UTC (permalink / raw)
To: Yu-Chun Lin
Cc: mturquette, sboyd, robh, krzk+dt, conor+dt, p.zabel, cylee12,
jyanchou, devicetree, linux-clk, linux-kernel, james.tai,
cy.huang, stanley_chang
On Mon, Dec 29, 2025 at 03:53:06PM +0800, Yu-Chun Lin wrote:
> +
> +int rtk_reset_controller_add(struct device *dev,
> + struct rtk_reset_initdata *initdata)
> +{
> + struct rtk_reset_data *data;
> +
> + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
> +
What sort of coding style do you use? There is absolutely never a blank
line between kzalloc and the if().
> + if (!data)
> + return -ENOMEM;
> +
> + data->dev = dev;
> + data->num_banks = initdata->num_banks;
> + data->banks = initdata->banks;
> + data->regmap = initdata->regmap;
> + data->rcdev.owner = THIS_MODULE;
THIS_MODULE? so which module is exactly the owner - clk-rtk.ko or actual
driver?
This feels buggy, but I did not check your Makefile.
> + data->rcdev.ops = &rtk_reset_ops;
> + data->rcdev.dev = dev;
> + data->rcdev.of_node = dev->of_node;
> + data->rcdev.nr_resets = initdata->num_banks * 0x100;
> + data->rcdev.of_xlate = rtk_of_reset_xlate;
> + data->rcdev.of_reset_n_cells = 1;
> +
> + return devm_reset_controller_register(dev, &data->rcdev);
> +}
> +EXPORT_SYMBOL_GPL(rtk_reset_controller_add);
> +
> diff --git a/drivers/clk/realtek/reset.h b/drivers/clk/realtek/reset.h
> new file mode 100644
> index 000000000000..cd446b098429
> --- /dev/null
> +++ b/drivers/clk/realtek/reset.h
> @@ -0,0 +1,36 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * Copyright (C) 2019 Realtek Semiconductor Corporation
Ah, so that's why you sent probe() from ~10 years ago...
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 3/9] clk: realtek: Introduce a common probe()
2025-12-29 7:53 ` [PATCH 3/9] clk: realtek: Introduce a common probe() Yu-Chun Lin
2025-12-30 12:17 ` Krzysztof Kozlowski
@ 2025-12-30 18:03 ` kernel test robot
2025-12-30 18:14 ` kernel test robot
2 siblings, 0 replies; 20+ messages in thread
From: kernel test robot @ 2025-12-30 18:03 UTC (permalink / raw)
To: Yu-Chun Lin, mturquette, sboyd, robh, krzk+dt, conor+dt, p.zabel,
cylee12, jyanchou
Cc: oe-kbuild-all, devicetree, linux-clk, linux-kernel, james.tai,
cy.huang, stanley_chang, eleanor.lin
Hi Yu-Chun,
kernel test robot noticed the following build warnings:
[auto build test WARNING on clk/clk-next]
[also build test WARNING on linus/master v6.19-rc3 next-20251219]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Yu-Chun-Lin/dt-bindings-clock-Add-Realtek-RTD1625-Clock-Reset-Controller/20251229-155549
base: https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
patch link: https://lore.kernel.org/r/20251229075313.27254-4-eleanor.lin%40realtek.com
patch subject: [PATCH 3/9] clk: realtek: Introduce a common probe()
config: i386-buildonly-randconfig-001-20251230 (https://download.01.org/0day-ci/archive/20251231/202512310112.MJuwgWEO-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251231/202512310112.MJuwgWEO-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512310112.MJuwgWEO-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from include/linux/device.h:15,
from drivers/clk/realtek/common.c:7:
drivers/clk/realtek/common.c: In function 'rtk_clk_probe':
>> drivers/clk/realtek/common.c:58:25: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
58 | "Missing reset banks data though num_reset_banks is %lu\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:154:56: note: in expansion of macro 'dev_fmt'
154 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/clk/realtek/common.c:57:17: note: in expansion of macro 'dev_err'
57 | dev_err(dev,
| ^~~~~~~
drivers/clk/realtek/common.c:58:79: note: format string is defined here
58 | "Missing reset banks data though num_reset_banks is %lu\n",
| ~~^
| |
| long unsigned int
| %u
vim +58 drivers/clk/realtek/common.c
12
13 int rtk_clk_probe(struct platform_device *pdev, const struct rtk_clk_desc *desc)
14 {
15 int i, ret;
16 struct device *dev = &pdev->dev;
17 struct rtk_reset_initdata reset_initdata = { 0 };
18
19 struct regmap *regmap = device_node_to_regmap(pdev->dev.of_node);
20
21 if (IS_ERR(regmap)) {
22 ret = PTR_ERR(regmap);
23 dev_err(dev, "Failed to get regmap: %d\n", ret);
24 return ret;
25 }
26
27 for (i = 0; i < desc->num_clks; i++)
28 desc->clks[i]->regmap = regmap;
29
30 for (i = 0; i < desc->clk_data->num; i++) {
31 struct clk_hw *hw = desc->clk_data->hws[i];
32
33 if (!hw)
34 continue;
35
36 ret = devm_clk_hw_register(dev, hw);
37
38 if (ret) {
39 dev_warn(dev, "failed to register hw of clk%d: %d\n", i,
40 ret);
41 desc->clk_data->hws[i] = NULL;
42 }
43 }
44
45 ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get,
46 desc->clk_data);
47
48 if (ret) {
49 dev_err(dev, "Failed to add clock provider\n");
50 return ret;
51 }
52
53 if (!desc->num_reset_banks)
54 return 0;
55
56 if (!desc->reset_banks) {
57 dev_err(dev,
> 58 "Missing reset banks data though num_reset_banks is %lu\n",
59 desc->num_reset_banks);
60 return -EINVAL;
61 }
62
63 reset_initdata.regmap = regmap;
64 reset_initdata.num_banks = desc->num_reset_banks;
65 reset_initdata.banks = desc->reset_banks;
66
67 return rtk_reset_controller_add(dev, &reset_initdata);
68 }
69 EXPORT_SYMBOL_GPL(rtk_clk_probe);
70
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 3/9] clk: realtek: Introduce a common probe()
2025-12-29 7:53 ` [PATCH 3/9] clk: realtek: Introduce a common probe() Yu-Chun Lin
2025-12-30 12:17 ` Krzysztof Kozlowski
2025-12-30 18:03 ` kernel test robot
@ 2025-12-30 18:14 ` kernel test robot
2 siblings, 0 replies; 20+ messages in thread
From: kernel test robot @ 2025-12-30 18:14 UTC (permalink / raw)
To: Yu-Chun Lin, mturquette, sboyd, robh, krzk+dt, conor+dt, p.zabel,
cylee12, jyanchou
Cc: oe-kbuild-all, devicetree, linux-clk, linux-kernel, james.tai,
cy.huang, stanley_chang, eleanor.lin
Hi Yu-Chun,
kernel test robot noticed the following build warnings:
[auto build test WARNING on clk/clk-next]
[also build test WARNING on linus/master v6.19-rc3 next-20251219]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Yu-Chun-Lin/dt-bindings-clock-Add-Realtek-RTD1625-Clock-Reset-Controller/20251229-155549
base: https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
patch link: https://lore.kernel.org/r/20251229075313.27254-4-eleanor.lin%40realtek.com
patch subject: [PATCH 3/9] clk: realtek: Introduce a common probe()
config: arc-randconfig-002-20251231 (https://download.01.org/0day-ci/archive/20251231/202512310241.H75NfTMw-lkp@intel.com/config)
compiler: arc-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251231/202512310241.H75NfTMw-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512310241.H75NfTMw-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from include/linux/device.h:15,
from drivers/clk/realtek/common.c:7:
drivers/clk/realtek/common.c: In function 'rtk_clk_probe':
>> drivers/clk/realtek/common.c:58:4: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'const unsigned int'} [-Wformat=]
"Missing reset banks data though num_reset_banks is %lu\n",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:110:16: note: in definition of macro 'dev_printk_index_wrap'
_p_func(dev, fmt, ##__VA_ARGS__); \
^~~
include/linux/dev_printk.h:154:49: note: in expansion of macro 'dev_fmt'
dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
^~~~~~~
drivers/clk/realtek/common.c:57:3: note: in expansion of macro 'dev_err'
dev_err(dev,
^~~~~~~
vim +58 drivers/clk/realtek/common.c
12
13 int rtk_clk_probe(struct platform_device *pdev, const struct rtk_clk_desc *desc)
14 {
15 int i, ret;
16 struct device *dev = &pdev->dev;
17 struct rtk_reset_initdata reset_initdata = { 0 };
18
19 struct regmap *regmap = device_node_to_regmap(pdev->dev.of_node);
20
21 if (IS_ERR(regmap)) {
22 ret = PTR_ERR(regmap);
23 dev_err(dev, "Failed to get regmap: %d\n", ret);
24 return ret;
25 }
26
27 for (i = 0; i < desc->num_clks; i++)
28 desc->clks[i]->regmap = regmap;
29
30 for (i = 0; i < desc->clk_data->num; i++) {
31 struct clk_hw *hw = desc->clk_data->hws[i];
32
33 if (!hw)
34 continue;
35
36 ret = devm_clk_hw_register(dev, hw);
37
38 if (ret) {
39 dev_warn(dev, "failed to register hw of clk%d: %d\n", i,
40 ret);
41 desc->clk_data->hws[i] = NULL;
42 }
43 }
44
45 ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get,
46 desc->clk_data);
47
48 if (ret) {
49 dev_err(dev, "Failed to add clock provider\n");
50 return ret;
51 }
52
53 if (!desc->num_reset_banks)
54 return 0;
55
56 if (!desc->reset_banks) {
57 dev_err(dev,
> 58 "Missing reset banks data though num_reset_banks is %lu\n",
59 desc->num_reset_banks);
60 return -EINVAL;
61 }
62
63 reset_initdata.regmap = regmap;
64 reset_initdata.num_banks = desc->num_reset_banks;
65 reset_initdata.banks = desc->reset_banks;
66
67 return rtk_reset_controller_add(dev, &reset_initdata);
68 }
69 EXPORT_SYMBOL_GPL(rtk_clk_probe);
70
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 4/9] clk: realtek: Add support for phase locked loops (PLLs)
2025-12-29 7:53 ` [PATCH 4/9] clk: realtek: Add support for phase locked loops (PLLs) Yu-Chun Lin
@ 2025-12-30 20:18 ` kernel test robot
0 siblings, 0 replies; 20+ messages in thread
From: kernel test robot @ 2025-12-30 20:18 UTC (permalink / raw)
To: Yu-Chun Lin, mturquette, sboyd, robh, krzk+dt, conor+dt, p.zabel,
cylee12, jyanchou
Cc: oe-kbuild-all, devicetree, linux-clk, linux-kernel, james.tai,
cy.huang, stanley_chang, eleanor.lin
Hi Yu-Chun,
kernel test robot noticed the following build errors:
[auto build test ERROR on clk/clk-next]
[also build test ERROR on linus/master v6.19-rc3 next-20251219]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Yu-Chun-Lin/dt-bindings-clock-Add-Realtek-RTD1625-Clock-Reset-Controller/20251229-155549
base: https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
patch link: https://lore.kernel.org/r/20251229075313.27254-5-eleanor.lin%40realtek.com
patch subject: [PATCH 4/9] clk: realtek: Add support for phase locked loops (PLLs)
config: i386-buildonly-randconfig-001-20251230 (https://download.01.org/0day-ci/archive/20251231/202512310333.lXVsAtZ9-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251231/202512310333.lXVsAtZ9-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512310333.lXVsAtZ9-lkp@intel.com/
All errors (new ones prefixed by >>):
>> ld: drivers/clk/realtek/clk-pll.o:(.rodata+0x80): multiple definition of `clk_pll_ops'; drivers/clk/qcom/clk-pll.o:(.rodata+0x100): first defined here
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 20+ messages in thread
* RE: [PATCH 1/9] dt-bindings: clock: Add Realtek RTD1625 Clock & Reset Controller
2025-12-30 12:11 ` Krzysztof Kozlowski
@ 2026-01-02 5:46 ` Yu-Chun Lin [林祐君]
0 siblings, 0 replies; 20+ messages in thread
From: Yu-Chun Lin [林祐君] @ 2026-01-02 5:46 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, p.zabel@pengutronix.de,
Edgar Lee [李承諭],
Jyan Chou [周芷安], devicetree@vger.kernel.org,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
James Tai [戴志峰],
CY_Huang[黃鉦晏],
Stanley Chang[昌育德]
> On Mon, Dec 29, 2025 at 03:53:05PM +0800, Yu-Chun Lin wrote:
> > Add DT binding schema for Realtek RTD1625 clock and reset controller
> >
> > Signed-off-by: Cheng-Yu Lee <cylee12@realtek.com>
> > Signed-off-by: Yu-Chun Lin <eleanor.lin@realtek.com>
> > ---
> > .../bindings/clock/realtek,rtd1625-clk.yaml | 53 ++++++
> > MAINTAINERS | 9 +
> > .../dt-bindings/clock/realtek,rtd1625-clk.h | 165 ++++++++++++++++++
> > 3 files changed, 227 insertions(+)
> > create mode 100644
> > Documentation/devicetree/bindings/clock/realtek,rtd1625-clk.yaml
> > create mode 100644 include/dt-bindings/clock/realtek,rtd1625-clk.h
> >
> > diff --git
> > a/Documentation/devicetree/bindings/clock/realtek,rtd1625-clk.yaml
> > b/Documentation/devicetree/bindings/clock/realtek,rtd1625-clk.yaml
> > new file mode 100644
> > index 000000000000..dd636c6e9c66
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/clock/realtek,rtd1625-clk.yaml
> > @@ -0,0 +1,53 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/clock/realtek,rtd1625-clk.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Realtek RTD1625 Clock & Reset Controller
> > +
> > +maintainers:
> > + - Yu-Chun Lin <eleanor.lin@realtek.com>
> > +
> > +description: |
> > + The Realtek RTD1625 Clock Controller manages and distributes clock
> > + signals to various controllers and implements a Reset Controller
> > +for the
> > + SoC peripherals.
> > +
> > + Clocks are referenced by unique identifiers, which are defined as
> > + preprocessor macros in dt-bindings/clock/realtek,rtd1625-clk.h.
> > + Client
>
> This part is fine, although too long for simple refernce to clock IDs.
>
> > + device nodes within the Device Tree use these identifiers to
> > + specify the specific clock and reset signals they require.
>
> This is completely redundant. Do not explain us how DTS works. We all know
> that.
>
I will remove this.
> > +
> > +properties:
> > + compatible:
> > + enum:
> > + - realtek,rtd1625-crt-clk
> > + - realtek,rtd1625-iso-clk
> > + - realtek,rtd1625-iso-s-clk
>
> What is the difference between iso and iso-s?
>
iso-s stands for iso-sys internally.
Although ISO and ISO-S share the same clock controller IP logic, they are
backed by different hardware blocks with distinct register layouts and
available clock/reset sets.
> > +
> > + reg:
> > + maxItems: 1
> > +
> > + "#clock-cells":
> > + const: 1
> > +
> > + "#reset-cells":
> > + const: 1
> > +
> > +required:
> > + - compatible
> > + - reg
> > + - "#clock-cells"
> > + - "#reset-cells"
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > + - |
> > + clock-controller@98000000 {
> > + compatible = "realtek,rtd1625-crt-clk";
> > + reg = <98000000 0x1000>;
> > + #clock-cells = <1>;
> > + #reset-cells = <1>;
> > + };
> > diff --git a/MAINTAINERS b/MAINTAINERS index
> > 12f49de7fe03..9cc78e867a4e 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -21968,6 +21968,15 @@ S: Maintained
> > F: Documentation/devicetree/bindings/net/dsa/realtek.yaml
> > F: drivers/net/dsa/realtek/*
> >
> > +REALTEK SOC CLOCK AND RESET BINDINGS
> > +M: Cheng-Yu Lee <cylee12@realtek.com>
> > +M: Yu-Chun Lin <eleanor.lin@realtek.com>
> > +L: devicetree@vger.kernel.org
> > +L: linux-clk@vger.kernel.org
> > +S: Supported
> > +F: Documentation/devicetree/bindings/clock/realtek*
> > +F: include/dt-bindings/clock/realtek*
> > +
> > REALTEK SPI-NAND
> > M: Chris Packham <chris.packham@alliedtelesis.co.nz>
> > S: Maintained
> > diff --git a/include/dt-bindings/clock/realtek,rtd1625-clk.h
> > b/include/dt-bindings/clock/realtek,rtd1625-clk.h
> > new file mode 100644
> > index 000000000000..553884d7806a
> > --- /dev/null
> > +++ b/include/dt-bindings/clock/realtek,rtd1625-clk.h
> > @@ -0,0 +1,165 @@
> > +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
> > +/*
> > + * Copyright (C) 2025 Realtek Semiconductor Corp.
> > + */
> > +#ifndef __DT_BINDINGS_RTK_CLOCK_RTD1625_H #define
> > +__DT_BINDINGS_RTK_CLOCK_RTD1625_H
> > +
> > +#define RTD1625_CRT_CLK_EN_MISC 0
> > +#define RTD1625_CRT_CLK_EN_PCIE0 1
> > +#define RTD1625_CRT_CLK_EN_DIP 2
> > +#define RTD1625_CRT_CLK_EN_GSPI 3
> > +#define RTD1625_CRT_CLK_EN_ISO_MISC 5
> > +#define RTD1625_CRT_CLK_EN_SDS 6
> > +#define RTD1625_CRT_CLK_EN_HDMI 7
> > +#define RTD1625_CRT_CLK_EN_GPU 9
> > +#define RTD1625_CRT_CLK_EN_VE1 10
> > +#define RTD1625_CRT_CLK_EN_VE2 11
> > +#define RTD1625_CRT_CLK_EN_MD 18
> > +#define RTD1625_CRT_CLK_EN_TP 19
> > +#define RTD1625_CRT_CLK_EN_RCIC 20
> > +#define RTD1625_CRT_CLK_EN_NF 21
> > +#define RTD1625_CRT_CLK_EN_EMMC 22
> > +#define RTD1625_CRT_CLK_EN_SD 23
> > +#define RTD1625_CRT_CLK_EN_SDIO_IP 24
> > +#define RTD1625_CRT_CLK_EN_MIPI_CSI 25
> > +#define RTD1625_CRT_CLK_EN_EMMC_IP 26
> > +#define RTD1625_CRT_CLK_EN_SDIO 27
> > +#define RTD1625_CRT_CLK_EN_SD_IP 28
> > +#define RTD1625_CRT_CLK_EN_TPB 30
> > +#define RTD1625_CRT_CLK_EN_MISC_SC1 31
> > +#define RTD1625_CRT_CLK_EN_MISC_I2C_3 32
> > +#define RTD1625_CRT_CLK_EN_ACPU 33
> > +#define RTD1625_CRT_CLK_EN_JPEG 34
> > +#define RTD1625_CRT_CLK_EN_MISC_SC0 37
> > +#define RTD1625_CRT_CLK_EN_HDMIRX 45
> > +#define RTD1625_CRT_CLK_EN_HSE 46
> > +#define RTD1625_CRT_CLK_EN_FAN 49
> > +#define RTD1625_CRT_CLK_EN_SATA_WRAP_SYS 52 #define
> > +RTD1625_CRT_CLK_EN_SATA_WRAP_SYSH 53 #define
> > +RTD1625_CRT_CLK_EN_SATA_MAC_SYSH 54
> > +#define RTD1625_CRT_CLK_EN_R2RDSC 55
> > +#define RTD1625_CRT_CLK_EN_TPC 56
> > +#define RTD1625_CRT_CLK_EN_PCIE1 57
> > +#define RTD1625_CRT_CLK_EN_MISC_I2C_4 58
> > +#define RTD1625_CRT_CLK_EN_MISC_I2C_5 59
> > +#define RTD1625_CRT_CLK_EN_TSIO 60
> > +#define RTD1625_CRT_CLK_EN_VE4 61
> > +#define RTD1625_CRT_CLK_EN_EDP 62
> > +#define RTD1625_CRT_CLK_EN_TSIO_TRX 63
> > +#define RTD1625_CRT_CLK_EN_PCIE2 64
> > +#define RTD1625_CRT_CLK_EN_EARC 66
> > +#define RTD1625_CRT_CLK_EN_LITE 67
> > +#define RTD1625_CRT_CLK_EN_MIPI_DSI 68
> > +#define RTD1625_CRT_CLK_EN_NPUPP 69
> > +#define RTD1625_CRT_CLK_EN_NPU 70
> > +#define RTD1625_CRT_CLK_EN_AUCPU0 71
> > +#define RTD1625_CRT_CLK_EN_AUCPU1 72
> > +#define RTD1625_CRT_CLK_EN_NSRAM 73
> > +#define RTD1625_CRT_CLK_EN_HDMITOP 74
> > +#define RTD1625_CRT_CLK_EN_AUCPU_ISO_NPU 76
> > +#define RTD1625_CRT_CLK_EN_KEYLADDER 77
> > +#define RTD1625_CRT_CLK_EN_IFCP_KLM 78
> > +#define RTD1625_CRT_CLK_EN_IFCP 79
> > +#define RTD1625_CRT_CLK_EN_MDL_GENPW 80
> > +#define RTD1625_CRT_CLK_EN_MDL_CHIP 81
> > +#define RTD1625_CRT_CLK_EN_MDL_IP 82
> > +#define RTD1625_CRT_CLK_EN_MDLM2M 83
> > +#define RTD1625_CRT_CLK_EN_MDL_XTAL 84
> > +#define RTD1625_CRT_CLK_EN_TEST_MUX 85
> > +#define RTD1625_CRT_CLK_EN_DLA 86
> > +#define RTD1625_CRT_CLK_EN_TPCW 88
> > +#define RTD1625_CRT_CLK_EN_GPU_TS_SRC 89
> > +#define RTD1625_CRT_CLK_EN_VI 91
> > +#define RTD1625_CRT_CLK_EN_LVDS1 92
> > +#define RTD1625_CRT_CLK_EN_LVDS2 93
> > +#define RTD1625_CRT_CLK_EN_AUCPU 94
> > +#define RTD1625_CRT_CLK_EN_UR1 96
> > +#define RTD1625_CRT_CLK_EN_UR2 97
> > +#define RTD1625_CRT_CLK_EN_UR3 98
> > +#define RTD1625_CRT_CLK_EN_UR4 99
> > +#define RTD1625_CRT_CLK_EN_UR5 100
> > +#define RTD1625_CRT_CLK_EN_UR6 101
> > +#define RTD1625_CRT_CLK_EN_UR7 102
> > +#define RTD1625_CRT_CLK_EN_UR8 103
> > +#define RTD1625_CRT_CLK_EN_UR9 104
> > +#define RTD1625_CRT_CLK_EN_UR_TOP 105
> > +#define RTD1625_CRT_CLK_EN_MISC_I2C_7 110
> > +#define RTD1625_CRT_CLK_EN_MISC_I2C_6 111
> > +#define RTD1625_CRT_CLK_EN_SPI0 112
> > +#define RTD1625_CRT_CLK_EN_SPI1 113
> > +#define RTD1625_CRT_CLK_EN_SPI2 114
> > +#define RTD1625_CRT_CLK_EN_LSADC0 120
> > +#define RTD1625_CRT_CLK_EN_LSADC1 121
> > +#define RTD1625_CRT_CLK_EN_ISOMIS_DMA 122
> > +#define RTD1625_CRT_CLK_EN_DPTX 124
> > +#define RTD1625_CRT_CLK_EN_NPU_MIPI_CSI 125
> > +#define RTD1625_CRT_CLK_EN_EDPTX 126
> > +#define RTD1625_CRT_CLK_HIFI 128
> > +#define RTD1625_CRT_CLK_NPU_MIPI_CSI 129
> > +#define RTD1625_CRT_CLK_NPU 130
> > +#define RTD1625_CRT_CLK_NPU_SYSH 132
> > +#define RTD1625_CRT_CLK_HIFI_SCPU 133
> > +#define RTD1625_CRT_CLK_GPU 134
> > +#define RTD1625_CRT_CLK_GPU2D 135
> > +#define RTD1625_CRT_CLK_MIPI_DSI_PCLK 136
> > +#define RTD1625_CRT_CLK_VE1 137
> > +#define RTD1625_CRT_CLK_VE2 138
> > +#define RTD1625_CRT_CLK_VE4 139
> > +#define RTD1625_CRT_CLK_SYS 141
> > +#define RTD1625_CRT_CLK_SYSH 142
> > +#define RTD1625_CRT_PLL_SDIO_REF 145
> > +#define RTD1625_CRT_PLL_CR_REF 146
> > +#define RTD1625_CRT_PLL_EMMC_REF 147
> > +#define RTD1625_CRT_CLK_MIS_SC0 148
> > +#define RTD1625_CRT_CLK_MIS_SC1 149
> > +#define RTD1625_CRT_PLL_SCPU 150
> > +#define RTD1625_CRT_PLL_VE1 151
> > +#define RTD1625_CRT_PLL_DDSA 152
> > +#define RTD1625_CRT_PLL_PSAUDA1 153
> > +#define RTD1625_CRT_PLL_PSAUDA2 154
> > +#define RTD1625_CRT_PLL_BUS 155
> > +#define RTD1625_CRT_PLL_SDIO 156
> > +#define RTD1625_CRT_PLL_SDIO_VP0 157
> > +#define RTD1625_CRT_PLL_SDIO_VP1 158
> > +#define RTD1625_CRT_PLL_DCSB 159
> > +#define RTD1625_CRT_PLL_GPU 160
> > +#define RTD1625_CRT_PLL_NPU 161
> > +#define RTD1625_CRT_PLL_VE2 162
> > +#define RTD1625_CRT_PLL_HIFI 163
> > +#define RTD1625_CRT_PLL_SD 164
> > +#define RTD1625_CRT_PLL_SD_VP0 165
> > +#define RTD1625_CRT_PLL_SD_VP1 166
> > +#define RTD1625_CRT_PLL_EMMC 167
> > +#define RTD1625_CRT_PLL_EMMC_VP0 168
> > +#define RTD1625_CRT_PLL_EMMC_VP1 169
> > +#define RTD1625_CRT_PLL_ACPU 170
> > +#define RTD1625_CRT_CLK_DET 171
> > +#define RTD1625_CRT_CLK_MAX 172
>
> Drop, not a binding (explained also many times on the mailing lists).
>
> Blank line.
>
Understood. I'll drop this definition here and move it into the driver instead.
Will also fix the blank line.
> > +#define RTD1625_ISO_CLK_EN_USB_P4 0
> > +#define RTD1625_ISO_CLK_EN_USB_P3 1
> > +#define RTD1625_ISO_CLK_EN_MISC_CEC0 2
> > +#define RTD1625_ISO_CLK_EN_CBUSRX_SYS 3
> > +#define RTD1625_ISO_CLK_EN_CBUSTX_SYS 4
> > +#define RTD1625_ISO_CLK_EN_CBUS_SYS 5
> > +#define RTD1625_ISO_CLK_EN_CBUS_OSC 6
> > +#define RTD1625_ISO_CLK_EN_MISC_UR0 8
> > +#define RTD1625_ISO_CLK_EN_I2C0 9
> > +#define RTD1625_ISO_CLK_EN_I2C1 10
> > +#define RTD1625_ISO_CLK_EN_ETN_250M 11
> > +#define RTD1625_ISO_CLK_EN_ETN_SYS 12
> > +#define RTD1625_ISO_CLK_EN_USB_DRD 13
> > +#define RTD1625_ISO_CLK_EN_USB_HOST 14
> > +#define RTD1625_ISO_CLK_EN_USB_U3_HOST 15
> > +#define RTD1625_ISO_CLK_EN_USB 16
> > +#define RTD1625_ISO_CLK_EN_VTC 17
> > +#define RTD1625_ISO_CLK_EN_MISC_VFD 18
> > +#define RTD1625_ISO_CLK_MAX 19
>
> Ditto
>
> > +#define RTD1625_ISO_S_CLK_EN_ISOM_MIS 0
> > +#define RTD1625_ISO_S_CLK_EN_ISOM_GPIOM 1
> > +#define RTD1625_ISO_S_CLK_EN_TIMER7 2
> > +#define RTD1625_ISO_S_CLK_EN_IRDA 3
> > +#define RTD1625_ISO_S_CLK_EN_UR10 4
> > +#define RTD1625_ISO_S_CLK_MAX 5
>
> Drop
>
> > +
> > +#endif /* __DT_BINDINGS_RTK_CLOCK_RTD1625_H */
> > --
> > 2.34.1
> >
^ permalink raw reply [flat|nested] 20+ messages in thread
* RE: [PATCH 2/9] clk: realtek: Add basic reset support
2025-12-30 12:20 ` Krzysztof Kozlowski
@ 2026-01-02 5:56 ` Yu-Chun Lin [林祐君]
0 siblings, 0 replies; 20+ messages in thread
From: Yu-Chun Lin [林祐君] @ 2026-01-02 5:56 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, p.zabel@pengutronix.de,
Edgar Lee [李承諭],
Jyan Chou [周芷安], devicetree@vger.kernel.org,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
James Tai [戴志峰],
CY_Huang[黃鉦晏],
Stanley Chang[昌育德]
> On Mon, Dec 29, 2025 at 03:53:06PM +0800, Yu-Chun Lin wrote:
> > +
> > +int rtk_reset_controller_add(struct device *dev,
> > + struct rtk_reset_initdata *initdata) {
> > + struct rtk_reset_data *data;
> > +
> > + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
> > +
>
> What sort of coding style do you use? There is absolutely never a blank line
> between kzalloc and the if().
>
Will remove the blank line.
> > + if (!data)
> > + return -ENOMEM;
> > +
> > + data->dev = dev;
> > + data->num_banks = initdata->num_banks;
> > + data->banks = initdata->banks;
> > + data->regmap = initdata->regmap;
> > + data->rcdev.owner = THIS_MODULE;
>
> THIS_MODULE? so which module is exactly the owner - clk-rtk.ko or actual
> driver?
>
> This feels buggy, but I did not check your Makefile.
>
The reset support and the clock driver are designed to be linked together into
a single kernel module (clk-rtk.ko). Therefore, THIS_MODULE is the correct owner.
> > + data->rcdev.ops = &rtk_reset_ops;
> > + data->rcdev.dev = dev;
> > + data->rcdev.of_node = dev->of_node;
> > + data->rcdev.nr_resets = initdata->num_banks * 0x100;
> > + data->rcdev.of_xlate = rtk_of_reset_xlate;
> > + data->rcdev.of_reset_n_cells = 1;
> > +
> > + return devm_reset_controller_register(dev, &data->rcdev); }
> > +EXPORT_SYMBOL_GPL(rtk_reset_controller_add);
> > +
> > diff --git a/drivers/clk/realtek/reset.h b/drivers/clk/realtek/reset.h
> > new file mode 100644 index 000000000000..cd446b098429
> > --- /dev/null
> > +++ b/drivers/clk/realtek/reset.h
> > @@ -0,0 +1,36 @@
> > +/* SPDX-License-Identifier: GPL-2.0-only */
> > +/*
> > + * Copyright (C) 2019 Realtek Semiconductor Corporation
>
> Ah, so that's why you sent probe() from ~10 years ago...
>
> Best regards,
> Krzysztof
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 6/9] clk: realtek: Add support for mux clock
2025-12-29 7:53 ` [PATCH 6/9] clk: realtek: Add support for mux clock Yu-Chun Lin
@ 2026-01-05 12:04 ` Dan Carpenter
0 siblings, 0 replies; 20+ messages in thread
From: Dan Carpenter @ 2026-01-05 12:04 UTC (permalink / raw)
To: oe-kbuild, Yu-Chun Lin, mturquette, sboyd, robh, krzk+dt,
conor+dt, p.zabel, cylee12, jyanchou
Cc: lkp, oe-kbuild-all, devicetree, linux-clk, linux-kernel,
james.tai, cy.huang, stanley_chang, eleanor.lin
Hi Yu-Chun,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Yu-Chun-Lin/dt-bindings-clock-Add-Realtek-RTD1625-Clock-Reset-Controller/20251229-155549
base: https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
patch link: https://lore.kernel.org/r/20251229075313.27254-7-eleanor.lin%40realtek.com
patch subject: [PATCH 6/9] clk: realtek: Add support for mux clock
config: loongarch-randconfig-r072-20251231 (https://download.01.org/0day-ci/archive/20251231/202512310307.swVDgnPU-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 12.5.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202512310307.swVDgnPU-lkp@intel.com/
smatch warnings:
drivers/clk/realtek/clk-regmap-mux.c:23 clk_regmap_mux_get_parent() warn: signedness bug returning '(-22)'
vim +23 drivers/clk/realtek/clk-regmap-mux.c
f53de7a7df69f0 Yu-Chun Lin 2025-12-29 9 static u8 clk_regmap_mux_get_parent(struct clk_hw *hw)
^^
This function returns negative error codes so it needs to be type int.
f53de7a7df69f0 Yu-Chun Lin 2025-12-29 10 {
f53de7a7df69f0 Yu-Chun Lin 2025-12-29 11 struct clk_regmap_mux *clkm = to_clk_regmap_mux(hw);
f53de7a7df69f0 Yu-Chun Lin 2025-12-29 12 int num_parents = clk_hw_get_num_parents(hw);
f53de7a7df69f0 Yu-Chun Lin 2025-12-29 13 u32 val;
f53de7a7df69f0 Yu-Chun Lin 2025-12-29 14 int ret;
f53de7a7df69f0 Yu-Chun Lin 2025-12-29 15
f53de7a7df69f0 Yu-Chun Lin 2025-12-29 16 ret = regmap_read(clkm->clkr.regmap, clkm->mux_ofs, &val);
f53de7a7df69f0 Yu-Chun Lin 2025-12-29 17 if (ret)
f53de7a7df69f0 Yu-Chun Lin 2025-12-29 18 return ret;
f53de7a7df69f0 Yu-Chun Lin 2025-12-29 19
f53de7a7df69f0 Yu-Chun Lin 2025-12-29 20 val = val >> clkm->shift & clkm->mask;
f53de7a7df69f0 Yu-Chun Lin 2025-12-29 21
f53de7a7df69f0 Yu-Chun Lin 2025-12-29 22 if (val >= num_parents)
f53de7a7df69f0 Yu-Chun Lin 2025-12-29 @23 return -EINVAL;
f53de7a7df69f0 Yu-Chun Lin 2025-12-29 24
f53de7a7df69f0 Yu-Chun Lin 2025-12-29 25 return val;
f53de7a7df69f0 Yu-Chun Lin 2025-12-29 26 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2026-01-05 12:04 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-29 7:53 [PATCH 0/9] clk: realtek: Add RTD1625 Clock Support Yu-Chun Lin
2025-12-29 7:53 ` [PATCH 1/9] dt-bindings: clock: Add Realtek RTD1625 Clock & Reset Controller Yu-Chun Lin
2025-12-30 12:11 ` Krzysztof Kozlowski
2026-01-02 5:46 ` Yu-Chun Lin [林祐君]
2025-12-29 7:53 ` [PATCH 2/9] clk: realtek: Add basic reset support Yu-Chun Lin
2025-12-30 12:20 ` Krzysztof Kozlowski
2026-01-02 5:56 ` Yu-Chun Lin [林祐君]
2025-12-29 7:53 ` [PATCH 3/9] clk: realtek: Introduce a common probe() Yu-Chun Lin
2025-12-30 12:17 ` Krzysztof Kozlowski
2025-12-30 18:03 ` kernel test robot
2025-12-30 18:14 ` kernel test robot
2025-12-29 7:53 ` [PATCH 4/9] clk: realtek: Add support for phase locked loops (PLLs) Yu-Chun Lin
2025-12-30 20:18 ` kernel test robot
2025-12-29 7:53 ` [PATCH 5/9] clk: realtek: Add support for gate clock Yu-Chun Lin
2025-12-29 7:53 ` [PATCH 6/9] clk: realtek: Add support for mux clock Yu-Chun Lin
2026-01-05 12:04 ` Dan Carpenter
2025-12-29 7:53 ` [PATCH 7/9] clk: realtek: Add support for MMC-tuned PLL clocks Yu-Chun Lin
2025-12-29 7:53 ` [PATCH 8/9] clk: realtek: Add RTD1625-CRT clock controller driver Yu-Chun Lin
2025-12-30 12:15 ` Krzysztof Kozlowski
2025-12-29 7:53 ` [PATCH 9/9] clk: realtek: Add RTD1625-ISO " Yu-Chun Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).