Series adds support for parent data and parent_hw on the remaining AT91
clock drivers. Along with it a fix for SAMA7G5 has been introduced
(patch 1/42).
Series has been tested on SAM9X60 and SAMA5D2 SoCs.
Thank you,
Claudiu Beznea
Claudiu Beznea (42):
clk: at91: sama7g5: check __clk_get_hw() argument for errors
clk: at91: clk-usb: add support for parent_hw
clk: at91: sam9x60: switch to parent_hw and parent_data
clk: at91: sam9x60: make checkpatch.pl happy
clk: at91: clk-pll: add support for parent_hw
clk: at91: clk-audio-pll: add support for parent_hw
clk: at91: clk-plldiv: add support for parent_hw
clk: at91: clk-h32mx: add support for parent_hw
clk: at91: clk-i2s-mux: add support for parent_hw
clk: at91: sama5d2: switch to parent_hw and parent_data
clk: at91: clk-smd: add support for parent_hw
clk: at91: sama5d3: switch to parent_hw and parent_data
clk: at91: sama5d3: make checkpatch.pl happy
clk: at91: sama5d4: switch to parent_hw and parent_data
clk: at91: at91sam9x5: switch to parent_hw and parent_data
clk: at91: at91rm9200: switch to parent_hw and parent_data
clk: at91: at91rm9200: fix checkpatch.pl check
clk: at91: at91rm9200: fix checkpatch.pl check
clk: at91: clk-slow: add support for parent_hw
clk: at91: at91sam9260: switch to parent_hw and parent_data
clk: at91: at91sam9g45: switch to parent_hw and parent_data
clk: at91: at91sam9g45: fix checkpatch.pl check
clk: at91: at91sam9n12: switch to parent_hw and parent_data
clk: at91: at91sam9n12: remove checkpatch.pl checks
clk: at91: at91sam9rl: switch to parent_hw
clk: at91: dt-compat: switch to parent_hw and parent_data
clk: at91: clk-audio-pll: remove parent_names support
clk: at91: clk-generated: remove parent_names support
clk: at91: clk-h32mx: remove parent_names support
clk: at91: clk-i2s-mux: remove parent_names support
clk: at91: clk-main: remove parent_names support
clk: at91: clk-master: remove parent_names support
clk: at91: clk-peripheral: remove parent_names support
clk: at91: clk-pll: remove parent_names support
clk: at91: clk-plldiv: remove parent_names support
clk: at91: clk-programmable: remove parent_names support
clk: at91: clk-sam9x60-pll: remove parent_names support
clk: at91: clk-slow: remove parent_names support
clk: at91: clk-smd: remove parent_names support
clk: at91: clk-system: remove parent_names support
clk: at91: clk-usb: remove parent_names support
clk: at91: clk-utmi: remove parent_names support
drivers/clk/at91/at91rm9200.c | 101 +++++----
drivers/clk/at91/at91sam9260.c | 140 ++++++------
drivers/clk/at91/at91sam9g45.c | 94 ++++----
drivers/clk/at91/at91sam9n12.c | 113 +++++-----
drivers/clk/at91/at91sam9rl.c | 71 +++---
drivers/clk/at91/at91sam9x5.c | 123 ++++++-----
drivers/clk/at91/clk-audio-pll.c | 16 +-
drivers/clk/at91/clk-generated.c | 10 +-
drivers/clk/at91/clk-h32mx.c | 8 +-
drivers/clk/at91/clk-i2s-mux.c | 5 +-
drivers/clk/at91/clk-main.c | 24 +-
drivers/clk/at91/clk-master.c | 23 +-
drivers/clk/at91/clk-peripheral.c | 20 +-
drivers/clk/at91/clk-pll.c | 6 +-
drivers/clk/at91/clk-plldiv.c | 8 +-
drivers/clk/at91/clk-programmable.c | 10 +-
drivers/clk/at91/clk-sam9x60-pll.c | 16 +-
drivers/clk/at91/clk-slow.c | 8 +-
drivers/clk/at91/clk-smd.c | 7 +-
drivers/clk/at91/clk-system.c | 9 +-
drivers/clk/at91/clk-usb.c | 30 +--
drivers/clk/at91/clk-utmi.c | 23 +-
drivers/clk/at91/dt-compat.c | 330 +++++++++++++++++++---------
drivers/clk/at91/pmc.h | 64 +++---
drivers/clk/at91/sam9x60.c | 124 ++++++-----
drivers/clk/at91/sama5d2.c | 165 +++++++-------
drivers/clk/at91/sama5d3.c | 126 ++++++-----
drivers/clk/at91/sama5d4.c | 131 ++++++-----
drivers/clk/at91/sama7g5.c | 45 ++--
29 files changed, 1032 insertions(+), 818 deletions(-)
--
2.39.2
Remove parent_names support as parent_hw support is now available on all
platforms using clk-i2s-mux driver.
Signed-off-by: Claudiu Beznea <[email protected]>
---
drivers/clk/at91/clk-i2s-mux.c | 8 ++------
drivers/clk/at91/dt-compat.c | 2 +-
drivers/clk/at91/pmc.h | 3 +--
drivers/clk/at91/sama5d2.c | 4 ++--
4 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/drivers/clk/at91/clk-i2s-mux.c b/drivers/clk/at91/clk-i2s-mux.c
index f1981b8ee18d..ea84e8f5becd 100644
--- a/drivers/clk/at91/clk-i2s-mux.c
+++ b/drivers/clk/at91/clk-i2s-mux.c
@@ -50,8 +50,7 @@ static const struct clk_ops clk_i2s_mux_ops = {
struct clk_hw * __init
at91_clk_i2s_mux_register(struct regmap *regmap, const char *name,
- const char * const *parent_names, struct clk_hw **parent_hws,
- unsigned int num_parents, u8 bus_id)
+ struct clk_hw **parent_hws, unsigned int num_parents, u8 bus_id)
{
struct clk_init_data init = {};
struct clk_i2s_mux *i2s_ck;
@@ -63,10 +62,7 @@ at91_clk_i2s_mux_register(struct regmap *regmap, const char *name,
init.name = name;
init.ops = &clk_i2s_mux_ops;
- if (parent_hws)
- init.parent_hws = (const struct clk_hw **)parent_hws;
- else
- init.parent_names = parent_names;
+ init.parent_hws = (const struct clk_hw **)parent_hws;
init.num_parents = num_parents;
i2s_ck->hw.init = &init;
diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c
index 058b65c2d88d..7ab116a6e701 100644
--- a/drivers/clk/at91/dt-compat.c
+++ b/drivers/clk/at91/dt-compat.c
@@ -279,7 +279,7 @@ static void __init of_sama5d2_clk_i2s_mux_setup(struct device_node *np)
continue;
hw = at91_clk_i2s_mux_register(regmap_sfr, i2s_mux_np->name,
- NULL, parent_hws, 2, bus_id);
+ parent_hws, 2, bus_id);
if (IS_ERR(hw))
continue;
diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h
index 11f7ab4d1ad8..07f372abcfd0 100644
--- a/drivers/clk/at91/pmc.h
+++ b/drivers/clk/at91/pmc.h
@@ -153,8 +153,7 @@ at91_clk_register_h32mx(struct regmap *regmap, const char *name,
struct clk_hw * __init
at91_clk_i2s_mux_register(struct regmap *regmap, const char *name,
- const char * const *parent_names, struct clk_hw **parent_hws,
- unsigned int num_parents, u8 bus_id);
+ struct clk_hw **parent_hws, unsigned int num_parents, u8 bus_id);
struct clk_hw * __init
at91_clk_register_main_rc_osc(struct regmap *regmap, const char *name,
diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c
index 93c646e0b6ef..17a40cedd7fb 100644
--- a/drivers/clk/at91/sama5d2.c
+++ b/drivers/clk/at91/sama5d2.c
@@ -385,7 +385,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
parent_hws[0] = sama5d2_pmc->phws[54]; /* i2s0_clk */
parent_hws[1] = sama5d2_pmc->phws[54]; /* i2s0_gclk */
hw = at91_clk_i2s_mux_register(regmap_sfr, "i2s0_muxclk",
- NULL, parent_hws, 2, 0);
+ parent_hws, 2, 0);
if (IS_ERR(hw))
goto err_free;
@@ -394,7 +394,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
parent_hws[0] = sama5d2_pmc->phws[55]; /* i2s1_clk */
parent_hws[1] = sama5d2_pmc->ghws[55]; /* i2s1_gclk */
hw = at91_clk_i2s_mux_register(regmap_sfr, "i2s1_muxclk",
- NULL, parent_hws, 2, 1);
+ parent_hws, 2, 1);
if (IS_ERR(hw))
goto err_free;
--
2.39.2
Remove parent_names support as parent_hw support is now available on all
platforms using clk-generated driver.
Signed-off-by: Claudiu Beznea <[email protected]>
---
drivers/clk/at91/clk-generated.c | 10 +++-------
drivers/clk/at91/dt-compat.c | 2 +-
drivers/clk/at91/pmc.h | 3 +--
drivers/clk/at91/sam9x60.c | 2 +-
drivers/clk/at91/sama5d2.c | 2 +-
drivers/clk/at91/sama7g5.c | 2 +-
6 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/drivers/clk/at91/clk-generated.c b/drivers/clk/at91/clk-generated.c
index 4b4edeecc889..042553c7118a 100644
--- a/drivers/clk/at91/clk-generated.c
+++ b/drivers/clk/at91/clk-generated.c
@@ -318,8 +318,7 @@ static void clk_generated_startup(struct clk_generated *gck)
struct clk_hw * __init
at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock,
const struct clk_pcr_layout *layout,
- const char *name, const char **parent_names,
- struct clk_hw **parent_hws,
+ const char *name, struct clk_hw **parent_hws,
u32 *mux_table, u8 num_parents, u8 id,
const struct clk_range *range,
int chg_pid)
@@ -329,7 +328,7 @@ at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock,
struct clk_hw *hw;
int ret;
- if (!(parent_names || parent_hws))
+ if (!parent_hws)
return ERR_PTR(-ENOMEM);
gck = kzalloc(sizeof(*gck), GFP_KERNEL);
@@ -338,10 +337,7 @@ at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock,
init.name = name;
init.ops = &generated_ops;
- if (parent_hws)
- init.parent_hws = (const struct clk_hw **)parent_hws;
- else
- init.parent_names = parent_names;
+ init.parent_hws = (const struct clk_hw **)parent_hws;
init.num_parents = num_parents;
init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE;
if (chg_pid >= 0)
diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c
index 91bc2fada6ec..816a7ee353d6 100644
--- a/drivers/clk/at91/dt-compat.c
+++ b/drivers/clk/at91/dt-compat.c
@@ -198,7 +198,7 @@ static void __init of_sama5d2_clk_generated_setup(struct device_node *np)
hw = at91_clk_register_generated(regmap, &pmc_pcr_lock,
&dt_pcr_layout, name,
- NULL, parent_hws, NULL,
+ parent_hws, NULL,
num_parents, id, &range,
chg_pid);
if (IS_ERR(hw))
diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h
index 711b55a6b0ab..87ba2586d5e5 100644
--- a/drivers/clk/at91/pmc.h
+++ b/drivers/clk/at91/pmc.h
@@ -143,8 +143,7 @@ at91_clk_register_audio_pll_pmc(struct regmap *regmap, const char *name,
struct clk_hw * __init
at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock,
const struct clk_pcr_layout *layout,
- const char *name, const char **parent_names,
- struct clk_hw **parent_hws, u32 *mux_table,
+ const char *name, struct clk_hw **parent_hws, u32 *mux_table,
u8 num_parents, u8 id,
const struct clk_range *range, int chg_pid);
diff --git a/drivers/clk/at91/sam9x60.c b/drivers/clk/at91/sam9x60.c
index 930b4515a1dd..43997f686b87 100644
--- a/drivers/clk/at91/sam9x60.c
+++ b/drivers/clk/at91/sam9x60.c
@@ -363,7 +363,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
hw = at91_clk_register_generated(regmap, &pmc_pcr_lock,
&sam9x60_pcr_layout,
sam9x60_gck[i].n,
- NULL, parent_hws, NULL, 6,
+ parent_hws, NULL, 6,
sam9x60_gck[i].id,
&sam9x60_gck[i].r, INT_MIN);
if (IS_ERR(hw))
diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c
index 3920de445eca..2d4bf9e1a79c 100644
--- a/drivers/clk/at91/sama5d2.c
+++ b/drivers/clk/at91/sama5d2.c
@@ -371,7 +371,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
hw = at91_clk_register_generated(regmap, &pmc_pcr_lock,
&sama5d2_pcr_layout,
sama5d2_gck[i].n,
- NULL, parent_hws, NULL, 6,
+ parent_hws, NULL, 6,
sama5d2_gck[i].id,
&sama5d2_gck[i].r,
sama5d2_gck[i].chg_pid);
diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c
index 16e458be8304..b2d27193741b 100644
--- a/drivers/clk/at91/sama7g5.c
+++ b/drivers/clk/at91/sama7g5.c
@@ -1235,7 +1235,7 @@ static void __init sama7g5_pmc_setup(struct device_node *np)
hw = at91_clk_register_generated(regmap, &pmc_pcr_lock,
&sama7g5_pcr_layout,
- sama7g5_gck[i].n, NULL,
+ sama7g5_gck[i].n,
parent_hws, mux_table,
num_parents,
sama7g5_gck[i].id,
--
2.39.2
Remove parent_names support as parent_hw support is now available on all
platforms using clk-utmi driver.
Signed-off-by: Claudiu Beznea <[email protected]>
---
drivers/clk/at91/at91sam9g45.c | 2 +-
drivers/clk/at91/at91sam9rl.c | 2 +-
drivers/clk/at91/at91sam9x5.c | 2 +-
drivers/clk/at91/clk-utmi.c | 23 ++++++++---------------
drivers/clk/at91/dt-compat.c | 2 +-
drivers/clk/at91/pmc.h | 5 ++---
drivers/clk/at91/sama5d2.c | 2 +-
drivers/clk/at91/sama5d3.c | 2 +-
drivers/clk/at91/sama5d4.c | 2 +-
drivers/clk/at91/sama7g5.c | 2 +-
10 files changed, 18 insertions(+), 26 deletions(-)
diff --git a/drivers/clk/at91/at91sam9g45.c b/drivers/clk/at91/at91sam9g45.c
index 1e5262b678f5..1a20ce75201b 100644
--- a/drivers/clk/at91/at91sam9g45.c
+++ b/drivers/clk/at91/at91sam9g45.c
@@ -152,7 +152,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np)
at91sam9g45_pmc->chws[PMC_PLLACK] = hw;
- hw = at91_clk_register_utmi(regmap, NULL, "utmick", NULL, at91sam9g45_pmc->chws[PMC_MAIN]);
+ hw = at91_clk_register_utmi(regmap, NULL, "utmick", at91sam9g45_pmc->chws[PMC_MAIN]);
if (IS_ERR(hw))
goto err_free;
diff --git a/drivers/clk/at91/at91sam9rl.c b/drivers/clk/at91/at91sam9rl.c
index eaa757f6670a..05ea2bf3c73b 100644
--- a/drivers/clk/at91/at91sam9rl.c
+++ b/drivers/clk/at91/at91sam9rl.c
@@ -112,7 +112,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np)
at91sam9rl_pmc->chws[PMC_PLLACK] = hw;
- hw = at91_clk_register_utmi(regmap, NULL, "utmick", NULL, at91sam9rl_pmc->chws[PMC_MAIN]);
+ hw = at91_clk_register_utmi(regmap, NULL, "utmick", at91sam9rl_pmc->chws[PMC_MAIN]);
if (IS_ERR(hw))
goto err_free;
diff --git a/drivers/clk/at91/at91sam9x5.c b/drivers/clk/at91/at91sam9x5.c
index 1968dd69fbf7..b3a7d5803168 100644
--- a/drivers/clk/at91/at91sam9x5.c
+++ b/drivers/clk/at91/at91sam9x5.c
@@ -200,7 +200,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
at91sam9x5_pmc->chws[PMC_PLLACK] = hw;
- hw = at91_clk_register_utmi(regmap, NULL, "utmick", NULL, at91sam9x5_pmc->chws[PMC_MAIN]);
+ hw = at91_clk_register_utmi(regmap, NULL, "utmick", at91sam9x5_pmc->chws[PMC_MAIN]);
if (IS_ERR(hw))
goto err_free;
diff --git a/drivers/clk/at91/clk-utmi.c b/drivers/clk/at91/clk-utmi.c
index 40c84f5af5e8..8e2cf4893609 100644
--- a/drivers/clk/at91/clk-utmi.c
+++ b/drivers/clk/at91/clk-utmi.c
@@ -143,8 +143,7 @@ static const struct clk_ops utmi_ops = {
static struct clk_hw * __init
at91_clk_register_utmi_internal(struct regmap *regmap_pmc,
struct regmap *regmap_sfr,
- const char *name, const char *parent_name,
- struct clk_hw *parent_hw,
+ const char *name, struct clk_hw *parent_hw,
const struct clk_ops *ops, unsigned long flags)
{
struct clk_utmi *utmi;
@@ -152,7 +151,7 @@ at91_clk_register_utmi_internal(struct regmap *regmap_pmc,
struct clk_init_data init = {};
int ret;
- if (!(parent_name || parent_hw))
+ if (!parent_hw)
return ERR_PTR(-EINVAL);
utmi = kzalloc(sizeof(*utmi), GFP_KERNEL);
@@ -161,13 +160,8 @@ at91_clk_register_utmi_internal(struct regmap *regmap_pmc,
init.name = name;
init.ops = ops;
- if (parent_hw) {
- init.parent_hws = parent_hw ? (const struct clk_hw **)&parent_hw : NULL;
- init.num_parents = parent_hw ? 1 : 0;
- } else {
- init.parent_names = parent_name ? &parent_name : NULL;
- init.num_parents = parent_name ? 1 : 0;
- }
+ init.parent_hws = parent_hw ? (const struct clk_hw **)&parent_hw : NULL;
+ init.num_parents = parent_hw ? 1 : 0;
init.flags = flags;
utmi->hw.init = &init;
@@ -186,11 +180,10 @@ at91_clk_register_utmi_internal(struct regmap *regmap_pmc,
struct clk_hw * __init
at91_clk_register_utmi(struct regmap *regmap_pmc, struct regmap *regmap_sfr,
- const char *name, const char *parent_name,
- struct clk_hw *parent_hw)
+ const char *name, struct clk_hw *parent_hw)
{
return at91_clk_register_utmi_internal(regmap_pmc, regmap_sfr, name,
- parent_name, parent_hw, &utmi_ops, CLK_SET_RATE_GATE);
+ parent_hw, &utmi_ops, CLK_SET_RATE_GATE);
}
static int clk_utmi_sama7g5_prepare(struct clk_hw *hw)
@@ -289,8 +282,8 @@ static const struct clk_ops sama7g5_utmi_ops = {
struct clk_hw * __init
at91_clk_sama7g5_register_utmi(struct regmap *regmap_pmc, const char *name,
- const char *parent_name, struct clk_hw *parent_hw)
+ struct clk_hw *parent_hw)
{
return at91_clk_register_utmi_internal(regmap_pmc, NULL, name,
- parent_name, parent_hw, &sama7g5_utmi_ops, 0);
+ parent_hw, &sama7g5_utmi_ops, 0);
}
diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c
index 285ede5d6702..68211b36c8f6 100644
--- a/drivers/clk/at91/dt-compat.c
+++ b/drivers/clk/at91/dt-compat.c
@@ -1189,7 +1189,7 @@ static void __init of_at91sam9x5_clk_utmi_setup(struct device_node *np)
regmap_sfr = NULL;
}
- hw = at91_clk_register_utmi(regmap_pmc, regmap_sfr, name, NULL, parent_hw);
+ hw = at91_clk_register_utmi(regmap_pmc, regmap_sfr, name, parent_hw);
if (IS_ERR(hw))
return;
diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h
index 5e65f5b59536..889230d29bf2 100644
--- a/drivers/clk/at91/pmc.h
+++ b/drivers/clk/at91/pmc.h
@@ -263,11 +263,10 @@ at91rm9200_clk_register_usb(struct regmap *regmap, const char *name,
struct clk_hw * __init
at91_clk_register_utmi(struct regmap *regmap_pmc, struct regmap *regmap_sfr,
- const char *name, const char *parent_name,
- struct clk_hw *parent_hw);
+ const char *name, struct clk_hw *parent_hw);
struct clk_hw * __init
at91_clk_sama7g5_register_utmi(struct regmap *regmap, const char *name,
- const char *parent_name, struct clk_hw *parent_hw);
+ struct clk_hw *parent_hw);
#endif /* __PMC_H_ */
diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c
index fa14c6f7d37a..cf1f34a69862 100644
--- a/drivers/clk/at91/sama5d2.c
+++ b/drivers/clk/at91/sama5d2.c
@@ -253,7 +253,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
if (IS_ERR(regmap_sfr))
regmap_sfr = NULL;
- hw = at91_clk_register_utmi(regmap, regmap_sfr, "utmick", NULL,
+ hw = at91_clk_register_utmi(regmap, regmap_sfr, "utmick",
sama5d2_pmc->chws[PMC_MAIN]);
if (IS_ERR(hw))
goto err_free;
diff --git a/drivers/clk/at91/sama5d3.c b/drivers/clk/at91/sama5d3.c
index 0713a6b21c8a..707e501b1a73 100644
--- a/drivers/clk/at91/sama5d3.c
+++ b/drivers/clk/at91/sama5d3.c
@@ -179,7 +179,7 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
sama5d3_pmc->chws[PMC_PLLACK] = hw;
- hw = at91_clk_register_utmi(regmap, NULL, "utmick", NULL, mainck_hw);
+ hw = at91_clk_register_utmi(regmap, NULL, "utmick", mainck_hw);
if (IS_ERR(hw))
goto err_free;
diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c
index d0bd025876ac..542c7cccda46 100644
--- a/drivers/clk/at91/sama5d4.c
+++ b/drivers/clk/at91/sama5d4.c
@@ -194,7 +194,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
sama5d4_pmc->chws[PMC_PLLACK] = hw;
- hw = at91_clk_register_utmi(regmap, NULL, "utmick", NULL, mainck_hw);
+ hw = at91_clk_register_utmi(regmap, NULL, "utmick", mainck_hw);
if (IS_ERR(hw))
goto err_free;
diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c
index 61f7027f1033..012e992ce14b 100644
--- a/drivers/clk/at91/sama7g5.c
+++ b/drivers/clk/at91/sama7g5.c
@@ -1151,7 +1151,7 @@ static void __init sama7g5_pmc_setup(struct device_node *np)
sama7g5_pmc->chws[sama7g5_mckx[i].eid] = hw;
}
- hw = at91_clk_sama7g5_register_utmi(regmap, "utmick", NULL, main_xtal_hw);
+ hw = at91_clk_sama7g5_register_utmi(regmap, "utmick", main_xtal_hw);
if (IS_ERR(hw))
goto err_free;
--
2.39.2
Switch SAMA5D3 clocks to use parent_hw and parent_data. Having
parent_hw instead of parent names improves to clock registration
speed and re-parenting.
Signed-off-by: Claudiu Beznea <[email protected]>
---
drivers/clk/at91/sama5d3.c | 124 +++++++++++++++++++++----------------
1 file changed, 70 insertions(+), 54 deletions(-)
diff --git a/drivers/clk/at91/sama5d3.c b/drivers/clk/at91/sama5d3.c
index 8326bb6a291c..db0c66e24091 100644
--- a/drivers/clk/at91/sama5d3.c
+++ b/drivers/clk/at91/sama5d3.c
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
+#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/mfd/syscon.h>
#include <linux/slab.h>
@@ -37,9 +38,9 @@ static const struct clk_pcr_layout sama5d3_pcr_layout = {
.div_mask = GENMASK(17, 16),
};
-static const struct {
+static struct {
char *n;
- char *p;
+ struct clk_hw *parent_hw;
unsigned long flags;
u8 id;
} sama5d3_systemck[] = {
@@ -47,14 +48,14 @@ static const struct {
* ddrck feeds DDR controller and is enabled by bootloader thus we need
* to keep it enabled in case there is no Linux consumer for it.
*/
- { .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
- { .n = "lcdck", .p = "masterck_div", .id = 3 },
- { .n = "smdck", .p = "smdclk", .id = 4 },
- { .n = "uhpck", .p = "usbck", .id = 6 },
- { .n = "udpck", .p = "usbck", .id = 7 },
- { .n = "pck0", .p = "prog0", .id = 8 },
- { .n = "pck1", .p = "prog1", .id = 9 },
- { .n = "pck2", .p = "prog2", .id = 10 },
+ { .n = "ddrck", .id = 2, .flags = CLK_IS_CRITICAL },
+ { .n = "lcdck", .id = 3 },
+ { .n = "smdck", .id = 4 },
+ { .n = "uhpck", .id = 6 },
+ { .n = "udpck", .id = 7 },
+ { .n = "pck0", .id = 8 },
+ { .n = "pck1", .id = 9 },
+ { .n = "pck2", .id = 10 },
};
static const struct {
@@ -114,24 +115,28 @@ static const struct {
static void __init sama5d3_pmc_setup(struct device_node *np)
{
- const char *slck_name, *mainxtal_name;
+ struct clk_hw *slow_clk_hw, *main_xtal_hw, *main_rc_hw, *main_osc_hw, *mainck_hw;
+ struct clk_hw *parent_hws[5], *smdck_hw, *usbck_hw, *hw;
+ static struct clk_parent_data parent_data;
+ const char *main_xtal_name = "main_xtal";
struct pmc_data *sama5d3_pmc;
- const char *parent_names[5];
struct regmap *regmap;
- struct clk_hw *hw;
+ struct clk *clk;
int i;
bool bypass;
- i = of_property_match_string(np, "clock-names", "slow_clk");
- if (i < 0)
+ clk = of_clk_get_by_name(np, "slow_clk");
+ if (IS_ERR(clk))
return;
-
- slck_name = of_clk_get_parent_name(np, i);
-
- i = of_property_match_string(np, "clock-names", "main_xtal");
- if (i < 0)
+ slow_clk_hw = __clk_get_hw(clk);
+ if (!slow_clk_hw)
+ return;
+ clk = of_clk_get_by_name(np, main_xtal_name);
+ if (!IS_ERR(clk))
+ return;
+ main_xtal_hw = __clk_get_hw(clk);
+ if (!main_xtal_hw)
return;
- mainxtal_name = of_clk_get_parent_name(np, i);
regmap = device_node_to_regmap(np);
if (IS_ERR(regmap))
@@ -143,54 +148,56 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
if (!sama5d3_pmc)
return;
- hw = at91_clk_register_main_rc_osc(regmap, "main_rc_osc", 12000000,
- 50000000);
- if (IS_ERR(hw))
+ main_rc_hw = at91_clk_register_main_rc_osc(regmap, "main_rc_osc", 12000000,
+ 50000000);
+ if (IS_ERR(main_rc_hw))
goto err_free;
bypass = of_property_read_bool(np, "atmel,osc-bypass");
- hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, NULL,
- bypass);
- if (IS_ERR(hw))
+ parent_data.name = main_xtal_name;
+ parent_data.fw_name = main_xtal_name;
+ main_osc_hw = at91_clk_register_main_osc(regmap, "main_osc", NULL, &parent_data,
+ bypass);
+ if (IS_ERR(main_osc_hw))
goto err_free;
- parent_names[0] = "main_rc_osc";
- parent_names[1] = "main_osc";
- hw = at91_clk_register_sam9x5_main(regmap, "mainck", parent_names, NULL, 2);
- if (IS_ERR(hw))
+ parent_hws[0] = main_rc_hw;
+ parent_hws[1] = main_osc_hw;
+ mainck_hw = at91_clk_register_sam9x5_main(regmap, "mainck", NULL, parent_hws, 2);
+ if (IS_ERR(mainck_hw))
goto err_free;
- hw = at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0,
+ hw = at91_clk_register_pll(regmap, "pllack", NULL, mainck_hw, 0,
&sama5d3_pll_layout, &plla_characteristics);
if (IS_ERR(hw))
goto err_free;
- hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL);
+ hw = at91_clk_register_plldiv(regmap, "plladivck", NULL, hw);
if (IS_ERR(hw))
goto err_free;
sama5d3_pmc->chws[PMC_PLLACK] = hw;
- hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck", NULL);
+ hw = at91_clk_register_utmi(regmap, NULL, "utmick", NULL, mainck_hw);
if (IS_ERR(hw))
goto err_free;
sama5d3_pmc->chws[PMC_UTMI] = hw;
- parent_names[0] = slck_name;
- parent_names[1] = "mainck";
- parent_names[2] = "plladivck";
- parent_names[3] = "utmick";
+ parent_hws[0] = slow_clk_hw;
+ parent_hws[1] = mainck_hw;
+ parent_hws[2] = sama5d3_pmc->chws[PMC_PLLACK];
+ parent_hws[3] = sama5d3_pmc->chws[PMC_UTMI];
hw = at91_clk_register_master_pres(regmap, "masterck_pres", 4,
- parent_names, NULL,
+ NULL, parent_hws,
&at91sam9x5_master_layout,
&mck_characteristics, &mck_lock);
if (IS_ERR(hw))
goto err_free;
hw = at91_clk_register_master_div(regmap, "masterck_div",
- "masterck_pres", NULL,
+ NULL, hw,
&at91sam9x5_master_layout,
&mck_characteristics, &mck_lock,
CLK_SET_RATE_GATE, 0);
@@ -199,28 +206,28 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
sama5d3_pmc->chws[PMC_MCK] = hw;
- parent_names[0] = "plladivck";
- parent_names[1] = "utmick";
- hw = at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, NULL, 2);
- if (IS_ERR(hw))
+ parent_hws[0] = sama5d3_pmc->chws[PMC_PLLACK];
+ parent_hws[1] = sama5d3_pmc->chws[PMC_UTMI];
+ usbck_hw = at91sam9x5_clk_register_usb(regmap, "usbck", NULL, parent_hws, 2);
+ if (IS_ERR(usbck_hw))
goto err_free;
- hw = at91sam9x5_clk_register_smd(regmap, "smdclk", parent_names, NULL, 2);
- if (IS_ERR(hw))
+ smdck_hw = at91sam9x5_clk_register_smd(regmap, "smdclk", NULL, parent_hws, 2);
+ if (IS_ERR(smdck_hw))
goto err_free;
- parent_names[0] = slck_name;
- parent_names[1] = "mainck";
- parent_names[2] = "plladivck";
- parent_names[3] = "utmick";
- parent_names[4] = "masterck_div";
+ parent_hws[0] = slow_clk_hw;
+ parent_hws[1] = mainck_hw;
+ parent_hws[2] = sama5d3_pmc->chws[PMC_PLLACK];
+ parent_hws[3] = sama5d3_pmc->chws[PMC_UTMI];
+ parent_hws[4] = sama5d3_pmc->chws[PMC_MCK];
for (i = 0; i < 3; i++) {
char name[6];
snprintf(name, sizeof(name), "prog%d", i);
hw = at91_clk_register_programmable(regmap, name,
- parent_names, NULL, 5, i,
+ NULL, parent_hws, 5, i,
&at91sam9x5_programmable_layout,
NULL);
if (IS_ERR(hw))
@@ -229,9 +236,18 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
sama5d3_pmc->pchws[i] = hw;
}
+ /* Set systemck parent hws. */
+ sama5d3_systemck[0].parent_hw = sama5d3_pmc->chws[PMC_MCK];
+ sama5d3_systemck[1].parent_hw = sama5d3_pmc->chws[PMC_MCK];
+ sama5d3_systemck[2].parent_hw = smdck_hw;
+ sama5d3_systemck[3].parent_hw = usbck_hw;
+ sama5d3_systemck[4].parent_hw = usbck_hw;
+ sama5d3_systemck[5].parent_hw = sama5d3_pmc->pchws[0];
+ sama5d3_systemck[6].parent_hw = sama5d3_pmc->pchws[1];
+ sama5d3_systemck[7].parent_hw = sama5d3_pmc->pchws[2];
for (i = 0; i < ARRAY_SIZE(sama5d3_systemck); i++) {
hw = at91_clk_register_system(regmap, sama5d3_systemck[i].n,
- sama5d3_systemck[i].p, NULL,
+ NULL, sama5d3_systemck[i].parent_hw,
sama5d3_systemck[i].id,
sama5d3_systemck[i].flags);
if (IS_ERR(hw))
@@ -244,7 +260,7 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
hw = at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock,
&sama5d3_pcr_layout,
sama5d3_periphck[i].n,
- "masterck_div", NULL,
+ NULL, sama5d3_pmc->chws[PMC_MCK],
sama5d3_periphck[i].id,
&sama5d3_periphck[i].r,
INT_MIN,
--
2.39.2
Add support for parent_hw in plldiv clock driver.
With this parent-child relation is described with pointers rather
than strings making registration a bit faster.
All the SoC based drivers that rely on clk-plldiv were adapted
to the new API change. The switch itself for SoCs will be done
in subsequent patches.
Signed-off-by: Claudiu Beznea <[email protected]>
---
drivers/clk/at91/at91sam9g45.c | 2 +-
drivers/clk/at91/at91sam9n12.c | 2 +-
drivers/clk/at91/at91sam9x5.c | 2 +-
drivers/clk/at91/clk-plldiv.c | 13 +++++++++----
drivers/clk/at91/dt-compat.c | 2 +-
drivers/clk/at91/pmc.h | 2 +-
drivers/clk/at91/sama5d2.c | 2 +-
drivers/clk/at91/sama5d3.c | 2 +-
drivers/clk/at91/sama5d4.c | 2 +-
9 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/drivers/clk/at91/at91sam9g45.c b/drivers/clk/at91/at91sam9g45.c
index 3436a09a6e8a..cb98d22c2e30 100644
--- a/drivers/clk/at91/at91sam9g45.c
+++ b/drivers/clk/at91/at91sam9g45.c
@@ -139,7 +139,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np)
if (IS_ERR(hw))
goto err_free;
- hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack");
+ hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL);
if (IS_ERR(hw))
goto err_free;
diff --git a/drivers/clk/at91/at91sam9n12.c b/drivers/clk/at91/at91sam9n12.c
index 80ccd4a49df3..34dd7645f964 100644
--- a/drivers/clk/at91/at91sam9n12.c
+++ b/drivers/clk/at91/at91sam9n12.c
@@ -165,7 +165,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
if (IS_ERR(hw))
goto err_free;
- hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack");
+ hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL);
if (IS_ERR(hw))
goto err_free;
diff --git a/drivers/clk/at91/at91sam9x5.c b/drivers/clk/at91/at91sam9x5.c
index 6b8c755fefdf..37280852f086 100644
--- a/drivers/clk/at91/at91sam9x5.c
+++ b/drivers/clk/at91/at91sam9x5.c
@@ -187,7 +187,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
if (IS_ERR(hw))
goto err_free;
- hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack");
+ hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL);
if (IS_ERR(hw))
goto err_free;
diff --git a/drivers/clk/at91/clk-plldiv.c b/drivers/clk/at91/clk-plldiv.c
index ba3a1839a96d..1d5a0a6d299d 100644
--- a/drivers/clk/at91/clk-plldiv.c
+++ b/drivers/clk/at91/clk-plldiv.c
@@ -72,11 +72,11 @@ static const struct clk_ops plldiv_ops = {
struct clk_hw * __init
at91_clk_register_plldiv(struct regmap *regmap, const char *name,
- const char *parent_name)
+ const char *parent_name, struct clk_hw *parent_hw)
{
struct clk_plldiv *plldiv;
struct clk_hw *hw;
- struct clk_init_data init;
+ struct clk_init_data init = {};
int ret;
plldiv = kzalloc(sizeof(*plldiv), GFP_KERNEL);
@@ -85,8 +85,13 @@ at91_clk_register_plldiv(struct regmap *regmap, const char *name,
init.name = name;
init.ops = &plldiv_ops;
- init.parent_names = parent_name ? &parent_name : NULL;
- init.num_parents = parent_name ? 1 : 0;
+ if (parent_hw) {
+ init.parent_hws = (const struct clk_hw **)&parent_hw;
+ init.num_parents = 1;
+ } else {
+ init.parent_names = parent_name ? &parent_name : NULL;
+ init.num_parents = parent_name ? 1 : 0;
+ }
init.flags = CLK_SET_RATE_GATE;
plldiv->hw.init = &init;
diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c
index 6698a770d45a..6e010b5cb435 100644
--- a/drivers/clk/at91/dt-compat.c
+++ b/drivers/clk/at91/dt-compat.c
@@ -723,7 +723,7 @@ of_at91sam9x5_clk_plldiv_setup(struct device_node *np)
if (IS_ERR(regmap))
return;
- hw = at91_clk_register_plldiv(regmap, name, parent_name);
+ hw = at91_clk_register_plldiv(regmap, name, parent_name, NULL);
if (IS_ERR(hw))
return;
diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h
index 6d541b4d3f50..3f7ad79db4db 100644
--- a/drivers/clk/at91/pmc.h
+++ b/drivers/clk/at91/pmc.h
@@ -216,7 +216,7 @@ at91_clk_register_pll(struct regmap *regmap, const char *name,
const struct clk_pll_characteristics *characteristics);
struct clk_hw * __init
at91_clk_register_plldiv(struct regmap *regmap, const char *name,
- const char *parent_name);
+ const char *parent_name, struct clk_hw *parent_hw);
struct clk_hw * __init
sam9x60_clk_register_div_pll(struct regmap *regmap, spinlock_t *lock,
diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c
index d2af421abddc..7904f2122ed7 100644
--- a/drivers/clk/at91/sama5d2.c
+++ b/drivers/clk/at91/sama5d2.c
@@ -220,7 +220,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
if (IS_ERR(hw))
goto err_free;
- hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack");
+ hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL);
if (IS_ERR(hw))
goto err_free;
diff --git a/drivers/clk/at91/sama5d3.c b/drivers/clk/at91/sama5d3.c
index 9d86c350a1e7..7f2ac8f648dd 100644
--- a/drivers/clk/at91/sama5d3.c
+++ b/drivers/clk/at91/sama5d3.c
@@ -166,7 +166,7 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
if (IS_ERR(hw))
goto err_free;
- hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack");
+ hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL);
if (IS_ERR(hw))
goto err_free;
diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c
index 8491b1e0391d..7cda8032653e 100644
--- a/drivers/clk/at91/sama5d4.c
+++ b/drivers/clk/at91/sama5d4.c
@@ -181,7 +181,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
if (IS_ERR(hw))
goto err_free;
- hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack");
+ hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL);
if (IS_ERR(hw))
goto err_free;
--
2.39.2
Remove parent_names support as parent_hw support is now available on all
platforms using clk-h32mx driver.
Signed-off-by: Claudiu Beznea <[email protected]>
---
drivers/clk/at91/clk-h32mx.c | 11 +++--------
drivers/clk/at91/dt-compat.c | 2 +-
drivers/clk/at91/pmc.h | 2 +-
drivers/clk/at91/sama5d2.c | 2 +-
drivers/clk/at91/sama5d4.c | 2 +-
5 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/drivers/clk/at91/clk-h32mx.c b/drivers/clk/at91/clk-h32mx.c
index d7cdade56454..0e139bf731ec 100644
--- a/drivers/clk/at91/clk-h32mx.c
+++ b/drivers/clk/at91/clk-h32mx.c
@@ -83,7 +83,7 @@ static const struct clk_ops h32mx_ops = {
struct clk_hw * __init
at91_clk_register_h32mx(struct regmap *regmap, const char *name,
- const char *parent_name, struct clk_hw *parent_hw)
+ struct clk_hw *parent_hw)
{
struct clk_sama5d4_h32mx *h32mxclk;
struct clk_init_data init = {};
@@ -95,13 +95,8 @@ at91_clk_register_h32mx(struct regmap *regmap, const char *name,
init.name = name;
init.ops = &h32mx_ops;
- if (parent_hw) {
- init.parent_hws = (const struct clk_hw **)&parent_hw;
- init.num_parents = 1;
- } else {
- init.parent_names = parent_name ? &parent_name : NULL;
- init.num_parents = parent_name ? 1 : 0;
- }
+ init.parent_hws = parent_hw ? (const struct clk_hw **)&parent_hw : NULL;
+ init.num_parents = parent_hw ? 1 : 0;
init.flags = CLK_SET_RATE_GATE;
h32mxclk->hw.init = &init;
diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c
index 816a7ee353d6..058b65c2d88d 100644
--- a/drivers/clk/at91/dt-compat.c
+++ b/drivers/clk/at91/dt-compat.c
@@ -234,7 +234,7 @@ static void __init of_sama5d4_clk_h32mx_setup(struct device_node *np)
if (!parent_hw)
return;
- hw = at91_clk_register_h32mx(regmap, name, NULL, parent_hw);
+ hw = at91_clk_register_h32mx(regmap, name, parent_hw);
if (IS_ERR(hw))
return;
diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h
index 87ba2586d5e5..11f7ab4d1ad8 100644
--- a/drivers/clk/at91/pmc.h
+++ b/drivers/clk/at91/pmc.h
@@ -149,7 +149,7 @@ at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock,
struct clk_hw * __init
at91_clk_register_h32mx(struct regmap *regmap, const char *name,
- const char *parent_name, struct clk_hw *parent_hw);
+ struct clk_hw *parent_hw);
struct clk_hw * __init
at91_clk_i2s_mux_register(struct regmap *regmap, const char *name,
diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c
index 2d4bf9e1a79c..93c646e0b6ef 100644
--- a/drivers/clk/at91/sama5d2.c
+++ b/drivers/clk/at91/sama5d2.c
@@ -280,7 +280,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
sama5d2_pmc->chws[PMC_MCK] = hw;
- hw = at91_clk_register_h32mx(regmap, "h32mxck", NULL, sama5d2_pmc->chws[PMC_MCK]);
+ hw = at91_clk_register_h32mx(regmap, "h32mxck", sama5d2_pmc->chws[PMC_MCK]);
if (IS_ERR(hw))
goto err_free;
diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c
index ac7565b26dce..b4375cb1c3f3 100644
--- a/drivers/clk/at91/sama5d4.c
+++ b/drivers/clk/at91/sama5d4.c
@@ -220,7 +220,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
sama5d4_pmc->chws[PMC_MCK] = hw;
- hw = at91_clk_register_h32mx(regmap, "h32mxck", NULL, sama5d4_pmc->chws[PMC_MCK]);
+ hw = at91_clk_register_h32mx(regmap, "h32mxck", sama5d4_pmc->chws[PMC_MCK]);
if (IS_ERR(hw))
goto err_free;
--
2.39.2