Add driver support for ESWIN eic700 SoC clock controller
Subsystems (3)
[email protected]
maintainercover Add driver support for ESWIN eic700 SoC clock controller
From: Xuyang Dong <[email protected]>
Add support for the clock functionality in the Linux kernel. The driver provides basic functionality to manage and control the clock signals for the eic7700 series chips, which are part of the ESWIN SoC family.
The driver is integrated with the Linux clock subsystem, allowing kernel code to use clock signals on hardware and ensuring proper handling of clock events.
Features:
Implement support for the ESWIN eic7700 SoC clock controller. Provide API to manage clock signals for the eic7700 series SoC. Integrate with the Linux clock subsystem for consistency and scalability.
Supported chips:
ESWIN eic7700 series SoC.
Test:
The tests tested on the Sifive HiFive Premier P550 (which uses the EIC7700 SoC), including system boot, networking, EMMC, display, and other peripherals. The drivers for these modules all use the clock module,
so the verifies that this clock driver patch is working properly.
Xuyang Dong (2):
dt-bindings: clock: eswin: Documentation for eic7700 SoC
clock: eswin: Add eic7700 clock driver
.../bindings/clock/eswin,eic7700-clock.yaml | 53 + drivers/clk/Kconfig | 1 + drivers/clk/Makefile | 1 + drivers/clk/eswin/Kconfig | 10 + drivers/clk/eswin/Makefile | 8 + drivers/clk/eswin/clk-eic7700.c | 3811 +++++++++++++++++ drivers/clk/eswin/clk-eic7700.h | 194 + drivers/clk/eswin/clk.c | 1069 +++++ drivers/clk/eswin/clk.h | 209 + .../dt-bindings/clock/eswin,eic7700-clock.h | 588 +++ 10 files changed, 5944 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/eswin,eic7700-clock.yaml create mode 100644 drivers/clk/eswin/Kconfig create mode 100644 drivers/clk/eswin/Makefile create mode 100644 drivers/clk/eswin/clk-eic7700.c create mode 100644 drivers/clk/eswin/clk-eic7700.h create mode 100644 drivers/clk/eswin/clk.c create mode 100644 drivers/clk/eswin/clk.h create mode 100644 include/dt-bindings/clock/eswin,eic7700-clock.h
--
2.17.1
[email protected]
maintainerPATCH 1/2 dt-bindings: clock: eswin: Documentation for eic7700 SoC
From: Xuyang Dong <[email protected]>
Add device tree binding documentation and header file for the ESWIN EIC7700 clock controller module.
--- .../bindings/clock/eswin,eic7700-clock.yaml | 43 ++ .../dt-bindings/clock/eswin,eic7700-clock.h | 588 ++++++++++++++++++ 2 files changed, 641 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/eswin,eic7700-clock.yaml create mode 100644 include/dt-bindings/clock/eswin,eic7700-clock.h
Documentation/devicetree/bindings/clock/eswin,eic7700-clock.yaml new file +43 -0
@@ -0,0 +1,43 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/eswin,eic7700-clock.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Eswin EIC7700 SoC clock controller + +maintainers: + - Yifeng Huang <[email protected]> + - Xuyang Dong <[email protected]> + +description: | + The clock controller registers are part of the syscrg block on + eic7700 SoC. + +properties: + compatible: + oneOf: + - items: + - const: eswin,eic7700-clock + + '#clock-cells': + const: 1 + +required: + - compatible + - '#clock-cells' + +additionalProperties: false + +examples: + - | + #include <dt-bindings/clock/eswin,eic7700-clock.h> + + sys_crg: sys-crg@51828000 { + compatible = "syscon", "simple-mfd"; + reg = <0x000000 0x51828000 0x000000 0x80000>; + clock: clock-controller { + compatible = "eswin,eic7700-clock"; + #clock-cells = <1>; + }; + };
include/dt-bindings/clock/eswin,eic7700-clock.h new file +588 -0
588 lines not on this page · raw message
--
2.17.1
Rob Herring (Arm)
maintainerRe: [PATCH 1/2] dt-bindings: clock: eswin: Documentation for eic7700 SoC
Quoted 5 lines · On Wed, 14 May 2025 08:25:16 +0800, [email protected] wrote:
From: Xuyang Dong <[email protected]>
Add device tree binding documentation and header file for the ESWIN EIC7700 clock controller module.
Quoted 9 lines
Signed-off-by Yifeng Huang <[email protected]>Signed-off-by Xuyang Dong <[email protected]>--- .../bindings/clock/eswin,eic7700-clock.yaml | 43 ++ .../dt-bindings/clock/eswin,eic7700-clock.h | 588 ++++++++++++++++++ 2 files changed, 641 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/eswin,eic7700-clock.yaml create mode 100644 include/dt-bindings/clock/eswin,eic7700-clock.h
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/eswin,eic7700-clock.example.dtb: sys-crg@51828000 (syscon): compatible: ['syscon', 'simple-mfd'] is too short
from schema $id: http://devicetree.org/schemas/mfd/syscon-common.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/eswin,eic7700-clock.example.dtb: sys-crg@51828000 (syscon): reg: [[0, 1367506944], [0, 524288]] is too long
from schema $id: http://devicetree.org/schemas/mfd/syscon-common.yaml#
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
董绪洋
maintainerRe: Re: [PATCH 1/2] dt-bindings: clock: eswin: Documentation for eic7700 SoC
Hi, I use "pip3 install dtschema --upgrade" to upgrade the dtschema. The dtschema is 2025.02 and yamllint is 1.37.1. Use "make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/clock/eswin,eic7700-clock.yaml" to check, but there is not found warnings/errors. The environment is Ubuntu 18.04, and the Linux kernel version is v6.15-rc6. Therefore, I would like to obtain the versions of dtschema and yamllint that detect warnings/errors.
Thank you for telling me the message.
Quoted 50 lines
-----原始邮件-----
发件人: "Rob Herring (Arm)" <[email protected]>
发送时间:2025-05-14 09:20:14 (星期三)
收件人: [email protected]
抄送: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected] 主题: Re: [PATCH 1/2] dt-bindings: clock: eswin: Documentation for eic7700 SoCQuoted 5 lines · On Wed, 14 May 2025 08:25:16 +0800, [email protected] wrote:
From: Xuyang Dong <[email protected]>
Add device tree binding documentation and header file for the ESWIN EIC7700 clock controller module.
Quoted 9 lines
Signed-off-by Yifeng Huang <[email protected]>Signed-off-by Xuyang Dong <[email protected]>--- .../bindings/clock/eswin,eic7700-clock.yaml | 43 ++ .../dt-bindings/clock/eswin,eic7700-clock.h | 588 ++++++++++++++++++ 2 files changed, 641 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/eswin,eic7700-clock.yaml create mode 100644 include/dt-bindings/clock/eswin,eic7700-clock.hMy bot found errors running 'make
dt_binding_check' on your patch:yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/eswin,eic7700-clock.example.dtb: sys-crg@51828000 (syscon): compatible: ['syscon', 'simple-mfd'] is too short
from schema $id: http://devicetree.org/schemas/mfd/syscon-common.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/eswin,eic7700-clock.example.dtb: sys-crg@51828000 (syscon): reg: [[0, 1367506944], [0, 524288]] is too long
from schema $id: http://devicetree.org/schemas/mfd/syscon-common.yaml#doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make
dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that
DT_SCHEMA_FILEScan be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
Rob Herring
maintainerRe: [PATCH 1/2] dt-bindings: clock: eswin: Documentation for eic7700 SoC
In reply to [email protected]Quoted 23 lines · On Wed, May 14, 2025 at 08:25:16AM +0800, [email protected] wrote:
From: Xuyang Dong <[email protected]>
Add device tree binding documentation and header file for the ESWIN EIC7700 clock controller module.
Signed-off-by Yifeng Huang <[email protected]>Signed-off-by Xuyang Dong <[email protected]>--- .../bindings/clock/eswin,eic7700-clock.yaml | 43 ++ .../dt-bindings/clock/eswin,eic7700-clock.h | 588 ++++++++++++++++++ 2 files changed, 641 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/eswin,eic7700-clock.yaml create mode 100644 include/dt-bindings/clock/eswin,eic7700-clock.hDocumentation/devicetree/bindings/clock/eswin,eic7700-clock.yaml new file +3
-0@@ -0,0 +1,43 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +---
Documentation/devicetree/bindings/clock/eswin,eic7700-clock.yaml line 13
Quoted 10 lines
Documentation/devicetree/bindings/clock/eswin,eic7700-clock.yaml new file +10
-0+$id: http://devicetree.org/schemas/clock/eswin,eic7700-clock.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Eswin EIC7700 SoC clock controller + +maintainers: + - Yifeng Huang <[email protected]> + - Xuyang Dong <[email protected]> + +description: |
Don't need '|'.
Documentation/devicetree/bindings/clock/eswin,eic7700-clock.yaml line 15
Quoted 2 lines
Documentation/devicetree/bindings/clock/eswin,eic7700-clock.yaml new file +2
-0+ The clock controller registers are part of the syscrg block on + eic7700 SoC.
Wrap at 80
Documentation/devicetree/bindings/clock/eswin,eic7700-clock.yaml line 21
Quoted 6 lines
Documentation/devicetree/bindings/clock/eswin,eic7700-clock.yaml new file +6
-0+ +properties: + compatible: + oneOf: + - items: + - const: eswin,eic7700-clock
Drop 'oneOf' and 'items'.
Quoted 6 lines
Documentation/devicetree/bindings/clock/eswin,eic7700-clock.yaml new file +6
-0+ + '#clock-cells': + const: 1 + +required: + - compatible
Documentation/devicetree/bindings/clock/eswin,eic7700-clock.yaml line 37
Quoted 10 lines
Documentation/devicetree/bindings/clock/eswin,eic7700-clock.yaml new file +10
-0+ - '#clock-cells' + +additionalProperties: false + +examples: + - | + #include <dt-bindings/clock/eswin,eic7700-clock.h> + + sys_crg: sys-crg@51828000 { + compatible = "syscon", "simple-mfd";
Must have a specific compatible for the block.
Documentation/devicetree/bindings/clock/eswin,eic7700-clock.yaml line 41
Quoted 4 lines
Documentation/devicetree/bindings/clock/eswin,eic7700-clock.yaml new file +4
-0+ reg = <0x000000 0x51828000 0x000000 0x80000>; + clock: clock-controller { + compatible = "eswin,eic7700-clock"; + #clock-cells = <1>;
There's no need for a child node here. Just add '#clock-cells' to the parent node.
Quoted 2 lines
Documentation/devicetree/bindings/clock/eswin,eic7700-clock.yaml new file +2
-0+ }; + };
[email protected]
maintainerPATCH 2/2 clock: eswin: Add eic7700 clock driver
In reply to [email protected]From: Xuyang Dong <[email protected]>
This driver depends on the CCF framework implementation.
Based on this driver, other modules in the SoC can use the APIs provided by CCF to perform clock-related operations. The driver supports eic7700 series chips.
--- drivers/clk/Kconfig | 1 + drivers/clk/Makefile | 1 + drivers/clk/eswin/Kconfig | 10 + drivers/clk/eswin/Makefile | 8 + drivers/clk/eswin/clk-eic7700.c | 3811 +++++++++++++++++++++++++++++++ drivers/clk/eswin/clk-eic7700.h | 194 ++ drivers/clk/eswin/clk.c | 1069 +++++++++ drivers/clk/eswin/clk.h | 209 ++ 8 files changed, 5303 insertions(+) create mode 100644 drivers/clk/eswin/Kconfig create mode 100644 drivers/clk/eswin/Makefile create mode 100644 drivers/clk/eswin/clk-eic7700.c create mode 100644 drivers/clk/eswin/clk-eic7700.h create mode 100644 drivers/clk/eswin/clk.c create mode 100644 drivers/clk/eswin/clk.h
drivers/clk/Kconfig +1 -0
@@ -497,6 +497,7 @@ source "drivers/clk/actions/Kconfig" source "drivers/clk/analogbits/Kconfig" source "drivers/clk/baikal-t1/Kconfig" source "drivers/clk/bcm/Kconfig" +source "drivers/clk/eswin/Kconfig" source "drivers/clk/hisilicon/Kconfig" source "drivers/clk/imgtec/Kconfig" source "drivers/clk/imx/Kconfig"
drivers/clk/Makefile +1 -0
@@ -118,6 +118,7 @@ obj-$(CONFIG_CLK_BAIKAL_T1) += baikal-t1/ obj-y += bcm/ obj-$(CONFIG_ARCH_BERLIN) += berlin/ obj-$(CONFIG_ARCH_DAVINCI) += davinci/ +obj-$(CONFIG_ARCH_ESWIN) += eswin/ obj-$(CONFIG_ARCH_HISI) += hisilicon/ obj-y += imgtec/ obj-y += imx/
drivers/clk/eswin/Kconfig new file +10 -0
@@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0 + +config COMMON_CLK_EIC7700 + bool "EIC7700 Clock Driver" + depends on ARCH_ESWIN + help + Build the Eswin EIC7700 SOC clock driver based on the + common clock framework. This driver provides support + for the clock control on the Eswin EIC7700 SoC, + which is essential for managing clock rates and power management.
drivers/clk/eswin/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Eswin Clock specific Makefile +# + +obj-y += clk.o + +obj-$(CONFIG_COMMON_CLK_EIC7700) += clk-eic7700.o
drivers/clk/eswin/clk-eic7700.c new file +3811 -0
2,968 lines not on this page · raw message
drivers/clk/eswin/clk-eic7700.h new file +194 -0
194 lines not on this page · raw message
drivers/clk/eswin/clk.c new file +1069 -0
1,069 lines not on this page · raw message
drivers/clk/eswin/clk.h new file +209 -0
209 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.17.1
Part of the diff is not shown here. View the raw message.
Re: [PATCH 2/2] clock: eswin: Add eic7700 clock driver
drivers/clk/eswin/clk-eic7700.c line 3718
Quoted 11 lines · On 14/05/2025 02:26, [email protected] wrote:
Quoted 1 line
+static int
eswin_cpu_clk_init(struct platform_device *pdev)drivers/clk/eswin/clk-eic7700.c new file +10
-0+{ +struct clk *cpu_clk; +struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node; +u32 default_freq; +int ret =0 ; +int numa_id; +char name[128 ] = {0 }; + + ret =of_property_read_u32 (np,"cpu-default-frequency" , &default_freq);
NAK, undocumented ABI.
You already got such comments. All your patches repeat the same mistakes.
Quoted 11 lines
drivers/clk/eswin/clk-eic7700.c new file +11
-0+if (ret) { +dev_info (dev,"cpu-default-frequency not set\n" ); +return ret; + } + numa_id =dev_to_node (dev->parent); +if (numa_id <0 ) +sprintf (name,"%s" ,"clk_cpu_ext_src_core_clk_0" ); +else +sprintf (name,"d%d_%s" , numa_id,"clk_cpu_ext_src_core_clk_0" ); + + cpu_clk =__clk_lookup (name);
drivers/clk/eswin/clk-eic7700.c line 3739
Quoted 10 lines
drivers/clk/eswin/clk-eic7700.c new file +10
-0+if (!cpu_clk) { +dev_err (dev,"Failed to lookup CPU clock\n" ); +return -EINVAL ; + } + ret =clk_set_rate (cpu_clk, default_freq); +if (ret) { +dev_err (dev,"Failed to set CPU frequency: %d\n" , ret); +return ret; + } +dev_info (dev,"CPU frequency set to %u Hz\n" , default_freq);
Drop, this is supposed to be silent.
Quoted 51 lines
drivers/clk/eswin/clk-eic7700.c new file +51
-0+return 0 ; +} + +static int eswin_clk_probe (struct platform_device *pdev) +{ +struct eswin_clock_data *clk_data; + + clk_data =eswin_clk_init (pdev,EIC7700_NR_CLKS ); +if (!clk_data) +return -EAGAIN ; + +special_div_table_init (u_3_bit_special_div_table, +ARRAY_SIZE (u_3_bit_special_div_table)); +special_div_table_init (u_4_bit_special_div_table, +ARRAY_SIZE (u_4_bit_special_div_table)); +special_div_table_init (u_6_bit_special_div_table, +ARRAY_SIZE (u_6_bit_special_div_table)); +special_div_table_init (u_7_bit_special_div_table, +ARRAY_SIZE (u_7_bit_special_div_table)); +special_div_table_init (u_8_bit_special_div_table, +ARRAY_SIZE (u_8_bit_special_div_table)); +special_div_table_init (u_11_bit_special_div_table, +ARRAY_SIZE (u_11_bit_special_div_table)); +special_div_table_init (u_16_bit_special_div_table, +ARRAY_SIZE (u_16_bit_special_div_table)); + +eswin_clk_register_fixed_rate (eic7700_fixed_rate_clks, +ARRAY_SIZE (eic7700_fixed_rate_clks), + clk_data); +eswin_clk_register_pll (eic7700_pll_clks,ARRAY_SIZE (eic7700_pll_clks), + clk_data, &pdev->dev); + +eswin_clk_register_fixed_factor (eic7700_fixed_factor_clks, +ARRAY_SIZE (eic7700_fixed_factor_clks), + clk_data); +eswin_clk_register_mux (eic7700_mux_clks,ARRAY_SIZE (eic7700_mux_clks), + clk_data); +eswin_clk_register_clk (eic7700_clks_early_0, +ARRAY_SIZE (eic7700_clks_early_0), clk_data); +eswin_clk_register_divider (eic7700_div_clks, +ARRAY_SIZE (eic7700_div_clks), clk_data); +eswin_clk_register_clk (eic7700_clks_early_1, +ARRAY_SIZE (eic7700_clks_early_1), clk_data); +eswin_clk_register_gate (eic7700_gate_clks, +ARRAY_SIZE (eic7700_gate_clks), clk_data); +eswin_clk_register_clk (eic7700_clks,ARRAY_SIZE (eic7700_clks), + clk_data); + +eswin_cpu_clk_init (pdev); + +return 0 ;
...
Quoted 16 lines
drivers/clk/eswin/clk.c new file +16
-0+int eswin_clk_register_clk (const struct eswin_clock *clks,int nums, +struct eswin_clock_data *data) +{ +struct clk *clk; +int i; + +for (i =0 ; i < nums; i++) { +char *name =kzalloc (strlen (clks[i].name) +2 *sizeof (char ) + +sizeof (int ), +GFP_KERNEL ); +char *parent_name = +kzalloc (strlen (clks[i].parent_name) +2 *sizeof (char ) + +sizeof (int ), +GFP_KERNEL ); +if (data->numa_id <0 ) { +sprintf (name,"%s" , clks[i].name);
drivers/clk/eswin/clk.c line 1048
Quoted 10 lines
drivers/clk/eswin/clk.c new file +10
-0+sprintf (parent_name,"%s" , clks[i].parent_name); + }else { +sprintf (name,"d%d_%s" , data->numa_id, clks[i].name); +sprintf (parent_name,"d%d_%s" , data->numa_id, + clks[i].parent_name); + } + clk =eswin_register_clk (data,NULL , name, parent_name, + clks[i].flags, &data->lock); +if (IS_ERR (clk)) { + pr_err("%s: failed to register clock %s\n", __func__,
Same comments apply as for all other patches.
Quoted 11 lines
drivers/clk/eswin/clk.c new file +11
-0+ clks[i].name); +kfree (name); +kfree (parent_name); + goto err; + } + +if (clks[i].alias) +clk_register_clkdev (clk, clks[i].alias,NULL ); + + data->clk_data.clks[clks[i].id] = clk; +kfree (name);
drivers/clk/eswin/clk.c line 1069
Quoted 10 lines
drivers/clk/eswin/clk.c new file +10
-0+kfree (parent_name); + } +return 0 ; +err: +while (i--) +clk_unregister_gate (data->clk_data.clks[clks[i].id]); + +return PTR_ERR (clk); +} +EXPORT_SYMBOL_GPL (eswin_clk_register_clk);
That's not a module.
drivers/clk/eswin/clk.h line 1
Quoted 7 lines
drivers/clk/eswin/clk.h new file +1
-0@@ -0,0 +1,209 @@ +/* SPDX-License-Identifier: GPL-2.0 */
Best regards,
Krzysztof
Re: [PATCH 2/2] clock: eswin: Add eic7700 clock driver
Quoted 14 lines · Krzysztof Kozlowski
drivers/clk/eswin/clk-eic7700.c line 3718
Quoted 11 lines · On 14/05/2025 02:26, [email protected] wrote:
Quoted 1 line
+static int
eswin_cpu_clk_init(struct platform_device *pdev)drivers/clk/eswin/clk-eic7700.c new file +10
-0+{ +struct clk *cpu_clk; +struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node; +u32 default_freq; +int ret =0 ; +int numa_id; +char name[128 ] = {0 }; + + ret =of_property_read_u32 (np,"cpu-default-frequency" , &default_freq);NAK, undocumented ABI.
I NAKed your patch and this you translated as reviewed? This is inappropriate. You just bypass comments and force push your code onto us.
Best regards,
Krzysztof