Add S4 SoC PLL and Peripheral clock controller
Subsystems (4)
v5 cover Add S4 SoC PLL and Peripheral clock controller
1. Add PLL and Peripheral clock controller driver for S4 SOC.
Yu Tu (4):
clk: meson: S4: add support for Amlogic S4 SoC PLL clock driver and
bindings
arm64: dts: meson: add S4 Soc PLL clock controller in DT
clk: meson: s4: add s4 SoC peripheral clock controller driver and
bindings
arm64: dts: meson: add S4 Soc Peripheral clock controller in DT
V4 -> V5: change format and clock flags and adjust the patch series as suggested by Jerome.
V3 -> V4: change format and clock flags.
V2 -> V3: Use two clock controller.
V1 -> V2: Change format as discussed in the email.
.../clock/amlogic,s4-peripherals-clkc.yaml | 105 + .../bindings/clock/amlogic,s4-pll-clkc.yaml | 51 + MAINTAINERS | 1 + arch/arm64/boot/dts/amlogic/meson-s4.dtsi | 34 + drivers/clk/meson/Kconfig | 25 + drivers/clk/meson/Makefile | 2 + drivers/clk/meson/s4-peripherals.c | 3783 +++++++++++++++++ drivers/clk/meson/s4-peripherals.h | 218 + drivers/clk/meson/s4-pll.c | 875 ++++ drivers/clk/meson/s4-pll.h | 88 + .../clock/amlogic,s4-peripherals-clkc.h | 131 + .../dt-bindings/clock/amlogic,s4-pll-clkc.h | 30 + 12 files changed, 5343 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/amlogic,s4-peripherals-clkc.yaml create mode 100644 Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml create mode 100644 drivers/clk/meson/s4-peripherals.c create mode 100644 drivers/clk/meson/s4-peripherals.h create mode 100644 drivers/clk/meson/s4-pll.c create mode 100644 drivers/clk/meson/s4-pll.h create mode 100644 include/dt-bindings/clock/amlogic,s4-peripherals-clkc.h create mode 100644 include/dt-bindings/clock/amlogic,s4-pll-clkc.h
base-commit: 5eeec1fd8360d57899d29a607ff81d0094e6cf59
Signature · 7 lines
2.33.1 _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic
PATCH v5 1/4 clk: meson: S4: add support for Amlogic S4 SoC PLL clock driver and bindings
Add the S4 PLL clock controller found and bindings in the s4 SoC family.
--- .../bindings/clock/amlogic,s4-pll-clkc.yaml | 51 + MAINTAINERS | 1 + drivers/clk/meson/Kconfig | 13 + drivers/clk/meson/Makefile | 1 + drivers/clk/meson/s4-pll.c | 875 ++++++++++++++++++ drivers/clk/meson/s4-pll.h | 88 ++ .../dt-bindings/clock/amlogic,s4-pll-clkc.h | 30 + 7 files changed, 1059 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml create mode 100644 drivers/clk/meson/s4-pll.c create mode 100644 drivers/clk/meson/s4-pll.h create mode 100644 include/dt-bindings/clock/amlogic,s4-pll-clkc.h
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +51 -0
@@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/amlogic,s4-pll-clkc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Amlogic Meson S serials PLL Clock Controller + +maintainers: + - Neil Armstrong <[email protected]> + - Jerome Brunet <[email protected]> + - Yu Tu <[email protected]> + + +properties: + compatible: + const: amlogic,s4-pll-clkc + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + items: + - const: xtal + + "#clock-cells": + const: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - "#clock-cells" + +additionalProperties: false + +examples: + - | + clkc_pll: clock-controller@fe008000 { + compatible = "amlogic,s4-pll-clkc"; + reg = <0xfe008000 0x1e8>; + clocks = <&xtal>; + clock-names = "xtal"; + #clock-cells = <1>; + }; + +...
MAINTAINERS +1 -0
@@ -1837,6 +1837,7 @@ L: [email protected] S: Maintained F: Documentation/devicetree/bindings/clock/amlogic* F: drivers/clk/meson/ +F: include/dt-bindings/clock/amlogic* F: include/dt-bindings/clock/gxbb* F: include/dt-bindings/clock/meson*
drivers/clk/meson/Kconfig +13 -0
@@ -115,4 +115,17 @@ config COMMON_CLK_G12A help Support for the clock controller on Amlogic S905D2, S905X2 and S905Y2 devices, aka g12a. Say Y if you want peripherals to work. + +config COMMON_CLK_S4_PLL + tristate "S4 SoC PLL clock controllers support" + depends on ARM64 + default y + select COMMON_CLK_MESON_MPLL + select COMMON_CLK_MESON_PLL + select COMMON_CLK_MESON_REGMAP + help + Support for the pll clock controller on Amlogic S805X2 and S905Y4 devices, + aka s4. Amlogic S805X2 and S905Y4 devices include AQ222 and AQ229. + Say Y if you want the board to work, because plls are the parent of most + peripherals. endmenu
drivers/clk/meson/Makefile +1 -0
@@ -19,3 +19,4 @@ obj-$(CONFIG_COMMON_CLK_AXG_AUDIO) += axg-audio.o obj-$(CONFIG_COMMON_CLK_GXBB) += gxbb.o gxbb-aoclk.o obj-$(CONFIG_COMMON_CLK_G12A) += g12a.o g12a-aoclk.o obj-$(CONFIG_COMMON_CLK_MESON8B) += meson8b.o meson8-ddr.o +obj-$(CONFIG_COMMON_CLK_S4_PLL) += s4-pll.o
drivers/clk/meson/s4-pll.c new file +875 -0
875 lines not on this page · raw message
drivers/clk/meson/s4-pll.h new file +88 -0
88 lines not on this page · raw message
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +30 -0
@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ +/* +* Copyright (c) 2021 Amlogic, Inc. All rights reserved. +* Author: Yu Tu <[email protected]> +*/ + +#ifndef _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H +#define _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H + +/* +* CLKID index values +*/ + +#define CLKID_FIXED_PLL 1 +#define CLKID_FCLK_DIV2 3 +#define CLKID_FCLK_DIV3 5 +#define CLKID_FCLK_DIV4 7 +#define CLKID_FCLK_DIV5 9 +#define CLKID_FCLK_DIV7 11 +#define CLKID_FCLK_DIV2P5 13 +#define CLKID_GP0_PLL 15 +#define CLKID_HIFI_PLL 17 +#define CLKID_HDMI_PLL 20 +#define CLKID_MPLL_50M 22 +#define CLKID_MPLL0 25 +#define CLKID_MPLL1 27 +#define CLKID_MPLL2 29 +#define CLKID_MPLL3 31 + +#endif /* _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H */
Signature · 7 lines
2.33.1 _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic
Re: [PATCH V5 1/4] clk: meson: S4: add support for Amlogic S4 SoC PLL clock driver and bindings
Quoted 5 lines · Yu Tu
Add the S4 PLL clock controller found and bindings in the s4 SoC family.
Signed-off-by Yu Tu <[email protected]>--- .../bindings/clock/amlogic,s4-pll-clkc.yaml | 51 +
This is v5 and still bindings are here? Bindings are always separate patches. Use subject prefixes matching the subsystem (git log --oneline -- ...).
And this was split, wasn't it? What happened here?!?
Quoted 21 lines
MAINTAINERS | 1 + drivers/clk/meson/Kconfig | 13 + drivers/clk/meson/Makefile | 1 + drivers/clk/meson/s4-pll.c | 875 ++++++++++++++++++ drivers/clk/meson/s4-pll.h | 88 ++ .../dt-bindings/clock/amlogic,s4-pll-clkc.h | 30 + 7 files changed, 1059 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml create mode 100644 drivers/clk/meson/s4-pll.c create mode 100644 drivers/clk/meson/s4-pll.h create mode 100644 include/dt-bindings/clock/amlogic,s4-pll-clkc.hDocumentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +3
-0@@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +---
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml line 13
Quoted 10 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +10
-0+$id: http://devicetree.org/schemas/clock/amlogic,s4-pll-clkc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Amlogic Meson S serials PLL Clock Controller + +maintainers: + - Neil Armstrong <[email protected]> + - Jerome Brunet <[email protected]> + - Yu Tu <[email protected]> +
One blank line.
include/dt-bindings/clock/amlogic,s4-pll-clkc.h
Quoted 44 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +37
-0+ +properties: + compatible: + const: amlogic,s4-pll-clkc + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + items: + - const: xtal + + "#clock-cells": + const: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - "#clock-cells" + +additionalProperties: false + +examples: + - | + clkc_pll: clock-controller@fe008000 { + compatible = "amlogic,s4-pll-clkc"; + reg = <0xfe008000 0x1e8>; + clocks = <&xtal>; + clock-names = "xtal"; + #clock-cells = <1>; + }; +#endif /* __MESON_S4_PLL_H__ */include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +0
-0
This belongs to bindings patch, not driver.
Quoted 6 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +5
-0@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ +/* +* Copyright (c) 2021 Amlogic, Inc. All rights reserved. +* Author: Yu Tu <[email protected]> +*/
include/dt-bindings/clock/amlogic,s4-pll-clkc.h line 15
Quoted 10 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +10
-0+ +#ifndef _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H +#define _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H + +/* +* CLKID index values +*/ + +#define CLKID_FIXED_PLL 1 +#define CLKID_FCLK_DIV2 3
Indexes start from 0 and are incremented by 1. Not by 2.
NAK.
Best regards,
Krzysztof
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Re: [PATCH V5 1/4] clk: meson: S4: add support for Amlogic S4 SoC PLL clock driver and bindings
Hi Krzysztof,
Thank you for your reply.
Quoted 9 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 5 lines · Yu Tu
Add the S4 PLL clock controller found and bindings in the s4 SoC family.
Signed-off-by Yu Tu <[email protected]>--- .../bindings/clock/amlogic,s4-pll-clkc.yaml | 51 +
Quoted 5 lines
This is v5 and still bindings are here? Bindings are always separate patches. Use subject prefixes matching the subsystem (git log --oneline -- ...).
And this was split, wasn't it? What happened here?!?
Put bindings and clock driver patch together from Jerome. Maybe you can read this chat history.
https://lore.kernel.or/all/[email protected]/
Quoted 26 lines
Quoted 26 lines
MAINTAINERS | 1 + drivers/clk/meson/Kconfig | 13 + drivers/clk/meson/Makefile | 1 + drivers/clk/meson/s4-pll.c | 875 ++++++++++++++++++ drivers/clk/meson/s4-pll.h | 88 ++ .../dt-bindings/clock/amlogic,s4-pll-clkc.h | 30 + 7 files changed, 1059 insertions(+)create mode 100644
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yamlcreate mode 100644drivers/clk/meson/s4-pll.c
create mode 100644drivers/clk/meson/s4-pll.h
create mode 100644include/dt-bindings/clock/amlogic,s4-pll-clkc.hDocumentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +6
-0@@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/amlogic,s4-pll-clkc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# +
Quoted 8 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml line 13
Quoted 7 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +7
-0+title: Amlogic Meson S serials PLL Clock Controller + +maintainers: + - Neil Armstrong <[email protected]> + - Jerome Brunet <[email protected]> + - Yu Tu <[email protected]> +One blank line.
I will delete this, on next version patch.
Quoted 67 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h
Quoted 45 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +37
-0+ +properties: + compatible: + const: amlogic,s4-pll-clkc + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + items: + - const: xtal + + "#clock-cells": + const: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - "#clock-cells" + +additionalProperties: false + +examples: + - | + clkc_pll: clock-controller@fe008000 { + compatible = "amlogic,s4-pll-clkc"; + reg = <0xfe008000 0x1e8>; + clocks = <&xtal>; + clock-names = "xtal"; + #clock-cells = <1>; + }; +#endif /* __MESON_S4_PLL_H__ */include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +0
-0This belongs to bindings patch, not driver.
Quoted 6 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +5
-0@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ +/* +* Copyright (c) 2021 Amlogic, Inc. All rights reserved. +* Author: Yu Tu <[email protected]> +*/ include/dt-bindings/clock/amlogic,s4-pll-clkc.h line 15
Quoted 10 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +10
-0+ +#ifndef _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H +#define _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H + +/* +* CLKID index values +*/ + +#define CLKID_FIXED_PLL 1 +#define CLKID_FCLK_DIV2 3Indexes start from 0 and are incremented by 1. Not by 2.
Quoted 1 line
NAK.
I remember Jerome discussing this with you.You can look at this submission history.
https://lore.kernel.org/all/[email protected]/
Quoted 5 lines
Best regards,
Krzysztof.
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Re: [PATCH V5 1/4] clk: meson: S4: add support for Amlogic S4 SoC PLL clock driver and bindings
Quoted 17 lines · Yu Tu
Hi Krzysztof,
Thank you for your reply.Quoted 13 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 5 lines · Yu Tu
Add the S4 PLL clock controller found and bindings in the s4 SoC family.
Signed-off-by Yu Tu <[email protected]>--- .../bindings/clock/amlogic,s4-pll-clkc.yaml | 51 +This is v5 and still bindings are here? Bindings are always separate patches. Use subject prefixes matching the subsystem (git log --oneline -- ...).
Quoted 5 lines
Quoted 1 line
And this was split, wasn't it? What happened here?!?
Put bindings and clock driver patch together from Jerome. Maybe you can read this chat history.
https://lore.kernel.or/all/[email protected]/
Link does not explain me anything. It mentions series, which is totally different than mixing it one patch!
Anyway you should have warnings from checkpatch.
Bindings are always separate patches.
(...)
Quoted 67 lines
Quoted 67 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h
Quoted 45 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +37
-0+ +properties: + compatible: + const: amlogic,s4-pll-clkc + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + items: + - const: xtal + + "#clock-cells": + const: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - "#clock-cells" + +additionalProperties: false + +examples: + - | + clkc_pll: clock-controller@fe008000 { + compatible = "amlogic,s4-pll-clkc"; + reg = <0xfe008000 0x1e8>; + clocks = <&xtal>; + clock-names = "xtal"; + #clock-cells = <1>; + }; +#endif /* __MESON_S4_PLL_H__ */include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +0
-0This belongs to bindings patch, not driver.
Quoted 6 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +5
-0@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ +/* +* Copyright (c) 2021 Amlogic, Inc. All rights reserved. +* Author: Yu Tu <[email protected]> +*/ include/dt-bindings/clock/amlogic,s4-pll-clkc.h line 15
Quoted 10 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +10
-0+ +#ifndef _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H +#define _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H + +/* +* CLKID index values +*/ + +#define CLKID_FIXED_PLL 1 +#define CLKID_FCLK_DIV2 3Indexes start from 0 and are incremented by 1. Not by 2.
Quoted 5 lines
Quoted 1 line
NAK.
I remember Jerome discussing this with you.You can look at this submission history.
https://lore.kernel.org/all/[email protected]/
You pointed to my arguments, so what is this proving? That you ignored feedback? Or was there some other mail?
Best regards,
Krzysztof
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Neil Armstrong
maintainerRe: [PATCH V5 1/4] clk: meson: S4: add support for Amlogic S4 SoC PLL clock driver and bindings
In reply to Yu TuHi,
Quoted 13 lines · Yu Tu
Hi Krzysztof,
Thank you for your reply.Quoted 9 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 5 lines · Yu Tu
Add the S4 PLL clock controller found and bindings in the s4 SoC family.
Signed-off-by Yu Tu <[email protected]>---
.../bindings/clock/amlogic,s4-pll-clkc.yaml | 51 +
Quoted 8 lines
Quoted 5 lines
This is v5 and still bindings are here? Bindings are always separate patches. Use subject prefixes matching the subsystem (git log --oneline -- ...).
And this was split, wasn't it? What happened here?!?
Put bindings and clock driver patch together from Jerome. Maybe you can read this chat history.
https://lore.kernel.or/all/[email protected]/
Jerome was asking you to send 2 patchsets, one with :
- bindings in separate patches
- drivers in separate patches
and a second with DT changes.
Then when the bindings + clocks patches are merged, a pull request of the bindings can be done to me so I can merge it with DT.
Quoted 105 lines
Quoted 27 lines
Quoted 27 lines
MAINTAINERS | 1 + drivers/clk/meson/Kconfig | 13 +
drivers/clk/meson/Makefile | 1 + drivers/clk/meson/s4-pll.c | 875 ++++++++++++++++++ drivers/clk/meson/s4-pll.h | 88 ++ .../dt-bindings/clock/amlogic,s4-pll-clkc.h | 30 + 7 files changed, 1059 insertions(+)create mode 100644
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yamlcreate mode 100644drivers/clk/meson/s4-pll.c
create mode 100644drivers/clk/meson/s4-pll.h
create mode 100644include/dt-bindings/clock/amlogic,s4-pll-clkc.hDocumentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +6
-0@@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/amlogic,s4-pll-clkc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# +Quoted 8 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml line 13
Quoted 7 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +7
-0+title: Amlogic Meson S serials PLL Clock Controller + +maintainers: + - Neil Armstrong <[email protected]> + - Jerome Brunet <[email protected]> + - Yu Tu <[email protected]> +One blank line.
I will delete this, on next version patch.
Quoted 67 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h
Quoted 45 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +37
-0+ +properties: + compatible: + const: amlogic,s4-pll-clkc + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + items: + - const: xtal + + "#clock-cells": + const: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - "#clock-cells" + +additionalProperties: false + +examples: + - | + clkc_pll: clock-controller@fe008000 { + compatible = "amlogic,s4-pll-clkc"; + reg = <0xfe008000 0x1e8>; + clocks = <&xtal>; + clock-names = "xtal"; + #clock-cells = <1>; + }; +#endif /* __MESON_S4_PLL_H__ */include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +0
-0This belongs to bindings patch, not driver.
Quoted 6 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +5
-0@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ +/* +* Copyright (c) 2021 Amlogic, Inc. All rights reserved. +* Author: Yu Tu <[email protected]> +*/ include/dt-bindings/clock/amlogic,s4-pll-clkc.h line 15
Quoted 10 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +10
-0+ +#ifndef _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H +#define _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H + +/* +* CLKID index values +*/ + +#define CLKID_FIXED_PLL 1 +#define CLKID_FCLK_DIV2 3Indexes start from 0 and are incremented by 1. Not by 2.
Quoted 4 lines
Quoted 1 line
NAK.
I remember Jerome discussing this with you.You can look at this submission history.
https://lore.kernel.org/all/[email protected]/
Historically we did that by only exposing part of the numbers, controlling which clocks were part of the bindings.
But it seems this doesn't make sens anymore, maybe it would be time to put all the clock ids in the bindings for this new SoC and break with the previous strategy.
Neil
Quoted 6 lines
Quoted 6 lines
Best regards,
Krzysztof.
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Re: [PATCH V5 1/4] clk: meson: S4: add support for Amlogic S4 SoC PLL clock driver and bindings
Quoted 140 lines · Neil Armstrong
Hi,
Quoted 13 lines · Yu Tu
Hi Krzysztof,
Thank you for your reply.Quoted 9 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 5 lines · Yu Tu
Add the S4 PLL clock controller found and bindings in the s4 SoC family.
Signed-off-by Yu Tu <[email protected]>---
.../bindings/clock/amlogic,s4-pll-clkc.yaml | 51 +Quoted 8 lines
Quoted 5 lines
This is v5 and still bindings are here? Bindings are always separate patches. Use subject prefixes matching the subsystem (git log --oneline -- ...).
And this was split, wasn't it? What happened here?!?
Put bindings and clock driver patch together from Jerome. Maybe you can read this chat history.
https://lore.kernel.or/all/[email protected]/Jerome was asking you to send 2 patchsets, one with :
- bindings in separate patches
- drivers in separate patches
and a second with DT changes.Then when the bindings + clocks patches are merged, a pull request of the bindings can be done to me so I can merge it with DT.
Quoted 107 lines
Quoted 27 lines
Quoted 27 lines
MAINTAINERS | 1 + drivers/clk/meson/Kconfig | 13 +
drivers/clk/meson/Makefile | 1 + drivers/clk/meson/s4-pll.c | 875 ++++++++++++++++++ drivers/clk/meson/s4-pll.h | 88 ++ .../dt-bindings/clock/amlogic,s4-pll-clkc.h | 30 + 7 files changed, 1059 insertions(+)create mode 100644
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yamlcreate mode 100644drivers/clk/meson/s4-pll.c
create mode 100644drivers/clk/meson/s4-pll.h
create mode 100644include/dt-bindings/clock/amlogic,s4-pll-clkc.hDocumentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +6
-0@@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/amlogic,s4-pll-clkc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# +Quoted 8 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml line 13
Quoted 7 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +7
-0+title: Amlogic Meson S serials PLL Clock Controller + +maintainers: + - Neil Armstrong <[email protected]> + - Jerome Brunet <[email protected]> + - Yu Tu <[email protected]> +One blank line.
I will delete this, on next version patch.
Quoted 68 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h
Quoted 45 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +37
-0+ +properties: + compatible: + const: amlogic,s4-pll-clkc + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + items: + - const: xtal + + "#clock-cells": + const: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - "#clock-cells" + +additionalProperties: false + +examples: + - | + clkc_pll: clock-controller@fe008000 { + compatible = "amlogic,s4-pll-clkc"; + reg = <0xfe008000 0x1e8>; + clocks = <&xtal>; + clock-names = "xtal"; + #clock-cells = <1>; + }; +#endif /* __MESON_S4_PLL_H__ */include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +0
-0This belongs to bindings patch, not driver.
Quoted 6 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +5
-0@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ +/* +* Copyright (c) 2021 Amlogic, Inc. All rights reserved. +* Author: Yu Tu <[email protected]> +*/ include/dt-bindings/clock/amlogic,s4-pll-clkc.h line 15
Quoted 10 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +10
-0+ +#ifndef _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H +#define _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H + +/* +* CLKID index values +*/ + +#define CLKID_FIXED_PLL 1 +#define CLKID_FCLK_DIV2 3Indexes start from 0 and are incremented by 1. Not by 2.
NAK.
Quoted 8 lines
Quoted 2 lines
I remember Jerome discussing this with you.You can look at this submission history.
https://lore.kernel.org/all/[email protected]/Historically we did that by only exposing part of the numbers, controlling which clocks were part of the bindings.
But it seems this doesn't make sens anymore, maybe it would be time to put all the clock ids in the bindings for this new SoC and break with the previous strategy.
So the outcome of the previous discussion was somewhere later in that thread:
Quoted 3 lines
It is just a choice to not expose some IDs.
It is not tied to the implementation at all.
I think we actually follow the rules and the idea behind it.
Best regards,
Krzysztof
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Jerome Brunet
maintainerRe: [PATCH V5 1/4] clk: meson: S4: add support for Amlogic S4 SoC PLL clock driver and bindings
Quoted 23 lines · Krzysztof Kozlowski
Quoted 22 lines · Neil Armstrong
Hi,
Quoted 19 lines · Yu Tu
Hi Krzysztof,
Thank you for your reply.Quoted 14 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 5 lines · Yu Tu
Add the S4 PLL clock controller found and bindings in the s4 SoC family.
Signed-off-by Yu Tu <[email protected]>---
.../bindings/clock/amlogic,s4-pll-clkc.yaml | 51 +This is v5 and still bindings are here? Bindings are always separate patches. Use subject prefixes matching the subsystem (git log --oneline -- ...).
And this was split, wasn't it? What happened here?!?
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Put bindings and clock driver patch together from Jerome. Maybe you can read this chat history.
https://lore.kernel.or/all/[email protected]/Jerome was asking you to send 2 patchsets, one with :
- bindings in separate patches
- drivers in separate patches
and a second with DT changes.
Indeed, this is what was asked. It is aligned with Krzysztof's request.
Quoted 111 lines
Quoted 111 lines
Then when the bindings + clocks patches are merged, a pull request of the bindings can be done to me so I can merge it with DT.
Quoted 107 lines
Quoted 27 lines
Quoted 27 lines
MAINTAINERS | 1 + drivers/clk/meson/Kconfig | 13 +
drivers/clk/meson/Makefile | 1 + drivers/clk/meson/s4-pll.c | 875 ++++++++++++++++++ drivers/clk/meson/s4-pll.h | 88 ++ .../dt-bindings/clock/amlogic,s4-pll-clkc.h | 30 + 7 files changed, 1059 insertions(+)create mode 100644
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yamlcreate mode 100644drivers/clk/meson/s4-pll.c
create mode 100644drivers/clk/meson/s4-pll.h
create mode 100644include/dt-bindings/clock/amlogic,s4-pll-clkc.hDocumentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +6
-0@@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/amlogic,s4-pll-clkc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# +Quoted 8 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml line 13
Quoted 7 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +7
-0+title: Amlogic Meson S serials PLL Clock Controller + +maintainers: + - Neil Armstrong <[email protected]> + - Jerome Brunet <[email protected]> + - Yu Tu <[email protected]> +One blank line.
I will delete this, on next version patch.
Quoted 68 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h
Quoted 45 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +37
-0+ +properties: + compatible: + const: amlogic,s4-pll-clkc + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + items: + - const: xtal + + "#clock-cells": + const: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - "#clock-cells" + +additionalProperties: false + +examples: + - | + clkc_pll: clock-controller@fe008000 { + compatible = "amlogic,s4-pll-clkc"; + reg = <0xfe008000 0x1e8>; + clocks = <&xtal>; + clock-names = "xtal"; + #clock-cells = <1>; + }; +#endif /* __MESON_S4_PLL_H__ */include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +0
-0This belongs to bindings patch, not driver.
Quoted 6 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +5
-0@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ +/* +* Copyright (c) 2021 Amlogic, Inc. All rights reserved. +* Author: Yu Tu <[email protected]> +*/ include/dt-bindings/clock/amlogic,s4-pll-clkc.h line 15
Quoted 10 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +10
-0+ +#ifndef _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H +#define _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H + +/* +* CLKID index values +*/ + +#define CLKID_FIXED_PLL 1 +#define CLKID_FCLK_DIV2 3Indexes start from 0 and are incremented by 1. Not by 2.
NAK.
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
I remember Jerome discussing this with you.You can look at this submission history.
https://lore.kernel.org/all/[email protected]/Historically we did that by only exposing part of the numbers, controlling which clocks were part of the bindings.
But it seems this doesn't make sens anymore, maybe it would be time to put all the clock ids in the bindings for this new SoC and break with the previous strategy.
Krzysztof and I agreed there is nothing wrong with the current approach, I believe.
It does not prevent someone from using an un-exposed clock, sure, or exposing it in the future if necessary.
However, I think it clearly shows that an un-exposed element is not expected to be used by an external consumers. It should be enough to trigger a discussion if this expectation is wrong.
Quoted 11 lines
So the outcome of the previous discussion was somewhere later in that thread:
Quoted 3 lines
It is just a choice to not expose some IDs.
It is not tied to the implementation at all.
I think we actually follow the rules and the idea behind it.Best regards,
Krzysztof
Re: [PATCH V5 1/4] clk: meson: S4: add support for Amlogic S4 SoC PLL clock driver and bindings
Hi Jerome,
Thank you for your reply.
Quoted 31 lines · Jerome Brunet
[ EXTERNAL EMAIL ]
Quoted 26 lines · Krzysztof Kozlowski
Quoted 25 lines · Neil Armstrong
Hi,
Quoted 21 lines · Yu Tu
Hi Krzysztof,
Thank you for your reply.Quoted 9 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 5 lines · Yu Tu
Add the S4 PLL clock controller found and bindings in the s4 SoC family.
Signed-off-by Yu Tu <[email protected]>--- .../bindings/clock/amlogic,s4-pll-clkc.yaml | 51 +Quoted 5 lines
This is v5 and still bindings are here? Bindings are always separate patches. Use subject prefixes matching the subsystem (git log --oneline -- ...).
And this was split, wasn't it? What happened here?!?
Put bindings and clock driver patch together from Jerome. Maybe you can read this chat history.
https://lore.kernel.or/all/[email protected]/
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Jerome was asking you to send 2 patchsets, one with :
- bindings in separate patches
- drivers in separate patches
and a second with DT changes.Indeed, this is what was asked. It is aligned with Krzysztof's request.
According to your discussion, I still should send patches in the previous way in series. But I'm going to change it like you suggested. I don't know, am I getting it right?
Quoted 144 lines
Quoted 112 lines
Quoted 112 lines
Then when the bindings + clocks patches are merged, a pull request of the bindings can be done to me so I can merge it with DT.
Quoted 107 lines
Quoted 27 lines
Quoted 27 lines
MAINTAINERS | 1 + drivers/clk/meson/Kconfig | 13 + drivers/clk/meson/Makefile | 1 + drivers/clk/meson/s4-pll.c | 875 ++++++++++++++++++ drivers/clk/meson/s4-pll.h | 88 ++ .../dt-bindings/clock/amlogic,s4-pll-clkc.h | 30 + 7 files changed, 1059 insertions(+)create mode 100644
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yamlcreate mode 100644drivers/clk/meson/s4-pll.c
create mode 100644drivers/clk/meson/s4-pll.h
create mode 100644include/dt-bindings/clock/amlogic,s4-pll-clkc.hDocumentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +6
-0@@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/amlogic,s4-pll-clkc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# +Quoted 8 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml line 13
Quoted 7 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +7
-0+title: Amlogic Meson S serials PLL Clock Controller + +maintainers: + - Neil Armstrong <[email protected]> + - Jerome Brunet <[email protected]> + - Yu Tu <[email protected]> +One blank line.
I will delete this, on next version patch.
Quoted 68 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h
Quoted 45 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +37
-0+ +properties: + compatible: + const: amlogic,s4-pll-clkc + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + items: + - const: xtal + + "#clock-cells": + const: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - "#clock-cells" + +additionalProperties: false + +examples: + - | + clkc_pll: clock-controller@fe008000 { + compatible = "amlogic,s4-pll-clkc"; + reg = <0xfe008000 0x1e8>; + clocks = <&xtal>; + clock-names = "xtal"; + #clock-cells = <1>; + }; +#endif /* __MESON_S4_PLL_H__ */include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +0
-0This belongs to bindings patch, not driver.
Quoted 6 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +5
-0@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ +/* +* Copyright (c) 2021 Amlogic, Inc. All rights reserved. +* Author: Yu Tu <[email protected]> +*/ include/dt-bindings/clock/amlogic,s4-pll-clkc.h line 15
Quoted 10 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +10
-0+ +#ifndef _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H +#define _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H + +/* +* CLKID index values +*/ + +#define CLKID_FIXED_PLL 1 +#define CLKID_FCLK_DIV2 3Indexes start from 0 and are incremented by 1. Not by 2.
NAK.
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
I remember Jerome discussing this with you.You can look at this submission history.
https://lore.kernel.org/all/[email protected]/Historically we did that by only exposing part of the numbers, controlling which clocks were part of the bindings.
But it seems this doesn't make sens anymore, maybe it would be time to put all the clock ids in the bindings for this new SoC and break with the previous strategy.
Krzysztof and I agreed there is nothing wrong with the current approach, I believe.
It does not prevent someone from using an un-exposed clock, sure, or exposing it in the future if necessary.
However, I think it clearly shows that an un-exposed element is not expected to be used by an external consumers. It should be enough to trigger a discussion if this expectation is wrong.
Quoted 11 lines
So the outcome of the previous discussion was somewhere later in that thread:
Quoted 3 lines
It is just a choice to not expose some IDs.
It is not tied to the implementation at all.
I think we actually follow the rules and the idea behind it.Best regards,
Krzysztof.
Jerome Brunet
maintainerRe: [PATCH V5 1/4] clk: meson: S4: add support for Amlogic S4 SoC PLL clock driver and bindings
Quoted 38 lines · Yu Tu
Hi Jerome,
Thank you for your reply.Quoted 34 lines · Jerome Brunet
[ EXTERNAL EMAIL ]
Quoted 30 lines · Krzysztof Kozlowski
Quoted 29 lines · Neil Armstrong
Hi,
Quoted 13 lines · Yu Tu
Hi Krzysztof,
Thank you for your reply.Quoted 9 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 5 lines · Yu Tu
Add the S4 PLL clock controller found and bindings in the s4 SoC family.
Signed-off-by Yu Tu <[email protected]>--- .../bindings/clock/amlogic,s4-pll-clkc.yaml | 51 +Quoted 8 lines
Quoted 5 lines
This is v5 and still bindings are here? Bindings are always separate patches. Use subject prefixes matching the subsystem (git log --oneline -- ...).
And this was split, wasn't it? What happened here?!?
Put bindings and clock driver patch together from Jerome. Maybe you can read this chat history.
https://lore.kernel.or/all/[email protected]/Jerome was asking you to send 2 patchsets, one with :
- bindings in separate patches
- drivers in separate patches
and a second with DT changes.
Quoted 5 lines
Quoted 1 line
Indeed, this is what was asked. It is aligned with Krzysztof's request.
According to your discussion, I still should send patches in the previous way in series. But I'm going to change it like you suggested. I don't know, am I getting it right?
3 people tried to explain this already and we all told you the same thing.
* 1 patchset per maintainer: clk and dt
* bindings must be dedicated patches - never mixed with driver code.
I strongly suggest that you take some time to (re)read:
* https://docs.kernel.org/process/submitting-patches.html
* https://docs.kernel.org/devicetree/bindings/submitting-patches.html
If still unclear, please take some time to look at the kernel mailing list archive and see how others have done the same things.
Thx.
Quoted 141 lines
Quoted 141 lines
Quoted 113 lines
Quoted 113 lines
Then when the bindings + clocks patches are merged, a pull request of the bindings can be done to me so I can merge it with DT.
Quoted 107 lines
Quoted 27 lines
Quoted 27 lines
MAINTAINERS | 1 + drivers/clk/meson/Kconfig | 13 + drivers/clk/meson/Makefile | 1 + drivers/clk/meson/s4-pll.c | 875 ++++++++++++++++++ drivers/clk/meson/s4-pll.h | 88 ++ .../dt-bindings/clock/amlogic,s4-pll-clkc.h | 30 + 7 files changed, 1059 insertions(+)create mode 100644
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yamlcreate mode 100644drivers/clk/meson/s4-pll.c
create mode 100644drivers/clk/meson/s4-pll.h
create mode 100644include/dt-bindings/clock/amlogic,s4-pll-clkc.hDocumentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +6
-0@@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/amlogic,s4-pll-clkc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# +Quoted 8 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml line 13
Quoted 7 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +7
-0+title: Amlogic Meson S serials PLL Clock Controller + +maintainers: + - Neil Armstrong <[email protected]> + - Jerome Brunet <[email protected]> + - Yu Tu <[email protected]> +One blank line.
I will delete this, on next version patch.
Quoted 68 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h
Quoted 45 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +37
-0+ +properties: + compatible: + const: amlogic,s4-pll-clkc + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + items: + - const: xtal + + "#clock-cells": + const: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - "#clock-cells" + +additionalProperties: false + +examples: + - | + clkc_pll: clock-controller@fe008000 { + compatible = "amlogic,s4-pll-clkc"; + reg = <0xfe008000 0x1e8>; + clocks = <&xtal>; + clock-names = "xtal"; + #clock-cells = <1>; + }; +#endif /* __MESON_S4_PLL_H__ */include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +0
-0This belongs to bindings patch, not driver.
Quoted 6 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +5
-0@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ +/* +* Copyright (c) 2021 Amlogic, Inc. All rights reserved. +* Author: Yu Tu <[email protected]> +*/ include/dt-bindings/clock/amlogic,s4-pll-clkc.h line 15
Quoted 10 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +10
-0+ +#ifndef _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H +#define _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H + +/* +* CLKID index values +*/ + +#define CLKID_FIXED_PLL 1 +#define CLKID_FCLK_DIV2 3Indexes start from 0 and are incremented by 1. Not by 2.
NAK.
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
I remember Jerome discussing this with you.You can look at this submission history.
https://lore.kernel.org/all/[email protected]/Historically we did that by only exposing part of the numbers, controlling which clocks were part of the bindings.
But it seems this doesn't make sens anymore, maybe it would be time to put all the clock ids in the bindings for this new SoC and break with the previous strategy.
Krzysztof and I agreed there is nothing wrong with the current approach, I believe.
It does not prevent someone from using an un-exposed clock, sure, or exposing it in the future if necessary.
However, I think it clearly shows that an un-exposed element is not expected to be used by an external consumers. It should be enough to trigger a discussion if this expectation is wrong.Quoted 11 lines
So the outcome of the previous discussion was somewhere later in that thread:
Quoted 3 lines
It is just a choice to not expose some IDs.
It is not tied to the implementation at all.
I think we actually follow the rules and the idea behind it.Best regards,
Krzysztof.
Re: [PATCH V5 1/4] clk: meson: S4: add support for Amlogic S4 SoC PLL clock driver and bindings
Hi Jerome ,
Quoted 54 lines · Jerome Brunet
[ EXTERNAL EMAIL ]
Quoted 38 lines · Yu Tu
Hi Jerome,
Thank you for your reply.Quoted 34 lines · Jerome Brunet
[ EXTERNAL EMAIL ]
Quoted 30 lines · Krzysztof Kozlowski
Quoted 29 lines · Neil Armstrong
Hi,
Quoted 13 lines · Yu Tu
Hi Krzysztof,
Thank you for your reply.Quoted 9 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 5 lines · Yu Tu
Add the S4 PLL clock controller found and bindings in the s4 SoC family.
Signed-off-by Yu Tu <[email protected]>--- .../bindings/clock/amlogic,s4-pll-clkc.yaml | 51 +Quoted 8 lines
Quoted 5 lines
This is v5 and still bindings are here? Bindings are always separate patches. Use subject prefixes matching the subsystem (git log --oneline -- ...).
And this was split, wasn't it? What happened here?!?
Put bindings and clock driver patch together from Jerome. Maybe you can read this chat history.
https://lore.kernel.or/all/[email protected]/Jerome was asking you to send 2 patchsets, one with :
- bindings in separate patches
- drivers in separate patches
and a second with DT changes.Quoted 5 lines
Quoted 1 line
Indeed, this is what was asked. It is aligned with Krzysztof's request.
According to your discussion, I still should send patches in the previous way in series. But I'm going to change it like you suggested. I don't know, am I getting it right?
3 people tried to explain this already and we all told you the same thing.
* 1 patchset per maintainer: clk and dt
* bindings must be dedicated patches - never mixed with driver code.
Quoted 8 lines
I strongly suggest that you take some time to (re)read:
* https://docs.kernel.org/process/submitting-patches.html
* https://docs.kernel.org/devicetree/bindings/submitting-patches.htmlIf still unclear, please take some time to look at the kernel mailing list archive and see how others have done the same things.
Thx.
I'll change it as you suggest.But I still don't understand what you suggested in V3.
I remember discussing it with you at V3.
https://lore.kernel.or/all/[email protected]/
">>>> Also it would be nice to split this in two series.
Quoted 11 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Bindings and drivers in one, arm64 dt in the other. These changes goes in through different trees.
At present, Bindings, DTS and drivers are three series. Do you mean to put Bindings and drivers together? If so, checkpatch.pl will report a warning.
Yes because patches are not in yet so there is a good reason to ignore the warning. Warning will never show up on the actual tree if the patches are correctly ordered.
I think Binding, DTS and drivers use three series and you said two series is not a big problem. Three series are recommended for checkpatch.pl, I think it should be easy for that to separate and merge。
No - There is only 2 series. 1 for the bindings and clock drivers and one for the DT once things are in"
Quoted 139 lines
Quoted 139 lines
Quoted 139 lines
Quoted 114 lines
Quoted 114 lines
Then when the bindings + clocks patches are merged, a pull request of the bindings can be done to me so I can merge it with DT.
Quoted 107 lines
Quoted 27 lines
Quoted 27 lines
MAINTAINERS | 1 + drivers/clk/meson/Kconfig | 13 + drivers/clk/meson/Makefile | 1 + drivers/clk/meson/s4-pll.c | 875 ++++++++++++++++++ drivers/clk/meson/s4-pll.h | 88 ++ .../dt-bindings/clock/amlogic,s4-pll-clkc.h | 30 + 7 files changed, 1059 insertions(+)create mode 100644
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yamlcreate mode 100644drivers/clk/meson/s4-pll.c
create mode 100644drivers/clk/meson/s4-pll.h
create mode 100644include/dt-bindings/clock/amlogic,s4-pll-clkc.hDocumentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +6
-0@@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/amlogic,s4-pll-clkc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# +Quoted 8 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml line 13
Quoted 7 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +7
-0+title: Amlogic Meson S serials PLL Clock Controller + +maintainers: + - Neil Armstrong <[email protected]> + - Jerome Brunet <[email protected]> + - Yu Tu <[email protected]> +One blank line.
I will delete this, on next version patch.
Quoted 68 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h
Quoted 45 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +37
-0+ +properties: + compatible: + const: amlogic,s4-pll-clkc + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + items: + - const: xtal + + "#clock-cells": + const: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - "#clock-cells" + +additionalProperties: false + +examples: + - | + clkc_pll: clock-controller@fe008000 { + compatible = "amlogic,s4-pll-clkc"; + reg = <0xfe008000 0x1e8>; + clocks = <&xtal>; + clock-names = "xtal"; + #clock-cells = <1>; + }; +#endif /* __MESON_S4_PLL_H__ */include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +0
-0This belongs to bindings patch, not driver.
Quoted 6 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +5
-0@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ +/* +* Copyright (c) 2021 Amlogic, Inc. All rights reserved. +* Author: Yu Tu <[email protected]> +*/ include/dt-bindings/clock/amlogic,s4-pll-clkc.h line 15
Quoted 10 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +10
-0+ +#ifndef _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H +#define _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H + +/* +* CLKID index values +*/ + +#define CLKID_FIXED_PLL 1 +#define CLKID_FCLK_DIV2 3Indexes start from 0 and are incremented by 1. Not by 2.
NAK.
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
I remember Jerome discussing this with you.You can look at this submission history.
https://lore.kernel.org/all/[email protected]/Historically we did that by only exposing part of the numbers, controlling which clocks were part of the bindings.
But it seems this doesn't make sens anymore, maybe it would be time to put all the clock ids in the bindings for this new SoC and break with the previous strategy.
Krzysztof and I agreed there is nothing wrong with the current approach, I believe.
It does not prevent someone from using an un-exposed clock, sure, or exposing it in the future if necessary.
However, I think it clearly shows that an un-exposed element is not expected to be used by an external consumers. It should be enough to trigger a discussion if this expectation is wrong.Quoted 9 lines
So the outcome of the previous discussion was somewhere later in that thread:
Quoted 3 lines
It is just a choice to not expose some IDs.
It is not tied to the implementation at all.
I think we actually follow the rules and the idea behind it.
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Best regards,
Krzysztof.
.
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
[email protected]
maintainerRe: [PATCH V5 1/4] clk: meson: S4: add support for Amlogic S4 SoC PLL clock driver and bindings
Quoted 80 lines · Yu Tu
Hi Jerome ,
Quoted 54 lines · Jerome Brunet
[ EXTERNAL EMAIL ]
Quoted 38 lines · Yu Tu
Hi Jerome,
Thank you for your reply.Quoted 34 lines · Jerome Brunet
[ EXTERNAL EMAIL ]
Quoted 30 lines · Krzysztof Kozlowski
Quoted 29 lines · Neil Armstrong
Hi,
Quoted 13 lines · Yu Tu
Hi Krzysztof,
Thank you for your reply.Quoted 9 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 5 lines · Yu Tu
Add the S4 PLL clock controller found and bindings in the s4 SoC family.
Signed-off-by Yu Tu <[email protected]>---
.../bindings/clock/amlogic,s4-pll-clkc.yaml | 51 +Quoted 8 lines
Quoted 5 lines
This is v5 and still bindings are here? Bindings are always separate patches. Use subject prefixes matching the subsystem (git log --oneline -- ...).
And this was split, wasn't it? What happened here?!?
Put bindings and clock driver patch together from Jerome. Maybe you can read this chat history.
https://lore.kernel.or/all/[email protected]/Jerome was asking you to send 2 patchsets, one with :
- bindings in separate patches
- drivers in separate patches
and a second with DT changes.Quoted 5 lines
Quoted 1 line
Indeed, this is what was asked. It is aligned with Krzysztof's request.
According to your discussion, I still should send patches in the previous way in series. But I'm going to change it like you suggested. I don't know, am I getting it right?
3 people tried to explain this already and we all told you the same thing.
* 1 patchset per maintainer: clk and dt
* bindings must be dedicated patches - never mixed with driver code.Quoted 8 lines
I strongly suggest that you take some time to (re)read:
* https://docs.kernel.org/process/submitting-patches.html
* https://docs.kernel.org/devicetree/bindings/submitting-patches.htmlIf still unclear, please take some time to look at the kernel mailing list archive and see how others have done the same things.
Thx.
I'll change it as you suggest.But I still don't understand what you suggested in V3.
I remember discussing it with you at V3.
https://lore.kernel.or/all/[email protected]/">>>> Also it would be nice to split this in two series.
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Bindings and drivers in one, arm64 dt in the other. These changes goes in through different trees.
At present, Bindings, DTS and drivers are three series. Do you mean to put Bindings and drivers together? If so, checkpatch.pl will report a warning.
Yes because patches are not in yet so there is a good reason to ignore the warning. Warning will never show up on the actual tree if the patches are correctly ordered.
Quoted 6 lines
Quoted 3 lines
I think Binding, DTS and drivers use three series and you said two series is not a big problem. Three series are recommended for checkpatch.pl, I think it should be easy for that to separate and merge。
No - There is only 2 series. 1 for the bindings and clock drivers and one for the DT once things are in"
Please send the following emails:
* First patchset
[PATCH V6 0/3] clk: meson: Add S4 SoC PLL and Peripheral clock controller
[PATCH v6 1/3] dt-bindings: clock: document Amlogic S4 SoC PLL & peripheral clock controller [PATCH v6 2/3] clk: meson: add support for Amlogic S4 SoC PLL
[PATCH v6 3/3] clk: meson: add support for Amlogic S4 SoC peripheral clock controller
1) will contain only .yaml and dt-bindings include
2) will only have drivers/clk/meson changes
3) will only have drivers/clk/meson changes
* Second patchset:
[PATCH v1 0/2] arm64: dts: meson: Add S4 SoC PLL and Peripheral clock nodes
[PATCH v1 1/2] arm64: dts: meson: add S4 Soc PLL clock controller node [PATCH v1 2/2] arm64: dts: meson: add S4 Soc Peripheral clock controller node
1) is the patch 3 of v5 patchset
2) is the patch 4 of v5 patchset
And in the second cover letter, explain those patches comes from the previous V5 patchset and add a link to the V6 "drivers + bindings" patchset as a dependency.
Neil
Quoted 145 lines
Quoted 145 lines
Quoted 135 lines
Quoted 135 lines
Quoted 115 lines
Quoted 115 lines
Then when the bindings + clocks patches are merged, a pull request of the bindings can be done to me so I can merge it with DT.
Quoted 107 lines
Quoted 27 lines
Quoted 27 lines
MAINTAINERS | 1 + drivers/clk/meson/Kconfig | 13 +
drivers/clk/meson/Makefile | 1 + drivers/clk/meson/s4-pll.c | 875 ++++++++++++++++++ drivers/clk/meson/s4-pll.h | 88 ++ .../dt-bindings/clock/amlogic,s4-pll-clkc.h | 30 + 7 files changed, 1059 insertions(+)create mode 100644
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yamlcreate mode 100644drivers/clk/meson/s4-pll.c
create mode 100644drivers/clk/meson/s4-pll.h
create mode 100644include/dt-bindings/clock/amlogic,s4-pll-clkc.hDocumentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +6
-0@@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/amlogic,s4-pll-clkc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# +Quoted 8 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml line 13
Quoted 7 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +7
-0+title: Amlogic Meson S serials PLL Clock Controller + +maintainers: + - Neil Armstrong <[email protected]> + - Jerome Brunet <[email protected]> + - Yu Tu <[email protected]> +One blank line.
I will delete this, on next version patch.
Quoted 68 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h
Quoted 45 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +37
-0+ +properties: + compatible: + const: amlogic,s4-pll-clkc + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + items: + - const: xtal + + "#clock-cells": + const: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - "#clock-cells" + +additionalProperties: false + +examples: + - | + clkc_pll: clock-controller@fe008000 { + compatible = "amlogic,s4-pll-clkc"; + reg = <0xfe008000 0x1e8>; + clocks = <&xtal>; + clock-names = "xtal"; + #clock-cells = <1>; + }; +#endif /* __MESON_S4_PLL_H__ */include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +0
-0This belongs to bindings patch, not driver.
Quoted 6 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +5
-0@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ +/* +* Copyright (c) 2021 Amlogic, Inc. All rights reserved. +* Author: Yu Tu <[email protected]> +*/ include/dt-bindings/clock/amlogic,s4-pll-clkc.h line 15
Quoted 10 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +10
-0+ +#ifndef _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H +#define _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H + +/* +* CLKID index values +*/ + +#define CLKID_FIXED_PLL 1 +#define CLKID_FCLK_DIV2 3Indexes start from 0 and are incremented by 1. Not by 2.
NAK.
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
I remember Jerome discussing this with you.You can look at this submission history.
https://lore.kernel.org/all/[email protected]/Historically we did that by only exposing part of the numbers, controlling which clocks were part of the bindings.
But it seems this doesn't make sens anymore, maybe it would be time to put all the clock ids in the bindings for this new SoC and break with the previous strategy.
Krzysztof and I agreed there is nothing wrong with the current approach, I believe.
It does not prevent someone from using an un-exposed clock, sure, or exposing it in the future if necessary.
However, I think it clearly shows that an un-exposed element is not expected to be used by an external consumers. It should be enough to trigger a discussion if this expectation is wrong.Quoted 4 lines
So the outcome of the previous discussion was somewhere later in that thread:
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
It is just a choice to not expose some IDs.
It is not tied to the implementation at all.
I think we actually follow the rules and the idea behind it.Best regards,
Krzysztof.
.
Re: [PATCH V5 1/4] clk: meson: S4: add support for Amlogic S4 SoC PLL clock driver and bindings
Quoted 113 lines · On 2022/12/1 16:36, [email protected] wrote:
[ EXTERNAL EMAIL ]
Quoted 85 lines · Yu Tu
Hi Jerome ,
Quoted 55 lines · Jerome Brunet
[ EXTERNAL EMAIL ]
Quoted 39 lines · Yu Tu
Hi Jerome,
Thank you for your reply.Quoted 35 lines · Jerome Brunet
[ EXTERNAL EMAIL ]
Quoted 31 lines · Krzysztof Kozlowski
Quoted 30 lines · Neil Armstrong
Hi,
Quoted 18 lines · Yu Tu
Hi Krzysztof,
Thank you for your reply.Quoted 14 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 5 lines · Yu Tu
Add the S4 PLL clock controller found and bindings in the s4 SoC family.
Signed-off-by Yu Tu <[email protected]>---
.../bindings/clock/amlogic,s4-pll-clkc.yaml | 51 +This is v5 and still bindings are here? Bindings are always separate patches. Use subject prefixes matching the subsystem (git log --oneline
-- ...).Quoted 4 lines
Quoted 1 line
And this was split, wasn't it? What happened here?!?
Put bindings and clock driver patch together from Jerome. Maybe you can read this chat history.
https://lore.kernel.or/all/[email protected]/Jerome was asking you to send 2 patchsets, one with :
- bindings in separate patches
- drivers in separate patches
and a second with DT changes.Quoted 5 lines
Quoted 1 line
Indeed, this is what was asked. It is aligned with Krzysztof's request.
According to your discussion, I still should send patches in the previous way in series. But I'm going to change it like you suggested. I don't know, am I getting it right?
3 people tried to explain this already and we all told you the same thing.
* 1 patchset per maintainer: clk and dt
* bindings must be dedicated patches - never mixed with driver code.Quoted 8 lines
I strongly suggest that you take some time to (re)read:
* https://docs.kernel.org/process/submitting-patches.html
* https://docs.kernel.org/devicetree/bindings/submitting-patches.htmlIf still unclear, please take some time to look at the kernel mailing list archive and see how others have done the same things.
Thx.
I'll change it as you suggest.But I still don't understand what you suggested in V3.
I remember discussing it with you at V3.
https://lore.kernel.or/all/[email protected]/">>>> Also it would be nice to split this in two series.
>>>> Bindings and drivers in one, arm64 dt in the other. These changes goes >>>> in through different trees.
>>> At present, Bindings, DTS and drivers are three series. Do you mean to put >>> Bindings and drivers together? If so, checkpatch.pl will report a warning. >> Yes because patches are not in yet so there is a good reason to ignore >> the warning. Warning will never show up on the actual tree if the >> patches are correctly ordered.
>
> I think Binding, DTS and drivers use three series and you said two series > is not a big problem. Three series are recommended for checkpatch.pl, I > think it should be easy for that to separate and merge。Quoted 2 lines
No - There is only 2 series. 1 for the bindings and clock drivers and one for the DT once things are in"
Please send the following emails:
* First patchset
[PATCH V6 0/3] clk: meson: Add S4 SoC PLL and Peripheral clock controller
[PATCH v6 1/3] dt-bindings: clock: document Amlogic S4 SoC PLL &
peripheral clock controller
[PATCH v6 2/3] clk: meson: add support for Amlogic S4 SoC PLL [PATCH v6 3/3] clk: meson: add support for Amlogic S4 SoC
peripheral clock controller1) will contain only .yaml and dt-bindings include
2) will only havedrivers/clk/mesonchanges
3) will only havedrivers/clk/mesonchanges* Second patchset:
[PATCH v1 0/2] arm64: dts: meson: Add S4 SoC PLL and Peripheral clock nodes
[PATCH v1 1/2] arm64: dts: meson: add S4 Soc PLL clock controller node [PATCH v1 2/2] arm64: dts: meson: add S4 Soc Peripheral clock
controller node
Quoted 7 lines
1) is the patch 3 of v5 patchset
2) is the patch 4 of v5 patchsetAnd in the second cover letter, explain those patches comes from the previous V5 patchset and add a link to the V6 "drivers + bindings" patchset as a dependency.
Neil
Hi Neil,
Thank you very much for your detailed explanation.
Quoted 143 lines
Quoted 143 lines
Quoted 143 lines
Quoted 143 lines
Quoted 143 lines
Quoted 118 lines
Quoted 118 lines
Then when the bindings + clocks patches are merged, a pull request of the bindings can be done to me so I can merge it with DT.
Quoted 110 lines
Quoted 30 lines
Quoted 30 lines
MAINTAINERS | 1 + drivers/clk/meson/Kconfig | 13 + drivers/clk/meson/Makefile | 1 + drivers/clk/meson/s4-pll.c | 875
++++++++++++++++++
drivers/clk/meson/s4-pll.h | 88 ++ .../dt-bindings/clock/amlogic,s4-pll-clkc.h | 30 +7 files changed, 1059 insertions(+)create mode 100644
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yamlcreate mode 100644drivers/clk/meson/s4-pll.c
create mode 100644drivers/clk/meson/s4-pll.h
create mode 100644include/dt-bindings/clock/amlogic,s4-pll-clkc.h(quoted diff) +0
-0
b/Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml(quoted diff) +4
-0@@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id:http://devicetree.org/schemas/clock/amlogic,s4-pll-clkc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+Quoted 8 lines
Review
Quoted 7 lines
(quoted diff) +7
-0+title: Amlogic Meson S serials PLL Clock Controller + +maintainers: + - Neil Armstrong <[email protected]> + - Jerome Brunet <[email protected]> + - Yu Tu <[email protected]> +One blank line.
I will delete this, on next version patch.
Quoted 68 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h
Quoted 45 lines
(quoted diff) +37
-0+ +properties: + compatible: + const: amlogic,s4-pll-clkc + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + items: + - const: xtal + + "#clock-cells": + const: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - "#clock-cells" + +additionalProperties: false + +examples: + - | + clkc_pll: clock-controller@fe008000 { + compatible = "amlogic,s4-pll-clkc"; + reg = <0xfe008000 0x1e8>; + clocks = <&xtal>; + clock-names = "xtal"; + #clock-cells = <1>; + }; +#endif /* __MESON_S4_PLL_H__ */include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +0
-0This belongs to bindings patch, not driver.
Quoted 6 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +5
-0@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ +/* +* Copyright (c) 2021 Amlogic, Inc. All rights reserved. +* Author: Yu Tu <[email protected]> +*/ include/dt-bindings/clock/amlogic,s4-pll-clkc.h line 15
Quoted 10 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +10
-0+ +#ifndef _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H +#define _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H + +/* +* CLKID index values +*/ + +#define CLKID_FIXED_PLL 1 +#define CLKID_FCLK_DIV2 3Indexes start from 0 and are incremented by 1. Not by 2.
NAK.
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
I remember Jerome discussing this with you.You can look at this submission history.
https://lore.kernel.org/all/[email protected]/Historically we did that by only exposing part of the numbers, controlling which clocks were part of the bindings.
But it seems this doesn't make sens anymore, maybe it would be time to put all the clock ids in the bindings for this new SoC and break with the previous strategy.
Krzysztof and I agreed there is nothing wrong with the current approach, I believe.
It does not prevent someone from using an un-exposed clock, sure, or exposing it in the future if necessary.
However, I think it clearly shows that an un-exposed element is not expected to be used by an external consumers. It should be enough to trigger a discussion if this expectation is wrong.Quoted 9 lines
So the outcome of the previous discussion was somewhere later in that thread:
Quoted 3 lines
It is just a choice to not expose some IDs.
It is not tied to the implementation at all.
I think we actually follow the rules and the idea behind it.
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Best regards,
Krzysztof.
.
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Re: [PATCH V5 1/4] clk: meson: S4: add support for Amlogic S4 SoC PLL clock driver and bindings
In reply to Neil ArmstrongHi Neil,
Quoted 27 lines · Neil Armstrong
[ EXTERNAL EMAIL ]
Hi,
Quoted 13 lines · Yu Tu
Hi Krzysztof,
Thank you for your reply.Quoted 9 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 5 lines · Yu Tu
Add the S4 PLL clock controller found and bindings in the s4 SoC family.
Signed-off-by Yu Tu <[email protected]>---
.../bindings/clock/amlogic,s4-pll-clkc.yaml | 51 +Quoted 8 lines
Quoted 5 lines
This is v5 and still bindings are here? Bindings are always separate patches. Use subject prefixes matching the subsystem (git log --oneline -- ...).
And this was split, wasn't it? What happened here?!?
Put bindings and clock driver patch together from Jerome. Maybe you can read this chat history.
https://lore.kernel.or/all/[email protected]/
Quoted 8 lines
Jerome was asking you to send 2 patchsets, one with :
- bindings in separate patches
- drivers in separate patches
and a second with DT changes.Then when the bindings + clocks patches are merged, a pull request of the bindings can be done to me so I can merge it with DT.
I may have misunderstood Jerome's advice.So should I follow the V4 patch format and change as Jerome suggested from V3?
Quoted 112 lines
Quoted 106 lines
Quoted 28 lines
Quoted 28 lines
MAINTAINERS | 1 + drivers/clk/meson/Kconfig | 13 + drivers/clk/meson/Makefile | 1 + drivers/clk/meson/s4-pll.c | 875
++++++++++++++++++
drivers/clk/meson/s4-pll.h | 88 ++ .../dt-bindings/clock/amlogic,s4-pll-clkc.h | 30 +7 files changed, 1059 insertions(+)create mode 100644
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yamlcreate mode 100644drivers/clk/meson/s4-pll.c
create mode 100644drivers/clk/meson/s4-pll.h
create mode 100644include/dt-bindings/clock/amlogic,s4-pll-clkc.hDocumentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +6
-0@@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/amlogic,s4-pll-clkc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# +Quoted 8 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml line 13
Quoted 7 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +7
-0+title: Amlogic Meson S serials PLL Clock Controller + +maintainers: + - Neil Armstrong <[email protected]> + - Jerome Brunet <[email protected]> + - Yu Tu <[email protected]> +One blank line.
I will delete this, on next version patch.
Quoted 67 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h
Quoted 45 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +37
-0+ +properties: + compatible: + const: amlogic,s4-pll-clkc + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + items: + - const: xtal + + "#clock-cells": + const: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - "#clock-cells" + +additionalProperties: false + +examples: + - | + clkc_pll: clock-controller@fe008000 { + compatible = "amlogic,s4-pll-clkc"; + reg = <0xfe008000 0x1e8>; + clocks = <&xtal>; + clock-names = "xtal"; + #clock-cells = <1>; + }; +#endif /* __MESON_S4_PLL_H__ */include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +0
-0This belongs to bindings patch, not driver.
Quoted 6 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +5
-0@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ +/* +* Copyright (c) 2021 Amlogic, Inc. All rights reserved. +* Author: Yu Tu <[email protected]> +*/ include/dt-bindings/clock/amlogic,s4-pll-clkc.h line 15
Quoted 10 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +10
-0+ +#ifndef _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H +#define _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H + +/* +* CLKID index values +*/ + +#define CLKID_FIXED_PLL 1 +#define CLKID_FCLK_DIV2 3Indexes start from 0 and are incremented by 1. Not by 2.
Quoted 5 lines
Quoted 1 line
NAK.
I remember Jerome discussing this with you.You can look at this submission history.
https://lore.kernel.org/all/[email protected]/
Quoted 5 lines
Historically we did that by only exposing part of the numbers, controlling which clocks were part of the bindings.
But it seems this doesn't make sens anymore, maybe it would be time to put all the clock ids in the bindings for this new SoC and break with the previous strategy.
That's OK with me. But I don't know if Jerome thinks it's ok?
Quoted 11 lines
Neil
Quoted 6 lines
Quoted 6 lines
Best regards,
Krzysztof.
.
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
[email protected]
maintainerRe: [PATCH V5 1/4] clk: meson: S4: add support for Amlogic S4 SoC PLL clock driver and bindings
Quoted 35 lines · Yu Tu
Hi Neil,
Quoted 32 lines · Neil Armstrong
[ EXTERNAL EMAIL ]
Hi,
Quoted 13 lines · Yu Tu
Hi Krzysztof,
Thank you for your reply.Quoted 9 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 5 lines · Yu Tu
Add the S4 PLL clock controller found and bindings in the s4 SoC family.
Signed-off-by Yu Tu <[email protected]>---
.../bindings/clock/amlogic,s4-pll-clkc.yaml | 51 +Quoted 8 lines
Quoted 5 lines
This is v5 and still bindings are here? Bindings are always separate patches. Use subject prefixes matching the subsystem (git log --oneline -- ...).
And this was split, wasn't it? What happened here?!?
Put bindings and clock driver patch together from Jerome. Maybe you can read this chat history.
https://lore.kernel.or/all/[email protected]/Jerome was asking you to send 2 patchsets, one with :
- bindings in separate patches
- drivers in separate patches
and a second with DT changes.
Quoted 5 lines
Quoted 3 lines
Then when the bindings + clocks patches are merged, a pull request of the bindings can be done to me so I can merge it with DT.
I may have misunderstood Jerome's advice.So should I follow the V4 patch format and change as Jerome suggested from V3?
Let's wait for his input on this to see if a v4 is needed now or later.
Quoted 111 lines
Quoted 111 lines
Quoted 110 lines
Quoted 28 lines
Quoted 28 lines
MAINTAINERS | 1 + drivers/clk/meson/Kconfig | 13 +
drivers/clk/meson/Makefile | 1 + drivers/clk/meson/s4-pll.c | 875 ++++++++++++++++++ drivers/clk/meson/s4-pll.h | 88 ++ .../dt-bindings/clock/amlogic,s4-pll-clkc.h | 30 + 7 files changed, 1059 insertions(+)create mode 100644
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yamlcreate mode 100644drivers/clk/meson/s4-pll.c
create mode 100644drivers/clk/meson/s4-pll.h
create mode 100644include/dt-bindings/clock/amlogic,s4-pll-clkc.hDocumentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +6
-0@@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/amlogic,s4-pll-clkc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# +Quoted 8 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml line 13
Quoted 7 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +7
-0+title: Amlogic Meson S serials PLL Clock Controller + +maintainers: + - Neil Armstrong <[email protected]> + - Jerome Brunet <[email protected]> + - Yu Tu <[email protected]> +One blank line.
I will delete this, on next version patch.
Quoted 67 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h
Quoted 45 lines
Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yaml new file +37
-0+ +properties: + compatible: + const: amlogic,s4-pll-clkc + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + items: + - const: xtal + + "#clock-cells": + const: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - "#clock-cells" + +additionalProperties: false + +examples: + - | + clkc_pll: clock-controller@fe008000 { + compatible = "amlogic,s4-pll-clkc"; + reg = <0xfe008000 0x1e8>; + clocks = <&xtal>; + clock-names = "xtal"; + #clock-cells = <1>; + }; +#endif /* __MESON_S4_PLL_H__ */include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +0
-0This belongs to bindings patch, not driver.
Quoted 6 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +5
-0@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ +/* +* Copyright (c) 2021 Amlogic, Inc. All rights reserved. +* Author: Yu Tu <[email protected]> +*/ include/dt-bindings/clock/amlogic,s4-pll-clkc.h line 15
Quoted 10 lines
include/dt-bindings/clock/amlogic,s4-pll-clkc.h new file +10
-0+ +#ifndef _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H +#define _DT_BINDINGS_CLOCK_AMLOGIC_S4_PLL_CLKC_H + +/* +* CLKID index values +*/ + +#define CLKID_FIXED_PLL 1 +#define CLKID_FCLK_DIV2 3Indexes start from 0 and are incremented by 1. Not by 2.
Quoted 1 line
NAK.
I remember Jerome discussing this with you.You can look at this submission history.
https://lore.kernel.org/all/[email protected]/
Quoted 7 lines
Quoted 5 lines
Historically we did that by only exposing part of the numbers, controlling which clocks were part of the bindings.
But it seems this doesn't make sens anymore, maybe it would be time to put all the clock ids in the bindings for this new SoC and break with the previous strategy.
That's OK with me. But I don't know if Jerome thinks it's ok?
Let's wait for his input on that aswell.
Neil
Quoted 6 lines
Quoted 6 lines
Neil
Quoted 2 lines
Quoted 2 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Best regards,
Krzysztof.
.
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
PATCH v5 2/4 arm64: dts: meson: add S4 Soc PLL clock controller in DT
In reply to Yu TuAdded information about the S4 SOC PLL Clock controller in DT.
--- arch/arm64/boot/dts/amlogic/meson-s4.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm64/boot/dts/amlogic/meson-s4.dtsi +8 -0
@@ -92,6 +92,14 @@ apb4: apb4@fe000000 { #size-cells = <2>; ranges = <0x0 0x0 0x0 0xfe000000 0x0 0x480000>; + clkc_pll: clock-controller@8000 { + compatible = "amlogic,s4-pll-clkc"; + reg = <0x0 0x8000 0x0 0x1e8>; + clocks = <&xtal>; + clock-names = "xtal"; + #clock-cells = <1>; + }; + periphs_pinctrl: pinctrl@4000 { compatible = "amlogic,meson-s4-periphs-pinctrl"; #address-cells = <2>;
Signature · 1 line
2.33.1
PATCH v5 3/4 clk: meson: s4: add s4 SoC peripheral clock controller driver and bindings
In reply to Yu TuAdd the peripherals clock controller found and bindings in the s4 SoC family.
--- .../clock/amlogic,s4-peripherals-clkc.yaml | 105 + drivers/clk/meson/Kconfig | 12 + drivers/clk/meson/Makefile | 1 + drivers/clk/meson/s4-peripherals.c | 3783 +++++++++++++++++ drivers/clk/meson/s4-peripherals.h | 218 + .../clock/amlogic,s4-peripherals-clkc.h | 131 + 6 files changed, 4250 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/amlogic,s4-peripherals-clkc.yaml create mode 100644 drivers/clk/meson/s4-peripherals.c create mode 100644 drivers/clk/meson/s4-peripherals.h create mode 100644 include/dt-bindings/clock/amlogic,s4-peripherals-clkc.h
Documentation/devicetree/bindings/clock/amlogic,s4-peripherals-clkc.yaml new file +105 -0
@@ -0,0 +1,105 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/amlogic,s4-peripherals-clkc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Amlogic Meson S serials Peripherals Clock Controller + +maintainers: + - Neil Armstrong <[email protected]> + - Jerome Brunet <[email protected]> + - Yu Tu <[email protected]> + + +properties: + compatible: + const: amlogic,s4-peripherals-clkc + + reg: + maxItems: 1 + + clocks: + items: + - description: input fixed pll div2 + - description: input fixed pll div2p5 + - description: input fixed pll div3 + - description: input fixed pll div4 + - description: input fixed pll div5 + - description: input fixed pll div7 + - description: input hifi pll + - description: input gp0 pll + - description: input mpll0 + - description: input mpll1 + - description: input mpll2 + - description: input mpll3 + - description: input hdmi pll + - description: input oscillator (usually at 24MHz) + - description: input external 32kHz reference (optional) + + clock-names: + items: + - const: fclk_div2 + - const: fclk_div2p5 + - const: fclk_div3 + - const: fclk_div4 + - const: fclk_div5 + - const: fclk_div7 + - const: hifi_pll + - const: gp0_pll + - const: mpll0 + - const: mpll1 + - const: mpll2 + - const: mpll3 + - const: hdmi_pll + - const: xtal + - const: ext_32k + + "#clock-cells": + const: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - "#clock-cells" + +additionalProperties: false + +examples: + - | + #include <dt-bindings/clock/amlogic,s4-peripherals-clkc.h> + + /* 32KHz reference crystal */ + ext_32k: ref32k { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <32000>; + }; + + clkc_periphs: clock-controller@fe000000 { + compatible = "amlogic,s4-peripherals-clkc"; + reg = <0xfe000000 0x49c>; + clocks = <&clkc_pll 3>, + <&clkc_pll 13>, + <&clkc_pll 5>, + <&clkc_pll 7>, + <&clkc_pll 9>, + <&clkc_pll 11>, + <&clkc_pll 17>, + <&clkc_pll 15>, + <&clkc_pll 25>, + <&clkc_pll 27>, + <&clkc_pll 29>, + <&clkc_pll 31>, + <&clkc_pll 20>, + <&xtal>, + <&ext_32k>; + clock-names = "fclk_div2", "fclk_div2p5", "fclk_div3", "fclk_div4", + "fclk_div5", "fclk_div7", "hifi_pll", "gp0_pll", + "mpll0", "mpll1", "mpll2", "mpll3", "hdmi_pll", "xtal", + "ext_32k"; + #clock-cells = <1>; + }; +...
drivers/clk/meson/Kconfig +12 -0
@@ -128,4 +128,16 @@ config COMMON_CLK_S4_PLL aka s4. Amlogic S805X2 and S905Y4 devices include AQ222 and AQ229. Say Y if you want the board to work, because plls are the parent of most peripherals. + +config COMMON_CLK_S4 + tristate "S4 SoC Peripherals clock controllers support" + depends on ARM64 + default y + select COMMON_CLK_MESON_REGMAP + select COMMON_CLK_MESON_DUALDIV + select COMMON_CLK_MESON_VID_PLL_DIV + help + Support for the Peripherals clock controller on Amlogic S805X2 and S905Y4 + devices, aka s4. Amlogic S805X2 and S905Y4 devices include AQ222 and AQ229. + Say Y if you want peripherals to work. endmenu
drivers/clk/meson/Makefile +1 -0
@@ -20,3 +20,4 @@ obj-$(CONFIG_COMMON_CLK_GXBB) += gxbb.o gxbb-aoclk.o obj-$(CONFIG_COMMON_CLK_G12A) += g12a.o g12a-aoclk.o obj-$(CONFIG_COMMON_CLK_MESON8B) += meson8b.o meson8-ddr.o obj-$(CONFIG_COMMON_CLK_S4_PLL) += s4-pll.o +obj-$(CONFIG_COMMON_CLK_S4) += s4-peripherals.o
drivers/clk/meson/s4-peripherals.c new file +3783 -0
2,875 lines not on this page · raw message
drivers/clk/meson/s4-peripherals.h new file +218 -0
218 lines not on this page · raw message
include/dt-bindings/clock/amlogic,s4-peripherals-clkc.h new file +131 -0
131 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 7 lines
2.33.1 _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic
Part of the diff is not shown here. View the raw message.
Re: [PATCH V5 3/4] clk: meson: s4: add s4 SoC peripheral clock controller driver and bindings
Quoted 5 lines · Yu Tu
Add the peripherals clock controller found and bindings in the s4 SoC family.
Signed-off-by Yu Tu <[email protected]>--- .../clock/amlogic,s4-peripherals-clkc.yaml | 105 +
No, this is total mess now.
Additionally, you received a lot of feedback but your changelog says only:
"V3 -> V4: change format and clock flags."
so you ignored entire feedback?
That's not the way to work with patches.
Best regards,
Krzysztof
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Re: [PATCH V5 3/4] clk: meson: s4: add s4 SoC peripheral clock controller driver and bindings
Quoted 9 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 5 lines · Yu Tu
Add the peripherals clock controller found and bindings in the s4 SoC family.
Signed-off-by Yu Tu <[email protected]>--- .../clock/amlogic,s4-peripherals-clkc.yaml | 105 +
Quoted 7 lines
No, this is total mess now.
Additionally, you received a lot of feedback but your changelog says only:
"V3 -> V4: change format and clock flags."
so you ignored entire feedback?That's not the way to work with patches.
Hi Krzysztof,
You can check the previous email reply. Now I don't know who to follow
your advice or Jerome's. I'm confused. Maybe you need to come to a conclusion. So I can change it in the next patch.
Quoted 5 lines
Best regards,
Krzysztof.
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Re: [PATCH V5 3/4] clk: meson: s4: add s4 SoC peripheral clock controller driver and bindings
Quoted 18 lines · Yu Tu
Quoted 15 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 5 lines · Yu Tu
Add the peripherals clock controller found and bindings in the s4 SoC family.
Signed-off-by Yu Tu <[email protected]>--- .../clock/amlogic,s4-peripherals-clkc.yaml | 105 +No, this is total mess now.
Additionally, you received a lot of feedback but your changelog says only:
"V3 -> V4: change format and clock flags."
so you ignored entire feedback?
Quoted 6 lines
Quoted 1 line
That's not the way to work with patches.
Hi Krzysztof,
You can check the previous email reply. Now I don't know who to follow
your advice or Jerome's. I'm confused. Maybe you need to come to a conclusion. So I can change it in the next patch.
I don't understand your comment. You received a lot of things to change for your v3. You said here "change format and clock flagS", so all other feedbacks from me were ignored? They were not contradicting to Jerome's comments, so either you implement them and mention this in changelog, or you keep discussing.
Best regards,
Krzysztof
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Re: [PATCH V5 3/4] clk: meson: s4: add s4 SoC peripheral clock controller driver and bindings
Hi Krzysztof,
Quoted 28 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 18 lines · Yu Tu
Quoted 15 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 5 lines · Yu Tu
Add the peripherals clock controller found and bindings in the s4 SoC family.
Signed-off-by Yu Tu <[email protected]>--- .../clock/amlogic,s4-peripherals-clkc.yaml | 105 +No, this is total mess now.
Additionally, you received a lot of feedback but your changelog says only:
"V3 -> V4: change format and clock flags."
so you ignored entire feedback?Quoted 6 lines
Quoted 1 line
That's not the way to work with patches.
Hi Krzysztof,
You can check the previous email reply. Now I don't know who to follow
your advice or Jerome's. I'm confused. Maybe you need to come to a conclusion. So I can change it in the next patch.
Quoted 6 lines
I don't understand your comment. You received a lot of things to change for your v3. You said here "change format and clock flagS", so all other feedbacks from me were ignored? They were not contradicting to Jerome's comments, so either you implement them and mention this in changelog, or you keep discussing.
I'm sorry I didn't write that clearly. The reality is that V4 I have changed some of the suggestions from Jerome. But there was a part that didn't agree before I sent V4, which Jerome chose to skip. Let's continue with V3, and then prepare this V5.
Quoted 4 lines
Best regards,
Krzysztof.
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Jerome Brunet
maintainerRe: [PATCH V5 3/4] clk: meson: s4: add s4 SoC peripheral clock controller driver and bindings
In reply to Yu TuQuoted 276 lines · Yu Tu
Add the peripherals clock controller found and bindings in the s4 SoC family.
Signed-off-by Yu Tu <[email protected]>--- .../clock/amlogic,s4-peripherals-clkc.yaml | 105 + drivers/clk/meson/Kconfig | 12 + drivers/clk/meson/Makefile | 1 + drivers/clk/meson/s4-peripherals.c | 3783 +++++++++++++++++ drivers/clk/meson/s4-peripherals.h | 218 + .../clock/amlogic,s4-peripherals-clkc.h | 131 + 6 files changed, 4250 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/amlogic,s4-peripherals-clkc.yaml create mode 100644 drivers/clk/meson/s4-peripherals.c create mode 100644 drivers/clk/meson/s4-peripherals.h create mode 100644 include/dt-bindings/clock/amlogic,s4-peripherals-clkc.hDocumentation/devicetree/bindings/clock/amlogic,s4-peripherals-clkc.yaml new file +105
-0@@ -0,0 +1,105 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/amlogic,s4-peripherals-clkc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Amlogic Meson S serials Peripherals Clock Controller + +maintainers: + - Neil Armstrong <[email protected]> + - Jerome Brunet <[email protected]> + - Yu Tu <[email protected]> + + +properties: + compatible: + const: amlogic,s4-peripherals-clkc + + reg: + maxItems: 1 + + clocks: + items: + - description: input fixed pll div2 + - description: input fixed pll div2p5 + - description: input fixed pll div3 + - description: input fixed pll div4 + - description: input fixed pll div5 + - description: input fixed pll div7 + - description: input hifi pll + - description: input gp0 pll + - description: input mpll0 + - description: input mpll1 + - description: input mpll2 + - description: input mpll3 + - description: input hdmi pll + - description: input oscillator (usually at 24MHz) + - description: input external 32kHz reference (optional) + + clock-names: + items: + - const: fclk_div2 + - const: fclk_div2p5 + - const: fclk_div3 + - const: fclk_div4 + - const: fclk_div5 + - const: fclk_div7 + - const: hifi_pll + - const: gp0_pll + - const: mpll0 + - const: mpll1 + - const: mpll2 + - const: mpll3 + - const: hdmi_pll + - const: xtal + - const: ext_32k + + "#clock-cells": + const: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - "#clock-cells" + +additionalProperties: false + +examples: + - | + #include <dt-bindings/clock/amlogic,s4-peripherals-clkc.h> + + /* 32KHz reference crystal */ + ext_32k: ref32k { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <32000>; + }; + + clkc_periphs: clock-controller@fe000000 { + compatible = "amlogic,s4-peripherals-clkc"; + reg = <0xfe000000 0x49c>; + clocks = <&clkc_pll 3>, + <&clkc_pll 13>, + <&clkc_pll 5>, + <&clkc_pll 7>, + <&clkc_pll 9>, + <&clkc_pll 11>, + <&clkc_pll 17>, + <&clkc_pll 15>, + <&clkc_pll 25>, + <&clkc_pll 27>, + <&clkc_pll 29>, + <&clkc_pll 31>, + <&clkc_pll 20>, + <&xtal>, + <&ext_32k>; + clock-names = "fclk_div2", "fclk_div2p5", "fclk_div3", "fclk_div4", + "fclk_div5", "fclk_div7", "hifi_pll", "gp0_pll", + "mpll0", "mpll1", "mpll2", "mpll3", "hdmi_pll", "xtal", + "ext_32k"; + #clock-cells = <1>; + }; +...drivers/clk/meson/Kconfig +12
-0@@ -128,4 +128,16 @@ config COMMON_CLK_S4_PLL aka s4. Amlogic S805X2 and S905Y4 devices include AQ222 and AQ229. Say Y if you want the board to work, because plls are the parent of most peripherals. + +config COMMON_CLK_S4 + tristate "S4 SoC Peripherals clock controllers support" + depends on ARM64 + default y + select COMMON_CLK_MESON_REGMAP + select COMMON_CLK_MESON_DUALDIV + select COMMON_CLK_MESON_VID_PLL_DIV + help + Support for the Peripherals clock controller on Amlogic S805X2 and S905Y4 + devices, aka s4. Amlogic S805X2 and S905Y4 devices include AQ222 and AQ229. + Say Y if you want peripherals to work. endmenudrivers/clk/meson/Makefile +1
-0@@ -20,3 +20,4 @@ obj-$(CONFIG_COMMON_CLK_GXBB) += gxbb.o gxbb-aoclk.o obj-$(CONFIG_COMMON_CLK_G12A) += g12a.o g12a-aoclk.o obj-$(CONFIG_COMMON_CLK_MESON8B) += meson8b.o meson8-ddr.o obj-$(CONFIG_COMMON_CLK_S4_PLL) += s4-pll.o +obj-$(CONFIG_COMMON_CLK_S4) += s4-peripherals.odrivers/clk/meson/s4-peripherals.c new file +113
-0@@ -0,0 +1,3783 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Amlogic Meson-S4 Peripherals Clock Controller Driver +* +* Copyright (c) 2021 Amlogic, inc. +* Author: Yu Tu <[email protected]> +*/ + +#include <linux/clk-provider.h> +#include <linux/of_device.h> +#include <linux/platform_device.h> + +#include "clk-regmap.h" +#include "vid-pll-div.h" +#include "clk-dualdiv.h" +#include "s4-peripherals.h" + +static struct clk_regmap s4_rtc_32k_by_oscin_clkin = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_RTC_BY_OSCIN_CTRL0 , + .bit_idx =31 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="rtc_32k_by_oscin_clkin" , + .ops = &clk_regmap_gate_ops, + .parent_data = (const struct clk_parent_data []) { + { .fw_name ="xtal" , } + }, + .num_parents =1 , + }, +}; + +static const struct meson_clk_dualdiv_param s4_32k_div_table[] = { + { + .dual =1 , + .n1 =733 , + .m1 =8 , + .n2 =732 , + .m2 =11 , + }, + {} +}; + +static struct clk_regmap s4_rtc_32k_by_oscin_div = { + .data = &(struct meson_clk_dualdiv_data ){ + .n1 = { + .reg_off =CLKCTRL_RTC_BY_OSCIN_CTRL0 , + .shift =0 , + .width =12 , + }, + .n2 = { + .reg_off =CLKCTRL_RTC_BY_OSCIN_CTRL0 , + .shift =12 , + .width =12 , + }, + .m1 = { + .reg_off =CLKCTRL_RTC_BY_OSCIN_CTRL1 , + .shift =0 , + .width =12 , + }, + .m2 = { + .reg_off =CLKCTRL_RTC_BY_OSCIN_CTRL1 , + .shift =12 , + .width =12 , + }, + .dual = { + .reg_off =CLKCTRL_RTC_BY_OSCIN_CTRL0 , + .shift =28 , + .width =1 , + }, + .table = s4_32k_div_table, + }, + .hw.init = &(struct clk_init_data ){ + .name ="rtc_32k_by_oscin_div" , + .ops = &meson_clk_dualdiv_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_rtc_32k_by_oscin_clkin.hw + }, + .num_parents =1 , + }, +}; + +static struct clk_regmap s4_rtc_32k_by_oscin_sel = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_RTC_BY_OSCIN_CTRL1 , + .mask =0x1 , + .shift =24 , + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ){ + .name ="rtc_32k_by_oscin_sel" , + .ops = &clk_regmap_mux_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_rtc_32k_by_oscin_div.hw, + &s4_rtc_32k_by_oscin_clkin.hw, + }, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_rtc_32k_by_oscin = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_RTC_BY_OSCIN_CTRL0 , + .bit_idx =30 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="rtc_32k_by_oscin" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_rtc_32k_by_oscin_sel.hw + }, + .num_parents =1 ,
drivers/clk/meson/s4-peripherals.c line 123
Quoted 10 lines
drivers/clk/meson/s4-peripherals.c new file +10
-0+ .flags = CLK_SET_RATE_PARENT, + }, +}; + +/* +* This RTC clock can be supplied by an external 32KHz crystal oscillator. +* If it is used, it should be documented in using fw_name and documented in the +* Bindings. Not currently in use on this board, so skip it. +*/ +static u32 rtc_clk_sel[] = {0 ,1 };
No reason to do that
Quoted 475 lines
drivers/clk/meson/s4-peripherals.c new file +475
-0+static const struct clk_parent_data rtc_clk_sel_parent_data[] = { + { .hw = &s4_rtc_32k_by_oscin.hw }, + { .hw = &s4_rtc_32k_by_oscin_div.hw }, + { .fw_name ="ext_32k" , } +}; + +static struct clk_regmap s4_rtc_clk = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_RTC_CTRL , + .mask =0x3 , + .shift =0 , + .table = rtc_clk_sel, + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ){ + .name ="rtc_clk_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = rtc_clk_sel_parent_data, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* The index 5 is AXI_CLK, which is dedicated to AXI. So skip it. */ +static u32 mux_table_sys_ab_clk_sel[] = {0 ,1 ,2 ,3 ,4 ,6 ,7 }; +static const struct clk_parent_data sys_ab_clk_parent_data[] = { + { .fw_name ="xtal" }, + { .fw_name ="fclk_div2" }, + { .fw_name ="fclk_div3" }, + { .fw_name ="fclk_div4" }, + { .fw_name ="fclk_div5" }, + { .fw_name ="fclk_div7" }, + { .hw = &s4_rtc_clk.hw } +}; + +static struct clk_regmap s4_sysclk_b_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_SYS_CLK_CTRL0 , + .mask =0x7 , + .shift =26 , + .table = mux_table_sys_ab_clk_sel, + }, + .hw.init = &(struct clk_init_data ){ + .name ="sysclk_b_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = sys_ab_clk_parent_data, + .num_parents =ARRAY_SIZE (sys_ab_clk_parent_data), + }, +}; + +static struct clk_regmap s4_sysclk_b_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_SYS_CLK_CTRL0 , + .shift =16 , + .width =10 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="sysclk_b_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sysclk_b_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_sysclk_b = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_SYS_CLK_CTRL0 , + .bit_idx =29 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="sysclk_b" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sysclk_b_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_sysclk_a_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_SYS_CLK_CTRL0 , + .mask =0x7 , + .shift =10 , + .table = mux_table_sys_ab_clk_sel, + }, + .hw.init = &(struct clk_init_data ){ + .name ="sysclk_a_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = sys_ab_clk_parent_data, + .num_parents =ARRAY_SIZE (sys_ab_clk_parent_data), + }, +}; + +static struct clk_regmap s4_sysclk_a_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_SYS_CLK_CTRL0 , + .shift =0 , + .width =10 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="sysclk_a_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sysclk_a_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_sysclk_a = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_SYS_CLK_CTRL0 , + .bit_idx =13 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="sysclk_a" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sysclk_a_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_sys_clk = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_SYS_CLK_CTRL0 , + .mask =0x1 , + .shift =31 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="sys_clk" , + .ops = &clk_regmap_mux_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sysclk_a.hw, + &s4_sysclk_b.hw + }, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_ceca_32k_clkin = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_CECA_CTRL0 , + .bit_idx =31 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="ceca_32k_clkin" , + .ops = &clk_regmap_gate_ops, + .parent_data = (const struct clk_parent_data []) { + { .fw_name ="xtal" , } + }, + .num_parents =1 , + }, +}; + +static struct clk_regmap s4_ceca_32k_div = { + .data = &(struct meson_clk_dualdiv_data ){ + .n1 = { + .reg_off =CLKCTRL_CECA_CTRL0 , + .shift =0 , + .width =12 , + }, + .n2 = { + .reg_off =CLKCTRL_CECA_CTRL0 , + .shift =12 , + .width =12 , + }, + .m1 = { + .reg_off =CLKCTRL_CECA_CTRL1 , + .shift =0 , + .width =12 , + }, + .m2 = { + .reg_off =CLKCTRL_CECA_CTRL1 , + .shift =12 , + .width =12 , + }, + .dual = { + .reg_off =CLKCTRL_CECA_CTRL0 , + .shift =28 , + .width =1 , + }, + .table = s4_32k_div_table, + }, + .hw.init = &(struct clk_init_data ){ + .name ="ceca_32k_div" , + .ops = &meson_clk_dualdiv_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_ceca_32k_clkin.hw + }, + .num_parents =1 , + }, +}; + +static struct clk_regmap s4_ceca_32k_sel_pre = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_CECA_CTRL1 , + .mask =0x1 , + .shift =24 , + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ){ + .name ="ceca_32k_sel_pre" , + .ops = &clk_regmap_mux_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_ceca_32k_div.hw, + &s4_ceca_32k_clkin.hw + }, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_ceca_32k_sel = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_CECA_CTRL1 , + .mask =0x1 , + .shift =31 , + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ){ + .name ="ceca_32k_sel" , + .ops = &clk_regmap_mux_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_ceca_32k_sel_pre.hw, + &s4_rtc_clk.hw + }, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_ceca_32k_clkout = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_CECA_CTRL0 , + .bit_idx =30 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="ceca_32k_clkout" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_ceca_32k_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_cecb_32k_clkin = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_CECB_CTRL0 , + .bit_idx =31 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="cecb_32k_clkin" , + .ops = &clk_regmap_gate_ops, + .parent_data = (const struct clk_parent_data []) { + { .fw_name ="xtal" , } + }, + .num_parents =1 , + }, +}; + +static struct clk_regmap s4_cecb_32k_div = { + .data = &(struct meson_clk_dualdiv_data ){ + .n1 = { + .reg_off =CLKCTRL_CECB_CTRL0 , + .shift =0 , + .width =12 , + }, + .n2 = { + .reg_off =CLKCTRL_CECB_CTRL0 , + .shift =12 , + .width =12 , + }, + .m1 = { + .reg_off =CLKCTRL_CECB_CTRL1 , + .shift =0 , + .width =12 , + }, + .m2 = { + .reg_off =CLKCTRL_CECB_CTRL1 , + .shift =12 , + .width =12 , + }, + .dual = { + .reg_off =CLKCTRL_CECB_CTRL0 , + .shift =28 , + .width =1 , + }, + .table = s4_32k_div_table, + }, + .hw.init = &(struct clk_init_data ){ + .name ="cecb_32k_div" , + .ops = &meson_clk_dualdiv_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_cecb_32k_clkin.hw + }, + .num_parents =1 , + }, +}; + +static struct clk_regmap s4_cecb_32k_sel_pre = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_CECB_CTRL1 , + .mask =0x1 , + .shift =24 , + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ){ + .name ="cecb_32k_sel_pre" , + .ops = &clk_regmap_mux_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_cecb_32k_div.hw, + &s4_cecb_32k_clkin.hw + }, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_cecb_32k_sel = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_CECB_CTRL1 , + .mask =0x1 , + .shift =31 , + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ){ + .name ="cecb_32k_sel" , + .ops = &clk_regmap_mux_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_cecb_32k_sel_pre.hw, + &s4_rtc_clk.hw + }, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_cecb_32k_clkout = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_CECB_CTRL0 , + .bit_idx =30 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="cecb_32k_clkout" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_cecb_32k_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static const struct clk_parent_data s4_sc_parent_data[] = { + { .fw_name ="fclk_div4" }, + { .fw_name ="fclk_div3" }, + { .fw_name ="fclk_div5" }, + { .fw_name ="xtal" , } +}; + +static struct clk_regmap s4_sc_clk_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_SC_CLK_CTRL , + .mask =0x3 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="sc_clk_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_sc_parent_data, + .num_parents =ARRAY_SIZE (s4_sc_parent_data), + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_sc_clk_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_SC_CLK_CTRL , + .shift =0 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="sc_clk_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sc_clk_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_sc_clk_gate = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_SC_CLK_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="sc_clk_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sc_clk_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_12_24M_clk_gate = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_CLK12_24_CTRL , + .bit_idx =11 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="12_24m_gate" , + .ops = &clk_regmap_gate_ops, + .parent_data = (const struct clk_parent_data []) { + { .fw_name ="xtal" , } + }, + .num_parents =1 , + }, +}; + +static struct clk_fixed_factor s4_12M_clk_div = { + .mult =1 , + .div =2 , + .hw.init = &(struct clk_init_data ){ + .name ="12M" , + .ops = &clk_fixed_factor_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_12_24M_clk_gate.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_12_24M_clk = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_CLK12_24_CTRL , + .mask =0x1 , + .shift =10 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="12_24m" , + .ops = &clk_regmap_mux_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_12_24M_clk_gate.hw, + &s4_12M_clk_div.hw, + }, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* Video Clocks */ +static struct clk_regmap s4_vid_pll_div = { + .data = &(struct meson_vid_pll_div_data ){ + .val = { + .reg_off =CLKCTRL_VID_PLL_CLK_DIV , + .shift =0 , + .width =15 , + },
drivers/clk/meson/s4-peripherals.c line 608
Quoted 10 lines
drivers/clk/meson/s4-peripherals.c new file +10
-0+ .sel = { + .reg_off = CLKCTRL_VID_PLL_CLK_DIV, + .shift = 16, + .width = 2, + }, + }, + .hw.init = &(struct clk_init_data ) { + .name ="vid_pll_div" , +/* Same to g12a */ + .ops = &meson_vid_pll_div_ro_ops,
Please add an helpful explanation.
'Same to g12a' is not helpful.
Quoted 55 lines
drivers/clk/meson/s4-peripherals.c new file +55
-0+ .parent_data = (const struct clk_parent_data []) { + { .fw_name = "hdmi_pll", } + }, + .num_parents = 1, + .flags = CLK_SET_RATE_PARENT, + }, +}; + +static struct clk_regmap s4_vid_pll_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VID_PLL_CLK_DIV , + .mask =0x1 , + .shift =18 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vid_pll_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = (const struct clk_parent_data []) { + { .hw = &s4_vid_pll_div.hw }, + { .fw_name ="hdmi_pll" , } + }, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vid_pll = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_PLL_CLK_DIV , + .bit_idx =19 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vid_pll" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vid_pll_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static const struct clk_parent_data s4_vclk_parent_data[] = { + { .hw = &s4_vid_pll.hw }, + { .fw_name ="gp0_pll" , }, + { .fw_name ="hifi_pll" , }, + { .fw_name ="mpll1" , }, + { .fw_name ="fclk_div3" , }, + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div5" , }, + { .fw_name ="fclk_div7" , }, +}; + +static struct clk_regmap s4_vclk_sel = { + .data = &(struct clk_regmap_mux_data ){
drivers/clk/meson/s4-peripherals.c line 673
Quoted 10 lines
drivers/clk/meson/s4-peripherals.c new file +10
-0+ .offset = CLKCTRL_VID_CLK_CTRL, + .mask = 0x7, + .shift = 16, + }, + .hw.init = &(struct clk_init_data ){ + .name ="vclk_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_vclk_parent_data, + .num_parents =ARRAY_SIZE (s4_vclk_parent_data), + },
You are stopping rate propagation here.
It deserves an explanation. Same goes below.
Quoted 3,471 lines
drivers/clk/meson/s4-peripherals.c new file +3110
-0+}; + +static struct clk_regmap s4_vclk2_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VIID_CLK_CTRL , + .mask =0x7 , + .shift =16 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vclk2_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_vclk_parent_data, + .num_parents =ARRAY_SIZE (s4_vclk_parent_data), + }, +}; + +static struct clk_regmap s4_vclk_input = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_CLK_DIV , + .bit_idx =16 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk_input" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk_sel.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk2_input = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VIID_CLK_DIV , + .bit_idx =16 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk2_input" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk2_sel.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VID_CLK_DIV , + .shift =0 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vclk_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vclk_input.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk2_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VIID_CLK_DIV , + .shift =0 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vclk2_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vclk2_input.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_CLK_CTRL , + .bit_idx =19 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk_div.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk2 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VIID_CLK_CTRL , + .bit_idx =19 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk2" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk2_div.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk_div1 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_CLK_CTRL , + .bit_idx =0 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk_div1" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk_div2_en = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_CLK_CTRL , + .bit_idx =1 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk_div2_en" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk_div4_en = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_CLK_CTRL , + .bit_idx =2 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk_div4_en" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk_div6_en = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_CLK_CTRL , + .bit_idx =3 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk_div6_en" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk_div12_en = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_CLK_CTRL , + .bit_idx =4 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk_div12_en" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk2_div1 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VIID_CLK_CTRL , + .bit_idx =0 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk2_div1" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk2.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk2_div2_en = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VIID_CLK_CTRL , + .bit_idx =1 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk2_div2_en" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk2.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk2_div4_en = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VIID_CLK_CTRL , + .bit_idx =2 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk2_div4_en" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk2.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk2_div6_en = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VIID_CLK_CTRL , + .bit_idx =3 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk2_div6_en" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk2.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk2_div12_en = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VIID_CLK_CTRL , + .bit_idx =4 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk2_div12_en" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk2.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_fixed_factor s4_vclk_div2 = { + .mult =1 , + .div =2 , + .hw.init = &(struct clk_init_data ){ + .name ="vclk_div2" , + .ops = &clk_fixed_factor_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vclk_div2_en.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_fixed_factor s4_vclk_div4 = { + .mult =1 , + .div =4 , + .hw.init = &(struct clk_init_data ){ + .name ="vclk_div4" , + .ops = &clk_fixed_factor_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vclk_div4_en.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_fixed_factor s4_vclk_div6 = { + .mult =1 , + .div =6 , + .hw.init = &(struct clk_init_data ){ + .name ="vclk_div6" , + .ops = &clk_fixed_factor_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vclk_div6_en.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_fixed_factor s4_vclk_div12 = { + .mult =1 , + .div =12 , + .hw.init = &(struct clk_init_data ){ + .name ="vclk_div12" , + .ops = &clk_fixed_factor_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vclk_div12_en.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_fixed_factor s4_vclk2_div2 = { + .mult =1 , + .div =2 , + .hw.init = &(struct clk_init_data ){ + .name ="vclk2_div2" , + .ops = &clk_fixed_factor_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vclk2_div2_en.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_fixed_factor s4_vclk2_div4 = { + .mult =1 , + .div =4 , + .hw.init = &(struct clk_init_data ){ + .name ="vclk2_div4" , + .ops = &clk_fixed_factor_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vclk2_div4_en.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_fixed_factor s4_vclk2_div6 = { + .mult =1 , + .div =6 , + .hw.init = &(struct clk_init_data ){ + .name ="vclk2_div6" , + .ops = &clk_fixed_factor_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vclk2_div6_en.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_fixed_factor s4_vclk2_div12 = { + .mult =1 , + .div =12 , + .hw.init = &(struct clk_init_data ){ + .name ="vclk2_div12" , + .ops = &clk_fixed_factor_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vclk2_div12_en.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* The 5,6,7 indexes corresponds to no real clock, so there are not used. */ +static u32 mux_table_cts_sel[] = {0 ,1 ,2 ,3 ,4 ,8 ,9 ,10 ,11 ,12 }; +static const struct clk_hw *s4_cts_parent_hws[] = { + &s4_vclk_div1.hw, + &s4_vclk_div2.hw, + &s4_vclk_div4.hw, + &s4_vclk_div6.hw, + &s4_vclk_div12.hw, + &s4_vclk2_div1.hw, + &s4_vclk2_div2.hw, + &s4_vclk2_div4.hw, + &s4_vclk2_div6.hw, + &s4_vclk2_div12.hw +}; + +static struct clk_regmap s4_cts_enci_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VID_CLK_DIV , + .mask =0xf , + .shift =28 , + .table = mux_table_cts_sel, + }, + .hw.init = &(struct clk_init_data ){ + .name ="cts_enci_sel" , + .ops = &clk_regmap_mux_ops, + .parent_hws = s4_cts_parent_hws, + .num_parents =ARRAY_SIZE (s4_cts_parent_hws), + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_cts_encp_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VID_CLK_DIV , + .mask =0xf , + .shift =20 , + .table = mux_table_cts_sel, + }, + .hw.init = &(struct clk_init_data ){ + .name ="cts_encp_sel" , + .ops = &clk_regmap_mux_ops, + .parent_hws = s4_cts_parent_hws, + .num_parents =ARRAY_SIZE (s4_cts_parent_hws), + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_cts_vdac_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VIID_CLK_DIV , + .mask =0xf , + .shift =28 , + .table = mux_table_cts_sel, + }, + .hw.init = &(struct clk_init_data ){ + .name ="cts_vdac_sel" , + .ops = &clk_regmap_mux_ops, + .parent_hws = s4_cts_parent_hws, + .num_parents =ARRAY_SIZE (s4_cts_parent_hws), + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* The 5,6,7 indexes corresponds to no real clock, so there are not used. */ +static u32 mux_table_hdmi_tx_sel[] = {0 ,1 ,2 ,3 ,4 ,8 ,9 ,10 ,11 ,12 }; +static const struct clk_hw *s4_cts_hdmi_tx_parent_hws[] = { + &s4_vclk_div1.hw, + &s4_vclk_div2.hw, + &s4_vclk_div4.hw, + &s4_vclk_div6.hw, + &s4_vclk_div12.hw, + &s4_vclk2_div1.hw, + &s4_vclk2_div2.hw, + &s4_vclk2_div4.hw, + &s4_vclk2_div6.hw, + &s4_vclk2_div12.hw +}; + +static struct clk_regmap s4_hdmi_tx_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_HDMI_CLK_CTRL , + .mask =0xf , + .shift =16 , + .table = mux_table_hdmi_tx_sel, + }, + .hw.init = &(struct clk_init_data ){ + .name ="hdmi_tx_sel" , + .ops = &clk_regmap_mux_ops, + .parent_hws = s4_cts_hdmi_tx_parent_hws, + .num_parents =ARRAY_SIZE (s4_cts_hdmi_tx_parent_hws), + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_cts_enci = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_CLK_CTRL2 , + .bit_idx =0 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="cts_enci" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_cts_enci_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_cts_encp = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_CLK_CTRL2 , + .bit_idx =2 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="cts_encp" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_cts_encp_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_cts_vdac = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_CLK_CTRL2 , + .bit_idx =4 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="cts_vdac" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_cts_vdac_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_hdmi_tx = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_CLK_CTRL2 , + .bit_idx =5 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="hdmi_tx" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_hdmi_tx_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* HDMI Clocks */ +static const struct clk_parent_data s4_hdmi_parent_data[] = { + { .fw_name ="xtal" , }, + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div3" , }, + { .fw_name ="fclk_div5" , } +}; + +static struct clk_regmap s4_hdmi_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_HDMI_CLK_CTRL , + .mask =0x3 , + .shift =9 , + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ){ + .name ="hdmi_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_hdmi_parent_data, + .num_parents =ARRAY_SIZE (s4_hdmi_parent_data), + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_hdmi_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_HDMI_CLK_CTRL , + .shift =0 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="hdmi_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_hdmi_sel.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_hdmi = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_HDMI_CLK_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="hdmi" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_hdmi_div.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_ts_clk_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_TS_CLK_CTRL , + .shift =0 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="ts_clk_div" , + .ops = &clk_regmap_divider_ops, + .parent_data = &(const struct clk_parent_data ) { + .fw_name ="xtal" , + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_ts_clk_gate = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_TS_CLK_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="ts_clk" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_ts_clk_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* +* The MALI IP is clocked by two identical clocks (mali_0 and mali_1) +* muxed by a glitch-free switch. The CCF can manage this glitch-free +* mux because it does top-to-bottom updates the each clock tree and +* switches to the "inactive" one when CLK_SET_RATE_GATE is set. +*/ +static const struct clk_parent_data s4_mali_0_1_parent_data[] = { + { .fw_name ="xtal" , }, + { .fw_name ="gp0_pll" , }, + { .fw_name ="hifi_pll" , }, + { .fw_name ="fclk_div2p5" , }, + { .fw_name ="fclk_div3" , }, + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div5" , }, + { .fw_name ="fclk_div7" , } +}; + +static struct clk_regmap s4_mali_0_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_MALI_CLK_CTRL , + .mask =0x7 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="mali_0_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_mali_0_1_parent_data, + .num_parents =ARRAY_SIZE (s4_mali_0_1_parent_data), +/* +* Don't request the parent to change the rate because +* all GPU frequencies can be derived from the fclk_* +* clocks and one special GP0_PLL setting. This is +* important because we need the MPLL clocks for audio. +*/ + .flags =0 , + }, +}; + +static struct clk_regmap s4_mali_0_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_MALI_CLK_CTRL , + .shift =0 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="mali_0_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_mali_0_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_mali_0 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_MALI_CLK_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="mali_0" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_mali_0_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_mali_1_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_MALI_CLK_CTRL , + .mask =0x7 , + .shift =25 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="mali_1_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_mali_0_1_parent_data, + .num_parents =ARRAY_SIZE (s4_mali_0_1_parent_data), + .flags =0 , + }, +}; + +static struct clk_regmap s4_mali_1_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_MALI_CLK_CTRL , + .shift =16 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="mali_1_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_mali_1_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_mali_1 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_MALI_CLK_CTRL , + .bit_idx =24 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="mali_1" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_mali_1_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static const struct clk_hw *s4_mali_parent_hws[] = { + &s4_mali_0.hw, + &s4_mali_1.hw +}; + +static struct clk_regmap s4_mali_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_MALI_CLK_CTRL , + .mask =1 , + .shift =31 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="mali" , + .ops = &clk_regmap_mux_ops, + .parent_hws = s4_mali_parent_hws, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* VDEC clocks */ +static const struct clk_parent_data s4_dec_parent_data[] = { + { .fw_name ="fclk_div2p5" , }, + { .fw_name ="fclk_div3" , }, + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div5" , }, + { .fw_name ="fclk_div7" , }, + { .fw_name ="hifi_pll" , }, + { .fw_name ="gp0_pll" , }, + { .fw_name ="xtal" , } +}; + +static struct clk_regmap s4_vdec_p0_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VDEC_CLK_CTRL , + .mask =0x7 , + .shift =9 , + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vdec_p0_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_dec_parent_data, + .num_parents =ARRAY_SIZE (s4_dec_parent_data), + }, +}; + +static struct clk_regmap s4_vdec_p0_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VDEC_CLK_CTRL , + .shift =0 , + .width =7 , + .flags =CLK_DIVIDER_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vdec_p0_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vdec_p0_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vdec_p0 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VDEC_CLK_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vdec_p0" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vdec_p0_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vdec_p1_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VDEC3_CLK_CTRL , + .mask =0x7 , + .shift =9 , + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vdec_p1_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_dec_parent_data, + .num_parents =ARRAY_SIZE (s4_dec_parent_data), + }, +}; + +static struct clk_regmap s4_vdec_p1_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VDEC3_CLK_CTRL , + .shift =0 , + .width =7 , + .flags =CLK_DIVIDER_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vdec_p1_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vdec_p1_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vdec_p1 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VDEC3_CLK_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vdec_p1" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vdec_p1_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static const struct clk_hw *s4_vdec_mux_parent_hws[] = { + &s4_vdec_p0.hw, + &s4_vdec_p1.hw +}; + +static struct clk_regmap s4_vdec_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VDEC3_CLK_CTRL , + .mask =0x1 , + .shift =15 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vdec_mux" , + .ops = &clk_regmap_mux_ops, + .parent_hws = s4_vdec_mux_parent_hws, + .num_parents =ARRAY_SIZE (s4_vdec_mux_parent_hws), + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_hevcf_p0_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VDEC2_CLK_CTRL , + .mask =0x7 , + .shift =9 , + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ) { + .name ="hevcf_p0_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_dec_parent_data, + .num_parents =ARRAY_SIZE (s4_dec_parent_data), + }, +}; + +static struct clk_regmap s4_hevcf_p0_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VDEC2_CLK_CTRL , + .shift =0 , + .width =7 , + .flags =CLK_DIVIDER_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ) { + .name ="hevcf_p0_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_hevcf_p0_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_hevcf_p0 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VDEC2_CLK_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="hevcf_p0_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_hevcf_p0_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_hevcf_p1_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VDEC4_CLK_CTRL , + .mask =0x7 , + .shift =9 , + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ) { + .name ="hevcf_p1_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_dec_parent_data, + .num_parents =ARRAY_SIZE (s4_dec_parent_data), + }, +}; + +static struct clk_regmap s4_hevcf_p1_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VDEC4_CLK_CTRL , + .shift =0 , + .width =7 , + .flags =CLK_DIVIDER_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ) { + .name ="hevcf_p1_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_hevcf_p1_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_hevcf_p1 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VDEC4_CLK_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="hevcf_p1" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_hevcf_p1_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static const struct clk_hw *s4_hevcf_mux_parent_hws[] = { + &s4_hevcf_p0.hw, + &s4_hevcf_p1.hw +}; + +static struct clk_regmap s4_hevcf_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VDEC4_CLK_CTRL , + .mask =0x1 , + .shift =15 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="hevcf" , + .ops = &clk_regmap_mux_ops, + .parent_hws = s4_hevcf_mux_parent_hws, + .num_parents =ARRAY_SIZE (s4_hevcf_mux_parent_hws), + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* VPU Clock */ +static const struct clk_parent_data s4_vpu_parent_data[] = { + { .fw_name ="fclk_div3" , }, + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div5" , }, + { .fw_name ="fclk_div7" , }, + { .fw_name ="mpll1" , }, + { .hw = &s4_vid_pll.hw }, + { .fw_name ="hifi_pll" , }, + { .fw_name ="gp0_pll" , }, +}; + +static struct clk_regmap s4_vpu_0_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VPU_CLK_CTRL , + .mask =0x7 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vpu_0_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_vpu_parent_data, + .num_parents =ARRAY_SIZE (s4_vpu_parent_data), + }, +}; + +static struct clk_regmap s4_vpu_0_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VPU_CLK_CTRL , + .shift =0 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vpu_0_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vpu_0_sel.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vpu_0 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VPU_CLK_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vpu_0" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vpu_0_div.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vpu_1_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VPU_CLK_CTRL , + .mask =0x7 , + .shift =25 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vpu_1_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_vpu_parent_data, + .num_parents =ARRAY_SIZE (s4_vpu_parent_data), + }, +}; + +static struct clk_regmap s4_vpu_1_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VPU_CLK_CTRL , + .shift =16 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vpu_1_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vpu_1_sel.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vpu_1 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VPU_CLK_CTRL , + .bit_idx =24 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vpu_1" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vpu_1_div.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vpu = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VPU_CLK_CTRL , + .mask =1 , + .shift =31 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vpu" , + .ops = &clk_regmap_mux_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vpu_0.hw, + &s4_vpu_1.hw, + }, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static const struct clk_parent_data vpu_clkb_tmp_parent_data[] = { + { .hw = &s4_vpu.hw }, + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div5" , }, + { .fw_name ="fclk_div7" , } +}; + +static struct clk_regmap s4_vpu_clkb_tmp_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VPU_CLKB_CTRL , + .mask =0x3 , + .shift =20 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vpu_clkb_tmp_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = vpu_clkb_tmp_parent_data, + .num_parents =ARRAY_SIZE (vpu_clkb_tmp_parent_data), + }, +}; + +static struct clk_regmap s4_vpu_clkb_tmp_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VPU_CLKB_CTRL , + .shift =16 , + .width =4 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vpu_clkb_tmp_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vpu_clkb_tmp_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vpu_clkb_tmp = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VPU_CLKB_CTRL , + .bit_idx =24 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vpu_clkb_tmp" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vpu_clkb_tmp_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vpu_clkb_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VPU_CLKB_CTRL , + .shift =0 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vpu_clkb_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vpu_clkb_tmp.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vpu_clkb = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VPU_CLKB_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vpu_clkb" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vpu_clkb_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static const struct clk_parent_data s4_vpu_clkc_parent_data[] = { + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div3" , }, + { .fw_name ="fclk_div5" , }, + { .fw_name ="fclk_div7" , }, + { .fw_name ="mpll1" , }, + { .hw = &s4_vid_pll.hw }, + { .fw_name ="mpll2" , }, + { .fw_name ="gp0_pll" , }, +}; + +static struct clk_regmap s4_vpu_clkc_p0_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VPU_CLKC_CTRL , + .mask =0x7 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vpu_clkc_p0_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_vpu_clkc_parent_data, + .num_parents =ARRAY_SIZE (s4_vpu_clkc_parent_data), + }, +}; + +static struct clk_regmap s4_vpu_clkc_p0_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VPU_CLKC_CTRL , + .shift =0 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vpu_clkc_p0_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vpu_clkc_p0_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vpu_clkc_p0 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VPU_CLKC_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vpu_clkc_p0" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vpu_clkc_p0_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vpu_clkc_p1_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VPU_CLKC_CTRL , + .mask =0x7 , + .shift =25 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vpu_clkc_p1_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_vpu_clkc_parent_data, + .num_parents =ARRAY_SIZE (s4_vpu_clkc_parent_data), + }, +}; + +static struct clk_regmap s4_vpu_clkc_p1_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VPU_CLKC_CTRL , + .shift =16 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vpu_clkc_p1_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vpu_clkc_p1_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vpu_clkc_p1 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VPU_CLKC_CTRL , + .bit_idx =24 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vpu_clkc_p1" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vpu_clkc_p1_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static const struct clk_hw *s4_vpu_mux_parent_hws[] = { + &s4_vpu_clkc_p0.hw, + &s4_vpu_clkc_p1.hw +}; + +static struct clk_regmap s4_vpu_clkc_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VPU_CLKC_CTRL , + .mask =0x1 , + .shift =31 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vpu_clkc_mux" , + .ops = &clk_regmap_mux_ops, + .parent_hws = s4_vpu_mux_parent_hws, + .num_parents =ARRAY_SIZE (s4_vpu_mux_parent_hws), + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* VAPB Clock */ +static const struct clk_parent_data s4_vapb_parent_data[] = { + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div3" , }, + { .fw_name ="fclk_div5" , }, + { .fw_name ="fclk_div7" , }, + { .fw_name ="mpll1" , }, + { .hw = &s4_vid_pll.hw }, + { .fw_name ="mpll2" , }, + { .fw_name ="fclk_div2p5" , }, +}; + +static struct clk_regmap s4_vapb_0_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VAPBCLK_CTRL , + .mask =0x7 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vapb_0_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_vapb_parent_data, + .num_parents =ARRAY_SIZE (s4_vapb_parent_data), + }, +}; + +static struct clk_regmap s4_vapb_0_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VAPBCLK_CTRL , + .shift =0 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vapb_0_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vapb_0_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vapb_0 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VAPBCLK_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vapb_0" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vapb_0_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vapb_1_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VAPBCLK_CTRL , + .mask =0x7 , + .shift =25 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vapb_1_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_vapb_parent_data, + .num_parents =ARRAY_SIZE (s4_vapb_parent_data), + }, +}; + +static struct clk_regmap s4_vapb_1_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VAPBCLK_CTRL , + .shift =16 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vapb_1_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vapb_1_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vapb_1 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VAPBCLK_CTRL , + .bit_idx =24 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vapb_1" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vapb_1_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vapb = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VAPBCLK_CTRL , + .mask =1 , + .shift =31 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vapb_sel" , + .ops = &clk_regmap_mux_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vapb_0.hw, + &s4_vapb_1.hw + }, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_ge2d_gate = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VAPBCLK_CTRL , + .bit_idx =30 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="ge2d_clk" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vapb.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static const struct clk_parent_data s4_esmclk_parent_data[] = { + { .fw_name ="fclk_div7" , }, + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div3" , }, + { .fw_name ="fclk_div5" , }, +}; + +static struct clk_regmap s4_hdcp22_esmclk_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_HDCP22_CTRL , + .mask =0x3 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="hdcp22_esmclk_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_esmclk_parent_data, + .num_parents =ARRAY_SIZE (s4_esmclk_parent_data), + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_hdcp22_esmclk_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_HDCP22_CTRL , + .shift =0 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="hdcp22_esmclk_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_hdcp22_esmclk_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_hdcp22_esmclk_gate = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_HDCP22_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="hdcp22_esmclk_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_hdcp22_esmclk_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static const struct clk_parent_data s4_skpclk_parent_data[] = { + { .fw_name ="xtal" , }, + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div3" , }, + { .fw_name ="fclk_div5" , }, +}; + +static struct clk_regmap s4_hdcp22_skpclk_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_HDCP22_CTRL , + .mask =0x3 , + .shift =25 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="hdcp22_skpclk_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_skpclk_parent_data, + .num_parents =ARRAY_SIZE (s4_skpclk_parent_data), + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_hdcp22_skpclk_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_HDCP22_CTRL , + .shift =16 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="hdcp22_skpclk_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_hdcp22_skpclk_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_hdcp22_skpclk_gate = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_HDCP22_CTRL , + .bit_idx =24 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="hdcp22_skpclk_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_hdcp22_skpclk_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static const struct clk_parent_data s4_vdin_parent_data[] = { + { .fw_name ="xtal" , }, + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div3" , }, + { .fw_name ="fclk_div5" , }, + { .hw = &s4_vid_pll.hw } +}; + +static struct clk_regmap s4_vdin_meas_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VDIN_MEAS_CLK_CTRL , + .mask =0x7 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vdin_meas_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_vdin_parent_data, + .num_parents =ARRAY_SIZE (s4_vdin_parent_data), + }, +}; + +static struct clk_regmap s4_vdin_meas_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VDIN_MEAS_CLK_CTRL , + .shift =0 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vdin_meas_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vdin_meas_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vdin_meas_gate = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VDIN_MEAS_CLK_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vdin_meas_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vdin_meas_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* EMMC/NAND clock */ +static const struct clk_parent_data s4_sd_emmc_clk0_parent_data[] = { + { .fw_name ="xtal" , }, + { .fw_name ="fclk_div2" , }, + { .fw_name ="fclk_div3" , }, + { .fw_name ="hifi_pll" , }, + { .fw_name ="fclk_div2p5" , }, + { .fw_name ="mpll2" , }, + { .fw_name ="mpll3" , }, + { .fw_name ="gp0_pll" , }, +}; + +static struct clk_regmap s4_sd_emmc_c_clk0_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_NAND_CLK_CTRL , + .mask =0x7 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="sd_emmc_c_clk0_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_sd_emmc_clk0_parent_data, + .num_parents =ARRAY_SIZE (s4_sd_emmc_clk0_parent_data), + }, +}; + +static struct clk_regmap s4_sd_emmc_c_clk0_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_NAND_CLK_CTRL , + .shift =0 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="sd_emmc_c_clk0_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sd_emmc_c_clk0_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_sd_emmc_c_clk0 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_NAND_CLK_CTRL , + .bit_idx =7 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="sd_emmc_c_clk0" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sd_emmc_c_clk0_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_sd_emmc_a_clk0_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_SD_EMMC_CLK_CTRL , + .mask =0x7 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="sd_emmc_a_clk0_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_sd_emmc_clk0_parent_data, + .num_parents =ARRAY_SIZE (s4_sd_emmc_clk0_parent_data), + }, +}; + +static struct clk_regmap s4_sd_emmc_a_clk0_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_SD_EMMC_CLK_CTRL , + .shift =0 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="sd_emmc_a_clk0_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sd_emmc_a_clk0_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_sd_emmc_a_clk0 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_SD_EMMC_CLK_CTRL , + .bit_idx =7 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="sd_emmc_a_clk0" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sd_emmc_a_clk0_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_sd_emmc_b_clk0_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_SD_EMMC_CLK_CTRL , + .mask =0x7 , + .shift =25 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="sd_emmc_b_clk0_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_sd_emmc_clk0_parent_data, + .num_parents =ARRAY_SIZE (s4_sd_emmc_clk0_parent_data), + }, +}; + +static struct clk_regmap s4_sd_emmc_b_clk0_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_SD_EMMC_CLK_CTRL , + .shift =16 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="sd_emmc_b_clk0_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sd_emmc_b_clk0_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_sd_emmc_b_clk0 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_SD_EMMC_CLK_CTRL , + .bit_idx =23 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="sd_emmc_b_clk0" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sd_emmc_b_clk0_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* SPICC Clock */ +static const struct clk_parent_data s4_spicc_parent_data[] = { + { .fw_name ="xtal" , }, + { .hw = &s4_sys_clk.hw }, + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div3" , }, + { .fw_name ="fclk_div2" , }, + { .fw_name ="fclk_div5" , }, + { .fw_name ="fclk_div7" , }, +}; + +static struct clk_regmap s4_spicc0_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_SPICC_CLK_CTRL , + .mask =0x7 , + .shift =7 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="spicc0_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_spicc_parent_data, + .num_parents =ARRAY_SIZE (s4_spicc_parent_data), + }, +}; + +static struct clk_regmap s4_spicc0_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_SPICC_CLK_CTRL , + .shift =0 , + .width =6 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="spicc0_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_spicc0_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_spicc0_gate = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_SPICC_CLK_CTRL , + .bit_idx =6 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="spicc0" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_spicc0_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* PWM Clock */ +static const struct clk_parent_data s4_pwm_parent_data[] = { + { .fw_name ="xtal" , }, + { .hw = &s4_vid_pll.hw }, + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div3" , }, +}; + +static struct clk_regmap s4_pwm_a_mux = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_PWM_CLK_AB_CTRL , + .mask =0x3 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_a_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_pwm_parent_data, + .num_parents =ARRAY_SIZE (s4_pwm_parent_data), + }, +}; + +static struct clk_regmap s4_pwm_a_div = { + .data = &(struct clk_regmap_div_data ) { + .offset =CLKCTRL_PWM_CLK_AB_CTRL , + .shift =0 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_a_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_a_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_a_gate = { + .data = &(struct clk_regmap_gate_data ) { + .offset =CLKCTRL_PWM_CLK_AB_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_a_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_a_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_b_mux = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_PWM_CLK_AB_CTRL , + .mask =0x3 , + .shift =25 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_b_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_pwm_parent_data, + .num_parents =ARRAY_SIZE (s4_pwm_parent_data), + }, +}; + +static struct clk_regmap s4_pwm_b_div = { + .data = &(struct clk_regmap_div_data ) { + .offset =CLKCTRL_PWM_CLK_AB_CTRL , + .shift =16 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_b_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_b_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_b_gate = { + .data = &(struct clk_regmap_gate_data ) { + .offset =CLKCTRL_PWM_CLK_AB_CTRL , + .bit_idx =24 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_b_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_b_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_c_mux = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_PWM_CLK_CD_CTRL , + .mask =0x3 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_c_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_pwm_parent_data, + .num_parents =ARRAY_SIZE (s4_pwm_parent_data), + }, +}; + +static struct clk_regmap s4_pwm_c_div = { + .data = &(struct clk_regmap_div_data ) { + .offset =CLKCTRL_PWM_CLK_CD_CTRL , + .shift =0 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_c_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_c_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_c_gate = { + .data = &(struct clk_regmap_gate_data ) { + .offset =CLKCTRL_PWM_CLK_CD_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_c_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_c_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_d_mux = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_PWM_CLK_CD_CTRL , + .mask =0x3 , + .shift =25 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_d_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_pwm_parent_data, + .num_parents =ARRAY_SIZE (s4_pwm_parent_data), + }, +}; + +static struct clk_regmap s4_pwm_d_div = { + .data = &(struct clk_regmap_div_data ) { + .offset =CLKCTRL_PWM_CLK_CD_CTRL , + .shift =16 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_d_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_d_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_d_gate = { + .data = &(struct clk_regmap_gate_data ) { + .offset =CLKCTRL_PWM_CLK_CD_CTRL , + .bit_idx =24 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_d_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_d_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_e_mux = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_PWM_CLK_EF_CTRL , + .mask =0x3 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_e_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_pwm_parent_data, + .num_parents =ARRAY_SIZE (s4_pwm_parent_data), + }, +}; + +static struct clk_regmap s4_pwm_e_div = { + .data = &(struct clk_regmap_div_data ) { + .offset =CLKCTRL_PWM_CLK_EF_CTRL , + .shift =0 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_e_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_e_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_e_gate = { + .data = &(struct clk_regmap_gate_data ) { + .offset =CLKCTRL_PWM_CLK_EF_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_e_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_e_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_f_mux = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_PWM_CLK_EF_CTRL , + .mask =0x3 , + .shift =25 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_f_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_pwm_parent_data, + .num_parents =ARRAY_SIZE (s4_pwm_parent_data), + }, +}; + +static struct clk_regmap s4_pwm_f_div = { + .data = &(struct clk_regmap_div_data ) { + .offset =CLKCTRL_PWM_CLK_EF_CTRL , + .shift =16 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_f_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_f_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_f_gate = { + .data = &(struct clk_regmap_gate_data ) { + .offset =CLKCTRL_PWM_CLK_EF_CTRL , + .bit_idx =24 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_f_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_f_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_g_mux = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_PWM_CLK_GH_CTRL , + .mask =0x3 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_g_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_pwm_parent_data, + .num_parents =ARRAY_SIZE (s4_pwm_parent_data), + }, +}; + +static struct clk_regmap s4_pwm_g_div = { + .data = &(struct clk_regmap_div_data ) { + .offset =CLKCTRL_PWM_CLK_GH_CTRL , + .shift =0 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_g_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_g_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_g_gate = { + .data = &(struct clk_regmap_gate_data ) { + .offset =CLKCTRL_PWM_CLK_GH_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_g_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_g_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_h_mux = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_PWM_CLK_GH_CTRL , + .mask =0x3 , + .shift =25 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_h_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_pwm_parent_data, + .num_parents =ARRAY_SIZE (s4_pwm_parent_data), + }, +}; + +static struct clk_regmap s4_pwm_h_div = { + .data = &(struct clk_regmap_div_data ) { + .offset =CLKCTRL_PWM_CLK_GH_CTRL , + .shift =16 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_h_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_h_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_h_gate = { + .data = &(struct clk_regmap_gate_data ) { + .offset =CLKCTRL_PWM_CLK_GH_CTRL ,Lines of this file are not shown. View the raw message.
drivers/clk/meson/s4-peripherals.h new file +218
-0Lines of this file are not shown. View the raw message.
include/dt-bindings/clock/amlogic,s4-peripherals-clkc.h new file +131
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Re: [PATCH V5 3/4] clk: meson: s4: add s4 SoC peripheral clock controller driver and bindings
Hi Jerome,
Quoted 285 lines · Jerome Brunet
[ EXTERNAL EMAIL ]
Quoted 280 lines · Yu Tu
Add the peripherals clock controller found and bindings in the s4 SoC family.
Signed-off-by Yu Tu <[email protected]>--- .../clock/amlogic,s4-peripherals-clkc.yaml | 105 + drivers/clk/meson/Kconfig | 12 + drivers/clk/meson/Makefile | 1 + drivers/clk/meson/s4-peripherals.c | 3783 +++++++++++++++++ drivers/clk/meson/s4-peripherals.h | 218 + .../clock/amlogic,s4-peripherals-clkc.h | 131 + 6 files changed, 4250 insertions(+)create mode 100644
Documentation/devicetree/bindings/clock/amlogic,s4-peripherals-clkc.yamlcreate mode 100644drivers/clk/meson/s4-peripherals.c
create mode 100644drivers/clk/meson/s4-peripherals.h
create mode 100644include/dt-bindings/clock/amlogic,s4-peripherals-clkc.hDocumentation/devicetree/bindings/clock/amlogic,s4-peripherals-clkc.yaml new file +105
-0@@ -0,0 +1,105 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/amlogic,s4-peripherals-clkc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Amlogic Meson S serials Peripherals Clock Controller + +maintainers: + - Neil Armstrong <[email protected]> + - Jerome Brunet <[email protected]> + - Yu Tu <[email protected]> + + +properties: + compatible: + const: amlogic,s4-peripherals-clkc + + reg: + maxItems: 1 + + clocks: + items: + - description: input fixed pll div2 + - description: input fixed pll div2p5 + - description: input fixed pll div3 + - description: input fixed pll div4 + - description: input fixed pll div5 + - description: input fixed pll div7 + - description: input hifi pll + - description: input gp0 pll + - description: input mpll0 + - description: input mpll1 + - description: input mpll2 + - description: input mpll3 + - description: input hdmi pll + - description: input oscillator (usually at 24MHz) + - description: input external 32kHz reference (optional) + + clock-names: + items: + - const: fclk_div2 + - const: fclk_div2p5 + - const: fclk_div3 + - const: fclk_div4 + - const: fclk_div5 + - const: fclk_div7 + - const: hifi_pll + - const: gp0_pll + - const: mpll0 + - const: mpll1 + - const: mpll2 + - const: mpll3 + - const: hdmi_pll + - const: xtal + - const: ext_32k + + "#clock-cells": + const: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - "#clock-cells" + +additionalProperties: false + +examples: + - | + #include <dt-bindings/clock/amlogic,s4-peripherals-clkc.h> + + /* 32KHz reference crystal */ + ext_32k: ref32k { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <32000>; + }; + + clkc_periphs: clock-controller@fe000000 { + compatible = "amlogic,s4-peripherals-clkc"; + reg = <0xfe000000 0x49c>; + clocks = <&clkc_pll 3>, + <&clkc_pll 13>, + <&clkc_pll 5>, + <&clkc_pll 7>, + <&clkc_pll 9>, + <&clkc_pll 11>, + <&clkc_pll 17>, + <&clkc_pll 15>, + <&clkc_pll 25>, + <&clkc_pll 27>, + <&clkc_pll 29>, + <&clkc_pll 31>, + <&clkc_pll 20>, + <&xtal>, + <&ext_32k>; + clock-names = "fclk_div2", "fclk_div2p5", "fclk_div3", "fclk_div4", + "fclk_div5", "fclk_div7", "hifi_pll", "gp0_pll", + "mpll0", "mpll1", "mpll2", "mpll3", "hdmi_pll", "xtal", + "ext_32k"; + #clock-cells = <1>; + }; +...drivers/clk/meson/Kconfig +12
-0@@ -128,4 +128,16 @@ config COMMON_CLK_S4_PLL aka s4. Amlogic S805X2 and S905Y4 devices include AQ222 and AQ229. Say Y if you want the board to work, because plls are the parent of most peripherals. + +config COMMON_CLK_S4 + tristate "S4 SoC Peripherals clock controllers support" + depends on ARM64 + default y + select COMMON_CLK_MESON_REGMAP + select COMMON_CLK_MESON_DUALDIV + select COMMON_CLK_MESON_VID_PLL_DIV + help + Support for the Peripherals clock controller on Amlogic S805X2 and S905Y4 + devices, aka s4. Amlogic S805X2 and S905Y4 devices include AQ222 and AQ229. + Say Y if you want peripherals to work. endmenudrivers/clk/meson/Makefile +1
-0@@ -20,3 +20,4 @@ obj-$(CONFIG_COMMON_CLK_GXBB) += gxbb.o gxbb-aoclk.o obj-$(CONFIG_COMMON_CLK_G12A) += g12a.o g12a-aoclk.o obj-$(CONFIG_COMMON_CLK_MESON8B) += meson8b.o meson8-ddr.o obj-$(CONFIG_COMMON_CLK_S4_PLL) += s4-pll.o +obj-$(CONFIG_COMMON_CLK_S4) += s4-peripherals.odrivers/clk/meson/s4-peripherals.c new file +117
-0@@ -0,0 +1,3783 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Amlogic Meson-S4 Peripherals Clock Controller Driver +* +* Copyright (c) 2021 Amlogic, inc. +* Author: Yu Tu <[email protected]> +*/ + +#include <linux/clk-provider.h> +#include <linux/of_device.h> +#include <linux/platform_device.h> + +#include "clk-regmap.h" +#include "vid-pll-div.h" +#include "clk-dualdiv.h" +#include "s4-peripherals.h" + +static struct clk_regmap s4_rtc_32k_by_oscin_clkin = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_RTC_BY_OSCIN_CTRL0 , + .bit_idx =31 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="rtc_32k_by_oscin_clkin" , + .ops = &clk_regmap_gate_ops, + .parent_data = (const struct clk_parent_data []) { + { .fw_name ="xtal" , } + }, + .num_parents =1 , + }, +}; + +static const struct meson_clk_dualdiv_param s4_32k_div_table[] = { + { + .dual =1 , + .n1 =733 , + .m1 =8 , + .n2 =732 , + .m2 =11 , + }, + {} +}; + +static struct clk_regmap s4_rtc_32k_by_oscin_div = { + .data = &(struct meson_clk_dualdiv_data ){ + .n1 = { + .reg_off =CLKCTRL_RTC_BY_OSCIN_CTRL0 , + .shift =0 , + .width =12 , + }, + .n2 = { + .reg_off =CLKCTRL_RTC_BY_OSCIN_CTRL0 , + .shift =12 , + .width =12 , + }, + .m1 = { + .reg_off =CLKCTRL_RTC_BY_OSCIN_CTRL1 , + .shift =0 , + .width =12 , + }, + .m2 = { + .reg_off =CLKCTRL_RTC_BY_OSCIN_CTRL1 , + .shift =12 , + .width =12 , + }, + .dual = { + .reg_off =CLKCTRL_RTC_BY_OSCIN_CTRL0 , + .shift =28 , + .width =1 , + }, + .table = s4_32k_div_table, + }, + .hw.init = &(struct clk_init_data ){ + .name ="rtc_32k_by_oscin_div" , + .ops = &meson_clk_dualdiv_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_rtc_32k_by_oscin_clkin.hw + }, + .num_parents =1 , + }, +}; + +static struct clk_regmap s4_rtc_32k_by_oscin_sel = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_RTC_BY_OSCIN_CTRL1 , + .mask =0x1 , + .shift =24 , + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ){ + .name ="rtc_32k_by_oscin_sel" , + .ops = &clk_regmap_mux_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_rtc_32k_by_oscin_div.hw, + &s4_rtc_32k_by_oscin_clkin.hw, + }, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_rtc_32k_by_oscin = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_RTC_BY_OSCIN_CTRL0 , + .bit_idx =30 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="rtc_32k_by_oscin" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_rtc_32k_by_oscin_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; +
Quoted 8 lines
drivers/clk/meson/s4-peripherals.c line 123
Quoted 6 lines
drivers/clk/meson/s4-peripherals.c new file +6
-0+/* +* This RTC clock can be supplied by an external 32KHz crystal oscillator. +* If it is used, it should be documented in using fw_name and documented in the +* Bindings. Not currently in use on this board, so skip it. +*/ +static u32 rtc_clk_sel[] = {0 ,1 };No reason to do that
I'm going to change it to static u32 rtc_clk_sel[] = { 0, 1, 2 };. I don't know if that's okay with you?
Quoted 489 lines
Quoted 476 lines
drivers/clk/meson/s4-peripherals.c new file +475
-0+static const struct clk_parent_data rtc_clk_sel_parent_data[] = { + { .hw = &s4_rtc_32k_by_oscin.hw }, + { .hw = &s4_rtc_32k_by_oscin_div.hw }, + { .fw_name ="ext_32k" , } +}; + +static struct clk_regmap s4_rtc_clk = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_RTC_CTRL , + .mask =0x3 , + .shift =0 , + .table = rtc_clk_sel, + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ){ + .name ="rtc_clk_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = rtc_clk_sel_parent_data, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* The index 5 is AXI_CLK, which is dedicated to AXI. So skip it. */ +static u32 mux_table_sys_ab_clk_sel[] = {0 ,1 ,2 ,3 ,4 ,6 ,7 }; +static const struct clk_parent_data sys_ab_clk_parent_data[] = { + { .fw_name ="xtal" }, + { .fw_name ="fclk_div2" }, + { .fw_name ="fclk_div3" }, + { .fw_name ="fclk_div4" }, + { .fw_name ="fclk_div5" }, + { .fw_name ="fclk_div7" }, + { .hw = &s4_rtc_clk.hw } +}; + +static struct clk_regmap s4_sysclk_b_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_SYS_CLK_CTRL0 , + .mask =0x7 , + .shift =26 , + .table = mux_table_sys_ab_clk_sel, + }, + .hw.init = &(struct clk_init_data ){ + .name ="sysclk_b_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = sys_ab_clk_parent_data, + .num_parents =ARRAY_SIZE (sys_ab_clk_parent_data), + }, +}; + +static struct clk_regmap s4_sysclk_b_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_SYS_CLK_CTRL0 , + .shift =16 , + .width =10 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="sysclk_b_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sysclk_b_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_sysclk_b = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_SYS_CLK_CTRL0 , + .bit_idx =29 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="sysclk_b" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sysclk_b_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_sysclk_a_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_SYS_CLK_CTRL0 , + .mask =0x7 , + .shift =10 , + .table = mux_table_sys_ab_clk_sel, + }, + .hw.init = &(struct clk_init_data ){ + .name ="sysclk_a_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = sys_ab_clk_parent_data, + .num_parents =ARRAY_SIZE (sys_ab_clk_parent_data), + }, +}; + +static struct clk_regmap s4_sysclk_a_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_SYS_CLK_CTRL0 , + .shift =0 , + .width =10 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="sysclk_a_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sysclk_a_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_sysclk_a = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_SYS_CLK_CTRL0 , + .bit_idx =13 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="sysclk_a" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sysclk_a_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_sys_clk = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_SYS_CLK_CTRL0 , + .mask =0x1 , + .shift =31 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="sys_clk" , + .ops = &clk_regmap_mux_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sysclk_a.hw, + &s4_sysclk_b.hw + }, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_ceca_32k_clkin = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_CECA_CTRL0 , + .bit_idx =31 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="ceca_32k_clkin" , + .ops = &clk_regmap_gate_ops, + .parent_data = (const struct clk_parent_data []) { + { .fw_name ="xtal" , } + }, + .num_parents =1 , + }, +}; + +static struct clk_regmap s4_ceca_32k_div = { + .data = &(struct meson_clk_dualdiv_data ){ + .n1 = { + .reg_off =CLKCTRL_CECA_CTRL0 , + .shift =0 , + .width =12 , + }, + .n2 = { + .reg_off =CLKCTRL_CECA_CTRL0 , + .shift =12 , + .width =12 , + }, + .m1 = { + .reg_off =CLKCTRL_CECA_CTRL1 , + .shift =0 , + .width =12 , + }, + .m2 = { + .reg_off =CLKCTRL_CECA_CTRL1 , + .shift =12 , + .width =12 , + }, + .dual = { + .reg_off =CLKCTRL_CECA_CTRL0 , + .shift =28 , + .width =1 , + }, + .table = s4_32k_div_table, + }, + .hw.init = &(struct clk_init_data ){ + .name ="ceca_32k_div" , + .ops = &meson_clk_dualdiv_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_ceca_32k_clkin.hw + }, + .num_parents =1 , + }, +}; + +static struct clk_regmap s4_ceca_32k_sel_pre = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_CECA_CTRL1 , + .mask =0x1 , + .shift =24 , + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ){ + .name ="ceca_32k_sel_pre" , + .ops = &clk_regmap_mux_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_ceca_32k_div.hw, + &s4_ceca_32k_clkin.hw + }, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_ceca_32k_sel = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_CECA_CTRL1 , + .mask =0x1 , + .shift =31 , + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ){ + .name ="ceca_32k_sel" , + .ops = &clk_regmap_mux_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_ceca_32k_sel_pre.hw, + &s4_rtc_clk.hw + }, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_ceca_32k_clkout = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_CECA_CTRL0 , + .bit_idx =30 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="ceca_32k_clkout" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_ceca_32k_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_cecb_32k_clkin = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_CECB_CTRL0 , + .bit_idx =31 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="cecb_32k_clkin" , + .ops = &clk_regmap_gate_ops, + .parent_data = (const struct clk_parent_data []) { + { .fw_name ="xtal" , } + }, + .num_parents =1 , + }, +}; + +static struct clk_regmap s4_cecb_32k_div = { + .data = &(struct meson_clk_dualdiv_data ){ + .n1 = { + .reg_off =CLKCTRL_CECB_CTRL0 , + .shift =0 , + .width =12 , + }, + .n2 = { + .reg_off =CLKCTRL_CECB_CTRL0 , + .shift =12 , + .width =12 , + }, + .m1 = { + .reg_off =CLKCTRL_CECB_CTRL1 , + .shift =0 , + .width =12 , + }, + .m2 = { + .reg_off =CLKCTRL_CECB_CTRL1 , + .shift =12 , + .width =12 , + }, + .dual = { + .reg_off =CLKCTRL_CECB_CTRL0 , + .shift =28 , + .width =1 , + }, + .table = s4_32k_div_table, + }, + .hw.init = &(struct clk_init_data ){ + .name ="cecb_32k_div" , + .ops = &meson_clk_dualdiv_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_cecb_32k_clkin.hw + }, + .num_parents =1 , + }, +}; + +static struct clk_regmap s4_cecb_32k_sel_pre = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_CECB_CTRL1 , + .mask =0x1 , + .shift =24 , + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ){ + .name ="cecb_32k_sel_pre" , + .ops = &clk_regmap_mux_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_cecb_32k_div.hw, + &s4_cecb_32k_clkin.hw + }, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_cecb_32k_sel = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_CECB_CTRL1 , + .mask =0x1 , + .shift =31 , + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ){ + .name ="cecb_32k_sel" , + .ops = &clk_regmap_mux_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_cecb_32k_sel_pre.hw, + &s4_rtc_clk.hw + }, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_cecb_32k_clkout = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_CECB_CTRL0 , + .bit_idx =30 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="cecb_32k_clkout" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_cecb_32k_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static const struct clk_parent_data s4_sc_parent_data[] = { + { .fw_name ="fclk_div4" }, + { .fw_name ="fclk_div3" }, + { .fw_name ="fclk_div5" }, + { .fw_name ="xtal" , } +}; + +static struct clk_regmap s4_sc_clk_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_SC_CLK_CTRL , + .mask =0x3 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="sc_clk_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_sc_parent_data, + .num_parents =ARRAY_SIZE (s4_sc_parent_data), + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_sc_clk_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_SC_CLK_CTRL , + .shift =0 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="sc_clk_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sc_clk_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_sc_clk_gate = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_SC_CLK_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="sc_clk_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sc_clk_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_12_24M_clk_gate = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_CLK12_24_CTRL , + .bit_idx =11 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="12_24m_gate" , + .ops = &clk_regmap_gate_ops, + .parent_data = (const struct clk_parent_data []) { + { .fw_name ="xtal" , } + }, + .num_parents =1 , + }, +}; + +static struct clk_fixed_factor s4_12M_clk_div = { + .mult =1 , + .div =2 , + .hw.init = &(struct clk_init_data ){ + .name ="12M" , + .ops = &clk_fixed_factor_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_12_24M_clk_gate.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_12_24M_clk = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_CLK12_24_CTRL , + .mask =0x1 , + .shift =10 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="12_24m" , + .ops = &clk_regmap_mux_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_12_24M_clk_gate.hw, + &s4_12M_clk_div.hw, + }, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* Video Clocks */ +static struct clk_regmap s4_vid_pll_div = { + .data = &(struct meson_vid_pll_div_data ){ + .val = { + .reg_off =CLKCTRL_VID_PLL_CLK_DIV , + .shift =0 , + .width =15 , + },drivers/clk/meson/s4-peripherals.c line 608
Quoted 10 lines
drivers/clk/meson/s4-peripherals.c new file +10
-0+ .sel = { + .reg_off = CLKCTRL_VID_PLL_CLK_DIV, + .shift = 16, + .width = 2, + }, + }, + .hw.init = &(struct clk_init_data ) { + .name ="vid_pll_div" , +/* Same to g12a */ + .ops = &meson_vid_pll_div_ro_ops,Please add an helpful explanation.
Quoted 2 lines
'Same to g12a' is not helpful.
"Because the vid_pll_div clock is a clock that does not need to change the divisor, ops only provides meson_vid_pll_div_ro_ops." I wonder if this description is ok for you?
Quoted 60 lines
Quoted 60 lines
drivers/clk/meson/s4-peripherals.c new file +60
-0+ .parent_data = (const struct clk_parent_data []) { + { .fw_name = "hdmi_pll", } + }, + .num_parents = 1, + .flags = CLK_SET_RATE_PARENT, + }, +}; + +static struct clk_regmap s4_vid_pll_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VID_PLL_CLK_DIV , + .mask =0x1 , + .shift =18 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vid_pll_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = (const struct clk_parent_data []) { + { .hw = &s4_vid_pll_div.hw }, + { .fw_name ="hdmi_pll" , } + }, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vid_pll = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_PLL_CLK_DIV , + .bit_idx =19 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vid_pll" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vid_pll_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static const struct clk_parent_data s4_vclk_parent_data[] = { + { .hw = &s4_vid_pll.hw }, + { .fw_name ="gp0_pll" , }, + { .fw_name ="hifi_pll" , }, + { .fw_name ="mpll1" , }, + { .fw_name ="fclk_div3" , }, + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div5" , }, + { .fw_name ="fclk_div7" , }, +}; + +static struct clk_regmap s4_vclk_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VID_CLK_CTRL , + .mask =0x7 , + .shift =16 , + }, + .hw.init = &(struct clk_init_data ){
Quoted 8 lines
drivers/clk/meson/s4-peripherals.c line 673
Quoted 5 lines
drivers/clk/meson/s4-peripherals.c new file +5
-0+ .name = "vclk_sel", + .ops = &clk_regmap_mux_ops, + .parent_data = s4_vclk_parent_data, + .num_parents = ARRAY_SIZE(s4_vclk_parent_data), + },You are stopping rate propagation here.
It deserves an explanation. Same goes below.
"When the driver uses this clock, needs to specify the patent clock he wants in the dts." Is ok for you?
Quoted 3,474 lines
include/dt-bindings/clock/amlogic,s4-peripherals-clkc.h
Quoted 3,472 lines
drivers/clk/meson/s4-peripherals.c new file +3110
-0+}; + +static struct clk_regmap s4_vclk2_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VIID_CLK_CTRL , + .mask =0x7 , + .shift =16 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vclk2_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_vclk_parent_data, + .num_parents =ARRAY_SIZE (s4_vclk_parent_data), + }, +}; + +static struct clk_regmap s4_vclk_input = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_CLK_DIV , + .bit_idx =16 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk_input" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk_sel.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk2_input = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VIID_CLK_DIV , + .bit_idx =16 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk2_input" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk2_sel.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VID_CLK_DIV , + .shift =0 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vclk_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vclk_input.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk2_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VIID_CLK_DIV , + .shift =0 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vclk2_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vclk2_input.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_CLK_CTRL , + .bit_idx =19 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk_div.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk2 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VIID_CLK_CTRL , + .bit_idx =19 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk2" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk2_div.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk_div1 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_CLK_CTRL , + .bit_idx =0 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk_div1" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk_div2_en = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_CLK_CTRL , + .bit_idx =1 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk_div2_en" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk_div4_en = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_CLK_CTRL , + .bit_idx =2 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk_div4_en" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk_div6_en = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_CLK_CTRL , + .bit_idx =3 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk_div6_en" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk_div12_en = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_CLK_CTRL , + .bit_idx =4 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk_div12_en" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk2_div1 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VIID_CLK_CTRL , + .bit_idx =0 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk2_div1" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk2.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk2_div2_en = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VIID_CLK_CTRL , + .bit_idx =1 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk2_div2_en" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk2.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk2_div4_en = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VIID_CLK_CTRL , + .bit_idx =2 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk2_div4_en" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk2.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk2_div6_en = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VIID_CLK_CTRL , + .bit_idx =3 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk2_div6_en" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk2.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vclk2_div12_en = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VIID_CLK_CTRL , + .bit_idx =4 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vclk2_div12_en" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vclk2.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_fixed_factor s4_vclk_div2 = { + .mult =1 , + .div =2 , + .hw.init = &(struct clk_init_data ){ + .name ="vclk_div2" , + .ops = &clk_fixed_factor_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vclk_div2_en.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_fixed_factor s4_vclk_div4 = { + .mult =1 , + .div =4 , + .hw.init = &(struct clk_init_data ){ + .name ="vclk_div4" , + .ops = &clk_fixed_factor_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vclk_div4_en.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_fixed_factor s4_vclk_div6 = { + .mult =1 , + .div =6 , + .hw.init = &(struct clk_init_data ){ + .name ="vclk_div6" , + .ops = &clk_fixed_factor_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vclk_div6_en.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_fixed_factor s4_vclk_div12 = { + .mult =1 , + .div =12 , + .hw.init = &(struct clk_init_data ){ + .name ="vclk_div12" , + .ops = &clk_fixed_factor_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vclk_div12_en.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_fixed_factor s4_vclk2_div2 = { + .mult =1 , + .div =2 , + .hw.init = &(struct clk_init_data ){ + .name ="vclk2_div2" , + .ops = &clk_fixed_factor_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vclk2_div2_en.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_fixed_factor s4_vclk2_div4 = { + .mult =1 , + .div =4 , + .hw.init = &(struct clk_init_data ){ + .name ="vclk2_div4" , + .ops = &clk_fixed_factor_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vclk2_div4_en.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_fixed_factor s4_vclk2_div6 = { + .mult =1 , + .div =6 , + .hw.init = &(struct clk_init_data ){ + .name ="vclk2_div6" , + .ops = &clk_fixed_factor_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vclk2_div6_en.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_fixed_factor s4_vclk2_div12 = { + .mult =1 , + .div =12 , + .hw.init = &(struct clk_init_data ){ + .name ="vclk2_div12" , + .ops = &clk_fixed_factor_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vclk2_div12_en.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* The 5,6,7 indexes corresponds to no real clock, so there are not used. */ +static u32 mux_table_cts_sel[] = {0 ,1 ,2 ,3 ,4 ,8 ,9 ,10 ,11 ,12 }; +static const struct clk_hw *s4_cts_parent_hws[] = { + &s4_vclk_div1.hw, + &s4_vclk_div2.hw, + &s4_vclk_div4.hw, + &s4_vclk_div6.hw, + &s4_vclk_div12.hw, + &s4_vclk2_div1.hw, + &s4_vclk2_div2.hw, + &s4_vclk2_div4.hw, + &s4_vclk2_div6.hw, + &s4_vclk2_div12.hw +}; + +static struct clk_regmap s4_cts_enci_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VID_CLK_DIV , + .mask =0xf , + .shift =28 , + .table = mux_table_cts_sel, + }, + .hw.init = &(struct clk_init_data ){ + .name ="cts_enci_sel" , + .ops = &clk_regmap_mux_ops, + .parent_hws = s4_cts_parent_hws, + .num_parents =ARRAY_SIZE (s4_cts_parent_hws), + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_cts_encp_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VID_CLK_DIV , + .mask =0xf , + .shift =20 , + .table = mux_table_cts_sel, + }, + .hw.init = &(struct clk_init_data ){ + .name ="cts_encp_sel" , + .ops = &clk_regmap_mux_ops, + .parent_hws = s4_cts_parent_hws, + .num_parents =ARRAY_SIZE (s4_cts_parent_hws), + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_cts_vdac_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VIID_CLK_DIV , + .mask =0xf , + .shift =28 , + .table = mux_table_cts_sel, + }, + .hw.init = &(struct clk_init_data ){ + .name ="cts_vdac_sel" , + .ops = &clk_regmap_mux_ops, + .parent_hws = s4_cts_parent_hws, + .num_parents =ARRAY_SIZE (s4_cts_parent_hws), + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* The 5,6,7 indexes corresponds to no real clock, so there are not used. */ +static u32 mux_table_hdmi_tx_sel[] = {0 ,1 ,2 ,3 ,4 ,8 ,9 ,10 ,11 ,12 }; +static const struct clk_hw *s4_cts_hdmi_tx_parent_hws[] = { + &s4_vclk_div1.hw, + &s4_vclk_div2.hw, + &s4_vclk_div4.hw, + &s4_vclk_div6.hw, + &s4_vclk_div12.hw, + &s4_vclk2_div1.hw, + &s4_vclk2_div2.hw, + &s4_vclk2_div4.hw, + &s4_vclk2_div6.hw, + &s4_vclk2_div12.hw +}; + +static struct clk_regmap s4_hdmi_tx_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_HDMI_CLK_CTRL , + .mask =0xf , + .shift =16 , + .table = mux_table_hdmi_tx_sel, + }, + .hw.init = &(struct clk_init_data ){ + .name ="hdmi_tx_sel" , + .ops = &clk_regmap_mux_ops, + .parent_hws = s4_cts_hdmi_tx_parent_hws, + .num_parents =ARRAY_SIZE (s4_cts_hdmi_tx_parent_hws), + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_cts_enci = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_CLK_CTRL2 , + .bit_idx =0 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="cts_enci" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_cts_enci_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_cts_encp = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_CLK_CTRL2 , + .bit_idx =2 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="cts_encp" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_cts_encp_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_cts_vdac = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_CLK_CTRL2 , + .bit_idx =4 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="cts_vdac" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_cts_vdac_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_hdmi_tx = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VID_CLK_CTRL2 , + .bit_idx =5 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="hdmi_tx" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_hdmi_tx_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* HDMI Clocks */ +static const struct clk_parent_data s4_hdmi_parent_data[] = { + { .fw_name ="xtal" , }, + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div3" , }, + { .fw_name ="fclk_div5" , } +}; + +static struct clk_regmap s4_hdmi_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_HDMI_CLK_CTRL , + .mask =0x3 , + .shift =9 , + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ){ + .name ="hdmi_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_hdmi_parent_data, + .num_parents =ARRAY_SIZE (s4_hdmi_parent_data), + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_hdmi_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_HDMI_CLK_CTRL , + .shift =0 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="hdmi_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_hdmi_sel.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_hdmi = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_HDMI_CLK_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="hdmi" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_hdmi_div.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_ts_clk_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_TS_CLK_CTRL , + .shift =0 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="ts_clk_div" , + .ops = &clk_regmap_divider_ops, + .parent_data = &(const struct clk_parent_data ) { + .fw_name ="xtal" , + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_ts_clk_gate = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_TS_CLK_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="ts_clk" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_ts_clk_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* +* The MALI IP is clocked by two identical clocks (mali_0 and mali_1) +* muxed by a glitch-free switch. The CCF can manage this glitch-free +* mux because it does top-to-bottom updates the each clock tree and +* switches to the "inactive" one when CLK_SET_RATE_GATE is set. +*/ +static const struct clk_parent_data s4_mali_0_1_parent_data[] = { + { .fw_name ="xtal" , }, + { .fw_name ="gp0_pll" , }, + { .fw_name ="hifi_pll" , }, + { .fw_name ="fclk_div2p5" , }, + { .fw_name ="fclk_div3" , }, + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div5" , }, + { .fw_name ="fclk_div7" , } +}; + +static struct clk_regmap s4_mali_0_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_MALI_CLK_CTRL , + .mask =0x7 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="mali_0_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_mali_0_1_parent_data, + .num_parents =ARRAY_SIZE (s4_mali_0_1_parent_data), +/* +* Don't request the parent to change the rate because +* all GPU frequencies can be derived from the fclk_* +* clocks and one special GP0_PLL setting. This is +* important because we need the MPLL clocks for audio. +*/ + .flags =0 , + }, +}; + +static struct clk_regmap s4_mali_0_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_MALI_CLK_CTRL , + .shift =0 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="mali_0_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_mali_0_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_mali_0 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_MALI_CLK_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="mali_0" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_mali_0_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_mali_1_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_MALI_CLK_CTRL , + .mask =0x7 , + .shift =25 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="mali_1_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_mali_0_1_parent_data, + .num_parents =ARRAY_SIZE (s4_mali_0_1_parent_data), + .flags =0 , + }, +}; + +static struct clk_regmap s4_mali_1_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_MALI_CLK_CTRL , + .shift =16 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="mali_1_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_mali_1_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_mali_1 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_MALI_CLK_CTRL , + .bit_idx =24 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="mali_1" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_mali_1_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static const struct clk_hw *s4_mali_parent_hws[] = { + &s4_mali_0.hw, + &s4_mali_1.hw +}; + +static struct clk_regmap s4_mali_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_MALI_CLK_CTRL , + .mask =1 , + .shift =31 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="mali" , + .ops = &clk_regmap_mux_ops, + .parent_hws = s4_mali_parent_hws, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* VDEC clocks */ +static const struct clk_parent_data s4_dec_parent_data[] = { + { .fw_name ="fclk_div2p5" , }, + { .fw_name ="fclk_div3" , }, + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div5" , }, + { .fw_name ="fclk_div7" , }, + { .fw_name ="hifi_pll" , }, + { .fw_name ="gp0_pll" , }, + { .fw_name ="xtal" , } +}; + +static struct clk_regmap s4_vdec_p0_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VDEC_CLK_CTRL , + .mask =0x7 , + .shift =9 , + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vdec_p0_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_dec_parent_data, + .num_parents =ARRAY_SIZE (s4_dec_parent_data), + }, +}; + +static struct clk_regmap s4_vdec_p0_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VDEC_CLK_CTRL , + .shift =0 , + .width =7 , + .flags =CLK_DIVIDER_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vdec_p0_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vdec_p0_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vdec_p0 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VDEC_CLK_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vdec_p0" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vdec_p0_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vdec_p1_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VDEC3_CLK_CTRL , + .mask =0x7 , + .shift =9 , + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vdec_p1_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_dec_parent_data, + .num_parents =ARRAY_SIZE (s4_dec_parent_data), + }, +}; + +static struct clk_regmap s4_vdec_p1_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VDEC3_CLK_CTRL , + .shift =0 , + .width =7 , + .flags =CLK_DIVIDER_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vdec_p1_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vdec_p1_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vdec_p1 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VDEC3_CLK_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vdec_p1" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vdec_p1_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static const struct clk_hw *s4_vdec_mux_parent_hws[] = { + &s4_vdec_p0.hw, + &s4_vdec_p1.hw +}; + +static struct clk_regmap s4_vdec_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VDEC3_CLK_CTRL , + .mask =0x1 , + .shift =15 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vdec_mux" , + .ops = &clk_regmap_mux_ops, + .parent_hws = s4_vdec_mux_parent_hws, + .num_parents =ARRAY_SIZE (s4_vdec_mux_parent_hws), + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_hevcf_p0_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VDEC2_CLK_CTRL , + .mask =0x7 , + .shift =9 , + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ) { + .name ="hevcf_p0_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_dec_parent_data, + .num_parents =ARRAY_SIZE (s4_dec_parent_data), + }, +}; + +static struct clk_regmap s4_hevcf_p0_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VDEC2_CLK_CTRL , + .shift =0 , + .width =7 , + .flags =CLK_DIVIDER_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ) { + .name ="hevcf_p0_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_hevcf_p0_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_hevcf_p0 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VDEC2_CLK_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="hevcf_p0_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_hevcf_p0_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_hevcf_p1_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VDEC4_CLK_CTRL , + .mask =0x7 , + .shift =9 , + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ) { + .name ="hevcf_p1_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_dec_parent_data, + .num_parents =ARRAY_SIZE (s4_dec_parent_data), + }, +}; + +static struct clk_regmap s4_hevcf_p1_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VDEC4_CLK_CTRL , + .shift =0 , + .width =7 , + .flags =CLK_DIVIDER_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ) { + .name ="hevcf_p1_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_hevcf_p1_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_hevcf_p1 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VDEC4_CLK_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="hevcf_p1" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_hevcf_p1_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static const struct clk_hw *s4_hevcf_mux_parent_hws[] = { + &s4_hevcf_p0.hw, + &s4_hevcf_p1.hw +}; + +static struct clk_regmap s4_hevcf_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VDEC4_CLK_CTRL , + .mask =0x1 , + .shift =15 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="hevcf" , + .ops = &clk_regmap_mux_ops, + .parent_hws = s4_hevcf_mux_parent_hws, + .num_parents =ARRAY_SIZE (s4_hevcf_mux_parent_hws), + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* VPU Clock */ +static const struct clk_parent_data s4_vpu_parent_data[] = { + { .fw_name ="fclk_div3" , }, + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div5" , }, + { .fw_name ="fclk_div7" , }, + { .fw_name ="mpll1" , }, + { .hw = &s4_vid_pll.hw }, + { .fw_name ="hifi_pll" , }, + { .fw_name ="gp0_pll" , }, +}; + +static struct clk_regmap s4_vpu_0_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VPU_CLK_CTRL , + .mask =0x7 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vpu_0_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_vpu_parent_data, + .num_parents =ARRAY_SIZE (s4_vpu_parent_data), + }, +}; + +static struct clk_regmap s4_vpu_0_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VPU_CLK_CTRL , + .shift =0 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vpu_0_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vpu_0_sel.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vpu_0 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VPU_CLK_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vpu_0" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vpu_0_div.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vpu_1_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VPU_CLK_CTRL , + .mask =0x7 , + .shift =25 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vpu_1_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_vpu_parent_data, + .num_parents =ARRAY_SIZE (s4_vpu_parent_data), + }, +}; + +static struct clk_regmap s4_vpu_1_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VPU_CLK_CTRL , + .shift =16 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vpu_1_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vpu_1_sel.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vpu_1 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VPU_CLK_CTRL , + .bit_idx =24 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vpu_1" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vpu_1_div.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vpu = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VPU_CLK_CTRL , + .mask =1 , + .shift =31 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vpu" , + .ops = &clk_regmap_mux_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vpu_0.hw, + &s4_vpu_1.hw, + }, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static const struct clk_parent_data vpu_clkb_tmp_parent_data[] = { + { .hw = &s4_vpu.hw }, + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div5" , }, + { .fw_name ="fclk_div7" , } +}; + +static struct clk_regmap s4_vpu_clkb_tmp_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VPU_CLKB_CTRL , + .mask =0x3 , + .shift =20 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vpu_clkb_tmp_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = vpu_clkb_tmp_parent_data, + .num_parents =ARRAY_SIZE (vpu_clkb_tmp_parent_data), + }, +}; + +static struct clk_regmap s4_vpu_clkb_tmp_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VPU_CLKB_CTRL , + .shift =16 , + .width =4 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vpu_clkb_tmp_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vpu_clkb_tmp_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vpu_clkb_tmp = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VPU_CLKB_CTRL , + .bit_idx =24 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vpu_clkb_tmp" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vpu_clkb_tmp_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vpu_clkb_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VPU_CLKB_CTRL , + .shift =0 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vpu_clkb_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vpu_clkb_tmp.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vpu_clkb = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VPU_CLKB_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vpu_clkb" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vpu_clkb_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static const struct clk_parent_data s4_vpu_clkc_parent_data[] = { + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div3" , }, + { .fw_name ="fclk_div5" , }, + { .fw_name ="fclk_div7" , }, + { .fw_name ="mpll1" , }, + { .hw = &s4_vid_pll.hw }, + { .fw_name ="mpll2" , }, + { .fw_name ="gp0_pll" , }, +}; + +static struct clk_regmap s4_vpu_clkc_p0_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VPU_CLKC_CTRL , + .mask =0x7 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vpu_clkc_p0_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_vpu_clkc_parent_data, + .num_parents =ARRAY_SIZE (s4_vpu_clkc_parent_data), + }, +}; + +static struct clk_regmap s4_vpu_clkc_p0_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VPU_CLKC_CTRL , + .shift =0 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vpu_clkc_p0_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vpu_clkc_p0_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vpu_clkc_p0 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VPU_CLKC_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vpu_clkc_p0" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vpu_clkc_p0_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vpu_clkc_p1_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VPU_CLKC_CTRL , + .mask =0x7 , + .shift =25 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vpu_clkc_p1_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_vpu_clkc_parent_data, + .num_parents =ARRAY_SIZE (s4_vpu_clkc_parent_data), + }, +}; + +static struct clk_regmap s4_vpu_clkc_p1_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VPU_CLKC_CTRL , + .shift =16 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vpu_clkc_p1_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vpu_clkc_p1_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vpu_clkc_p1 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VPU_CLKC_CTRL , + .bit_idx =24 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vpu_clkc_p1" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vpu_clkc_p1_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static const struct clk_hw *s4_vpu_mux_parent_hws[] = { + &s4_vpu_clkc_p0.hw, + &s4_vpu_clkc_p1.hw +}; + +static struct clk_regmap s4_vpu_clkc_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VPU_CLKC_CTRL , + .mask =0x1 , + .shift =31 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vpu_clkc_mux" , + .ops = &clk_regmap_mux_ops, + .parent_hws = s4_vpu_mux_parent_hws, + .num_parents =ARRAY_SIZE (s4_vpu_mux_parent_hws), + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* VAPB Clock */ +static const struct clk_parent_data s4_vapb_parent_data[] = { + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div3" , }, + { .fw_name ="fclk_div5" , }, + { .fw_name ="fclk_div7" , }, + { .fw_name ="mpll1" , }, + { .hw = &s4_vid_pll.hw }, + { .fw_name ="mpll2" , }, + { .fw_name ="fclk_div2p5" , }, +}; + +static struct clk_regmap s4_vapb_0_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VAPBCLK_CTRL , + .mask =0x7 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vapb_0_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_vapb_parent_data, + .num_parents =ARRAY_SIZE (s4_vapb_parent_data), + }, +}; + +static struct clk_regmap s4_vapb_0_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VAPBCLK_CTRL , + .shift =0 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vapb_0_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vapb_0_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vapb_0 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VAPBCLK_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vapb_0" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vapb_0_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vapb_1_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VAPBCLK_CTRL , + .mask =0x7 , + .shift =25 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vapb_1_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_vapb_parent_data, + .num_parents =ARRAY_SIZE (s4_vapb_parent_data), + }, +}; + +static struct clk_regmap s4_vapb_1_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VAPBCLK_CTRL , + .shift =16 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vapb_1_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vapb_1_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vapb_1 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VAPBCLK_CTRL , + .bit_idx =24 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vapb_1" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vapb_1_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vapb = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VAPBCLK_CTRL , + .mask =1 , + .shift =31 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vapb_sel" , + .ops = &clk_regmap_mux_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vapb_0.hw, + &s4_vapb_1.hw + }, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_ge2d_gate = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VAPBCLK_CTRL , + .bit_idx =30 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="ge2d_clk" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &s4_vapb.hw }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static const struct clk_parent_data s4_esmclk_parent_data[] = { + { .fw_name ="fclk_div7" , }, + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div3" , }, + { .fw_name ="fclk_div5" , }, +}; + +static struct clk_regmap s4_hdcp22_esmclk_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_HDCP22_CTRL , + .mask =0x3 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="hdcp22_esmclk_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_esmclk_parent_data, + .num_parents =ARRAY_SIZE (s4_esmclk_parent_data), + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_hdcp22_esmclk_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_HDCP22_CTRL , + .shift =0 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="hdcp22_esmclk_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_hdcp22_esmclk_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_hdcp22_esmclk_gate = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_HDCP22_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="hdcp22_esmclk_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_hdcp22_esmclk_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static const struct clk_parent_data s4_skpclk_parent_data[] = { + { .fw_name ="xtal" , }, + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div3" , }, + { .fw_name ="fclk_div5" , }, +}; + +static struct clk_regmap s4_hdcp22_skpclk_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_HDCP22_CTRL , + .mask =0x3 , + .shift =25 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="hdcp22_skpclk_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_skpclk_parent_data, + .num_parents =ARRAY_SIZE (s4_skpclk_parent_data), + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_hdcp22_skpclk_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_HDCP22_CTRL , + .shift =16 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="hdcp22_skpclk_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_hdcp22_skpclk_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_hdcp22_skpclk_gate = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_HDCP22_CTRL , + .bit_idx =24 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="hdcp22_skpclk_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_hdcp22_skpclk_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static const struct clk_parent_data s4_vdin_parent_data[] = { + { .fw_name ="xtal" , }, + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div3" , }, + { .fw_name ="fclk_div5" , }, + { .hw = &s4_vid_pll.hw } +}; + +static struct clk_regmap s4_vdin_meas_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VDIN_MEAS_CLK_CTRL , + .mask =0x7 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vdin_meas_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_vdin_parent_data, + .num_parents =ARRAY_SIZE (s4_vdin_parent_data), + }, +}; + +static struct clk_regmap s4_vdin_meas_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_VDIN_MEAS_CLK_CTRL , + .shift =0 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="vdin_meas_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vdin_meas_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_vdin_meas_gate = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_VDIN_MEAS_CLK_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="vdin_meas_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_vdin_meas_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* EMMC/NAND clock */ +static const struct clk_parent_data s4_sd_emmc_clk0_parent_data[] = { + { .fw_name ="xtal" , }, + { .fw_name ="fclk_div2" , }, + { .fw_name ="fclk_div3" , }, + { .fw_name ="hifi_pll" , }, + { .fw_name ="fclk_div2p5" , }, + { .fw_name ="mpll2" , }, + { .fw_name ="mpll3" , }, + { .fw_name ="gp0_pll" , }, +}; + +static struct clk_regmap s4_sd_emmc_c_clk0_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_NAND_CLK_CTRL , + .mask =0x7 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="sd_emmc_c_clk0_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_sd_emmc_clk0_parent_data, + .num_parents =ARRAY_SIZE (s4_sd_emmc_clk0_parent_data), + }, +}; + +static struct clk_regmap s4_sd_emmc_c_clk0_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_NAND_CLK_CTRL , + .shift =0 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="sd_emmc_c_clk0_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sd_emmc_c_clk0_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_sd_emmc_c_clk0 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_NAND_CLK_CTRL , + .bit_idx =7 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="sd_emmc_c_clk0" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sd_emmc_c_clk0_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_sd_emmc_a_clk0_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_SD_EMMC_CLK_CTRL , + .mask =0x7 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="sd_emmc_a_clk0_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_sd_emmc_clk0_parent_data, + .num_parents =ARRAY_SIZE (s4_sd_emmc_clk0_parent_data), + }, +}; + +static struct clk_regmap s4_sd_emmc_a_clk0_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_SD_EMMC_CLK_CTRL , + .shift =0 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="sd_emmc_a_clk0_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sd_emmc_a_clk0_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_sd_emmc_a_clk0 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_SD_EMMC_CLK_CTRL , + .bit_idx =7 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="sd_emmc_a_clk0" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sd_emmc_a_clk0_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_sd_emmc_b_clk0_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_SD_EMMC_CLK_CTRL , + .mask =0x7 , + .shift =25 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="sd_emmc_b_clk0_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_sd_emmc_clk0_parent_data, + .num_parents =ARRAY_SIZE (s4_sd_emmc_clk0_parent_data), + }, +}; + +static struct clk_regmap s4_sd_emmc_b_clk0_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_SD_EMMC_CLK_CTRL , + .shift =16 , + .width =7 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="sd_emmc_b_clk0_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sd_emmc_b_clk0_sel.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_sd_emmc_b_clk0 = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_SD_EMMC_CLK_CTRL , + .bit_idx =23 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="sd_emmc_b_clk0" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_sd_emmc_b_clk0_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* SPICC Clock */ +static const struct clk_parent_data s4_spicc_parent_data[] = { + { .fw_name ="xtal" , }, + { .hw = &s4_sys_clk.hw }, + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div3" , }, + { .fw_name ="fclk_div2" , }, + { .fw_name ="fclk_div5" , }, + { .fw_name ="fclk_div7" , }, +}; + +static struct clk_regmap s4_spicc0_mux = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_SPICC_CLK_CTRL , + .mask =0x7 , + .shift =7 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="spicc0_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_spicc_parent_data, + .num_parents =ARRAY_SIZE (s4_spicc_parent_data), + }, +}; + +static struct clk_regmap s4_spicc0_div = { + .data = &(struct clk_regmap_div_data ){ + .offset =CLKCTRL_SPICC_CLK_CTRL , + .shift =0 , + .width =6 , + }, + .hw.init = &(struct clk_init_data ) { + .name ="spicc0_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_spicc0_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_spicc0_gate = { + .data = &(struct clk_regmap_gate_data ){ + .offset =CLKCTRL_SPICC_CLK_CTRL , + .bit_idx =6 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="spicc0" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_spicc0_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +/* PWM Clock */ +static const struct clk_parent_data s4_pwm_parent_data[] = { + { .fw_name ="xtal" , }, + { .hw = &s4_vid_pll.hw }, + { .fw_name ="fclk_div4" , }, + { .fw_name ="fclk_div3" , }, +}; + +static struct clk_regmap s4_pwm_a_mux = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_PWM_CLK_AB_CTRL , + .mask =0x3 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_a_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_pwm_parent_data, + .num_parents =ARRAY_SIZE (s4_pwm_parent_data), + }, +}; + +static struct clk_regmap s4_pwm_a_div = { + .data = &(struct clk_regmap_div_data ) { + .offset =CLKCTRL_PWM_CLK_AB_CTRL , + .shift =0 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_a_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_a_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_a_gate = { + .data = &(struct clk_regmap_gate_data ) { + .offset =CLKCTRL_PWM_CLK_AB_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_a_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_a_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_b_mux = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_PWM_CLK_AB_CTRL , + .mask =0x3 , + .shift =25 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_b_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_pwm_parent_data, + .num_parents =ARRAY_SIZE (s4_pwm_parent_data), + }, +}; + +static struct clk_regmap s4_pwm_b_div = { + .data = &(struct clk_regmap_div_data ) { + .offset =CLKCTRL_PWM_CLK_AB_CTRL , + .shift =16 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_b_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_b_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_b_gate = { + .data = &(struct clk_regmap_gate_data ) { + .offset =CLKCTRL_PWM_CLK_AB_CTRL , + .bit_idx =24 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_b_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_b_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_c_mux = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_PWM_CLK_CD_CTRL , + .mask =0x3 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_c_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_pwm_parent_data, + .num_parents =ARRAY_SIZE (s4_pwm_parent_data), + }, +}; + +static struct clk_regmap s4_pwm_c_div = { + .data = &(struct clk_regmap_div_data ) { + .offset =CLKCTRL_PWM_CLK_CD_CTRL , + .shift =0 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_c_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_c_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_c_gate = { + .data = &(struct clk_regmap_gate_data ) { + .offset =CLKCTRL_PWM_CLK_CD_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_c_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_c_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_d_mux = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_PWM_CLK_CD_CTRL , + .mask =0x3 , + .shift =25 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_d_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_pwm_parent_data, + .num_parents =ARRAY_SIZE (s4_pwm_parent_data), + }, +}; + +static struct clk_regmap s4_pwm_d_div = { + .data = &(struct clk_regmap_div_data ) { + .offset =CLKCTRL_PWM_CLK_CD_CTRL , + .shift =16 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_d_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_d_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_d_gate = { + .data = &(struct clk_regmap_gate_data ) { + .offset =CLKCTRL_PWM_CLK_CD_CTRL , + .bit_idx =24 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_d_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_d_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_e_mux = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_PWM_CLK_EF_CTRL , + .mask =0x3 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_e_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_pwm_parent_data, + .num_parents =ARRAY_SIZE (s4_pwm_parent_data), + }, +}; + +static struct clk_regmap s4_pwm_e_div = { + .data = &(struct clk_regmap_div_data ) { + .offset =CLKCTRL_PWM_CLK_EF_CTRL , + .shift =0 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_e_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_e_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_e_gate = { + .data = &(struct clk_regmap_gate_data ) { + .offset =CLKCTRL_PWM_CLK_EF_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_e_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_e_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_f_mux = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_PWM_CLK_EF_CTRL , + .mask =0x3 , + .shift =25 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_f_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_pwm_parent_data, + .num_parents =ARRAY_SIZE (s4_pwm_parent_data), + }, +}; + +static struct clk_regmap s4_pwm_f_div = { + .data = &(struct clk_regmap_div_data ) { + .offset =CLKCTRL_PWM_CLK_EF_CTRL , + .shift =16 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_f_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_f_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_f_gate = { + .data = &(struct clk_regmap_gate_data ) { + .offset =CLKCTRL_PWM_CLK_EF_CTRL , + .bit_idx =24 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_f_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_f_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_g_mux = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_PWM_CLK_GH_CTRL , + .mask =0x3 , + .shift =9 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_g_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_pwm_parent_data, + .num_parents =ARRAY_SIZE (s4_pwm_parent_data), + }, +}; + +static struct clk_regmap s4_pwm_g_div = { + .data = &(struct clk_regmap_div_data ) { + .offset =CLKCTRL_PWM_CLK_GH_CTRL , + .shift =0 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_g_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_g_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_g_gate = { + .data = &(struct clk_regmap_gate_data ) { + .offset =CLKCTRL_PWM_CLK_GH_CTRL , + .bit_idx =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_g_gate" , + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_g_div.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_h_mux = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_PWM_CLK_GH_CTRL , + .mask =0x3 , + .shift =25 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_h_mux" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_pwm_parent_data, + .num_parents =ARRAY_SIZE (s4_pwm_parent_data), + }, +}; + +static struct clk_regmap s4_pwm_h_div = { + .data = &(struct clk_regmap_div_data ) { + .offset =CLKCTRL_PWM_CLK_GH_CTRL , + .shift =16 , + .width =8 , + }, + .hw.init = &(struct clk_init_data ){ + .name ="pwm_h_div" , + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &s4_pwm_h_mux.hw + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + }, +}; + +static struct clk_regmap s4_pwm_h_gate = { + .data = &(struct clk_regmap_gate_data ) { + .offset =CLKCTRL_PWM_CLK_GH_CTRL ,Lines of this file are not shown. View the raw message.
drivers/clk/meson/s4-peripherals.h new file +218
-0Lines of this file are not shown. View the raw message.
include/dt-bindings/clock/amlogic,s4-peripherals-clkc.h new file +131
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
.
Part of the diff is not shown here. View the raw message.
Jerome Brunet
maintainerRe: [PATCH V5 3/4] clk: meson: s4: add s4 SoC peripheral clock controller driver and bindings
Quoted 11 lines · Yu Tu
Quoted 8 lines
drivers/clk/meson/s4-peripherals.c line 123
Quoted 7 lines
drivers/clk/meson/s4-peripherals.c new file +7
-0+ +/* +* This RTC clock can be supplied by an external 32KHz crystal oscillator. +* If it is used, it should be documented in using fw_name and documented in the +* Bindings. Not currently in use on this board, so skip it. +*/ +static u32 rtc_clk_sel[] = {0 ,1 };No reason to do that
I'm going to change it to static u32 rtc_clk_sel[] = { 0, 1, 2 };. I don't know if that's okay with you?
... then there is no need to specify this table.
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
drivers/clk/meson/s4-peripherals.c new file +23
-0+static const struct clk_parent_data rtc_clk_sel_parent_data[] = { + { .hw = &s4_rtc_32k_by_oscin.hw }, + { .hw = &s4_rtc_32k_by_oscin_div.hw }, + { .fw_name ="ext_32k" , } +}; + +static struct clk_regmap s4_rtc_clk = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_RTC_CTRL , + .mask =0x3 , + .shift =0 , + .table = rtc_clk_sel, + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ){ + .name ="rtc_clk_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = rtc_clk_sel_parent_data, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; +
[...]
Quoted 23 lines
Quoted 13 lines
Quoted 13 lines
drivers/clk/meson/s4-peripherals.c new file +13
-0+ +/* Video Clocks */ +static struct clk_regmap s4_vid_pll_div = { + .data = &(struct meson_vid_pll_div_data ){ + .val = { + .reg_off =CLKCTRL_VID_PLL_CLK_DIV , + .shift =0 , + .width =15 , + }, + .sel = { + .reg_off =CLKCTRL_VID_PLL_CLK_DIV , + .shift =16 , + .width =2 ,Quoted 9 lines
drivers/clk/meson/s4-peripherals.c line 608
Quoted 6 lines
drivers/clk/meson/s4-peripherals.c new file +6
-0+ }, + }, + .hw.init = &(struct clk_init_data) { + .name ="vid_pll_div" , +/* Same to g12a */ + .ops = &meson_vid_pll_div_ro_ops,Please add an helpful explanation.
'Same to g12a' is not helpful.
Quoted 3 lines
"Because the
vid_pll_divclock is a clock that does not need to change the divisor, ops only providesmeson_vid_pll_div_ro_ops."
I wonder if this description is ok for you?
I understand this divider will not change with RO ops.
I'm interrested why it does not change and how it is expected to be setup.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/clk/meson/s4-peripherals.c new file +7
-0+ .parent_data = (const struct clk_parent_data []) { + { .fw_name = "hdmi_pll", } + }, + .num_parents = 1, + .flags = CLK_SET_RATE_PARENT, + }, +};
[...]
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
drivers/clk/meson/s4-peripherals.c new file +7
-0+ +static struct clk_regmap s4_vclk_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VID_CLK_CTRL , + .mask =0x7 , + .shift =16 , + },Quoted 8 lines
drivers/clk/meson/s4-peripherals.c line 673
Quoted 6 lines
drivers/clk/meson/s4-peripherals.c new file +6
-0+ .hw.init = &(struct clk_init_data){ + .name ="vclk_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_vclk_parent_data, + .num_parents =ARRAY_SIZE (s4_vclk_parent_data), + },You are stopping rate propagation here.
It deserves an explanation. Same goes below.
Quoted 3 lines
"When the driver uses this clock, needs to specify the patent clock he wants in the dts."
Is ok for you?
Then you still don't understand the clock flag usage.
Preserving the parent selection (CLK_SET_RATE_NO_REPARENT) and rate propagation (CLK_SET_RATE_PARENT) is not the same thing.
As it stands, your comment is not aliged with what you do.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
+};
Re: [PATCH V5 3/4] clk: meson: s4: add s4 SoC peripheral clock controller driver and bindings
Hi Jerome,
Quoted 14 lines · Jerome Brunet
[ EXTERNAL EMAIL ]
Quoted 9 lines · Yu Tu
Quoted 8 lines
drivers/clk/meson/s4-peripherals.c line 123
Quoted 7 lines
drivers/clk/meson/s4-peripherals.c new file +7
-0+ +/* +* This RTC clock can be supplied by an external 32KHz crystal oscillator. +* If it is used, it should be documented in using fw_name and documented in the +* Bindings. Not currently in use on this board, so skip it. +*/ +static u32 rtc_clk_sel[] = {0 ,1 };No reason to do that
Quoted 5 lines
Quoted 2 lines
I'm going to change it to static u32 rtc_clk_sel[] = { 0, 1, 2 };. I don't know if that's okay with you?
... then there is no need to specify this table.
I got it.I'll change it as you suggest.
Quoted 53 lines
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
drivers/clk/meson/s4-peripherals.c new file +23
-0+static const struct clk_parent_data rtc_clk_sel_parent_data[] = { + { .hw = &s4_rtc_32k_by_oscin.hw }, + { .hw = &s4_rtc_32k_by_oscin_div.hw }, + { .fw_name ="ext_32k" , } +}; + +static struct clk_regmap s4_rtc_clk = { + .data = &(struct clk_regmap_mux_data ) { + .offset =CLKCTRL_RTC_CTRL , + .mask =0x3 , + .shift =0 , + .table = rtc_clk_sel, + .flags =CLK_MUX_ROUND_CLOSEST , + }, + .hw.init = &(struct clk_init_data ){ + .name ="rtc_clk_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = rtc_clk_sel_parent_data, + .num_parents =2 , + .flags =CLK_SET_RATE_PARENT , + }, +}; +[...]
Quoted 23 lines
Quoted 22 lines
Quoted 9 lines
drivers/clk/meson/s4-peripherals.c new file +9
-0+ +/* Video Clocks */ +static struct clk_regmap s4_vid_pll_div = { + .data = &(struct meson_vid_pll_div_data ){ + .val = { + .reg_off =CLKCTRL_VID_PLL_CLK_DIV , + .shift =0 , + .width =15 , + },drivers/clk/meson/s4-peripherals.c line 608
Quoted 10 lines
drivers/clk/meson/s4-peripherals.c new file +10
-0+ .sel = { + .reg_off = CLKCTRL_VID_PLL_CLK_DIV, + .shift = 16, + .width = 2, + }, + }, + .hw.init = &(struct clk_init_data ) { + .name ="vid_pll_div" , +/* Same to g12a */ + .ops = &meson_vid_pll_div_ro_ops,Please add an helpful explanation.
'Same to g12a' is not helpful.
Quoted 7 lines
Quoted 3 lines
"Because the
vid_pll_divclock is a clock that does not need to change the divisor, ops only providesmeson_vid_pll_div_ro_ops."
I wonder if this description is ok for you?I understand this divider will not change with RO ops.
I'm interrested why it does not change and how it is expected to be setup.
Maybe you can be more specific, I don't understand, you're interested in that part of it specifically.
I don't know if you have the document of chip. If not, I can provide it to you privately. You can ask specific questions in conjunction with your documentation and submission(The original submission came from you.). I can give you a specific answer or ask the chip designer to give you a reply.Do you think that's okay with you
Quoted 31 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/clk/meson/s4-peripherals.c new file +7
-0+ .parent_data = (const struct clk_parent_data []) { + { .fw_name = "hdmi_pll", } + }, + .num_parents = 1, + .flags = CLK_SET_RATE_PARENT, + }, +};[...]
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
drivers/clk/meson/s4-peripherals.c new file +7
-0+ +static struct clk_regmap s4_vclk_sel = { + .data = &(struct clk_regmap_mux_data ){ + .offset =CLKCTRL_VID_CLK_CTRL , + .mask =0x7 , + .shift =16 , + },Quoted 8 lines
drivers/clk/meson/s4-peripherals.c line 673
Quoted 6 lines
drivers/clk/meson/s4-peripherals.c new file +6
-0+ .hw.init = &(struct clk_init_data){ + .name ="vclk_sel" , + .ops = &clk_regmap_mux_ops, + .parent_data = s4_vclk_parent_data, + .num_parents =ARRAY_SIZE (s4_vclk_parent_data), + },You are stopping rate propagation here.
It deserves an explanation. Same goes below.Quoted 3 lines
"When the driver uses this clock, needs to specify the patent clock he wants in the dts."
Is ok for you?
Quoted 7 lines
Then you still don't understand the clock flag usage.
Preserving the parent selection (
CLK_SET_RATE_NO_REPARENT) and rate propagation (CLK_SET_RATE_PARENT) is not the same thing.As it stands, your comment is not aliged with what you do.
Thanks for the explanation of flag.
My goal is to have the clock user describe themselves in DTS using the parent, or using the assigned-clocks and assigned-clock-parents settings in DTS. According to your explanation, some clocks like this should use CLK_SET_RATE_NO_REPARENT, right?
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
+};
.
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
PATCH v5 4/4 arm64: dts: meson: add S4 Soc Peripheral clock controller in DT
In reply to Yu TuAdded information about the S4 SOC Peripheral Clock controller in DT.
--- arch/arm64/boot/dts/amlogic/meson-s4.dtsi | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+)
arch/arm64/boot/dts/amlogic/meson-s4.dtsi +26 -0
@@ -6,6 +6,8 @@ #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/clock/amlogic,s4-pll-clkc.h> +#include <dt-bindings/clock/amlogic,s4-peripherals-clkc.h> / { cpus {
@@ -100,6 +102,30 @@ clkc_pll: clock-controller@8000 { #clock-cells = <1>; }; + clkc_periphs: clock-controller { + compatible = "amlogic,s4-peripherals-clkc"; + reg = <0x0 0x0 0x0 0x49c>; + clocks = <&clkc_pll CLKID_FCLK_DIV2>, + <&clkc_pll CLKID_FCLK_DIV2P5>, + <&clkc_pll CLKID_FCLK_DIV3>, + <&clkc_pll CLKID_FCLK_DIV4>, + <&clkc_pll CLKID_FCLK_DIV5>, + <&clkc_pll CLKID_FCLK_DIV7>, + <&clkc_pll CLKID_HIFI_PLL>, + <&clkc_pll CLKID_GP0_PLL>, + <&clkc_pll CLKID_MPLL0>, + <&clkc_pll CLKID_MPLL1>, + <&clkc_pll CLKID_MPLL2>, + <&clkc_pll CLKID_MPLL3>, + <&clkc_pll CLKID_HDMI_PLL>, + <&xtal>; + clock-names = "fclk_div2", "fclk_div2p5", "fclk_div3", + "fclk_div4", "fclk_div5", "fclk_div7", + "hifi_pll", "gp0_pll", "mpll0", "mpll1", + "mpll2", "mpll3", "hdmi_pll", "xtal"; + #clock-cells = <1>; + }; + periphs_pinctrl: pinctrl@4000 { compatible = "amlogic,meson-s4-periphs-pinctrl"; #address-cells = <2>;
Signature · 1 line
2.33.1
Re: [PATCH V5 4/4] arm64: dts: meson: add S4 Soc Peripheral clock controller in DT
Quoted 21 lines · Yu Tu
Added information about the S4 SOC Peripheral Clock controller in DT.
Signed-off-by Yu Tu <[email protected]>--- arch/arm64/boot/dts/amlogic/meson-s4.dtsi | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+)arch/arm64/boot/dts/amlogic/meson-s4.dtsi +2
-0@@ -6,6 +6,8 @@ #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/clock/amlogic,s4-pll-clkc.h> +#include <dt-bindings/clock/amlogic,s4-peripherals-clkc.h> / { cpus {
arch/arm64/boot/dts/amlogic/meson-s4.dtsi clkc_pll: clock-controller@8000 { · line 107
Quoted 6 lines
arch/arm64/boot/dts/amlogic/meson-s4.dtsi +3
-0@@ -100,6 +102,30 @@ clkc_pll: clock-controller@8000 { #clock-cells = <1>; }; + clkc_periphs: clock-controller { + compatible = "amlogic,s4-peripherals-clkc"; + reg = <0x0 0x0 0x0 0x49c>;
This is broken... did you check for warnings?
Best regards,
Krzysztof
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Re: [PATCH V5 4/4] arm64: dts: meson: add S4 Soc Peripheral clock controller in DT
Hi Krzysztof,
Quoted 27 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 24 lines · Yu Tu
Added information about the S4 SOC Peripheral Clock controller in DT.
Signed-off-by Yu Tu <[email protected]>--- arch/arm64/boot/dts/amlogic/meson-s4.dtsi | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+)arch/arm64/boot/dts/amlogic/meson-s4.dtsi +2
-0@@ -6,6 +6,8 @@ #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/clock/amlogic,s4-pll-clkc.h> +#include <dt-bindings/clock/amlogic,s4-peripherals-clkc.h> / { cpus {@@ -100,6 +102,30 @@ clkc_pll: clock-controller@8000 { #clock-cells = <1>; };
Quoted 5 lines
arch/arm64/boot/dts/amlogic/meson-s4.dtsi clkc_pll: clock-controller@8000 { · line 107
Quoted 3 lines
arch/arm64/boot/dts/amlogic/meson-s4.dtsi +3
-0+ clkc_periphs: clock-controller { + compatible = "amlogic,s4-peripherals-clkc"; + reg = <0x0 0x0 0x0 0x49c>;This is broken... did you check for warnings?
Yes, i do.
You can have a look at the results of my test, as follows.
total: 0 errors, 0 warnings, 0 checks, 38 lines checked
../patch_clk_v5_1122/0004-arm64-dts-meson-add-S4-Soc-Peripheral-clock-controll.patch has no obvious style problems and is ready for submission.
Quoted 6 lines
Best regards,
Krzysztof.
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Re: [PATCH V5 4/4] arm64: dts: meson: add S4 Soc Peripheral clock controller in DT
Quoted 35 lines · Yu Tu
Hi Krzysztof,
Quoted 27 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 24 lines · Yu Tu
Added information about the S4 SOC Peripheral Clock controller in DT.
Signed-off-by Yu Tu <[email protected]>--- arch/arm64/boot/dts/amlogic/meson-s4.dtsi | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+)arch/arm64/boot/dts/amlogic/meson-s4.dtsi +2
-0@@ -6,6 +6,8 @@ #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/clock/amlogic,s4-pll-clkc.h> +#include <dt-bindings/clock/amlogic,s4-peripherals-clkc.h> / { cpus {@@ -100,6 +102,30 @@ clkc_pll: clock-controller@8000 { #clock-cells = <1>; };Quoted 5 lines
arch/arm64/boot/dts/amlogic/meson-s4.dtsi clkc_pll: clock-controller@8000 { · line 107
Quoted 3 lines
arch/arm64/boot/dts/amlogic/meson-s4.dtsi +3
-0+ clkc_periphs: clock-controller { + compatible = "amlogic,s4-peripherals-clkc"; + reg = <0x0 0x0 0x0 0x49c>;This is broken... did you check for warnings?
Quoted 8 lines
Yes, i do.
You can have a look at the results of my test, as follows.total: 0 errors, 0 warnings, 0 checks, 38 lines checked
../patch_clk_v5_1122/0004-arm64-dts-meson-add-S4-Soc-Peripheral-clock-controll.patchhas no obvious style problems and is ready for submission.
This is a checkpatch output. I am talking about DTS broken. dtc should warn you.
Best regards,
Krzysztof
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Re: [PATCH V5 4/4] arm64: dts: meson: add S4 Soc Peripheral clock controller in DT
Quoted 41 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 38 lines · Yu Tu
Hi Krzysztof,
Quoted 27 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 24 lines · Yu Tu
Added information about the S4 SOC Peripheral Clock controller in DT.
Signed-off-by Yu Tu <[email protected]>--- arch/arm64/boot/dts/amlogic/meson-s4.dtsi | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+)arch/arm64/boot/dts/amlogic/meson-s4.dtsi +2
-0@@ -6,6 +6,8 @@ #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/clock/amlogic,s4-pll-clkc.h> +#include <dt-bindings/clock/amlogic,s4-peripherals-clkc.h> / { cpus {@@ -100,6 +102,30 @@ clkc_pll: clock-controller@8000 { #clock-cells = <1>; };Quoted 5 lines
arch/arm64/boot/dts/amlogic/meson-s4.dtsi clkc_pll: clock-controller@8000 { · line 107
Quoted 3 lines
arch/arm64/boot/dts/amlogic/meson-s4.dtsi +3
-0+ clkc_periphs: clock-controller { + compatible = "amlogic,s4-peripherals-clkc"; + reg = <0x0 0x0 0x0 0x49c>;This is broken... did you check for warnings?
Yes, i do.
You can have a look at the results of my test, as follows.
Quoted 8 lines
Quoted 5 lines
total: 0 errors, 0 warnings, 0 checks, 38 lines checked
../patch_clk_v5_1122/0004-arm64-dts-meson-add-S4-Soc-Peripheral-clock-controll.patchhas no obvious style problems and is ready for submission.This is a checkpatch output. I am talking about DTS broken. dtc should warn you.
Do you mean I will have wraning in compiling?
I actually compiled without warning.
ccf$ make ARCH=arm64 dtbs -j12
DTC arch/arm64/boot/dts/amlogic/meson-s4-s805x2-aq222.dtb
Quoted 5 lines
Best regards,
Krzysztof.
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Re: [PATCH V5 4/4] arm64: dts: meson: add S4 Soc Peripheral clock controller in DT
Quoted 4 lines · Yu Tu
Quoted 4 lines
Quoted 3 lines
../patch_clk_v5_1122/0004-arm64-dts-meson-add-S4-Soc-Peripheral-clock-controll.patchhas no obvious style problems and is ready for submission.
Quoted 8 lines
Quoted 2 lines
This is a checkpatch output. I am talking about DTS broken. dtc should warn you.
Do you mean I will have wraning in compiling?
I actually compiled without warning.
ccf$ make ARCH=arm64 dtbs -j12
DTCarch/arm64/boot/dts/amlogic/meson-s4-s805x2-aq222.dtb
Nope:
../arch/arm64/boot/dts/amlogic/meson-s4.dtsi:105.35-127.6: Warning (unit_address_vs_reg): /soc/apb4@fe000000/clock-controller: node has a reg or ranges property, but no unit name
Test your patches better before using reviewers time for trivial compile-time fixes. The same rules for C code apply for DTS.
Best regards,
Krzysztof
Re: [PATCH V5 4/4] arm64: dts: meson: add S4 Soc Peripheral clock controller in DT
Quoted 16 lines · Krzysztof Kozlowski
[ EXTERNAL EMAIL ]
Quoted 4 lines · Yu Tu
Quoted 4 lines
Quoted 3 lines
../patch_clk_v5_1122/0004-arm64-dts-meson-add-S4-Soc-Peripheral-clock-controll.patchhas no obvious style problems and is ready for submission.Quoted 8 lines
Quoted 2 lines
This is a checkpatch output. I am talking about DTS broken. dtc should warn you.
Do you mean I will have wraning in compiling?
I actually compiled without warning.
ccf$ make ARCH=arm64 dtbs -j12DTC arch/arm64/boot/dts/amlogic/meson-s4-s805x2-aq222.dtb
Quoted 9 lines
Nope:
../arch/arm64/boot/dts/amlogic/meson-s4.dtsi:105.35-127.6: Warning (
unit_address_vs_reg): /soc/apb4@fe000000/clock-controller: node has a reg or ranges property, but no unit nameTest your patches better before using reviewers time for trivial compile-time fixes. The same rules for C code apply for DTS.
Like this:
clkc_periphs: clock-controller@0 {
compatible = "amlogic,s4-peripherals-clkc";
reg = <0x0 0x0 0x0 0x49c>;You mean it should be, right?
Quoted 4 lines
Best regards,
Krzysztof.
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Neil Armstrong
maintainerRe: [PATCH V5 4/4] arm64: dts: meson: add S4 Soc Peripheral clock controller in DT
In reply to Krzysztof KozlowskiQuoted 25 lines · Krzysztof Kozlowski
Quoted 24 lines · Yu Tu
Added information about the S4 SOC Peripheral Clock controller in DT.
Signed-off-by Yu Tu <[email protected]>--- arch/arm64/boot/dts/amlogic/meson-s4.dtsi | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+)arch/arm64/boot/dts/amlogic/meson-s4.dtsi +2
-0@@ -6,6 +6,8 @@ #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/clock/amlogic,s4-pll-clkc.h> +#include <dt-bindings/clock/amlogic,s4-peripherals-clkc.h> / { cpus {@@ -100,6 +102,30 @@ clkc_pll: clock-controller@8000 { #clock-cells = <1>; };
Quoted 5 lines
arch/arm64/boot/dts/amlogic/meson-s4.dtsi clkc_pll: clock-controller@8000 { · line 107
Quoted 3 lines
arch/arm64/boot/dts/amlogic/meson-s4.dtsi +3
-0+ clkc_periphs: clock-controller { + compatible = "amlogic,s4-peripherals-clkc"; + reg = <0x0 0x0 0x0 0x49c>;This is broken... did you check for warnings?
This is actually fine, the parent node has a ranges property:
https://github.com/torvalds/linux/blob/eb7081409f94a9a8608593d0fb63a1aa3d6f95d8/arch/arm64/boot/dts/amlogic/meson-s4.dtsi#L93
Neil
Quoted 10 lines
Best regards,
Krzysztof_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Re: [PATCH V5 4/4] arm64: dts: meson: add S4 Soc Peripheral clock controller in DT
Hi Neil,
Thanks for your reply and explanation.
Quoted 44 lines · Neil Armstrong
[ EXTERNAL EMAIL ]
Quoted 20 lines · Krzysztof Kozlowski
Quoted 19 lines · Yu Tu
Added information about the S4 SOC Peripheral Clock controller in DT.
Signed-off-by Yu Tu <[email protected]>---
arch/arm64/boot/dts/amlogic/meson-s4.dtsi| 26 +++++++++++++++++++++++1 file changed, 26 insertions(+)arch/arm64/boot/dts/amlogic/meson-s4.dtsi +2
-0@@ -6,6 +6,8 @@ #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/clock/amlogic,s4-pll-clkc.h> +#include <dt-bindings/clock/amlogic,s4-peripherals-clkc.h> / { cpus {Quoted 8 lines
arch/arm64/boot/dts/amlogic/meson-s4.dtsi clkc_pll: clock-controller@8000 { · line 106
Quoted 6 lines
arch/arm64/boot/dts/amlogic/meson-s4.dtsi +3
-0@@ -100,6 +102,30 @@ clkc_pll: clock-controller@8000 { #clock-cells = <1>; }; + clkc_periphs: clock-controller { + compatible = "amlogic,s4-peripherals-clkc"; + reg = <0x0 0x0 0x0 0x49c>;This is broken... did you check for warnings?
This is actually fine, the parent node has a ranges property:
https://github.com/torvalds/linux/blob/eb7081409f94a9a8608593d0fb63a1aa3d6f95d8/arch/arm64/boot/dts/amlogic/meson-s4.dtsi#L93Neil
Quoted 6 lines
Best regards,
Krzysztof
Quoted 6 lines
Quoted 4 lines
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic.
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Re: [PATCH V5 4/4] arm64: dts: meson: add S4 Soc Peripheral clock controller in DT
In reply to Neil ArmstrongQuoted 26 lines · Neil Armstrong
Quoted 25 lines · Krzysztof Kozlowski
Quoted 24 lines · Yu Tu
Added information about the S4 SOC Peripheral Clock controller in DT.
Signed-off-by Yu Tu <[email protected]>--- arch/arm64/boot/dts/amlogic/meson-s4.dtsi | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+)arch/arm64/boot/dts/amlogic/meson-s4.dtsi +2
-0@@ -6,6 +6,8 @@ #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/clock/amlogic,s4-pll-clkc.h> +#include <dt-bindings/clock/amlogic,s4-peripherals-clkc.h> / { cpus {@@ -100,6 +102,30 @@ clkc_pll: clock-controller@8000 { #clock-cells = <1>; };
Quoted 8 lines
Quoted 5 lines
arch/arm64/boot/dts/amlogic/meson-s4.dtsi clkc_pll: clock-controller@8000 { · line 107
Quoted 3 lines
arch/arm64/boot/dts/amlogic/meson-s4.dtsi +3
-0+ clkc_periphs: clock-controller { + compatible = "amlogic,s4-peripherals-clkc"; + reg = <0x0 0x0 0x0 0x49c>;This is broken... did you check for warnings?
This is actually fine, the parent node has a ranges property:
https://github.com/torvalds/linux/blob/eb7081409f94a9a8608593d0fb63a1aa3d6f95d8/arch/arm64/boot/dts/amlogic/meson-s4.dtsi#L93
The parent ranges do not change here anything. You cannot have a reg without unit address and the tools report it. No need to use reviewers for this...
Best regards,
Krzysztof
[email protected]
maintainerRe: [PATCH V5 4/4] arm64: dts: meson: add S4 Soc Peripheral clock controller in DT
Quoted 33 lines · Krzysztof Kozlowski
Quoted 32 lines · Neil Armstrong
Quoted 30 lines · Krzysztof Kozlowski
Quoted 21 lines · Yu Tu
Added information about the S4 SOC Peripheral Clock controller in DT.
Signed-off-by Yu Tu <[email protected]>--- arch/arm64/boot/dts/amlogic/meson-s4.dtsi | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+)arch/arm64/boot/dts/amlogic/meson-s4.dtsi +2
-0@@ -6,6 +6,8 @@ #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/clock/amlogic,s4-pll-clkc.h> +#include <dt-bindings/clock/amlogic,s4-peripherals-clkc.h> / { cpus {arch/arm64/boot/dts/amlogic/meson-s4.dtsi clkc_pll: clock-controller@8000 { · line 107
Quoted 6 lines
arch/arm64/boot/dts/amlogic/meson-s4.dtsi +3
-0@@ -100,6 +102,30 @@ clkc_pll: clock-controller@8000 { #clock-cells = <1>; }; + clkc_periphs: clock-controller { + compatible = "amlogic,s4-peripherals-clkc"; + reg = <0x0 0x0 0x0 0x49c>;This is broken... did you check for warnings?
Quoted 6 lines
Quoted 2 lines
This is actually fine, the parent node has a ranges property:
https://github.com/torvalds/linux/blob/eb7081409f94a9a8608593d0fb63a1aa3d6f95d8/arch/arm64/boot/dts/amlogic/meson-s4.dtsi#L93The parent ranges do not change here anything. You cannot have a reg without unit address and the tools report it. No need to use reviewers for this...
Oh I see now, I simply looked at the reg property, not the unit address.
Sorry indeed it's wrong and DTC should complain.
Yu, you should probably update your DTC version.
Neil
Quoted 4 lines
Best regards,
Krzysztof
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Re: [PATCH V5 4/4] arm64: dts: meson: add S4 Soc Peripheral clock controller in DT
Quoted 43 lines · On 2022/11/23 22:21, [email protected] wrote:
[ EXTERNAL EMAIL ]
Quoted 32 lines · Krzysztof Kozlowski
Quoted 31 lines · Neil Armstrong
Quoted 29 lines · Krzysztof Kozlowski
Quoted 21 lines · Yu Tu
Added information about the S4 SOC Peripheral Clock controller in DT.
Signed-off-by Yu Tu <[email protected]>---
arch/arm64/boot/dts/amlogic/meson-s4.dtsi| 26
+++++++++++++++++++++++1 file changed, 26 insertions(+)arch/arm64/boot/dts/amlogic/meson-s4.dtsi +2
-0@@ -6,6 +6,8 @@ #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/clock/amlogic,s4-pll-clkc.h> +#include <dt-bindings/clock/amlogic,s4-peripherals-clkc.h> / { cpus {arch/arm64/boot/dts/amlogic/meson-s4.dtsi clkc_pll: clock-controller@8000 { · line 106
Quoted 5 lines
arch/arm64/boot/dts/amlogic/meson-s4.dtsi +3
-0@@ -100,6 +102,30 @@ clkc_pll: clock-controller@8000 { #clock-cells = <1>; }; + clkc_periphs: clock-controller { + compatible = "amlogic,s4-peripherals-clkc"; + reg = <0x0 0x0 0x0 0x49c>;This is broken... did you check for warnings?
Quoted 7 lines
Quoted 3 lines
This is actually fine, the parent node has a ranges property:
https://github.com/torvalds/linux/blob/eb7081409f94a9a8608593d0fb63a1aa3d6f95d8/arch/arm64/boot/dts/amlogic/meson-s4.dtsi#L93The parent ranges do not change here anything. You cannot have a reg without unit address and the tools report it. No need to use reviewers for this...
Quoted 5 lines
Oh I see now, I simply looked at the reg property, not the unit address.
Sorry indeed it's wrong and DTC should complain.
Yu, you should probably update your DTC version.
Okay.
Quoted 9 lines
Neil
Quoted 4 lines
Best regards,
Krzysztof.
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Neil Armstrong
maintainerHi,
Quoted 9 lines · Yu Tu
1. Add PLL and Peripheral clock controller driver for S4 SOC.
Yu Tu (4):
clk: meson: S4: add support for Amlogic S4 SoC PLL clock driver and
bindings
arm64: dts: meson: add S4 Soc PLL clock controller in DT
clk: meson: s4: add s4 SoC peripheral clock controller driver and
bindings
arm64: dts: meson: add S4 Soc Peripheral clock controller in DT
My correct e-mail is [email protected] and not [email protected], please fix it for future versions.
Thanks,
Neil
Quoted 32 lines
V4 -> V5: change format and clock flags and adjust the patch series as suggested by Jerome.
V3 -> V4: change format and clock flags.
V2 -> V3: Use two clock controller.
V1 -> V2: Change format as discussed in the email..../clock/amlogic,s4-peripherals-clkc.yaml | 105 + .../bindings/clock/amlogic,s4-pll-clkc.yaml | 51 + MAINTAINERS | 1 + arch/arm64/boot/dts/amlogic/meson-s4.dtsi | 34 + drivers/clk/meson/Kconfig | 25 + drivers/clk/meson/Makefile | 2 + drivers/clk/meson/s4-peripherals.c | 3783 +++++++++++++++++ drivers/clk/meson/s4-peripherals.h | 218 + drivers/clk/meson/s4-pll.c | 875 ++++ drivers/clk/meson/s4-pll.h | 88 + .../clock/amlogic,s4-peripherals-clkc.h | 131 + .../dt-bindings/clock/amlogic,s4-pll-clkc.h | 30 + 12 files changed, 5343 insertions(+)create mode 100644
Documentation/devicetree/bindings/clock/amlogic,s4-peripherals-clkc.yamlcreate mode 100644Documentation/devicetree/bindings/clock/amlogic,s4-pll-clkc.yamlcreate mode 100644drivers/clk/meson/s4-peripherals.c
create mode 100644drivers/clk/meson/s4-peripherals.h
create mode 100644drivers/clk/meson/s4-pll.c
create mode 100644drivers/clk/meson/s4-pll.h
create mode 100644include/dt-bindings/clock/amlogic,s4-peripherals-clkc.hcreate mode 100644include/dt-bindings/clock/amlogic,s4-pll-clkc.h
Quoted 1 line
base-commit:
5eeec1fd8360d57899d29a607ff81d0094e6cf59
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic