Support clock and reset unit of Rockchip RK3528
Subsystems (4)
v2 cover Support clock and reset unit of Rockchip RK3528
Similar to previous Rockchip SoCs, reset controller on RK3528 shares MMIO region with clock controller, combined as CRU. They're represented as a single node in dt.
For the reset controller, only bindings are included in this series because it's hard to test the reset controller without support for some peripherals (e.g. pinctrl). I'd like to first make dt and basic peripherals available, then submit the driver.
This is tested on Radxa E20C board. With some out-of-tree drivers, I've successfully brouhgt up UART, pinctrl/gpio and I2C. A clock dump could be obtained from [1].
[1]: https://gist.github.com/ziyao233/032961d1eebeecb9a41fea2d690e8351
Yao Zi (5):
dt-bindings: clock: Document clock and reset unit of RK3528
clk: rockchip: Add PLL flag ROCKCHIP_PLL_FIXED_MODE
clk: rockchip: Add clock controller driver for RK3528 SoC
arm64: dts: rockchip: Add clock generators for RK3528 SoC
arm64: dts: rockchip: Add UART clocks for RK3528 SoC
.../bindings/clock/rockchip,rk3528-cru.yaml | 67 + arch/arm64/boot/dts/rockchip/rk3528.dtsi | 68 +- drivers/clk/rockchip/Kconfig | 7 + drivers/clk/rockchip/Makefile | 1 + drivers/clk/rockchip/clk-pll.c | 10 +- drivers/clk/rockchip/clk-rk3528.c | 1114 +++++++++++++++++ drivers/clk/rockchip/clk.h | 22 + .../dt-bindings/clock/rockchip,rk3528-cru.h | 453 +++++++ .../dt-bindings/reset/rockchip,rk3528-cru.h | 241 ++++ 9 files changed, 1978 insertions(+), 5 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml create mode 100644 drivers/clk/rockchip/clk-rk3528.c create mode 100644 include/dt-bindings/clock/rockchip,rk3528-cru.h create mode 100644 include/dt-bindings/reset/rockchip,rk3528-cru.h
Signature · 1 line
2.47.1
PATCH v2 1/5 dt-bindings: clock: Document clock and reset unit of RK3528
There are two types of clocks in RK3528 SoC, CRU-managed and SCMI-managed. Independent IDs are assigned to them.
For the reset part, differing from previous Rockchip SoCs and downstream bindings which embeds register offsets into the IDs, gapless numbers starting from zero are used.
--- .../bindings/clock/rockchip,rk3528-cru.yaml | 67 +++ .../dt-bindings/clock/rockchip,rk3528-cru.h | 453 ++++++++++++++++++ .../dt-bindings/reset/rockchip,rk3528-cru.h | 241 ++++++++++ 3 files changed, 761 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml create mode 100644 include/dt-bindings/clock/rockchip,rk3528-cru.h create mode 100644 include/dt-bindings/reset/rockchip,rk3528-cru.h
Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml new file +67 -0
@@ -0,0 +1,67 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/rockchip,rk3528-cru.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip RK3528 Clock and Reset Controller + +maintainers: + - Yao Zi <[email protected]> + +description: | + The RK3528 clock controller generates the clock and also implements a reset + controller for SoC peripherals. For example, it provides SCLK_UART0 and + PCLK_UART0 as well as SRST_P_UART0 and SRST_S_UART0 for the first UART + module. + Each clock is assigned an identifier, consumer nodes can use it to specify + the clock. All available clock and reset IDs are defined in dt-binding + headers. + +properties: + compatible: + const: rockchip,rk3528-cru + + reg: + maxItems: 1 + + assigned-clocks: true + + assigned-clock-rates: true + + clocks: + items: + - description: External 24MHz oscillator clock + - description: 50MHz clock generated by PHY module + + clock-names: + items: + - const: xin24m + - const: gmac0 + + "#clock-cells": + const: 1 + + "#reset-cells": + const: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - "#clock-cells" + - "#reset-cells" + +additionalProperties: false + +examples: + - | + clock-controller@ff4a0000 { + compatible = "rockchip,rk3528-cru"; + reg = <0xff4a0000 0x30000>; + clocks = <&xin24m>, <&gmac0_clk>; + clock-names = "xin24m", "gmac0"; + #clock-cells = <1>; + #reset-cells = <1>; + };
include/dt-bindings/clock/rockchip,rk3528-cru.h new file +453 -0
453 lines not on this page · raw message
include/dt-bindings/reset/rockchip,rk3528-cru.h new file +241 -0
241 lines not on this page · raw message
Signature · 1 line
2.47.1
Re: [PATCH v2 1/5] dt-bindings: clock: Document clock and reset unit of RK3528
Quoted 43 lines · Yao Zi
There are two types of clocks in RK3528 SoC, CRU-managed and SCMI-managed. Independent IDs are assigned to them.
For the reset part, differing from previous Rockchip SoCs and downstream bindings which embeds register offsets into the IDs, gapless numbers starting from zero are used.
Signed-off-by Yao Zi <[email protected]>--- .../bindings/clock/rockchip,rk3528-cru.yaml | 67 +++ .../dt-bindings/clock/rockchip,rk3528-cru.h | 453 ++++++++++++++++++ .../dt-bindings/reset/rockchip,rk3528-cru.h | 241 ++++++++++ 3 files changed, 761 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml create mode 100644 include/dt-bindings/clock/rockchip,rk3528-cru.h create mode 100644 include/dt-bindings/reset/rockchip,rk3528-cru.hDocumentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml new file +20
-0@@ -0,0 +1,67 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/rockchip,rk3528-cru.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip RK3528 Clock and Reset Controller + +maintainers: + - Yao Zi <[email protected]> + +description: | + The RK3528 clock controller generates the clock and also implements a reset + controller for SoC peripherals. For example, it provides SCLK_UART0 and + PCLK_UART0 as well as SRST_P_UART0 and SRST_S_UART0 for the first UART + module. + Each clock is assigned an identifier, consumer nodes can use it to specify + the clock. All available clock and reset IDs are defined in dt-binding + headers. +
Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml line 30
Quoted 10 lines
Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml new file +10
-0+properties: + compatible: + const: rockchip,rk3528-cru + + reg: + maxItems: 1 + + assigned-clocks: true + + assigned-clock-rates: true
Drop both, totally redundant.
Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml line 40
Quoted 10 lines
Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml new file +10
-0+ + clocks: + items: + - description: External 24MHz oscillator clock + - description: 50MHz clock generated by PHY module + + clock-names: + items: + - const: xin24m + - const: gmac0
gmac
(unless you have gmac1 here as well but then please add it now)
Best regards,
Krzysztof
Re: [PATCH v2 1/5] dt-bindings: clock: Document clock and reset unit of RK3528
Quoted 48 lines · Krzysztof Kozlowski
Quoted 47 lines · Yao Zi
There are two types of clocks in RK3528 SoC, CRU-managed and SCMI-managed. Independent IDs are assigned to them.
For the reset part, differing from previous Rockchip SoCs and downstream bindings which embeds register offsets into the IDs, gapless numbers starting from zero are used.
Signed-off-by Yao Zi <[email protected]>--- .../bindings/clock/rockchip,rk3528-cru.yaml | 67 +++ .../dt-bindings/clock/rockchip,rk3528-cru.h | 453 ++++++++++++++++++ .../dt-bindings/reset/rockchip,rk3528-cru.h | 241 ++++++++++ 3 files changed, 761 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml create mode 100644 include/dt-bindings/clock/rockchip,rk3528-cru.h create mode 100644 include/dt-bindings/reset/rockchip,rk3528-cru.hDocumentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml new file +24
-0@@ -0,0 +1,67 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/rockchip,rk3528-cru.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip RK3528 Clock and Reset Controller + +maintainers: + - Yao Zi <[email protected]> + +description: | + The RK3528 clock controller generates the clock and also implements a reset + controller for SoC peripherals. For example, it provides SCLK_UART0 and + PCLK_UART0 as well as SRST_P_UART0 and SRST_S_UART0 for the first UART + module. + Each clock is assigned an identifier, consumer nodes can use it to specify + the clock. All available clock and reset IDs are defined in dt-binding + headers. + +properties: + compatible: + const: rockchip,rk3528-cru +
Quoted 8 lines
Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml line 30
Quoted 6 lines
Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml new file +6
-0+ reg: + maxItems: 1 + + assigned-clocks: true + + assigned-clock-rates: trueDrop both, totally redundant.
Okay, will fix in next version.
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml new file +5
-0+ + clocks: + items: + - description: External 24MHz oscillator clock + - description: 50MHz clock generated by PHY module
Quoted 8 lines
Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml line 40
Quoted 5 lines
Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml new file +5
-0+ + clock-names: + items: + - const: xin24m + - const: gmac0gmac
(unless you have gmac1 here as well but then please add it now)
RK3528 comes with two onchip gmacs. This input clock is only used for the first one and I think keeping the number would give the reader an extra hint. What do you think about it?
Quoted 4 lines
Best regards,
Krzysztof
Thanks,
Yao Zi
Heiko Stübner
maintainerRe: [PATCH v2 1/5] dt-bindings: clock: Document clock and reset unit of RK3528
Am Donnerstag, 9. Januar 2025, 10:16:12 CET schrieb Yao Zi:
Quoted 58 lines · Krzysztof Kozlowski
Quoted 48 lines · Yao Zi
Quoted 47 lines
There are two types of clocks in RK3528 SoC, CRU-managed and SCMI-managed. Independent IDs are assigned to them.
For the reset part, differing from previous Rockchip SoCs and downstream bindings which embeds register offsets into the IDs, gapless numbers starting from zero are used.
Signed-off-by Yao Zi <[email protected]>--- .../bindings/clock/rockchip,rk3528-cru.yaml | 67 +++ .../dt-bindings/clock/rockchip,rk3528-cru.h | 453 ++++++++++++++++++ .../dt-bindings/reset/rockchip,rk3528-cru.h | 241 ++++++++++ 3 files changed, 761 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml create mode 100644 include/dt-bindings/clock/rockchip,rk3528-cru.h create mode 100644 include/dt-bindings/reset/rockchip,rk3528-cru.hDocumentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml new file +24
-0@@ -0,0 +1,67 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/rockchip,rk3528-cru.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip RK3528 Clock and Reset Controller + +maintainers: + - Yao Zi <[email protected]> + +description: | + The RK3528 clock controller generates the clock and also implements a reset + controller for SoC peripherals. For example, it provides SCLK_UART0 and + PCLK_UART0 as well as SRST_P_UART0 and SRST_S_UART0 for the first UART + module. + Each clock is assigned an identifier, consumer nodes can use it to specify + the clock. All available clock and reset IDs are defined in dt-binding + headers. + +properties: + compatible: + const: rockchip,rk3528-cru +Quoted 8 lines
Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml line 30
Quoted 6 lines
Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml new file +6
-0+ reg: + maxItems: 1 + + assigned-clocks: true + + assigned-clock-rates: trueDrop both, totally redundant.
Quoted 7 lines
Okay, will fix in next version.
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml new file +5
-0+ + clocks: + items: + - description: External 24MHz oscillator clock + - description: 50MHz clock generated by PHY module
you could adjust the description to something like
50MHz clock generated by PHY module only for gmac0
or so, to make it more clear where that signal goes to.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml new file +5
-0+ + clock-names: + items: + - const: xin24m + - const: gmac0
Quoted 6 lines
Quoted 2 lines
gmac
(unless you have gmac1 here as well but then please add it now)RK3528 comes with two onchip gmacs. This input clock is only used for the first one and I think keeping the number would give the reader an extra hint. What do you think about it?
I would agree here. Looking through the TRM registers, gmac0 gets _only_ supplied from that external input, while gmac1 only gets supplied from a number of internal sources (different sources for gmac1-specific clocks)
Heiko
Re: [PATCH v2 1/5] dt-bindings: clock: Document clock and reset unit of RK3528
In reply to Yao ZiQuoted 74 lines · Yao Zi
Quoted 48 lines · Krzysztof Kozlowski
Quoted 47 lines · Yao Zi
There are two types of clocks in RK3528 SoC, CRU-managed and SCMI-managed. Independent IDs are assigned to them.
For the reset part, differing from previous Rockchip SoCs and downstream bindings which embeds register offsets into the IDs, gapless numbers starting from zero are used.
Signed-off-by Yao Zi <[email protected]>--- .../bindings/clock/rockchip,rk3528-cru.yaml | 67 +++ .../dt-bindings/clock/rockchip,rk3528-cru.h | 453 ++++++++++++++++++ .../dt-bindings/reset/rockchip,rk3528-cru.h | 241 ++++++++++ 3 files changed, 761 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml create mode 100644 include/dt-bindings/clock/rockchip,rk3528-cru.h create mode 100644 include/dt-bindings/reset/rockchip,rk3528-cru.hDocumentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml new file +24
-0@@ -0,0 +1,67 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/rockchip,rk3528-cru.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip RK3528 Clock and Reset Controller + +maintainers: + - Yao Zi <[email protected]> + +description: | + The RK3528 clock controller generates the clock and also implements a reset + controller for SoC peripherals. For example, it provides SCLK_UART0 and + PCLK_UART0 as well as SRST_P_UART0 and SRST_S_UART0 for the first UART + module. + Each clock is assigned an identifier, consumer nodes can use it to specify + the clock. All available clock and reset IDs are defined in dt-binding + headers. + +properties: + compatible: + const: rockchip,rk3528-cru +Quoted 8 lines
Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml line 30
Quoted 6 lines
Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml new file +6
-0+ reg: + maxItems: 1 + + assigned-clocks: true + + assigned-clock-rates: trueDrop both, totally redundant.
Okay, will fix in next version.
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml new file +5
-0+ + clocks: + items: + - description: External 24MHz oscillator clock + - description: 50MHz clock generated by PHY moduleQuoted 8 lines
Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml line 40
Quoted 5 lines
Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml new file +5
-0+ + clock-names: + items: + - const: xin24m + - const: gmac0gmac
(unless you have gmac1 here as well but then please add it now)
Quoted 3 lines
RK3528 comes with two onchip gmacs. This input clock is only used for the first one and I think keeping the number would give the reader an extra hint. What do you think about it?
You don't get the point. What clock is from this module perspective? gmac.
Best regards,
Krzysztof
Re: [PATCH v2 1/5] dt-bindings: clock: Document clock and reset unit of RK3528
Quoted 75 lines · Krzysztof Kozlowski
Quoted 74 lines · Yao Zi
Quoted 48 lines · Krzysztof Kozlowski
Quoted 47 lines · Yao Zi
There are two types of clocks in RK3528 SoC, CRU-managed and SCMI-managed. Independent IDs are assigned to them.
For the reset part, differing from previous Rockchip SoCs and downstream bindings which embeds register offsets into the IDs, gapless numbers starting from zero are used.
Signed-off-by Yao Zi <[email protected]>--- .../bindings/clock/rockchip,rk3528-cru.yaml | 67 +++ .../dt-bindings/clock/rockchip,rk3528-cru.h | 453 ++++++++++++++++++ .../dt-bindings/reset/rockchip,rk3528-cru.h | 241 ++++++++++ 3 files changed, 761 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml create mode 100644 include/dt-bindings/clock/rockchip,rk3528-cru.h create mode 100644 include/dt-bindings/reset/rockchip,rk3528-cru.hDocumentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml new file +24
-0@@ -0,0 +1,67 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/rockchip,rk3528-cru.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip RK3528 Clock and Reset Controller + +maintainers: + - Yao Zi <[email protected]> + +description: | + The RK3528 clock controller generates the clock and also implements a reset + controller for SoC peripherals. For example, it provides SCLK_UART0 and + PCLK_UART0 as well as SRST_P_UART0 and SRST_S_UART0 for the first UART + module. + Each clock is assigned an identifier, consumer nodes can use it to specify + the clock. All available clock and reset IDs are defined in dt-binding + headers. + +properties: + compatible: + const: rockchip,rk3528-cru +Quoted 8 lines
Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml line 30
Quoted 6 lines
Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml new file +6
-0+ reg: + maxItems: 1 + + assigned-clocks: true + + assigned-clock-rates: trueDrop both, totally redundant.
Okay, will fix in next version.
Quoted 13 lines
Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml line 40
Quoted 10 lines
Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml new file +10
-0+ + clocks: + items: + - description: External 24MHz oscillator clock + - description: 50MHz clock generated by PHY module + + clock-names: + items: + - const: xin24m + - const: gmac0gmac
(unless you have gmac1 here as well but then please add it now)
Quoted 4 lines
Quoted 3 lines
RK3528 comes with two onchip gmacs. This input clock is only used for the first one and I think keeping the number would give the reader an extra hint. What do you think about it?
You don't get the point. What clock is from this module perspective? gmac.
I'm not sure what "from this module perspective" means. If it's about the source of the input clock, it's also gmac0 and gmac1 has nothing to do with it. Pointing this out explicitly brings us (and the later reader) only extra information.
And in the previous series, Conor mentioned[1],
Quoted 2 lines
clocks should be named after how they're used in the IP in question, not the name of the source of that clock in the SoC.
Since its usage is exactly to generate clocks required by gmac0, as confirmed by Heiko, I consider gmac0 appropriate and am willing to make its description more clear.
Further explanation will be appreciated, thanks for your review.
Best regards,
Yao Zi
[1]: https://lore.kernel.org/linux-rockchip/20241001-name-stooge-7a939f71a08e@spud/
PATCH v2 2/5 clk: rockchip: Add PLL flag ROCKCHIP_PLL_FIXED_MODE
In reply to Yao ZiRK3528 comes with a new PLL variant: its "PPLL", which mainly generates clocks for the PCIe controller, operates in normal mode only. Let's describe it with flag ROCKCHIP_PLL_FIXED_MODE and handle it in code.
--- drivers/clk/rockchip/clk-pll.c | 10 ++++++---- drivers/clk/rockchip/clk.h | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/clk/rockchip/clk-pll.c +6 -4
@@ -204,10 +204,12 @@ static int rockchip_rk3036_pll_set_params(struct rockchip_clk_pll *pll,rockchip_rk3036_pll_get_params (pll, &cur); cur.rate =0 ; - cur_parent = pll_mux_ops->get_parent (&pll_mux->hw); -if (cur_parent ==PLL_MODE_NORM ) { - pll_mux_ops->set_parent (&pll_mux->hw,PLL_MODE_SLOW ); - rate_change_remuxed =1 ; +if (!(pll->flags &ROCKCHIP_PLL_FIXED_MODE )) { + cur_parent = pll_mux_ops->get_parent (&pll_mux->hw); +if (cur_parent ==PLL_MODE_NORM ) { + pll_mux_ops->set_parent (&pll_mux->hw,PLL_MODE_SLOW ); + rate_change_remuxed =1 ; + } }/* update pll values */
drivers/clk/rockchip/clk.h +2 -0
@@ -444,6 +444,7 @@ struct rockchip_pll_rate_table {* Flags: * ROCKCHIP_PLL_SYNC_RATE - check rate parameters to match against the * rate_table parameters and ajust them if necessary. +* ROCKCHIP_PLL_FIXED_MODE - the pll operates in normal mode only */ struct rockchip_pll_clock {unsigned int id;
@@ -461,6 +462,7 @@ struct rockchip_pll_clock { };#define ROCKCHIP_PLL_SYNC_RATE BIT(0) +#define ROCKCHIP_PLL_FIXED_MODE BIT(1)#define PLL (_type, _id, _name, _pnames, _flags, _con, _mode, _mshift, \ _lshift, _pflags, _rtable) \
Signature · 1 line
2.47.1
PATCH v2 3/5 clk: rockchip: Add clock controller driver for RK3528 SoC
In reply to Yao ZiAdd clock tree definition for RK3528. Similar to previous Rockchip SoCs, clock controller of RK3528 is combined with the reset controller. We omit the reset part for now since it's hard to test it without support for other basic peripherals.
--- drivers/clk/rockchip/Kconfig | 7 + drivers/clk/rockchip/Makefile | 1 + drivers/clk/rockchip/clk-rk3528.c | 1114 +++++++++++++++++++++++++++++ drivers/clk/rockchip/clk.h | 20 + 4 files changed, 1142 insertions(+) create mode 100644 drivers/clk/rockchip/clk-rk3528.c
drivers/clk/rockchip/Kconfig +7 -0
@@ -93,6 +93,13 @@ config CLK_RK3399 help Build the driver for RK3399 Clock Driver. +config CLK_RK3528 + bool "Rockchip RK3528 clock controller support" + depends on ARM64 || COMPILE_TEST + default y + help + Build the driver for RK3528 Clock Controller. + config CLK_RK3568 bool "Rockchip RK3568 clock controller support" depends on ARM64 || COMPILE_TEST
drivers/clk/rockchip/Makefile +1 -0
@@ -27,6 +27,7 @@ obj-$(CONFIG_CLK_RK3308) += clk-rk3308.o obj-$(CONFIG_CLK_RK3328) += clk-rk3328.o obj-$(CONFIG_CLK_RK3368) += clk-rk3368.o obj-$(CONFIG_CLK_RK3399) += clk-rk3399.o +obj-$(CONFIG_CLK_RK3528) += clk-rk3528.o obj-$(CONFIG_CLK_RK3568) += clk-rk3568.o obj-$(CONFIG_CLK_RK3576) += clk-rk3576.o rst-rk3576.o obj-$(CONFIG_CLK_RK3588) += clk-rk3588.o rst-rk3588.o
drivers/clk/rockchip/clk-rk3528.c new file +1114 -0
1,114 lines not on this page · raw message
drivers/clk/rockchip/clk.h +20 -0
@@ -207,6 +207,26 @@ struct clk;#define RK3399_PMU_CLKGATE_CON (x) ((x) * 0x4 + 0x100)#define RK3399_PMU_SOFTRST_CON (x) ((x) * 0x4 + 0x110) +#define RK3528_PMU_CRU_BASE 0x10000 +#define RK3528_PCIE_CRU_BASE 0x20000 +#define RK3528_DDRPHY_CRU_BASE 0x28000 +#define RK3528_PLL_CON (x) RK2928_PLL_CON(x) +#define RK3528_PCIE_PLL_CON (x) ((x) * 0x4 + RK3528_PCIE_CRU_BASE) +#define RK3528_DDRPHY_PLL_CON (x) ((x) * 0x4 + RK3528_DDRPHY_CRU_BASE) +#define RK3528_MODE_CON 0x280 +#define RK3528_CLKSEL_CON (x) ((x) * 0x4 + 0x300) +#define RK3528_CLKGATE_CON (x) ((x) * 0x4 + 0x800) +#define RK3528_SOFTRST_CON (x) ((x) * 0x4 + 0xa00) +#define RK3528_PMU_CLKSEL_CON (x) ((x) * 0x4 + 0x300 + RK3528_PMU_CRU_BASE) +#define RK3528_PMU_CLKGATE_CON (x) ((x) * 0x4 + 0x800 + RK3528_PMU_CRU_BASE) +#define RK3528_PCIE_CLKSEL_CON (x) ((x) * 0x4 + 0x300 + RK3528_PCIE_CRU_BASE) +#define RK3528_PCIE_CLKGATE_CON (x) ((x) * 0x4 + 0x800 + RK3528_PCIE_CRU_BASE) +#define RK3528_DDRPHY_CLKGATE_CON (x) ((x) * 0x4 + 0x800 + RK3528_DDRPHY_CRU_BASE) +#define RK3528_DDRPHY_MODE_CON (0x280 + RK3528_DDRPHY_CRU_BASE) +#define RK3528_GLB_CNT_TH 0xc00 +#define RK3528_GLB_SRST_FST 0xc08 +#define RK3528_GLB_SRST_SND 0xc0c +#define RK3568_PLL_CON (x) RK2928_PLL_CON(x)#define RK3568_MODE_CON0 0xc0#define RK3568_MISC_CON0 0xc4
Signature · 1 line
2.47.1
PATCH v2 4/5 arm64: dts: rockchip: Add clock generators for RK3528 SoC
In reply to Yao ZiAdd dt node for RK3528 clock and reset unit. Clock "gmac0_clk" is generated by internal Ethernet phy, a fixed clock node is added as a placeholder to avoid orphans.
--- arch/arm64/boot/dts/rockchip/rk3528.dtsi | 51 ++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
arch/arm64/boot/dts/rockchip/rk3528.dtsi +51 -0
@@ -6,6 +6,7 @@ #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/interrupt-controller/irq.h> +#include <dt-bindings/clock/rockchip,rk3528-cru.h> / { compatible = "rockchip,rk3528";
@@ -95,6 +96,13 @@ xin24m: clock-xin24m { #clock-cells = <0>; }; + gmac0_clk: clock-gmac50m { + compatible = "fixed-clock"; + clock-frequency = <50000000>; + clock-output-names = "gmac0"; + #clock-cells = <0>; + }; + soc { compatible = "simple-bus"; ranges = <0x0 0xfe000000 0x0 0xfe000000 0x0 0x2000000>;
@@ -114,6 +122,49 @@ gic: interrupt-controller@fed01000 { #interrupt-cells = <3>; }; + cru: clock-controller@ff4a0000 { + compatible = "rockchip,rk3528-cru"; + reg = <0x0 0xff4a0000 0x0 0x30000>; + assigned-clocks = + <&cru XIN_OSC0_DIV>, <&cru PLL_GPLL>, + <&cru PLL_PPLL>, <&cru PLL_CPLL>, + <&cru ARMCLK>, <&cru CLK_MATRIX_250M_SRC>, + <&cru CLK_MATRIX_500M_SRC>, + <&cru CLK_MATRIX_50M_SRC>, + <&cru CLK_MATRIX_100M_SRC>, + <&cru CLK_MATRIX_150M_SRC>, + <&cru CLK_MATRIX_200M_SRC>, + <&cru CLK_MATRIX_300M_SRC>, + <&cru CLK_MATRIX_339M_SRC>, + <&cru CLK_MATRIX_400M_SRC>, + <&cru CLK_MATRIX_600M_SRC>, + <&cru CLK_PPLL_50M_MATRIX>, + <&cru CLK_PPLL_100M_MATRIX>, + <&cru CLK_PPLL_125M_MATRIX>, + <&cru ACLK_BUS_VOPGL_ROOT>; + assigned-clock-rates = + <32768>, <1188000000>, + <1000000000>, <996000000>, + <408000000>, <250000000>, + <500000000>, + <50000000>, + <100000000>, + <150000000>, + <200000000>, + <300000000>, + <340000000>, + <400000000>, + <600000000>, + <50000000>, + <100000000>, + <125000000>, + <500000000>; + clocks = <&xin24m>, <&gmac0_clk>; + clock-names = "xin24m", "gmac0"; + #clock-cells = <1>; + #reset-cells = <1>; + }; + uart0: serial@ff9f0000 { compatible = "rockchip,rk3528-uart", "snps,dw-apb-uart"; reg = <0x0 0xff9f0000 0x0 0x100>;
Signature · 1 line
2.47.1
PATCH v2 5/5 arm64: dts: rockchip: Add UART clocks for RK3528 SoC
In reply to Yao ZiAdd missing clocks in UART nodes for RK3528 SoC.
--- arch/arm64/boot/dts/rockchip/rk3528.dtsi | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3528.dtsi +16 -1
@@ -168,7 +168,8 @@ cru: clock-controller@ff4a0000 { uart0: serial@ff9f0000 { compatible = "rockchip,rk3528-uart", "snps,dw-apb-uart"; reg = <0x0 0xff9f0000 0x0 0x100>; - clock-frequency = <24000000>; + clocks = <&cru SCLK_UART0>, <&cru PCLK_UART0>; + clock-names = "baudclk", "apb_pclk"; interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>; reg-io-width = <4>; reg-shift = <2>;
@@ -178,6 +179,8 @@ uart0: serial@ff9f0000 { uart1: serial@ff9f8000 { compatible = "rockchip,rk3528-uart", "snps,dw-apb-uart"; reg = <0x0 0xff9f8000 0x0 0x100>; + clocks = <&cru SCLK_UART1>, <&cru PCLK_UART1>; + clock-names = "baudclk", "apb_pclk"; interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>; reg-io-width = <4>; reg-shift = <2>;
@@ -187,6 +190,8 @@ uart1: serial@ff9f8000 { uart2: serial@ffa00000 { compatible = "rockchip,rk3528-uart", "snps,dw-apb-uart"; reg = <0x0 0xffa00000 0x0 0x100>; + clocks = <&cru SCLK_UART2>, <&cru PCLK_UART2>; + clock-names = "baudclk", "apb_pclk"; interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>; reg-io-width = <4>; reg-shift = <2>;
@@ -195,6 +200,8 @@ uart2: serial@ffa00000 { uart3: serial@ffa08000 { compatible = "rockchip,rk3528-uart", "snps,dw-apb-uart"; + clocks = <&cru SCLK_UART3>, <&cru PCLK_UART3>; + clock-names = "baudclk", "apb_pclk"; reg = <0x0 0xffa08000 0x0 0x100>; reg-io-width = <4>; reg-shift = <2>;
@@ -204,6 +211,8 @@ uart3: serial@ffa08000 { uart4: serial@ffa10000 { compatible = "rockchip,rk3528-uart", "snps,dw-apb-uart"; reg = <0x0 0xffa10000 0x0 0x100>; + clocks = <&cru SCLK_UART4>, <&cru PCLK_UART4>; + clock-names = "baudclk", "apb_pclk"; interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>; reg-io-width = <4>; reg-shift = <2>;
@@ -213,6 +222,8 @@ uart4: serial@ffa10000 { uart5: serial@ffa18000 { compatible = "rockchip,rk3528-uart", "snps,dw-apb-uart"; reg = <0x0 0xffa18000 0x0 0x100>; + clocks = <&cru SCLK_UART5>, <&cru PCLK_UART5>; + clock-names = "baudclk", "apb_pclk"; interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>; reg-io-width = <4>; reg-shift = <2>;
@@ -222,6 +233,8 @@ uart5: serial@ffa18000 { uart6: serial@ffa20000 { compatible = "rockchip,rk3528-uart", "snps,dw-apb-uart"; reg = <0x0 0xffa20000 0x0 0x100>; + clocks = <&cru SCLK_UART6>, <&cru PCLK_UART6>; + clock-names = "baudclk", "apb_pclk"; interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>; reg-io-width = <4>; reg-shift = <2>;
@@ -231,6 +244,8 @@ uart6: serial@ffa20000 { uart7: serial@ffa28000 { compatible = "rockchip,rk3528-uart", "snps,dw-apb-uart"; reg = <0x0 0xffa28000 0x0 0x100>; + clocks = <&cru SCLK_UART7>, <&cru PCLK_UART7>; + clock-names = "baudclk", "apb_pclk"; interrupts = <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>; reg-io-width = <4>; reg-shift = <2>;
Signature · 1 line
2.47.1
Quoted 9 lines · Yao Zi
Similar to previous Rockchip SoCs, reset controller on RK3528 shares MMIO region with clock controller, combined as CRU. They're represented as a single node in dt.
For the reset controller, only bindings are included in this series because it's hard to test the reset controller without support for some peripherals (e.g. pinctrl). I'd like to first make dt and basic peripherals available, then submit the driver.
Quoted 5 lines
This is tested on Radxa E20C board. With some out-of-tree drivers, I've successfully brouhgt up UART, pinctrl/gpio and I2C. A clock dump could be obtained from [1].
[1]: https://gist.github.com/ziyao233/032961d1eebeecb9a41fea2d690e8351
Oops, I forgot to attach the changelog. Sorry for the inconvenience and please refer to this,
- dt-binding changes
- relicense binding headers as GPL-2.0-only OR MIT
- use gapless integers starting from 0 for binding IDs
- make input clocks essential, add corresponding description
- rename the input clock that is generated by phy module as "gmac0"
- style fixes
- driver changes
- format in the common Rockchip driver style
- drop initializing code of the reset controller, as it'll not be supported in this series
Quoted 26 lines
Yao Zi (5):
dt-bindings: clock: Document clock and reset unit of RK3528
clk: rockchip: Add PLL flagROCKCHIP_PLL_FIXED_MODE
clk: rockchip: Add clock controller driver for RK3528 SoC
arm64: dts: rockchip: Add clock generators for RK3528 SoC
arm64: dts: rockchip: Add UART clocks for RK3528 SoC.../bindings/clock/rockchip,rk3528-cru.yaml | 67 + arch/arm64/boot/dts/rockchip/rk3528.dtsi | 68 +- drivers/clk/rockchip/Kconfig | 7 + drivers/clk/rockchip/Makefile | 1 + drivers/clk/rockchip/clk-pll.c | 10 +- drivers/clk/rockchip/clk-rk3528.c | 1114 +++++++++++++++++ drivers/clk/rockchip/clk.h | 22 + .../dt-bindings/clock/rockchip,rk3528-cru.h | 453 +++++++ .../dt-bindings/reset/rockchip,rk3528-cru.h | 241 ++++ 9 files changed, 1978 insertions(+), 5 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/rockchip,rk3528-cru.yaml create mode 100644 drivers/clk/rockchip/clk-rk3528.c create mode 100644 include/dt-bindings/clock/rockchip,rk3528-cru.h create mode 100644 include/dt-bindings/reset/rockchip,rk3528-cru.hSignature · 1 line
2.47.1