ARM64: dts: meson: hhi syscon and clock controllers
Subsystems (4)
Jerome Brunet
maintainercover ARM64: dts: meson: hhi syscon and clock controllers
The HHI register region provides more than just clocks. Several drivers may need to access this region, such as the clock controllers and the display driver.
Meson-gx clock controllers has been developed and merged before we knew the hhi could be needed elsewhere, which is why it requests the region directly. Meson-axg was built following the model of meson-gx.
To fix this situation, the clock controller should be a child of the hhi system controllers. The hhi system controller node already exists on meson-gx. It needs to be added on the axg.
This changeset depends on [0]. This dependency has been merged in clk-next. A topic branch is available here [1]
[0]: https://lkml.kernel.org/r/20180212145846.19380-1-jbrunet at baylibre.com [1]: https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git/log/?h=clk-amlogic
Jerome Brunet (4):
dt-bindings: clock: meson: update documentation with hhi syscon
ARM64: dts: meson-gx: sysctrl is the parent of the clock controller
ARM64: dts: meson-axg: use hhi syscon for the clock controller
ARM64: dts: meson-gx: fix gxl clock controller compatible
.../devicetree/bindings/clock/amlogic,gxbb-clkc.txt | 16 +++++++++++----- arch/arm64/boot/dts/amlogic/meson-axg.dtsi | 12 ++++++++---- arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 5 ++--- arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 7 +++---- 4 files changed, 24 insertions(+), 16 deletions(-)
Signature · 1 line
2.14.3
Jerome Brunet
maintainerPATCH 1/4 dt-bindings: clock: meson: update documentation with hhi syscon
The HHI register region hosts more than just clocks and needs to accessed drivers other than the clock controller, such as the display driver.
This register region should be managed by syscon. It is already the case on gxbb/gxl and it soon will be on axg. The clock controllers must use this system controller instead of directly mapping the registers.
This changes the bindings of gxbb and axg's clock controllers. This is due to an initial 'incomplete' knowledge of these SoCs, which is why the meson bindings are unstable ATM.
--- .../devicetree/bindings/clock/amlogic,gxbb-clkc.txt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/clock/amlogic,gxbb-clkc.txt +11 -5
@@ -10,9 +10,6 @@ Required Properties: "amlogic,gxl-clkc" for GXL and GXM SoC, "amlogic,axg-clkc" for AXG SoC. -- reg: physical base address of the clock controller and length of memory - mapped region. - - #clock-cells: should be 1. Each clock is assigned an identifier and client nodes can use this identifier
@@ -20,13 +17,22 @@ to specify the clock which they consume. All available clocks are defined as preprocessor macros in the dt-bindings/clock/gxbb-clkc.h header and can be used in device tree sources. +Parent node should have the following properties : +- compatible: "syscon", "simple-mfd, and "amlogic,meson-gx-hhi-sysctrl" or + "amlogic,meson-axg-hhi-sysctrl" +- reg: base address and size of the HHI system control register space. + Example: Clock controller node: - clkc: clock-controller at c883c000 { +sysctrl: system-controller at 0 { + compatible = "amlogic,meson-gx-hhi-sysctrl", "syscon", "simple-mfd"; + reg = <0 0 0 0x400>; + + clkc: clock-controller { #clock-cells = <1>; compatible = "amlogic,gxbb-clkc"; - reg = <0x0 0xc883c000 0x0 0x3db>; }; +}; Example: UART controller node that consumes the clock generated by the clock controller:
Signature · 1 line
2.14.3
Jerome Brunet
maintainerPATCH 2/4 ARM64: dts: meson-gx: sysctrl is the parent of the clock controller
In reply to Jerome BrunetThe parent of the meson-gx clock controller should be the hhi system controller, not the HIU bus. This way, the HHI register region can be used safely by multiple drivers
--- arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 5 ++--- arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi +2 -3
@@ -304,11 +304,10 @@ clock-names = "isfr", "iahb", "venci"; }; -&hiubus { - clkc: clock-controller at 0 { +&sysctrl { + clkc: clock-controller { compatible = "amlogic,gxbb-clkc"; #clock-cells = <1>; - reg = <0x0 0x0 0x0 0x3db>; }; };
arch/arm64/boot/dts/amlogic/meson-gxl.dtsi +2 -3
@@ -206,11 +206,10 @@ clock-names = "isfr", "iahb", "venci"; }; -&hiubus { - clkc: clock-controller at 0 { +&sysctrl { + clkc: clock-controller { compatible = "amlogic,gxl-clkc", "amlogic,gxbb-clkc"; #clock-cells = <1>; - reg = <0x0 0x0 0x0 0x3db>; }; };
Signature · 1 line
2.14.3
Jerome Brunet
maintainerPATCH 3/4 ARM64: dts: meson-axg: use hhi syscon for the clock controller
In reply to Jerome BrunetLike the meson-gx, the axg clock controller should go through a syscon to access the hhi register region, and not directly map the region. This way, the hhi register region can be used safely by multiple drivers.
--- arch/arm64/boot/dts/amlogic/meson-axg.dtsi | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/amlogic/meson-axg.dtsi +8 -4
@@ -262,10 +262,14 @@ #size-cells = <2>; ranges = <0x0 0x0 0x0 0xff63c000 0x0 0x1c00>; - clkc: clock-controller at 0 { - compatible = "amlogic,axg-clkc"; - #clock-cells = <1>; - reg = <0x0 0x0 0x0 0x320>; + sysctrl: system-controller at 0 { + compatible = "amlogic,meson-axg-hhi-sysctrl", "syscon", "simple-mfd"; + reg = <0 0 0 0x400>; + + clkc: clock-controller { + compatible = "amlogic,axg-clkc"; + #clock-cells = <1>; + }; }; };
Signature · 1 line
2.14.3
Jerome Brunet
maintainerPATCH 4/4 ARM64: dts: meson-gx: fix gxl clock controller compatible
In reply to Jerome BrunetThere are a few differences between the gxbb and gxl clock controllers which makes them incompatible. The hdmi, gp0 and fixed pll are different. The rate of these plls reported by gxbb driver on a gxl device would be wrong.
Remove the gxbb compatible from the gxl clock controller node so only the correct driver is matched.
--- arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/amlogic/meson-gxl.dtsi +1 -1
@@ -208,7 +208,7 @@ &sysctrl { clkc: clock-controller { - compatible = "amlogic,gxl-clkc", "amlogic,gxbb-clkc"; + compatible = "amlogic,gxl-clkc"; #clock-cells = <1>; }; };
Signature · 1 line
2.14.3
Rob Herring
maintainerRe: [PATCH 1/4] dt-bindings: clock: meson: update documentation with hhi syscon
In reply to Jerome BrunetQuoted 7 lines · Jerome Brunet
The HHI register region hosts more than just clocks and needs to accessed drivers other than the clock controller, such as the display driver.
This register region should be managed by syscon. It is already the case on gxbb/gxl and it soon will be on axg. The clock controllers must use this system controller instead of directly mapping the registers.
Sounds like a kernel problem, not a DT one.
Quoted 31 lines
This changes the bindings of gxbb and axg's clock controllers. This is due to an initial 'incomplete' knowledge of these SoCs, which is why the meson bindings are unstable ATM.
Signed-off-by Jerome Brunet <[email protected]>--- .../devicetree/bindings/clock/amlogic,gxbb-clkc.txt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)Documentation/devicetree/bindings/clock/amlogic,gxbb-clkc.txt +3
-3@@ -10,9 +10,6 @@ Required Properties: "amlogic,gxl-clkc" for GXL and GXM SoC, "amlogic,axg-clkc" for AXG SoC. -- reg: physical base address of the clock controller and length of memory - mapped region. - - #clock-cells: should be 1. Each clock is assigned an identifier and client nodes can use this identifier@@ -20,13 +17,22 @@ to specify the clock which they consume. All available clocks are defined as preprocessor macros in the dt-bindings/clock/gxbb-clkc.h header and can be used in device tree sources. +Parent node should have the following properties : +- compatible: "syscon", "simple-mfd, and "amlogic,meson-gx-hhi-sysctrl" or + "amlogic,meson-axg-hhi-sysctrl"
Documentation/devicetree/bindings/clock/amlogic,gxbb-clkc.txt to specify the clock which they consume. All available clocks are defined as · line 31
Quoted 10 lines
Documentation/devicetree/bindings/clock/amlogic,gxbb-clkc.txt +7
-1+- reg: base address and size of the HHI system control register space. + Example: Clock controller node: - clkc: clock-controller at c883c000 { +sysctrl: system-controller at 0 { + compatible = "amlogic,meson-gx-hhi-sysctrl", "syscon", "simple-mfd"; + reg = <0 0 0 0x400>; + + clkc: clock-controller {
With a single child, there is really no point to this change. A single node can provide multiple functions. Look at nodes that are both reset and clock providers.
What other functions are there?
Rob
Jerome Brunet
maintainerRe: [PATCH 1/4] dt-bindings: clock: meson: update documentation with hhi syscon
Quoted 10 lines · Rob Herring
Quoted 7 lines · Jerome Brunet
The HHI register region hosts more than just clocks and needs to accessed drivers other than the clock controller, such as the display driver.
This register region should be managed by syscon. It is already the case on gxbb/gxl and it soon will be on axg. The clock controllers must use this system controller instead of directly mapping the registers.
Sounds like a kernel problem, not a DT one.
It's a platform problem, so it has much a kernel problem (solution already merged) as a DT problem
DT wise, we've got two devices mapping the same region
in arch/arm64/boot/dts/amlogic/meson-gx.dtsi:
Quoted 1 line
system-controller at 0
which is used by the display device.
and in arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi (same for gxl)
Quoted 1 line
clock-controller at 0
It has worked so far because the clock controller claims the region w/o reserving it but it remains unsafe since both device may access the same region. The fix is to have the clock controller go through the existing syscon.
Quoted 6 lines
Quoted 2 lines
With a single child, there is really no point to this change. A single node can provide multiple functions. Look at nodes that are both reset and clock providers.
There is more than a single user, as explained above and in the cover letter of this series.
Quoted 4 lines
What other functions are there?
Rob
Rob Herring
maintainerRe: [PATCH 1/4] dt-bindings: clock: meson: update documentation with hhi syscon
Quoted 20 lines · Jerome Brunet
Quoted 10 lines · Rob Herring
Quoted 7 lines · Jerome Brunet
The HHI register region hosts more than just clocks and needs to accessed drivers other than the clock controller, such as the display driver.
This register region should be managed by syscon. It is already the case on gxbb/gxl and it soon will be on axg. The clock controllers must use this system controller instead of directly mapping the registers.
Sounds like a kernel problem, not a DT one.
It's a platform problem, so it has much a kernel problem (solution already merged) as a DT problem
DT wise, we've got two devices mapping the same region
in
arch/arm64/boot/dts/amlogic/meson-gx.dtsi:Quoted 1 line
system-controller at 0
Quoted 8 lines
which is used by the display device.
and in
arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi(same for gxl)Quoted 1 line
clock-controller at 0
It has worked so far because the clock controller claims the region w/o reserving it but it remains unsafe since both device may access the same region. The fix is to have the clock controller go through the existing syscon.
We certainly want to avoid multiple nodes using the same mmio region.
Quoted 6 lines
Quoted 3 lines
With a single child, there is really no point to this change. A single node can provide multiple functions. Look at nodes that are both reset and clock providers.
There is more than a single user, as explained above and in the cover letter of this series.
Right, but a single node can support more than a single user (or provider). You don't have to have multiple nodes to have multiple users/providers.
Rob
Re: [PATCH 1/4] dt-bindings: clock: meson: update documentation with hhi syscon
Quoted 37 lines · Rob Herring
Quoted 20 lines · Jerome Brunet
Quoted 10 lines · Rob Herring
Quoted 7 lines · Jerome Brunet
The HHI register region hosts more than just clocks and needs to accessed drivers other than the clock controller, such as the display driver.
This register region should be managed by syscon. It is already the case on gxbb/gxl and it soon will be on axg. The clock controllers must use this system controller instead of directly mapping the registers.
Sounds like a kernel problem, not a DT one.
It's a platform problem, so it has much a kernel problem (solution already merged) as a DT problem
DT wise, we've got two devices mapping the same region
in
arch/arm64/boot/dts/amlogic/meson-gx.dtsi:Quoted 1 line
system-controller at 0
Quoted 8 lines
which is used by the display device.
and in
arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi(same for gxl)Quoted 1 line
clock-controller at 0
It has worked so far because the clock controller claims the region w/o reserving it but it remains unsafe since both device may access the same region. The fix is to have the clock controller go through the existing syscon.
We certainly want to avoid multiple nodes using the same mmio region.
Quoted 4 lines
Quoted 3 lines
With a single child, there is really no point to this change. A single node can provide multiple functions. Look at nodes that are both reset and clock providers.
Quoted 9 lines
Quoted 2 lines
There is more than a single user, as explained above and in the cover letter of this series.
Right, but a single node can support more than a single user (or provider). You don't have to have multiple nodes to have multiple users/providers.
Rob
Hi Rob,
It's a question about user/provider, the syscon node represents the entire mmio region which has multiple sparse registers for multiple features, is used indirectly by the display driver, ... and has multiple features, non limited to, clock controller, multiple power domains,... and it is simpler to represent these as subnodes instead of a big fat node.
Today, it is already represented like this within the Documentation/devicetree/bindings/power/amlogic,meson-gx-pwrc.txt So this binding is only an extension for the clock controller which was mis-architectured
at the time due to a mis-knowledge of the HW architecture.
Neil
Kevin Hilman
maintainerQuoted 8 lines · Jerome Brunet
The HHI register region provides more than just clocks. Several drivers may need to access this region, such as the clock controllers and the display driver.
Meson-gx clock controllers has been developed and merged before we knew the hhi could be needed elsewhere, which is why it requests the region directly. Meson-axg was built following the model of meson-gx.
Quoted 6 lines
To fix this situation, the clock controller should be a child of the hhi system controllers. The hhi system controller node already exists on meson-gx. It needs to be added on the axg.
This changeset depends on [0]. This dependency has been merged in clk-next. A topic branch is available here [1]
As the dependencies are now merged for v4.17, applying this to v4.18/dt64,
Thanks,
Kevin