dt-bindings: documentation: add clock bindings information for eASIC N5X
Dinh Nguyen
maintainerPATCH 1/2 dt-bindings: documentation: add clock bindings information for eASIC N5X
Document the Agilex clock bindings, and add the clock header file. The clock header is an enumeration of all the different clocks on the eASIC N5X platform.
--- .../bindings/clock/intel,easic-n5x.yaml | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/intel,easic-n5x.yaml
Documentation/devicetree/bindings/clock/intel,easic-n5x.yaml new file +46 -0
@@ -0,0 +1,46 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/intel,easic-n5x.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Intel SoCFPGA eASIC N5X platform clock controller binding + +maintainers: + - Dinh Nguyen <[email protected]> + +description: + The Intel eASIC N5X Clock controller is an integrated clock controller, which + generates and supplies to all modules. + +properties: + compatible: + const: intel,easic-n5x-clkmgr + + '#clock-cells': + const: 1 + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + +required: + - compatible + - reg + - clocks + - '#clock-cells' + +additionalProperties: false + +examples: + # Clock controller node: + - | + clkmgr: clock-controller@ffd10000 { + compatible = "intel,easic-n5x-clkmgr"; + reg = <0xffd10000 0x1000>; + clocks = <&osc1>; + #clock-cells = <1>; + }; +...
Signature · 1 line
2.30.0
Dinh Nguyen
maintainerPATCH v2 2/2 clk: socfpga: agilex: add clock driver for eASIC N5X platform
Add support for Intel's eASIC N5X platform. The clock manager driver for the N5X is very similar to the Agilex platform, we can re-use most of the Agilex clock driver.
This patch makes the necessary changes for the driver to differentiate between the Agilex and the N5X platforms.
---
v2: use "intel,easic-n5x-clkmgr" binding
correct the pll prepare function
Address Stephen's comments
Add a binding documentation
--- drivers/clk/socfpga/clk-agilex.c | 88 +++++++++++++++++++++++++++- drivers/clk/socfpga/clk-periph-s10.c | 53 +++++++++++++++++ drivers/clk/socfpga/clk-pll-s10.c | 83 ++++++++++++++++++++++++++ drivers/clk/socfpga/stratix10-clk.h | 17 +++++- 4 files changed, 238 insertions(+), 3 deletions(-)
drivers/clk/socfpga/clk-agilex.c +86 -2
@@ -196,6 +196,17 @@ static const struct stratix10_pll_clock agilex_pll_clks[] = { 0, 0x9c}, }; +static const struct n5x_perip_c_clock n5x_main_perip_c_clks[] = { + {AGILEX_MAIN_PLL_C0_CLK ,"main_pll_c0" ,"main_pll" ,NULL ,1 ,0 ,0x54 ,0 }, + {AGILEX_MAIN_PLL_C1_CLK ,"main_pll_c1" ,"main_pll" ,NULL ,1 ,0 ,0x54 ,8 }, + {AGILEX_MAIN_PLL_C2_CLK ,"main_pll_c2" ,"main_pll" ,NULL ,1 ,0 ,0x54 ,16 }, + {AGILEX_MAIN_PLL_C3_CLK ,"main_pll_c3" ,"main_pll" ,NULL ,1 ,0 ,0x54 ,24 }, + {AGILEX_PERIPH_PLL_C0_CLK ,"peri_pll_c0" ,"periph_pll" ,NULL ,1 ,0 ,0xA8 ,0 }, + {AGILEX_PERIPH_PLL_C1_CLK ,"peri_pll_c1" ,"periph_pll" ,NULL ,1 ,0 ,0xA8 ,8 }, + {AGILEX_PERIPH_PLL_C2_CLK ,"peri_pll_c2" ,"periph_pll" ,NULL ,1 ,0 ,0xA8 ,16 }, + {AGILEX_PERIPH_PLL_C3_CLK ,"peri_pll_c3" ,"periph_pll" ,NULL ,1 ,0 ,0xA8 ,24 }, +}; +static const struct stratix10_perip_c_clock agilex_main_perip_c_clks[] = { {AGILEX_MAIN_PLL_C0_CLK ,"main_pll_c0" ,"main_pll" ,NULL ,1 ,0 ,0x58 }, {AGILEX_MAIN_PLL_C1_CLK ,"main_pll_c1" ,"main_pll" ,NULL ,1 ,0 ,0x5C },
@@ -289,6 +300,25 @@ static const struct stratix10_gate_clock agilex_gate_clks[] = { 10, 0, 0, 0, 0, 0, 4}, }; +static int n5x_clk_register_c_perip (const struct n5x_perip_c_clock *clks, +int nums,struct stratix10_clock_data *data) +{ +struct clk *clk; +void __iomem *base = data->base; +int i; + +for (i =0 ; i < nums; i++) { + clk =n5x_register_periph (&clks[i], base); +if (IS_ERR (clk)) { +pr_err ("%s: failed to register clock %s\n" , + __func__, clks[i].name); +continue ; + } + data->clk_data.clks[clks[i].id] = clk; + } +return 0 ; +} +static int agilex_clk_register_c_perip (const struct stratix10_perip_c_clock *clks,int nums,struct stratix10_clock_data *data) {
@@ -367,6 +397,26 @@ static int agilex_clk_register_pll(const struct stratix10_pll_clock *clks,return 0 ; } +static int n5x_clk_register_pll (const struct stratix10_pll_clock *clks, +int nums,struct stratix10_clock_data *data) +{ +struct clk *clk; +void __iomem *base = data->base; +int i; + +for (i =0 ; i < nums; i++) { + clk =n5x_register_pll (&clks[i], base); +if (IS_ERR (clk)) { +pr_err ("%s: failed to register clock %s\n" , + __func__, clks[i].name); +continue ; + } + data->clk_data.clks[clks[i].id] = clk; + } + +return 0 ; +} +static struct stratix10_clock_data *__socfpga_agilex_clk_init (struct platform_device *pdev,int nr_clks) {
@@ -401,7 +451,7 @@ static struct stratix10_clock_data *__socfpga_agilex_clk_init(struct platform_dereturn clk_data; } -static int agilex_clkmgr_probe (struct platform_device *pdev) +static int agilex_clkmgr_init (struct platform_device *pdev) {struct stratix10_clock_data *clk_data;
@@ -423,9 +473,43 @@ static int agilex_clkmgr_probe(struct platform_device *pdev)return 0 ; } +static int n5x_clkmgr_init (struct platform_device *pdev) +{ +struct stratix10_clock_data *clk_data; + + clk_data =__socfpga_agilex_clk_init (pdev,AGILEX_NUM_CLKS ); +if (IS_ERR (clk_data)) +return PTR_ERR (clk_data); + +n5x_clk_register_pll (agilex_pll_clks,ARRAY_SIZE (agilex_pll_clks), clk_data); + +n5x_clk_register_c_perip (n5x_main_perip_c_clks, +ARRAY_SIZE (n5x_main_perip_c_clks), clk_data); + +agilex_clk_register_cnt_perip (agilex_main_perip_cnt_clks, +ARRAY_SIZE (agilex_main_perip_cnt_clks), + clk_data); + +agilex_clk_register_gate (agilex_gate_clks,ARRAY_SIZE (agilex_gate_clks), + clk_data); +return 0 ; +} + +static int agilex_clkmgr_probe (struct platform_device *pdev) +{ +int (*probe_func)(struct platform_device *init_func); + + probe_func =of_device_get_match_data (&pdev->dev); +if (!probe_func) +return -ENODEV ; +return probe_func (pdev); +} +static const struct of_device_id agilex_clkmgr_match_table[] = { { .compatible ="intel,agilex-clkmgr" , - .data = agilex_clkmgr_probe }, + .data = agilex_clkmgr_init }, + { .compatible ="intel,easic-n5x-clkmgr" , + .data = n5x_clkmgr_init }, { } };
drivers/clk/socfpga/clk-periph-s10.c +53 -0
71 lines not on this page · raw message
drivers/clk/socfpga/clk-pll-s10.c +83 -0
102 lines not on this page · raw message
drivers/clk/socfpga/stratix10-clk.h +16 -1
@@ -30,6 +30,17 @@ struct stratix10_perip_c_clock {unsigned long offset; }; +struct n5x_perip_c_clock { +unsigned int id; +const char *name; +const char *parent_name; +const char *const *parent_names; +u8 num_parents; +unsigned long flags; +unsigned long offset; +unsigned long shift; +}; +struct stratix10_perip_cnt_clock {unsigned int id;const char *name;
@@ -64,8 +75,12 @@ struct clk *s10_register_pll(const struct stratix10_pll_clock *, void __iomem *);struct clk *agilex_register_pll (const struct stratix10_pll_clock *,void __iomem *); +struct clk *n5x_register_pll (const struct stratix10_pll_clock *clks, +void __iomem *reg);struct clk *s10_register_periph (const struct stratix10_perip_c_clock *, -void __iomem *); +void __iomem *reg); +struct clk *n5x_register_periph (const struct n5x_perip_c_clock *clks, +void __iomem *reg);struct clk *s10_register_cnt_periph (const struct stratix10_perip_cnt_clock *,void __iomem *); struct clk *s10_register_gate(const struct stratix10_gate_clock *,
Signature · 1 line
2.30.0
Re: [PATCHv2 2/2] clk: socfpga: agilex: add clock driver for eASIC N5X platform
Quoting Dinh Nguyen (2021-02-12 06:30:59)
Quoted 9 lines
Add support for Intel's eASIC N5X platform. The clock manager driver for the N5X is very similar to the Agilex platform, we can re-use most of the Agilex clock driver.
This patch makes the necessary changes for the driver to differentiate between the Agilex and the N5X platforms.
Signed-off-by Dinh Nguyen <[email protected]>---
Applied to clk-next
Quoting Dinh Nguyen (2021-02-12 06:30:58)
Quoted 6 lines
Document the Agilex clock bindings, and add the clock header file. The clock header is an enumeration of all the different clocks on the eASIC N5X platform.
Signed-off-by Dinh Nguyen <[email protected]>---
Applied to clk-next