clk: socfpga: Add clock driver for Arria10
Subsystems (2)
v4 cover clk: socfpga: Add clock driver for Arria10
From: Dinh Nguyen <[email protected]>
Hi,
This patch series add the clock driver for the Arria10 platform. Although the Arria10 SoC's clock framework has some similarities the Cyclone/Arria 5, the differences are enough to warrant it's own driver, rather than polluting the existing driver with platform lookups.
v4:
- Move syscon regmap lookup to gate_clk_init().
- Remove unused includes(linux/clk.h and linux/clkdev.h)
- Check return value of of_clk_add_provider
- Clean ups to address Stephen's comments
v3:
- Fix sparse warning of assigning an integer 0 instead of NULL to a pointer.
v2:
- Update the DTS bindings doucment to have the new Arria10 clocks.
- Add an l4_sys_free_clk node. The l4_sys_free_clk is similar to the l4_sp_clk, but cannot be gated.
Thanks,
Dinh Nguyen (2):
clk: socfpga: update clk.h so for Arria10 platform to use
clk: socfpga: add a clock driver for the Arria 10 platform
drivers/clk/socfpga/Makefile | 1 + drivers/clk/socfpga/clk-gate-a10.c | 188 +++++++++++++++++++++++++++++++++++ drivers/clk/socfpga/clk-gate.c | 4 - drivers/clk/socfpga/clk-periph-a10.c | 138 +++++++++++++++++++++++++ drivers/clk/socfpga/clk-pll-a10.c | 129 ++++++++++++++++++++++++ drivers/clk/socfpga/clk.c | 7 +- drivers/clk/socfpga/clk.h | 11 +- 7 files changed, 472 insertions(+), 6 deletions(-) create mode 100644 drivers/clk/socfpga/clk-gate-a10.c create mode 100644 drivers/clk/socfpga/clk-periph-a10.c create mode 100644 drivers/clk/socfpga/clk-pll-a10.c
Signature · 1 line
2.2.1
PATCH v4 1/2 clk: socfpga: update clk.h so for Arria10 platform to use
From: Dinh Nguyen <[email protected]>
There are 5 possible parent clocks for the SoCFPGA Arria10. Move the define SYSMGR_SDMMC_CTRL_SET and streq() to clk.h so that the Arria clock driver can use.
--- drivers/clk/socfpga/clk-gate.c | 4 ---- drivers/clk/socfpga/clk.h | 6 +++++- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/clk/socfpga/clk-gate.c +0 -4
@@ -32,14 +32,10 @@#define SOCFPGA_MMC_CLK "sdmmc_clk"#define SOCFPGA_GPIO_DB_CLK_OFFSET 0xA8 -#define streq (a, b) (strcmp((a), (b)) == 0) -#define to_socfpga_gate_clk (p) container_of(p, struct socfpga_gate_clk, hw.hw)/* SDMMC Group for System Manager defines */ #define SYSMGR_SDMMCGRP_CTRL_OFFSET 0x108 -#define SYSMGR_SDMMC_CTRL_SET (smplsel, drvsel) \ - ((((smplsel) & 0x7) << 3) | (((drvsel) & 0x7) << 0))static u8 socfpga_clk_get_parent (struct clk_hw *hwclk) {
drivers/clk/socfpga/clk.h +5 -1
@@ -26,9 +26,13 @@#define CLKMGR_L4SRC 0x70#define CLKMGR_PERPLL_SRC 0xAC -#define SOCFPGA_MAX_PARENTS 3 +#define SOCFPGA_MAX_PARENTS 5#define div_mask (width) ((1 << (width)) - 1) +#define streq (a, b) (strcmp((a), (b)) == 0) +#define SYSMGR_SDMMC_CTRL_SET (smplsel, drvsel) \ + ((((smplsel) & 0x7) << 3) | (((drvsel) & 0x7) << 0)) +extern void __iomem *clk_mgr_base_addr;void __init socfpga_pll_init (struct device_node *node);
Signature · 1 line
2.2.1
PATCH v4 2/2 clk: socfpga: add a clock driver for the Arria 10 platform
In reply to [email protected]From: Dinh Nguyen <[email protected]>
The clocks on the Arria 10 platform is a bit different than the Cyclone/Arria 5 platform that it should just have it's own driver.
---
v4: Move lookup of syscon for clk_phase to gate_clk_init()
Remove unused includes
v3: Assign pointer to NULL instead of integer 0 per sparse check
--- drivers/clk/socfpga/Makefile | 1 + drivers/clk/socfpga/clk-gate-a10.c | 188 +++++++++++++++++++++++++++++++++++ drivers/clk/socfpga/clk-periph-a10.c | 138 +++++++++++++++++++++++++ drivers/clk/socfpga/clk-pll-a10.c | 129 ++++++++++++++++++++++++ drivers/clk/socfpga/clk.c | 7 +- drivers/clk/socfpga/clk.h | 5 + 6 files changed, 467 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/socfpga/clk-gate-a10.c create mode 100644 drivers/clk/socfpga/clk-periph-a10.c create mode 100644 drivers/clk/socfpga/clk-pll-a10.c
drivers/clk/socfpga/Makefile +1 -0
@@ -2,3 +2,4 @@ obj-y += clk.o obj-y += clk-gate.o obj-y += clk-pll.o obj-y += clk-periph.o +obj-y += clk-pll-a10.o clk-periph-a10.o clk-gate-a10.o
drivers/clk/socfpga/clk-gate-a10.c new file +188 -0
188 lines not on this page · raw message
drivers/clk/socfpga/clk-periph-a10.c new file +138 -0
138 lines not on this page · raw message
drivers/clk/socfpga/clk-pll-a10.c new file +129 -0
129 lines not on this page · raw message
drivers/clk/socfpga/clk.c +6 -1
@@ -24,4 +24,9 @@CLK_OF_DECLARE (socfpga_pll_clk,"altr,socfpga-pll-clock" , socfpga_pll_init);CLK_OF_DECLARE (socfpga_perip_clk,"altr,socfpga-perip-clk" , socfpga_periph_init);CLK_OF_DECLARE (socfpga_gate_clk,"altr,socfpga-gate-clk" , socfpga_gate_init); - +CLK_OF_DECLARE (socfpga_a10_pll_clk,"altr,socfpga-a10-pll-clock" , + socfpga_a10_pll_init); +CLK_OF_DECLARE (socfpga_a10_perip_clk,"altr,socfpga-a10-perip-clk" , + socfpga_a10_periph_init); +CLK_OF_DECLARE (socfpga_a10_gate_clk,"altr,socfpga-a10-gate-clk" , + socfpga_a10_gate_init);
drivers/clk/socfpga/clk.h +5 -0
@@ -34,10 +34,14 @@ ((((smplsel) & 0x7) << 3) | (((drvsel) & 0x7) << 0))extern void __iomem *clk_mgr_base_addr; +extern void __iomem *clk_mgr_a10_base_addr;void __init socfpga_pll_init (struct device_node *node);void __init socfpga_periph_init (struct device_node *node);void __init socfpga_gate_init (struct device_node *node); +void socfpga_a10_pll_init (struct device_node *node); +void socfpga_a10_periph_init (struct device_node *node); +void socfpga_a10_gate_init (struct device_node *node);struct socfpga_pll {struct clk_gate hw;
@@ -48,6 +52,7 @@ struct socfpga_gate_clk {char *parent_name;u32 fixed_div;void __iomem *div_reg; +struct regmap *sys_mgr_base_addr;u32 width;/* only valid if div_reg != 0 */ u32 shift;/* only valid if div_reg != 0 */ u32 clk_phase[2 ];
Signature · 1 line
2.2.1
Stephen Boyd
AppliedRe: [PATCHv4 2/2] clk: socfpga: add a clock driver for the Arria 10 platform
Quoted 7 lines · dinguyen at opensource.altera.com
From: Dinh Nguyen <[email protected]>
The clocks on the Arria 10 platform is a bit different than the Cyclone/Arria 5 platform that it should just have it's own driver.
Signed-off-by Dinh Nguyen <[email protected]>---
Applied to clk-next. One note below.
drivers/clk/socfpga/clk-gate-a10.c line 169
Quoted 8 lines
drivers/clk/socfpga/clk-gate-a10.c new file +8
-0+of_property_read_string (node,"clock-output-names" , &clk_name); + + init.name = clk_name; + init.ops = ops; + init.flags =0 ; +while (i <SOCFPGA_MAX_PARENTS && (parent_name[i] = +of_clk_get_parent_name (node, i)) !=NULL ) + i++;
Perhaps this should be a generic clk framework helper.
int of_clk_parent_something(node, array, size)
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project