clk: sophgo: add SG2044 clock controller support
Subsystems (5)
Inochi Amaoto
maintainerv5 cover clk: sophgo: add SG2044 clock controller support
The clock controller of SG2044 provides multiple clocks for various IPs on the SoC, including PLL, mux, div and gates. As the PLL and div have obvious changed and do not fit the framework of SG2042, a new implement is provided to handle these.
Changed from v4:
1. patch 1,3: Applied Krzysztof's tag.
2. patch 1: fix header path in description.
3. patch 4: drop duplicated module alias.
4. patch 5: make sg2044_clk_desc_data const.
Changed from v3:
- https://lore.kernel.org/all/[email protected]
1. patch 1,2: Add top syscon binding and aux driver.
2. patch 4: Separate the syscon pll driver to a standalone one.
3. patch 4: use abs_diff to compare pll clock.
4. patch 4: remove unnecessary else.
5. patch 5: use clk_hw for parent clocks if possible.
6. patch 5: inline the header which is necessary.
7. patch 5: make common array as const.
Changed from v2:
- https://lore.kernel.org/all/[email protected]/
1. Applied Chen Wang's tag.
2. patch 2: fix author mail infomation.
Changed from v1:
- https://lore.kernel.org/all/[email protected]/
1. patch 1: Applied Krzysztof's tag.
2. patch 2: Fix the build warning from bot.
Inochi Amaoto (5):
dt-bindings: soc: sophgo: Add SG2044 top syscon device
soc: sophgo: sg2044: Add support for SG2044 TOP syscon device
dt-bindings: clock: sophgo: add clock controller for SG2044
clk: sophgo: Add PLL clock controller support for SG2044 SoC
clk: sophgo: Add clock controller support for SG2044 SoC
.../bindings/clock/sophgo,sg2044-clk.yaml | 99 + .../soc/sophgo/sophgo,sg2044-top-syscon.yaml | 49 + drivers/clk/sophgo/Kconfig | 19 + drivers/clk/sophgo/Makefile | 2 + drivers/clk/sophgo/clk-sg2044-pll.c | 628 ++++++ drivers/clk/sophgo/clk-sg2044.c | 1812 +++++++++++++++++ drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/sophgo/Kconfig | 21 + drivers/soc/sophgo/Makefile | 3 + drivers/soc/sophgo/sg2044-topsys.c | 45 + include/dt-bindings/clock/sophgo,sg2044-clk.h | 153 ++ include/dt-bindings/clock/sophgo,sg2044-pll.h | 27 + 13 files changed, 2860 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/sophgo,sg2044-clk.yaml create mode 100644 Documentation/devicetree/bindings/soc/sophgo/sophgo,sg2044-top-syscon.yaml create mode 100644 drivers/clk/sophgo/clk-sg2044-pll.c create mode 100644 drivers/clk/sophgo/clk-sg2044.c create mode 100644 drivers/soc/sophgo/Kconfig create mode 100644 drivers/soc/sophgo/Makefile create mode 100644 drivers/soc/sophgo/sg2044-topsys.c create mode 100644 include/dt-bindings/clock/sophgo,sg2044-clk.h create mode 100644 include/dt-bindings/clock/sophgo,sg2044-pll.h
--
2.49.0
Inochi Amaoto
maintainerPATCH v5 1/5 dt-bindings: soc: sophgo: Add SG2044 top syscon device
The SG2044 top syscon device provide PLL clock control and some other misc feature of the SoC.
Add the compatible string for SG2044 top syscon device.
--- .../soc/sophgo/sophgo,sg2044-top-syscon.yaml | 49 +++++++++++++++++++ include/dt-bindings/clock/sophgo,sg2044-pll.h | 27 ++++++++++ 2 files changed, 76 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/sophgo/sophgo,sg2044-top-syscon.yaml create mode 100644 include/dt-bindings/clock/sophgo,sg2044-pll.h
Documentation/devicetree/bindings/soc/sophgo/sophgo,sg2044-top-syscon.yaml new file +49 -0
@@ -0,0 +1,49 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/sophgo/sophgo,sg2044-top-syscon.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Sophgo SG2044 SoC TOP system controller + +maintainers: + - Inochi Amaoto <[email protected]> + +description: + The Sophgo SG2044 TOP system controller is a hardware block grouping + multiple small functions, such as clocks and some other internal + function. + +properties: + compatible: + items: + - const: sophgo,sg2044-top-syscon + - const: syscon + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + '#clock-cells': + const: 1 + description: + See <dt-bindings/clock/sophgo,sg2044-pll.h> for valid clock. + +required: + - compatible + - reg + - clocks + - '#clock-cells' + +additionalProperties: false + +examples: + - | + syscon@50000000 { + compatible = "sophgo,sg2044-top-syscon", "syscon"; + reg = <0x50000000 0x1000>; + #clock-cells = <1>; + clocks = <&osc>; + };
include/dt-bindings/clock/sophgo,sg2044-pll.h new file +27 -0
@@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */ +/* +* Copyright (C) 2024 Inochi Amaoto <[email protected]> +*/ + +#ifndef __DT_BINDINGS_SOPHGO_SG2044_PLL_H__ +#define __DT_BINDINGS_SOPHGO_SG2044_PLL_H__ + +#define CLK_FPLL0 0 +#define CLK_FPLL1 1 +#define CLK_FPLL2 2 +#define CLK_DPLL0 3 +#define CLK_DPLL1 4 +#define CLK_DPLL2 5 +#define CLK_DPLL3 6 +#define CLK_DPLL4 7 +#define CLK_DPLL5 8 +#define CLK_DPLL6 9 +#define CLK_DPLL7 10 +#define CLK_MPLL0 11 +#define CLK_MPLL1 12 +#define CLK_MPLL2 13 +#define CLK_MPLL3 14 +#define CLK_MPLL4 15 +#define CLK_MPLL5 16 + +#endif /* __DT_BINDINGS_SOPHGO_SG2044_PLL_H__ */
Signature · 1 line
2.49.0
Inochi Amaoto
maintainerPATCH v5 2/5 soc: sophgo: sg2044: Add support for SG2044 TOP syscon device
In reply to Inochi AmaotoThe SG2044 TOP device provide PLL clock function in its area. Add a mfd definition for it.
--- drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/sophgo/Kconfig | 21 ++++++++++++++ drivers/soc/sophgo/Makefile | 3 ++ drivers/soc/sophgo/sg2044-topsys.c | 45 ++++++++++++++++++++++++++++++ 5 files changed, 71 insertions(+) create mode 100644 drivers/soc/sophgo/Kconfig create mode 100644 drivers/soc/sophgo/Makefile create mode 100644 drivers/soc/sophgo/sg2044-topsys.c
drivers/soc/Kconfig +1 -0
@@ -23,6 +23,7 @@ source "drivers/soc/qcom/Kconfig" source "drivers/soc/renesas/Kconfig" source "drivers/soc/rockchip/Kconfig" source "drivers/soc/samsung/Kconfig" +source "drivers/soc/sophgo/Kconfig" source "drivers/soc/sunxi/Kconfig" source "drivers/soc/tegra/Kconfig" source "drivers/soc/ti/Kconfig"
drivers/soc/Makefile +1 -0
@@ -29,6 +29,7 @@ obj-y += qcom/ obj-y += renesas/ obj-y += rockchip/ obj-$(CONFIG_SOC_SAMSUNG) += samsung/ +obj-y += sophgo/ obj-y += sunxi/ obj-$(CONFIG_ARCH_TEGRA) += tegra/ obj-y += ti/
drivers/soc/sophgo/Kconfig new file +21 -0
@@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Sophgo SoC drivers +# + +if ARCH_SOPHGO || COMPILE_TEST +menu "Sophgo SoC drivers" + +config SOPHGO_SG2044_TOPSYS + tristate "Sophgo SG2044 TOP syscon driver" + select MFD_CORE + help + This is the core driver for the Sophgo SG2044 TOP system + controller device. This driver provide PLL clock device + for the SoC. + + This driver can also be built as a module. If so, the module + will be called sg2044-topsys. + +endmenu +endif
drivers/soc/sophgo/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_SOPHGO_SG2044_TOPSYS) += sg2044-topsys.o
drivers/soc/sophgo/sg2044-topsys.c new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
2.49.0
Inochi Amaoto
maintainerPATCH v5 3/5 dt-bindings: clock: sophgo: add clock controller for SG2044
In reply to Inochi AmaotoThe clock controller on the SG2044 provides common clock function for all IPs on the SoC. This device requires PLL clock to function normally.
Add definition for the clock controller of the SG2044 SoC.
--- .../bindings/clock/sophgo,sg2044-clk.yaml | 99 ++++++++++++ include/dt-bindings/clock/sophgo,sg2044-clk.h | 153 ++++++++++++++++++ 2 files changed, 252 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/sophgo,sg2044-clk.yaml create mode 100644 include/dt-bindings/clock/sophgo,sg2044-clk.h
Documentation/devicetree/bindings/clock/sophgo,sg2044-clk.yaml new file +99 -0
@@ -0,0 +1,99 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/sophgo,sg2044-clk.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Sophgo SG2044 Clock Controller + +maintainers: + - Inochi Amaoto <[email protected]> + +description: | + The Sophgo SG2044 clock controller requires an external oscillator + as input clock. + + All available clocks are defined as preprocessor macros in + include/dt-bindings/clock/sophgo,sg2044-clk.h + +properties: + compatible: + const: sophgo,sg2044-clk + + reg: + maxItems: 1 + + clocks: + items: + - description: fpll0 + - description: fpll1 + - description: fpll2 + - description: dpll0 + - description: dpll1 + - description: dpll2 + - description: dpll3 + - description: dpll4 + - description: dpll5 + - description: dpll6 + - description: dpll7 + - description: mpll0 + - description: mpll1 + - description: mpll2 + - description: mpll3 + - description: mpll4 + - description: mpll5 + + clock-names: + items: + - const: fpll0 + - const: fpll1 + - const: fpll2 + - const: dpll0 + - const: dpll1 + - const: dpll2 + - const: dpll3 + - const: dpll4 + - const: dpll5 + - const: dpll6 + - const: dpll7 + - const: mpll0 + - const: mpll1 + - const: mpll2 + - const: mpll3 + - const: mpll4 + - const: mpll5 + + '#clock-cells': + const: 1 + +required: + - compatible + - reg + - clocks + - '#clock-cells' + +additionalProperties: false + +examples: + - | + #include <dt-bindings/clock/sophgo,sg2044-pll.h> + + clock-controller@50002000 { + compatible = "sophgo,sg2044-clk"; + reg = <0x50002000 0x1000>; + #clock-cells = <1>; + clocks = <&syscon CLK_FPLL0>, <&syscon CLK_FPLL1>, + <&syscon CLK_FPLL2>, <&syscon CLK_DPLL0>, + <&syscon CLK_DPLL1>, <&syscon CLK_DPLL2>, + <&syscon CLK_DPLL3>, <&syscon CLK_DPLL4>, + <&syscon CLK_DPLL5>, <&syscon CLK_DPLL6>, + <&syscon CLK_DPLL7>, <&syscon CLK_MPLL0>, + <&syscon CLK_MPLL1>, <&syscon CLK_MPLL2>, + <&syscon CLK_MPLL3>, <&syscon CLK_MPLL4>, + <&syscon CLK_MPLL5>; + clock-names = "fpll0", "fpll1", "fpll2", "dpll0", + "dpll1", "dpll2", "dpll3", "dpll4", + "dpll5", "dpll6", "dpll7", "mpll0", + "mpll1", "mpll2", "mpll3", "mpll4", + "mpll5"; + };
include/dt-bindings/clock/sophgo,sg2044-clk.h new file +153 -0
153 lines not on this page · raw message
Signature · 1 line
2.49.0
Inochi Amaoto
maintainerPATCH v5 4/5 clk: sophgo: Add PLL clock controller support for SG2044 SoC
In reply to Inochi AmaotoAdd PLL clock driver and clock definition for SG2044 SoC.
--- drivers/clk/sophgo/Kconfig | 10 + drivers/clk/sophgo/Makefile | 1 + drivers/clk/sophgo/clk-sg2044-pll.c | 628 ++++++++++++++++++++++++++++ 3 files changed, 639 insertions(+) create mode 100644 drivers/clk/sophgo/clk-sg2044-pll.c
drivers/clk/sophgo/Kconfig +10 -0
@@ -37,3 +37,13 @@ config CLK_SOPHGO_SG2042_RPGATE This clock IP depends on SG2042 Clock Generator because it uses clock from Clock Generator IP as input. This driver provides Gate function for RP. + +config CLK_SOPHGO_SG2044_PLL + tristate "Sophgo SG2044 PLL clock controller support" + depends on ARCH_SOPHGO || COMPILE_TEST + select MFD_SYSCON + select REGMAP_MMIO + help + This driver supports the PLL clock controller on the Sophgo + SG2044 SoC. This controller requires 25M oscillator as input. + This clock control provides PLL clocks on the SoC.
drivers/clk/sophgo/Makefile +1 -0
@@ -9,3 +9,4 @@ clk-sophgo-cv1800-y += clk-cv18xx-pll.o obj-$(CONFIG_CLK_SOPHGO_SG2042_CLKGEN) += clk-sg2042-clkgen.o obj-$(CONFIG_CLK_SOPHGO_SG2042_PLL) += clk-sg2042-pll.o obj-$(CONFIG_CLK_SOPHGO_SG2042_RPGATE) += clk-sg2042-rpgate.o +obj-$(CONFIG_CLK_SOPHGO_SG2044_PLL) += clk-sg2044-pll.o
drivers/clk/sophgo/clk-sg2044-pll.c new file +628 -0
628 lines not on this page · raw message
Signature · 1 line
2.49.0
Inochi Amaoto
maintainerPATCH v5 5/5 clk: sophgo: Add clock controller support for SG2044 SoC
In reply to Inochi AmaotoAdd clock driver and clock definition for SG2044 SoC.
--- drivers/clk/sophgo/Kconfig | 9 + drivers/clk/sophgo/Makefile | 1 + drivers/clk/sophgo/clk-sg2044.c | 1812 +++++++++++++++++++++++++++++++ 3 files changed, 1822 insertions(+) create mode 100644 drivers/clk/sophgo/clk-sg2044.c
drivers/clk/sophgo/Kconfig +9 -0
@@ -38,6 +38,15 @@ config CLK_SOPHGO_SG2042_RPGATE clock from Clock Generator IP as input. This driver provides Gate function for RP. +config CLK_SOPHGO_SG2044 + tristate "Sophgo SG2044 clock controller support" + depends on ARCH_SOPHGO || COMPILE_TEST + help + This driver supports the clock controller on the Sophgo SG2044 + SoC. This controller requires mulitple PLL clock as input. + This clock control provides PLL clocks and common clock function + for various IPs on the SoC. + config CLK_SOPHGO_SG2044_PLL tristate "Sophgo SG2044 PLL clock controller support" depends on ARCH_SOPHGO || COMPILE_TEST
drivers/clk/sophgo/Makefile +1 -0
@@ -9,4 +9,5 @@ clk-sophgo-cv1800-y += clk-cv18xx-pll.o obj-$(CONFIG_CLK_SOPHGO_SG2042_CLKGEN) += clk-sg2042-clkgen.o obj-$(CONFIG_CLK_SOPHGO_SG2042_PLL) += clk-sg2042-pll.o obj-$(CONFIG_CLK_SOPHGO_SG2042_RPGATE) += clk-sg2042-rpgate.o +obj-$(CONFIG_CLK_SOPHGO_SG2044) += clk-sg2044.o obj-$(CONFIG_CLK_SOPHGO_SG2044_PLL) += clk-sg2044-pll.o
drivers/clk/sophgo/clk-sg2044.c new file +1812 -0
1,812 lines not on this page · raw message
Signature · 1 line
2.49.0
Inochi Amaoto
maintainerQuoted 62 lines · Inochi Amaoto
The clock controller of SG2044 provides multiple clocks for various IPs on the SoC, including PLL, mux, div and gates. As the PLL and div have obvious changed and do not fit the framework of SG2042, a new implement is provided to handle these.
Changed from v4:
1. patch 1,3: Applied Krzysztof's tag.
2. patch 1: fix header path in description.
3. patch 4: drop duplicated module alias.
4. patch 5: makesg2044_clk_desc_dataconst.Changed from v3:
- https://lore.kernel.org/all/[email protected]
1. patch 1,2: Add top syscon binding and aux driver.
2. patch 4: Separate the syscon pll driver to a standalone one.
3. patch 4: useabs_diffto compare pll clock.
4. patch 4: remove unnecessary else.
5. patch 5: useclk_hwfor parent clocks if possible.
6. patch 5: inline the header which is necessary.
7. patch 5: make common array as const.Changed from v2:
- https://lore.kernel.org/all/[email protected]/
1. Applied Chen Wang's tag.
2. patch 2: fix author mail infomation.Changed from v1:
- https://lore.kernel.org/all/[email protected]/
1. patch 1: Applied Krzysztof's tag.
2. patch 2: Fix the build warning from bot.Inochi Amaoto (5):
dt-bindings: soc: sophgo: Add SG2044 top syscon device
soc: sophgo: sg2044: Add support for SG2044 TOP syscon device
dt-bindings: clock: sophgo: add clock controller for SG2044
clk: sophgo: Add PLL clock controller support for SG2044 SoC
clk: sophgo: Add clock controller support for SG2044 SoC.../bindings/clock/sophgo,sg2044-clk.yaml | 99 + .../soc/sophgo/sophgo,sg2044-top-syscon.yaml | 49 + drivers/clk/sophgo/Kconfig | 19 + drivers/clk/sophgo/Makefile | 2 + drivers/clk/sophgo/clk-sg2044-pll.c | 628 ++++++ drivers/clk/sophgo/clk-sg2044.c | 1812 +++++++++++++++++ drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/sophgo/Kconfig | 21 + drivers/soc/sophgo/Makefile | 3 + drivers/soc/sophgo/sg2044-topsys.c | 45 + include/dt-bindings/clock/sophgo,sg2044-clk.h | 153 ++ include/dt-bindings/clock/sophgo,sg2044-pll.h | 27 + 13 files changed, 2860 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/sophgo,sg2044-clk.yaml create mode 100644 Documentation/devicetree/bindings/soc/sophgo/sophgo,sg2044-top-syscon.yaml create mode 100644 drivers/clk/sophgo/clk-sg2044-pll.c create mode 100644 drivers/clk/sophgo/clk-sg2044.c create mode 100644 drivers/soc/sophgo/Kconfig create mode 100644 drivers/soc/sophgo/Makefile create mode 100644 drivers/soc/sophgo/sg2044-topsys.c create mode 100644 include/dt-bindings/clock/sophgo,sg2044-clk.h create mode 100644 include/dt-bindings/clock/sophgo,sg2044-pll.h
Quoted 3 lines
--
2.49.0
Hi, Stephen,
Would you like to share some comments on this series? I think this driver now it is ready to go.
Regards,
Inochi
Re: (subset) [PATCH v5 0/5] clk: sophgo: add SG2044 clock controller support
In reply to Inochi AmaotoQuoted 5 lines · Inochi Amaoto
The clock controller of SG2044 provides multiple clocks for various IPs on the SoC, including PLL, mux, div and gates. As the PLL and div have obvious changed and do not fit the framework of SG2042, a new implement is provided to handle these.
Quoted 7 lines
Changed from v4:
1. patch 1,3: Applied Krzysztof's tag.
2. patch 1: fix header path in description.
3. patch 4: drop duplicated module alias.
4. patch 5: makesg2044_clk_desc_dataconst.[...]
Applied to sophgo-clk-for-6.16-rc1, thanks!
[1/5] dt-bindings: soc: sophgo: Add SG2044 top syscon device
https://github.com/sophgo/linux/commit/e4b700d38957526fbcec6d7bb5890ad4c1192241 [3/5] dt-bindings: clock: sophgo: add clock controller for SG2044 https://github.com/sophgo/linux/commit/1a215904986e48ce04ac8f24ecb5b18cb6beaf43 [4/5] clk: sophgo: Add PLL clock controller support for SG2044 SoC https://github.com/sophgo/linux/commit/ff5240793b0484187a836f6e1b7f0e376e0776ed
Thanks,
Inochi
Re: (subset) [PATCH v5 0/5] clk: sophgo: add SG2044 clock controller support
In reply to Inochi AmaotoQuoted 5 lines · Inochi Amaoto
The clock controller of SG2044 provides multiple clocks for various IPs on the SoC, including PLL, mux, div and gates. As the PLL and div have obvious changed and do not fit the framework of SG2042, a new implement is provided to handle these.
Quoted 7 lines
Changed from v4:
1. patch 1,3: Applied Krzysztof's tag.
2. patch 1: fix header path in description.
3. patch 4: drop duplicated module alias.
4. patch 5: makesg2044_clk_desc_dataconst.[...]
Applied to soc-for-next, thanks!
[2/5] soc: sophgo: sg2044: Add support for SG2044 TOP syscon device
https://github.com/sophgo/linux/commit/f18198c0de56ea636c74312bd09b9d67273412d8
Thanks,
Inochi
Re: (subset) [PATCH v5 0/5] clk: sophgo: add SG2044 clock controller support
In reply to Inochi AmaotoQuoted 5 lines · Inochi Amaoto
The clock controller of SG2044 provides multiple clocks for various IPs on the SoC, including PLL, mux, div and gates. As the PLL and div have obvious changed and do not fit the framework of SG2042, a new implement is provided to handle these.
Quoted 7 lines
Changed from v4:
1. patch 1,3: Applied Krzysztof's tag.
2. patch 1: fix header path in description.
3. patch 4: drop duplicated module alias.
4. patch 5: makesg2044_clk_desc_dataconst.[...]
Applied to sophgo-clk-for-6.16-rc1, thanks!
[5/5] clk: sophgo: Add clock controller support for SG2044 SoC
https://github.com/sophgo/linux/commit/41b08610dd262dc4a5e1eff993b2d21eab8b8ba3
Thanks,
Inochi