sama5d3.c (9b031c86506cef9acae45e61339fcf9deaabb793) | sama5d3.c (153bc1c66a8814e621ca0483098ac722be860aaf) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2#include <linux/clk-provider.h> 3#include <linux/mfd/syscon.h> 4#include <linux/slab.h> 5 6#include <dt-bindings/clock/at91.h> 7 8#include "pmc.h" --- 107 unchanged lines hidden (view full) --- 116 117 slck_name = of_clk_get_parent_name(np, i); 118 119 i = of_property_match_string(np, "clock-names", "main_xtal"); 120 if (i < 0) 121 return; 122 mainxtal_name = of_clk_get_parent_name(np, i); 123 | 1// SPDX-License-Identifier: GPL-2.0 2#include <linux/clk-provider.h> 3#include <linux/mfd/syscon.h> 4#include <linux/slab.h> 5 6#include <dt-bindings/clock/at91.h> 7 8#include "pmc.h" --- 107 unchanged lines hidden (view full) --- 116 117 slck_name = of_clk_get_parent_name(np, i); 118 119 i = of_property_match_string(np, "clock-names", "main_xtal"); 120 if (i < 0) 121 return; 122 mainxtal_name = of_clk_get_parent_name(np, i); 123 |
124 regmap = syscon_node_to_regmap(np); | 124 regmap = device_node_to_regmap(np); |
125 if (IS_ERR(regmap)) 126 return; 127 | 125 if (IS_ERR(regmap)) 126 return; 127 |
128 sama5d3_pmc = pmc_data_allocate(PMC_MAIN + 1, | 128 sama5d3_pmc = pmc_data_allocate(PMC_PLLACK + 1, |
129 nck(sama5d3_systemck), | 129 nck(sama5d3_systemck), |
130 nck(sama5d3_periphck), 0); | 130 nck(sama5d3_periphck), 0, 3); |
131 if (!sama5d3_pmc) 132 return; 133 134 hw = at91_clk_register_main_rc_osc(regmap, "main_rc_osc", 12000000, 135 50000000); 136 if (IS_ERR(hw)) 137 goto err_free; 138 --- 14 unchanged lines hidden (view full) --- 153 &sama5d3_pll_layout, &plla_characteristics); 154 if (IS_ERR(hw)) 155 goto err_free; 156 157 hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack"); 158 if (IS_ERR(hw)) 159 goto err_free; 160 | 131 if (!sama5d3_pmc) 132 return; 133 134 hw = at91_clk_register_main_rc_osc(regmap, "main_rc_osc", 12000000, 135 50000000); 136 if (IS_ERR(hw)) 137 goto err_free; 138 --- 14 unchanged lines hidden (view full) --- 153 &sama5d3_pll_layout, &plla_characteristics); 154 if (IS_ERR(hw)) 155 goto err_free; 156 157 hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack"); 158 if (IS_ERR(hw)) 159 goto err_free; 160 |
161 sama5d3_pmc->chws[PMC_PLLACK] = hw; 162 |
|
161 hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck"); 162 if (IS_ERR(hw)) 163 goto err_free; 164 165 sama5d3_pmc->chws[PMC_UTMI] = hw; 166 167 parent_names[0] = slck_name; 168 parent_names[1] = "mainck"; --- 27 unchanged lines hidden (view full) --- 196 197 snprintf(name, sizeof(name), "prog%d", i); 198 199 hw = at91_clk_register_programmable(regmap, name, 200 parent_names, 5, i, 201 &at91sam9x5_programmable_layout); 202 if (IS_ERR(hw)) 203 goto err_free; | 163 hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck"); 164 if (IS_ERR(hw)) 165 goto err_free; 166 167 sama5d3_pmc->chws[PMC_UTMI] = hw; 168 169 parent_names[0] = slck_name; 170 parent_names[1] = "mainck"; --- 27 unchanged lines hidden (view full) --- 198 199 snprintf(name, sizeof(name), "prog%d", i); 200 201 hw = at91_clk_register_programmable(regmap, name, 202 parent_names, 5, i, 203 &at91sam9x5_programmable_layout); 204 if (IS_ERR(hw)) 205 goto err_free; |
206 207 sama5d3_pmc->pchws[i] = hw; |
|
204 } 205 206 for (i = 0; i < ARRAY_SIZE(sama5d3_systemck); i++) { 207 hw = at91_clk_register_system(regmap, sama5d3_systemck[i].n, 208 sama5d3_systemck[i].p, 209 sama5d3_systemck[i].id); 210 if (IS_ERR(hw)) 211 goto err_free; --- 14 unchanged lines hidden (view full) --- 226 sama5d3_pmc->phws[sama5d3_periphck[i].id] = hw; 227 } 228 229 of_clk_add_hw_provider(np, of_clk_hw_pmc_get, sama5d3_pmc); 230 231 return; 232 233err_free: | 208 } 209 210 for (i = 0; i < ARRAY_SIZE(sama5d3_systemck); i++) { 211 hw = at91_clk_register_system(regmap, sama5d3_systemck[i].n, 212 sama5d3_systemck[i].p, 213 sama5d3_systemck[i].id); 214 if (IS_ERR(hw)) 215 goto err_free; --- 14 unchanged lines hidden (view full) --- 230 sama5d3_pmc->phws[sama5d3_periphck[i].id] = hw; 231 } 232 233 of_clk_add_hw_provider(np, of_clk_hw_pmc_get, sama5d3_pmc); 234 235 return; 236 237err_free: |
234 pmc_data_free(sama5d3_pmc); | 238 kfree(sama5d3_pmc); |
235} 236/* 237 * The TCB is used as the clocksource so its clock is needed early. This means 238 * this can't be a platform driver. 239 */ 240CLK_OF_DECLARE_DRIVER(sama5d3_pmc, "atmel,sama5d3-pmc", sama5d3_pmc_setup); | 239} 240/* 241 * The TCB is used as the clocksource so its clock is needed early. This means 242 * this can't be a platform driver. 243 */ 244CLK_OF_DECLARE_DRIVER(sama5d3_pmc, "atmel,sama5d3-pmc", sama5d3_pmc_setup); |