Pull yet more ARM multiplatform updates from Arnd Bergmann: "This is the third and final bit of the multiplatform conversion for ARMv5, finishing off OMAP1. One patch enables the common-clk interface, and the other ones does the Kconfig change. These were waiting on a few dependencies to trickle in for common-clk, and the last one of those was in the USB tree" * tag 'arm-multiplatform-5.19-3' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: ARM: omap1: enable multiplatform ARM: OMAP1: clock: Convert to CCF
Unified · Split
| @@ -396,19 +396,6 @@ config ARCH_SA1100 · 395 unmodified lines | ||
| 396 | 396 | help |
| 397 | 397 | Support for StrongARM 11x0 based boards. |
| 398 | 398 | |
| 399 | −config ARCH_OMAP1 | |
| 400 | − bool "TI OMAP1" | |
| 401 | − depends on CPU_LITTLE_ENDIAN | |
| 402 | − select CLKSRC_MMIO | |
| 403 | − select FORCE_PCI if PCCARD | |
| 404 | − select GENERIC_IRQ_CHIP | |
| 405 | − select GPIOLIB | |
| 406 | − select HAVE_LEGACY_CLK | |
| 407 | − select IRQ_DOMAIN | |
| 408 | − select SPARSE_IRQ | |
| 409 | − help | |
| 410 | − Support for older TI OMAP1 (omap7xx, omap15xx or omap16xx) | |
| 411 | − | |
| 412 | 399 | endchoice |
| 413 | 400 | |
| 414 | 401 | menu "Multiple platform selection" |
| @@ -17,6 +17,9 @@ CONFIG_MODULES=y · 16 unmodified lines | ||
| 17 | 17 | CONFIG_MODULE_UNLOAD=y |
| 18 | 18 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 19 | 19 | # CONFIG_BLK_DEV_BSG is not set |
| 20 | +CONFIG_ARCH_MULTI_V4T=y | |
| 21 | +CONFIG_ARCH_MULTI_V5=y | |
| 22 | +# CONFIG_ARCH_MULTI_V7 is not set | |
| 20 | 23 | CONFIG_ARCH_OMAP=y |
| 21 | 24 | CONFIG_ARCH_OMAP1=y |
| 22 | 25 | CONFIG_OMAP_RESET_CLOCKS=y |
| @@ -1,4 +1,16 @@ | ||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | +menuconfig ARCH_OMAP1 | |
| 3 | + bool "TI OMAP1" | |
| 4 | + depends on ARCH_MULTI_V4T || ARCH_MULTI_V5 | |
| 5 | + depends on CPU_LITTLE_ENDIAN | |
| 6 | + select ARCH_HAS_HOLES_MEMORYMODEL | |
| 7 | + select ARCH_OMAP | |
| 8 | + select CLKSRC_MMIO | |
| 9 | + select FORCE_PCI if PCCARD | |
| 10 | + select GPIOLIB | |
| 11 | + help | |
| 12 | + Support for older TI OMAP1 (omap7xx, omap15xx or omap16xx) | |
| 13 | + | |
| 2 | 14 | if ARCH_OMAP1 |
| 3 | 15 | |
| 4 | 16 | menu "TI OMAP1 specific features" |
| @@ -6,23 +18,27 @@ menu "TI OMAP1 specific features" · 1 unmodified line | ||
| 6 | 18 | comment "OMAP Core Type" |
| 7 | 19 | |
| 8 | 20 | config ARCH_OMAP730 |
| 21 | + depends on ARCH_MULTI_V5 | |
| 9 | 22 | bool "OMAP730 Based System" |
| 10 | 23 | select ARCH_OMAP_OTG |
| 11 | 24 | select CPU_ARM926T |
| 12 | 25 | select OMAP_MPU_TIMER |
| 13 | 26 | |
| 14 | 27 | config ARCH_OMAP850 |
| 28 | + depends on ARCH_MULTI_V5 | |
| 15 | 29 | bool "OMAP850 Based System" |
| 16 | 30 | select ARCH_OMAP_OTG |
| 17 | 31 | select CPU_ARM926T |
| 18 | 32 | |
| 19 | 33 | config ARCH_OMAP15XX |
| 34 | + depends on ARCH_MULTI_V4T | |
| 20 | 35 | default y |
| 21 | 36 | bool "OMAP15xx Based System" |
| 22 | 37 | select CPU_ARM925T |
| 23 | 38 | select OMAP_MPU_TIMER |
| 24 | 39 | |
| 25 | 40 | config ARCH_OMAP16XX |
| 41 | + depends on ARCH_MULTI_V5 | |
| 26 | 42 | bool "OMAP16xx Based System" |
| 27 | 43 | select ARCH_OMAP_OTG |
| 28 | 44 | select CPU_ARM926T |
| @@ -16,7 +16,9 @@ · 15 unmodified lines | ||
| 16 | 16 | #include <linux/io.h> |
| 17 | 17 | #include <linux/clk.h> |
| 18 | 18 | #include <linux/clkdev.h> |
| 19 | +#include <linux/clk-provider.h> | |
| 19 | 20 | #include <linux/soc/ti/omap1-io.h> |
| 21 | +#include <linux/spinlock.h> | |
| 20 | 22 | |
| 21 | 23 | #include <asm/mach-types.h> |
| 22 | 24 | |
| @@ -28,33 +30,37 @@ · 5 unmodified lines | ||
| 28 | 30 | #include "sram.h" |
| 29 | 31 | |
| 30 | 32 | __u32 arm_idlect1_mask; |
| 31 | −struct clk *api_ck_p, *ck_dpll1_p, *ck_ref_p; | |
| 33 | +/* provide direct internal access (not via clk API) to some clocks */ | |
| 34 | +struct omap1_clk *api_ck_p, *ck_dpll1_p, *ck_ref_p; | |
| 32 | 35 | |
| 33 | −static LIST_HEAD(clocks); | |
| 34 | −static DEFINE_MUTEX(clocks_mutex); | |
| 35 | −static DEFINE_SPINLOCK(clockfw_lock); | |
| 36 | +/* protect registeres shared among clk_enable/disable() and clk_set_rate() operations */ | |
| 37 | +static DEFINE_SPINLOCK(arm_ckctl_lock); | |
| 38 | +static DEFINE_SPINLOCK(arm_idlect2_lock); | |
| 39 | +static DEFINE_SPINLOCK(mod_conf_ctrl_0_lock); | |
| 40 | +static DEFINE_SPINLOCK(mod_conf_ctrl_1_lock); | |
| 41 | +static DEFINE_SPINLOCK(swd_clk_div_ctrl_sel_lock); | |
| 36 | 42 | |
| 37 | 43 | /* |
| 38 | 44 | * Omap1 specific clock functions |
| 39 | 45 | */ |
| 40 | 46 | |
| 41 | −unsigned long omap1_uart_recalc(struct clk *clk) | |
| 47 | +unsigned long omap1_uart_recalc(struct omap1_clk *clk, unsigned long p_rate) | |
| 42 | 48 | { |
| 43 | 49 | unsigned int val = __raw_readl(clk->enable_reg); |
| 44 | 50 | return val & 1 << clk->enable_bit ? 48000000 : 12000000; |
| 45 | 51 | } |
| 46 | 52 | |
| 47 | −unsigned long omap1_sossi_recalc(struct clk *clk) | |
| 53 | +unsigned long omap1_sossi_recalc(struct omap1_clk *clk, unsigned long p_rate) | |
| 48 | 54 | { |
| 49 | 55 | u32 div = omap_readl(MOD_CONF_CTRL_1); |
| 50 | 56 | |
| 51 | 57 | div = (div >> 17) & 0x7; |
| 52 | 58 | div++; |
| 53 | 59 | |
| 54 | − return clk->parent->rate / div; | |
| 60 | + return p_rate / div; | |
| 55 | 61 | } |
| 56 | 62 | |
| 57 | −static void omap1_clk_allow_idle(struct clk *clk) | |
| 63 | +static void omap1_clk_allow_idle(struct omap1_clk *clk) | |
| 58 | 64 | { |
| 59 | 65 | struct arm_idlect1_clk * iclk = (struct arm_idlect1_clk *)clk; |
| 60 | 66 | |
| @@ -65,7 +71,7 @@ static void omap1_clk_allow_idle(struct clk *clk) · 4 unmodified lines | ||
| 65 | 71 | arm_idlect1_mask |= 1 << iclk->idlect_shift; |
| 66 | 72 | } |
| 67 | 73 | |
| 68 | −static void omap1_clk_deny_idle(struct clk *clk) | |
| 74 | +static void omap1_clk_deny_idle(struct omap1_clk *clk) | |
| 69 | 75 | { |
| 70 | 76 | struct arm_idlect1_clk * iclk = (struct arm_idlect1_clk *)clk; |
| 71 | 77 | |
| @@ -129,7 +135,7 @@ static __u16 verify_ckctl_value(__u16 newval) · 57 unmodified lines | ||
| 129 | 135 | return newval; |
| 130 | 136 | } |
| 131 | 137 | |
| 132 | −static int calc_dsor_exp(struct clk *clk, unsigned long rate) | |
| 138 | +static int calc_dsor_exp(unsigned long rate, unsigned long realrate) | |
| 133 | 139 | { |
| 134 | 140 | /* Note: If target frequency is too low, this function will return 4, |
| 135 | 141 | * which is invalid value. Caller must check for this value and act |
| @@ -142,15 +148,11 @@ static int calc_dsor_exp(struct clk *clk, unsigned long rate) · 6 unmodified lines | ||
| 142 | 148 | * DSP_CK >= TC_CK |
| 143 | 149 | * DSPMMU_CK >= TC_CK |
| 144 | 150 | */ |
| 145 | − unsigned long realrate; | |
| 146 | − struct clk * parent; | |
| 147 | 151 | unsigned dsor_exp; |
| 148 | 152 | |
| 149 | − parent = clk->parent; | |
| 150 | − if (unlikely(parent == NULL)) | |
| 153 | + if (unlikely(realrate == 0)) | |
| 151 | 154 | return -EIO; |
| 152 | 155 | |
| 153 | − realrate = parent->rate; | |
| 154 | 156 | for (dsor_exp=0; dsor_exp<4; dsor_exp++) { |
| 155 | 157 | if (realrate <= rate) |
| 156 | 158 | break; |
| @@ -161,16 +163,50 @@ static int calc_dsor_exp(struct clk *clk, unsigned long rate) · 4 unmodified lines | ||
| 161 | 163 | return dsor_exp; |
| 162 | 164 | } |
| 163 | 165 | |
| 164 | −unsigned long omap1_ckctl_recalc(struct clk *clk) | |
| 166 | +unsigned long omap1_ckctl_recalc(struct omap1_clk *clk, unsigned long p_rate) | |
| 165 | 167 | { |
| 166 | 168 | /* Calculate divisor encoded as 2-bit exponent */ |
| 167 | 169 | int dsor = 1 << (3 & (omap_readw(ARM_CKCTL) >> clk->rate_offset)); |
| 168 | 170 | |
| 169 | − return clk->parent->rate / dsor; | |
| 171 | + /* update locally maintained rate, required by arm_ck for omap1_show_rates() */ | |
| 172 | + clk->rate = p_rate / dsor; | |
| 173 | + return clk->rate; | |
| 170 | 174 | } |
| 171 | 175 | |
| 172 | −unsigned long omap1_ckctl_recalc_dsp_domain(struct clk *clk) | |
| 176 | +static int omap1_clk_is_enabled(struct clk_hw *hw) | |
| 173 | 177 | { |
| 178 | + struct omap1_clk *clk = to_omap1_clk(hw); | |
| 179 | + bool api_ck_was_enabled = true; | |
| 180 | + __u32 regval32; | |
| 181 | + int ret; | |
| 182 | + | |
| 183 | + if (!clk->ops) /* no gate -- always enabled */ | |
| 184 | + return 1; | |
| 185 | + | |
| 186 | + if (clk->ops == &clkops_dspck) { | |
| 187 | + api_ck_was_enabled = omap1_clk_is_enabled(&api_ck_p->hw); | |
| 188 | + if (!api_ck_was_enabled) | |
| 189 | + if (api_ck_p->ops->enable(api_ck_p) < 0) | |
| 190 | + return 0; | |
| 191 | + } | |
| 192 | + | |
| 193 | + if (clk->flags & ENABLE_REG_32BIT) | |
| 194 | + regval32 = __raw_readl(clk->enable_reg); | |
| 195 | + else | |
| 196 | + regval32 = __raw_readw(clk->enable_reg); | |
| 197 | + | |
| 198 | + ret = regval32 & (1 << clk->enable_bit); | |
| 199 | + | |
| 200 | + if (!api_ck_was_enabled) | |
| 201 | + api_ck_p->ops->disable(api_ck_p); | |
| 202 | + | |
| 203 | + return ret; | |
| 204 | +} | |
| 205 | + | |
| 206 | + | |
| 207 | +unsigned long omap1_ckctl_recalc_dsp_domain(struct omap1_clk *clk, unsigned long p_rate) | |
| 208 | +{ | |
| 209 | + bool api_ck_was_enabled; | |
| 174 | 210 | int dsor; |
| 175 | 211 | |
| 176 | 212 | /* Calculate divisor encoded as 2-bit exponent |
| @@ -180,15 +216,18 @@ unsigned long omap1_ckctl_recalc_dsp_domain(struct clk *clk) · 3 unmodified lines | ||
| 180 | 216 | * Note that DSP_CKCTL virt addr = phys addr, so |
| 181 | 217 | * we must use __raw_readw() instead of omap_readw(). |
| 182 | 218 | */ |
| 183 | − omap1_clk_enable(api_ck_p); | |
| 219 | + api_ck_was_enabled = omap1_clk_is_enabled(&api_ck_p->hw); | |
| 220 | + if (!api_ck_was_enabled) | |
| 221 | + api_ck_p->ops->enable(api_ck_p); | |
| 184 | 222 | dsor = 1 << (3 & (__raw_readw(DSP_CKCTL) >> clk->rate_offset)); |
| 185 | − omap1_clk_disable(api_ck_p); | |
| 223 | + if (!api_ck_was_enabled) | |
| 224 | + api_ck_p->ops->disable(api_ck_p); | |
| 186 | 225 | |
| 187 | − return clk->parent->rate / dsor; | |
| 226 | + return p_rate / dsor; | |
| 188 | 227 | } |
| 189 | 228 | |
| 190 | 229 | /* MPU virtual clock functions */ |
| 191 | −int omap1_select_table_rate(struct clk *clk, unsigned long rate) | |
| 230 | +int omap1_select_table_rate(struct omap1_clk *clk, unsigned long rate, unsigned long p_rate) | |
| 192 | 231 | { |
| 193 | 232 | /* Find the highest supported frequency <= rate and switch to it */ |
| 194 | 233 | struct mpu_rate * ptr; |
| @@ -223,12 +262,12 @@ int omap1_select_table_rate(struct clk *clk, unsigned long rate) · 28 unmodified lines | ||
| 223 | 262 | return 0; |
| 224 | 263 | } |
| 225 | 264 | |
| 226 | −int omap1_clk_set_rate_dsp_domain(struct clk *clk, unsigned long rate) | |
| 265 | +int omap1_clk_set_rate_dsp_domain(struct omap1_clk *clk, unsigned long rate, unsigned long p_rate) | |
| 227 | 266 | { |
| 228 | 267 | int dsor_exp; |
| 229 | 268 | u16 regval; |
| 230 | 269 | |
| 231 | − dsor_exp = calc_dsor_exp(clk, rate); | |
| 270 | + dsor_exp = calc_dsor_exp(rate, p_rate); | |
| 232 | 271 | if (dsor_exp > 3) |
| 233 | 272 | dsor_exp = -EINVAL; |
| 234 | 273 | if (dsor_exp < 0) |
| @@ -238,42 +277,51 @@ int omap1_clk_set_rate_dsp_domain(struct clk *clk, unsigned long rate) · 3 unmodified lines | ||
| 238 | 277 | regval &= ~(3 << clk->rate_offset); |
| 239 | 278 | regval |= dsor_exp << clk->rate_offset; |
| 240 | 279 | __raw_writew(regval, DSP_CKCTL); |
| 241 | − clk->rate = clk->parent->rate / (1 << dsor_exp); | |
| 280 | + clk->rate = p_rate / (1 << dsor_exp); | |
| 242 | 281 | |
| 243 | 282 | return 0; |
| 244 | 283 | } |
| 245 | 284 | |
| 246 | −long omap1_clk_round_rate_ckctl_arm(struct clk *clk, unsigned long rate) | |
| 285 | +long omap1_clk_round_rate_ckctl_arm(struct omap1_clk *clk, unsigned long rate, | |
| 286 | + unsigned long *p_rate) | |
| 247 | 287 | { |
| 248 | − int dsor_exp = calc_dsor_exp(clk, rate); | |
| 288 | + int dsor_exp = calc_dsor_exp(rate, *p_rate); | |
| 289 | + | |
| 249 | 290 | if (dsor_exp < 0) |
| 250 | 291 | return dsor_exp; |
| 251 | 292 | if (dsor_exp > 3) |
| 252 | 293 | dsor_exp = 3; |
| 253 | − return clk->parent->rate / (1 << dsor_exp); | |
| 294 | + return *p_rate / (1 << dsor_exp); | |
| 254 | 295 | } |
| 255 | 296 | |
| 256 | −int omap1_clk_set_rate_ckctl_arm(struct clk *clk, unsigned long rate) | |
| 297 | +int omap1_clk_set_rate_ckctl_arm(struct omap1_clk *clk, unsigned long rate, unsigned long p_rate) | |
| 257 | 298 | { |
| 299 | + unsigned long flags; | |
| 258 | 300 | int dsor_exp; |
| 259 | 301 | u16 regval; |
| 260 | 302 | |
| 261 | − dsor_exp = calc_dsor_exp(clk, rate); | |
| 303 | + dsor_exp = calc_dsor_exp(rate, p_rate); | |
| 262 | 304 | if (dsor_exp > 3) |
| 263 | 305 | dsor_exp = -EINVAL; |
| 264 | 306 | if (dsor_exp < 0) |
| 265 | 307 | return dsor_exp; |
| 266 | 308 | |
| 309 | + /* protect ARM_CKCTL register from concurrent access via clk_enable/disable() */ | |
| 310 | + spin_lock_irqsave(&arm_ckctl_lock, flags); | |
| 311 | + | |
| 267 | 312 | regval = omap_readw(ARM_CKCTL); |
| 268 | 313 | regval &= ~(3 << clk->rate_offset); |
| 269 | 314 | regval |= dsor_exp << clk->rate_offset; |
| 270 | 315 | regval = verify_ckctl_value(regval); |
| 271 | 316 | omap_writew(regval, ARM_CKCTL); |
| 272 | − clk->rate = clk->parent->rate / (1 << dsor_exp); | |
| 317 | + clk->rate = p_rate / (1 << dsor_exp); | |
| 318 | + | |
| 319 | + spin_unlock_irqrestore(&arm_ckctl_lock, flags); | |
| 320 | + | |
| 273 | 321 | return 0; |
| 274 | 322 | } |
| 275 | 323 | |
| 276 | −long omap1_round_to_table_rate(struct clk *clk, unsigned long rate) | |
| 324 | +long omap1_round_to_table_rate(struct omap1_clk *clk, unsigned long rate, unsigned long *p_rate) | |
| 277 | 325 | { |
| 278 | 326 | /* Find the highest supported frequency <= rate */ |
| 279 | 327 | struct mpu_rate * ptr; |
| @@ -324,26 +372,40 @@ static unsigned calc_ext_dsor(unsigned long rate) · 44 unmodified lines | ||
| 324 | 372 | } |
| 325 | 373 | |
| 326 | 374 | /* XXX Only needed on 1510 */ |
| 327 | −int omap1_set_uart_rate(struct clk *clk, unsigned long rate) | |
| 375 | +long omap1_round_uart_rate(struct omap1_clk *clk, unsigned long rate, unsigned long *p_rate) | |
| 328 | 376 | { |
| 377 | + return rate > 24000000 ? 48000000 : 12000000; | |
| 378 | +} | |
| 379 | + | |
| 380 | +int omap1_set_uart_rate(struct omap1_clk *clk, unsigned long rate, unsigned long p_rate) | |
| 381 | +{ | |
| 382 | + unsigned long flags; | |
| 329 | 383 | unsigned int val; |
| 330 | 384 | |
| 331 | − val = __raw_readl(clk->enable_reg); | |
| 332 | 385 | if (rate == 12000000) |
| 333 | − val &= ~(1 << clk->enable_bit); | |
| 386 | + val = 0; | |
| 334 | 387 | else if (rate == 48000000) |
| 335 | − val |= (1 << clk->enable_bit); | |
| 388 | + val = 1 << clk->enable_bit; | |
| 336 | 389 | else |
| 337 | 390 | return -EINVAL; |
| 391 | + | |
| 392 | + /* protect MOD_CONF_CTRL_0 register from concurrent access via clk_enable/disable() */ | |
| 393 | + spin_lock_irqsave(&mod_conf_ctrl_0_lock, flags); | |
| 394 | + | |
| 395 | + val |= __raw_readl(clk->enable_reg) & ~(1 << clk->enable_bit); | |
| 338 | 396 | __raw_writel(val, clk->enable_reg); |
| 397 | + | |
| 398 | + spin_unlock_irqrestore(&mod_conf_ctrl_0_lock, flags); | |
| 399 | + | |
| 339 | 400 | clk->rate = rate; |
| 340 | 401 | |
| 341 | 402 | return 0; |
| 342 | 403 | } |
| 343 | 404 | |
| 344 | 405 | /* External clock (MCLK & BCLK) functions */ |
| 345 | −int omap1_set_ext_clk_rate(struct clk *clk, unsigned long rate) | |
| 406 | +int omap1_set_ext_clk_rate(struct omap1_clk *clk, unsigned long rate, unsigned long p_rate) | |
| 346 | 407 | { |
| 408 | + unsigned long flags; | |
| 347 | 409 | unsigned dsor; |
| 348 | 410 | __u16 ratio_bits; |
| 349 | 411 | |
| @@ -354,25 +416,53 @@ int omap1_set_ext_clk_rate(struct clk *clk, unsigned long rate) · 4 unmodified lines | ||
| 354 | 416 | else |
| 355 | 417 | ratio_bits = (dsor - 2) << 2; |
| 356 | 418 | |
| 419 | + /* protect SWD_CLK_DIV_CTRL_SEL register from concurrent access via clk_enable/disable() */ | |
| 420 | + spin_lock_irqsave(&swd_clk_div_ctrl_sel_lock, flags); | |
| 421 | + | |
| 357 | 422 | ratio_bits |= __raw_readw(clk->enable_reg) & ~0xfd; |
| 358 | 423 | __raw_writew(ratio_bits, clk->enable_reg); |
| 359 | 424 | |
| 425 | + spin_unlock_irqrestore(&swd_clk_div_ctrl_sel_lock, flags); | |
| 426 | + | |
| 360 | 427 | return 0; |
| 361 | 428 | } |
| 362 | 429 | |
| 363 | −int omap1_set_sossi_rate(struct clk *clk, unsigned long rate) | |
| 430 | +static int calc_div_sossi(unsigned long rate, unsigned long p_rate) | |
| 364 | 431 | { |
| 365 | − u32 l; | |
| 366 | 432 | int div; |
| 367 | − unsigned long p_rate; | |
| 368 | 433 | |
| 369 | − p_rate = clk->parent->rate; | |
| 370 | 434 | /* Round towards slower frequency */ |
| 371 | 435 | div = (p_rate + rate - 1) / rate; |
| 372 | − div--; | |
| 436 | + | |
| 437 | + return --div; | |
| 438 | +} | |
| 439 | + | |
| 440 | +long omap1_round_sossi_rate(struct omap1_clk *clk, unsigned long rate, unsigned long *p_rate) | |
| 441 | +{ | |
| 442 | + int div; | |
| 443 | + | |
| 444 | + div = calc_div_sossi(rate, *p_rate); | |
| 445 | + if (div < 0) | |
| 446 | + div = 0; | |
| 447 | + else if (div > 7) | |
| 448 | + div = 7; | |
| 449 | + | |
| 450 | + return *p_rate / (div + 1); | |
| 451 | +} | |
| 452 | + | |
| 453 | +int omap1_set_sossi_rate(struct omap1_clk *clk, unsigned long rate, unsigned long p_rate) | |
| 454 | +{ | |
| 455 | + unsigned long flags; | |
| 456 | + u32 l; | |
| 457 | + int div; | |
| 458 | + | |
| 459 | + div = calc_div_sossi(rate, p_rate); | |
| 373 | 460 | if (div < 0 || div > 7) |
| 374 | 461 | return -EINVAL; |
| 375 | 462 | |
| 463 | + /* protect MOD_CONF_CTRL_1 register from concurrent access via clk_enable/disable() */ | |
| 464 | + spin_lock_irqsave(&mod_conf_ctrl_1_lock, flags); | |
| 465 | + | |
| 376 | 466 | l = omap_readl(MOD_CONF_CTRL_1); |
| 377 | 467 | l &= ~(7 << 17); |
| 378 | 468 | l |= div << 17; |
| @@ -380,15 +470,17 @@ int omap1_set_sossi_rate(struct clk *clk, unsigned long rate) · 1 unmodified line | ||
| 380 | 470 | |
| 381 | 471 | clk->rate = p_rate / (div + 1); |
| 382 | 472 | |
| 473 | + spin_unlock_irqrestore(&mod_conf_ctrl_1_lock, flags); | |
| 474 | + | |
| 383 | 475 | return 0; |
| 384 | 476 | } |
| 385 | 477 | |
| 386 | −long omap1_round_ext_clk_rate(struct clk *clk, unsigned long rate) | |
| 478 | +long omap1_round_ext_clk_rate(struct omap1_clk *clk, unsigned long rate, unsigned long *p_rate) | |
| 387 | 479 | { |
| 388 | 480 | return 96000000 / calc_ext_dsor(rate); |
| 389 | 481 | } |
| 390 | 482 | |
| 391 | −void omap1_init_ext_clk(struct clk *clk) | |
| 483 | +int omap1_init_ext_clk(struct omap1_clk *clk) | |
| 392 | 484 | { |
| 393 | 485 | unsigned dsor; |
| 394 | 486 | __u16 ratio_bits; |
| @@ -404,59 +496,59 @@ void omap1_init_ext_clk(struct clk *clk) · 9 unmodified lines | ||
| 404 | 496 | dsor = ratio_bits + 2; |
| 405 | 497 | |
| 406 | 498 | clk-> rate = 96000000 / dsor; |
| 499 | + | |
| 500 | + return 0; | |
| 407 | 501 | } |
| 408 | 502 | |
| 409 | −int omap1_clk_enable(struct clk *clk) | |
| 503 | +static int omap1_clk_enable(struct clk_hw *hw) | |
| 410 | 504 | { |
| 505 | + struct omap1_clk *clk = to_omap1_clk(hw), *parent = to_omap1_clk(clk_hw_get_parent(hw)); | |
| 411 | 506 | int ret = 0; |
| 412 | 507 | |
| 413 | − if (clk->usecount++ == 0) { | |
| 414 | − if (clk->parent) { | |
| 415 | − ret = omap1_clk_enable(clk->parent); | |
| 416 | − if (ret) | |
| 417 | − goto err; | |
| 418 | − | |
| 419 | − if (clk->flags & CLOCK_NO_IDLE_PARENT) | |
| 420 | − omap1_clk_deny_idle(clk->parent); | |
| 421 | − } | |
| 508 | + if (parent && clk->flags & CLOCK_NO_IDLE_PARENT) | |
| 509 | + omap1_clk_deny_idle(parent); | |
| 422 | 510 | |
| 511 | + if (clk->ops && !(WARN_ON(!clk->ops->enable))) | |
| 423 | 512 | ret = clk->ops->enable(clk); |
| 424 | − if (ret) { | |
| 425 | − if (clk->parent) | |
| 426 | − omap1_clk_disable(clk->parent); | |
| 427 | − goto err; | |
| 428 | − } | |
| 429 | − } | |
| 430 | − return ret; | |
| 431 | 513 | |
| 432 | −err: | |
| 433 | − clk->usecount--; | |
| 434 | 514 | return ret; |
| 435 | 515 | } |
| 436 | 516 | |
| 437 | −void omap1_clk_disable(struct clk *clk) | |
| 517 | +static void omap1_clk_disable(struct clk_hw *hw) | |
| 438 | 518 | { |
| 439 | − if (clk->usecount > 0 && !(--clk->usecount)) { | |
| 519 | + struct omap1_clk *clk = to_omap1_clk(hw), *parent = to_omap1_clk(clk_hw_get_parent(hw)); | |
| 520 | + | |
| 521 | + if (clk->ops && !(WARN_ON(!clk->ops->disable))) | |
| 440 | 522 | clk->ops->disable(clk); |
| 441 | − if (likely(clk->parent)) { | |
| 442 | − omap1_clk_disable(clk->parent); | |
| 443 | − if (clk->flags & CLOCK_NO_IDLE_PARENT) | |
| 444 | − omap1_clk_allow_idle(clk->parent); | |
| 445 | − } | |
| 446 | − } | |
| 523 | + | |
| 524 | + if (likely(parent) && clk->flags & CLOCK_NO_IDLE_PARENT) | |
| 525 | + omap1_clk_allow_idle(parent); | |
| 447 | 526 | } |
| 448 | 527 | |
| 449 | −static int omap1_clk_enable_generic(struct clk *clk) | |
| 528 | +static int omap1_clk_enable_generic(struct omap1_clk *clk) | |
| 450 | 529 | { |
| 530 | + unsigned long flags; | |
| 451 | 531 | __u16 regval16; |
| 452 | 532 | __u32 regval32; |
| 453 | 533 | |
| 454 | 534 | if (unlikely(clk->enable_reg == NULL)) { |
| 455 | 535 | printk(KERN_ERR "clock.c: Enable for %s without enable code\n", |
| 456 | − clk->name); | |
| 536 | + clk_hw_get_name(&clk->hw)); | |
| 457 | 537 | return -EINVAL; |
| 458 | 538 | } |
| 459 | 539 | |
| 540 | + /* protect clk->enable_reg from concurrent access via clk_set_rate() */ | |
| 541 | + if (clk->enable_reg == OMAP1_IO_ADDRESS(ARM_CKCTL)) | |
| 542 | + spin_lock_irqsave(&arm_ckctl_lock, flags); | |
| 543 | + else if (clk->enable_reg == OMAP1_IO_ADDRESS(ARM_IDLECT2)) | |
| 544 | + spin_lock_irqsave(&arm_idlect2_lock, flags); | |
| 545 | + else if (clk->enable_reg == OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0)) | |
| 546 | + spin_lock_irqsave(&mod_conf_ctrl_0_lock, flags); | |
| 547 | + else if (clk->enable_reg == OMAP1_IO_ADDRESS(MOD_CONF_CTRL_1)) | |
| 548 | + spin_lock_irqsave(&mod_conf_ctrl_1_lock, flags); | |
| 549 | + else if (clk->enable_reg == OMAP1_IO_ADDRESS(SWD_CLK_DIV_CTRL_SEL)) | |
| 550 | + spin_lock_irqsave(&swd_clk_div_ctrl_sel_lock, flags); | |
| 551 | + | |
| 460 | 552 | if (clk->flags & ENABLE_REG_32BIT) { |
| 461 | 553 | regval32 = __raw_readl(clk->enable_reg); |
| 462 | 554 | regval32 |= (1 << clk->enable_bit); |
| @@ -467,17 +559,41 @@ static int omap1_clk_enable_generic(struct clk *clk) · 4 unmodified lines | ||
| 467 | 559 | __raw_writew(regval16, clk->enable_reg); |
| 468 | 560 | } |
| 469 | 561 | |
| 562 | + if (clk->enable_reg == OMAP1_IO_ADDRESS(ARM_CKCTL)) | |
| 563 | + spin_unlock_irqrestore(&arm_ckctl_lock, flags); | |
| 564 | + else if (clk->enable_reg == OMAP1_IO_ADDRESS(ARM_IDLECT2)) | |
| 565 | + spin_unlock_irqrestore(&arm_idlect2_lock, flags); | |
| 566 | + else if (clk->enable_reg == OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0)) | |
| 567 | + spin_unlock_irqrestore(&mod_conf_ctrl_0_lock, flags); | |
| 568 | + else if (clk->enable_reg == OMAP1_IO_ADDRESS(MOD_CONF_CTRL_1)) | |
| 569 | + spin_unlock_irqrestore(&mod_conf_ctrl_1_lock, flags); | |
| 570 | + else if (clk->enable_reg == OMAP1_IO_ADDRESS(SWD_CLK_DIV_CTRL_SEL)) | |
| 571 | + spin_unlock_irqrestore(&swd_clk_div_ctrl_sel_lock, flags); | |
| 572 | + | |
| 470 | 573 | return 0; |
| 471 | 574 | } |
| 472 | 575 | |
| 473 | −static void omap1_clk_disable_generic(struct clk *clk) | |
| 576 | +static void omap1_clk_disable_generic(struct omap1_clk *clk) | |
| 474 | 577 | { |
| 578 | + unsigned long flags; | |
| 475 | 579 | __u16 regval16; |
| 476 | 580 | __u32 regval32; |
| 477 | 581 | |
| 478 | 582 | if (clk->enable_reg == NULL) |
| 479 | 583 | return; |
| 480 | 584 | |
| 585 | + /* protect clk->enable_reg from concurrent access via clk_set_rate() */ | |
| 586 | + if (clk->enable_reg == OMAP1_IO_ADDRESS(ARM_CKCTL)) | |
| 587 | + spin_lock_irqsave(&arm_ckctl_lock, flags); | |
| 588 | + else if (clk->enable_reg == OMAP1_IO_ADDRESS(ARM_IDLECT2)) | |
| 589 | + spin_lock_irqsave(&arm_idlect2_lock, flags); | |
| 590 | + else if (clk->enable_reg == OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0)) | |
| 591 | + spin_lock_irqsave(&mod_conf_ctrl_0_lock, flags); | |
| 592 | + else if (clk->enable_reg == OMAP1_IO_ADDRESS(MOD_CONF_CTRL_1)) | |
| 593 | + spin_lock_irqsave(&mod_conf_ctrl_1_lock, flags); | |
| 594 | + else if (clk->enable_reg == OMAP1_IO_ADDRESS(SWD_CLK_DIV_CTRL_SEL)) | |
| 595 | + spin_lock_irqsave(&swd_clk_div_ctrl_sel_lock, flags); | |
| 596 | + | |
| 481 | 597 | if (clk->flags & ENABLE_REG_32BIT) { |
| 482 | 598 | regval32 = __raw_readl(clk->enable_reg); |
| 483 | 599 | regval32 &= ~(1 << clk->enable_bit); |
| @@ -487,6 +603,17 @@ static void omap1_clk_disable_generic(struct clk *clk) · 3 unmodified lines | ||
| 487 | 603 | regval16 &= ~(1 << clk->enable_bit); |
| 488 | 604 | __raw_writew(regval16, clk->enable_reg); |
| 489 | 605 | } |
| 606 | + | |
| 607 | + if (clk->enable_reg == OMAP1_IO_ADDRESS(ARM_CKCTL)) | |
| 608 | + spin_unlock_irqrestore(&arm_ckctl_lock, flags); | |
| 609 | + else if (clk->enable_reg == OMAP1_IO_ADDRESS(ARM_IDLECT2)) | |
| 610 | + spin_unlock_irqrestore(&arm_idlect2_lock, flags); | |
| 611 | + else if (clk->enable_reg == OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0)) | |
| 612 | + spin_unlock_irqrestore(&mod_conf_ctrl_0_lock, flags); | |
| 613 | + else if (clk->enable_reg == OMAP1_IO_ADDRESS(MOD_CONF_CTRL_1)) | |
| 614 | + spin_unlock_irqrestore(&mod_conf_ctrl_1_lock, flags); | |
| 615 | + else if (clk->enable_reg == OMAP1_IO_ADDRESS(SWD_CLK_DIV_CTRL_SEL)) | |
| 616 | + spin_unlock_irqrestore(&swd_clk_div_ctrl_sel_lock, flags); | |
| 490 | 617 | } |
| 491 | 618 | |
| 492 | 619 | const struct clkops clkops_generic = { |
| @@ -494,25 +621,38 @@ const struct clkops clkops_generic = { · 1 unmodified line | ||
| 494 | 621 | .disable = omap1_clk_disable_generic, |
| 495 | 622 | }; |
| 496 | 623 | |
| 497 | −static int omap1_clk_enable_dsp_domain(struct clk *clk) | |
| 624 | +static int omap1_clk_enable_dsp_domain(struct omap1_clk *clk) | |
| 498 | 625 | { |
| 499 | − int retval; | |
| 626 | + bool api_ck_was_enabled; | |
| 627 | + int retval = 0; | |
| 628 | + | |
| 629 | + api_ck_was_enabled = omap1_clk_is_enabled(&api_ck_p->hw); | |
| 630 | + if (!api_ck_was_enabled) | |
| 631 | + retval = api_ck_p->ops->enable(api_ck_p); | |
| 500 | 632 | |
| 501 | − retval = omap1_clk_enable(api_ck_p); | |
| 502 | 633 | if (!retval) { |
| 503 | 634 | retval = omap1_clk_enable_generic(clk); |
| 504 | − omap1_clk_disable(api_ck_p); | |
| 635 | + | |
| 636 | + if (!api_ck_was_enabled) | |
| 637 | + api_ck_p->ops->disable(api_ck_p); | |
| 505 | 638 | } |
| 506 | 639 | |
| 507 | 640 | return retval; |
| 508 | 641 | } |
| 509 | 642 | |
| 510 | −static void omap1_clk_disable_dsp_domain(struct clk *clk) | |
| 643 | +static void omap1_clk_disable_dsp_domain(struct omap1_clk *clk) | |
| 511 | 644 | { |
| 512 | − if (omap1_clk_enable(api_ck_p) == 0) { | |
| 513 | − omap1_clk_disable_generic(clk); | |
| 514 | − omap1_clk_disable(api_ck_p); | |
| 515 | − } | |
| 645 | + bool api_ck_was_enabled; | |
| 646 | + | |
| 647 | + api_ck_was_enabled = omap1_clk_is_enabled(&api_ck_p->hw); | |
| 648 | + if (!api_ck_was_enabled) | |
| 649 | + if (api_ck_p->ops->enable(api_ck_p) < 0) | |
| 650 | + return; | |
| 651 | + | |
| 652 | + omap1_clk_disable_generic(clk); | |
| 653 | + | |
| 654 | + if (!api_ck_was_enabled) | |
| 655 | + api_ck_p->ops->disable(api_ck_p); | |
| 516 | 656 | } |
| 517 | 657 | |
| 518 | 658 | const struct clkops clkops_dspck = { |
| @@ -521,7 +661,7 @@ const struct clkops clkops_dspck = { · 2 unmodified lines | ||
| 521 | 661 | }; |
| 522 | 662 | |
| 523 | 663 | /* XXX SYSC register handling does not belong in the clock framework */ |
| 524 | −static int omap1_clk_enable_uart_functional_16xx(struct clk *clk) | |
| 664 | +static int omap1_clk_enable_uart_functional_16xx(struct omap1_clk *clk) | |
| 525 | 665 | { |
| 526 | 666 | int ret; |
| 527 | 667 | struct uart_clk *uclk; |
| @@ -538,7 +678,7 @@ static int omap1_clk_enable_uart_functional_16xx(struct clk *clk) · 10 unmodified lines | ||
| 538 | 678 | } |
| 539 | 679 | |
| 540 | 680 | /* XXX SYSC register handling does not belong in the clock framework */ |
| 541 | −static void omap1_clk_disable_uart_functional_16xx(struct clk *clk) | |
| 681 | +static void omap1_clk_disable_uart_functional_16xx(struct omap1_clk *clk) | |
| 542 | 682 | { |
| 543 | 683 | struct uart_clk *uclk; |
| 544 | 684 | |
| @@ -555,20 +695,33 @@ const struct clkops clkops_uart_16xx = { · 10 unmodified lines | ||
| 555 | 695 | .disable = omap1_clk_disable_uart_functional_16xx, |
| 556 | 696 | }; |
| 557 | 697 | |
| 558 | −long omap1_clk_round_rate(struct clk *clk, unsigned long rate) | |
| 698 | +static unsigned long omap1_clk_recalc_rate(struct clk_hw *hw, unsigned long p_rate) | |
| 559 | 699 | { |
| 560 | − if (clk->round_rate != NULL) | |
| 561 | − return clk->round_rate(clk, rate); | |
| 700 | + struct omap1_clk *clk = to_omap1_clk(hw); | |
| 701 | + | |
| 702 | + if (clk->recalc) | |
| 703 | + return clk->recalc(clk, p_rate); | |
| 562 | 704 | |
| 563 | 705 | return clk->rate; |
| 564 | 706 | } |
| 565 | 707 | |
| 566 | −int omap1_clk_set_rate(struct clk *clk, unsigned long rate) | |
| 708 | +static long omap1_clk_round_rate(struct clk_hw *hw, unsigned long rate, unsigned long *p_rate) | |
| 709 | +{ | |
| 710 | + struct omap1_clk *clk = to_omap1_clk(hw); | |
| 711 | + | |
| 712 | + if (clk->round_rate != NULL) | |
| 713 | + return clk->round_rate(clk, rate, p_rate); | |
| 714 | + | |
| 715 | + return omap1_clk_recalc_rate(hw, *p_rate); | |
| 716 | +} | |
| 717 | + | |
| 718 | +static int omap1_clk_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long p_rate) | |
| 567 | 719 | { |
| 720 | + struct omap1_clk *clk = to_omap1_clk(hw); | |
| 568 | 721 | int ret = -EINVAL; |
| 569 | 722 | |
| 570 | 723 | if (clk->set_rate) |
| 571 | − ret = clk->set_rate(clk, rate); | |
| 724 | + ret = clk->set_rate(clk, rate, p_rate); | |
| 572 | 725 | return ret; |
| 573 | 726 | } |
| 574 | 727 | |
| @@ -576,243 +729,105 @@ int omap1_clk_set_rate(struct clk *clk, unsigned long rate) · 1 unmodified line | ||
| 576 | 729 | * Omap1 clock reset and init functions |
| 577 | 730 | */ |
| 578 | 731 | |
| 732 | +static int omap1_clk_init_op(struct clk_hw *hw) | |
| 733 | +{ | |
| 734 | + struct omap1_clk *clk = to_omap1_clk(hw); | |
| 735 | + | |
| 736 | + if (clk->init) | |
| 737 | + return clk->init(clk); | |
| 738 | + | |
| 739 | + return 0; | |
| 740 | +} | |
| 741 | + | |
| 579 | 742 | #ifdef CONFIG_OMAP_RESET_CLOCKS |
| 580 | 743 | |
| 581 | −void omap1_clk_disable_unused(struct clk *clk) | |
| 744 | +static void omap1_clk_disable_unused(struct clk_hw *hw) | |
| 582 | 745 | { |
| 583 | − __u32 regval32; | |
| 746 | + struct omap1_clk *clk = to_omap1_clk(hw); | |
| 747 | + const char *name = clk_hw_get_name(hw); | |
| 584 | 748 | |
| 585 | 749 | /* Clocks in the DSP domain need api_ck. Just assume bootloader |
| 586 | 750 | * has not enabled any DSP clocks */ |
| 587 | 751 | if (clk->enable_reg == DSP_IDLECT2) { |
| 588 | − pr_info("Skipping reset check for DSP domain clock \"%s\"\n", | |
| 589 | − clk->name); | |
| 752 | + pr_info("Skipping reset check for DSP domain clock \"%s\"\n", name); | |
| 590 | 753 | return; |
| 591 | 754 | } |
| 592 | 755 | |
| 593 | − /* Is the clock already disabled? */ | |
| 594 | − if (clk->flags & ENABLE_REG_32BIT) | |
| 595 | − regval32 = __raw_readl(clk->enable_reg); | |
| 596 | − else | |
| 597 | − regval32 = __raw_readw(clk->enable_reg); | |
| 598 | − | |
| 599 | − if ((regval32 & (1 << clk->enable_bit)) == 0) | |
| 600 | − return; | |
| 601 | − | |
| 602 | − printk(KERN_INFO "Disabling unused clock \"%s\"... ", clk->name); | |
| 603 | − clk->ops->disable(clk); | |
| 756 | + pr_info("Disabling unused clock \"%s\"... ", name); | |
| 757 | + omap1_clk_disable(hw); | |
| 604 | 758 | printk(" done\n"); |
| 605 | 759 | } |
| 606 | 760 | |
| 607 | 761 | #endif |
| 608 | 762 | |
| 763 | +const struct clk_ops omap1_clk_gate_ops = { | |
| 764 | + .enable = omap1_clk_enable, | |
| 765 | + .disable = omap1_clk_disable, | |
| 766 | + .is_enabled = omap1_clk_is_enabled, | |
| 767 | +#ifdef CONFIG_OMAP_RESET_CLOCKS | |
| 768 | + .disable_unused = omap1_clk_disable_unused, | |
| 769 | +#endif | |
| 770 | +}; | |
| 609 | 771 | |
| 610 | −int clk_enable(struct clk *clk) | |
| 611 | −{ | |
| 612 | − unsigned long flags; | |
| 613 | − int ret; | |
| 614 | − | |
| 615 | − if (IS_ERR_OR_NULL(clk)) | |
| 616 | − return -EINVAL; | |
| 617 | − | |
| 618 | − spin_lock_irqsave(&clockfw_lock, flags); | |
| 619 | − ret = omap1_clk_enable(clk); | |
| 620 | − spin_unlock_irqrestore(&clockfw_lock, flags); | |
| 621 | − | |
| 622 | − return ret; | |
| 623 | −} | |
| 624 | −EXPORT_SYMBOL(clk_enable); | |
| 625 | − | |
| 626 | −void clk_disable(struct clk *clk) | |
| 627 | −{ | |
| 628 | − unsigned long flags; | |
| 629 | − | |
| 630 | − if (IS_ERR_OR_NULL(clk)) | |
| 631 | − return; | |
| 632 | − | |
| 633 | − spin_lock_irqsave(&clockfw_lock, flags); | |
| 634 | − if (clk->usecount == 0) { | |
| 635 | − pr_err("Trying disable clock %s with 0 usecount\n", | |
| 636 | − clk->name); | |
| 637 | − WARN_ON(1); | |
| 638 | − goto out; | |
| 639 | − } | |
| 640 | − | |
| 641 | − omap1_clk_disable(clk); | |
| 642 | − | |
| 643 | −out: | |
| 644 | − spin_unlock_irqrestore(&clockfw_lock, flags); | |
| 645 | −} | |
| 646 | −EXPORT_SYMBOL(clk_disable); | |
| 647 | − | |
| 648 | −unsigned long clk_get_rate(struct clk *clk) | |
| 649 | −{ | |
| 650 | − unsigned long flags; | |
| 651 | − unsigned long ret; | |
| 652 | − | |
| 653 | − if (IS_ERR_OR_NULL(clk)) | |
| 654 | − return 0; | |
| 655 | − | |
| 656 | − spin_lock_irqsave(&clockfw_lock, flags); | |
| 657 | − ret = clk->rate; | |
| 658 | − spin_unlock_irqrestore(&clockfw_lock, flags); | |
| 659 | − | |
| 660 | − return ret; | |
| 661 | −} | |
| 662 | −EXPORT_SYMBOL(clk_get_rate); | |
| 663 | − | |
| 664 | −/* | |
| 665 | − * Optional clock functions defined in include/linux/clk.h | |
| 666 | − */ | |
| 667 | − | |
| 668 | −long clk_round_rate(struct clk *clk, unsigned long rate) | |
| 669 | −{ | |
| 670 | − unsigned long flags; | |
| 671 | − long ret; | |
| 672 | − | |
| 673 | − if (IS_ERR_OR_NULL(clk)) | |
| 674 | − return 0; | |
| 675 | − | |
| 676 | − spin_lock_irqsave(&clockfw_lock, flags); | |
| 677 | − ret = omap1_clk_round_rate(clk, rate); | |
| 678 | − spin_unlock_irqrestore(&clockfw_lock, flags); | |
| 679 | − | |
| 680 | − return ret; | |
| 681 | −} | |
| 682 | −EXPORT_SYMBOL(clk_round_rate); | |
| 683 | − | |
| 684 | −int clk_set_rate(struct clk *clk, unsigned long rate) | |
| 685 | −{ | |
| 686 | − unsigned long flags; | |
| 687 | − int ret = -EINVAL; | |
| 688 | − | |
| 689 | − if (IS_ERR_OR_NULL(clk)) | |
| 690 | − return ret; | |
| 691 | − | |
| 692 | − spin_lock_irqsave(&clockfw_lock, flags); | |
| 693 | − ret = omap1_clk_set_rate(clk, rate); | |
| 694 | − if (ret == 0) | |
| 695 | − propagate_rate(clk); | |
| 696 | − spin_unlock_irqrestore(&clockfw_lock, flags); | |
| 697 | − | |
| 698 | − return ret; | |
| 699 | −} | |
| 700 | −EXPORT_SYMBOL(clk_set_rate); | |
| 701 | − | |
| 702 | −int clk_set_parent(struct clk *clk, struct clk *parent) | |
| 703 | −{ | |
| 704 | − WARN_ONCE(1, "clk_set_parent() not implemented for OMAP1\n"); | |
| 705 | − | |
| 706 | − return -EINVAL; | |
| 707 | −} | |
| 708 | −EXPORT_SYMBOL(clk_set_parent); | |
| 772 | +const struct clk_ops omap1_clk_rate_ops = { | |
| 773 | + .recalc_rate = omap1_clk_recalc_rate, | |
| 774 | + .round_rate = omap1_clk_round_rate, | |
| 775 | + .set_rate = omap1_clk_set_rate, | |
| 776 | + .init = omap1_clk_init_op, | |
| 777 | +}; | |
| 709 | 778 | |
| 710 | −struct clk *clk_get_parent(struct clk *clk) | |
| 711 | −{ | |
| 712 | − return clk->parent; | |
| 713 | −} | |
| 714 | −EXPORT_SYMBOL(clk_get_parent); | |
| 779 | +const struct clk_ops omap1_clk_full_ops = { | |
| 780 | + .enable = omap1_clk_enable, | |
| 781 | + .disable = omap1_clk_disable, | |
| 782 | + .is_enabled = omap1_clk_is_enabled, | |
| 783 | +#ifdef CONFIG_OMAP_RESET_CLOCKS | |
| 784 | + .disable_unused = omap1_clk_disable_unused, | |
| 785 | +#endif | |
| 786 | + .recalc_rate = omap1_clk_recalc_rate, | |
| 787 | + .round_rate = omap1_clk_round_rate, | |
| 788 | + .set_rate = omap1_clk_set_rate, | |
| 789 | + .init = omap1_clk_init_op, | |
| 790 | +}; | |
| 715 | 791 | |
| 716 | 792 | /* |
| 717 | 793 | * OMAP specific clock functions shared between omap1 and omap2 |
| 718 | 794 | */ |
| 719 | 795 | |
| 720 | 796 | /* Used for clocks that always have same value as the parent clock */ |
| 721 | −unsigned long followparent_recalc(struct clk *clk) | |
| 797 | +unsigned long followparent_recalc(struct omap1_clk *clk, unsigned long p_rate) | |
| 722 | 798 | { |
| 723 | − return clk->parent->rate; | |
| 799 | + return p_rate; | |
| 724 | 800 | } |
| 725 | 801 | |
| 726 | 802 | /* |
| 727 | 803 | * Used for clocks that have the same value as the parent clock, |
| 728 | 804 | * divided by some factor |
| 729 | 805 | */ |
| 730 | −unsigned long omap_fixed_divisor_recalc(struct clk *clk) | |
| 806 | +unsigned long omap_fixed_divisor_recalc(struct omap1_clk *clk, unsigned long p_rate) | |
| 731 | 807 | { |
| 732 | 808 | WARN_ON(!clk->fixed_div); |
| 733 | 809 | |
| 734 | − return clk->parent->rate / clk->fixed_div; | |
| 810 | + return p_rate / clk->fixed_div; | |
| 735 | 811 | } |
| 736 | 812 | |
| 737 | 813 | /* Propagate rate to children */ |
| 738 | −void propagate_rate(struct clk *tclk) | |
| 814 | +void propagate_rate(struct omap1_clk *tclk) | |
| 739 | 815 | { |
| 740 | 816 | struct clk *clkp; |
| 741 | 817 | |
| 742 | − list_for_each_entry(clkp, &tclk->children, sibling) { | |
| 743 | − if (clkp->recalc) | |
| 744 | − clkp->rate = clkp->recalc(clkp); | |
| 745 | − propagate_rate(clkp); | |
| 746 | − } | |
| 747 | −} | |
| 748 | − | |
| 749 | −static LIST_HEAD(root_clks); | |
| 750 | − | |
| 751 | −/** | |
| 752 | − * clk_preinit - initialize any fields in the struct clk before clk init | |
| 753 | − * @clk: struct clk * to initialize | |
| 754 | − * | |
| 755 | − * Initialize any struct clk fields needed before normal clk initialization | |
| 756 | − * can run. No return value. | |
| 757 | − */ | |
| 758 | −void clk_preinit(struct clk *clk) | |
| 759 | −{ | |
| 760 | − INIT_LIST_HEAD(&clk->children); | |
| 761 | −} | |
| 762 | − | |
| 763 | −int clk_register(struct clk *clk) | |
| 764 | −{ | |
| 765 | − if (IS_ERR_OR_NULL(clk)) | |
| 766 | − return -EINVAL; | |
| 767 | − | |
| 768 | − /* | |
| 769 | − * trap out already registered clocks | |
| 770 | − */ | |
| 771 | − if (clk->node.next || clk->node.prev) | |
| 772 | − return 0; | |
| 773 | − | |
| 774 | − mutex_lock(&clocks_mutex); | |
| 775 | − if (clk->parent) | |
| 776 | − list_add(&clk->sibling, &clk->parent->children); | |
| 777 | − else | |
| 778 | − list_add(&clk->sibling, &root_clks); | |
| 779 | − | |
| 780 | − list_add(&clk->node, &clocks); | |
| 781 | − if (clk->init) | |
| 782 | − clk->init(clk); | |
| 783 | − mutex_unlock(&clocks_mutex); | |
| 784 | − | |
| 785 | − return 0; | |
| 786 | −} | |
| 787 | −EXPORT_SYMBOL(clk_register); | |
| 788 | − | |
| 789 | −void clk_unregister(struct clk *clk) | |
| 790 | −{ | |
| 791 | − if (IS_ERR_OR_NULL(clk)) | |
| 818 | + /* depend on CCF ability to recalculate new rates across whole clock subtree */ | |
| 819 | + if (WARN_ON(!(clk_hw_get_flags(&tclk->hw) & CLK_GET_RATE_NOCACHE))) | |
| 792 | 820 | return; |
| 793 | 821 | |
| 794 | − mutex_lock(&clocks_mutex); | |
| 795 | − list_del(&clk->sibling); | |
| 796 | − list_del(&clk->node); | |
| 797 | − mutex_unlock(&clocks_mutex); | |
| 798 | −} | |
| 799 | −EXPORT_SYMBOL(clk_unregister); | |
| 800 | − | |
| 801 | −/* | |
| 802 | − * Low level helpers | |
| 803 | − */ | |
| 804 | −static int clkll_enable_null(struct clk *clk) | |
| 805 | −{ | |
| 806 | − return 0; | |
| 807 | −} | |
| 822 | + clkp = clk_get_sys(NULL, clk_hw_get_name(&tclk->hw)); | |
| 823 | + if (WARN_ON(!clkp)) | |
| 824 | + return; | |
| 808 | 825 | |
| 809 | −static void clkll_disable_null(struct clk *clk) | |
| 810 | −{ | |
| 826 | + clk_get_rate(clkp); | |
| 827 | + clk_put(clkp); | |
| 811 | 828 | } |
| 812 | 829 | |
| 813 | −const struct clkops clkops_null = { | |
| 814 | − .enable = clkll_enable_null, | |
| 815 | − .disable = clkll_disable_null, | |
| 830 | +const struct clk_ops omap1_clk_null_ops = { | |
| 816 | 831 | }; |
| 817 | 832 | |
| 818 | 833 | /* |
| @@ -820,114 +835,6 @@ const struct clkops clkops_null = { · 1 unmodified line | ||
| 820 | 835 | * |
| 821 | 836 | * Used for clock aliases that are needed on some OMAPs, but not others |
| 822 | 837 | */ |
| 823 | −struct clk dummy_ck = { | |
| 824 | − .name = "dummy", | |
| 825 | − .ops = &clkops_null, | |
| 838 | +struct omap1_clk dummy_ck __refdata = { | |
| 839 | + .hw.init = CLK_HW_INIT_NO_PARENT("dummy", &omap1_clk_null_ops, 0), | |
| 826 | 840 | }; |
| 827 | − | |
| 828 | −/* | |
| 829 | − * | |
| 830 | − */ | |
| 831 | − | |
| 832 | −#ifdef CONFIG_OMAP_RESET_CLOCKS | |
| 833 | −/* | |
| 834 | − * Disable any unused clocks left on by the bootloader | |
| 835 | − */ | |
| 836 | −static int __init clk_disable_unused(void) | |
| 837 | −{ | |
| 838 | − struct clk *ck; | |
| 839 | − unsigned long flags; | |
| 840 | − | |
| 841 | − pr_info("clock: disabling unused clocks to save power\n"); | |
| 842 | − | |
| 843 | − spin_lock_irqsave(&clockfw_lock, flags); | |
| 844 | − list_for_each_entry(ck, &clocks, node) { | |
| 845 | − if (ck->ops == &clkops_null) | |
| 846 | − continue; | |
| 847 | − | |
| 848 | − if (ck->usecount > 0 || !ck->enable_reg) | |
| 849 | − continue; | |
| 850 | − | |
| 851 | − omap1_clk_disable_unused(ck); | |
| 852 | − } | |
| 853 | − spin_unlock_irqrestore(&clockfw_lock, flags); | |
| 854 | − | |
| 855 | − return 0; | |
| 856 | −} | |
| 857 | −late_initcall(clk_disable_unused); | |
| 858 | −#endif | |
| 859 | − | |
| 860 | −#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) | |
| 861 | −/* | |
| 862 | − * debugfs support to trace clock tree hierarchy and attributes | |
| 863 | − */ | |
| 864 | − | |
| 865 | −#include <linux/debugfs.h> | |
| 866 | −#include <linux/seq_file.h> | |
| 867 | − | |
| 868 | −static struct dentry *clk_debugfs_root; | |
| 869 | − | |
| 870 | −static int debug_clock_show(struct seq_file *s, void *unused) | |
| 871 | −{ | |
| 872 | − struct clk *c; | |
| 873 | − struct clk *pa; | |
| 874 | − | |
| 875 | − mutex_lock(&clocks_mutex); | |
| 876 | − seq_printf(s, "%-30s %-30s %-10s %s\n", | |
| 877 | − "clock-name", "parent-name", "rate", "use-count"); | |
| 878 | − | |
| 879 | − list_for_each_entry(c, &clocks, node) { | |
| 880 | − pa = c->parent; | |
| 881 | − seq_printf(s, "%-30s %-30s %-10lu %d\n", | |
| 882 | − c->name, pa ? pa->name : "none", c->rate, | |
| 883 | − c->usecount); | |
| 884 | − } | |
| 885 | − mutex_unlock(&clocks_mutex); | |
| 886 | − | |
| 887 | − return 0; | |
| 888 | −} | |
| 889 | − | |
| 890 | −DEFINE_SHOW_ATTRIBUTE(debug_clock); | |
| 891 | − | |
| 892 | −static void clk_debugfs_register_one(struct clk *c) | |
| 893 | −{ | |
| 894 | − struct dentry *d; | |
| 895 | − struct clk *pa = c->parent; | |
| 896 | − | |
| 897 | − d = debugfs_create_dir(c->name, pa ? pa->dent : clk_debugfs_root); | |
| 898 | − c->dent = d; | |
| 899 | − | |
| 900 | − debugfs_create_u8("usecount", S_IRUGO, c->dent, &c->usecount); | |
| 901 | − debugfs_create_ulong("rate", S_IRUGO, c->dent, &c->rate); | |
| 902 | − debugfs_create_x8("flags", S_IRUGO, c->dent, &c->flags); | |
| 903 | −} | |
| 904 | − | |
| 905 | −static void clk_debugfs_register(struct clk *c) | |
| 906 | −{ | |
| 907 | − struct clk *pa = c->parent; | |
| 908 | − | |
| 909 | − if (pa && !pa->dent) | |
| 910 | − clk_debugfs_register(pa); | |
| 911 | − | |
| 912 | − if (!c->dent) | |
| 913 | − clk_debugfs_register_one(c); | |
| 914 | −} | |
| 915 | − | |
| 916 | −static int __init clk_debugfs_init(void) | |
| 917 | −{ | |
| 918 | − struct clk *c; | |
| 919 | − struct dentry *d; | |
| 920 | − | |
| 921 | − d = debugfs_create_dir("clock", NULL); | |
| 922 | − clk_debugfs_root = d; | |
| 923 | − | |
| 924 | − list_for_each_entry(c, &clocks, node) | |
| 925 | − clk_debugfs_register(c); | |
| 926 | − | |
| 927 | − debugfs_create_file("summary", S_IRUGO, d, NULL, &debug_clock_fops); | |
| 928 | − | |
| 929 | − return 0; | |
| 930 | −} | |
| 931 | −late_initcall(clk_debugfs_init); | |
| 932 | − | |
| 933 | −#endif /* defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) */ | |
| @@ -11,12 +11,11 @@ · 10 unmodified lines | ||
| 11 | 11 | #define __ARCH_ARM_MACH_OMAP1_CLOCK_H |
| 12 | 12 | |
| 13 | 13 | #include <linux/clk.h> |
| 14 | −#include <linux/list.h> | |
| 15 | − | |
| 16 | 14 | #include <linux/clkdev.h> |
| 15 | +#include <linux/clk-provider.h> | |
| 17 | 16 | |
| 18 | 17 | struct module; |
| 19 | −struct clk; | |
| 18 | +struct omap1_clk; | |
| 20 | 19 | |
| 21 | 20 | struct omap_clk { |
| 22 | 21 | u16 cpu; |
| @@ -29,7 +28,7 @@ struct omap_clk { · 6 unmodified lines | ||
| 29 | 28 | .lk = { \ |
| 30 | 29 | .dev_id = dev, \ |
| 31 | 30 | .con_id = con, \ |
| 32 | − .clk = ck, \ | |
| 31 | + .clk_hw = ck, \ | |
| 33 | 32 | }, \ |
| 34 | 33 | } |
| 35 | 34 | |
| @@ -40,10 +39,6 @@ struct omap_clk { · 4 unmodified lines | ||
| 40 | 39 | #define CK_16XX (1 << 3) /* 16xx, 17xx, 5912 */ |
| 41 | 40 | #define CK_1710 (1 << 4) /* 1710 extra for rate selection */ |
| 42 | 41 | |
| 43 | − | |
| 44 | −/* Temporary, needed during the common clock framework conversion */ | |
| 45 | −#define __clk_get_name(clk) (clk->name) | |
| 46 | − | |
| 47 | 42 | /** |
| 48 | 43 | * struct clkops - some clock function pointers |
| 49 | 44 | * @enable: fn ptr that enables the current clock in hardware |
| @@ -51,8 +46,8 @@ struct omap_clk { · 1 unmodified line | ||
| 51 | 46 | * @allow_idle: fn ptr that enables autoidle for the current clock in hardware |
| 52 | 47 | */ |
| 53 | 48 | struct clkops { |
| 54 | − int (*enable)(struct clk *); | |
| 55 | − void (*disable)(struct clk *); | |
| 49 | + int (*enable)(struct omap1_clk *clk); | |
| 50 | + void (*disable)(struct omap1_clk *clk); | |
| 56 | 51 | }; |
| 57 | 52 | |
| 58 | 53 | /* |
| @@ -65,13 +60,9 @@ struct clkops { · 6 unmodified lines | ||
| 65 | 60 | #define CLOCK_NO_IDLE_PARENT (1 << 2) |
| 66 | 61 | |
| 67 | 62 | /** |
| 68 | − * struct clk - OMAP struct clk | |
| 69 | − * @node: list_head connecting this clock into the full clock list | |
| 63 | + * struct omap1_clk - OMAP1 struct clk | |
| 64 | + * @hw: struct clk_hw for common clock framework integration | |
| 70 | 65 | * @ops: struct clkops * for this clock |
| 71 | − * @name: the name of the clock in the hardware (used in hwmod data and debug) | |
| 72 | − * @parent: pointer to this clock's parent struct clk | |
| 73 | − * @children: list_head connecting to the child clks' @sibling list_heads | |
| 74 | − * @sibling: list_head connecting this clk to its parent clk's @children | |
| 75 | 66 | * @rate: current clock rate |
| 76 | 67 | * @enable_reg: register to write to enable the clock (see @enable_bit) |
| 77 | 68 | * @recalc: fn ptr that returns the clock's current rate |
| @@ -79,102 +70,65 @@ struct clkops { · 1 unmodified line | ||
| 79 | 70 | * @round_rate: fn ptr that can round the clock's current rate |
| 80 | 71 | * @init: fn ptr to do clock-specific initialization |
| 81 | 72 | * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg) |
| 82 | − * @usecount: number of users that have requested this clock to be enabled | |
| 83 | 73 | * @fixed_div: when > 0, this clock's rate is its parent's rate / @fixed_div |
| 84 | 74 | * @flags: see "struct clk.flags possibilities" above |
| 85 | 75 | * @rate_offset: bitshift for rate selection bitfield (OMAP1 only) |
| 86 | − * | |
| 87 | − * XXX @rate_offset should probably be removed and OMAP1 | |
| 88 | − * clock code converted to use clksel. | |
| 89 | − * | |
| 90 | − * XXX @usecount is poorly named. It should be "enable_count" or | |
| 91 | − * something similar. "users" in the description refers to kernel | |
| 92 | − * code (core code or drivers) that have called clk_enable() and not | |
| 93 | − * yet called clk_disable(); the usecount of parent clocks is also | |
| 94 | − * incremented by the clock code when clk_enable() is called on child | |
| 95 | − * clocks and decremented by the clock code when clk_disable() is | |
| 96 | − * called on child clocks. | |
| 97 | − * | |
| 98 | − * XXX @usecount, @children, @sibling should be marked for | |
| 99 | − * internal use only. | |
| 100 | − * | |
| 101 | − * @children and @sibling are used to optimize parent-to-child clock | |
| 102 | − * tree traversals. (child-to-parent traversals use @parent.) | |
| 103 | − * | |
| 104 | − * XXX The notion of the clock's current rate probably needs to be | |
| 105 | − * separated from the clock's target rate. | |
| 106 | 76 | */ |
| 107 | −struct clk { | |
| 108 | − struct list_head node; | |
| 77 | +struct omap1_clk { | |
| 78 | + struct clk_hw hw; | |
| 109 | 79 | const struct clkops *ops; |
| 110 | − const char *name; | |
| 111 | − struct clk *parent; | |
| 112 | − struct list_head children; | |
| 113 | − struct list_head sibling; /* node for children */ | |
| 114 | 80 | unsigned long rate; |
| 115 | 81 | void __iomem *enable_reg; |
| 116 | − unsigned long (*recalc)(struct clk *); | |
| 117 | − int (*set_rate)(struct clk *, unsigned long); | |
| 118 | − long (*round_rate)(struct clk *, unsigned long); | |
| 119 | − void (*init)(struct clk *); | |
| 82 | + unsigned long (*recalc)(struct omap1_clk *clk, unsigned long rate); | |
| 83 | + int (*set_rate)(struct omap1_clk *clk, unsigned long rate, | |
| 84 | + unsigned long p_rate); | |
| 85 | + long (*round_rate)(struct omap1_clk *clk, unsigned long rate, | |
| 86 | + unsigned long *p_rate); | |
| 87 | + int (*init)(struct omap1_clk *clk); | |
| 120 | 88 | u8 enable_bit; |
| 121 | − s8 usecount; | |
| 122 | 89 | u8 fixed_div; |
| 123 | 90 | u8 flags; |
| 124 | 91 | u8 rate_offset; |
| 125 | −#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) | |
| 126 | − struct dentry *dent; /* For visible tree hierarchy */ | |
| 127 | −#endif | |
| 128 | 92 | }; |
| 93 | +#define to_omap1_clk(_hw) container_of(_hw, struct omap1_clk, hw) | |
| 129 | 94 | |
| 130 | −extern void clk_preinit(struct clk *clk); | |
| 131 | −extern int clk_register(struct clk *clk); | |
| 132 | −extern void clk_unregister(struct clk *clk); | |
| 133 | −extern void propagate_rate(struct clk *clk); | |
| 134 | −extern unsigned long followparent_recalc(struct clk *clk); | |
| 135 | −unsigned long omap_fixed_divisor_recalc(struct clk *clk); | |
| 95 | +void propagate_rate(struct omap1_clk *clk); | |
| 96 | +unsigned long followparent_recalc(struct omap1_clk *clk, unsigned long p_rate); | |
| 97 | +unsigned long omap_fixed_divisor_recalc(struct omap1_clk *clk, unsigned long p_rate); | |
| 136 | 98 | |
| 137 | −extern const struct clkops clkops_null; | |
| 138 | − | |
| 139 | −extern struct clk dummy_ck; | |
| 99 | +extern struct omap1_clk dummy_ck; | |
| 140 | 100 | |
| 141 | 101 | int omap1_clk_init(void); |
| 142 | 102 | void omap1_clk_late_init(void); |
| 143 | −extern int omap1_clk_enable(struct clk *clk); | |
| 144 | −extern void omap1_clk_disable(struct clk *clk); | |
| 145 | −extern long omap1_clk_round_rate(struct clk *clk, unsigned long rate); | |
| 146 | −extern int omap1_clk_set_rate(struct clk *clk, unsigned long rate); | |
| 147 | −extern unsigned long omap1_ckctl_recalc(struct clk *clk); | |
| 148 | −extern int omap1_set_sossi_rate(struct clk *clk, unsigned long rate); | |
| 149 | −extern unsigned long omap1_sossi_recalc(struct clk *clk); | |
| 150 | −extern unsigned long omap1_ckctl_recalc_dsp_domain(struct clk *clk); | |
| 151 | −extern int omap1_clk_set_rate_dsp_domain(struct clk *clk, unsigned long rate); | |
| 152 | −extern int omap1_set_uart_rate(struct clk *clk, unsigned long rate); | |
| 153 | −extern unsigned long omap1_uart_recalc(struct clk *clk); | |
| 154 | −extern int omap1_set_ext_clk_rate(struct clk *clk, unsigned long rate); | |
| 155 | −extern long omap1_round_ext_clk_rate(struct clk *clk, unsigned long rate); | |
| 156 | −extern void omap1_init_ext_clk(struct clk *clk); | |
| 157 | −extern int omap1_select_table_rate(struct clk *clk, unsigned long rate); | |
| 158 | −extern long omap1_round_to_table_rate(struct clk *clk, unsigned long rate); | |
| 159 | −extern int omap1_clk_set_rate_ckctl_arm(struct clk *clk, unsigned long rate); | |
| 160 | −extern long omap1_clk_round_rate_ckctl_arm(struct clk *clk, unsigned long rate); | |
| 161 | − | |
| 162 | −#ifdef CONFIG_OMAP_RESET_CLOCKS | |
| 163 | −extern void omap1_clk_disable_unused(struct clk *clk); | |
| 164 | −#else | |
| 165 | −#define omap1_clk_disable_unused NULL | |
| 166 | −#endif | |
| 103 | +unsigned long omap1_ckctl_recalc(struct omap1_clk *clk, unsigned long p_rate); | |
| 104 | +long omap1_round_sossi_rate(struct omap1_clk *clk, unsigned long rate, unsigned long *p_rate); | |
| 105 | +int omap1_set_sossi_rate(struct omap1_clk *clk, unsigned long rate, unsigned long p_rate); | |
| 106 | +unsigned long omap1_sossi_recalc(struct omap1_clk *clk, unsigned long p_rate); | |
| 107 | +unsigned long omap1_ckctl_recalc_dsp_domain(struct omap1_clk *clk, unsigned long p_rate); | |
| 108 | +int omap1_clk_set_rate_dsp_domain(struct omap1_clk *clk, unsigned long rate, | |
| 109 | + unsigned long p_rate); | |
| 110 | +long omap1_round_uart_rate(struct omap1_clk *clk, unsigned long rate, unsigned long *p_rate); | |
| 111 | +int omap1_set_uart_rate(struct omap1_clk *clk, unsigned long rate, unsigned long p_rate); | |
| 112 | +unsigned long omap1_uart_recalc(struct omap1_clk *clk, unsigned long p_rate); | |
| 113 | +int omap1_set_ext_clk_rate(struct omap1_clk *clk, unsigned long rate, unsigned long p_rate); | |
| 114 | +long omap1_round_ext_clk_rate(struct omap1_clk *clk, unsigned long rate, unsigned long *p_rate); | |
| 115 | +int omap1_init_ext_clk(struct omap1_clk *clk); | |
| 116 | +int omap1_select_table_rate(struct omap1_clk *clk, unsigned long rate, unsigned long p_rate); | |
| 117 | +long omap1_round_to_table_rate(struct omap1_clk *clk, unsigned long rate, unsigned long *p_rate); | |
| 118 | +int omap1_clk_set_rate_ckctl_arm(struct omap1_clk *clk, unsigned long rate, unsigned long p_rate); | |
| 119 | +long omap1_clk_round_rate_ckctl_arm(struct omap1_clk *clk, unsigned long rate, | |
| 120 | + unsigned long *p_rate); | |
| 167 | 121 | |
| 168 | 122 | struct uart_clk { |
| 169 | − struct clk clk; | |
| 170 | − unsigned long sysc_addr; | |
| 123 | + struct omap1_clk clk; | |
| 124 | + unsigned long sysc_addr; | |
| 171 | 125 | }; |
| 172 | 126 | |
| 173 | 127 | /* Provide a method for preventing idling some ARM IDLECT clocks */ |
| 174 | 128 | struct arm_idlect1_clk { |
| 175 | − struct clk clk; | |
| 176 | − unsigned long no_idle_count; | |
| 177 | − __u8 idlect_shift; | |
| 129 | + struct omap1_clk clk; | |
| 130 | + unsigned long no_idle_count; | |
| 131 | + __u8 idlect_shift; | |
| 178 | 132 | }; |
| 179 | 133 | |
| 180 | 134 | /* ARM_CKCTL bit shifts */ |
| @@ -224,7 +178,7 @@ struct arm_idlect1_clk { · 43 unmodified lines | ||
| 224 | 178 | #define SOFT_REQ_REG2 0xfffe0880 |
| 225 | 179 | |
| 226 | 180 | extern __u32 arm_idlect1_mask; |
| 227 | −extern struct clk *api_ck_p, *ck_dpll1_p, *ck_ref_p; | |
| 181 | +extern struct omap1_clk *api_ck_p, *ck_dpll1_p, *ck_ref_p; | |
| 228 | 182 | |
| 229 | 183 | extern const struct clkops clkops_dspck; |
| 230 | 184 | extern const struct clkops clkops_uart_16xx; |
| @@ -233,4 +187,9 @@ extern const struct clkops clkops_generic; · 2 unmodified lines | ||
| 233 | 187 | /* used for passing SoC type to omap1_{select,round_to}_table_rate() */ |
| 234 | 188 | extern u32 cpu_mask; |
| 235 | 189 | |
| 190 | +extern const struct clk_ops omap1_clk_null_ops; | |
| 191 | +extern const struct clk_ops omap1_clk_gate_ops; | |
| 192 | +extern const struct clk_ops omap1_clk_rate_ops; | |
| 193 | +extern const struct clk_ops omap1_clk_full_ops; | |
| 194 | + | |
| 236 | 195 | #endif |
| @@ -14,6 +14,8 @@ · 13 unmodified lines | ||
| 14 | 14 | #include <linux/kernel.h> |
| 15 | 15 | #include <linux/io.h> |
| 16 | 16 | #include <linux/clk.h> |
| 17 | +#include <linux/clkdev.h> | |
| 18 | +#include <linux/clk-provider.h> | |
| 17 | 19 | #include <linux/cpufreq.h> |
| 18 | 20 | #include <linux/delay.h> |
| 19 | 21 | #include <linux/soc/ti/omap1-io.h> |
| @@ -71,16 +73,18 @@ · 51 unmodified lines | ||
| 71 | 73 | * Omap1 clocks |
| 72 | 74 | */ |
| 73 | 75 | |
| 74 | −static struct clk ck_ref = { | |
| 75 | − .name = "ck_ref", | |
| 76 | − .ops = &clkops_null, | |
| 76 | +static struct omap1_clk ck_ref = { | |
| 77 | + .hw.init = CLK_HW_INIT_NO_PARENT("ck_ref", &omap1_clk_rate_ops, 0), | |
| 77 | 78 | .rate = 12000000, |
| 78 | 79 | }; |
| 79 | 80 | |
| 80 | −static struct clk ck_dpll1 = { | |
| 81 | − .name = "ck_dpll1", | |
| 82 | − .ops = &clkops_null, | |
| 83 | − .parent = &ck_ref, | |
| 81 | +static struct omap1_clk ck_dpll1 = { | |
| 82 | + .hw.init = CLK_HW_INIT("ck_dpll1", "ck_ref", &omap1_clk_rate_ops, | |
| 83 | + /* | |
| 84 | + * force recursive refresh of rates of the clock | |
| 85 | + * and its children when clk_get_rate() is called | |
| 86 | + */ | |
| 87 | + CLK_GET_RATE_NOCACHE), | |
| 84 | 88 | }; |
| 85 | 89 | |
| 86 | 90 | /* |
| @@ -89,32 +93,28 @@ static struct clk ck_dpll1 = { · 2 unmodified lines | ||
| 89 | 93 | */ |
| 90 | 94 | static struct arm_idlect1_clk ck_dpll1out = { |
| 91 | 95 | .clk = { |
| 92 | − .name = "ck_dpll1out", | |
| 96 | + .hw.init = CLK_HW_INIT("ck_dpll1out", "ck_dpll1", &omap1_clk_gate_ops, 0), | |
| 93 | 97 | .ops = &clkops_generic, |
| 94 | − .parent = &ck_dpll1, | |
| 95 | 98 | .flags = CLOCK_IDLE_CONTROL | ENABLE_REG_32BIT, |
| 96 | 99 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), |
| 97 | 100 | .enable_bit = EN_CKOUT_ARM, |
| 98 | − .recalc = &followparent_recalc, | |
| 99 | 101 | }, |
| 100 | 102 | .idlect_shift = IDL_CLKOUT_ARM_SHIFT, |
| 101 | 103 | }; |
| 102 | 104 | |
| 103 | −static struct clk sossi_ck = { | |
| 104 | − .name = "ck_sossi", | |
| 105 | +static struct omap1_clk sossi_ck = { | |
| 106 | + .hw.init = CLK_HW_INIT("ck_sossi", "ck_dpll1out", &omap1_clk_full_ops, 0), | |
| 105 | 107 | .ops = &clkops_generic, |
| 106 | − .parent = &ck_dpll1out.clk, | |
| 107 | 108 | .flags = CLOCK_NO_IDLE_PARENT | ENABLE_REG_32BIT, |
| 108 | 109 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_1), |
| 109 | 110 | .enable_bit = CONF_MOD_SOSSI_CLK_EN_R, |
| 110 | 111 | .recalc = &omap1_sossi_recalc, |
| 112 | + .round_rate = &omap1_round_sossi_rate, | |
| 111 | 113 | .set_rate = &omap1_set_sossi_rate, |
| 112 | 114 | }; |
| 113 | 115 | |
| 114 | −static struct clk arm_ck = { | |
| 115 | − .name = "arm_ck", | |
| 116 | − .ops = &clkops_null, | |
| 117 | − .parent = &ck_dpll1, | |
| 116 | +static struct omap1_clk arm_ck = { | |
| 117 | + .hw.init = CLK_HW_INIT("arm_ck", "ck_dpll1", &omap1_clk_rate_ops, 0), | |
| 118 | 118 | .rate_offset = CKCTL_ARMDIV_OFFSET, |
| 119 | 119 | .recalc = &omap1_ckctl_recalc, |
| 120 | 120 | .round_rate = omap1_clk_round_rate_ckctl_arm, |
| @@ -123,9 +123,9 @@ static struct clk arm_ck = { · 2 unmodified lines | ||
| 123 | 123 | |
| 124 | 124 | static struct arm_idlect1_clk armper_ck = { |
| 125 | 125 | .clk = { |
| 126 | − .name = "armper_ck", | |
| 126 | + .hw.init = CLK_HW_INIT("armper_ck", "ck_dpll1", &omap1_clk_full_ops, | |
| 127 | + CLK_IS_CRITICAL), | |
| 127 | 128 | .ops = &clkops_generic, |
| 128 | − .parent = &ck_dpll1, | |
| 129 | 129 | .flags = CLOCK_IDLE_CONTROL, |
| 130 | 130 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), |
| 131 | 131 | .enable_bit = EN_PERCK, |
| @@ -141,46 +141,41 @@ static struct arm_idlect1_clk armper_ck = { · 9 unmodified lines | ||
| 141 | 141 | * FIXME: This clock seems to be necessary but no-one has asked for its |
| 142 | 142 | * activation. [ GPIO code for 1510 ] |
| 143 | 143 | */ |
| 144 | −static struct clk arm_gpio_ck = { | |
| 145 | − .name = "ick", | |
| 144 | +static struct omap1_clk arm_gpio_ck = { | |
| 145 | + .hw.init = CLK_HW_INIT("ick", "ck_dpll1", &omap1_clk_gate_ops, CLK_IS_CRITICAL), | |
| 146 | 146 | .ops = &clkops_generic, |
| 147 | − .parent = &ck_dpll1, | |
| 148 | 147 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), |
| 149 | 148 | .enable_bit = EN_GPIOCK, |
| 150 | − .recalc = &followparent_recalc, | |
| 151 | 149 | }; |
| 152 | 150 | |
| 153 | 151 | static struct arm_idlect1_clk armxor_ck = { |
| 154 | 152 | .clk = { |
| 155 | − .name = "armxor_ck", | |
| 153 | + .hw.init = CLK_HW_INIT("armxor_ck", "ck_ref", &omap1_clk_gate_ops, | |
| 154 | + CLK_IS_CRITICAL), | |
| 156 | 155 | .ops = &clkops_generic, |
| 157 | − .parent = &ck_ref, | |
| 158 | 156 | .flags = CLOCK_IDLE_CONTROL, |
| 159 | 157 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), |
| 160 | 158 | .enable_bit = EN_XORPCK, |
| 161 | − .recalc = &followparent_recalc, | |
| 162 | 159 | }, |
| 163 | 160 | .idlect_shift = IDLXORP_ARM_SHIFT, |
| 164 | 161 | }; |
| 165 | 162 | |
| 166 | 163 | static struct arm_idlect1_clk armtim_ck = { |
| 167 | 164 | .clk = { |
| 168 | − .name = "armtim_ck", | |
| 165 | + .hw.init = CLK_HW_INIT("armtim_ck", "ck_ref", &omap1_clk_gate_ops, | |
| 166 | + CLK_IS_CRITICAL), | |
| 169 | 167 | .ops = &clkops_generic, |
| 170 | − .parent = &ck_ref, | |
| 171 | 168 | .flags = CLOCK_IDLE_CONTROL, |
| 172 | 169 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), |
| 173 | 170 | .enable_bit = EN_TIMCK, |
| 174 | − .recalc = &followparent_recalc, | |
| 175 | 171 | }, |
| 176 | 172 | .idlect_shift = IDLTIM_ARM_SHIFT, |
| 177 | 173 | }; |
| 178 | 174 | |
| 179 | 175 | static struct arm_idlect1_clk armwdt_ck = { |
| 180 | 176 | .clk = { |
| 181 | − .name = "armwdt_ck", | |
| 177 | + .hw.init = CLK_HW_INIT("armwdt_ck", "ck_ref", &omap1_clk_full_ops, 0), | |
| 182 | 178 | .ops = &clkops_generic, |
| 183 | − .parent = &ck_ref, | |
| 184 | 179 | .flags = CLOCK_IDLE_CONTROL, |
| 185 | 180 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), |
| 186 | 181 | .enable_bit = EN_WDTCK, |
| @@ -190,11 +185,8 @@ static struct arm_idlect1_clk armwdt_ck = { · 3 unmodified lines | ||
| 190 | 185 | .idlect_shift = IDLWDT_ARM_SHIFT, |
| 191 | 186 | }; |
| 192 | 187 | |
| 193 | −static struct clk arminth_ck16xx = { | |
| 194 | − .name = "arminth_ck", | |
| 195 | − .ops = &clkops_null, | |
| 196 | − .parent = &arm_ck, | |
| 197 | − .recalc = &followparent_recalc, | |
| 188 | +static struct omap1_clk arminth_ck16xx = { | |
| 189 | + .hw.init = CLK_HW_INIT("arminth_ck", "arm_ck", &omap1_clk_null_ops, 0), | |
| 198 | 190 | /* Note: On 16xx the frequency can be divided by 2 by programming |
| 199 | 191 | * ARM_CKCTL:ARM_INTHCK_SEL(14) to 1 |
| 200 | 192 | * |
| @@ -202,10 +194,9 @@ static struct clk arminth_ck16xx = { · 1 unmodified line | ||
| 202 | 194 | */ |
| 203 | 195 | }; |
| 204 | 196 | |
| 205 | −static struct clk dsp_ck = { | |
| 206 | − .name = "dsp_ck", | |
| 197 | +static struct omap1_clk dsp_ck = { | |
| 198 | + .hw.init = CLK_HW_INIT("dsp_ck", "ck_dpll1", &omap1_clk_full_ops, 0), | |
| 207 | 199 | .ops = &clkops_generic, |
| 208 | − .parent = &ck_dpll1, | |
| 209 | 200 | .enable_reg = OMAP1_IO_ADDRESS(ARM_CKCTL), |
| 210 | 201 | .enable_bit = EN_DSPCK, |
| 211 | 202 | .rate_offset = CKCTL_DSPDIV_OFFSET, |
| @@ -214,20 +205,17 @@ static struct clk dsp_ck = { · 2 unmodified lines | ||
| 214 | 205 | .set_rate = omap1_clk_set_rate_ckctl_arm, |
| 215 | 206 | }; |
| 216 | 207 | |
| 217 | −static struct clk dspmmu_ck = { | |
| 218 | − .name = "dspmmu_ck", | |
| 219 | − .ops = &clkops_null, | |
| 220 | − .parent = &ck_dpll1, | |
| 208 | +static struct omap1_clk dspmmu_ck = { | |
| 209 | + .hw.init = CLK_HW_INIT("dspmmu_ck", "ck_dpll1", &omap1_clk_rate_ops, 0), | |
| 221 | 210 | .rate_offset = CKCTL_DSPMMUDIV_OFFSET, |
| 222 | 211 | .recalc = &omap1_ckctl_recalc, |
| 223 | 212 | .round_rate = omap1_clk_round_rate_ckctl_arm, |
| 224 | 213 | .set_rate = omap1_clk_set_rate_ckctl_arm, |
| 225 | 214 | }; |
| 226 | 215 | |
| 227 | −static struct clk dspper_ck = { | |
| 228 | − .name = "dspper_ck", | |
| 216 | +static struct omap1_clk dspper_ck = { | |
| 217 | + .hw.init = CLK_HW_INIT("dspper_ck", "ck_dpll1", &omap1_clk_full_ops, 0), | |
| 229 | 218 | .ops = &clkops_dspck, |
| 230 | − .parent = &ck_dpll1, | |
| 231 | 219 | .enable_reg = DSP_IDLECT2, |
| 232 | 220 | .enable_bit = EN_PERCK, |
| 233 | 221 | .rate_offset = CKCTL_PERDIV_OFFSET, |
| @@ -236,29 +224,23 @@ static struct clk dspper_ck = { · 2 unmodified lines | ||
| 236 | 224 | .set_rate = &omap1_clk_set_rate_dsp_domain, |
| 237 | 225 | }; |
| 238 | 226 | |
| 239 | −static struct clk dspxor_ck = { | |
| 240 | − .name = "dspxor_ck", | |
| 227 | +static struct omap1_clk dspxor_ck = { | |
| 228 | + .hw.init = CLK_HW_INIT("dspxor_ck", "ck_ref", &omap1_clk_gate_ops, 0), | |
| 241 | 229 | .ops = &clkops_dspck, |
| 242 | − .parent = &ck_ref, | |
| 243 | 230 | .enable_reg = DSP_IDLECT2, |
| 244 | 231 | .enable_bit = EN_XORPCK, |
| 245 | − .recalc = &followparent_recalc, | |
| 246 | 232 | }; |
| 247 | 233 | |
| 248 | −static struct clk dsptim_ck = { | |
| 249 | − .name = "dsptim_ck", | |
| 234 | +static struct omap1_clk dsptim_ck = { | |
| 235 | + .hw.init = CLK_HW_INIT("dsptim_ck", "ck_ref", &omap1_clk_gate_ops, 0), | |
| 250 | 236 | .ops = &clkops_dspck, |
| 251 | − .parent = &ck_ref, | |
| 252 | 237 | .enable_reg = DSP_IDLECT2, |
| 253 | 238 | .enable_bit = EN_DSPTIMCK, |
| 254 | − .recalc = &followparent_recalc, | |
| 255 | 239 | }; |
| 256 | 240 | |
| 257 | 241 | static struct arm_idlect1_clk tc_ck = { |
| 258 | 242 | .clk = { |
| 259 | − .name = "tc_ck", | |
| 260 | − .ops = &clkops_null, | |
| 261 | − .parent = &ck_dpll1, | |
| 243 | + .hw.init = CLK_HW_INIT("tc_ck", "ck_dpll1", &omap1_clk_rate_ops, 0), | |
| 262 | 244 | .flags = CLOCK_IDLE_CONTROL, |
| 263 | 245 | .rate_offset = CKCTL_TCDIV_OFFSET, |
| 264 | 246 | .recalc = &omap1_ckctl_recalc, |
| @@ -268,116 +250,88 @@ static struct arm_idlect1_clk tc_ck = { · 3 unmodified lines | ||
| 268 | 250 | .idlect_shift = IDLIF_ARM_SHIFT, |
| 269 | 251 | }; |
| 270 | 252 | |
| 271 | −static struct clk arminth_ck1510 = { | |
| 272 | − .name = "arminth_ck", | |
| 273 | − .ops = &clkops_null, | |
| 274 | − .parent = &tc_ck.clk, | |
| 275 | − .recalc = &followparent_recalc, | |
| 253 | +static struct omap1_clk arminth_ck1510 = { | |
| 254 | + .hw.init = CLK_HW_INIT("arminth_ck", "tc_ck", &omap1_clk_null_ops, 0), | |
| 276 | 255 | /* Note: On 1510 the frequency follows TC_CK |
| 277 | 256 | * |
| 278 | 257 | * 16xx version is in MPU clocks. |
| 279 | 258 | */ |
| 280 | 259 | }; |
| 281 | 260 | |
| 282 | −static struct clk tipb_ck = { | |
| 261 | +static struct omap1_clk tipb_ck = { | |
| 283 | 262 | /* No-idle controlled by "tc_ck" */ |
| 284 | − .name = "tipb_ck", | |
| 285 | − .ops = &clkops_null, | |
| 286 | − .parent = &tc_ck.clk, | |
| 287 | − .recalc = &followparent_recalc, | |
| 263 | + .hw.init = CLK_HW_INIT("tipb_ck", "tc_ck", &omap1_clk_null_ops, 0), | |
| 288 | 264 | }; |
| 289 | 265 | |
| 290 | −static struct clk l3_ocpi_ck = { | |
| 266 | +static struct omap1_clk l3_ocpi_ck = { | |
| 291 | 267 | /* No-idle controlled by "tc_ck" */ |
| 292 | − .name = "l3_ocpi_ck", | |
| 268 | + .hw.init = CLK_HW_INIT("l3_ocpi_ck", "tc_ck", &omap1_clk_gate_ops, 0), | |
| 293 | 269 | .ops = &clkops_generic, |
| 294 | − .parent = &tc_ck.clk, | |
| 295 | 270 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT3), |
| 296 | 271 | .enable_bit = EN_OCPI_CK, |
| 297 | − .recalc = &followparent_recalc, | |
| 298 | 272 | }; |
| 299 | 273 | |
| 300 | −static struct clk tc1_ck = { | |
| 301 | − .name = "tc1_ck", | |
| 274 | +static struct omap1_clk tc1_ck = { | |
| 275 | + .hw.init = CLK_HW_INIT("tc1_ck", "tc_ck", &omap1_clk_gate_ops, 0), | |
| 302 | 276 | .ops = &clkops_generic, |
| 303 | − .parent = &tc_ck.clk, | |
| 304 | 277 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT3), |
| 305 | 278 | .enable_bit = EN_TC1_CK, |
| 306 | − .recalc = &followparent_recalc, | |
| 307 | 279 | }; |
| 308 | 280 | |
| 309 | 281 | /* |
| 310 | 282 | * FIXME: This clock seems to be necessary but no-one has asked for its |
| 311 | 283 | * activation. [ pm.c (SRAM), CCP, Camera ] |
| 312 | 284 | */ |
| 313 | −static struct clk tc2_ck = { | |
| 314 | − .name = "tc2_ck", | |
| 285 | + | |
| 286 | +static struct omap1_clk tc2_ck = { | |
| 287 | + .hw.init = CLK_HW_INIT("tc2_ck", "tc_ck", &omap1_clk_gate_ops, CLK_IS_CRITICAL), | |
| 315 | 288 | .ops = &clkops_generic, |
| 316 | − .parent = &tc_ck.clk, | |
| 317 | 289 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT3), |
| 318 | 290 | .enable_bit = EN_TC2_CK, |
| 319 | − .recalc = &followparent_recalc, | |
| 320 | 291 | }; |
| 321 | 292 | |
| 322 | −static struct clk dma_ck = { | |
| 293 | +static struct omap1_clk dma_ck = { | |
| 323 | 294 | /* No-idle controlled by "tc_ck" */ |
| 324 | − .name = "dma_ck", | |
| 325 | − .ops = &clkops_null, | |
| 326 | − .parent = &tc_ck.clk, | |
| 327 | − .recalc = &followparent_recalc, | |
| 295 | + .hw.init = CLK_HW_INIT("dma_ck", "tc_ck", &omap1_clk_null_ops, 0), | |
| 328 | 296 | }; |
| 329 | 297 | |
| 330 | −static struct clk dma_lcdfree_ck = { | |
| 331 | − .name = "dma_lcdfree_ck", | |
| 332 | − .ops = &clkops_null, | |
| 333 | − .parent = &tc_ck.clk, | |
| 334 | − .recalc = &followparent_recalc, | |
| 298 | +static struct omap1_clk dma_lcdfree_ck = { | |
| 299 | + .hw.init = CLK_HW_INIT("dma_lcdfree_ck", "tc_ck", &omap1_clk_null_ops, 0), | |
| 335 | 300 | }; |
| 336 | 301 | |
| 337 | 302 | static struct arm_idlect1_clk api_ck = { |
| 338 | 303 | .clk = { |
| 339 | − .name = "api_ck", | |
| 304 | + .hw.init = CLK_HW_INIT("api_ck", "tc_ck", &omap1_clk_gate_ops, 0), | |
| 340 | 305 | .ops = &clkops_generic, |
| 341 | − .parent = &tc_ck.clk, | |
| 342 | 306 | .flags = CLOCK_IDLE_CONTROL, |
| 343 | 307 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), |
| 344 | 308 | .enable_bit = EN_APICK, |
| 345 | − .recalc = &followparent_recalc, | |
| 346 | 309 | }, |
| 347 | 310 | .idlect_shift = IDLAPI_ARM_SHIFT, |
| 348 | 311 | }; |
| 349 | 312 | |
| 350 | 313 | static struct arm_idlect1_clk lb_ck = { |
| 351 | 314 | .clk = { |
| 352 | − .name = "lb_ck", | |
| 315 | + .hw.init = CLK_HW_INIT("lb_ck", "tc_ck", &omap1_clk_gate_ops, 0), | |
| 353 | 316 | .ops = &clkops_generic, |
| 354 | − .parent = &tc_ck.clk, | |
| 355 | 317 | .flags = CLOCK_IDLE_CONTROL, |
| 356 | 318 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), |
| 357 | 319 | .enable_bit = EN_LBCK, |
| 358 | − .recalc = &followparent_recalc, | |
| 359 | 320 | }, |
| 360 | 321 | .idlect_shift = IDLLB_ARM_SHIFT, |
| 361 | 322 | }; |
| 362 | 323 | |
| 363 | −static struct clk rhea1_ck = { | |
| 364 | − .name = "rhea1_ck", | |
| 365 | − .ops = &clkops_null, | |
| 366 | − .parent = &tc_ck.clk, | |
| 367 | − .recalc = &followparent_recalc, | |
| 324 | +static struct omap1_clk rhea1_ck = { | |
| 325 | + .hw.init = CLK_HW_INIT("rhea1_ck", "tc_ck", &omap1_clk_null_ops, 0), | |
| 368 | 326 | }; |
| 369 | 327 | |
| 370 | −static struct clk rhea2_ck = { | |
| 371 | − .name = "rhea2_ck", | |
| 372 | − .ops = &clkops_null, | |
| 373 | − .parent = &tc_ck.clk, | |
| 374 | − .recalc = &followparent_recalc, | |
| 328 | +static struct omap1_clk rhea2_ck = { | |
| 329 | + .hw.init = CLK_HW_INIT("rhea2_ck", "tc_ck", &omap1_clk_null_ops, 0), | |
| 375 | 330 | }; |
| 376 | 331 | |
| 377 | −static struct clk lcd_ck_16xx = { | |
| 378 | − .name = "lcd_ck", | |
| 332 | +static struct omap1_clk lcd_ck_16xx = { | |
| 333 | + .hw.init = CLK_HW_INIT("lcd_ck", "ck_dpll1", &omap1_clk_full_ops, 0), | |
| 379 | 334 | .ops = &clkops_generic, |
| 380 | − .parent = &ck_dpll1, | |
| 381 | 335 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), |
| 382 | 336 | .enable_bit = EN_LCDCK, |
| 383 | 337 | .rate_offset = CKCTL_LCDDIV_OFFSET, |
| @@ -388,9 +342,8 @@ static struct clk lcd_ck_16xx = { · 4 unmodified lines | ||
| 388 | 342 | |
| 389 | 343 | static struct arm_idlect1_clk lcd_ck_1510 = { |
| 390 | 344 | .clk = { |
| 391 | − .name = "lcd_ck", | |
| 345 | + .hw.init = CLK_HW_INIT("lcd_ck", "ck_dpll1", &omap1_clk_full_ops, 0), | |
| 392 | 346 | .ops = &clkops_generic, |
| 393 | − .parent = &ck_dpll1, | |
| 394 | 347 | .flags = CLOCK_IDLE_CONTROL, |
| 395 | 348 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), |
| 396 | 349 | .enable_bit = EN_LCDCK, |
| @@ -402,37 +355,35 @@ static struct arm_idlect1_clk lcd_ck_1510 = { · 5 unmodified lines | ||
| 402 | 355 | .idlect_shift = OMAP1510_IDLLCD_ARM_SHIFT, |
| 403 | 356 | }; |
| 404 | 357 | |
| 358 | + | |
| 405 | 359 | /* |
| 406 | 360 | * XXX The enable_bit here is misused - it simply switches between 12MHz |
| 407 | − * and 48MHz. Reimplement with clksel. | |
| 361 | + * and 48MHz. Reimplement with clk_mux. | |
| 408 | 362 | * |
| 409 | 363 | * XXX does this need SYSC register handling? |
| 410 | 364 | */ |
| 411 | −static struct clk uart1_1510 = { | |
| 412 | − .name = "uart1_ck", | |
| 413 | − .ops = &clkops_null, | |
| 365 | +static struct omap1_clk uart1_1510 = { | |
| 414 | 366 | /* Direct from ULPD, no real parent */ |
| 415 | − .parent = &armper_ck.clk, | |
| 416 | − .rate = 12000000, | |
| 367 | + .hw.init = CLK_HW_INIT("uart1_ck", "armper_ck", &omap1_clk_full_ops, 0), | |
| 417 | 368 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, |
| 418 | 369 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), |
| 419 | 370 | .enable_bit = CONF_MOD_UART1_CLK_MODE_R, |
| 371 | + .round_rate = &omap1_round_uart_rate, | |
| 420 | 372 | .set_rate = &omap1_set_uart_rate, |
| 421 | 373 | .recalc = &omap1_uart_recalc, |
| 422 | 374 | }; |
| 423 | 375 | |
| 424 | 376 | /* |
| 425 | 377 | * XXX The enable_bit here is misused - it simply switches between 12MHz |
| 426 | − * and 48MHz. Reimplement with clksel. | |
| 378 | + * and 48MHz. Reimplement with clk_mux. | |
| 427 | 379 | * |
| 428 | 380 | * XXX SYSC register handling does not belong in the clock framework |
| 429 | 381 | */ |
| 430 | 382 | static struct uart_clk uart1_16xx = { |
| 431 | 383 | .clk = { |
| 432 | − .name = "uart1_ck", | |
| 433 | 384 | .ops = &clkops_uart_16xx, |
| 434 | 385 | /* Direct from ULPD, no real parent */ |
| 435 | − .parent = &armper_ck.clk, | |
| 386 | + .hw.init = CLK_HW_INIT("uart1_ck", "armper_ck", &omap1_clk_full_ops, 0), | |
| 436 | 387 | .rate = 48000000, |
| 437 | 388 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, |
| 438 | 389 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), |
| @@ -443,54 +394,49 @@ static struct uart_clk uart1_16xx = { · 4 unmodified lines | ||
| 443 | 394 | |
| 444 | 395 | /* |
| 445 | 396 | * XXX The enable_bit here is misused - it simply switches between 12MHz |
| 446 | − * and 48MHz. Reimplement with clksel. | |
| 397 | + * and 48MHz. Reimplement with clk_mux. | |
| 447 | 398 | * |
| 448 | 399 | * XXX does this need SYSC register handling? |
| 449 | 400 | */ |
| 450 | −static struct clk uart2_ck = { | |
| 451 | − .name = "uart2_ck", | |
| 452 | − .ops = &clkops_null, | |
| 401 | +static struct omap1_clk uart2_ck = { | |
| 453 | 402 | /* Direct from ULPD, no real parent */ |
| 454 | − .parent = &armper_ck.clk, | |
| 455 | − .rate = 12000000, | |
| 403 | + .hw.init = CLK_HW_INIT("uart2_ck", "armper_ck", &omap1_clk_full_ops, 0), | |
| 456 | 404 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, |
| 457 | 405 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), |
| 458 | 406 | .enable_bit = CONF_MOD_UART2_CLK_MODE_R, |
| 407 | + .round_rate = &omap1_round_uart_rate, | |
| 459 | 408 | .set_rate = &omap1_set_uart_rate, |
| 460 | 409 | .recalc = &omap1_uart_recalc, |
| 461 | 410 | }; |
| 462 | 411 | |
| 463 | 412 | /* |
| 464 | 413 | * XXX The enable_bit here is misused - it simply switches between 12MHz |
| 465 | − * and 48MHz. Reimplement with clksel. | |
| 414 | + * and 48MHz. Reimplement with clk_mux. | |
| 466 | 415 | * |
| 467 | 416 | * XXX does this need SYSC register handling? |
| 468 | 417 | */ |
| 469 | −static struct clk uart3_1510 = { | |
| 470 | − .name = "uart3_ck", | |
| 471 | − .ops = &clkops_null, | |
| 418 | +static struct omap1_clk uart3_1510 = { | |
| 472 | 419 | /* Direct from ULPD, no real parent */ |
| 473 | − .parent = &armper_ck.clk, | |
| 474 | − .rate = 12000000, | |
| 420 | + .hw.init = CLK_HW_INIT("uart3_ck", "armper_ck", &omap1_clk_full_ops, 0), | |
| 475 | 421 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, |
| 476 | 422 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), |
| 477 | 423 | .enable_bit = CONF_MOD_UART3_CLK_MODE_R, |
| 424 | + .round_rate = &omap1_round_uart_rate, | |
| 478 | 425 | .set_rate = &omap1_set_uart_rate, |
| 479 | 426 | .recalc = &omap1_uart_recalc, |
| 480 | 427 | }; |
| 481 | 428 | |
| 482 | 429 | /* |
| 483 | 430 | * XXX The enable_bit here is misused - it simply switches between 12MHz |
| 484 | − * and 48MHz. Reimplement with clksel. | |
| 431 | + * and 48MHz. Reimplement with clk_mux. | |
| 485 | 432 | * |
| 486 | 433 | * XXX SYSC register handling does not belong in the clock framework |
| 487 | 434 | */ |
| 488 | 435 | static struct uart_clk uart3_16xx = { |
| 489 | 436 | .clk = { |
| 490 | − .name = "uart3_ck", | |
| 491 | 437 | .ops = &clkops_uart_16xx, |
| 492 | 438 | /* Direct from ULPD, no real parent */ |
| 493 | − .parent = &armper_ck.clk, | |
| 439 | + .hw.init = CLK_HW_INIT("uart3_ck", "armper_ck", &omap1_clk_full_ops, 0), | |
| 494 | 440 | .rate = 48000000, |
| 495 | 441 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, |
| 496 | 442 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), |
| @@ -499,30 +445,30 @@ static struct uart_clk uart3_16xx = { · 2 unmodified lines | ||
| 499 | 445 | .sysc_addr = 0xfffb9854, |
| 500 | 446 | }; |
| 501 | 447 | |
| 502 | −static struct clk usb_clko = { /* 6 MHz output on W4_USB_CLKO */ | |
| 503 | − .name = "usb_clko", | |
| 448 | +static struct omap1_clk usb_clko = { /* 6 MHz output on W4_USB_CLKO */ | |
| 504 | 449 | .ops = &clkops_generic, |
| 505 | 450 | /* Direct from ULPD, no parent */ |
| 451 | + .hw.init = CLK_HW_INIT_NO_PARENT("usb_clko", &omap1_clk_full_ops, 0), | |
| 506 | 452 | .rate = 6000000, |
| 507 | 453 | .flags = ENABLE_REG_32BIT, |
| 508 | 454 | .enable_reg = OMAP1_IO_ADDRESS(ULPD_CLOCK_CTRL), |
| 509 | 455 | .enable_bit = USB_MCLK_EN_BIT, |
| 510 | 456 | }; |
| 511 | 457 | |
| 512 | −static struct clk usb_hhc_ck1510 = { | |
| 513 | − .name = "usb_hhc_ck", | |
| 458 | +static struct omap1_clk usb_hhc_ck1510 = { | |
| 514 | 459 | .ops = &clkops_generic, |
| 515 | 460 | /* Direct from ULPD, no parent */ |
| 461 | + .hw.init = CLK_HW_INIT_NO_PARENT("usb_hhc_ck", &omap1_clk_full_ops, 0), | |
| 516 | 462 | .rate = 48000000, /* Actually 2 clocks, 12MHz and 48MHz */ |
| 517 | 463 | .flags = ENABLE_REG_32BIT, |
| 518 | 464 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), |
| 519 | 465 | .enable_bit = USB_HOST_HHC_UHOST_EN, |
| 520 | 466 | }; |
| 521 | 467 | |
| 522 | −static struct clk usb_hhc_ck16xx = { | |
| 523 | − .name = "usb_hhc_ck", | |
| 468 | +static struct omap1_clk usb_hhc_ck16xx = { | |
| 524 | 469 | .ops = &clkops_generic, |
| 525 | 470 | /* Direct from ULPD, no parent */ |
| 471 | + .hw.init = CLK_HW_INIT_NO_PARENT("usb_hhc_ck", &omap1_clk_full_ops, 0), | |
| 526 | 472 | .rate = 48000000, |
| 527 | 473 | /* OTG_SYSCON_2.OTG_PADEN == 0 (not 1510-compatible) */ |
| 528 | 474 | .flags = ENABLE_REG_32BIT, |
| @@ -530,46 +476,46 @@ static struct clk usb_hhc_ck16xx = { · 1 unmodified line | ||
| 530 | 476 | .enable_bit = OTG_SYSCON_2_UHOST_EN_SHIFT |
| 531 | 477 | }; |
| 532 | 478 | |
| 533 | −static struct clk usb_dc_ck = { | |
| 534 | − .name = "usb_dc_ck", | |
| 479 | +static struct omap1_clk usb_dc_ck = { | |
| 535 | 480 | .ops = &clkops_generic, |
| 536 | 481 | /* Direct from ULPD, no parent */ |
| 482 | + .hw.init = CLK_HW_INIT_NO_PARENT("usb_dc_ck", &omap1_clk_full_ops, 0), | |
| 537 | 483 | .rate = 48000000, |
| 538 | 484 | .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG), |
| 539 | 485 | .enable_bit = SOFT_USB_OTG_DPLL_REQ_SHIFT, |
| 540 | 486 | }; |
| 541 | 487 | |
| 542 | −static struct clk uart1_7xx = { | |
| 543 | − .name = "uart1_ck", | |
| 488 | +static struct omap1_clk uart1_7xx = { | |
| 544 | 489 | .ops = &clkops_generic, |
| 545 | 490 | /* Direct from ULPD, no parent */ |
| 491 | + .hw.init = CLK_HW_INIT_NO_PARENT("uart1_ck", &omap1_clk_full_ops, 0), | |
| 546 | 492 | .rate = 12000000, |
| 547 | 493 | .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG), |
| 548 | 494 | .enable_bit = 9, |
| 549 | 495 | }; |
| 550 | 496 | |
| 551 | −static struct clk uart2_7xx = { | |
| 552 | − .name = "uart2_ck", | |
| 497 | +static struct omap1_clk uart2_7xx = { | |
| 553 | 498 | .ops = &clkops_generic, |
| 554 | 499 | /* Direct from ULPD, no parent */ |
| 500 | + .hw.init = CLK_HW_INIT_NO_PARENT("uart2_ck", &omap1_clk_full_ops, 0), | |
| 555 | 501 | .rate = 12000000, |
| 556 | 502 | .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG), |
| 557 | 503 | .enable_bit = 11, |
| 558 | 504 | }; |
| 559 | 505 | |
| 560 | −static struct clk mclk_1510 = { | |
| 561 | − .name = "mclk", | |
| 506 | +static struct omap1_clk mclk_1510 = { | |
| 562 | 507 | .ops = &clkops_generic, |
| 563 | 508 | /* Direct from ULPD, no parent. May be enabled by ext hardware. */ |
| 509 | + .hw.init = CLK_HW_INIT_NO_PARENT("mclk", &omap1_clk_full_ops, 0), | |
| 564 | 510 | .rate = 12000000, |
| 565 | 511 | .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG), |
| 566 | 512 | .enable_bit = SOFT_COM_MCKO_REQ_SHIFT, |
| 567 | 513 | }; |
| 568 | 514 | |
| 569 | −static struct clk mclk_16xx = { | |
| 570 | − .name = "mclk", | |
| 515 | +static struct omap1_clk mclk_16xx = { | |
| 571 | 516 | .ops = &clkops_generic, |
| 572 | 517 | /* Direct from ULPD, no parent. May be enabled by ext hardware. */ |
| 518 | + .hw.init = CLK_HW_INIT_NO_PARENT("mclk", &omap1_clk_full_ops, 0), | |
| 573 | 519 | .enable_reg = OMAP1_IO_ADDRESS(COM_CLK_DIV_CTRL_SEL), |
| 574 | 520 | .enable_bit = COM_ULPD_PLL_CLK_REQ, |
| 575 | 521 | .set_rate = &omap1_set_ext_clk_rate, |
| @@ -577,17 +523,16 @@ static struct clk mclk_16xx = { · 1 unmodified line | ||
| 577 | 523 | .init = &omap1_init_ext_clk, |
| 578 | 524 | }; |
| 579 | 525 | |
| 580 | −static struct clk bclk_1510 = { | |
| 581 | − .name = "bclk", | |
| 582 | − .ops = &clkops_generic, | |
| 526 | +static struct omap1_clk bclk_1510 = { | |
| 583 | 527 | /* Direct from ULPD, no parent. May be enabled by ext hardware. */ |
| 528 | + .hw.init = CLK_HW_INIT_NO_PARENT("bclk", &omap1_clk_rate_ops, 0), | |
| 584 | 529 | .rate = 12000000, |
| 585 | 530 | }; |
| 586 | 531 | |
| 587 | −static struct clk bclk_16xx = { | |
| 588 | − .name = "bclk", | |
| 532 | +static struct omap1_clk bclk_16xx = { | |
| 589 | 533 | .ops = &clkops_generic, |
| 590 | 534 | /* Direct from ULPD, no parent. May be enabled by ext hardware. */ |
| 535 | + .hw.init = CLK_HW_INIT_NO_PARENT("bclk", &omap1_clk_full_ops, 0), | |
| 591 | 536 | .enable_reg = OMAP1_IO_ADDRESS(SWD_CLK_DIV_CTRL_SEL), |
| 592 | 537 | .enable_bit = SWD_ULPD_PLL_CLK_REQ, |
| 593 | 538 | .set_rate = &omap1_set_ext_clk_rate, |
| @@ -595,11 +540,10 @@ static struct clk bclk_16xx = { · 1 unmodified line | ||
| 595 | 540 | .init = &omap1_init_ext_clk, |
| 596 | 541 | }; |
| 597 | 542 | |
| 598 | −static struct clk mmc1_ck = { | |
| 599 | − .name = "mmc1_ck", | |
| 543 | +static struct omap1_clk mmc1_ck = { | |
| 600 | 544 | .ops = &clkops_generic, |
| 601 | 545 | /* Functional clock is direct from ULPD, interface clock is ARMPER */ |
| 602 | − .parent = &armper_ck.clk, | |
| 546 | + .hw.init = CLK_HW_INIT("mmc1_ck", "armper_ck", &omap1_clk_full_ops, 0), | |
| 603 | 547 | .rate = 48000000, |
| 604 | 548 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, |
| 605 | 549 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), |
| @@ -610,32 +554,29 @@ static struct clk mmc1_ck = { · 4 unmodified lines | ||
| 610 | 554 | * XXX MOD_CONF_CTRL_0 bit 20 is defined in the 1510 TRM as |
| 611 | 555 | * CONF_MOD_MCBSP3_AUXON ?? |
| 612 | 556 | */ |
| 613 | −static struct clk mmc2_ck = { | |
| 614 | − .name = "mmc2_ck", | |
| 557 | +static struct omap1_clk mmc2_ck = { | |
| 615 | 558 | .ops = &clkops_generic, |
| 616 | 559 | /* Functional clock is direct from ULPD, interface clock is ARMPER */ |
| 617 | − .parent = &armper_ck.clk, | |
| 560 | + .hw.init = CLK_HW_INIT("mmc2_ck", "armper_ck", &omap1_clk_full_ops, 0), | |
| 618 | 561 | .rate = 48000000, |
| 619 | 562 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, |
| 620 | 563 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), |
| 621 | 564 | .enable_bit = 20, |
| 622 | 565 | }; |
| 623 | 566 | |
| 624 | −static struct clk mmc3_ck = { | |
| 625 | − .name = "mmc3_ck", | |
| 567 | +static struct omap1_clk mmc3_ck = { | |
| 626 | 568 | .ops = &clkops_generic, |
| 627 | 569 | /* Functional clock is direct from ULPD, interface clock is ARMPER */ |
| 628 | − .parent = &armper_ck.clk, | |
| 570 | + .hw.init = CLK_HW_INIT("mmc3_ck", "armper_ck", &omap1_clk_full_ops, 0), | |
| 629 | 571 | .rate = 48000000, |
| 630 | 572 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, |
| 631 | 573 | .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG), |
| 632 | 574 | .enable_bit = SOFT_MMC_DPLL_REQ_SHIFT, |
| 633 | 575 | }; |
| 634 | 576 | |
| 635 | −static struct clk virtual_ck_mpu = { | |
| 636 | − .name = "mpu", | |
| 637 | − .ops = &clkops_null, | |
| 638 | − .parent = &arm_ck, /* Is smarter alias for */ | |
| 577 | +static struct omap1_clk virtual_ck_mpu = { | |
| 578 | + /* Is smarter alias for arm_ck */ | |
| 579 | + .hw.init = CLK_HW_INIT("mpu", "arm_ck", &omap1_clk_rate_ops, 0), | |
| 639 | 580 | .recalc = &followparent_recalc, |
| 640 | 581 | .set_rate = &omap1_select_table_rate, |
| 641 | 582 | .round_rate = &omap1_round_to_table_rate, |
| @@ -643,20 +584,14 @@ static struct clk virtual_ck_mpu = { · 1 unmodified line | ||
| 643 | 584 | |
| 644 | 585 | /* virtual functional clock domain for I2C. Just for making sure that ARMXOR_CK |
| 645 | 586 | remains active during MPU idle whenever this is enabled */ |
| 646 | −static struct clk i2c_fck = { | |
| 647 | − .name = "i2c_fck", | |
| 648 | − .ops = &clkops_null, | |
| 587 | +static struct omap1_clk i2c_fck = { | |
| 588 | + .hw.init = CLK_HW_INIT("i2c_fck", "armxor_ck", &omap1_clk_gate_ops, 0), | |
| 649 | 589 | .flags = CLOCK_NO_IDLE_PARENT, |
| 650 | − .parent = &armxor_ck.clk, | |
| 651 | − .recalc = &followparent_recalc, | |
| 652 | 590 | }; |
| 653 | 591 | |
| 654 | −static struct clk i2c_ick = { | |
| 655 | − .name = "i2c_ick", | |
| 656 | − .ops = &clkops_null, | |
| 592 | +static struct omap1_clk i2c_ick = { | |
| 593 | + .hw.init = CLK_HW_INIT("i2c_ick", "armper_ck", &omap1_clk_gate_ops, 0), | |
| 657 | 594 | .flags = CLOCK_NO_IDLE_PARENT, |
| 658 | − .parent = &armper_ck.clk, | |
| 659 | − .recalc = &followparent_recalc, | |
| 660 | 595 | }; |
| 661 | 596 | |
| 662 | 597 | /* |
| @@ -665,81 +600,81 @@ static struct clk i2c_ick = { · 2 unmodified lines | ||
| 665 | 600 | |
| 666 | 601 | static struct omap_clk omap_clks[] = { |
| 667 | 602 | /* non-ULPD clocks */ |
| 668 | − CLK(NULL, "ck_ref", &ck_ref, CK_16XX | CK_1510 | CK_310 | CK_7XX), | |
| 669 | − CLK(NULL, "ck_dpll1", &ck_dpll1, CK_16XX | CK_1510 | CK_310 | CK_7XX), | |
| 603 | + CLK(NULL, "ck_ref", &ck_ref.hw, CK_16XX | CK_1510 | CK_310 | CK_7XX), | |
| 604 | + CLK(NULL, "ck_dpll1", &ck_dpll1.hw, CK_16XX | CK_1510 | CK_310 | CK_7XX), | |
| 670 | 605 | /* CK_GEN1 clocks */ |
| 671 | − CLK(NULL, "ck_dpll1out", &ck_dpll1out.clk, CK_16XX), | |
| 672 | − CLK(NULL, "ck_sossi", &sossi_ck, CK_16XX), | |
| 673 | − CLK(NULL, "arm_ck", &arm_ck, CK_16XX | CK_1510 | CK_310), | |
| 674 | − CLK(NULL, "armper_ck", &armper_ck.clk, CK_16XX | CK_1510 | CK_310), | |
| 675 | − CLK("omap_gpio.0", "ick", &arm_gpio_ck, CK_1510 | CK_310), | |
| 676 | − CLK(NULL, "armxor_ck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX), | |
| 677 | − CLK(NULL, "armtim_ck", &armtim_ck.clk, CK_16XX | CK_1510 | CK_310), | |
| 678 | − CLK("omap_wdt", "fck", &armwdt_ck.clk, CK_16XX | CK_1510 | CK_310), | |
| 679 | − CLK("omap_wdt", "ick", &armper_ck.clk, CK_16XX), | |
| 680 | − CLK("omap_wdt", "ick", &dummy_ck, CK_1510 | CK_310), | |
| 681 | − CLK(NULL, "arminth_ck", &arminth_ck1510, CK_1510 | CK_310), | |
| 682 | − CLK(NULL, "arminth_ck", &arminth_ck16xx, CK_16XX), | |
| 606 | + CLK(NULL, "ck_dpll1out", &ck_dpll1out.clk.hw, CK_16XX), | |
| 607 | + CLK(NULL, "ck_sossi", &sossi_ck.hw, CK_16XX), | |
| 608 | + CLK(NULL, "arm_ck", &arm_ck.hw, CK_16XX | CK_1510 | CK_310), | |
| 609 | + CLK(NULL, "armper_ck", &armper_ck.clk.hw, CK_16XX | CK_1510 | CK_310), | |
| 610 | + CLK("omap_gpio.0", "ick", &arm_gpio_ck.hw, CK_1510 | CK_310), | |
| 611 | + CLK(NULL, "armxor_ck", &armxor_ck.clk.hw, CK_16XX | CK_1510 | CK_310 | CK_7XX), | |
| 612 | + CLK(NULL, "armtim_ck", &armtim_ck.clk.hw, CK_16XX | CK_1510 | CK_310), | |
| 613 | + CLK("omap_wdt", "fck", &armwdt_ck.clk.hw, CK_16XX | CK_1510 | CK_310), | |
| 614 | + CLK("omap_wdt", "ick", &armper_ck.clk.hw, CK_16XX), | |
| 615 | + CLK("omap_wdt", "ick", &dummy_ck.hw, CK_1510 | CK_310), | |
| 616 | + CLK(NULL, "arminth_ck", &arminth_ck1510.hw, CK_1510 | CK_310), | |
| 617 | + CLK(NULL, "arminth_ck", &arminth_ck16xx.hw, CK_16XX), | |
| 683 | 618 | /* CK_GEN2 clocks */ |
| 684 | − CLK(NULL, "dsp_ck", &dsp_ck, CK_16XX | CK_1510 | CK_310), | |
| 685 | − CLK(NULL, "dspmmu_ck", &dspmmu_ck, CK_16XX | CK_1510 | CK_310), | |
| 686 | − CLK(NULL, "dspper_ck", &dspper_ck, CK_16XX | CK_1510 | CK_310), | |
| 687 | − CLK(NULL, "dspxor_ck", &dspxor_ck, CK_16XX | CK_1510 | CK_310), | |
| 688 | − CLK(NULL, "dsptim_ck", &dsptim_ck, CK_16XX | CK_1510 | CK_310), | |
| 619 | + CLK(NULL, "dsp_ck", &dsp_ck.hw, CK_16XX | CK_1510 | CK_310), | |
| 620 | + CLK(NULL, "dspmmu_ck", &dspmmu_ck.hw, CK_16XX | CK_1510 | CK_310), | |
| 621 | + CLK(NULL, "dspper_ck", &dspper_ck.hw, CK_16XX | CK_1510 | CK_310), | |
| 622 | + CLK(NULL, "dspxor_ck", &dspxor_ck.hw, CK_16XX | CK_1510 | CK_310), | |
| 623 | + CLK(NULL, "dsptim_ck", &dsptim_ck.hw, CK_16XX | CK_1510 | CK_310), | |
| 689 | 624 | /* CK_GEN3 clocks */ |
| 690 | − CLK(NULL, "tc_ck", &tc_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX), | |
| 691 | − CLK(NULL, "tipb_ck", &tipb_ck, CK_1510 | CK_310), | |
| 692 | − CLK(NULL, "l3_ocpi_ck", &l3_ocpi_ck, CK_16XX | CK_7XX), | |
| 693 | − CLK(NULL, "tc1_ck", &tc1_ck, CK_16XX), | |
| 694 | − CLK(NULL, "tc2_ck", &tc2_ck, CK_16XX), | |
| 695 | − CLK(NULL, "dma_ck", &dma_ck, CK_16XX | CK_1510 | CK_310), | |
| 696 | − CLK(NULL, "dma_lcdfree_ck", &dma_lcdfree_ck, CK_16XX), | |
| 697 | − CLK(NULL, "api_ck", &api_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX), | |
| 698 | − CLK(NULL, "lb_ck", &lb_ck.clk, CK_1510 | CK_310), | |
| 699 | − CLK(NULL, "rhea1_ck", &rhea1_ck, CK_16XX), | |
| 700 | − CLK(NULL, "rhea2_ck", &rhea2_ck, CK_16XX), | |
| 701 | − CLK(NULL, "lcd_ck", &lcd_ck_16xx, CK_16XX | CK_7XX), | |
| 702 | − CLK(NULL, "lcd_ck", &lcd_ck_1510.clk, CK_1510 | CK_310), | |
| 625 | + CLK(NULL, "tc_ck", &tc_ck.clk.hw, CK_16XX | CK_1510 | CK_310 | CK_7XX), | |
| 626 | + CLK(NULL, "tipb_ck", &tipb_ck.hw, CK_1510 | CK_310), | |
| 627 | + CLK(NULL, "l3_ocpi_ck", &l3_ocpi_ck.hw, CK_16XX | CK_7XX), | |
| 628 | + CLK(NULL, "tc1_ck", &tc1_ck.hw, CK_16XX), | |
| 629 | + CLK(NULL, "tc2_ck", &tc2_ck.hw, CK_16XX), | |
| 630 | + CLK(NULL, "dma_ck", &dma_ck.hw, CK_16XX | CK_1510 | CK_310), | |
| 631 | + CLK(NULL, "dma_lcdfree_ck", &dma_lcdfree_ck.hw, CK_16XX), | |
| 632 | + CLK(NULL, "api_ck", &api_ck.clk.hw, CK_16XX | CK_1510 | CK_310 | CK_7XX), | |
| 633 | + CLK(NULL, "lb_ck", &lb_ck.clk.hw, CK_1510 | CK_310), | |
| 634 | + CLK(NULL, "rhea1_ck", &rhea1_ck.hw, CK_16XX), | |
| 635 | + CLK(NULL, "rhea2_ck", &rhea2_ck.hw, CK_16XX), | |
| 636 | + CLK(NULL, "lcd_ck", &lcd_ck_16xx.hw, CK_16XX | CK_7XX), | |
| 637 | + CLK(NULL, "lcd_ck", &lcd_ck_1510.clk.hw, CK_1510 | CK_310), | |
| 703 | 638 | /* ULPD clocks */ |
| 704 | − CLK(NULL, "uart1_ck", &uart1_1510, CK_1510 | CK_310), | |
| 705 | − CLK(NULL, "uart1_ck", &uart1_16xx.clk, CK_16XX), | |
| 706 | − CLK(NULL, "uart1_ck", &uart1_7xx, CK_7XX), | |
| 707 | − CLK(NULL, "uart2_ck", &uart2_ck, CK_16XX | CK_1510 | CK_310), | |
| 708 | − CLK(NULL, "uart2_ck", &uart2_7xx, CK_7XX), | |
| 709 | − CLK(NULL, "uart3_ck", &uart3_1510, CK_1510 | CK_310), | |
| 710 | − CLK(NULL, "uart3_ck", &uart3_16xx.clk, CK_16XX), | |
| 711 | − CLK(NULL, "usb_clko", &usb_clko, CK_16XX | CK_1510 | CK_310), | |
| 712 | − CLK(NULL, "usb_hhc_ck", &usb_hhc_ck1510, CK_1510 | CK_310), | |
| 713 | − CLK(NULL, "usb_hhc_ck", &usb_hhc_ck16xx, CK_16XX), | |
| 714 | − CLK(NULL, "usb_dc_ck", &usb_dc_ck, CK_16XX | CK_7XX), | |
| 715 | − CLK(NULL, "mclk", &mclk_1510, CK_1510 | CK_310), | |
| 716 | − CLK(NULL, "mclk", &mclk_16xx, CK_16XX), | |
| 717 | − CLK(NULL, "bclk", &bclk_1510, CK_1510 | CK_310), | |
| 718 | − CLK(NULL, "bclk", &bclk_16xx, CK_16XX), | |
| 719 | − CLK("mmci-omap.0", "fck", &mmc1_ck, CK_16XX | CK_1510 | CK_310), | |
| 720 | − CLK("mmci-omap.0", "fck", &mmc3_ck, CK_7XX), | |
| 721 | − CLK("mmci-omap.0", "ick", &armper_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX), | |
| 722 | − CLK("mmci-omap.1", "fck", &mmc2_ck, CK_16XX), | |
| 723 | − CLK("mmci-omap.1", "ick", &armper_ck.clk, CK_16XX), | |
| 639 | + CLK(NULL, "uart1_ck", &uart1_1510.hw, CK_1510 | CK_310), | |
| 640 | + CLK(NULL, "uart1_ck", &uart1_16xx.clk.hw, CK_16XX), | |
| 641 | + CLK(NULL, "uart1_ck", &uart1_7xx.hw, CK_7XX), | |
| 642 | + CLK(NULL, "uart2_ck", &uart2_ck.hw, CK_16XX | CK_1510 | CK_310), | |
| 643 | + CLK(NULL, "uart2_ck", &uart2_7xx.hw, CK_7XX), | |
| 644 | + CLK(NULL, "uart3_ck", &uart3_1510.hw, CK_1510 | CK_310), | |
| 645 | + CLK(NULL, "uart3_ck", &uart3_16xx.clk.hw, CK_16XX), | |
| 646 | + CLK(NULL, "usb_clko", &usb_clko.hw, CK_16XX | CK_1510 | CK_310), | |
| 647 | + CLK(NULL, "usb_hhc_ck", &usb_hhc_ck1510.hw, CK_1510 | CK_310), | |
| 648 | + CLK(NULL, "usb_hhc_ck", &usb_hhc_ck16xx.hw, CK_16XX), | |
| 649 | + CLK(NULL, "usb_dc_ck", &usb_dc_ck.hw, CK_16XX | CK_7XX), | |
| 650 | + CLK(NULL, "mclk", &mclk_1510.hw, CK_1510 | CK_310), | |
| 651 | + CLK(NULL, "mclk", &mclk_16xx.hw, CK_16XX), | |
| 652 | + CLK(NULL, "bclk", &bclk_1510.hw, CK_1510 | CK_310), | |
| 653 | + CLK(NULL, "bclk", &bclk_16xx.hw, CK_16XX), | |
| 654 | + CLK("mmci-omap.0", "fck", &mmc1_ck.hw, CK_16XX | CK_1510 | CK_310), | |
| 655 | + CLK("mmci-omap.0", "fck", &mmc3_ck.hw, CK_7XX), | |
| 656 | + CLK("mmci-omap.0", "ick", &armper_ck.clk.hw, CK_16XX | CK_1510 | CK_310 | CK_7XX), | |
| 657 | + CLK("mmci-omap.1", "fck", &mmc2_ck.hw, CK_16XX), | |
| 658 | + CLK("mmci-omap.1", "ick", &armper_ck.clk.hw, CK_16XX), | |
| 724 | 659 | /* Virtual clocks */ |
| 725 | − CLK(NULL, "mpu", &virtual_ck_mpu, CK_16XX | CK_1510 | CK_310), | |
| 726 | − CLK("omap_i2c.1", "fck", &i2c_fck, CK_16XX | CK_1510 | CK_310 | CK_7XX), | |
| 727 | − CLK("omap_i2c.1", "ick", &i2c_ick, CK_16XX), | |
| 728 | − CLK("omap_i2c.1", "ick", &dummy_ck, CK_1510 | CK_310 | CK_7XX), | |
| 729 | − CLK("omap1_spi100k.1", "fck", &dummy_ck, CK_7XX), | |
| 730 | − CLK("omap1_spi100k.1", "ick", &dummy_ck, CK_7XX), | |
| 731 | − CLK("omap1_spi100k.2", "fck", &dummy_ck, CK_7XX), | |
| 732 | − CLK("omap1_spi100k.2", "ick", &dummy_ck, CK_7XX), | |
| 733 | − CLK("omap_uwire", "fck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310), | |
| 734 | − CLK("omap-mcbsp.1", "ick", &dspper_ck, CK_16XX), | |
| 735 | − CLK("omap-mcbsp.1", "ick", &dummy_ck, CK_1510 | CK_310), | |
| 736 | − CLK("omap-mcbsp.2", "ick", &armper_ck.clk, CK_16XX), | |
| 737 | − CLK("omap-mcbsp.2", "ick", &dummy_ck, CK_1510 | CK_310), | |
| 738 | − CLK("omap-mcbsp.3", "ick", &dspper_ck, CK_16XX), | |
| 739 | − CLK("omap-mcbsp.3", "ick", &dummy_ck, CK_1510 | CK_310), | |
| 740 | − CLK("omap-mcbsp.1", "fck", &dspxor_ck, CK_16XX | CK_1510 | CK_310), | |
| 741 | − CLK("omap-mcbsp.2", "fck", &armper_ck.clk, CK_16XX | CK_1510 | CK_310), | |
| 742 | − CLK("omap-mcbsp.3", "fck", &dspxor_ck, CK_16XX | CK_1510 | CK_310), | |
| 660 | + CLK(NULL, "mpu", &virtual_ck_mpu.hw, CK_16XX | CK_1510 | CK_310), | |
| 661 | + CLK("omap_i2c.1", "fck", &i2c_fck.hw, CK_16XX | CK_1510 | CK_310 | CK_7XX), | |
| 662 | + CLK("omap_i2c.1", "ick", &i2c_ick.hw, CK_16XX), | |
| 663 | + CLK("omap_i2c.1", "ick", &dummy_ck.hw, CK_1510 | CK_310 | CK_7XX), | |
| 664 | + CLK("omap1_spi100k.1", "fck", &dummy_ck.hw, CK_7XX), | |
| 665 | + CLK("omap1_spi100k.1", "ick", &dummy_ck.hw, CK_7XX), | |
| 666 | + CLK("omap1_spi100k.2", "fck", &dummy_ck.hw, CK_7XX), | |
| 667 | + CLK("omap1_spi100k.2", "ick", &dummy_ck.hw, CK_7XX), | |
| 668 | + CLK("omap_uwire", "fck", &armxor_ck.clk.hw, CK_16XX | CK_1510 | CK_310), | |
| 669 | + CLK("omap-mcbsp.1", "ick", &dspper_ck.hw, CK_16XX), | |
| 670 | + CLK("omap-mcbsp.1", "ick", &dummy_ck.hw, CK_1510 | CK_310), | |
| 671 | + CLK("omap-mcbsp.2", "ick", &armper_ck.clk.hw, CK_16XX), | |
| 672 | + CLK("omap-mcbsp.2", "ick", &dummy_ck.hw, CK_1510 | CK_310), | |
| 673 | + CLK("omap-mcbsp.3", "ick", &dspper_ck.hw, CK_16XX), | |
| 674 | + CLK("omap-mcbsp.3", "ick", &dummy_ck.hw, CK_1510 | CK_310), | |
| 675 | + CLK("omap-mcbsp.1", "fck", &dspxor_ck.hw, CK_16XX | CK_1510 | CK_310), | |
| 676 | + CLK("omap-mcbsp.2", "fck", &armper_ck.clk.hw, CK_16XX | CK_1510 | CK_310), | |
| 677 | + CLK("omap-mcbsp.3", "fck", &dspxor_ck.hw, CK_16XX | CK_1510 | CK_310), | |
| 743 | 678 | }; |
| 744 | 679 | |
| 745 | 680 | /* |
| @@ -778,9 +713,6 @@ int __init omap1_clk_init(void) · 32 unmodified lines | ||
| 778 | 713 | /* By default all idlect1 clocks are allowed to idle */ |
| 779 | 714 | arm_idlect1_mask = ~0; |
| 780 | 715 | |
| 781 | − for (c = omap_clks; c < omap_clks + ARRAY_SIZE(omap_clks); c++) | |
| 782 | − clk_preinit(c->lk.clk); | |
| 783 | − | |
| 784 | 716 | cpu_mask = 0; |
| 785 | 717 | if (cpu_is_omap1710()) |
| 786 | 718 | cpu_mask |= CK_1710; |
| @@ -793,16 +725,10 @@ int __init omap1_clk_init(void) · 6 unmodified lines | ||
| 793 | 725 | if (cpu_is_omap310()) |
| 794 | 726 | cpu_mask |= CK_310; |
| 795 | 727 | |
| 796 | − for (c = omap_clks; c < omap_clks + ARRAY_SIZE(omap_clks); c++) | |
| 797 | − if (c->cpu & cpu_mask) { | |
| 798 | − clkdev_add(&c->lk); | |
| 799 | − clk_register(c->lk.clk); | |
| 800 | − } | |
| 801 | − | |
| 802 | 728 | /* Pointers to these clocks are needed by code in clock.c */ |
| 803 | − api_ck_p = clk_get(NULL, "api_ck"); | |
| 804 | − ck_dpll1_p = clk_get(NULL, "ck_dpll1"); | |
| 805 | − ck_ref_p = clk_get(NULL, "ck_ref"); | |
| 729 | + api_ck_p = &api_ck.clk; | |
| 730 | + ck_dpll1_p = &ck_dpll1; | |
| 731 | + ck_ref_p = &ck_ref; | |
| 806 | 732 | |
| 807 | 733 | if (cpu_is_omap7xx()) |
| 808 | 734 | ck_ref.rate = 13000000; |
| @@ -844,10 +770,7 @@ int __init omap1_clk_init(void) · 35 unmodified lines | ||
| 844 | 770 | } |
| 845 | 771 | } |
| 846 | 772 | } |
| 847 | − propagate_rate(&ck_dpll1); | |
| 848 | − /* Cache rates for clocks connected to ck_ref (not dpll1) */ | |
| 849 | − propagate_rate(&ck_ref); | |
| 850 | − omap1_show_rates(); | |
| 773 | + | |
| 851 | 774 | if (machine_is_omap_perseus2() || machine_is_omap_fsample()) { |
| 852 | 775 | /* Select slicer output as OMAP input clock */ |
| 853 | 776 | omap_writew(omap_readw(OMAP7XX_PCC_UPLD_CTRL) & ~0x1, |
| @@ -879,16 +802,28 @@ int __init omap1_clk_init(void) · 25 unmodified lines | ||
| 879 | 802 | */ |
| 880 | 803 | omap_writew(0x0000, ARM_IDLECT2); /* Turn LCD clock off also */ |
| 881 | 804 | |
| 882 | − /* | |
| 883 | − * Only enable those clocks we will need, let the drivers | |
| 884 | − * enable other clocks as necessary | |
| 885 | − */ | |
| 886 | − clk_enable(&armper_ck.clk); | |
| 887 | − clk_enable(&armxor_ck.clk); | |
| 888 | − clk_enable(&armtim_ck.clk); /* This should be done by timer code */ | |
| 805 | + for (c = omap_clks; c < omap_clks + ARRAY_SIZE(omap_clks); c++) { | |
| 806 | + if (!(c->cpu & cpu_mask)) | |
| 807 | + continue; | |
| 808 | + | |
| 809 | + if (c->lk.clk_hw->init) { /* NULL if provider already registered */ | |
| 810 | + const struct clk_init_data *init = c->lk.clk_hw->init; | |
| 811 | + const char *name = c->lk.clk_hw->init->name; | |
| 812 | + int err; | |
| 813 | + | |
| 814 | + err = clk_hw_register(NULL, c->lk.clk_hw); | |
| 815 | + if (err < 0) { | |
| 816 | + pr_err("failed to register clock \"%s\"! (%d)\n", name, err); | |
| 817 | + /* may be tried again, restore init data */ | |
| 818 | + c->lk.clk_hw->init = init; | |
| 819 | + continue; | |
| 820 | + } | |
| 821 | + } | |
| 822 | + | |
| 823 | + clk_hw_register_clkdev(c->lk.clk_hw, c->lk.con_id, c->lk.dev_id); | |
| 824 | + } | |
| 889 | 825 | |
| 890 | − if (cpu_is_omap15xx()) | |
| 891 | − clk_enable(&arm_gpio_ck); | |
| 826 | + omap1_show_rates(); | |
| 892 | 827 | |
| 893 | 828 | return 0; |
| 894 | 829 | } |
| @@ -900,7 +835,7 @@ void __init omap1_clk_late_init(void) · 5 unmodified lines | ||
| 900 | 835 | unsigned long rate = ck_dpll1.rate; |
| 901 | 836 | |
| 902 | 837 | /* Find the highest supported frequency and enable it */ |
| 903 | − if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) { | |
| 838 | + if (omap1_select_table_rate(&virtual_ck_mpu, ~0, arm_ck.rate)) { | |
| 904 | 839 | pr_err("System frequencies not set, using default. Check your config.\n"); |
| 905 | 840 | /* |
| 906 | 841 | * Reprogramming the DPLL is tricky, it must be done from SRAM. |
| @@ -64,7 +64,7 @@ static inline u32 omap_cs3_phys(void) · 63 unmodified lines | ||
| 64 | 64 | #define OMAP1_IO_OFFSET 0x00f00000 /* Virtual IO = 0xff0b0000 */ |
| 65 | 65 | #define OMAP1_IO_ADDRESS(pa) IOMEM((pa) - OMAP1_IO_OFFSET) |
| 66 | 66 | |
| 67 | −#include <mach/serial.h> | |
| 67 | +#include "serial.h" | |
| 68 | 68 | |
| 69 | 69 | /* |
| 70 | 70 | * --------------------------------------------------------------------------- |
| @@ -1,117 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * arch/arm/plat-omap/include/mach/uncompress.h | |
| 3 | − * | |
| 4 | − * Serial port stubs for kernel decompress status messages | |
| 5 | − * | |
| 6 | − * Initially based on: | |
| 7 | − * linux-2.4.15-rmk1-dsplinux1.6/arch/arm/plat-omap/include/mach1510/uncompress.h | |
| 8 | − * Copyright (C) 2000 RidgeRun, Inc. | |
| 9 | − * Author: Greg Lonnon <glonnon@ridgerun.com> | |
| 10 | − * | |
| 11 | − * Rewritten by: | |
| 12 | − * Author: <source@mvista.com> | |
| 13 | − * 2004 (c) MontaVista Software, Inc. | |
| 14 | − * | |
| 15 | − * This file is licensed under the terms of the GNU General Public License | |
| 16 | − * version 2. This program is licensed "as is" without any warranty of any | |
| 17 | − * kind, whether express or implied. | |
| 18 | − */ | |
| 19 | − | |
| 20 | −#include <linux/types.h> | |
| 21 | −#include <linux/serial_reg.h> | |
| 22 | − | |
| 23 | −#include <asm/memory.h> | |
| 24 | −#include <asm/mach-types.h> | |
| 25 | − | |
| 26 | −#include "serial.h" | |
| 27 | − | |
| 28 | −#define MDR1_MODE_MASK 0x07 | |
| 29 | − | |
| 30 | −volatile u8 *uart_base; | |
| 31 | −int uart_shift; | |
| 32 | − | |
| 33 | −/* | |
| 34 | − * Store the DEBUG_LL uart number into memory. | |
| 35 | − * See also debug-macro.S, and serial.c for related code. | |
| 36 | − */ | |
| 37 | −static void set_omap_uart_info(unsigned char port) | |
| 38 | −{ | |
| 39 | − /* | |
| 40 | − * Get address of some.bss variable and round it down | |
| 41 | − * a la CONFIG_AUTO_ZRELADDR. | |
| 42 | − */ | |
| 43 | − u32 ram_start = (u32)&uart_shift & 0xf8000000; | |
| 44 | − u32 *uart_info = (u32 *)(ram_start + OMAP_UART_INFO_OFS); | |
| 45 | − *uart_info = port; | |
| 46 | −} | |
| 47 | − | |
| 48 | −static inline void putc(int c) | |
| 49 | −{ | |
| 50 | − if (!uart_base) | |
| 51 | − return; | |
| 52 | − | |
| 53 | − /* Check for UART 16x mode */ | |
| 54 | − if ((uart_base[UART_OMAP_MDR1 << uart_shift] & MDR1_MODE_MASK) != 0) | |
| 55 | − return; | |
| 56 | − | |
| 57 | − while (!(uart_base[UART_LSR << uart_shift] & UART_LSR_THRE)) | |
| 58 | − barrier(); | |
| 59 | − uart_base[UART_TX << uart_shift] = c; | |
| 60 | −} | |
| 61 | − | |
| 62 | −static inline void flush(void) | |
| 63 | −{ | |
| 64 | −} | |
| 65 | − | |
| 66 | −/* | |
| 67 | − * Macros to configure UART1 and debug UART | |
| 68 | − */ | |
| 69 | −#define _DEBUG_LL_ENTRY(mach, dbg_uart, dbg_shft, dbg_id) \ | |
| 70 | − if (machine_is_##mach()) { \ | |
| 71 | − uart_base = (volatile u8 *)(dbg_uart); \ | |
| 72 | − uart_shift = (dbg_shft); \ | |
| 73 | − port = (dbg_id); \ | |
| 74 | − set_omap_uart_info(port); \ | |
| 75 | − break; \ | |
| 76 | − } | |
| 77 | − | |
| 78 | −#define DEBUG_LL_OMAP7XX(p, mach) \ | |
| 79 | − _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP7XX_PORT_SHIFT, \ | |
| 80 | − OMAP1UART##p) | |
| 81 | − | |
| 82 | −#define DEBUG_LL_OMAP1(p, mach) \ | |
| 83 | − _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP_PORT_SHIFT, \ | |
| 84 | − OMAP1UART##p) | |
| 85 | − | |
| 86 | −static inline void arch_decomp_setup(void) | |
| 87 | −{ | |
| 88 | − int port = 0; | |
| 89 | − | |
| 90 | − /* | |
| 91 | − * Initialize the port based on the machine ID from the bootloader. | |
| 92 | − * Note that we're using macros here instead of switch statement | |
| 93 | − * as machine_is functions are optimized out for the boards that | |
| 94 | − * are not selected. | |
| 95 | − */ | |
| 96 | − do { | |
| 97 | − /* omap7xx/8xx based boards using UART1 with shift 0 */ | |
| 98 | − DEBUG_LL_OMAP7XX(1, herald); | |
| 99 | − DEBUG_LL_OMAP7XX(1, omap_perseus2); | |
| 100 | − | |
| 101 | − /* omap15xx/16xx based boards using UART1 */ | |
| 102 | − DEBUG_LL_OMAP1(1, ams_delta); | |
| 103 | − DEBUG_LL_OMAP1(1, nokia770); | |
| 104 | − DEBUG_LL_OMAP1(1, omap_h2); | |
| 105 | − DEBUG_LL_OMAP1(1, omap_h3); | |
| 106 | − DEBUG_LL_OMAP1(1, omap_innovator); | |
| 107 | − DEBUG_LL_OMAP1(1, omap_osk); | |
| 108 | − DEBUG_LL_OMAP1(1, omap_palmte); | |
| 109 | − DEBUG_LL_OMAP1(1, omap_palmz71); | |
| 110 | − | |
| 111 | − /* omap15xx/16xx based boards using UART2 */ | |
| 112 | − DEBUG_LL_OMAP1(2, omap_palmtt); | |
| 113 | − | |
| 114 | − /* omap15xx/16xx based boards using UART3 */ | |
| 115 | − DEBUG_LL_OMAP1(3, sx1); | |
| 116 | − } while (0); | |
| 117 | −} | |
| @@ -15,10 +15,8 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <asm/mach/map.h> |
| 16 | 16 | |
| 17 | 17 | #include "tc.h" |
| 18 | −#include "mux.h" | |
| 19 | 18 | #include "iomap.h" |
| 20 | 19 | #include "common.h" |
| 21 | −#include "clock.h" | |
| 22 | 20 | |
| 23 | 21 | /* |
| 24 | 22 | * The machine specific code may provide the extra mapping besides the |
| @@ -125,11 +123,6 @@ void __init omap1_init_early(void) · 100 unmodified lines | ||
| 125 | 123 | */ |
| 126 | 124 | omap_writew(0x0, MPU_PUBLIC_TIPB_CNTL); |
| 127 | 125 | omap_writew(0x0, MPU_PRIVATE_TIPB_CNTL); |
| 128 | − | |
| 129 | − /* Must init clocks early to assure that timer interrupt works | |
| 130 | − */ | |
| 131 | − omap1_clk_init(); | |
| 132 | − omap1_mux_init(); | |
| 133 | 126 | } |
| 134 | 127 | |
| 135 | 128 | void __init omap1_init_late(void) |
| @@ -19,8 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | |
| 20 | 20 | #include <asm/mach-types.h> |
| 21 | 21 | |
| 22 | −#include <mach/serial.h> | |
| 23 | − | |
| 22 | +#include "serial.h" | |
| 24 | 23 | #include "mux.h" |
| 25 | 24 | #include "pm.h" |
| 26 | 25 | #include "soc.h" |
File renamed without changes.
| @@ -51,8 +51,10 @@ · 50 unmodified lines | ||
| 51 | 51 | #include <asm/mach/time.h> |
| 52 | 52 | |
| 53 | 53 | #include "hardware.h" |
| 54 | +#include "mux.h" | |
| 54 | 55 | #include "iomap.h" |
| 55 | 56 | #include "common.h" |
| 57 | +#include "clock.h" | |
| 56 | 58 | |
| 57 | 59 | #ifdef CONFIG_OMAP_MPU_TIMER |
| 58 | 60 | |
| @@ -224,6 +226,9 @@ static inline void omap_mpu_timer_init(void) · 165 unmodified lines | ||
| 224 | 226 | */ |
| 225 | 227 | void __init omap1_timer_init(void) |
| 226 | 228 | { |
| 229 | + omap1_clk_init(); | |
| 230 | + omap1_mux_init(); | |
| 231 | + | |
| 227 | 232 | if (omap_32k_timer_init() != 0) |
| 228 | 233 | omap_mpu_timer_init(); |
| 229 | 234 | } |