diff options
author | Michael Turquette <mturquette@linaro.org> | 2015-03-24 19:33:33 -0400 |
---|---|---|
committer | Michael Turquette <mturquette@linaro.org> | 2015-03-24 19:47:43 -0400 |
commit | c77662a4df847e7b75ff8c5f2314dd4f022377e3 (patch) | |
tree | fbf34d2f4c260bc413d51b1591f21854532f67b7 | |
parent | 3966fab8b6abfe0fa55418fb9455c0b05735c1b0 (diff) | |
parent | 9089848d9afa34a796988b5b666c2c4e611ccb61 (diff) |
Merge branch 'for-4.1-clk-ti' of github.com:t-kristo/linux-pm into clk-next
-rw-r--r-- | drivers/clk/ti/apll.c | 5 | ||||
-rw-r--r-- | drivers/clk/ti/autoidle.c | 2 | ||||
-rw-r--r-- | drivers/clk/ti/clk-3xxx-legacy.c | 16 | ||||
-rw-r--r-- | drivers/clk/ti/clk-3xxx.c | 19 | ||||
-rw-r--r-- | drivers/clk/ti/clk-44xx.c | 11 | ||||
-rw-r--r-- | drivers/clk/ti/clk-54xx.c | 22 | ||||
-rw-r--r-- | drivers/clk/ti/clk-7xx.c | 18 | ||||
-rw-r--r-- | drivers/clk/ti/clk.c | 7 | ||||
-rw-r--r-- | drivers/clk/ti/divider.c | 4 | ||||
-rw-r--r-- | drivers/clk/ti/dpll.c | 6 | ||||
-rw-r--r-- | drivers/clk/ti/fapll.c | 270 | ||||
-rw-r--r-- | drivers/clk/ti/gate.c | 4 | ||||
-rw-r--r-- | drivers/clk/ti/interface.c | 2 | ||||
-rw-r--r-- | drivers/clk/ti/mux.c | 4 |
14 files changed, 318 insertions, 72 deletions
diff --git a/drivers/clk/ti/apll.c b/drivers/clk/ti/apll.c index 72d97279eae1..49baf3831546 100644 --- a/drivers/clk/ti/apll.c +++ b/drivers/clk/ti/apll.c | |||
@@ -203,7 +203,7 @@ static void __init of_dra7_apll_setup(struct device_node *node) | |||
203 | ad->control_reg = ti_clk_get_reg_addr(node, 0); | 203 | ad->control_reg = ti_clk_get_reg_addr(node, 0); |
204 | ad->idlest_reg = ti_clk_get_reg_addr(node, 1); | 204 | ad->idlest_reg = ti_clk_get_reg_addr(node, 1); |
205 | 205 | ||
206 | if (!ad->control_reg || !ad->idlest_reg) | 206 | if (IS_ERR(ad->control_reg) || IS_ERR(ad->idlest_reg)) |
207 | goto cleanup; | 207 | goto cleanup; |
208 | 208 | ||
209 | ad->idlest_mask = 0x1; | 209 | ad->idlest_mask = 0x1; |
@@ -384,7 +384,8 @@ static void __init of_omap2_apll_setup(struct device_node *node) | |||
384 | ad->autoidle_reg = ti_clk_get_reg_addr(node, 1); | 384 | ad->autoidle_reg = ti_clk_get_reg_addr(node, 1); |
385 | ad->idlest_reg = ti_clk_get_reg_addr(node, 2); | 385 | ad->idlest_reg = ti_clk_get_reg_addr(node, 2); |
386 | 386 | ||
387 | if (!ad->control_reg || !ad->autoidle_reg || !ad->idlest_reg) | 387 | if (IS_ERR(ad->control_reg) || IS_ERR(ad->autoidle_reg) || |
388 | IS_ERR(ad->idlest_reg)) | ||
388 | goto cleanup; | 389 | goto cleanup; |
389 | 390 | ||
390 | clk = clk_register(NULL, &clk_hw->hw); | 391 | clk = clk_register(NULL, &clk_hw->hw); |
diff --git a/drivers/clk/ti/autoidle.c b/drivers/clk/ti/autoidle.c index 8912ff80af34..e75c64c9e81c 100644 --- a/drivers/clk/ti/autoidle.c +++ b/drivers/clk/ti/autoidle.c | |||
@@ -119,7 +119,7 @@ int __init of_ti_clk_autoidle_setup(struct device_node *node) | |||
119 | clk->name = node->name; | 119 | clk->name = node->name; |
120 | clk->reg = ti_clk_get_reg_addr(node, 0); | 120 | clk->reg = ti_clk_get_reg_addr(node, 0); |
121 | 121 | ||
122 | if (!clk->reg) { | 122 | if (IS_ERR(clk->reg)) { |
123 | kfree(clk); | 123 | kfree(clk); |
124 | return -EINVAL; | 124 | return -EINVAL; |
125 | } | 125 | } |
diff --git a/drivers/clk/ti/clk-3xxx-legacy.c b/drivers/clk/ti/clk-3xxx-legacy.c index e0732a4c8f26..0b61548d569b 100644 --- a/drivers/clk/ti/clk-3xxx-legacy.c +++ b/drivers/clk/ti/clk-3xxx-legacy.c | |||
@@ -4320,7 +4320,6 @@ static struct ti_clk_alias omap3xxx_clks[] = { | |||
4320 | CLK(NULL, "dpll3_m3x2_ck", &dpll3_m3x2_ck), | 4320 | CLK(NULL, "dpll3_m3x2_ck", &dpll3_m3x2_ck), |
4321 | CLK("etb", "emu_core_alwon_ck", &emu_core_alwon_ck), | 4321 | CLK("etb", "emu_core_alwon_ck", &emu_core_alwon_ck), |
4322 | CLK(NULL, "sys_altclk", &sys_altclk), | 4322 | CLK(NULL, "sys_altclk", &sys_altclk), |
4323 | CLK(NULL, "mcbsp_clks", &mcbsp_clks), | ||
4324 | CLK(NULL, "sys_clkout1", &sys_clkout1), | 4323 | CLK(NULL, "sys_clkout1", &sys_clkout1), |
4325 | CLK(NULL, "dpll3_m2_ck", &dpll3_m2_ck), | 4324 | CLK(NULL, "dpll3_m2_ck", &dpll3_m2_ck), |
4326 | CLK(NULL, "core_ck", &core_ck), | 4325 | CLK(NULL, "core_ck", &core_ck), |
@@ -4369,8 +4368,6 @@ static struct ti_clk_alias omap3xxx_clks[] = { | |||
4369 | CLK(NULL, "i2c3_fck", &i2c3_fck), | 4368 | CLK(NULL, "i2c3_fck", &i2c3_fck), |
4370 | CLK(NULL, "i2c2_fck", &i2c2_fck), | 4369 | CLK(NULL, "i2c2_fck", &i2c2_fck), |
4371 | CLK(NULL, "i2c1_fck", &i2c1_fck), | 4370 | CLK(NULL, "i2c1_fck", &i2c1_fck), |
4372 | CLK(NULL, "mcbsp5_fck", &mcbsp5_fck), | ||
4373 | CLK(NULL, "mcbsp1_fck", &mcbsp1_fck), | ||
4374 | CLK(NULL, "core_48m_fck", &core_48m_fck), | 4371 | CLK(NULL, "core_48m_fck", &core_48m_fck), |
4375 | CLK(NULL, "mcspi4_fck", &mcspi4_fck), | 4372 | CLK(NULL, "mcspi4_fck", &mcspi4_fck), |
4376 | CLK(NULL, "mcspi3_fck", &mcspi3_fck), | 4373 | CLK(NULL, "mcspi3_fck", &mcspi3_fck), |
@@ -4409,8 +4406,6 @@ static struct ti_clk_alias omap3xxx_clks[] = { | |||
4409 | CLK(NULL, "uart1_ick", &uart1_ick), | 4406 | CLK(NULL, "uart1_ick", &uart1_ick), |
4410 | CLK(NULL, "gpt11_ick", &gpt11_ick), | 4407 | CLK(NULL, "gpt11_ick", &gpt11_ick), |
4411 | CLK(NULL, "gpt10_ick", &gpt10_ick), | 4408 | CLK(NULL, "gpt10_ick", &gpt10_ick), |
4412 | CLK("omap-mcbsp.5", "ick", &mcbsp5_ick), | ||
4413 | CLK("omap-mcbsp.1", "ick", &mcbsp1_ick), | ||
4414 | CLK(NULL, "mcbsp5_ick", &mcbsp5_ick), | 4409 | CLK(NULL, "mcbsp5_ick", &mcbsp5_ick), |
4415 | CLK(NULL, "mcbsp1_ick", &mcbsp1_ick), | 4410 | CLK(NULL, "mcbsp1_ick", &mcbsp1_ick), |
4416 | CLK(NULL, "omapctrl_ick", &omapctrl_ick), | 4411 | CLK(NULL, "omapctrl_ick", &omapctrl_ick), |
@@ -4467,15 +4462,22 @@ static struct ti_clk_alias omap3xxx_clks[] = { | |||
4467 | CLK(NULL, "gpt4_ick", &gpt4_ick), | 4462 | CLK(NULL, "gpt4_ick", &gpt4_ick), |
4468 | CLK(NULL, "gpt3_ick", &gpt3_ick), | 4463 | CLK(NULL, "gpt3_ick", &gpt3_ick), |
4469 | CLK(NULL, "gpt2_ick", &gpt2_ick), | 4464 | CLK(NULL, "gpt2_ick", &gpt2_ick), |
4465 | CLK(NULL, "mcbsp_clks", &mcbsp_clks), | ||
4466 | CLK("omap-mcbsp.1", "ick", &mcbsp1_ick), | ||
4470 | CLK("omap-mcbsp.2", "ick", &mcbsp2_ick), | 4467 | CLK("omap-mcbsp.2", "ick", &mcbsp2_ick), |
4471 | CLK("omap-mcbsp.3", "ick", &mcbsp3_ick), | 4468 | CLK("omap-mcbsp.3", "ick", &mcbsp3_ick), |
4472 | CLK("omap-mcbsp.4", "ick", &mcbsp4_ick), | 4469 | CLK("omap-mcbsp.4", "ick", &mcbsp4_ick), |
4473 | CLK(NULL, "mcbsp4_ick", &mcbsp2_ick), | 4470 | CLK("omap-mcbsp.5", "ick", &mcbsp5_ick), |
4471 | CLK(NULL, "mcbsp1_ick", &mcbsp1_ick), | ||
4472 | CLK(NULL, "mcbsp2_ick", &mcbsp2_ick), | ||
4474 | CLK(NULL, "mcbsp3_ick", &mcbsp3_ick), | 4473 | CLK(NULL, "mcbsp3_ick", &mcbsp3_ick), |
4475 | CLK(NULL, "mcbsp2_ick", &mcbsp4_ick), | 4474 | CLK(NULL, "mcbsp4_ick", &mcbsp4_ick), |
4475 | CLK(NULL, "mcbsp5_ick", &mcbsp5_ick), | ||
4476 | CLK(NULL, "mcbsp1_fck", &mcbsp1_fck), | ||
4476 | CLK(NULL, "mcbsp2_fck", &mcbsp2_fck), | 4477 | CLK(NULL, "mcbsp2_fck", &mcbsp2_fck), |
4477 | CLK(NULL, "mcbsp3_fck", &mcbsp3_fck), | 4478 | CLK(NULL, "mcbsp3_fck", &mcbsp3_fck), |
4478 | CLK(NULL, "mcbsp4_fck", &mcbsp4_fck), | 4479 | CLK(NULL, "mcbsp4_fck", &mcbsp4_fck), |
4480 | CLK(NULL, "mcbsp5_fck", &mcbsp5_fck), | ||
4479 | CLK(NULL, "emu_src_mux_ck", &emu_src_mux_ck), | 4481 | CLK(NULL, "emu_src_mux_ck", &emu_src_mux_ck), |
4480 | CLK("etb", "emu_src_ck", &emu_src_ck), | 4482 | CLK("etb", "emu_src_ck", &emu_src_ck), |
4481 | CLK(NULL, "emu_src_mux_ck", &emu_src_mux_ck), | 4483 | CLK(NULL, "emu_src_mux_ck", &emu_src_mux_ck), |
diff --git a/drivers/clk/ti/clk-3xxx.c b/drivers/clk/ti/clk-3xxx.c index 383a06e49b09..757636d166cf 100644 --- a/drivers/clk/ti/clk-3xxx.c +++ b/drivers/clk/ti/clk-3xxx.c | |||
@@ -34,7 +34,6 @@ static struct ti_dt_clk omap3xxx_clks[] = { | |||
34 | DT_CLK(NULL, "omap_96m_alwon_fck", "omap_96m_alwon_fck"), | 34 | DT_CLK(NULL, "omap_96m_alwon_fck", "omap_96m_alwon_fck"), |
35 | DT_CLK("etb", "emu_core_alwon_ck", "emu_core_alwon_ck"), | 35 | DT_CLK("etb", "emu_core_alwon_ck", "emu_core_alwon_ck"), |
36 | DT_CLK(NULL, "sys_altclk", "sys_altclk"), | 36 | DT_CLK(NULL, "sys_altclk", "sys_altclk"), |
37 | DT_CLK(NULL, "mcbsp_clks", "mcbsp_clks"), | ||
38 | DT_CLK(NULL, "sys_clkout1", "sys_clkout1"), | 37 | DT_CLK(NULL, "sys_clkout1", "sys_clkout1"), |
39 | DT_CLK(NULL, "dpll1_ck", "dpll1_ck"), | 38 | DT_CLK(NULL, "dpll1_ck", "dpll1_ck"), |
40 | DT_CLK(NULL, "dpll1_x2_ck", "dpll1_x2_ck"), | 39 | DT_CLK(NULL, "dpll1_x2_ck", "dpll1_x2_ck"), |
@@ -82,8 +81,6 @@ static struct ti_dt_clk omap3xxx_clks[] = { | |||
82 | DT_CLK(NULL, "i2c3_fck", "i2c3_fck"), | 81 | DT_CLK(NULL, "i2c3_fck", "i2c3_fck"), |
83 | DT_CLK(NULL, "i2c2_fck", "i2c2_fck"), | 82 | DT_CLK(NULL, "i2c2_fck", "i2c2_fck"), |
84 | DT_CLK(NULL, "i2c1_fck", "i2c1_fck"), | 83 | DT_CLK(NULL, "i2c1_fck", "i2c1_fck"), |
85 | DT_CLK(NULL, "mcbsp5_fck", "mcbsp5_fck"), | ||
86 | DT_CLK(NULL, "mcbsp1_fck", "mcbsp1_fck"), | ||
87 | DT_CLK(NULL, "core_48m_fck", "core_48m_fck"), | 84 | DT_CLK(NULL, "core_48m_fck", "core_48m_fck"), |
88 | DT_CLK(NULL, "mcspi4_fck", "mcspi4_fck"), | 85 | DT_CLK(NULL, "mcspi4_fck", "mcspi4_fck"), |
89 | DT_CLK(NULL, "mcspi3_fck", "mcspi3_fck"), | 86 | DT_CLK(NULL, "mcspi3_fck", "mcspi3_fck"), |
@@ -122,10 +119,6 @@ static struct ti_dt_clk omap3xxx_clks[] = { | |||
122 | DT_CLK(NULL, "uart1_ick", "uart1_ick"), | 119 | DT_CLK(NULL, "uart1_ick", "uart1_ick"), |
123 | DT_CLK(NULL, "gpt11_ick", "gpt11_ick"), | 120 | DT_CLK(NULL, "gpt11_ick", "gpt11_ick"), |
124 | DT_CLK(NULL, "gpt10_ick", "gpt10_ick"), | 121 | DT_CLK(NULL, "gpt10_ick", "gpt10_ick"), |
125 | DT_CLK("omap-mcbsp.5", "ick", "mcbsp5_ick"), | ||
126 | DT_CLK("omap-mcbsp.1", "ick", "mcbsp1_ick"), | ||
127 | DT_CLK(NULL, "mcbsp5_ick", "mcbsp5_ick"), | ||
128 | DT_CLK(NULL, "mcbsp1_ick", "mcbsp1_ick"), | ||
129 | DT_CLK(NULL, "omapctrl_ick", "omapctrl_ick"), | 122 | DT_CLK(NULL, "omapctrl_ick", "omapctrl_ick"), |
130 | DT_CLK(NULL, "dss_tv_fck", "dss_tv_fck"), | 123 | DT_CLK(NULL, "dss_tv_fck", "dss_tv_fck"), |
131 | DT_CLK(NULL, "dss_96m_fck", "dss_96m_fck"), | 124 | DT_CLK(NULL, "dss_96m_fck", "dss_96m_fck"), |
@@ -179,15 +172,17 @@ static struct ti_dt_clk omap3xxx_clks[] = { | |||
179 | DT_CLK(NULL, "gpt4_ick", "gpt4_ick"), | 172 | DT_CLK(NULL, "gpt4_ick", "gpt4_ick"), |
180 | DT_CLK(NULL, "gpt3_ick", "gpt3_ick"), | 173 | DT_CLK(NULL, "gpt3_ick", "gpt3_ick"), |
181 | DT_CLK(NULL, "gpt2_ick", "gpt2_ick"), | 174 | DT_CLK(NULL, "gpt2_ick", "gpt2_ick"), |
182 | DT_CLK("omap-mcbsp.2", "ick", "mcbsp2_ick"), | 175 | DT_CLK(NULL, "mcbsp_clks", "mcbsp_clks"), |
183 | DT_CLK("omap-mcbsp.3", "ick", "mcbsp3_ick"), | 176 | DT_CLK(NULL, "mcbsp1_ick", "mcbsp1_ick"), |
184 | DT_CLK("omap-mcbsp.4", "ick", "mcbsp4_ick"), | 177 | DT_CLK(NULL, "mcbsp2_ick", "mcbsp2_ick"), |
185 | DT_CLK(NULL, "mcbsp4_ick", "mcbsp2_ick"), | ||
186 | DT_CLK(NULL, "mcbsp3_ick", "mcbsp3_ick"), | 178 | DT_CLK(NULL, "mcbsp3_ick", "mcbsp3_ick"), |
187 | DT_CLK(NULL, "mcbsp2_ick", "mcbsp4_ick"), | 179 | DT_CLK(NULL, "mcbsp4_ick", "mcbsp4_ick"), |
180 | DT_CLK(NULL, "mcbsp5_ick", "mcbsp5_ick"), | ||
181 | DT_CLK(NULL, "mcbsp1_fck", "mcbsp1_fck"), | ||
188 | DT_CLK(NULL, "mcbsp2_fck", "mcbsp2_fck"), | 182 | DT_CLK(NULL, "mcbsp2_fck", "mcbsp2_fck"), |
189 | DT_CLK(NULL, "mcbsp3_fck", "mcbsp3_fck"), | 183 | DT_CLK(NULL, "mcbsp3_fck", "mcbsp3_fck"), |
190 | DT_CLK(NULL, "mcbsp4_fck", "mcbsp4_fck"), | 184 | DT_CLK(NULL, "mcbsp4_fck", "mcbsp4_fck"), |
185 | DT_CLK(NULL, "mcbsp5_fck", "mcbsp5_fck"), | ||
191 | DT_CLK("etb", "emu_src_ck", "emu_src_ck"), | 186 | DT_CLK("etb", "emu_src_ck", "emu_src_ck"), |
192 | DT_CLK(NULL, "emu_src_ck", "emu_src_ck"), | 187 | DT_CLK(NULL, "emu_src_ck", "emu_src_ck"), |
193 | DT_CLK(NULL, "pclk_fck", "pclk_fck"), | 188 | DT_CLK(NULL, "pclk_fck", "pclk_fck"), |
diff --git a/drivers/clk/ti/clk-44xx.c b/drivers/clk/ti/clk-44xx.c index 4f4c87751db5..581db7711f51 100644 --- a/drivers/clk/ti/clk-44xx.c +++ b/drivers/clk/ti/clk-44xx.c | |||
@@ -249,17 +249,6 @@ static struct ti_dt_clk omap44xx_clks[] = { | |||
249 | DT_CLK("usbhs_tll", "usbtll_fck", "dummy_ck"), | 249 | DT_CLK("usbhs_tll", "usbtll_fck", "dummy_ck"), |
250 | DT_CLK("omap_wdt", "ick", "dummy_ck"), | 250 | DT_CLK("omap_wdt", "ick", "dummy_ck"), |
251 | DT_CLK(NULL, "timer_32k_ck", "sys_32k_ck"), | 251 | DT_CLK(NULL, "timer_32k_ck", "sys_32k_ck"), |
252 | DT_CLK("omap_timer.1", "timer_sys_ck", "sys_clkin_ck"), | ||
253 | DT_CLK("omap_timer.2", "timer_sys_ck", "sys_clkin_ck"), | ||
254 | DT_CLK("omap_timer.3", "timer_sys_ck", "sys_clkin_ck"), | ||
255 | DT_CLK("omap_timer.4", "timer_sys_ck", "sys_clkin_ck"), | ||
256 | DT_CLK("omap_timer.9", "timer_sys_ck", "sys_clkin_ck"), | ||
257 | DT_CLK("omap_timer.10", "timer_sys_ck", "sys_clkin_ck"), | ||
258 | DT_CLK("omap_timer.11", "timer_sys_ck", "sys_clkin_ck"), | ||
259 | DT_CLK("omap_timer.5", "timer_sys_ck", "syc_clk_div_ck"), | ||
260 | DT_CLK("omap_timer.6", "timer_sys_ck", "syc_clk_div_ck"), | ||
261 | DT_CLK("omap_timer.7", "timer_sys_ck", "syc_clk_div_ck"), | ||
262 | DT_CLK("omap_timer.8", "timer_sys_ck", "syc_clk_div_ck"), | ||
263 | DT_CLK("4a318000.timer", "timer_sys_ck", "sys_clkin_ck"), | 252 | DT_CLK("4a318000.timer", "timer_sys_ck", "sys_clkin_ck"), |
264 | DT_CLK("48032000.timer", "timer_sys_ck", "sys_clkin_ck"), | 253 | DT_CLK("48032000.timer", "timer_sys_ck", "sys_clkin_ck"), |
265 | DT_CLK("48034000.timer", "timer_sys_ck", "sys_clkin_ck"), | 254 | DT_CLK("48034000.timer", "timer_sys_ck", "sys_clkin_ck"), |
diff --git a/drivers/clk/ti/clk-54xx.c b/drivers/clk/ti/clk-54xx.c index 14160b223548..96c69a335975 100644 --- a/drivers/clk/ti/clk-54xx.c +++ b/drivers/clk/ti/clk-54xx.c | |||
@@ -208,17 +208,17 @@ static struct ti_dt_clk omap54xx_clks[] = { | |||
208 | DT_CLK("usbhs_omap", "usbtll_fck", "dummy_ck"), | 208 | DT_CLK("usbhs_omap", "usbtll_fck", "dummy_ck"), |
209 | DT_CLK("omap_wdt", "ick", "dummy_ck"), | 209 | DT_CLK("omap_wdt", "ick", "dummy_ck"), |
210 | DT_CLK(NULL, "timer_32k_ck", "sys_32k_ck"), | 210 | DT_CLK(NULL, "timer_32k_ck", "sys_32k_ck"), |
211 | DT_CLK("omap_timer.1", "sys_ck", "sys_clkin"), | 211 | DT_CLK("4ae18000.timer", "timer_sys_ck", "sys_clkin"), |
212 | DT_CLK("omap_timer.2", "sys_ck", "sys_clkin"), | 212 | DT_CLK("48032000.timer", "timer_sys_ck", "sys_clkin"), |
213 | DT_CLK("omap_timer.3", "sys_ck", "sys_clkin"), | 213 | DT_CLK("48034000.timer", "timer_sys_ck", "sys_clkin"), |
214 | DT_CLK("omap_timer.4", "sys_ck", "sys_clkin"), | 214 | DT_CLK("48036000.timer", "timer_sys_ck", "sys_clkin"), |
215 | DT_CLK("omap_timer.9", "sys_ck", "sys_clkin"), | 215 | DT_CLK("4803e000.timer", "timer_sys_ck", "sys_clkin"), |
216 | DT_CLK("omap_timer.10", "sys_ck", "sys_clkin"), | 216 | DT_CLK("48086000.timer", "timer_sys_ck", "sys_clkin"), |
217 | DT_CLK("omap_timer.11", "sys_ck", "sys_clkin"), | 217 | DT_CLK("48088000.timer", "timer_sys_ck", "sys_clkin"), |
218 | DT_CLK("omap_timer.5", "sys_ck", "dss_syc_gfclk_div"), | 218 | DT_CLK("40138000.timer", "timer_sys_ck", "dss_syc_gfclk_div"), |
219 | DT_CLK("omap_timer.6", "sys_ck", "dss_syc_gfclk_div"), | 219 | DT_CLK("4013a000.timer", "timer_sys_ck", "dss_syc_gfclk_div"), |
220 | DT_CLK("omap_timer.7", "sys_ck", "dss_syc_gfclk_div"), | 220 | DT_CLK("4013c000.timer", "timer_sys_ck", "dss_syc_gfclk_div"), |
221 | DT_CLK("omap_timer.8", "sys_ck", "dss_syc_gfclk_div"), | 221 | DT_CLK("4013e000.timer", "timer_sys_ck", "dss_syc_gfclk_div"), |
222 | { .node_name = NULL }, | 222 | { .node_name = NULL }, |
223 | }; | 223 | }; |
224 | 224 | ||
diff --git a/drivers/clk/ti/clk-7xx.c b/drivers/clk/ti/clk-7xx.c index ee32f4deebf4..5d2217ae4478 100644 --- a/drivers/clk/ti/clk-7xx.c +++ b/drivers/clk/ti/clk-7xx.c | |||
@@ -289,17 +289,21 @@ static struct ti_dt_clk dra7xx_clks[] = { | |||
289 | DT_CLK("usbhs_omap", "usbtll_fck", "dummy_ck"), | 289 | DT_CLK("usbhs_omap", "usbtll_fck", "dummy_ck"), |
290 | DT_CLK("omap_wdt", "ick", "dummy_ck"), | 290 | DT_CLK("omap_wdt", "ick", "dummy_ck"), |
291 | DT_CLK(NULL, "timer_32k_ck", "sys_32k_ck"), | 291 | DT_CLK(NULL, "timer_32k_ck", "sys_32k_ck"), |
292 | DT_CLK("4ae18000.timer", "timer_sys_ck", "sys_clkin2"), | 292 | DT_CLK("4ae18000.timer", "timer_sys_ck", "timer_sys_clk_div"), |
293 | DT_CLK("48032000.timer", "timer_sys_ck", "sys_clkin2"), | 293 | DT_CLK("48032000.timer", "timer_sys_ck", "timer_sys_clk_div"), |
294 | DT_CLK("48034000.timer", "timer_sys_ck", "sys_clkin2"), | 294 | DT_CLK("48034000.timer", "timer_sys_ck", "timer_sys_clk_div"), |
295 | DT_CLK("48036000.timer", "timer_sys_ck", "sys_clkin2"), | 295 | DT_CLK("48036000.timer", "timer_sys_ck", "timer_sys_clk_div"), |
296 | DT_CLK("4803e000.timer", "timer_sys_ck", "sys_clkin2"), | 296 | DT_CLK("4803e000.timer", "timer_sys_ck", "timer_sys_clk_div"), |
297 | DT_CLK("48086000.timer", "timer_sys_ck", "sys_clkin2"), | 297 | DT_CLK("48086000.timer", "timer_sys_ck", "timer_sys_clk_div"), |
298 | DT_CLK("48088000.timer", "timer_sys_ck", "sys_clkin2"), | 298 | DT_CLK("48088000.timer", "timer_sys_ck", "timer_sys_clk_div"), |
299 | DT_CLK("48820000.timer", "timer_sys_ck", "timer_sys_clk_div"), | 299 | DT_CLK("48820000.timer", "timer_sys_ck", "timer_sys_clk_div"), |
300 | DT_CLK("48822000.timer", "timer_sys_ck", "timer_sys_clk_div"), | 300 | DT_CLK("48822000.timer", "timer_sys_ck", "timer_sys_clk_div"), |
301 | DT_CLK("48824000.timer", "timer_sys_ck", "timer_sys_clk_div"), | 301 | DT_CLK("48824000.timer", "timer_sys_ck", "timer_sys_clk_div"), |
302 | DT_CLK("48826000.timer", "timer_sys_ck", "timer_sys_clk_div"), | 302 | DT_CLK("48826000.timer", "timer_sys_ck", "timer_sys_clk_div"), |
303 | DT_CLK("48828000.timer", "timer_sys_ck", "timer_sys_clk_div"), | ||
304 | DT_CLK("4882a000.timer", "timer_sys_ck", "timer_sys_clk_div"), | ||
305 | DT_CLK("4882c000.timer", "timer_sys_ck", "timer_sys_clk_div"), | ||
306 | DT_CLK("4882e000.timer", "timer_sys_ck", "timer_sys_clk_div"), | ||
303 | DT_CLK(NULL, "sys_clkin", "sys_clkin1"), | 307 | DT_CLK(NULL, "sys_clkin", "sys_clkin1"), |
304 | { .node_name = NULL }, | 308 | { .node_name = NULL }, |
305 | }; | 309 | }; |
diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c index e22b95646e09..0ebe5c51062b 100644 --- a/drivers/clk/ti/clk.c +++ b/drivers/clk/ti/clk.c | |||
@@ -103,7 +103,8 @@ int __init ti_clk_retry_init(struct device_node *node, struct clk_hw *hw, | |||
103 | * @index: register index from the clock node | 103 | * @index: register index from the clock node |
104 | * | 104 | * |
105 | * Builds clock register address from device tree information. This | 105 | * Builds clock register address from device tree information. This |
106 | * is a struct of type clk_omap_reg. | 106 | * is a struct of type clk_omap_reg. Returns a pointer to the register |
107 | * address, or a pointer error value in failure. | ||
107 | */ | 108 | */ |
108 | void __iomem *ti_clk_get_reg_addr(struct device_node *node, int index) | 109 | void __iomem *ti_clk_get_reg_addr(struct device_node *node, int index) |
109 | { | 110 | { |
@@ -121,14 +122,14 @@ void __iomem *ti_clk_get_reg_addr(struct device_node *node, int index) | |||
121 | 122 | ||
122 | if (i == CLK_MAX_MEMMAPS) { | 123 | if (i == CLK_MAX_MEMMAPS) { |
123 | pr_err("clk-provider not found for %s!\n", node->name); | 124 | pr_err("clk-provider not found for %s!\n", node->name); |
124 | return NULL; | 125 | return ERR_PTR(-ENOENT); |
125 | } | 126 | } |
126 | 127 | ||
127 | reg->index = i; | 128 | reg->index = i; |
128 | 129 | ||
129 | if (of_property_read_u32_index(node, "reg", index, &val)) { | 130 | if (of_property_read_u32_index(node, "reg", index, &val)) { |
130 | pr_err("%s must have reg[%d]!\n", node->name, index); | 131 | pr_err("%s must have reg[%d]!\n", node->name, index); |
131 | return NULL; | 132 | return ERR_PTR(-EINVAL); |
132 | } | 133 | } |
133 | 134 | ||
134 | reg->offset = val; | 135 | reg->offset = val; |
diff --git a/drivers/clk/ti/divider.c b/drivers/clk/ti/divider.c index 6211893c0980..ff5f117950a9 100644 --- a/drivers/clk/ti/divider.c +++ b/drivers/clk/ti/divider.c | |||
@@ -530,8 +530,8 @@ static int __init ti_clk_divider_populate(struct device_node *node, | |||
530 | u32 val; | 530 | u32 val; |
531 | 531 | ||
532 | *reg = ti_clk_get_reg_addr(node, 0); | 532 | *reg = ti_clk_get_reg_addr(node, 0); |
533 | if (!*reg) | 533 | if (IS_ERR(*reg)) |
534 | return -EINVAL; | 534 | return PTR_ERR(*reg); |
535 | 535 | ||
536 | if (!of_property_read_u32(node, "ti,bit-shift", &val)) | 536 | if (!of_property_read_u32(node, "ti,bit-shift", &val)) |
537 | *shift = val; | 537 | *shift = val; |
diff --git a/drivers/clk/ti/dpll.c b/drivers/clk/ti/dpll.c index 81dc4698dc41..11478a501c30 100644 --- a/drivers/clk/ti/dpll.c +++ b/drivers/clk/ti/dpll.c | |||
@@ -390,18 +390,18 @@ static void __init of_ti_dpll_setup(struct device_node *node, | |||
390 | #endif | 390 | #endif |
391 | } else { | 391 | } else { |
392 | dd->idlest_reg = ti_clk_get_reg_addr(node, 1); | 392 | dd->idlest_reg = ti_clk_get_reg_addr(node, 1); |
393 | if (!dd->idlest_reg) | 393 | if (IS_ERR(dd->idlest_reg)) |
394 | goto cleanup; | 394 | goto cleanup; |
395 | 395 | ||
396 | dd->mult_div1_reg = ti_clk_get_reg_addr(node, 2); | 396 | dd->mult_div1_reg = ti_clk_get_reg_addr(node, 2); |
397 | } | 397 | } |
398 | 398 | ||
399 | if (!dd->control_reg || !dd->mult_div1_reg) | 399 | if (IS_ERR(dd->control_reg) || IS_ERR(dd->mult_div1_reg)) |
400 | goto cleanup; | 400 | goto cleanup; |
401 | 401 | ||
402 | if (dd->autoidle_mask) { | 402 | if (dd->autoidle_mask) { |
403 | dd->autoidle_reg = ti_clk_get_reg_addr(node, 3); | 403 | dd->autoidle_reg = ti_clk_get_reg_addr(node, 3); |
404 | if (!dd->autoidle_reg) | 404 | if (IS_ERR(dd->autoidle_reg)) |
405 | goto cleanup; | 405 | goto cleanup; |
406 | } | 406 | } |
407 | 407 | ||
diff --git a/drivers/clk/ti/fapll.c b/drivers/clk/ti/fapll.c index d21640634adf..ffcd8e09e85b 100644 --- a/drivers/clk/ti/fapll.c +++ b/drivers/clk/ti/fapll.c | |||
@@ -11,19 +11,27 @@ | |||
11 | 11 | ||
12 | #include <linux/clk-provider.h> | 12 | #include <linux/clk-provider.h> |
13 | #include <linux/delay.h> | 13 | #include <linux/delay.h> |
14 | #include <linux/slab.h> | ||
15 | #include <linux/err.h> | 14 | #include <linux/err.h> |
15 | #include <linux/math64.h> | ||
16 | #include <linux/of.h> | 16 | #include <linux/of.h> |
17 | #include <linux/of_address.h> | 17 | #include <linux/of_address.h> |
18 | #include <linux/clk/ti.h> | 18 | #include <linux/clk/ti.h> |
19 | #include <asm/div64.h> | ||
20 | 19 | ||
21 | /* FAPLL Control Register PLL_CTRL */ | 20 | /* FAPLL Control Register PLL_CTRL */ |
21 | #define FAPLL_MAIN_MULT_N_SHIFT 16 | ||
22 | #define FAPLL_MAIN_DIV_P_SHIFT 8 | ||
22 | #define FAPLL_MAIN_LOCK BIT(7) | 23 | #define FAPLL_MAIN_LOCK BIT(7) |
23 | #define FAPLL_MAIN_PLLEN BIT(3) | 24 | #define FAPLL_MAIN_PLLEN BIT(3) |
24 | #define FAPLL_MAIN_BP BIT(2) | 25 | #define FAPLL_MAIN_BP BIT(2) |
25 | #define FAPLL_MAIN_LOC_CTL BIT(0) | 26 | #define FAPLL_MAIN_LOC_CTL BIT(0) |
26 | 27 | ||
28 | #define FAPLL_MAIN_MAX_MULT_N 0xffff | ||
29 | #define FAPLL_MAIN_MAX_DIV_P 0xff | ||
30 | #define FAPLL_MAIN_CLEAR_MASK \ | ||
31 | ((FAPLL_MAIN_MAX_MULT_N << FAPLL_MAIN_MULT_N_SHIFT) | \ | ||
32 | (FAPLL_MAIN_DIV_P_SHIFT << FAPLL_MAIN_DIV_P_SHIFT) | \ | ||
33 | FAPLL_MAIN_LOC_CTL) | ||
34 | |||
27 | /* FAPLL powerdown register PWD */ | 35 | /* FAPLL powerdown register PWD */ |
28 | #define FAPLL_PWD_OFFSET 4 | 36 | #define FAPLL_PWD_OFFSET 4 |
29 | 37 | ||
@@ -49,6 +57,10 @@ | |||
49 | /* Synthesizer frequency register */ | 57 | /* Synthesizer frequency register */ |
50 | #define SYNTH_LDFREQ BIT(31) | 58 | #define SYNTH_LDFREQ BIT(31) |
51 | 59 | ||
60 | #define SYNTH_PHASE_K 8 | ||
61 | #define SYNTH_MAX_INT_DIV 0xf | ||
62 | #define SYNTH_MAX_DIV_M 0xff | ||
63 | |||
52 | struct fapll_data { | 64 | struct fapll_data { |
53 | struct clk_hw hw; | 65 | struct clk_hw hw; |
54 | void __iomem *base; | 66 | void __iomem *base; |
@@ -79,6 +91,48 @@ static bool ti_fapll_clock_is_bypass(struct fapll_data *fd) | |||
79 | return !!(v & FAPLL_MAIN_BP); | 91 | return !!(v & FAPLL_MAIN_BP); |
80 | } | 92 | } |
81 | 93 | ||
94 | static void ti_fapll_set_bypass(struct fapll_data *fd) | ||
95 | { | ||
96 | u32 v = readl_relaxed(fd->base); | ||
97 | |||
98 | if (fd->bypass_bit_inverted) | ||
99 | v &= ~FAPLL_MAIN_BP; | ||
100 | else | ||
101 | v |= FAPLL_MAIN_BP; | ||
102 | writel_relaxed(v, fd->base); | ||
103 | } | ||
104 | |||
105 | static void ti_fapll_clear_bypass(struct fapll_data *fd) | ||
106 | { | ||
107 | u32 v = readl_relaxed(fd->base); | ||
108 | |||
109 | if (fd->bypass_bit_inverted) | ||
110 | v |= FAPLL_MAIN_BP; | ||
111 | else | ||
112 | v &= ~FAPLL_MAIN_BP; | ||
113 | writel_relaxed(v, fd->base); | ||
114 | } | ||
115 | |||
116 | static int ti_fapll_wait_lock(struct fapll_data *fd) | ||
117 | { | ||
118 | int retries = FAPLL_MAX_RETRIES; | ||
119 | u32 v; | ||
120 | |||
121 | while ((v = readl_relaxed(fd->base))) { | ||
122 | if (v & FAPLL_MAIN_LOCK) | ||
123 | return 0; | ||
124 | |||
125 | if (retries-- <= 0) | ||
126 | break; | ||
127 | |||
128 | udelay(1); | ||
129 | } | ||
130 | |||
131 | pr_err("%s failed to lock\n", fd->name); | ||
132 | |||
133 | return -ETIMEDOUT; | ||
134 | } | ||
135 | |||
82 | static int ti_fapll_enable(struct clk_hw *hw) | 136 | static int ti_fapll_enable(struct clk_hw *hw) |
83 | { | 137 | { |
84 | struct fapll_data *fd = to_fapll(hw); | 138 | struct fapll_data *fd = to_fapll(hw); |
@@ -86,6 +140,7 @@ static int ti_fapll_enable(struct clk_hw *hw) | |||
86 | 140 | ||
87 | v |= FAPLL_MAIN_PLLEN; | 141 | v |= FAPLL_MAIN_PLLEN; |
88 | writel_relaxed(v, fd->base); | 142 | writel_relaxed(v, fd->base); |
143 | ti_fapll_wait_lock(fd); | ||
89 | 144 | ||
90 | return 0; | 145 | return 0; |
91 | } | 146 | } |
@@ -141,12 +196,85 @@ static u8 ti_fapll_get_parent(struct clk_hw *hw) | |||
141 | return 0; | 196 | return 0; |
142 | } | 197 | } |
143 | 198 | ||
199 | static int ti_fapll_set_div_mult(unsigned long rate, | ||
200 | unsigned long parent_rate, | ||
201 | u32 *pre_div_p, u32 *mult_n) | ||
202 | { | ||
203 | /* | ||
204 | * So far no luck getting decent clock with PLL divider, | ||
205 | * PLL does not seem to lock and the signal does not look | ||
206 | * right. It seems the divider can only be used together | ||
207 | * with the multiplier? | ||
208 | */ | ||
209 | if (rate < parent_rate) { | ||
210 | pr_warn("FAPLL main divider rates unsupported\n"); | ||
211 | return -EINVAL; | ||
212 | } | ||
213 | |||
214 | *mult_n = rate / parent_rate; | ||
215 | if (*mult_n > FAPLL_MAIN_MAX_MULT_N) | ||
216 | return -EINVAL; | ||
217 | *pre_div_p = 1; | ||
218 | |||
219 | return 0; | ||
220 | } | ||
221 | |||
222 | static long ti_fapll_round_rate(struct clk_hw *hw, unsigned long rate, | ||
223 | unsigned long *parent_rate) | ||
224 | { | ||
225 | u32 pre_div_p, mult_n; | ||
226 | int error; | ||
227 | |||
228 | if (!rate) | ||
229 | return -EINVAL; | ||
230 | |||
231 | error = ti_fapll_set_div_mult(rate, *parent_rate, | ||
232 | &pre_div_p, &mult_n); | ||
233 | if (error) | ||
234 | return error; | ||
235 | |||
236 | rate = *parent_rate / pre_div_p; | ||
237 | rate *= mult_n; | ||
238 | |||
239 | return rate; | ||
240 | } | ||
241 | |||
242 | static int ti_fapll_set_rate(struct clk_hw *hw, unsigned long rate, | ||
243 | unsigned long parent_rate) | ||
244 | { | ||
245 | struct fapll_data *fd = to_fapll(hw); | ||
246 | u32 pre_div_p, mult_n, v; | ||
247 | int error; | ||
248 | |||
249 | if (!rate) | ||
250 | return -EINVAL; | ||
251 | |||
252 | error = ti_fapll_set_div_mult(rate, parent_rate, | ||
253 | &pre_div_p, &mult_n); | ||
254 | if (error) | ||
255 | return error; | ||
256 | |||
257 | ti_fapll_set_bypass(fd); | ||
258 | v = readl_relaxed(fd->base); | ||
259 | v &= ~FAPLL_MAIN_CLEAR_MASK; | ||
260 | v |= pre_div_p << FAPLL_MAIN_DIV_P_SHIFT; | ||
261 | v |= mult_n << FAPLL_MAIN_MULT_N_SHIFT; | ||
262 | writel_relaxed(v, fd->base); | ||
263 | if (ti_fapll_is_enabled(hw)) | ||
264 | ti_fapll_wait_lock(fd); | ||
265 | ti_fapll_clear_bypass(fd); | ||
266 | |||
267 | return 0; | ||
268 | } | ||
269 | |||
144 | static struct clk_ops ti_fapll_ops = { | 270 | static struct clk_ops ti_fapll_ops = { |
145 | .enable = ti_fapll_enable, | 271 | .enable = ti_fapll_enable, |
146 | .disable = ti_fapll_disable, | 272 | .disable = ti_fapll_disable, |
147 | .is_enabled = ti_fapll_is_enabled, | 273 | .is_enabled = ti_fapll_is_enabled, |
148 | .recalc_rate = ti_fapll_recalc_rate, | 274 | .recalc_rate = ti_fapll_recalc_rate, |
149 | .get_parent = ti_fapll_get_parent, | 275 | .get_parent = ti_fapll_get_parent, |
276 | .round_rate = ti_fapll_round_rate, | ||
277 | .set_rate = ti_fapll_set_rate, | ||
150 | }; | 278 | }; |
151 | 279 | ||
152 | static int ti_fapll_synth_enable(struct clk_hw *hw) | 280 | static int ti_fapll_synth_enable(struct clk_hw *hw) |
@@ -204,7 +332,7 @@ static unsigned long ti_fapll_synth_recalc_rate(struct clk_hw *hw, | |||
204 | /* | 332 | /* |
205 | * Synth frequency integer and fractional divider. | 333 | * Synth frequency integer and fractional divider. |
206 | * Note that the phase output K is 8, so the result needs | 334 | * Note that the phase output K is 8, so the result needs |
207 | * to be multiplied by 8. | 335 | * to be multiplied by SYNTH_PHASE_K. |
208 | */ | 336 | */ |
209 | if (synth->freq) { | 337 | if (synth->freq) { |
210 | u32 v, synth_int_div, synth_frac_div, synth_div_freq; | 338 | u32 v, synth_int_div, synth_frac_div, synth_div_freq; |
@@ -215,14 +343,138 @@ static unsigned long ti_fapll_synth_recalc_rate(struct clk_hw *hw, | |||
215 | synth_div_freq = (synth_int_div * 10000000) + synth_frac_div; | 343 | synth_div_freq = (synth_int_div * 10000000) + synth_frac_div; |
216 | rate *= 10000000; | 344 | rate *= 10000000; |
217 | do_div(rate, synth_div_freq); | 345 | do_div(rate, synth_div_freq); |
218 | rate *= 8; | 346 | rate *= SYNTH_PHASE_K; |
219 | } | 347 | } |
220 | 348 | ||
221 | /* Synth ost-divider M */ | 349 | /* Synth post-divider M */ |
222 | synth_div_m = readl_relaxed(synth->div) & 0xff; | 350 | synth_div_m = readl_relaxed(synth->div) & SYNTH_MAX_DIV_M; |
223 | do_div(rate, synth_div_m); | ||
224 | 351 | ||
225 | return rate; | 352 | return DIV_ROUND_UP_ULL(rate, synth_div_m); |
353 | } | ||
354 | |||
355 | static unsigned long ti_fapll_synth_get_frac_rate(struct clk_hw *hw, | ||
356 | unsigned long parent_rate) | ||
357 | { | ||
358 | struct fapll_synth *synth = to_synth(hw); | ||
359 | unsigned long current_rate, frac_rate; | ||
360 | u32 post_div_m; | ||
361 | |||
362 | current_rate = ti_fapll_synth_recalc_rate(hw, parent_rate); | ||
363 | post_div_m = readl_relaxed(synth->div) & SYNTH_MAX_DIV_M; | ||
364 | frac_rate = current_rate * post_div_m; | ||
365 | |||
366 | return frac_rate; | ||
367 | } | ||
368 | |||
369 | static u32 ti_fapll_synth_set_frac_rate(struct fapll_synth *synth, | ||
370 | unsigned long rate, | ||
371 | unsigned long parent_rate) | ||
372 | { | ||
373 | u32 post_div_m, synth_int_div = 0, synth_frac_div = 0, v; | ||
374 | |||
375 | post_div_m = DIV_ROUND_UP_ULL((u64)parent_rate * SYNTH_PHASE_K, rate); | ||
376 | post_div_m = post_div_m / SYNTH_MAX_INT_DIV; | ||
377 | if (post_div_m > SYNTH_MAX_DIV_M) | ||
378 | return -EINVAL; | ||
379 | if (!post_div_m) | ||
380 | post_div_m = 1; | ||
381 | |||
382 | for (; post_div_m < SYNTH_MAX_DIV_M; post_div_m++) { | ||
383 | synth_int_div = DIV_ROUND_UP_ULL((u64)parent_rate * | ||
384 | SYNTH_PHASE_K * | ||
385 | 10000000, | ||
386 | rate * post_div_m); | ||
387 | synth_frac_div = synth_int_div % 10000000; | ||
388 | synth_int_div /= 10000000; | ||
389 | |||
390 | if (synth_int_div <= SYNTH_MAX_INT_DIV) | ||
391 | break; | ||
392 | } | ||
393 | |||
394 | if (synth_int_div > SYNTH_MAX_INT_DIV) | ||
395 | return -EINVAL; | ||
396 | |||
397 | v = readl_relaxed(synth->freq); | ||
398 | v &= ~0x1fffffff; | ||
399 | v |= (synth_int_div & SYNTH_MAX_INT_DIV) << 24; | ||
400 | v |= (synth_frac_div & 0xffffff); | ||
401 | v |= SYNTH_LDFREQ; | ||
402 | writel_relaxed(v, synth->freq); | ||
403 | |||
404 | return post_div_m; | ||
405 | } | ||
406 | |||
407 | static long ti_fapll_synth_round_rate(struct clk_hw *hw, unsigned long rate, | ||
408 | unsigned long *parent_rate) | ||
409 | { | ||
410 | struct fapll_synth *synth = to_synth(hw); | ||
411 | struct fapll_data *fd = synth->fd; | ||
412 | unsigned long r; | ||
413 | |||
414 | if (ti_fapll_clock_is_bypass(fd) || !synth->div || !rate) | ||
415 | return -EINVAL; | ||
416 | |||
417 | /* Only post divider m available with no fractional divider? */ | ||
418 | if (!synth->freq) { | ||
419 | unsigned long frac_rate; | ||
420 | u32 synth_post_div_m; | ||
421 | |||
422 | frac_rate = ti_fapll_synth_get_frac_rate(hw, *parent_rate); | ||
423 | synth_post_div_m = DIV_ROUND_UP(frac_rate, rate); | ||
424 | r = DIV_ROUND_UP(frac_rate, synth_post_div_m); | ||
425 | goto out; | ||
426 | } | ||
427 | |||
428 | r = *parent_rate * SYNTH_PHASE_K; | ||
429 | if (rate > r) | ||
430 | goto out; | ||
431 | |||
432 | r = DIV_ROUND_UP_ULL(r, SYNTH_MAX_INT_DIV * SYNTH_MAX_DIV_M); | ||
433 | if (rate < r) | ||
434 | goto out; | ||
435 | |||
436 | r = rate; | ||
437 | out: | ||
438 | return r; | ||
439 | } | ||
440 | |||
441 | static int ti_fapll_synth_set_rate(struct clk_hw *hw, unsigned long rate, | ||
442 | unsigned long parent_rate) | ||
443 | { | ||
444 | struct fapll_synth *synth = to_synth(hw); | ||
445 | struct fapll_data *fd = synth->fd; | ||
446 | unsigned long frac_rate, post_rate = 0; | ||
447 | u32 post_div_m = 0, v; | ||
448 | |||
449 | if (ti_fapll_clock_is_bypass(fd) || !synth->div || !rate) | ||
450 | return -EINVAL; | ||
451 | |||
452 | /* Produce the rate with just post divider M? */ | ||
453 | frac_rate = ti_fapll_synth_get_frac_rate(hw, parent_rate); | ||
454 | if (frac_rate < rate) { | ||
455 | if (!synth->freq) | ||
456 | return -EINVAL; | ||
457 | } else { | ||
458 | post_div_m = DIV_ROUND_UP(frac_rate, rate); | ||
459 | if (post_div_m && (post_div_m <= SYNTH_MAX_DIV_M)) | ||
460 | post_rate = DIV_ROUND_UP(frac_rate, post_div_m); | ||
461 | if (!synth->freq && !post_rate) | ||
462 | return -EINVAL; | ||
463 | } | ||
464 | |||
465 | /* Need to recalculate the fractional divider? */ | ||
466 | if ((post_rate != rate) && synth->freq) | ||
467 | post_div_m = ti_fapll_synth_set_frac_rate(synth, | ||
468 | rate, | ||
469 | parent_rate); | ||
470 | |||
471 | v = readl_relaxed(synth->div); | ||
472 | v &= ~SYNTH_MAX_DIV_M; | ||
473 | v |= post_div_m; | ||
474 | v |= SYNTH_LDMDIV1; | ||
475 | writel_relaxed(v, synth->div); | ||
476 | |||
477 | return 0; | ||
226 | } | 478 | } |
227 | 479 | ||
228 | static struct clk_ops ti_fapll_synt_ops = { | 480 | static struct clk_ops ti_fapll_synt_ops = { |
@@ -230,6 +482,8 @@ static struct clk_ops ti_fapll_synt_ops = { | |||
230 | .disable = ti_fapll_synth_disable, | 482 | .disable = ti_fapll_synth_disable, |
231 | .is_enabled = ti_fapll_synth_is_enabled, | 483 | .is_enabled = ti_fapll_synth_is_enabled, |
232 | .recalc_rate = ti_fapll_synth_recalc_rate, | 484 | .recalc_rate = ti_fapll_synth_recalc_rate, |
485 | .round_rate = ti_fapll_synth_round_rate, | ||
486 | .set_rate = ti_fapll_synth_set_rate, | ||
233 | }; | 487 | }; |
234 | 488 | ||
235 | static struct clk * __init ti_fapll_synth_setup(struct fapll_data *fd, | 489 | static struct clk * __init ti_fapll_synth_setup(struct fapll_data *fd, |
diff --git a/drivers/clk/ti/gate.c b/drivers/clk/ti/gate.c index d493307b73f4..0c6fdfcd5f93 100644 --- a/drivers/clk/ti/gate.c +++ b/drivers/clk/ti/gate.c | |||
@@ -225,7 +225,7 @@ static void __init _of_ti_gate_clk_setup(struct device_node *node, | |||
225 | 225 | ||
226 | if (ops != &omap_gate_clkdm_clk_ops) { | 226 | if (ops != &omap_gate_clkdm_clk_ops) { |
227 | reg = ti_clk_get_reg_addr(node, 0); | 227 | reg = ti_clk_get_reg_addr(node, 0); |
228 | if (!reg) | 228 | if (IS_ERR(reg)) |
229 | return; | 229 | return; |
230 | 230 | ||
231 | if (!of_property_read_u32(node, "ti,bit-shift", &val)) | 231 | if (!of_property_read_u32(node, "ti,bit-shift", &val)) |
@@ -264,7 +264,7 @@ _of_ti_composite_gate_clk_setup(struct device_node *node, | |||
264 | return; | 264 | return; |
265 | 265 | ||
266 | gate->enable_reg = ti_clk_get_reg_addr(node, 0); | 266 | gate->enable_reg = ti_clk_get_reg_addr(node, 0); |
267 | if (!gate->enable_reg) | 267 | if (IS_ERR(gate->enable_reg)) |
268 | goto cleanup; | 268 | goto cleanup; |
269 | 269 | ||
270 | of_property_read_u32(node, "ti,bit-shift", &val); | 270 | of_property_read_u32(node, "ti,bit-shift", &val); |
diff --git a/drivers/clk/ti/interface.c b/drivers/clk/ti/interface.c index 265d91f071c5..c76230d8dd04 100644 --- a/drivers/clk/ti/interface.c +++ b/drivers/clk/ti/interface.c | |||
@@ -111,7 +111,7 @@ static void __init _of_ti_interface_clk_setup(struct device_node *node, | |||
111 | u32 val; | 111 | u32 val; |
112 | 112 | ||
113 | reg = ti_clk_get_reg_addr(node, 0); | 113 | reg = ti_clk_get_reg_addr(node, 0); |
114 | if (!reg) | 114 | if (IS_ERR(reg)) |
115 | return; | 115 | return; |
116 | 116 | ||
117 | if (!of_property_read_u32(node, "ti,bit-shift", &val)) | 117 | if (!of_property_read_u32(node, "ti,bit-shift", &val)) |
diff --git a/drivers/clk/ti/mux.c b/drivers/clk/ti/mux.c index 728e253606bc..5cdeed538b08 100644 --- a/drivers/clk/ti/mux.c +++ b/drivers/clk/ti/mux.c | |||
@@ -210,7 +210,7 @@ static void of_mux_clk_setup(struct device_node *node) | |||
210 | 210 | ||
211 | reg = ti_clk_get_reg_addr(node, 0); | 211 | reg = ti_clk_get_reg_addr(node, 0); |
212 | 212 | ||
213 | if (!reg) | 213 | if (IS_ERR(reg)) |
214 | goto cleanup; | 214 | goto cleanup; |
215 | 215 | ||
216 | of_property_read_u32(node, "ti,bit-shift", &shift); | 216 | of_property_read_u32(node, "ti,bit-shift", &shift); |
@@ -283,7 +283,7 @@ static void __init of_ti_composite_mux_clk_setup(struct device_node *node) | |||
283 | 283 | ||
284 | mux->reg = ti_clk_get_reg_addr(node, 0); | 284 | mux->reg = ti_clk_get_reg_addr(node, 0); |
285 | 285 | ||
286 | if (!mux->reg) | 286 | if (IS_ERR(mux->reg)) |
287 | goto cleanup; | 287 | goto cleanup; |
288 | 288 | ||
289 | if (!of_property_read_u32(node, "ti,bit-shift", &val)) | 289 | if (!of_property_read_u32(node, "ti,bit-shift", &val)) |