Commit ff1c6c90 authored by Stephen Boyd's avatar Stephen Boyd

Merge tag 'clk-microchip-6.5-2' of...

Merge tag 'clk-microchip-6.5-2' of https://git.kernel.org/pub/scm/linux/kernel/git/at91/linux into clk-microchip

Pull Microchip clk driver updates from Claudiu Beznea:

It contains support for parent_data, parent_hw in AT91 clock drivers
used by SAMA7G5 SoC (e.g. main, master, generic, peripheral, programmable,
system, utmi, slow clocks) and also the update of SAMA7G5 to use
this new support.

* tag 'clk-microchip-6.5-2' of https://git.kernel.org/pub/scm/linux/kernel/git/at91/linux:
  clk: at91: sama7g5: s/ep_chg_chg_id/ep_chg_id
  clk: at91: sama7g5: switch to parent_hw and parent_data
  clk: at91: sckc: switch to parent_data/parent_hw
  clk: at91: clk-sam9x60-pll: add support for parent_hw
  clk: at91: clk-utmi: add support for parent_hw
  clk: at91: clk-system: add support for parent_hw
  clk: at91: clk-programmable: add support for parent_hw
  clk: at91: clk-peripheral: add support for parent_hw
  clk: at91: clk-master: add support for parent_hw
  clk: at91: clk-generated: add support for parent_hw
  clk: at91: clk-main: add support for parent_data/parent_hw
parents 3973bcc9 5619c2dd
...@@ -108,12 +108,12 @@ static void __init at91rm9200_pmc_setup(struct device_node *np) ...@@ -108,12 +108,12 @@ static void __init at91rm9200_pmc_setup(struct device_node *np)
bypass = of_property_read_bool(np, "atmel,osc-bypass"); bypass = of_property_read_bool(np, "atmel,osc-bypass");
hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, NULL,
bypass); bypass);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
hw = at91_clk_register_rm9200_main(regmap, "mainck", "main_osc"); hw = at91_clk_register_rm9200_main(regmap, "mainck", "main_osc", NULL);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
...@@ -140,7 +140,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np) ...@@ -140,7 +140,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np)
parent_names[2] = "pllack"; parent_names[2] = "pllack";
parent_names[3] = "pllbck"; parent_names[3] = "pllbck";
hw = at91_clk_register_master_pres(regmap, "masterck_pres", 4, hw = at91_clk_register_master_pres(regmap, "masterck_pres", 4,
parent_names, parent_names, NULL,
&at91rm9200_master_layout, &at91rm9200_master_layout,
&rm9200_mck_characteristics, &rm9200_mck_characteristics,
&rm9200_mck_lock); &rm9200_mck_lock);
...@@ -148,7 +148,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np) ...@@ -148,7 +148,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np)
goto err_free; goto err_free;
hw = at91_clk_register_master_div(regmap, "masterck_div", hw = at91_clk_register_master_div(regmap, "masterck_div",
"masterck_pres", "masterck_pres", NULL,
&at91rm9200_master_layout, &at91rm9200_master_layout,
&rm9200_mck_characteristics, &rm9200_mck_characteristics,
&rm9200_mck_lock, CLK_SET_RATE_GATE, 0); &rm9200_mck_lock, CLK_SET_RATE_GATE, 0);
...@@ -171,7 +171,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np) ...@@ -171,7 +171,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np)
snprintf(name, sizeof(name), "prog%d", i); snprintf(name, sizeof(name), "prog%d", i);
hw = at91_clk_register_programmable(regmap, name, hw = at91_clk_register_programmable(regmap, name,
parent_names, 4, i, parent_names, NULL, 4, i,
&at91rm9200_programmable_layout, &at91rm9200_programmable_layout,
NULL); NULL);
if (IS_ERR(hw)) if (IS_ERR(hw))
...@@ -182,7 +182,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np) ...@@ -182,7 +182,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np)
for (i = 0; i < ARRAY_SIZE(at91rm9200_systemck); i++) { for (i = 0; i < ARRAY_SIZE(at91rm9200_systemck); i++) {
hw = at91_clk_register_system(regmap, at91rm9200_systemck[i].n, hw = at91_clk_register_system(regmap, at91rm9200_systemck[i].n,
at91rm9200_systemck[i].p, at91rm9200_systemck[i].p, NULL,
at91rm9200_systemck[i].id, 0); at91rm9200_systemck[i].id, 0);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
...@@ -193,7 +193,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np) ...@@ -193,7 +193,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np)
for (i = 0; i < ARRAY_SIZE(at91rm9200_periphck); i++) { for (i = 0; i < ARRAY_SIZE(at91rm9200_periphck); i++) {
hw = at91_clk_register_peripheral(regmap, hw = at91_clk_register_peripheral(regmap,
at91rm9200_periphck[i].n, at91rm9200_periphck[i].n,
"masterck_div", "masterck_div", NULL,
at91rm9200_periphck[i].id); at91rm9200_periphck[i].id);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
......
...@@ -363,12 +363,12 @@ static void __init at91sam926x_pmc_setup(struct device_node *np, ...@@ -363,12 +363,12 @@ static void __init at91sam926x_pmc_setup(struct device_node *np,
bypass = of_property_read_bool(np, "atmel,osc-bypass"); bypass = of_property_read_bool(np, "atmel,osc-bypass");
hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, NULL,
bypass); bypass);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
hw = at91_clk_register_rm9200_main(regmap, "mainck", "main_osc"); hw = at91_clk_register_rm9200_main(regmap, "mainck", "main_osc", NULL);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
...@@ -416,7 +416,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np, ...@@ -416,7 +416,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np,
parent_names[2] = "pllack"; parent_names[2] = "pllack";
parent_names[3] = "pllbck"; parent_names[3] = "pllbck";
hw = at91_clk_register_master_pres(regmap, "masterck_pres", 4, hw = at91_clk_register_master_pres(regmap, "masterck_pres", 4,
parent_names, parent_names, NULL,
&at91rm9200_master_layout, &at91rm9200_master_layout,
data->mck_characteristics, data->mck_characteristics,
&at91sam9260_mck_lock); &at91sam9260_mck_lock);
...@@ -424,7 +424,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np, ...@@ -424,7 +424,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np,
goto err_free; goto err_free;
hw = at91_clk_register_master_div(regmap, "masterck_div", hw = at91_clk_register_master_div(regmap, "masterck_div",
"masterck_pres", "masterck_pres", NULL,
&at91rm9200_master_layout, &at91rm9200_master_layout,
data->mck_characteristics, data->mck_characteristics,
&at91sam9260_mck_lock, &at91sam9260_mck_lock,
...@@ -448,7 +448,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np, ...@@ -448,7 +448,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np,
snprintf(name, sizeof(name), "prog%d", i); snprintf(name, sizeof(name), "prog%d", i);
hw = at91_clk_register_programmable(regmap, name, hw = at91_clk_register_programmable(regmap, name,
parent_names, 4, i, parent_names, NULL, 4, i,
&at91rm9200_programmable_layout, &at91rm9200_programmable_layout,
NULL); NULL);
if (IS_ERR(hw)) if (IS_ERR(hw))
...@@ -459,7 +459,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np, ...@@ -459,7 +459,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np,
for (i = 0; i < data->num_sck; i++) { for (i = 0; i < data->num_sck; i++) {
hw = at91_clk_register_system(regmap, data->sck[i].n, hw = at91_clk_register_system(regmap, data->sck[i].n,
data->sck[i].p, data->sck[i].p, NULL,
data->sck[i].id, 0); data->sck[i].id, 0);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
...@@ -470,7 +470,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np, ...@@ -470,7 +470,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np,
for (i = 0; i < data->num_pck; i++) { for (i = 0; i < data->num_pck; i++) {
hw = at91_clk_register_peripheral(regmap, hw = at91_clk_register_peripheral(regmap,
data->pck[i].n, data->pck[i].n,
"masterck_div", "masterck_div", NULL,
data->pck[i].id); data->pck[i].id);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
......
...@@ -123,12 +123,12 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np) ...@@ -123,12 +123,12 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np)
bypass = of_property_read_bool(np, "atmel,osc-bypass"); bypass = of_property_read_bool(np, "atmel,osc-bypass");
hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, NULL,
bypass); bypass);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
hw = at91_clk_register_rm9200_main(regmap, "mainck", "main_osc"); hw = at91_clk_register_rm9200_main(regmap, "mainck", "main_osc", NULL);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
...@@ -145,7 +145,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np) ...@@ -145,7 +145,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np)
at91sam9g45_pmc->chws[PMC_PLLACK] = hw; at91sam9g45_pmc->chws[PMC_PLLACK] = hw;
hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck"); hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck", NULL);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
...@@ -156,7 +156,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np) ...@@ -156,7 +156,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np)
parent_names[2] = "plladivck"; parent_names[2] = "plladivck";
parent_names[3] = "utmick"; parent_names[3] = "utmick";
hw = at91_clk_register_master_pres(regmap, "masterck_pres", 4, hw = at91_clk_register_master_pres(regmap, "masterck_pres", 4,
parent_names, parent_names, NULL,
&at91rm9200_master_layout, &at91rm9200_master_layout,
&mck_characteristics, &mck_characteristics,
&at91sam9g45_mck_lock); &at91sam9g45_mck_lock);
...@@ -164,7 +164,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np) ...@@ -164,7 +164,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np)
goto err_free; goto err_free;
hw = at91_clk_register_master_div(regmap, "masterck_div", hw = at91_clk_register_master_div(regmap, "masterck_div",
"masterck_pres", "masterck_pres", NULL,
&at91rm9200_master_layout, &at91rm9200_master_layout,
&mck_characteristics, &mck_characteristics,
&at91sam9g45_mck_lock, &at91sam9g45_mck_lock,
...@@ -191,7 +191,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np) ...@@ -191,7 +191,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np)
snprintf(name, sizeof(name), "prog%d", i); snprintf(name, sizeof(name), "prog%d", i);
hw = at91_clk_register_programmable(regmap, name, hw = at91_clk_register_programmable(regmap, name,
parent_names, 5, i, parent_names, NULL, 5, i,
&at91sam9g45_programmable_layout, &at91sam9g45_programmable_layout,
NULL); NULL);
if (IS_ERR(hw)) if (IS_ERR(hw))
...@@ -202,7 +202,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np) ...@@ -202,7 +202,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np)
for (i = 0; i < ARRAY_SIZE(at91sam9g45_systemck); i++) { for (i = 0; i < ARRAY_SIZE(at91sam9g45_systemck); i++) {
hw = at91_clk_register_system(regmap, at91sam9g45_systemck[i].n, hw = at91_clk_register_system(regmap, at91sam9g45_systemck[i].n,
at91sam9g45_systemck[i].p, at91sam9g45_systemck[i].p, NULL,
at91sam9g45_systemck[i].id, at91sam9g45_systemck[i].id,
at91sam9g45_systemck[i].flags); at91sam9g45_systemck[i].flags);
if (IS_ERR(hw)) if (IS_ERR(hw))
...@@ -214,7 +214,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np) ...@@ -214,7 +214,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np)
for (i = 0; i < ARRAY_SIZE(at91sam9g45_periphck); i++) { for (i = 0; i < ARRAY_SIZE(at91sam9g45_periphck); i++) {
hw = at91_clk_register_peripheral(regmap, hw = at91_clk_register_peripheral(regmap,
at91sam9g45_periphck[i].n, at91sam9g45_periphck[i].n,
"masterck_div", "masterck_div", NULL,
at91sam9g45_periphck[i].id); at91sam9g45_periphck[i].id);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
......
...@@ -147,14 +147,14 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np) ...@@ -147,14 +147,14 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
bypass = of_property_read_bool(np, "atmel,osc-bypass"); bypass = of_property_read_bool(np, "atmel,osc-bypass");
hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, NULL,
bypass); bypass);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
parent_names[0] = "main_rc_osc"; parent_names[0] = "main_rc_osc";
parent_names[1] = "main_osc"; parent_names[1] = "main_osc";
hw = at91_clk_register_sam9x5_main(regmap, "mainck", parent_names, 2); hw = at91_clk_register_sam9x5_main(regmap, "mainck", parent_names, NULL, 2);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
...@@ -183,7 +183,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np) ...@@ -183,7 +183,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
parent_names[2] = "plladivck"; parent_names[2] = "plladivck";
parent_names[3] = "pllbck"; parent_names[3] = "pllbck";
hw = at91_clk_register_master_pres(regmap, "masterck_pres", 4, hw = at91_clk_register_master_pres(regmap, "masterck_pres", 4,
parent_names, parent_names, NULL,
&at91sam9x5_master_layout, &at91sam9x5_master_layout,
&mck_characteristics, &mck_characteristics,
&at91sam9n12_mck_lock); &at91sam9n12_mck_lock);
...@@ -191,7 +191,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np) ...@@ -191,7 +191,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
goto err_free; goto err_free;
hw = at91_clk_register_master_div(regmap, "masterck_div", hw = at91_clk_register_master_div(regmap, "masterck_div",
"masterck_pres", "masterck_pres", NULL,
&at91sam9x5_master_layout, &at91sam9x5_master_layout,
&mck_characteristics, &mck_characteristics,
&at91sam9n12_mck_lock, &at91sam9n12_mck_lock,
...@@ -216,7 +216,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np) ...@@ -216,7 +216,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
snprintf(name, sizeof(name), "prog%d", i); snprintf(name, sizeof(name), "prog%d", i);
hw = at91_clk_register_programmable(regmap, name, hw = at91_clk_register_programmable(regmap, name,
parent_names, 5, i, parent_names, NULL, 5, i,
&at91sam9x5_programmable_layout, &at91sam9x5_programmable_layout,
NULL); NULL);
if (IS_ERR(hw)) if (IS_ERR(hw))
...@@ -227,7 +227,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np) ...@@ -227,7 +227,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
for (i = 0; i < ARRAY_SIZE(at91sam9n12_systemck); i++) { for (i = 0; i < ARRAY_SIZE(at91sam9n12_systemck); i++) {
hw = at91_clk_register_system(regmap, at91sam9n12_systemck[i].n, hw = at91_clk_register_system(regmap, at91sam9n12_systemck[i].n,
at91sam9n12_systemck[i].p, at91sam9n12_systemck[i].p, NULL,
at91sam9n12_systemck[i].id, at91sam9n12_systemck[i].id,
at91sam9n12_systemck[i].flags); at91sam9n12_systemck[i].flags);
if (IS_ERR(hw)) if (IS_ERR(hw))
...@@ -240,7 +240,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np) ...@@ -240,7 +240,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
hw = at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock, hw = at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock,
&at91sam9n12_pcr_layout, &at91sam9n12_pcr_layout,
at91sam9n12_periphck[i].n, at91sam9n12_periphck[i].n,
"masterck_div", "masterck_div", NULL,
at91sam9n12_periphck[i].id, at91sam9n12_periphck[i].id,
&range, INT_MIN, 0); &range, INT_MIN, 0);
if (IS_ERR(hw)) if (IS_ERR(hw))
......
...@@ -95,7 +95,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np) ...@@ -95,7 +95,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np)
if (!at91sam9rl_pmc) if (!at91sam9rl_pmc)
return; return;
hw = at91_clk_register_rm9200_main(regmap, "mainck", mainxtal_name); hw = at91_clk_register_rm9200_main(regmap, "mainck", mainxtal_name, NULL);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
...@@ -109,7 +109,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np) ...@@ -109,7 +109,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np)
at91sam9rl_pmc->chws[PMC_PLLACK] = hw; at91sam9rl_pmc->chws[PMC_PLLACK] = hw;
hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck"); hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck", NULL);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
...@@ -120,7 +120,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np) ...@@ -120,7 +120,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np)
parent_names[2] = "pllack"; parent_names[2] = "pllack";
parent_names[3] = "utmick"; parent_names[3] = "utmick";
hw = at91_clk_register_master_pres(regmap, "masterck_pres", 4, hw = at91_clk_register_master_pres(regmap, "masterck_pres", 4,
parent_names, parent_names, NULL,
&at91rm9200_master_layout, &at91rm9200_master_layout,
&sam9rl_mck_characteristics, &sam9rl_mck_characteristics,
&sam9rl_mck_lock); &sam9rl_mck_lock);
...@@ -128,7 +128,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np) ...@@ -128,7 +128,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np)
goto err_free; goto err_free;
hw = at91_clk_register_master_div(regmap, "masterck_div", hw = at91_clk_register_master_div(regmap, "masterck_div",
"masterck_pres", "masterck_pres", NULL,
&at91rm9200_master_layout, &at91rm9200_master_layout,
&sam9rl_mck_characteristics, &sam9rl_mck_characteristics,
&sam9rl_mck_lock, CLK_SET_RATE_GATE, 0); &sam9rl_mck_lock, CLK_SET_RATE_GATE, 0);
...@@ -148,7 +148,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np) ...@@ -148,7 +148,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np)
snprintf(name, sizeof(name), "prog%d", i); snprintf(name, sizeof(name), "prog%d", i);
hw = at91_clk_register_programmable(regmap, name, hw = at91_clk_register_programmable(regmap, name,
parent_names, 5, i, parent_names, NULL, 5, i,
&at91rm9200_programmable_layout, &at91rm9200_programmable_layout,
NULL); NULL);
if (IS_ERR(hw)) if (IS_ERR(hw))
...@@ -159,7 +159,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np) ...@@ -159,7 +159,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np)
for (i = 0; i < ARRAY_SIZE(at91sam9rl_systemck); i++) { for (i = 0; i < ARRAY_SIZE(at91sam9rl_systemck); i++) {
hw = at91_clk_register_system(regmap, at91sam9rl_systemck[i].n, hw = at91_clk_register_system(regmap, at91sam9rl_systemck[i].n,
at91sam9rl_systemck[i].p, at91sam9rl_systemck[i].p, NULL,
at91sam9rl_systemck[i].id, 0); at91sam9rl_systemck[i].id, 0);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
...@@ -170,7 +170,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np) ...@@ -170,7 +170,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np)
for (i = 0; i < ARRAY_SIZE(at91sam9rl_periphck); i++) { for (i = 0; i < ARRAY_SIZE(at91sam9rl_periphck); i++) {
hw = at91_clk_register_peripheral(regmap, hw = at91_clk_register_peripheral(regmap,
at91sam9rl_periphck[i].n, at91sam9rl_periphck[i].n,
"masterck_div", "masterck_div", NULL,
at91sam9rl_periphck[i].id); at91sam9rl_periphck[i].id);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
......
...@@ -169,14 +169,14 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np, ...@@ -169,14 +169,14 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
bypass = of_property_read_bool(np, "atmel,osc-bypass"); bypass = of_property_read_bool(np, "atmel,osc-bypass");
hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, NULL,
bypass); bypass);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
parent_names[0] = "main_rc_osc"; parent_names[0] = "main_rc_osc";
parent_names[1] = "main_osc"; parent_names[1] = "main_osc";
hw = at91_clk_register_sam9x5_main(regmap, "mainck", parent_names, 2); hw = at91_clk_register_sam9x5_main(regmap, "mainck", parent_names, NULL, 2);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
...@@ -193,7 +193,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np, ...@@ -193,7 +193,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
at91sam9x5_pmc->chws[PMC_PLLACK] = hw; at91sam9x5_pmc->chws[PMC_PLLACK] = hw;
hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck"); hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck", NULL);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
...@@ -204,14 +204,14 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np, ...@@ -204,14 +204,14 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
parent_names[2] = "plladivck"; parent_names[2] = "plladivck";
parent_names[3] = "utmick"; parent_names[3] = "utmick";
hw = at91_clk_register_master_pres(regmap, "masterck_pres", 4, hw = at91_clk_register_master_pres(regmap, "masterck_pres", 4,
parent_names, parent_names, NULL,
&at91sam9x5_master_layout, &at91sam9x5_master_layout,
&mck_characteristics, &mck_lock); &mck_characteristics, &mck_lock);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
hw = at91_clk_register_master_div(regmap, "masterck_div", hw = at91_clk_register_master_div(regmap, "masterck_div",
"masterck_pres", "masterck_pres", NULL,
&at91sam9x5_master_layout, &at91sam9x5_master_layout,
&mck_characteristics, &mck_lock, &mck_characteristics, &mck_lock,
CLK_SET_RATE_GATE, 0); CLK_SET_RATE_GATE, 0);
...@@ -241,7 +241,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np, ...@@ -241,7 +241,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
snprintf(name, sizeof(name), "prog%d", i); snprintf(name, sizeof(name), "prog%d", i);
hw = at91_clk_register_programmable(regmap, name, hw = at91_clk_register_programmable(regmap, name,
parent_names, 5, i, parent_names, NULL, 5, i,
&at91sam9x5_programmable_layout, &at91sam9x5_programmable_layout,
NULL); NULL);
if (IS_ERR(hw)) if (IS_ERR(hw))
...@@ -252,7 +252,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np, ...@@ -252,7 +252,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
for (i = 0; i < ARRAY_SIZE(at91sam9x5_systemck); i++) { for (i = 0; i < ARRAY_SIZE(at91sam9x5_systemck); i++) {
hw = at91_clk_register_system(regmap, at91sam9x5_systemck[i].n, hw = at91_clk_register_system(regmap, at91sam9x5_systemck[i].n,
at91sam9x5_systemck[i].p, at91sam9x5_systemck[i].p, NULL,
at91sam9x5_systemck[i].id, at91sam9x5_systemck[i].id,
at91sam9x5_systemck[i].flags); at91sam9x5_systemck[i].flags);
if (IS_ERR(hw)) if (IS_ERR(hw))
...@@ -263,7 +263,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np, ...@@ -263,7 +263,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
if (has_lcdck) { if (has_lcdck) {
hw = at91_clk_register_system(regmap, "lcdck", "masterck_div", hw = at91_clk_register_system(regmap, "lcdck", "masterck_div",
3, 0); NULL, 3, 0);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
...@@ -274,7 +274,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np, ...@@ -274,7 +274,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
hw = at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock, hw = at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock,
&at91sam9x5_pcr_layout, &at91sam9x5_pcr_layout,
at91sam9x5_periphck[i].n, at91sam9x5_periphck[i].n,
"masterck_div", "masterck_div", NULL,
at91sam9x5_periphck[i].id, at91sam9x5_periphck[i].id,
&range, INT_MIN, 0); &range, INT_MIN, 0);
if (IS_ERR(hw)) if (IS_ERR(hw))
...@@ -287,7 +287,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np, ...@@ -287,7 +287,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
hw = at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock, hw = at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock,
&at91sam9x5_pcr_layout, &at91sam9x5_pcr_layout,
extra_pcks[i].n, extra_pcks[i].n,
"masterck_div", "masterck_div", NULL,
extra_pcks[i].id, extra_pcks[i].id,
&range, INT_MIN, 0); &range, INT_MIN, 0);
if (IS_ERR(hw)) if (IS_ERR(hw))
......
...@@ -319,21 +319,28 @@ struct clk_hw * __init ...@@ -319,21 +319,28 @@ struct clk_hw * __init
at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock, at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock,
const struct clk_pcr_layout *layout, const struct clk_pcr_layout *layout,
const char *name, const char **parent_names, const char *name, const char **parent_names,
struct clk_hw **parent_hws,
u32 *mux_table, u8 num_parents, u8 id, u32 *mux_table, u8 num_parents, u8 id,
const struct clk_range *range, const struct clk_range *range,
int chg_pid) int chg_pid)
{ {
struct clk_generated *gck; struct clk_generated *gck;
struct clk_init_data init; struct clk_init_data init = {};
struct clk_hw *hw; struct clk_hw *hw;
int ret; int ret;
if (!(parent_names || parent_hws))
return ERR_PTR(-ENOMEM);
gck = kzalloc(sizeof(*gck), GFP_KERNEL); gck = kzalloc(sizeof(*gck), GFP_KERNEL);
if (!gck) if (!gck)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
init.name = name; init.name = name;
init.ops = &generated_ops; init.ops = &generated_ops;
if (parent_hws)
init.parent_hws = (const struct clk_hw **)parent_hws;
else
init.parent_names = parent_names; init.parent_names = parent_names;
init.num_parents = num_parents; init.num_parents = num_parents;
init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE; init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE;
......
...@@ -152,14 +152,15 @@ struct clk_hw * __init ...@@ -152,14 +152,15 @@ struct clk_hw * __init
at91_clk_register_main_osc(struct regmap *regmap, at91_clk_register_main_osc(struct regmap *regmap,
const char *name, const char *name,
const char *parent_name, const char *parent_name,
struct clk_parent_data *parent_data,
bool bypass) bool bypass)
{ {
struct clk_main_osc *osc; struct clk_main_osc *osc;
struct clk_init_data init; struct clk_init_data init = {};
struct clk_hw *hw; struct clk_hw *hw;
int ret; int ret;
if (!name || !parent_name) if (!name || !(parent_name || parent_data))
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
osc = kzalloc(sizeof(*osc), GFP_KERNEL); osc = kzalloc(sizeof(*osc), GFP_KERNEL);
...@@ -168,6 +169,9 @@ at91_clk_register_main_osc(struct regmap *regmap, ...@@ -168,6 +169,9 @@ at91_clk_register_main_osc(struct regmap *regmap,
init.name = name; init.name = name;
init.ops = &main_osc_ops; init.ops = &main_osc_ops;
if (parent_data)
init.parent_data = (const struct clk_parent_data *)parent_data;
else
init.parent_names = &parent_name; init.parent_names = &parent_name;
init.num_parents = 1; init.num_parents = 1;
init.flags = CLK_IGNORE_UNUSED; init.flags = CLK_IGNORE_UNUSED;
...@@ -397,17 +401,18 @@ static const struct clk_ops rm9200_main_ops = { ...@@ -397,17 +401,18 @@ static const struct clk_ops rm9200_main_ops = {
struct clk_hw * __init struct clk_hw * __init
at91_clk_register_rm9200_main(struct regmap *regmap, at91_clk_register_rm9200_main(struct regmap *regmap,
const char *name, const char *name,
const char *parent_name) const char *parent_name,
struct clk_hw *parent_hw)
{ {
struct clk_rm9200_main *clkmain; struct clk_rm9200_main *clkmain;
struct clk_init_data init; struct clk_init_data init = {};
struct clk_hw *hw; struct clk_hw *hw;
int ret; int ret;
if (!name) if (!name)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
if (!parent_name) if (!(parent_name || parent_hw))
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
clkmain = kzalloc(sizeof(*clkmain), GFP_KERNEL); clkmain = kzalloc(sizeof(*clkmain), GFP_KERNEL);
...@@ -416,6 +421,9 @@ at91_clk_register_rm9200_main(struct regmap *regmap, ...@@ -416,6 +421,9 @@ at91_clk_register_rm9200_main(struct regmap *regmap,
init.name = name; init.name = name;
init.ops = &rm9200_main_ops; init.ops = &rm9200_main_ops;
if (parent_hw)
init.parent_hws = (const struct clk_hw **)&parent_hw;
else
init.parent_names = &parent_name; init.parent_names = &parent_name;
init.num_parents = 1; init.num_parents = 1;
init.flags = 0; init.flags = 0;
...@@ -543,10 +551,11 @@ struct clk_hw * __init ...@@ -543,10 +551,11 @@ struct clk_hw * __init
at91_clk_register_sam9x5_main(struct regmap *regmap, at91_clk_register_sam9x5_main(struct regmap *regmap,
const char *name, const char *name,
const char **parent_names, const char **parent_names,
struct clk_hw **parent_hws,
int num_parents) int num_parents)
{ {
struct clk_sam9x5_main *clkmain; struct clk_sam9x5_main *clkmain;
struct clk_init_data init; struct clk_init_data init = {};
unsigned int status; unsigned int status;
struct clk_hw *hw; struct clk_hw *hw;
int ret; int ret;
...@@ -554,7 +563,7 @@ at91_clk_register_sam9x5_main(struct regmap *regmap, ...@@ -554,7 +563,7 @@ at91_clk_register_sam9x5_main(struct regmap *regmap,
if (!name) if (!name)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
if (!parent_names || !num_parents) if (!(parent_hws || parent_names) || !num_parents)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
clkmain = kzalloc(sizeof(*clkmain), GFP_KERNEL); clkmain = kzalloc(sizeof(*clkmain), GFP_KERNEL);
...@@ -563,6 +572,9 @@ at91_clk_register_sam9x5_main(struct regmap *regmap, ...@@ -563,6 +572,9 @@ at91_clk_register_sam9x5_main(struct regmap *regmap,
init.name = name; init.name = name;
init.ops = &sam9x5_main_ops; init.ops = &sam9x5_main_ops;
if (parent_hws)
init.parent_hws = (const struct clk_hw **)parent_hws;
else
init.parent_names = parent_names; init.parent_names = parent_names;
init.num_parents = num_parents; init.num_parents = num_parents;
init.flags = CLK_SET_PARENT_GATE; init.flags = CLK_SET_PARENT_GATE;
......
...@@ -473,18 +473,19 @@ static struct clk_hw * __init ...@@ -473,18 +473,19 @@ static struct clk_hw * __init
at91_clk_register_master_internal(struct regmap *regmap, at91_clk_register_master_internal(struct regmap *regmap,
const char *name, int num_parents, const char *name, int num_parents,
const char **parent_names, const char **parent_names,
struct clk_hw **parent_hws,
const struct clk_master_layout *layout, const struct clk_master_layout *layout,
const struct clk_master_characteristics *characteristics, const struct clk_master_characteristics *characteristics,
const struct clk_ops *ops, spinlock_t *lock, u32 flags) const struct clk_ops *ops, spinlock_t *lock, u32 flags)
{ {
struct clk_master *master; struct clk_master *master;
struct clk_init_data init; struct clk_init_data init = {};
struct clk_hw *hw; struct clk_hw *hw;
unsigned int mckr; unsigned int mckr;
unsigned long irqflags; unsigned long irqflags;
int ret; int ret;
if (!name || !num_parents || !parent_names || !lock) if (!name || !num_parents || !(parent_names || parent_hws) || !lock)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
master = kzalloc(sizeof(*master), GFP_KERNEL); master = kzalloc(sizeof(*master), GFP_KERNEL);
...@@ -493,6 +494,9 @@ at91_clk_register_master_internal(struct regmap *regmap, ...@@ -493,6 +494,9 @@ at91_clk_register_master_internal(struct regmap *regmap,
init.name = name; init.name = name;
init.ops = ops; init.ops = ops;
if (parent_hws)
init.parent_hws = (const struct clk_hw **)parent_hws;
else
init.parent_names = parent_names; init.parent_names = parent_names;
init.num_parents = num_parents; init.num_parents = num_parents;
init.flags = flags; init.flags = flags;
...@@ -527,12 +531,13 @@ struct clk_hw * __init ...@@ -527,12 +531,13 @@ struct clk_hw * __init
at91_clk_register_master_pres(struct regmap *regmap, at91_clk_register_master_pres(struct regmap *regmap,
const char *name, int num_parents, const char *name, int num_parents,
const char **parent_names, const char **parent_names,
struct clk_hw **parent_hws,
const struct clk_master_layout *layout, const struct clk_master_layout *layout,
const struct clk_master_characteristics *characteristics, const struct clk_master_characteristics *characteristics,
spinlock_t *lock) spinlock_t *lock)
{ {
return at91_clk_register_master_internal(regmap, name, num_parents, return at91_clk_register_master_internal(regmap, name, num_parents,
parent_names, layout, parent_names, parent_hws, layout,
characteristics, characteristics,
&master_pres_ops, &master_pres_ops,
lock, CLK_SET_RATE_GATE); lock, CLK_SET_RATE_GATE);
...@@ -541,7 +546,7 @@ at91_clk_register_master_pres(struct regmap *regmap, ...@@ -541,7 +546,7 @@ at91_clk_register_master_pres(struct regmap *regmap,
struct clk_hw * __init struct clk_hw * __init
at91_clk_register_master_div(struct regmap *regmap, at91_clk_register_master_div(struct regmap *regmap,
const char *name, const char *parent_name, const char *name, const char *parent_name,
const struct clk_master_layout *layout, struct clk_hw *parent_hw, const struct clk_master_layout *layout,
const struct clk_master_characteristics *characteristics, const struct clk_master_characteristics *characteristics,
spinlock_t *lock, u32 flags, u32 safe_div) spinlock_t *lock, u32 flags, u32 safe_div)
{ {
...@@ -554,7 +559,8 @@ at91_clk_register_master_div(struct regmap *regmap, ...@@ -554,7 +559,8 @@ at91_clk_register_master_div(struct regmap *regmap,
ops = &master_div_ops_chg; ops = &master_div_ops_chg;
hw = at91_clk_register_master_internal(regmap, name, 1, hw = at91_clk_register_master_internal(regmap, name, 1,
&parent_name, layout, parent_name ? &parent_name : NULL,
parent_hw ? &parent_hw : NULL, layout,
characteristics, ops, characteristics, ops,
lock, flags); lock, flags);
...@@ -806,18 +812,19 @@ struct clk_hw * __init ...@@ -806,18 +812,19 @@ struct clk_hw * __init
at91_clk_sama7g5_register_master(struct regmap *regmap, at91_clk_sama7g5_register_master(struct regmap *regmap,
const char *name, int num_parents, const char *name, int num_parents,
const char **parent_names, const char **parent_names,
struct clk_hw **parent_hws,
u32 *mux_table, u32 *mux_table,
spinlock_t *lock, u8 id, spinlock_t *lock, u8 id,
bool critical, int chg_pid) bool critical, int chg_pid)
{ {
struct clk_master *master; struct clk_master *master;
struct clk_hw *hw; struct clk_hw *hw;
struct clk_init_data init; struct clk_init_data init = {};
unsigned long flags; unsigned long flags;
unsigned int val; unsigned int val;
int ret; int ret;
if (!name || !num_parents || !parent_names || !mux_table || if (!name || !num_parents || !(parent_names || parent_hws) || !mux_table ||
!lock || id > MASTER_MAX_ID) !lock || id > MASTER_MAX_ID)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
...@@ -827,6 +834,9 @@ at91_clk_sama7g5_register_master(struct regmap *regmap, ...@@ -827,6 +834,9 @@ at91_clk_sama7g5_register_master(struct regmap *regmap,
init.name = name; init.name = name;
init.ops = &sama7g5_master_ops; init.ops = &sama7g5_master_ops;
if (parent_hws)
init.parent_hws = (const struct clk_hw **)parent_hws;
else
init.parent_names = parent_names; init.parent_names = parent_names;
init.num_parents = num_parents; init.num_parents = num_parents;
init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE; init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE;
......
...@@ -97,14 +97,15 @@ static const struct clk_ops peripheral_ops = { ...@@ -97,14 +97,15 @@ static const struct clk_ops peripheral_ops = {
struct clk_hw * __init struct clk_hw * __init
at91_clk_register_peripheral(struct regmap *regmap, const char *name, at91_clk_register_peripheral(struct regmap *regmap, const char *name,
const char *parent_name, u32 id) const char *parent_name, struct clk_hw *parent_hw,
u32 id)
{ {
struct clk_peripheral *periph; struct clk_peripheral *periph;
struct clk_init_data init; struct clk_init_data init = {};
struct clk_hw *hw; struct clk_hw *hw;
int ret; int ret;
if (!name || !parent_name || id > PERIPHERAL_ID_MAX) if (!name || !(parent_name || parent_hw) || id > PERIPHERAL_ID_MAX)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
periph = kzalloc(sizeof(*periph), GFP_KERNEL); periph = kzalloc(sizeof(*periph), GFP_KERNEL);
...@@ -113,6 +114,9 @@ at91_clk_register_peripheral(struct regmap *regmap, const char *name, ...@@ -113,6 +114,9 @@ at91_clk_register_peripheral(struct regmap *regmap, const char *name,
init.name = name; init.name = name;
init.ops = &peripheral_ops; init.ops = &peripheral_ops;
if (parent_hw)
init.parent_hws = (const struct clk_hw **)&parent_hw;
else
init.parent_names = &parent_name; init.parent_names = &parent_name;
init.num_parents = 1; init.num_parents = 1;
init.flags = 0; init.flags = 0;
...@@ -444,15 +448,16 @@ struct clk_hw * __init ...@@ -444,15 +448,16 @@ struct clk_hw * __init
at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *lock, at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *lock,
const struct clk_pcr_layout *layout, const struct clk_pcr_layout *layout,
const char *name, const char *parent_name, const char *name, const char *parent_name,
struct clk_hw *parent_hw,
u32 id, const struct clk_range *range, u32 id, const struct clk_range *range,
int chg_pid, unsigned long flags) int chg_pid, unsigned long flags)
{ {
struct clk_sam9x5_peripheral *periph; struct clk_sam9x5_peripheral *periph;
struct clk_init_data init; struct clk_init_data init = {};
struct clk_hw *hw; struct clk_hw *hw;
int ret; int ret;
if (!name || !parent_name) if (!name || !(parent_name || parent_hw))
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
periph = kzalloc(sizeof(*periph), GFP_KERNEL); periph = kzalloc(sizeof(*periph), GFP_KERNEL);
...@@ -460,6 +465,9 @@ at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *lock, ...@@ -460,6 +465,9 @@ at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *lock,
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
init.name = name; init.name = name;
if (parent_hw)
init.parent_hws = (const struct clk_hw **)&parent_hw;
else
init.parent_names = &parent_name; init.parent_names = &parent_name;
init.num_parents = 1; init.num_parents = 1;
init.flags = flags; init.flags = flags;
......
...@@ -215,16 +215,16 @@ static const struct clk_ops programmable_ops = { ...@@ -215,16 +215,16 @@ static const struct clk_ops programmable_ops = {
struct clk_hw * __init struct clk_hw * __init
at91_clk_register_programmable(struct regmap *regmap, at91_clk_register_programmable(struct regmap *regmap,
const char *name, const char **parent_names, const char *name, const char **parent_names,
u8 num_parents, u8 id, struct clk_hw **parent_hws, u8 num_parents, u8 id,
const struct clk_programmable_layout *layout, const struct clk_programmable_layout *layout,
u32 *mux_table) u32 *mux_table)
{ {
struct clk_programmable *prog; struct clk_programmable *prog;
struct clk_hw *hw; struct clk_hw *hw;
struct clk_init_data init; struct clk_init_data init = {};
int ret; int ret;
if (id > PROG_ID_MAX) if (id > PROG_ID_MAX || !(parent_names || parent_hws))
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
prog = kzalloc(sizeof(*prog), GFP_KERNEL); prog = kzalloc(sizeof(*prog), GFP_KERNEL);
...@@ -233,6 +233,9 @@ at91_clk_register_programmable(struct regmap *regmap, ...@@ -233,6 +233,9 @@ at91_clk_register_programmable(struct regmap *regmap,
init.name = name; init.name = name;
init.ops = &programmable_ops; init.ops = &programmable_ops;
if (parent_hws)
init.parent_hws = (const struct clk_hw **)parent_hws;
else
init.parent_names = parent_names; init.parent_names = parent_names;
init.num_parents = num_parents; init.num_parents = num_parents;
init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE; init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE;
......
...@@ -616,7 +616,7 @@ sam9x60_clk_register_frac_pll(struct regmap *regmap, spinlock_t *lock, ...@@ -616,7 +616,7 @@ sam9x60_clk_register_frac_pll(struct regmap *regmap, spinlock_t *lock,
{ {
struct sam9x60_frac *frac; struct sam9x60_frac *frac;
struct clk_hw *hw; struct clk_hw *hw;
struct clk_init_data init; struct clk_init_data init = {};
unsigned long parent_rate, irqflags; unsigned long parent_rate, irqflags;
unsigned int val; unsigned int val;
int ret; int ret;
...@@ -629,7 +629,10 @@ sam9x60_clk_register_frac_pll(struct regmap *regmap, spinlock_t *lock, ...@@ -629,7 +629,10 @@ sam9x60_clk_register_frac_pll(struct regmap *regmap, spinlock_t *lock,
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
init.name = name; init.name = name;
if (parent_name)
init.parent_names = &parent_name; init.parent_names = &parent_name;
else
init.parent_hws = (const struct clk_hw **)&parent_hw;
init.num_parents = 1; init.num_parents = 1;
if (flags & CLK_SET_RATE_GATE) if (flags & CLK_SET_RATE_GATE)
init.ops = &sam9x60_frac_pll_ops; init.ops = &sam9x60_frac_pll_ops;
...@@ -692,14 +695,15 @@ sam9x60_clk_register_frac_pll(struct regmap *regmap, spinlock_t *lock, ...@@ -692,14 +695,15 @@ sam9x60_clk_register_frac_pll(struct regmap *regmap, spinlock_t *lock,
struct clk_hw * __init struct clk_hw * __init
sam9x60_clk_register_div_pll(struct regmap *regmap, spinlock_t *lock, sam9x60_clk_register_div_pll(struct regmap *regmap, spinlock_t *lock,
const char *name, const char *parent_name, u8 id, const char *name, const char *parent_name,
struct clk_hw *parent_hw, u8 id,
const struct clk_pll_characteristics *characteristics, const struct clk_pll_characteristics *characteristics,
const struct clk_pll_layout *layout, u32 flags, const struct clk_pll_layout *layout, u32 flags,
u32 safe_div) u32 safe_div)
{ {
struct sam9x60_div *div; struct sam9x60_div *div;
struct clk_hw *hw; struct clk_hw *hw;
struct clk_init_data init; struct clk_init_data init = {};
unsigned long irqflags; unsigned long irqflags;
unsigned int val; unsigned int val;
int ret; int ret;
...@@ -716,6 +720,9 @@ sam9x60_clk_register_div_pll(struct regmap *regmap, spinlock_t *lock, ...@@ -716,6 +720,9 @@ sam9x60_clk_register_div_pll(struct regmap *regmap, spinlock_t *lock,
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
init.name = name; init.name = name;
if (parent_hw)
init.parent_hws = (const struct clk_hw **)&parent_hw;
else
init.parent_names = &parent_name; init.parent_names = &parent_name;
init.num_parents = 1; init.num_parents = 1;
if (flags & CLK_SET_RATE_GATE) if (flags & CLK_SET_RATE_GATE)
......
...@@ -105,14 +105,15 @@ static const struct clk_ops system_ops = { ...@@ -105,14 +105,15 @@ static const struct clk_ops system_ops = {
struct clk_hw * __init struct clk_hw * __init
at91_clk_register_system(struct regmap *regmap, const char *name, at91_clk_register_system(struct regmap *regmap, const char *name,
const char *parent_name, u8 id, unsigned long flags) const char *parent_name, struct clk_hw *parent_hw, u8 id,
unsigned long flags)
{ {
struct clk_system *sys; struct clk_system *sys;
struct clk_hw *hw; struct clk_hw *hw;
struct clk_init_data init; struct clk_init_data init = {};
int ret; int ret;
if (!parent_name || id > SYSTEM_MAX_ID) if (!(parent_name || parent_hw) || id > SYSTEM_MAX_ID)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
sys = kzalloc(sizeof(*sys), GFP_KERNEL); sys = kzalloc(sizeof(*sys), GFP_KERNEL);
...@@ -121,6 +122,9 @@ at91_clk_register_system(struct regmap *regmap, const char *name, ...@@ -121,6 +122,9 @@ at91_clk_register_system(struct regmap *regmap, const char *name,
init.name = name; init.name = name;
init.ops = &system_ops; init.ops = &system_ops;
if (parent_hw)
init.parent_hws = (const struct clk_hw **)&parent_hw;
else
init.parent_names = &parent_name; init.parent_names = &parent_name;
init.num_parents = 1; init.num_parents = 1;
init.flags = CLK_SET_RATE_PARENT | flags; init.flags = CLK_SET_RATE_PARENT | flags;
......
...@@ -144,21 +144,30 @@ static struct clk_hw * __init ...@@ -144,21 +144,30 @@ static struct clk_hw * __init
at91_clk_register_utmi_internal(struct regmap *regmap_pmc, at91_clk_register_utmi_internal(struct regmap *regmap_pmc,
struct regmap *regmap_sfr, struct regmap *regmap_sfr,
const char *name, const char *parent_name, const char *name, const char *parent_name,
struct clk_hw *parent_hw,
const struct clk_ops *ops, unsigned long flags) const struct clk_ops *ops, unsigned long flags)
{ {
struct clk_utmi *utmi; struct clk_utmi *utmi;
struct clk_hw *hw; struct clk_hw *hw;
struct clk_init_data init; struct clk_init_data init = {};
int ret; int ret;
if (!(parent_name || parent_hw))
return ERR_PTR(-EINVAL);
utmi = kzalloc(sizeof(*utmi), GFP_KERNEL); utmi = kzalloc(sizeof(*utmi), GFP_KERNEL);
if (!utmi) if (!utmi)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
init.name = name; init.name = name;
init.ops = ops; 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.parent_names = parent_name ? &parent_name : NULL;
init.num_parents = parent_name ? 1 : 0; init.num_parents = parent_name ? 1 : 0;
}
init.flags = flags; init.flags = flags;
utmi->hw.init = &init; utmi->hw.init = &init;
...@@ -177,10 +186,11 @@ at91_clk_register_utmi_internal(struct regmap *regmap_pmc, ...@@ -177,10 +186,11 @@ at91_clk_register_utmi_internal(struct regmap *regmap_pmc,
struct clk_hw * __init struct clk_hw * __init
at91_clk_register_utmi(struct regmap *regmap_pmc, struct regmap *regmap_sfr, at91_clk_register_utmi(struct regmap *regmap_pmc, struct regmap *regmap_sfr,
const char *name, const char *parent_name) const char *name, const char *parent_name,
struct clk_hw *parent_hw)
{ {
return at91_clk_register_utmi_internal(regmap_pmc, regmap_sfr, name, return at91_clk_register_utmi_internal(regmap_pmc, regmap_sfr, name,
parent_name, &utmi_ops, CLK_SET_RATE_GATE); parent_name, parent_hw, &utmi_ops, CLK_SET_RATE_GATE);
} }
static int clk_utmi_sama7g5_prepare(struct clk_hw *hw) static int clk_utmi_sama7g5_prepare(struct clk_hw *hw)
...@@ -279,8 +289,8 @@ static const struct clk_ops sama7g5_utmi_ops = { ...@@ -279,8 +289,8 @@ static const struct clk_ops sama7g5_utmi_ops = {
struct clk_hw * __init struct clk_hw * __init
at91_clk_sama7g5_register_utmi(struct regmap *regmap_pmc, const char *name, at91_clk_sama7g5_register_utmi(struct regmap *regmap_pmc, const char *name,
const char *parent_name) const char *parent_name, struct clk_hw *parent_hw)
{ {
return at91_clk_register_utmi_internal(regmap_pmc, NULL, name, return at91_clk_register_utmi_internal(regmap_pmc, NULL, name,
parent_name, &sama7g5_utmi_ops, 0); parent_name, parent_hw, &sama7g5_utmi_ops, 0);
} }
...@@ -171,7 +171,7 @@ static void __init of_sama5d2_clk_generated_setup(struct device_node *np) ...@@ -171,7 +171,7 @@ static void __init of_sama5d2_clk_generated_setup(struct device_node *np)
hw = at91_clk_register_generated(regmap, &pmc_pcr_lock, hw = at91_clk_register_generated(regmap, &pmc_pcr_lock,
&dt_pcr_layout, name, &dt_pcr_layout, name,
parent_names, NULL, parent_names, NULL, NULL,
num_parents, id, &range, num_parents, id, &range,
chg_pid); chg_pid);
if (IS_ERR(hw)) if (IS_ERR(hw))
...@@ -269,7 +269,7 @@ static void __init of_at91rm9200_clk_main_osc_setup(struct device_node *np) ...@@ -269,7 +269,7 @@ static void __init of_at91rm9200_clk_main_osc_setup(struct device_node *np)
if (IS_ERR(regmap)) if (IS_ERR(regmap))
return; return;
hw = at91_clk_register_main_osc(regmap, name, parent_name, bypass); hw = at91_clk_register_main_osc(regmap, name, parent_name, NULL, bypass);
if (IS_ERR(hw)) if (IS_ERR(hw))
return; return;
...@@ -323,7 +323,7 @@ static void __init of_at91rm9200_clk_main_setup(struct device_node *np) ...@@ -323,7 +323,7 @@ static void __init of_at91rm9200_clk_main_setup(struct device_node *np)
if (IS_ERR(regmap)) if (IS_ERR(regmap))
return; return;
hw = at91_clk_register_rm9200_main(regmap, name, parent_name); hw = at91_clk_register_rm9200_main(regmap, name, parent_name, NULL);
if (IS_ERR(hw)) if (IS_ERR(hw))
return; return;
...@@ -354,7 +354,7 @@ static void __init of_at91sam9x5_clk_main_setup(struct device_node *np) ...@@ -354,7 +354,7 @@ static void __init of_at91sam9x5_clk_main_setup(struct device_node *np)
of_property_read_string(np, "clock-output-names", &name); of_property_read_string(np, "clock-output-names", &name);
hw = at91_clk_register_sam9x5_main(regmap, name, parent_names, hw = at91_clk_register_sam9x5_main(regmap, name, parent_names, NULL,
num_parents); num_parents);
if (IS_ERR(hw)) if (IS_ERR(hw))
return; return;
...@@ -420,12 +420,12 @@ of_at91_clk_master_setup(struct device_node *np, ...@@ -420,12 +420,12 @@ of_at91_clk_master_setup(struct device_node *np,
return; return;
hw = at91_clk_register_master_pres(regmap, "masterck_pres", num_parents, hw = at91_clk_register_master_pres(regmap, "masterck_pres", num_parents,
parent_names, layout, parent_names, NULL, layout,
characteristics, &mck_lock); characteristics, &mck_lock);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto out_free_characteristics; goto out_free_characteristics;
hw = at91_clk_register_master_div(regmap, name, "masterck_pres", hw = at91_clk_register_master_div(regmap, name, "masterck_pres", NULL,
layout, characteristics, layout, characteristics,
&mck_lock, CLK_SET_RATE_GATE, 0); &mck_lock, CLK_SET_RATE_GATE, 0);
if (IS_ERR(hw)) if (IS_ERR(hw))
...@@ -490,7 +490,7 @@ of_at91_clk_periph_setup(struct device_node *np, u8 type) ...@@ -490,7 +490,7 @@ of_at91_clk_periph_setup(struct device_node *np, u8 type)
if (type == PERIPHERAL_AT91RM9200) { if (type == PERIPHERAL_AT91RM9200) {
hw = at91_clk_register_peripheral(regmap, name, hw = at91_clk_register_peripheral(regmap, name,
parent_name, id); parent_name, NULL, id);
} else { } else {
struct clk_range range = CLK_RANGE(0, 0); struct clk_range range = CLK_RANGE(0, 0);
unsigned long flags = 0; unsigned long flags = 0;
...@@ -512,6 +512,7 @@ of_at91_clk_periph_setup(struct device_node *np, u8 type) ...@@ -512,6 +512,7 @@ of_at91_clk_periph_setup(struct device_node *np, u8 type)
&dt_pcr_layout, &dt_pcr_layout,
name, name,
parent_name, parent_name,
NULL,
id, &range, id, &range,
INT_MIN, INT_MIN,
flags); flags);
...@@ -769,7 +770,7 @@ of_at91_clk_prog_setup(struct device_node *np, ...@@ -769,7 +770,7 @@ of_at91_clk_prog_setup(struct device_node *np,
name = progclknp->name; name = progclknp->name;
hw = at91_clk_register_programmable(regmap, name, hw = at91_clk_register_programmable(regmap, name,
parent_names, num_parents, parent_names, NULL, num_parents,
id, layout, mux_table); id, layout, mux_table);
if (IS_ERR(hw)) if (IS_ERR(hw))
continue; continue;
...@@ -907,8 +908,8 @@ static void __init of_at91rm9200_clk_sys_setup(struct device_node *np) ...@@ -907,8 +908,8 @@ static void __init of_at91rm9200_clk_sys_setup(struct device_node *np)
if (!strcmp(sysclknp->name, "ddrck")) if (!strcmp(sysclknp->name, "ddrck"))
flags = CLK_IS_CRITICAL; flags = CLK_IS_CRITICAL;
hw = at91_clk_register_system(regmap, name, parent_name, id, hw = at91_clk_register_system(regmap, name, parent_name, NULL,
flags); id, flags);
if (IS_ERR(hw)) if (IS_ERR(hw))
continue; continue;
...@@ -1054,7 +1055,7 @@ static void __init of_at91sam9x5_clk_utmi_setup(struct device_node *np) ...@@ -1054,7 +1055,7 @@ static void __init of_at91sam9x5_clk_utmi_setup(struct device_node *np)
regmap_sfr = NULL; regmap_sfr = NULL;
} }
hw = at91_clk_register_utmi(regmap_pmc, regmap_sfr, name, parent_name); hw = at91_clk_register_utmi(regmap_pmc, regmap_sfr, name, parent_name, NULL);
if (IS_ERR(hw)) if (IS_ERR(hw))
return; return;
......
...@@ -144,7 +144,8 @@ struct clk_hw * __init ...@@ -144,7 +144,8 @@ struct clk_hw * __init
at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock, at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock,
const struct clk_pcr_layout *layout, const struct clk_pcr_layout *layout,
const char *name, const char **parent_names, const char *name, const char **parent_names,
u32 *mux_table, u8 num_parents, u8 id, struct clk_hw **parent_hws, u32 *mux_table,
u8 num_parents, u8 id,
const struct clk_range *range, int chg_pid); const struct clk_range *range, int chg_pid);
struct clk_hw * __init struct clk_hw * __init
...@@ -161,25 +162,29 @@ at91_clk_register_main_rc_osc(struct regmap *regmap, const char *name, ...@@ -161,25 +162,29 @@ at91_clk_register_main_rc_osc(struct regmap *regmap, const char *name,
u32 frequency, u32 accuracy); u32 frequency, u32 accuracy);
struct clk_hw * __init struct clk_hw * __init
at91_clk_register_main_osc(struct regmap *regmap, const char *name, at91_clk_register_main_osc(struct regmap *regmap, const char *name,
const char *parent_name, bool bypass); const char *parent_name,
struct clk_parent_data *parent_data, bool bypass);
struct clk_hw * __init struct clk_hw * __init
at91_clk_register_rm9200_main(struct regmap *regmap, at91_clk_register_rm9200_main(struct regmap *regmap,
const char *name, const char *name,
const char *parent_name); const char *parent_name,
struct clk_hw *parent_hw);
struct clk_hw * __init struct clk_hw * __init
at91_clk_register_sam9x5_main(struct regmap *regmap, const char *name, at91_clk_register_sam9x5_main(struct regmap *regmap, const char *name,
const char **parent_names, int num_parents); const char **parent_names,
struct clk_hw **parent_hws, int num_parents);
struct clk_hw * __init struct clk_hw * __init
at91_clk_register_master_pres(struct regmap *regmap, const char *name, at91_clk_register_master_pres(struct regmap *regmap, const char *name,
int num_parents, const char **parent_names, int num_parents, const char **parent_names,
struct clk_hw **parent_hws,
const struct clk_master_layout *layout, const struct clk_master_layout *layout,
const struct clk_master_characteristics *characteristics, const struct clk_master_characteristics *characteristics,
spinlock_t *lock); spinlock_t *lock);
struct clk_hw * __init struct clk_hw * __init
at91_clk_register_master_div(struct regmap *regmap, const char *name, at91_clk_register_master_div(struct regmap *regmap, const char *name,
const char *parent_names, const char *parent_names, struct clk_hw *parent_hw,
const struct clk_master_layout *layout, const struct clk_master_layout *layout,
const struct clk_master_characteristics *characteristics, const struct clk_master_characteristics *characteristics,
spinlock_t *lock, u32 flags, u32 safe_div); spinlock_t *lock, u32 flags, u32 safe_div);
...@@ -187,17 +192,20 @@ at91_clk_register_master_div(struct regmap *regmap, const char *name, ...@@ -187,17 +192,20 @@ at91_clk_register_master_div(struct regmap *regmap, const char *name,
struct clk_hw * __init struct clk_hw * __init
at91_clk_sama7g5_register_master(struct regmap *regmap, at91_clk_sama7g5_register_master(struct regmap *regmap,
const char *name, int num_parents, const char *name, int num_parents,
const char **parent_names, u32 *mux_table, const char **parent_names,
struct clk_hw **parent_hws, u32 *mux_table,
spinlock_t *lock, u8 id, bool critical, spinlock_t *lock, u8 id, bool critical,
int chg_pid); int chg_pid);
struct clk_hw * __init struct clk_hw * __init
at91_clk_register_peripheral(struct regmap *regmap, const char *name, at91_clk_register_peripheral(struct regmap *regmap, const char *name,
const char *parent_name, u32 id); const char *parent_name, struct clk_hw *parent_hw,
u32 id);
struct clk_hw * __init struct clk_hw * __init
at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *lock, at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *lock,
const struct clk_pcr_layout *layout, const struct clk_pcr_layout *layout,
const char *name, const char *parent_name, const char *name, const char *parent_name,
struct clk_hw *parent_hw,
u32 id, const struct clk_range *range, u32 id, const struct clk_range *range,
int chg_pid, unsigned long flags); int chg_pid, unsigned long flags);
...@@ -212,7 +220,8 @@ at91_clk_register_plldiv(struct regmap *regmap, const char *name, ...@@ -212,7 +220,8 @@ at91_clk_register_plldiv(struct regmap *regmap, const char *name,
struct clk_hw * __init struct clk_hw * __init
sam9x60_clk_register_div_pll(struct regmap *regmap, spinlock_t *lock, sam9x60_clk_register_div_pll(struct regmap *regmap, spinlock_t *lock,
const char *name, const char *parent_name, u8 id, const char *name, const char *parent_name,
struct clk_hw *parent_hw, u8 id,
const struct clk_pll_characteristics *characteristics, const struct clk_pll_characteristics *characteristics,
const struct clk_pll_layout *layout, u32 flags, const struct clk_pll_layout *layout, u32 flags,
u32 safe_div); u32 safe_div);
...@@ -226,7 +235,8 @@ sam9x60_clk_register_frac_pll(struct regmap *regmap, spinlock_t *lock, ...@@ -226,7 +235,8 @@ sam9x60_clk_register_frac_pll(struct regmap *regmap, spinlock_t *lock,
struct clk_hw * __init struct clk_hw * __init
at91_clk_register_programmable(struct regmap *regmap, const char *name, at91_clk_register_programmable(struct regmap *regmap, const char *name,
const char **parent_names, u8 num_parents, u8 id, const char **parent_names, struct clk_hw **parent_hws,
u8 num_parents, u8 id,
const struct clk_programmable_layout *layout, const struct clk_programmable_layout *layout,
u32 *mux_table); u32 *mux_table);
...@@ -242,7 +252,8 @@ at91sam9x5_clk_register_smd(struct regmap *regmap, const char *name, ...@@ -242,7 +252,8 @@ at91sam9x5_clk_register_smd(struct regmap *regmap, const char *name,
struct clk_hw * __init struct clk_hw * __init
at91_clk_register_system(struct regmap *regmap, const char *name, at91_clk_register_system(struct regmap *regmap, const char *name,
const char *parent_name, u8 id, unsigned long flags); const char *parent_name, struct clk_hw *parent_hw,
u8 id, unsigned long flags);
struct clk_hw * __init struct clk_hw * __init
at91sam9x5_clk_register_usb(struct regmap *regmap, const char *name, at91sam9x5_clk_register_usb(struct regmap *regmap, const char *name,
...@@ -259,10 +270,11 @@ at91rm9200_clk_register_usb(struct regmap *regmap, const char *name, ...@@ -259,10 +270,11 @@ at91rm9200_clk_register_usb(struct regmap *regmap, const char *name,
struct clk_hw * __init struct clk_hw * __init
at91_clk_register_utmi(struct regmap *regmap_pmc, struct regmap *regmap_sfr, at91_clk_register_utmi(struct regmap *regmap_pmc, struct regmap *regmap_sfr,
const char *name, const char *parent_name); const char *name, const char *parent_name,
struct clk_hw *parent_hw);
struct clk_hw * __init struct clk_hw * __init
at91_clk_sama7g5_register_utmi(struct regmap *regmap, const char *name, at91_clk_sama7g5_register_utmi(struct regmap *regmap, const char *name,
const char *parent_name); const char *parent_name, struct clk_hw *parent_hw);
#endif /* __PMC_H_ */ #endif /* __PMC_H_ */
...@@ -219,14 +219,14 @@ static void __init sam9x60_pmc_setup(struct device_node *np) ...@@ -219,14 +219,14 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, 0); hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, NULL, 0);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
main_osc_hw = hw; main_osc_hw = hw;
parent_names[0] = "main_rc_osc"; parent_names[0] = "main_rc_osc";
parent_names[1] = "main_osc"; parent_names[1] = "main_osc";
hw = at91_clk_register_sam9x5_main(regmap, "mainck", parent_names, 2); hw = at91_clk_register_sam9x5_main(regmap, "mainck", parent_names, NULL, 2);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
...@@ -246,7 +246,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np) ...@@ -246,7 +246,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
goto err_free; goto err_free;
hw = sam9x60_clk_register_div_pll(regmap, &pmc_pll_lock, "pllack_divck", hw = sam9x60_clk_register_div_pll(regmap, &pmc_pll_lock, "pllack_divck",
"pllack_fracck", 0, &plla_characteristics, "pllack_fracck", NULL, 0, &plla_characteristics,
&pll_div_layout, &pll_div_layout,
/* /*
* This feeds CPU. It should not * This feeds CPU. It should not
...@@ -266,7 +266,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np) ...@@ -266,7 +266,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
goto err_free; goto err_free;
hw = sam9x60_clk_register_div_pll(regmap, &pmc_pll_lock, "upllck_divck", hw = sam9x60_clk_register_div_pll(regmap, &pmc_pll_lock, "upllck_divck",
"upllck_fracck", 1, &upll_characteristics, "upllck_fracck", NULL, 1, &upll_characteristics,
&pll_div_layout, &pll_div_layout,
CLK_SET_RATE_GATE | CLK_SET_RATE_GATE |
CLK_SET_PARENT_GATE | CLK_SET_PARENT_GATE |
...@@ -280,13 +280,13 @@ static void __init sam9x60_pmc_setup(struct device_node *np) ...@@ -280,13 +280,13 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
parent_names[1] = "mainck"; parent_names[1] = "mainck";
parent_names[2] = "pllack_divck"; parent_names[2] = "pllack_divck";
hw = at91_clk_register_master_pres(regmap, "masterck_pres", 3, hw = at91_clk_register_master_pres(regmap, "masterck_pres", 3,
parent_names, &sam9x60_master_layout, parent_names, NULL, &sam9x60_master_layout,
&mck_characteristics, &mck_lock); &mck_characteristics, &mck_lock);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
hw = at91_clk_register_master_div(regmap, "masterck_div", hw = at91_clk_register_master_div(regmap, "masterck_div",
"masterck_pres", &sam9x60_master_layout, "masterck_pres", NULL, &sam9x60_master_layout,
&mck_characteristics, &mck_lock, &mck_characteristics, &mck_lock,
CLK_SET_RATE_GATE, 0); CLK_SET_RATE_GATE, 0);
if (IS_ERR(hw)) if (IS_ERR(hw))
...@@ -313,7 +313,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np) ...@@ -313,7 +313,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
snprintf(name, sizeof(name), "prog%d", i); snprintf(name, sizeof(name), "prog%d", i);
hw = at91_clk_register_programmable(regmap, name, hw = at91_clk_register_programmable(regmap, name,
parent_names, 6, i, parent_names, NULL, 6, i,
&sam9x60_programmable_layout, &sam9x60_programmable_layout,
NULL); NULL);
if (IS_ERR(hw)) if (IS_ERR(hw))
...@@ -324,7 +324,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np) ...@@ -324,7 +324,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
for (i = 0; i < ARRAY_SIZE(sam9x60_systemck); i++) { for (i = 0; i < ARRAY_SIZE(sam9x60_systemck); i++) {
hw = at91_clk_register_system(regmap, sam9x60_systemck[i].n, hw = at91_clk_register_system(regmap, sam9x60_systemck[i].n,
sam9x60_systemck[i].p, sam9x60_systemck[i].p, NULL,
sam9x60_systemck[i].id, sam9x60_systemck[i].id,
sam9x60_systemck[i].flags); sam9x60_systemck[i].flags);
if (IS_ERR(hw)) if (IS_ERR(hw))
...@@ -337,7 +337,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np) ...@@ -337,7 +337,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
hw = at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock, hw = at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock,
&sam9x60_pcr_layout, &sam9x60_pcr_layout,
sam9x60_periphck[i].n, sam9x60_periphck[i].n,
"masterck_div", "masterck_div", NULL,
sam9x60_periphck[i].id, sam9x60_periphck[i].id,
&range, INT_MIN, &range, INT_MIN,
sam9x60_periphck[i].flags); sam9x60_periphck[i].flags);
...@@ -351,7 +351,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np) ...@@ -351,7 +351,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
hw = at91_clk_register_generated(regmap, &pmc_pcr_lock, hw = at91_clk_register_generated(regmap, &pmc_pcr_lock,
&sam9x60_pcr_layout, &sam9x60_pcr_layout,
sam9x60_gck[i].n, sam9x60_gck[i].n,
parent_names, NULL, 6, parent_names, NULL, NULL, 6,
sam9x60_gck[i].id, sam9x60_gck[i].id,
&sam9x60_gck[i].r, INT_MIN); &sam9x60_gck[i].r, INT_MIN);
if (IS_ERR(hw)) if (IS_ERR(hw))
......
...@@ -202,14 +202,14 @@ static void __init sama5d2_pmc_setup(struct device_node *np) ...@@ -202,14 +202,14 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
bypass = of_property_read_bool(np, "atmel,osc-bypass"); bypass = of_property_read_bool(np, "atmel,osc-bypass");
hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, NULL,
bypass); bypass);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
parent_names[0] = "main_rc_osc"; parent_names[0] = "main_rc_osc";
parent_names[1] = "main_osc"; parent_names[1] = "main_osc";
hw = at91_clk_register_sam9x5_main(regmap, "mainck", parent_names, 2); hw = at91_clk_register_sam9x5_main(regmap, "mainck", parent_names, NULL, 2);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
...@@ -249,7 +249,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np) ...@@ -249,7 +249,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
if (IS_ERR(regmap_sfr)) if (IS_ERR(regmap_sfr))
regmap_sfr = NULL; regmap_sfr = NULL;
hw = at91_clk_register_utmi(regmap, regmap_sfr, "utmick", "mainck"); hw = at91_clk_register_utmi(regmap, regmap_sfr, "utmick", "mainck", NULL);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
...@@ -260,14 +260,14 @@ static void __init sama5d2_pmc_setup(struct device_node *np) ...@@ -260,14 +260,14 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
parent_names[2] = "plladivck"; parent_names[2] = "plladivck";
parent_names[3] = "utmick"; parent_names[3] = "utmick";
hw = at91_clk_register_master_pres(regmap, "masterck_pres", 4, hw = at91_clk_register_master_pres(regmap, "masterck_pres", 4,
parent_names, parent_names, NULL,
&at91sam9x5_master_layout, &at91sam9x5_master_layout,
&mck_characteristics, &mck_lock); &mck_characteristics, &mck_lock);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
hw = at91_clk_register_master_div(regmap, "masterck_div", hw = at91_clk_register_master_div(regmap, "masterck_div",
"masterck_pres", "masterck_pres", NULL,
&at91sam9x5_master_layout, &at91sam9x5_master_layout,
&mck_characteristics, &mck_lock, &mck_characteristics, &mck_lock,
CLK_SET_RATE_GATE, 0); CLK_SET_RATE_GATE, 0);
...@@ -300,7 +300,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np) ...@@ -300,7 +300,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
snprintf(name, sizeof(name), "prog%d", i); snprintf(name, sizeof(name), "prog%d", i);
hw = at91_clk_register_programmable(regmap, name, hw = at91_clk_register_programmable(regmap, name,
parent_names, 6, i, parent_names, NULL, 6, i,
&sama5d2_programmable_layout, &sama5d2_programmable_layout,
NULL); NULL);
if (IS_ERR(hw)) if (IS_ERR(hw))
...@@ -311,7 +311,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np) ...@@ -311,7 +311,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
for (i = 0; i < ARRAY_SIZE(sama5d2_systemck); i++) { for (i = 0; i < ARRAY_SIZE(sama5d2_systemck); i++) {
hw = at91_clk_register_system(regmap, sama5d2_systemck[i].n, hw = at91_clk_register_system(regmap, sama5d2_systemck[i].n,
sama5d2_systemck[i].p, sama5d2_systemck[i].p, NULL,
sama5d2_systemck[i].id, sama5d2_systemck[i].id,
sama5d2_systemck[i].flags); sama5d2_systemck[i].flags);
if (IS_ERR(hw)) if (IS_ERR(hw))
...@@ -324,7 +324,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np) ...@@ -324,7 +324,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
hw = at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock, hw = at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock,
&sama5d2_pcr_layout, &sama5d2_pcr_layout,
sama5d2_periphck[i].n, sama5d2_periphck[i].n,
"masterck_div", "masterck_div", NULL,
sama5d2_periphck[i].id, sama5d2_periphck[i].id,
&range, INT_MIN, &range, INT_MIN,
sama5d2_periphck[i].flags); sama5d2_periphck[i].flags);
...@@ -338,7 +338,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np) ...@@ -338,7 +338,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
hw = at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock, hw = at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock,
&sama5d2_pcr_layout, &sama5d2_pcr_layout,
sama5d2_periph32ck[i].n, sama5d2_periph32ck[i].n,
"h32mxck", "h32mxck", NULL,
sama5d2_periph32ck[i].id, sama5d2_periph32ck[i].id,
&sama5d2_periph32ck[i].r, &sama5d2_periph32ck[i].r,
INT_MIN, 0); INT_MIN, 0);
...@@ -358,7 +358,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np) ...@@ -358,7 +358,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
hw = at91_clk_register_generated(regmap, &pmc_pcr_lock, hw = at91_clk_register_generated(regmap, &pmc_pcr_lock,
&sama5d2_pcr_layout, &sama5d2_pcr_layout,
sama5d2_gck[i].n, sama5d2_gck[i].n,
parent_names, NULL, 6, parent_names, NULL, NULL, 6,
sama5d2_gck[i].id, sama5d2_gck[i].id,
&sama5d2_gck[i].r, &sama5d2_gck[i].r,
sama5d2_gck[i].chg_pid); sama5d2_gck[i].chg_pid);
......
...@@ -150,14 +150,14 @@ static void __init sama5d3_pmc_setup(struct device_node *np) ...@@ -150,14 +150,14 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
bypass = of_property_read_bool(np, "atmel,osc-bypass"); bypass = of_property_read_bool(np, "atmel,osc-bypass");
hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, NULL,
bypass); bypass);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
parent_names[0] = "main_rc_osc"; parent_names[0] = "main_rc_osc";
parent_names[1] = "main_osc"; parent_names[1] = "main_osc";
hw = at91_clk_register_sam9x5_main(regmap, "mainck", parent_names, 2); hw = at91_clk_register_sam9x5_main(regmap, "mainck", parent_names, NULL, 2);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
...@@ -172,7 +172,7 @@ static void __init sama5d3_pmc_setup(struct device_node *np) ...@@ -172,7 +172,7 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
sama5d3_pmc->chws[PMC_PLLACK] = hw; sama5d3_pmc->chws[PMC_PLLACK] = hw;
hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck"); hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck", NULL);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
...@@ -183,14 +183,14 @@ static void __init sama5d3_pmc_setup(struct device_node *np) ...@@ -183,14 +183,14 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
parent_names[2] = "plladivck"; parent_names[2] = "plladivck";
parent_names[3] = "utmick"; parent_names[3] = "utmick";
hw = at91_clk_register_master_pres(regmap, "masterck_pres", 4, hw = at91_clk_register_master_pres(regmap, "masterck_pres", 4,
parent_names, parent_names, NULL,
&at91sam9x5_master_layout, &at91sam9x5_master_layout,
&mck_characteristics, &mck_lock); &mck_characteristics, &mck_lock);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
hw = at91_clk_register_master_div(regmap, "masterck_div", hw = at91_clk_register_master_div(regmap, "masterck_div",
"masterck_pres", "masterck_pres", NULL,
&at91sam9x5_master_layout, &at91sam9x5_master_layout,
&mck_characteristics, &mck_lock, &mck_characteristics, &mck_lock,
CLK_SET_RATE_GATE, 0); CLK_SET_RATE_GATE, 0);
...@@ -220,7 +220,7 @@ static void __init sama5d3_pmc_setup(struct device_node *np) ...@@ -220,7 +220,7 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
snprintf(name, sizeof(name), "prog%d", i); snprintf(name, sizeof(name), "prog%d", i);
hw = at91_clk_register_programmable(regmap, name, hw = at91_clk_register_programmable(regmap, name,
parent_names, 5, i, parent_names, NULL, 5, i,
&at91sam9x5_programmable_layout, &at91sam9x5_programmable_layout,
NULL); NULL);
if (IS_ERR(hw)) if (IS_ERR(hw))
...@@ -231,7 +231,7 @@ static void __init sama5d3_pmc_setup(struct device_node *np) ...@@ -231,7 +231,7 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
for (i = 0; i < ARRAY_SIZE(sama5d3_systemck); i++) { for (i = 0; i < ARRAY_SIZE(sama5d3_systemck); i++) {
hw = at91_clk_register_system(regmap, sama5d3_systemck[i].n, hw = at91_clk_register_system(regmap, sama5d3_systemck[i].n,
sama5d3_systemck[i].p, sama5d3_systemck[i].p, NULL,
sama5d3_systemck[i].id, sama5d3_systemck[i].id,
sama5d3_systemck[i].flags); sama5d3_systemck[i].flags);
if (IS_ERR(hw)) if (IS_ERR(hw))
...@@ -244,7 +244,7 @@ static void __init sama5d3_pmc_setup(struct device_node *np) ...@@ -244,7 +244,7 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
hw = at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock, hw = at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock,
&sama5d3_pcr_layout, &sama5d3_pcr_layout,
sama5d3_periphck[i].n, sama5d3_periphck[i].n,
"masterck_div", "masterck_div", NULL,
sama5d3_periphck[i].id, sama5d3_periphck[i].id,
&sama5d3_periphck[i].r, &sama5d3_periphck[i].r,
INT_MIN, INT_MIN,
......
...@@ -165,14 +165,14 @@ static void __init sama5d4_pmc_setup(struct device_node *np) ...@@ -165,14 +165,14 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
bypass = of_property_read_bool(np, "atmel,osc-bypass"); bypass = of_property_read_bool(np, "atmel,osc-bypass");
hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, NULL,
bypass); bypass);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
parent_names[0] = "main_rc_osc"; parent_names[0] = "main_rc_osc";
parent_names[1] = "main_osc"; parent_names[1] = "main_osc";
hw = at91_clk_register_sam9x5_main(regmap, "mainck", parent_names, 2); hw = at91_clk_register_sam9x5_main(regmap, "mainck", parent_names, NULL, 2);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
...@@ -187,7 +187,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np) ...@@ -187,7 +187,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
sama5d4_pmc->chws[PMC_PLLACK] = hw; sama5d4_pmc->chws[PMC_PLLACK] = hw;
hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck"); hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck", NULL);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
...@@ -198,14 +198,14 @@ static void __init sama5d4_pmc_setup(struct device_node *np) ...@@ -198,14 +198,14 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
parent_names[2] = "plladivck"; parent_names[2] = "plladivck";
parent_names[3] = "utmick"; parent_names[3] = "utmick";
hw = at91_clk_register_master_pres(regmap, "masterck_pres", 4, hw = at91_clk_register_master_pres(regmap, "masterck_pres", 4,
parent_names, parent_names, NULL,
&at91sam9x5_master_layout, &at91sam9x5_master_layout,
&mck_characteristics, &mck_lock); &mck_characteristics, &mck_lock);
if (IS_ERR(hw)) if (IS_ERR(hw))
goto err_free; goto err_free;
hw = at91_clk_register_master_div(regmap, "masterck_div", hw = at91_clk_register_master_div(regmap, "masterck_div",
"masterck_pres", "masterck_pres", NULL,
&at91sam9x5_master_layout, &at91sam9x5_master_layout,
&mck_characteristics, &mck_lock, &mck_characteristics, &mck_lock,
CLK_SET_RATE_GATE, 0); CLK_SET_RATE_GATE, 0);
...@@ -243,7 +243,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np) ...@@ -243,7 +243,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
snprintf(name, sizeof(name), "prog%d", i); snprintf(name, sizeof(name), "prog%d", i);
hw = at91_clk_register_programmable(regmap, name, hw = at91_clk_register_programmable(regmap, name,
parent_names, 5, i, parent_names, NULL, 5, i,
&at91sam9x5_programmable_layout, &at91sam9x5_programmable_layout,
NULL); NULL);
if (IS_ERR(hw)) if (IS_ERR(hw))
...@@ -254,7 +254,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np) ...@@ -254,7 +254,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
for (i = 0; i < ARRAY_SIZE(sama5d4_systemck); i++) { for (i = 0; i < ARRAY_SIZE(sama5d4_systemck); i++) {
hw = at91_clk_register_system(regmap, sama5d4_systemck[i].n, hw = at91_clk_register_system(regmap, sama5d4_systemck[i].n,
sama5d4_systemck[i].p, sama5d4_systemck[i].p, NULL,
sama5d4_systemck[i].id, sama5d4_systemck[i].id,
sama5d4_systemck[i].flags); sama5d4_systemck[i].flags);
if (IS_ERR(hw)) if (IS_ERR(hw))
...@@ -267,7 +267,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np) ...@@ -267,7 +267,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
hw = at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock, hw = at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock,
&sama5d4_pcr_layout, &sama5d4_pcr_layout,
sama5d4_periphck[i].n, sama5d4_periphck[i].n,
"masterck_div", "masterck_div", NULL,
sama5d4_periphck[i].id, sama5d4_periphck[i].id,
&range, INT_MIN, &range, INT_MIN,
sama5d4_periphck[i].flags); sama5d4_periphck[i].flags);
...@@ -281,7 +281,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np) ...@@ -281,7 +281,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
hw = at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock, hw = at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock,
&sama5d4_pcr_layout, &sama5d4_pcr_layout,
sama5d4_periph32ck[i].n, sama5d4_periph32ck[i].n,
"h32mxck", "h32mxck", NULL,
sama5d4_periph32ck[i].id, sama5d4_periph32ck[i].id,
&range, INT_MIN, 0); &range, INT_MIN, 0);
if (IS_ERR(hw)) if (IS_ERR(hw))
......
This diff is collapsed.
...@@ -117,17 +117,17 @@ static const struct clk_ops slow_osc_ops = { ...@@ -117,17 +117,17 @@ static const struct clk_ops slow_osc_ops = {
static struct clk_hw * __init static struct clk_hw * __init
at91_clk_register_slow_osc(void __iomem *sckcr, at91_clk_register_slow_osc(void __iomem *sckcr,
const char *name, const char *name,
const char *parent_name, const struct clk_parent_data *parent_data,
unsigned long startup, unsigned long startup,
bool bypass, bool bypass,
const struct clk_slow_bits *bits) const struct clk_slow_bits *bits)
{ {
struct clk_slow_osc *osc; struct clk_slow_osc *osc;
struct clk_hw *hw; struct clk_hw *hw;
struct clk_init_data init; struct clk_init_data init = {};
int ret; int ret;
if (!sckcr || !name || !parent_name) if (!sckcr || !name || !parent_data)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
osc = kzalloc(sizeof(*osc), GFP_KERNEL); osc = kzalloc(sizeof(*osc), GFP_KERNEL);
...@@ -136,7 +136,7 @@ at91_clk_register_slow_osc(void __iomem *sckcr, ...@@ -136,7 +136,7 @@ at91_clk_register_slow_osc(void __iomem *sckcr,
init.name = name; init.name = name;
init.ops = &slow_osc_ops; init.ops = &slow_osc_ops;
init.parent_names = &parent_name; init.parent_data = parent_data;
init.num_parents = 1; init.num_parents = 1;
init.flags = CLK_IGNORE_UNUSED; init.flags = CLK_IGNORE_UNUSED;
...@@ -317,16 +317,16 @@ static const struct clk_ops sam9x5_slow_ops = { ...@@ -317,16 +317,16 @@ static const struct clk_ops sam9x5_slow_ops = {
static struct clk_hw * __init static struct clk_hw * __init
at91_clk_register_sam9x5_slow(void __iomem *sckcr, at91_clk_register_sam9x5_slow(void __iomem *sckcr,
const char *name, const char *name,
const char **parent_names, const struct clk_hw **parent_hws,
int num_parents, int num_parents,
const struct clk_slow_bits *bits) const struct clk_slow_bits *bits)
{ {
struct clk_sam9x5_slow *slowck; struct clk_sam9x5_slow *slowck;
struct clk_hw *hw; struct clk_hw *hw;
struct clk_init_data init; struct clk_init_data init = {};
int ret; int ret;
if (!sckcr || !name || !parent_names || !num_parents) if (!sckcr || !name || !parent_hws || !num_parents)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
slowck = kzalloc(sizeof(*slowck), GFP_KERNEL); slowck = kzalloc(sizeof(*slowck), GFP_KERNEL);
...@@ -335,7 +335,7 @@ at91_clk_register_sam9x5_slow(void __iomem *sckcr, ...@@ -335,7 +335,7 @@ at91_clk_register_sam9x5_slow(void __iomem *sckcr,
init.name = name; init.name = name;
init.ops = &sam9x5_slow_ops; init.ops = &sam9x5_slow_ops;
init.parent_names = parent_names; init.parent_hws = parent_hws;
init.num_parents = num_parents; init.num_parents = num_parents;
init.flags = 0; init.flags = 0;
...@@ -366,18 +366,21 @@ static void __init at91sam9x5_sckc_register(struct device_node *np, ...@@ -366,18 +366,21 @@ static void __init at91sam9x5_sckc_register(struct device_node *np,
unsigned int rc_osc_startup_us, unsigned int rc_osc_startup_us,
const struct clk_slow_bits *bits) const struct clk_slow_bits *bits)
{ {
const char *parent_names[2] = { "slow_rc_osc", "slow_osc" };
void __iomem *regbase = of_iomap(np, 0); void __iomem *regbase = of_iomap(np, 0);
struct device_node *child = NULL; struct device_node *child = NULL;
const char *xtal_name; const char *xtal_name;
struct clk_hw *slow_rc, *slow_osc, *slowck; struct clk_hw *slow_rc, *slow_osc, *slowck;
static struct clk_parent_data parent_data = {
.name = "slow_xtal",
};
const struct clk_hw *parent_hws[2];
bool bypass; bool bypass;
int ret; int ret;
if (!regbase) if (!regbase)
return; return;
slow_rc = at91_clk_register_slow_rc_osc(regbase, parent_names[0], slow_rc = at91_clk_register_slow_rc_osc(regbase, "slow_rc_osc",
32768, 50000000, 32768, 50000000,
rc_osc_startup_us, bits); rc_osc_startup_us, bits);
if (IS_ERR(slow_rc)) if (IS_ERR(slow_rc))
...@@ -401,12 +404,16 @@ static void __init at91sam9x5_sckc_register(struct device_node *np, ...@@ -401,12 +404,16 @@ static void __init at91sam9x5_sckc_register(struct device_node *np,
if (!xtal_name) if (!xtal_name)
goto unregister_slow_rc; goto unregister_slow_rc;
slow_osc = at91_clk_register_slow_osc(regbase, parent_names[1], parent_data.fw_name = xtal_name;
xtal_name, 1200000, bypass, bits);
slow_osc = at91_clk_register_slow_osc(regbase, "slow_osc",
&parent_data, 1200000, bypass, bits);
if (IS_ERR(slow_osc)) if (IS_ERR(slow_osc))
goto unregister_slow_rc; goto unregister_slow_rc;
slowck = at91_clk_register_sam9x5_slow(regbase, "slowck", parent_names, parent_hws[0] = slow_rc;
parent_hws[1] = slow_osc;
slowck = at91_clk_register_sam9x5_slow(regbase, "slowck", parent_hws,
2, bits); 2, bits);
if (IS_ERR(slowck)) if (IS_ERR(slowck))
goto unregister_slow_osc; goto unregister_slow_osc;
...@@ -464,14 +471,17 @@ static void __init of_sam9x60_sckc_setup(struct device_node *np) ...@@ -464,14 +471,17 @@ static void __init of_sam9x60_sckc_setup(struct device_node *np)
struct clk_hw_onecell_data *clk_data; struct clk_hw_onecell_data *clk_data;
struct clk_hw *slow_rc, *slow_osc; struct clk_hw *slow_rc, *slow_osc;
const char *xtal_name; const char *xtal_name;
const char *parent_names[2] = { "slow_rc_osc", "slow_osc" }; const struct clk_hw *parent_hws[2];
static struct clk_parent_data parent_data = {
.name = "slow_xtal",
};
bool bypass; bool bypass;
int ret; int ret;
if (!regbase) if (!regbase)
return; return;
slow_rc = clk_hw_register_fixed_rate_with_accuracy(NULL, parent_names[0], slow_rc = clk_hw_register_fixed_rate_with_accuracy(NULL, "slow_rc_osc",
NULL, 0, 32768, NULL, 0, 32768,
93750000); 93750000);
if (IS_ERR(slow_rc)) if (IS_ERR(slow_rc))
...@@ -481,9 +491,10 @@ static void __init of_sam9x60_sckc_setup(struct device_node *np) ...@@ -481,9 +491,10 @@ static void __init of_sam9x60_sckc_setup(struct device_node *np)
if (!xtal_name) if (!xtal_name)
goto unregister_slow_rc; goto unregister_slow_rc;
parent_data.fw_name = xtal_name;
bypass = of_property_read_bool(np, "atmel,osc-bypass"); bypass = of_property_read_bool(np, "atmel,osc-bypass");
slow_osc = at91_clk_register_slow_osc(regbase, parent_names[1], slow_osc = at91_clk_register_slow_osc(regbase, "slow_osc",
xtal_name, 5000000, bypass, &parent_data, 5000000, bypass,
&at91sam9x60_bits); &at91sam9x60_bits);
if (IS_ERR(slow_osc)) if (IS_ERR(slow_osc))
goto unregister_slow_rc; goto unregister_slow_rc;
...@@ -494,14 +505,16 @@ static void __init of_sam9x60_sckc_setup(struct device_node *np) ...@@ -494,14 +505,16 @@ static void __init of_sam9x60_sckc_setup(struct device_node *np)
/* MD_SLCK and TD_SLCK. */ /* MD_SLCK and TD_SLCK. */
clk_data->num = 2; clk_data->num = 2;
clk_data->hws[0] = clk_hw_register_fixed_rate(NULL, "md_slck", clk_data->hws[0] = clk_hw_register_fixed_rate_parent_hw(NULL, "md_slck",
parent_names[0], slow_rc,
0, 32768); 0, 32768);
if (IS_ERR(clk_data->hws[0])) if (IS_ERR(clk_data->hws[0]))
goto clk_data_free; goto clk_data_free;
parent_hws[0] = slow_rc;
parent_hws[1] = slow_osc;
clk_data->hws[1] = at91_clk_register_sam9x5_slow(regbase, "td_slck", clk_data->hws[1] = at91_clk_register_sam9x5_slow(regbase, "td_slck",
parent_names, 2, parent_hws, 2,
&at91sam9x60_bits); &at91sam9x60_bits);
if (IS_ERR(clk_data->hws[1])) if (IS_ERR(clk_data->hws[1]))
goto unregister_md_slck; goto unregister_md_slck;
...@@ -572,30 +585,36 @@ static void __init of_sama5d4_sckc_setup(struct device_node *np) ...@@ -572,30 +585,36 @@ static void __init of_sama5d4_sckc_setup(struct device_node *np)
void __iomem *regbase = of_iomap(np, 0); void __iomem *regbase = of_iomap(np, 0);
struct clk_hw *slow_rc, *slowck; struct clk_hw *slow_rc, *slowck;
struct clk_sama5d4_slow_osc *osc; struct clk_sama5d4_slow_osc *osc;
struct clk_init_data init; struct clk_init_data init = {};
const char *xtal_name; const char *xtal_name;
const char *parent_names[2] = { "slow_rc_osc", "slow_osc" }; const struct clk_hw *parent_hws[2];
static struct clk_parent_data parent_data = {
.name = "slow_xtal",
};
int ret; int ret;
if (!regbase) if (!regbase)
return; return;
slow_rc = clk_hw_register_fixed_rate_with_accuracy(NULL, slow_rc = clk_hw_register_fixed_rate_with_accuracy(NULL,
parent_names[0], "slow_rc_osc",
NULL, 0, 32768, NULL, 0, 32768,
250000000); 250000000);
if (IS_ERR(slow_rc)) if (IS_ERR(slow_rc))
return; return;
xtal_name = of_clk_get_parent_name(np, 0); xtal_name = of_clk_get_parent_name(np, 0);
if (!xtal_name)
goto unregister_slow_rc;
parent_data.fw_name = xtal_name;
osc = kzalloc(sizeof(*osc), GFP_KERNEL); osc = kzalloc(sizeof(*osc), GFP_KERNEL);
if (!osc) if (!osc)
goto unregister_slow_rc; goto unregister_slow_rc;
init.name = parent_names[1]; init.name = "slow_osc";
init.ops = &sama5d4_slow_osc_ops; init.ops = &sama5d4_slow_osc_ops;
init.parent_names = &xtal_name; init.parent_data = &parent_data;
init.num_parents = 1; init.num_parents = 1;
init.flags = CLK_IGNORE_UNUSED; init.flags = CLK_IGNORE_UNUSED;
...@@ -608,8 +627,10 @@ static void __init of_sama5d4_sckc_setup(struct device_node *np) ...@@ -608,8 +627,10 @@ static void __init of_sama5d4_sckc_setup(struct device_node *np)
if (ret) if (ret)
goto free_slow_osc_data; goto free_slow_osc_data;
parent_hws[0] = slow_rc;
parent_hws[1] = &osc->hw;
slowck = at91_clk_register_sam9x5_slow(regbase, "slowck", slowck = at91_clk_register_sam9x5_slow(regbase, "slowck",
parent_names, 2, parent_hws, 2,
&at91sama5d4_bits); &at91sama5d4_bits);
if (IS_ERR(slowck)) if (IS_ERR(slowck))
goto unregister_slow_osc; goto unregister_slow_osc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment