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 | help | 396 | help |
| 397 | Support for StrongARM 11x0 based boards. | 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 | endchoice | 399 | endchoice |
| 413 | 400 | ||
| 414 | menu "Multiple platform selection" | 401 | menu "Multiple platform selection" |
| @@ -17,6 +17,9 @@ CONFIG_MODULES=y · 16 unmodified lines | |||
| 17 | CONFIG_MODULE_UNLOAD=y | 17 | CONFIG_MODULE_UNLOAD=y |
| 18 | CONFIG_MODULE_FORCE_UNLOAD=y | 18 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 19 | # CONFIG_BLK_DEV_BSG is not set | 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 | CONFIG_ARCH_OMAP=y | 23 | CONFIG_ARCH_OMAP=y |
| 21 | CONFIG_ARCH_OMAP1=y | 24 | CONFIG_ARCH_OMAP1=y |
| 22 | CONFIG_OMAP_RESET_CLOCKS=y | 25 | CONFIG_OMAP_RESET_CLOCKS=y |
| @@ -1,4 +1,16 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | 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 | if ARCH_OMAP1 | 14 | if ARCH_OMAP1 |
| 3 | 15 | ||
| 4 | menu "TI OMAP1 specific features" | 16 | menu "TI OMAP1 specific features" |
| @@ -6,23 +18,27 @@ menu "TI OMAP1 specific features" · 1 unmodified line | |||
| 6 | comment "OMAP Core Type" | 18 | comment "OMAP Core Type" |
| 7 | 19 | ||
| 8 | config ARCH_OMAP730 | 20 | config ARCH_OMAP730 |
| 21 | depends on ARCH_MULTI_V5 | ||
| 9 | bool "OMAP730 Based System" | 22 | bool "OMAP730 Based System" |
| 10 | select ARCH_OMAP_OTG | 23 | select ARCH_OMAP_OTG |
| 11 | select CPU_ARM926T | 24 | select CPU_ARM926T |
| 12 | select OMAP_MPU_TIMER | 25 | select OMAP_MPU_TIMER |
| 13 | 26 | ||
| 14 | config ARCH_OMAP850 | 27 | config ARCH_OMAP850 |
| 28 | depends on ARCH_MULTI_V5 | ||
| 15 | bool "OMAP850 Based System" | 29 | bool "OMAP850 Based System" |
| 16 | select ARCH_OMAP_OTG | 30 | select ARCH_OMAP_OTG |
| 17 | select CPU_ARM926T | 31 | select CPU_ARM926T |
| 18 | 32 | ||
| 19 | config ARCH_OMAP15XX | 33 | config ARCH_OMAP15XX |
| 34 | depends on ARCH_MULTI_V4T | ||
| 20 | default y | 35 | default y |
| 21 | bool "OMAP15xx Based System" | 36 | bool "OMAP15xx Based System" |
| 22 | select CPU_ARM925T | 37 | select CPU_ARM925T |
| 23 | select OMAP_MPU_TIMER | 38 | select OMAP_MPU_TIMER |
| 24 | 39 | ||
| 25 | config ARCH_OMAP16XX | 40 | config ARCH_OMAP16XX |
| 41 | depends on ARCH_MULTI_V5 | ||
| 26 | bool "OMAP16xx Based System" | 42 | bool "OMAP16xx Based System" |
| 27 | select ARCH_OMAP_OTG | 43 | select ARCH_OMAP_OTG |
| 28 | select CPU_ARM926T | 44 | select CPU_ARM926T |
| @@ -16,7 +16,9 @@ · 15 unmodified lines | |||
| 16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
| 17 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
| 18 | #include <linux/clkdev.h> | 18 | #include <linux/clkdev.h> |
| 19 | #include <linux/clk-provider.h> | ||
| 19 | #include <linux/soc/ti/omap1-io.h> | 20 | #include <linux/soc/ti/omap1-io.h> |
| 21 | #include <linux/spinlock.h> | ||
| 20 | 22 | ||
| 21 | #include <asm/mach-types.h> | 23 | #include <asm/mach-types.h> |
| 22 | 24 | ||
| @@ -28,33 +30,37 @@ · 5 unmodified lines | |||
| 28 | #include "sram.h" | 30 | #include "sram.h" |
| 29 | 31 | ||
| 30 | __u32 arm_idlect1_mask; | 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); | 36 | /* protect registeres shared among clk_enable/disable() and clk_set_rate() operations */ |
| 34 | static DEFINE_MUTEX(clocks_mutex); | 37 | static DEFINE_SPINLOCK(arm_ckctl_lock); |
| 35 | static DEFINE_SPINLOCK(clockfw_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 | * Omap1 specific clock functions | 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 | unsigned int val = __raw_readl(clk->enable_reg); | 49 | unsigned int val = __raw_readl(clk->enable_reg); |
| 44 | return val & 1 << clk->enable_bit ? 48000000 : 12000000; | 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 | u32 div = omap_readl(MOD_CONF_CTRL_1); | 55 | u32 div = omap_readl(MOD_CONF_CTRL_1); |
| 50 | 56 | ||
| 51 | div = (div >> 17) & 0x7; | 57 | div = (div >> 17) & 0x7; |
| 52 | div++; | 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 | struct arm_idlect1_clk * iclk = (struct arm_idlect1_clk *)clk; | 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 | arm_idlect1_mask |= 1 << iclk->idlect_shift; | 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 | struct arm_idlect1_clk * iclk = (struct arm_idlect1_clk *)clk; | 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 | return newval; | 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 | /* Note: If target frequency is too low, this function will return 4, | 140 | /* Note: If target frequency is too low, this function will return 4, |
| 135 | * which is invalid value. Caller must check for this value and act | 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 | * DSP_CK >= TC_CK | 148 | * DSP_CK >= TC_CK |
| 143 | * DSPMMU_CK >= TC_CK | 149 | * DSPMMU_CK >= TC_CK |
| 144 | */ | 150 | */ |
| 145 | unsigned long realrate; | ||
| 146 | struct clk * parent; | ||
| 147 | unsigned dsor_exp; | 151 | unsigned dsor_exp; |
| 148 | 152 | ||
| 149 | parent = clk->parent; | 153 | if (unlikely(realrate == 0)) |
| 150 | if (unlikely(parent == NULL)) | ||
| 151 | return -EIO; | 154 | return -EIO; |
| 152 | 155 | ||
| 153 | realrate = parent->rate; | ||
| 154 | for (dsor_exp=0; dsor_exp<4; dsor_exp++) { | 156 | for (dsor_exp=0; dsor_exp<4; dsor_exp++) { |
| 155 | if (realrate <= rate) | 157 | if (realrate <= rate) |
| 156 | break; | 158 | break; |
| @@ -161,16 +163,50 @@ static int calc_dsor_exp(struct clk *clk, unsigned long rate) · 4 unmodified lines | |||
| 161 | return dsor_exp; | 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 | /* Calculate divisor encoded as 2-bit exponent */ | 168 | /* Calculate divisor encoded as 2-bit exponent */ |
| 167 | int dsor = 1 << (3 & (omap_readw(ARM_CKCTL) >> clk->rate_offset)); | 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 | int dsor; | 210 | int dsor; |
| 175 | 211 | ||
| 176 | /* Calculate divisor encoded as 2-bit exponent | 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 | * Note that DSP_CKCTL virt addr = phys addr, so | 216 | * Note that DSP_CKCTL virt addr = phys addr, so |
| 181 | * we must use __raw_readw() instead of omap_readw(). | 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 | dsor = 1 << (3 & (__raw_readw(DSP_CKCTL) >> clk->rate_offset)); | 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 | /* MPU virtual clock functions */ | 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 | /* Find the highest supported frequency <= rate and switch to it */ | 232 | /* Find the highest supported frequency <= rate and switch to it */ |
| 194 | struct mpu_rate * ptr; | 233 | struct mpu_rate * ptr; |
| @@ -223,12 +262,12 @@ int omap1_select_table_rate(struct clk *clk, unsigned long rate) · 28 unmodified lines | |||
| 223 | return 0; | 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 | int dsor_exp; | 267 | int dsor_exp; |
| 229 | u16 regval; | 268 | u16 regval; |
| 230 | 269 | ||
| 231 | dsor_exp = calc_dsor_exp(clk, rate); | 270 | dsor_exp = calc_dsor_exp(rate, p_rate); |
| 232 | if (dsor_exp > 3) | 271 | if (dsor_exp > 3) |
| 233 | dsor_exp = -EINVAL; | 272 | dsor_exp = -EINVAL; |
| 234 | if (dsor_exp < 0) | 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 | regval &= ~(3 << clk->rate_offset); | 277 | regval &= ~(3 << clk->rate_offset); |
| 239 | regval |= dsor_exp << clk->rate_offset; | 278 | regval |= dsor_exp << clk->rate_offset; |
| 240 | __raw_writew(regval, DSP_CKCTL); | 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 | return 0; | 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 | if (dsor_exp < 0) | 290 | if (dsor_exp < 0) |
| 250 | return dsor_exp; | 291 | return dsor_exp; |
| 251 | if (dsor_exp > 3) | 292 | if (dsor_exp > 3) |
| 252 | dsor_exp = 3; | 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 | int dsor_exp; | 300 | int dsor_exp; |
| 259 | u16 regval; | 301 | u16 regval; |
| 260 | 302 | ||
| 261 | dsor_exp = calc_dsor_exp(clk, rate); | 303 | dsor_exp = calc_dsor_exp(rate, p_rate); |
| 262 | if (dsor_exp > 3) | 304 | if (dsor_exp > 3) |
| 263 | dsor_exp = -EINVAL; | 305 | dsor_exp = -EINVAL; |
| 264 | if (dsor_exp < 0) | 306 | if (dsor_exp < 0) |
| 265 | return dsor_exp; | 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 | regval = omap_readw(ARM_CKCTL); | 312 | regval = omap_readw(ARM_CKCTL); |
| 268 | regval &= ~(3 << clk->rate_offset); | 313 | regval &= ~(3 << clk->rate_offset); |
| 269 | regval |= dsor_exp << clk->rate_offset; | 314 | regval |= dsor_exp << clk->rate_offset; |
| 270 | regval = verify_ckctl_value(regval); | 315 | regval = verify_ckctl_value(regval); |
| 271 | omap_writew(regval, ARM_CKCTL); | 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 | return 0; | 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 | /* Find the highest supported frequency <= rate */ | 326 | /* Find the highest supported frequency <= rate */ |
| 279 | struct mpu_rate * ptr; | 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 | /* XXX Only needed on 1510 */ | 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 | unsigned int val; | 383 | unsigned int val; |
| 330 | 384 | ||
| 331 | val = __raw_readl(clk->enable_reg); | ||
| 332 | if (rate == 12000000) | 385 | if (rate == 12000000) |
| 333 | val &= ~(1 << clk->enable_bit); | 386 | val = 0; |
| 334 | else if (rate == 48000000) | 387 | else if (rate == 48000000) |
| 335 | val |= (1 << clk->enable_bit); | 388 | val = 1 << clk->enable_bit; |
| 336 | else | 389 | else |
| 337 | return -EINVAL; | 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 | __raw_writel(val, clk->enable_reg); | 396 | __raw_writel(val, clk->enable_reg); |
| 397 | |||
| 398 | spin_unlock_irqrestore(&mod_conf_ctrl_0_lock, flags); | ||
| 399 | |||
| 339 | clk->rate = rate; | 400 | clk->rate = rate; |
| 340 | 401 | ||
| 341 | return 0; | 402 | return 0; |
| 342 | } | 403 | } |
| 343 | 404 | ||
| 344 | /* External clock (MCLK & BCLK) functions */ | 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 | unsigned dsor; | 409 | unsigned dsor; |
| 348 | __u16 ratio_bits; | 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 | else | 416 | else |
| 355 | ratio_bits = (dsor - 2) << 2; | 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 | ratio_bits |= __raw_readw(clk->enable_reg) & ~0xfd; | 422 | ratio_bits |= __raw_readw(clk->enable_reg) & ~0xfd; |
| 358 | __raw_writew(ratio_bits, clk->enable_reg); | 423 | __raw_writew(ratio_bits, clk->enable_reg); |
| 359 | 424 | ||
| 425 | spin_unlock_irqrestore(&swd_clk_div_ctrl_sel_lock, flags); | ||
| 426 | |||
| 360 | return 0; | 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 | int div; | 432 | int div; |
| 367 | unsigned long p_rate; | ||
| 368 | 433 | ||
| 369 | p_rate = clk->parent->rate; | ||
| 370 | /* Round towards slower frequency */ | 434 | /* Round towards slower frequency */ |
| 371 | div = (p_rate + rate - 1) / rate; | 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 | if (div < 0 || div > 7) | 460 | if (div < 0 || div > 7) |
| 374 | return -EINVAL; | 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 | l = omap_readl(MOD_CONF_CTRL_1); | 466 | l = omap_readl(MOD_CONF_CTRL_1); |
| 377 | l &= ~(7 << 17); | 467 | l &= ~(7 << 17); |
| 378 | l |= div << 17; | 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 | clk->rate = p_rate / (div + 1); | 471 | clk->rate = p_rate / (div + 1); |
| 382 | 472 | ||
| 473 | spin_unlock_irqrestore(&mod_conf_ctrl_1_lock, flags); | ||
| 474 | |||
| 383 | return 0; | 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 | return 96000000 / calc_ext_dsor(rate); | 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 | unsigned dsor; | 485 | unsigned dsor; |
| 394 | __u16 ratio_bits; | 486 | __u16 ratio_bits; |
| @@ -404,59 +496,59 @@ void omap1_init_ext_clk(struct clk *clk) · 9 unmodified lines | |||
| 404 | dsor = ratio_bits + 2; | 496 | dsor = ratio_bits + 2; |
| 405 | 497 | ||
| 406 | clk-> rate = 96000000 / dsor; | 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 | int ret = 0; | 506 | int ret = 0; |
| 412 | 507 | ||
| 413 | if (clk->usecount++ == 0) { | 508 | if (parent && clk->flags & CLOCK_NO_IDLE_PARENT) |
| 414 | if (clk->parent) { | 509 | omap1_clk_deny_idle(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 | } | ||
| 422 | 510 | ||
| 511 | if (clk->ops && !(WARN_ON(!clk->ops->enable))) | ||
| 423 | ret = clk->ops->enable(clk); | 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 | return ret; | 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 | clk->ops->disable(clk); | 522 | clk->ops->disable(clk); |
| 441 | if (likely(clk->parent)) { | 523 | |
| 442 | omap1_clk_disable(clk->parent); | 524 | if (likely(parent) && clk->flags & CLOCK_NO_IDLE_PARENT) |
| 443 | if (clk->flags & CLOCK_NO_IDLE_PARENT) | 525 | omap1_clk_allow_idle(parent); |
| 444 | omap1_clk_allow_idle(clk->parent); | ||
| 445 | } | ||
| 446 | } | ||
| 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 | __u16 regval16; | 531 | __u16 regval16; |
| 452 | __u32 regval32; | 532 | __u32 regval32; |
| 453 | 533 | ||
| 454 | if (unlikely(clk->enable_reg == NULL)) { | 534 | if (unlikely(clk->enable_reg == NULL)) { |
| 455 | printk(KERN_ERR "clock.c: Enable for %s without enable code\n", | 535 | printk(KERN_ERR "clock.c: Enable for %s without enable code\n", |
| 456 | clk->name); | 536 | clk_hw_get_name(&clk->hw)); |
| 457 | return -EINVAL; | 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 | if (clk->flags & ENABLE_REG_32BIT) { | 552 | if (clk->flags & ENABLE_REG_32BIT) { |
| 461 | regval32 = __raw_readl(clk->enable_reg); | 553 | regval32 = __raw_readl(clk->enable_reg); |
| 462 | regval32 |= (1 << clk->enable_bit); | 554 | regval32 |= (1 << clk->enable_bit); |
| @@ -467,17 +559,41 @@ static int omap1_clk_enable_generic(struct clk *clk) · 4 unmodified lines | |||
| 467 | __raw_writew(regval16, clk->enable_reg); | 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 | return 0; | 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 | __u16 regval16; | 579 | __u16 regval16; |
| 476 | __u32 regval32; | 580 | __u32 regval32; |
| 477 | 581 | ||
| 478 | if (clk->enable_reg == NULL) | 582 | if (clk->enable_reg == NULL) |
| 479 | return; | 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 | if (clk->flags & ENABLE_REG_32BIT) { | 597 | if (clk->flags & ENABLE_REG_32BIT) { |
| 482 | regval32 = __raw_readl(clk->enable_reg); | 598 | regval32 = __raw_readl(clk->enable_reg); |
| 483 | regval32 &= ~(1 << clk->enable_bit); | 599 | regval32 &= ~(1 << clk->enable_bit); |
| @@ -487,6 +603,17 @@ static void omap1_clk_disable_generic(struct clk *clk) · 3 unmodified lines | |||
| 487 | regval16 &= ~(1 << clk->enable_bit); | 603 | regval16 &= ~(1 << clk->enable_bit); |
| 488 | __raw_writew(regval16, clk->enable_reg); | 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 | const struct clkops clkops_generic = { | 619 | const struct clkops clkops_generic = { |
| @@ -494,25 +621,38 @@ const struct clkops clkops_generic = { · 1 unmodified line | |||
| 494 | .disable = omap1_clk_disable_generic, | 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 | if (!retval) { | 633 | if (!retval) { |
| 503 | retval = omap1_clk_enable_generic(clk); | 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 | return retval; | 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) { | 645 | bool api_ck_was_enabled; |
| 513 | omap1_clk_disable_generic(clk); | 646 | |
| 514 | omap1_clk_disable(api_ck_p); | 647 | api_ck_was_enabled = omap1_clk_is_enabled(&api_ck_p->hw); |
| 515 | } | 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 | const struct clkops clkops_dspck = { | 658 | const struct clkops clkops_dspck = { |
| @@ -521,7 +661,7 @@ const struct clkops clkops_dspck = { · 2 unmodified lines | |||
| 521 | }; | 661 | }; |
| 522 | 662 | ||
| 523 | /* XXX SYSC register handling does not belong in the clock framework */ | 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 | int ret; | 666 | int ret; |
| 527 | struct uart_clk *uclk; | 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 | /* XXX SYSC register handling does not belong in the clock framework */ | 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 | struct uart_clk *uclk; | 683 | struct uart_clk *uclk; |
| 544 | 684 | ||
| @@ -555,20 +695,33 @@ const struct clkops clkops_uart_16xx = { · 10 unmodified lines | |||
| 555 | .disable = omap1_clk_disable_uart_functional_16xx, | 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) | 700 | struct omap1_clk *clk = to_omap1_clk(hw); |
| 561 | return clk->round_rate(clk, rate); | 701 | |
| 702 | if (clk->recalc) | ||
| 703 | return clk->recalc(clk, p_rate); | ||
| 562 | 704 | ||
| 563 | return clk->rate; | 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 | int ret = -EINVAL; | 721 | int ret = -EINVAL; |
| 569 | 722 | ||
| 570 | if (clk->set_rate) | 723 | if (clk->set_rate) |
| 571 | ret = clk->set_rate(clk, rate); | 724 | ret = clk->set_rate(clk, rate, p_rate); |
| 572 | return ret; | 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 | * Omap1 clock reset and init functions | 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 | #ifdef CONFIG_OMAP_RESET_CLOCKS | 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 | /* Clocks in the DSP domain need api_ck. Just assume bootloader | 749 | /* Clocks in the DSP domain need api_ck. Just assume bootloader |
| 586 | * has not enabled any DSP clocks */ | 750 | * has not enabled any DSP clocks */ |
| 587 | if (clk->enable_reg == DSP_IDLECT2) { | 751 | if (clk->enable_reg == DSP_IDLECT2) { |
| 588 | pr_info("Skipping reset check for DSP domain clock \"%s\"\n", | 752 | pr_info("Skipping reset check for DSP domain clock \"%s\"\n", name); |
| 589 | clk->name); | ||
| 590 | return; | 753 | return; |
| 591 | } | 754 | } |
| 592 | 755 | ||
| 593 | /* Is the clock already disabled? */ | 756 | pr_info("Disabling unused clock \"%s\"... ", name); |
| 594 | if (clk->flags & ENABLE_REG_32BIT) | 757 | omap1_clk_disable(hw); |
| 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); | ||
| 604 | printk(" done\n"); | 758 | printk(" done\n"); |
| 605 | } | 759 | } |
| 606 | 760 | ||
| 607 | #endif | 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) | 772 | const struct clk_ops omap1_clk_rate_ops = { |
| 611 | { | 773 | .recalc_rate = omap1_clk_recalc_rate, |
| 612 | unsigned long flags; | 774 | .round_rate = omap1_clk_round_rate, |
| 613 | int ret; | 775 | .set_rate = omap1_clk_set_rate, |
| 614 | 776 | .init = omap1_clk_init_op, | |
| 615 | if (IS_ERR_OR_NULL(clk)) | 777 | }; |
| 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); | ||
| 709 | 778 | ||
| 710 | struct clk *clk_get_parent(struct clk *clk) | 779 | const struct clk_ops omap1_clk_full_ops = { |
| 711 | { | 780 | .enable = omap1_clk_enable, |
| 712 | return clk->parent; | 781 | .disable = omap1_clk_disable, |
| 713 | } | 782 | .is_enabled = omap1_clk_is_enabled, |
| 714 | EXPORT_SYMBOL(clk_get_parent); | 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 | * OMAP specific clock functions shared between omap1 and omap2 | 793 | * OMAP specific clock functions shared between omap1 and omap2 |
| 718 | */ | 794 | */ |
| 719 | 795 | ||
| 720 | /* Used for clocks that always have same value as the parent clock */ | 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 | * Used for clocks that have the same value as the parent clock, | 803 | * Used for clocks that have the same value as the parent clock, |
| 728 | * divided by some factor | 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 | WARN_ON(!clk->fixed_div); | 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 | /* Propagate rate to children */ | 813 | /* Propagate rate to children */ |
| 738 | void propagate_rate(struct clk *tclk) | 814 | void propagate_rate(struct omap1_clk *tclk) |
| 739 | { | 815 | { |
| 740 | struct clk *clkp; | 816 | struct clk *clkp; |
| 741 | 817 | ||
| 742 | list_for_each_entry(clkp, &tclk->children, sibling) { | 818 | /* depend on CCF ability to recalculate new rates across whole clock subtree */ |
| 743 | if (clkp->recalc) | 819 | if (WARN_ON(!(clk_hw_get_flags(&tclk->hw) & CLK_GET_RATE_NOCACHE))) |
| 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)) | ||
| 792 | return; | 820 | return; |
| 793 | 821 | ||
| 794 | mutex_lock(&clocks_mutex); | 822 | clkp = clk_get_sys(NULL, clk_hw_get_name(&tclk->hw)); |
| 795 | list_del(&clk->sibling); | 823 | if (WARN_ON(!clkp)) |
| 796 | list_del(&clk->node); | 824 | return; |
| 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 | } | ||
| 808 | 825 | ||
| 809 | static void clkll_disable_null(struct clk *clk) | 826 | clk_get_rate(clkp); |
| 810 | { | 827 | clk_put(clkp); |
| 811 | } | 828 | } |
| 812 | 829 | ||
| 813 | const struct clkops clkops_null = { | 830 | const struct clk_ops omap1_clk_null_ops = { |
| 814 | .enable = clkll_enable_null, | ||
| 815 | .disable = clkll_disable_null, | ||
| 816 | }; | 831 | }; |
| 817 | 832 | ||
| 818 | /* | 833 | /* |
| @@ -820,114 +835,6 @@ const struct clkops clkops_null = { · 1 unmodified line | |||
| 820 | * | 835 | * |
| 821 | * Used for clock aliases that are needed on some OMAPs, but not others | 836 | * Used for clock aliases that are needed on some OMAPs, but not others |
| 822 | */ | 837 | */ |
| 823 | struct clk dummy_ck = { | 838 | struct omap1_clk dummy_ck __refdata = { |
| 824 | .name = "dummy", | 839 | .hw.init = CLK_HW_INIT_NO_PARENT("dummy", &omap1_clk_null_ops, 0), |
| 825 | .ops = &clkops_null, | ||
| 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 | #define __ARCH_ARM_MACH_OMAP1_CLOCK_H | 11 | #define __ARCH_ARM_MACH_OMAP1_CLOCK_H |
| 12 | 12 | ||
| 13 | #include <linux/clk.h> | 13 | #include <linux/clk.h> |
| 14 | #include <linux/list.h> | ||
| 15 | |||
| 16 | #include <linux/clkdev.h> | 14 | #include <linux/clkdev.h> |
| 15 | #include <linux/clk-provider.h> | ||
| 17 | 16 | ||
| 18 | struct module; | 17 | struct module; |
| 19 | struct clk; | 18 | struct omap1_clk; |
| 20 | 19 | ||
| 21 | struct omap_clk { | 20 | struct omap_clk { |
| 22 | u16 cpu; | 21 | u16 cpu; |
| @@ -29,7 +28,7 @@ struct omap_clk { · 6 unmodified lines | |||
| 29 | .lk = { \ | 28 | .lk = { \ |
| 30 | .dev_id = dev, \ | 29 | .dev_id = dev, \ |
| 31 | .con_id = con, \ | 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 | #define CK_16XX (1 << 3) /* 16xx, 17xx, 5912 */ | 39 | #define CK_16XX (1 << 3) /* 16xx, 17xx, 5912 */ |
| 41 | #define CK_1710 (1 << 4) /* 1710 extra for rate selection */ | 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 | * struct clkops - some clock function pointers | 43 | * struct clkops - some clock function pointers |
| 49 | * @enable: fn ptr that enables the current clock in hardware | 44 | * @enable: fn ptr that enables the current clock in hardware |
| @@ -51,8 +46,8 @@ struct omap_clk { · 1 unmodified line | |||
| 51 | * @allow_idle: fn ptr that enables autoidle for the current clock in hardware | 46 | * @allow_idle: fn ptr that enables autoidle for the current clock in hardware |
| 52 | */ | 47 | */ |
| 53 | struct clkops { | 48 | struct clkops { |
| 54 | int (*enable)(struct clk *); | 49 | int (*enable)(struct omap1_clk *clk); |
| 55 | void (*disable)(struct clk *); | 50 | void (*disable)(struct omap1_clk *clk); |
| 56 | }; | 51 | }; |
| 57 | 52 | ||
| 58 | /* | 53 | /* |
| @@ -65,13 +60,9 @@ struct clkops { · 6 unmodified lines | |||
| 65 | #define CLOCK_NO_IDLE_PARENT (1 << 2) | 60 | #define CLOCK_NO_IDLE_PARENT (1 << 2) |
| 66 | 61 | ||
| 67 | /** | 62 | /** |
| 68 | * struct clk - OMAP struct clk | 63 | * struct omap1_clk - OMAP1 struct clk |
| 69 | * @node: list_head connecting this clock into the full clock list | 64 | * @hw: struct clk_hw for common clock framework integration |
| 70 | * @ops: struct clkops * for this clock | 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 | * @rate: current clock rate | 66 | * @rate: current clock rate |
| 76 | * @enable_reg: register to write to enable the clock (see @enable_bit) | 67 | * @enable_reg: register to write to enable the clock (see @enable_bit) |
| 77 | * @recalc: fn ptr that returns the clock's current rate | 68 | * @recalc: fn ptr that returns the clock's current rate |
| @@ -79,102 +70,65 @@ struct clkops { · 1 unmodified line | |||
| 79 | * @round_rate: fn ptr that can round the clock's current rate | 70 | * @round_rate: fn ptr that can round the clock's current rate |
| 80 | * @init: fn ptr to do clock-specific initialization | 71 | * @init: fn ptr to do clock-specific initialization |
| 81 | * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg) | 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 | * @fixed_div: when > 0, this clock's rate is its parent's rate / @fixed_div | 73 | * @fixed_div: when > 0, this clock's rate is its parent's rate / @fixed_div |
| 84 | * @flags: see "struct clk.flags possibilities" above | 74 | * @flags: see "struct clk.flags possibilities" above |
| 85 | * @rate_offset: bitshift for rate selection bitfield (OMAP1 only) | 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 { | 77 | struct omap1_clk { |
| 108 | struct list_head node; | 78 | struct clk_hw hw; |
| 109 | const struct clkops *ops; | 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 | unsigned long rate; | 80 | unsigned long rate; |
| 115 | void __iomem *enable_reg; | 81 | void __iomem *enable_reg; |
| 116 | unsigned long (*recalc)(struct clk *); | 82 | unsigned long (*recalc)(struct omap1_clk *clk, unsigned long rate); |
| 117 | int (*set_rate)(struct clk *, unsigned long); | 83 | int (*set_rate)(struct omap1_clk *clk, unsigned long rate, |
| 118 | long (*round_rate)(struct clk *, unsigned long); | 84 | unsigned long p_rate); |
| 119 | void (*init)(struct clk *); | 85 | long (*round_rate)(struct omap1_clk *clk, unsigned long rate, |
| 86 | unsigned long *p_rate); | ||
| 87 | int (*init)(struct omap1_clk *clk); | ||
| 120 | u8 enable_bit; | 88 | u8 enable_bit; |
| 121 | s8 usecount; | ||
| 122 | u8 fixed_div; | 89 | u8 fixed_div; |
| 123 | u8 flags; | 90 | u8 flags; |
| 124 | u8 rate_offset; | 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); | 95 | void propagate_rate(struct omap1_clk *clk); |
| 131 | extern int clk_register(struct clk *clk); | 96 | unsigned long followparent_recalc(struct omap1_clk *clk, unsigned long p_rate); |
| 132 | extern void clk_unregister(struct clk *clk); | 97 | unsigned long omap_fixed_divisor_recalc(struct omap1_clk *clk, unsigned long p_rate); |
| 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); | ||
| 136 | 98 | ||
| 137 | extern const struct clkops clkops_null; | 99 | extern struct omap1_clk dummy_ck; |
| 138 | |||
| 139 | extern struct clk dummy_ck; | ||
| 140 | 100 | ||
| 141 | int omap1_clk_init(void); | 101 | int omap1_clk_init(void); |
| 142 | void omap1_clk_late_init(void); | 102 | void omap1_clk_late_init(void); |
| 143 | extern int omap1_clk_enable(struct clk *clk); | 103 | unsigned long omap1_ckctl_recalc(struct omap1_clk *clk, unsigned long p_rate); |
| 144 | extern void omap1_clk_disable(struct clk *clk); | 104 | long omap1_round_sossi_rate(struct omap1_clk *clk, unsigned long rate, unsigned long *p_rate); |
| 145 | extern long omap1_clk_round_rate(struct clk *clk, unsigned long rate); | 105 | int omap1_set_sossi_rate(struct omap1_clk *clk, unsigned long rate, unsigned long p_rate); |
| 146 | extern int omap1_clk_set_rate(struct clk *clk, unsigned long rate); | 106 | unsigned long omap1_sossi_recalc(struct omap1_clk *clk, unsigned long p_rate); |
| 147 | extern unsigned long omap1_ckctl_recalc(struct clk *clk); | 107 | unsigned long omap1_ckctl_recalc_dsp_domain(struct omap1_clk *clk, unsigned long p_rate); |
| 148 | extern int omap1_set_sossi_rate(struct clk *clk, unsigned long rate); | 108 | int omap1_clk_set_rate_dsp_domain(struct omap1_clk *clk, unsigned long rate, |
| 149 | extern unsigned long omap1_sossi_recalc(struct clk *clk); | 109 | unsigned long p_rate); |
| 150 | extern unsigned long omap1_ckctl_recalc_dsp_domain(struct clk *clk); | 110 | long omap1_round_uart_rate(struct omap1_clk *clk, unsigned long rate, unsigned long *p_rate); |
| 151 | extern int omap1_clk_set_rate_dsp_domain(struct clk *clk, unsigned long rate); | 111 | int omap1_set_uart_rate(struct omap1_clk *clk, unsigned long rate, unsigned long p_rate); |
| 152 | extern int omap1_set_uart_rate(struct clk *clk, unsigned long rate); | 112 | unsigned long omap1_uart_recalc(struct omap1_clk *clk, unsigned long p_rate); |
| 153 | extern unsigned long omap1_uart_recalc(struct clk *clk); | 113 | int omap1_set_ext_clk_rate(struct omap1_clk *clk, unsigned long rate, unsigned long p_rate); |
| 154 | extern int omap1_set_ext_clk_rate(struct clk *clk, unsigned long rate); | 114 | long omap1_round_ext_clk_rate(struct omap1_clk *clk, unsigned long rate, unsigned long *p_rate); |
| 155 | extern long omap1_round_ext_clk_rate(struct clk *clk, unsigned long rate); | 115 | int omap1_init_ext_clk(struct omap1_clk *clk); |
| 156 | extern void omap1_init_ext_clk(struct clk *clk); | 116 | int omap1_select_table_rate(struct omap1_clk *clk, unsigned long rate, unsigned long p_rate); |
| 157 | extern int omap1_select_table_rate(struct clk *clk, unsigned long rate); | 117 | long omap1_round_to_table_rate(struct omap1_clk *clk, unsigned long rate, unsigned long *p_rate); |
| 158 | extern long omap1_round_to_table_rate(struct clk *clk, unsigned long rate); | 118 | int omap1_clk_set_rate_ckctl_arm(struct omap1_clk *clk, unsigned long rate, unsigned long p_rate); |
| 159 | extern int omap1_clk_set_rate_ckctl_arm(struct clk *clk, unsigned long rate); | 119 | long omap1_clk_round_rate_ckctl_arm(struct omap1_clk *clk, unsigned long rate, |
| 160 | extern long omap1_clk_round_rate_ckctl_arm(struct clk *clk, unsigned long rate); | 120 | unsigned long *p_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 | ||
| 167 | 121 | ||
| 168 | struct uart_clk { | 122 | struct uart_clk { |
| 169 | struct clk clk; | 123 | struct omap1_clk clk; |
| 170 | unsigned long sysc_addr; | 124 | unsigned long sysc_addr; |
| 171 | }; | 125 | }; |
| 172 | 126 | ||
| 173 | /* Provide a method for preventing idling some ARM IDLECT clocks */ | 127 | /* Provide a method for preventing idling some ARM IDLECT clocks */ |
| 174 | struct arm_idlect1_clk { | 128 | struct arm_idlect1_clk { |
| 175 | struct clk clk; | 129 | struct omap1_clk clk; |
| 176 | unsigned long no_idle_count; | 130 | unsigned long no_idle_count; |
| 177 | __u8 idlect_shift; | 131 | __u8 idlect_shift; |
| 178 | }; | 132 | }; |
| 179 | 133 | ||
| 180 | /* ARM_CKCTL bit shifts */ | 134 | /* ARM_CKCTL bit shifts */ |
| @@ -224,7 +178,7 @@ struct arm_idlect1_clk { · 43 unmodified lines | |||
| 224 | #define SOFT_REQ_REG2 0xfffe0880 | 178 | #define SOFT_REQ_REG2 0xfffe0880 |
| 225 | 179 | ||
| 226 | extern __u32 arm_idlect1_mask; | 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 | extern const struct clkops clkops_dspck; | 183 | extern const struct clkops clkops_dspck; |
| 230 | extern const struct clkops clkops_uart_16xx; | 184 | extern const struct clkops clkops_uart_16xx; |
| @@ -233,4 +187,9 @@ extern const struct clkops clkops_generic; · 2 unmodified lines | |||
| 233 | /* used for passing SoC type to omap1_{select,round_to}_table_rate() */ | 187 | /* used for passing SoC type to omap1_{select,round_to}_table_rate() */ |
| 234 | extern u32 cpu_mask; | 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 | #endif | 195 | #endif |
| @@ -14,6 +14,8 @@ · 13 unmodified lines | |||
| 14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
| 15 | #include <linux/io.h> | 15 | #include <linux/io.h> |
| 16 | #include <linux/clk.h> | 16 | #include <linux/clk.h> |
| 17 | #include <linux/clkdev.h> | ||
| 18 | #include <linux/clk-provider.h> | ||
| 17 | #include <linux/cpufreq.h> | 19 | #include <linux/cpufreq.h> |
| 18 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
| 19 | #include <linux/soc/ti/omap1-io.h> | 21 | #include <linux/soc/ti/omap1-io.h> |
| @@ -71,16 +73,18 @@ · 51 unmodified lines | |||
| 71 | * Omap1 clocks | 73 | * Omap1 clocks |
| 72 | */ | 74 | */ |
| 73 | 75 | ||
| 74 | static struct clk ck_ref = { | 76 | static struct omap1_clk ck_ref = { |
| 75 | .name = "ck_ref", | 77 | .hw.init = CLK_HW_INIT_NO_PARENT("ck_ref", &omap1_clk_rate_ops, 0), |
| 76 | .ops = &clkops_null, | ||
| 77 | .rate = 12000000, | 78 | .rate = 12000000, |
| 78 | }; | 79 | }; |
| 79 | 80 | ||
| 80 | static struct clk ck_dpll1 = { | 81 | static struct omap1_clk ck_dpll1 = { |
| 81 | .name = "ck_dpll1", | 82 | .hw.init = CLK_HW_INIT("ck_dpll1", "ck_ref", &omap1_clk_rate_ops, |
| 82 | .ops = &clkops_null, | 83 | /* |
| 83 | .parent = &ck_ref, | 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 | static struct arm_idlect1_clk ck_dpll1out = { | 94 | static struct arm_idlect1_clk ck_dpll1out = { |
| 91 | .clk = { | 95 | .clk = { |
| 92 | .name = "ck_dpll1out", | 96 | .hw.init = CLK_HW_INIT("ck_dpll1out", "ck_dpll1", &omap1_clk_gate_ops, 0), |
| 93 | .ops = &clkops_generic, | 97 | .ops = &clkops_generic, |
| 94 | .parent = &ck_dpll1, | ||
| 95 | .flags = CLOCK_IDLE_CONTROL | ENABLE_REG_32BIT, | 98 | .flags = CLOCK_IDLE_CONTROL | ENABLE_REG_32BIT, |
| 96 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), | 99 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), |
| 97 | .enable_bit = EN_CKOUT_ARM, | 100 | .enable_bit = EN_CKOUT_ARM, |
| 98 | .recalc = &followparent_recalc, | ||
| 99 | }, | 101 | }, |
| 100 | .idlect_shift = IDL_CLKOUT_ARM_SHIFT, | 102 | .idlect_shift = IDL_CLKOUT_ARM_SHIFT, |
| 101 | }; | 103 | }; |
| 102 | 104 | ||
| 103 | static struct clk sossi_ck = { | 105 | static struct omap1_clk sossi_ck = { |
| 104 | .name = "ck_sossi", | 106 | .hw.init = CLK_HW_INIT("ck_sossi", "ck_dpll1out", &omap1_clk_full_ops, 0), |
| 105 | .ops = &clkops_generic, | 107 | .ops = &clkops_generic, |
| 106 | .parent = &ck_dpll1out.clk, | ||
| 107 | .flags = CLOCK_NO_IDLE_PARENT | ENABLE_REG_32BIT, | 108 | .flags = CLOCK_NO_IDLE_PARENT | ENABLE_REG_32BIT, |
| 108 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_1), | 109 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_1), |
| 109 | .enable_bit = CONF_MOD_SOSSI_CLK_EN_R, | 110 | .enable_bit = CONF_MOD_SOSSI_CLK_EN_R, |
| 110 | .recalc = &omap1_sossi_recalc, | 111 | .recalc = &omap1_sossi_recalc, |
| 112 | .round_rate = &omap1_round_sossi_rate, | ||
| 111 | .set_rate = &omap1_set_sossi_rate, | 113 | .set_rate = &omap1_set_sossi_rate, |
| 112 | }; | 114 | }; |
| 113 | 115 | ||
| 114 | static struct clk arm_ck = { | 116 | static struct omap1_clk arm_ck = { |
| 115 | .name = "arm_ck", | 117 | .hw.init = CLK_HW_INIT("arm_ck", "ck_dpll1", &omap1_clk_rate_ops, 0), |
| 116 | .ops = &clkops_null, | ||
| 117 | .parent = &ck_dpll1, | ||
| 118 | .rate_offset = CKCTL_ARMDIV_OFFSET, | 118 | .rate_offset = CKCTL_ARMDIV_OFFSET, |
| 119 | .recalc = &omap1_ckctl_recalc, | 119 | .recalc = &omap1_ckctl_recalc, |
| 120 | .round_rate = omap1_clk_round_rate_ckctl_arm, | 120 | .round_rate = omap1_clk_round_rate_ckctl_arm, |
| @@ -123,9 +123,9 @@ static struct clk arm_ck = { · 2 unmodified lines | |||
| 123 | 123 | ||
| 124 | static struct arm_idlect1_clk armper_ck = { | 124 | static struct arm_idlect1_clk armper_ck = { |
| 125 | .clk = { | 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 | .ops = &clkops_generic, | 128 | .ops = &clkops_generic, |
| 128 | .parent = &ck_dpll1, | ||
| 129 | .flags = CLOCK_IDLE_CONTROL, | 129 | .flags = CLOCK_IDLE_CONTROL, |
| 130 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), | 130 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), |
| 131 | .enable_bit = EN_PERCK, | 131 | .enable_bit = EN_PERCK, |
| @@ -141,46 +141,41 @@ static struct arm_idlect1_clk armper_ck = { · 9 unmodified lines | |||
| 141 | * FIXME: This clock seems to be necessary but no-one has asked for its | 141 | * FIXME: This clock seems to be necessary but no-one has asked for its |
| 142 | * activation. [ GPIO code for 1510 ] | 142 | * activation. [ GPIO code for 1510 ] |
| 143 | */ | 143 | */ |
| 144 | static struct clk arm_gpio_ck = { | 144 | static struct omap1_clk arm_gpio_ck = { |
| 145 | .name = "ick", | 145 | .hw.init = CLK_HW_INIT("ick", "ck_dpll1", &omap1_clk_gate_ops, CLK_IS_CRITICAL), |
| 146 | .ops = &clkops_generic, | 146 | .ops = &clkops_generic, |
| 147 | .parent = &ck_dpll1, | ||
| 148 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), | 147 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), |
| 149 | .enable_bit = EN_GPIOCK, | 148 | .enable_bit = EN_GPIOCK, |
| 150 | .recalc = &followparent_recalc, | ||
| 151 | }; | 149 | }; |
| 152 | 150 | ||
| 153 | static struct arm_idlect1_clk armxor_ck = { | 151 | static struct arm_idlect1_clk armxor_ck = { |
| 154 | .clk = { | 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 | .ops = &clkops_generic, | 155 | .ops = &clkops_generic, |
| 157 | .parent = &ck_ref, | ||
| 158 | .flags = CLOCK_IDLE_CONTROL, | 156 | .flags = CLOCK_IDLE_CONTROL, |
| 159 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), | 157 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), |
| 160 | .enable_bit = EN_XORPCK, | 158 | .enable_bit = EN_XORPCK, |
| 161 | .recalc = &followparent_recalc, | ||
| 162 | }, | 159 | }, |
| 163 | .idlect_shift = IDLXORP_ARM_SHIFT, | 160 | .idlect_shift = IDLXORP_ARM_SHIFT, |
| 164 | }; | 161 | }; |
| 165 | 162 | ||
| 166 | static struct arm_idlect1_clk armtim_ck = { | 163 | static struct arm_idlect1_clk armtim_ck = { |
| 167 | .clk = { | 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 | .ops = &clkops_generic, | 167 | .ops = &clkops_generic, |
| 170 | .parent = &ck_ref, | ||
| 171 | .flags = CLOCK_IDLE_CONTROL, | 168 | .flags = CLOCK_IDLE_CONTROL, |
| 172 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), | 169 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), |
| 173 | .enable_bit = EN_TIMCK, | 170 | .enable_bit = EN_TIMCK, |
| 174 | .recalc = &followparent_recalc, | ||
| 175 | }, | 171 | }, |
| 176 | .idlect_shift = IDLTIM_ARM_SHIFT, | 172 | .idlect_shift = IDLTIM_ARM_SHIFT, |
| 177 | }; | 173 | }; |
| 178 | 174 | ||
| 179 | static struct arm_idlect1_clk armwdt_ck = { | 175 | static struct arm_idlect1_clk armwdt_ck = { |
| 180 | .clk = { | 176 | .clk = { |
| 181 | .name = "armwdt_ck", | 177 | .hw.init = CLK_HW_INIT("armwdt_ck", "ck_ref", &omap1_clk_full_ops, 0), |
| 182 | .ops = &clkops_generic, | 178 | .ops = &clkops_generic, |
| 183 | .parent = &ck_ref, | ||
| 184 | .flags = CLOCK_IDLE_CONTROL, | 179 | .flags = CLOCK_IDLE_CONTROL, |
| 185 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), | 180 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), |
| 186 | .enable_bit = EN_WDTCK, | 181 | .enable_bit = EN_WDTCK, |
| @@ -190,11 +185,8 @@ static struct arm_idlect1_clk armwdt_ck = { · 3 unmodified lines | |||
| 190 | .idlect_shift = IDLWDT_ARM_SHIFT, | 185 | .idlect_shift = IDLWDT_ARM_SHIFT, |
| 191 | }; | 186 | }; |
| 192 | 187 | ||
| 193 | static struct clk arminth_ck16xx = { | 188 | static struct omap1_clk arminth_ck16xx = { |
| 194 | .name = "arminth_ck", | 189 | .hw.init = CLK_HW_INIT("arminth_ck", "arm_ck", &omap1_clk_null_ops, 0), |
| 195 | .ops = &clkops_null, | ||
| 196 | .parent = &arm_ck, | ||
| 197 | .recalc = &followparent_recalc, | ||
| 198 | /* Note: On 16xx the frequency can be divided by 2 by programming | 190 | /* Note: On 16xx the frequency can be divided by 2 by programming |
| 199 | * ARM_CKCTL:ARM_INTHCK_SEL(14) to 1 | 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 = { | 197 | static struct omap1_clk dsp_ck = { |
| 206 | .name = "dsp_ck", | 198 | .hw.init = CLK_HW_INIT("dsp_ck", "ck_dpll1", &omap1_clk_full_ops, 0), |
| 207 | .ops = &clkops_generic, | 199 | .ops = &clkops_generic, |
| 208 | .parent = &ck_dpll1, | ||
| 209 | .enable_reg = OMAP1_IO_ADDRESS(ARM_CKCTL), | 200 | .enable_reg = OMAP1_IO_ADDRESS(ARM_CKCTL), |
| 210 | .enable_bit = EN_DSPCK, | 201 | .enable_bit = EN_DSPCK, |
| 211 | .rate_offset = CKCTL_DSPDIV_OFFSET, | 202 | .rate_offset = CKCTL_DSPDIV_OFFSET, |
| @@ -214,20 +205,17 @@ static struct clk dsp_ck = { · 2 unmodified lines | |||
| 214 | .set_rate = omap1_clk_set_rate_ckctl_arm, | 205 | .set_rate = omap1_clk_set_rate_ckctl_arm, |
| 215 | }; | 206 | }; |
| 216 | 207 | ||
| 217 | static struct clk dspmmu_ck = { | 208 | static struct omap1_clk dspmmu_ck = { |
| 218 | .name = "dspmmu_ck", | 209 | .hw.init = CLK_HW_INIT("dspmmu_ck", "ck_dpll1", &omap1_clk_rate_ops, 0), |
| 219 | .ops = &clkops_null, | ||
| 220 | .parent = &ck_dpll1, | ||
| 221 | .rate_offset = CKCTL_DSPMMUDIV_OFFSET, | 210 | .rate_offset = CKCTL_DSPMMUDIV_OFFSET, |
| 222 | .recalc = &omap1_ckctl_recalc, | 211 | .recalc = &omap1_ckctl_recalc, |
| 223 | .round_rate = omap1_clk_round_rate_ckctl_arm, | 212 | .round_rate = omap1_clk_round_rate_ckctl_arm, |
| 224 | .set_rate = omap1_clk_set_rate_ckctl_arm, | 213 | .set_rate = omap1_clk_set_rate_ckctl_arm, |
| 225 | }; | 214 | }; |
| 226 | 215 | ||
| 227 | static struct clk dspper_ck = { | 216 | static struct omap1_clk dspper_ck = { |
| 228 | .name = "dspper_ck", | 217 | .hw.init = CLK_HW_INIT("dspper_ck", "ck_dpll1", &omap1_clk_full_ops, 0), |
| 229 | .ops = &clkops_dspck, | 218 | .ops = &clkops_dspck, |
| 230 | .parent = &ck_dpll1, | ||
| 231 | .enable_reg = DSP_IDLECT2, | 219 | .enable_reg = DSP_IDLECT2, |
| 232 | .enable_bit = EN_PERCK, | 220 | .enable_bit = EN_PERCK, |
| 233 | .rate_offset = CKCTL_PERDIV_OFFSET, | 221 | .rate_offset = CKCTL_PERDIV_OFFSET, |
| @@ -236,29 +224,23 @@ static struct clk dspper_ck = { · 2 unmodified lines | |||
| 236 | .set_rate = &omap1_clk_set_rate_dsp_domain, | 224 | .set_rate = &omap1_clk_set_rate_dsp_domain, |
| 237 | }; | 225 | }; |
| 238 | 226 | ||
| 239 | static struct clk dspxor_ck = { | 227 | static struct omap1_clk dspxor_ck = { |
| 240 | .name = "dspxor_ck", | 228 | .hw.init = CLK_HW_INIT("dspxor_ck", "ck_ref", &omap1_clk_gate_ops, 0), |
| 241 | .ops = &clkops_dspck, | 229 | .ops = &clkops_dspck, |
| 242 | .parent = &ck_ref, | ||
| 243 | .enable_reg = DSP_IDLECT2, | 230 | .enable_reg = DSP_IDLECT2, |
| 244 | .enable_bit = EN_XORPCK, | 231 | .enable_bit = EN_XORPCK, |
| 245 | .recalc = &followparent_recalc, | ||
| 246 | }; | 232 | }; |
| 247 | 233 | ||
| 248 | static struct clk dsptim_ck = { | 234 | static struct omap1_clk dsptim_ck = { |
| 249 | .name = "dsptim_ck", | 235 | .hw.init = CLK_HW_INIT("dsptim_ck", "ck_ref", &omap1_clk_gate_ops, 0), |
| 250 | .ops = &clkops_dspck, | 236 | .ops = &clkops_dspck, |
| 251 | .parent = &ck_ref, | ||
| 252 | .enable_reg = DSP_IDLECT2, | 237 | .enable_reg = DSP_IDLECT2, |
| 253 | .enable_bit = EN_DSPTIMCK, | 238 | .enable_bit = EN_DSPTIMCK, |
| 254 | .recalc = &followparent_recalc, | ||
| 255 | }; | 239 | }; |
| 256 | 240 | ||
| 257 | static struct arm_idlect1_clk tc_ck = { | 241 | static struct arm_idlect1_clk tc_ck = { |
| 258 | .clk = { | 242 | .clk = { |
| 259 | .name = "tc_ck", | 243 | .hw.init = CLK_HW_INIT("tc_ck", "ck_dpll1", &omap1_clk_rate_ops, 0), |
| 260 | .ops = &clkops_null, | ||
| 261 | .parent = &ck_dpll1, | ||
| 262 | .flags = CLOCK_IDLE_CONTROL, | 244 | .flags = CLOCK_IDLE_CONTROL, |
| 263 | .rate_offset = CKCTL_TCDIV_OFFSET, | 245 | .rate_offset = CKCTL_TCDIV_OFFSET, |
| 264 | .recalc = &omap1_ckctl_recalc, | 246 | .recalc = &omap1_ckctl_recalc, |
| @@ -268,116 +250,88 @@ static struct arm_idlect1_clk tc_ck = { · 3 unmodified lines | |||
| 268 | .idlect_shift = IDLIF_ARM_SHIFT, | 250 | .idlect_shift = IDLIF_ARM_SHIFT, |
| 269 | }; | 251 | }; |
| 270 | 252 | ||
| 271 | static struct clk arminth_ck1510 = { | 253 | static struct omap1_clk arminth_ck1510 = { |
| 272 | .name = "arminth_ck", | 254 | .hw.init = CLK_HW_INIT("arminth_ck", "tc_ck", &omap1_clk_null_ops, 0), |
| 273 | .ops = &clkops_null, | ||
| 274 | .parent = &tc_ck.clk, | ||
| 275 | .recalc = &followparent_recalc, | ||
| 276 | /* Note: On 1510 the frequency follows TC_CK | 255 | /* Note: On 1510 the frequency follows TC_CK |
| 277 | * | 256 | * |
| 278 | * 16xx version is in MPU clocks. | 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 | /* No-idle controlled by "tc_ck" */ | 262 | /* No-idle controlled by "tc_ck" */ |
| 284 | .name = "tipb_ck", | 263 | .hw.init = CLK_HW_INIT("tipb_ck", "tc_ck", &omap1_clk_null_ops, 0), |
| 285 | .ops = &clkops_null, | ||
| 286 | .parent = &tc_ck.clk, | ||
| 287 | .recalc = &followparent_recalc, | ||
| 288 | }; | 264 | }; |
| 289 | 265 | ||
| 290 | static struct clk l3_ocpi_ck = { | 266 | static struct omap1_clk l3_ocpi_ck = { |
| 291 | /* No-idle controlled by "tc_ck" */ | 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 | .ops = &clkops_generic, | 269 | .ops = &clkops_generic, |
| 294 | .parent = &tc_ck.clk, | ||
| 295 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT3), | 270 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT3), |
| 296 | .enable_bit = EN_OCPI_CK, | 271 | .enable_bit = EN_OCPI_CK, |
| 297 | .recalc = &followparent_recalc, | ||
| 298 | }; | 272 | }; |
| 299 | 273 | ||
| 300 | static struct clk tc1_ck = { | 274 | static struct omap1_clk tc1_ck = { |
| 301 | .name = "tc1_ck", | 275 | .hw.init = CLK_HW_INIT("tc1_ck", "tc_ck", &omap1_clk_gate_ops, 0), |
| 302 | .ops = &clkops_generic, | 276 | .ops = &clkops_generic, |
| 303 | .parent = &tc_ck.clk, | ||
| 304 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT3), | 277 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT3), |
| 305 | .enable_bit = EN_TC1_CK, | 278 | .enable_bit = EN_TC1_CK, |
| 306 | .recalc = &followparent_recalc, | ||
| 307 | }; | 279 | }; |
| 308 | 280 | ||
| 309 | /* | 281 | /* |
| 310 | * FIXME: This clock seems to be necessary but no-one has asked for its | 282 | * FIXME: This clock seems to be necessary but no-one has asked for its |
| 311 | * activation. [ pm.c (SRAM), CCP, Camera ] | 283 | * activation. [ pm.c (SRAM), CCP, Camera ] |
| 312 | */ | 284 | */ |
| 313 | static struct clk tc2_ck = { | 285 | |
| 314 | .name = "tc2_ck", | 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 | .ops = &clkops_generic, | 288 | .ops = &clkops_generic, |
| 316 | .parent = &tc_ck.clk, | ||
| 317 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT3), | 289 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT3), |
| 318 | .enable_bit = EN_TC2_CK, | 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 | /* No-idle controlled by "tc_ck" */ | 294 | /* No-idle controlled by "tc_ck" */ |
| 324 | .name = "dma_ck", | 295 | .hw.init = CLK_HW_INIT("dma_ck", "tc_ck", &omap1_clk_null_ops, 0), |
| 325 | .ops = &clkops_null, | ||
| 326 | .parent = &tc_ck.clk, | ||
| 327 | .recalc = &followparent_recalc, | ||
| 328 | }; | 296 | }; |
| 329 | 297 | ||
| 330 | static struct clk dma_lcdfree_ck = { | 298 | static struct omap1_clk dma_lcdfree_ck = { |
| 331 | .name = "dma_lcdfree_ck", | 299 | .hw.init = CLK_HW_INIT("dma_lcdfree_ck", "tc_ck", &omap1_clk_null_ops, 0), |
| 332 | .ops = &clkops_null, | ||
| 333 | .parent = &tc_ck.clk, | ||
| 334 | .recalc = &followparent_recalc, | ||
| 335 | }; | 300 | }; |
| 336 | 301 | ||
| 337 | static struct arm_idlect1_clk api_ck = { | 302 | static struct arm_idlect1_clk api_ck = { |
| 338 | .clk = { | 303 | .clk = { |
| 339 | .name = "api_ck", | 304 | .hw.init = CLK_HW_INIT("api_ck", "tc_ck", &omap1_clk_gate_ops, 0), |
| 340 | .ops = &clkops_generic, | 305 | .ops = &clkops_generic, |
| 341 | .parent = &tc_ck.clk, | ||
| 342 | .flags = CLOCK_IDLE_CONTROL, | 306 | .flags = CLOCK_IDLE_CONTROL, |
| 343 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), | 307 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), |
| 344 | .enable_bit = EN_APICK, | 308 | .enable_bit = EN_APICK, |
| 345 | .recalc = &followparent_recalc, | ||
| 346 | }, | 309 | }, |
| 347 | .idlect_shift = IDLAPI_ARM_SHIFT, | 310 | .idlect_shift = IDLAPI_ARM_SHIFT, |
| 348 | }; | 311 | }; |
| 349 | 312 | ||
| 350 | static struct arm_idlect1_clk lb_ck = { | 313 | static struct arm_idlect1_clk lb_ck = { |
| 351 | .clk = { | 314 | .clk = { |
| 352 | .name = "lb_ck", | 315 | .hw.init = CLK_HW_INIT("lb_ck", "tc_ck", &omap1_clk_gate_ops, 0), |
| 353 | .ops = &clkops_generic, | 316 | .ops = &clkops_generic, |
| 354 | .parent = &tc_ck.clk, | ||
| 355 | .flags = CLOCK_IDLE_CONTROL, | 317 | .flags = CLOCK_IDLE_CONTROL, |
| 356 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), | 318 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), |
| 357 | .enable_bit = EN_LBCK, | 319 | .enable_bit = EN_LBCK, |
| 358 | .recalc = &followparent_recalc, | ||
| 359 | }, | 320 | }, |
| 360 | .idlect_shift = IDLLB_ARM_SHIFT, | 321 | .idlect_shift = IDLLB_ARM_SHIFT, |
| 361 | }; | 322 | }; |
| 362 | 323 | ||
| 363 | static struct clk rhea1_ck = { | 324 | static struct omap1_clk rhea1_ck = { |
| 364 | .name = "rhea1_ck", | 325 | .hw.init = CLK_HW_INIT("rhea1_ck", "tc_ck", &omap1_clk_null_ops, 0), |
| 365 | .ops = &clkops_null, | ||
| 366 | .parent = &tc_ck.clk, | ||
| 367 | .recalc = &followparent_recalc, | ||
| 368 | }; | 326 | }; |
| 369 | 327 | ||
| 370 | static struct clk rhea2_ck = { | 328 | static struct omap1_clk rhea2_ck = { |
| 371 | .name = "rhea2_ck", | 329 | .hw.init = CLK_HW_INIT("rhea2_ck", "tc_ck", &omap1_clk_null_ops, 0), |
| 372 | .ops = &clkops_null, | ||
| 373 | .parent = &tc_ck.clk, | ||
| 374 | .recalc = &followparent_recalc, | ||
| 375 | }; | 330 | }; |
| 376 | 331 | ||
| 377 | static struct clk lcd_ck_16xx = { | 332 | static struct omap1_clk lcd_ck_16xx = { |
| 378 | .name = "lcd_ck", | 333 | .hw.init = CLK_HW_INIT("lcd_ck", "ck_dpll1", &omap1_clk_full_ops, 0), |
| 379 | .ops = &clkops_generic, | 334 | .ops = &clkops_generic, |
| 380 | .parent = &ck_dpll1, | ||
| 381 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), | 335 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), |
| 382 | .enable_bit = EN_LCDCK, | 336 | .enable_bit = EN_LCDCK, |
| 383 | .rate_offset = CKCTL_LCDDIV_OFFSET, | 337 | .rate_offset = CKCTL_LCDDIV_OFFSET, |
| @@ -388,9 +342,8 @@ static struct clk lcd_ck_16xx = { · 4 unmodified lines | |||
| 388 | 342 | ||
| 389 | static struct arm_idlect1_clk lcd_ck_1510 = { | 343 | static struct arm_idlect1_clk lcd_ck_1510 = { |
| 390 | .clk = { | 344 | .clk = { |
| 391 | .name = "lcd_ck", | 345 | .hw.init = CLK_HW_INIT("lcd_ck", "ck_dpll1", &omap1_clk_full_ops, 0), |
| 392 | .ops = &clkops_generic, | 346 | .ops = &clkops_generic, |
| 393 | .parent = &ck_dpll1, | ||
| 394 | .flags = CLOCK_IDLE_CONTROL, | 347 | .flags = CLOCK_IDLE_CONTROL, |
| 395 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), | 348 | .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), |
| 396 | .enable_bit = EN_LCDCK, | 349 | .enable_bit = EN_LCDCK, |
| @@ -402,37 +355,35 @@ static struct arm_idlect1_clk lcd_ck_1510 = { · 5 unmodified lines | |||
| 402 | .idlect_shift = OMAP1510_IDLLCD_ARM_SHIFT, | 355 | .idlect_shift = OMAP1510_IDLLCD_ARM_SHIFT, |
| 403 | }; | 356 | }; |
| 404 | 357 | ||
| 358 | |||
| 405 | /* | 359 | /* |
| 406 | * XXX The enable_bit here is misused - it simply switches between 12MHz | 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 | * XXX does this need SYSC register handling? | 363 | * XXX does this need SYSC register handling? |
| 410 | */ | 364 | */ |
| 411 | static struct clk uart1_1510 = { | 365 | static struct omap1_clk uart1_1510 = { |
| 412 | .name = "uart1_ck", | ||
| 413 | .ops = &clkops_null, | ||
| 414 | /* Direct from ULPD, no real parent */ | 366 | /* Direct from ULPD, no real parent */ |
| 415 | .parent = &armper_ck.clk, | 367 | .hw.init = CLK_HW_INIT("uart1_ck", "armper_ck", &omap1_clk_full_ops, 0), |
| 416 | .rate = 12000000, | ||
| 417 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, | 368 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, |
| 418 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), | 369 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), |
| 419 | .enable_bit = CONF_MOD_UART1_CLK_MODE_R, | 370 | .enable_bit = CONF_MOD_UART1_CLK_MODE_R, |
| 371 | .round_rate = &omap1_round_uart_rate, | ||
| 420 | .set_rate = &omap1_set_uart_rate, | 372 | .set_rate = &omap1_set_uart_rate, |
| 421 | .recalc = &omap1_uart_recalc, | 373 | .recalc = &omap1_uart_recalc, |
| 422 | }; | 374 | }; |
| 423 | 375 | ||
| 424 | /* | 376 | /* |
| 425 | * XXX The enable_bit here is misused - it simply switches between 12MHz | 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 | * XXX SYSC register handling does not belong in the clock framework | 380 | * XXX SYSC register handling does not belong in the clock framework |
| 429 | */ | 381 | */ |
| 430 | static struct uart_clk uart1_16xx = { | 382 | static struct uart_clk uart1_16xx = { |
| 431 | .clk = { | 383 | .clk = { |
| 432 | .name = "uart1_ck", | ||
| 433 | .ops = &clkops_uart_16xx, | 384 | .ops = &clkops_uart_16xx, |
| 434 | /* Direct from ULPD, no real parent */ | 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 | .rate = 48000000, | 387 | .rate = 48000000, |
| 437 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, | 388 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, |
| 438 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), | 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 | * XXX The enable_bit here is misused - it simply switches between 12MHz | 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 | * XXX does this need SYSC register handling? | 399 | * XXX does this need SYSC register handling? |
| 449 | */ | 400 | */ |
| 450 | static struct clk uart2_ck = { | 401 | static struct omap1_clk uart2_ck = { |
| 451 | .name = "uart2_ck", | ||
| 452 | .ops = &clkops_null, | ||
| 453 | /* Direct from ULPD, no real parent */ | 402 | /* Direct from ULPD, no real parent */ |
| 454 | .parent = &armper_ck.clk, | 403 | .hw.init = CLK_HW_INIT("uart2_ck", "armper_ck", &omap1_clk_full_ops, 0), |
| 455 | .rate = 12000000, | ||
| 456 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, | 404 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, |
| 457 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), | 405 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), |
| 458 | .enable_bit = CONF_MOD_UART2_CLK_MODE_R, | 406 | .enable_bit = CONF_MOD_UART2_CLK_MODE_R, |
| 407 | .round_rate = &omap1_round_uart_rate, | ||
| 459 | .set_rate = &omap1_set_uart_rate, | 408 | .set_rate = &omap1_set_uart_rate, |
| 460 | .recalc = &omap1_uart_recalc, | 409 | .recalc = &omap1_uart_recalc, |
| 461 | }; | 410 | }; |
| 462 | 411 | ||
| 463 | /* | 412 | /* |
| 464 | * XXX The enable_bit here is misused - it simply switches between 12MHz | 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 | * XXX does this need SYSC register handling? | 416 | * XXX does this need SYSC register handling? |
| 468 | */ | 417 | */ |
| 469 | static struct clk uart3_1510 = { | 418 | static struct omap1_clk uart3_1510 = { |
| 470 | .name = "uart3_ck", | ||
| 471 | .ops = &clkops_null, | ||
| 472 | /* Direct from ULPD, no real parent */ | 419 | /* Direct from ULPD, no real parent */ |
| 473 | .parent = &armper_ck.clk, | 420 | .hw.init = CLK_HW_INIT("uart3_ck", "armper_ck", &omap1_clk_full_ops, 0), |
| 474 | .rate = 12000000, | ||
| 475 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, | 421 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, |
| 476 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), | 422 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), |
| 477 | .enable_bit = CONF_MOD_UART3_CLK_MODE_R, | 423 | .enable_bit = CONF_MOD_UART3_CLK_MODE_R, |
| 424 | .round_rate = &omap1_round_uart_rate, | ||
| 478 | .set_rate = &omap1_set_uart_rate, | 425 | .set_rate = &omap1_set_uart_rate, |
| 479 | .recalc = &omap1_uart_recalc, | 426 | .recalc = &omap1_uart_recalc, |
| 480 | }; | 427 | }; |
| 481 | 428 | ||
| 482 | /* | 429 | /* |
| 483 | * XXX The enable_bit here is misused - it simply switches between 12MHz | 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 | * XXX SYSC register handling does not belong in the clock framework | 433 | * XXX SYSC register handling does not belong in the clock framework |
| 487 | */ | 434 | */ |
| 488 | static struct uart_clk uart3_16xx = { | 435 | static struct uart_clk uart3_16xx = { |
| 489 | .clk = { | 436 | .clk = { |
| 490 | .name = "uart3_ck", | ||
| 491 | .ops = &clkops_uart_16xx, | 437 | .ops = &clkops_uart_16xx, |
| 492 | /* Direct from ULPD, no real parent */ | 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 | .rate = 48000000, | 440 | .rate = 48000000, |
| 495 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, | 441 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, |
| 496 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), | 442 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), |
| @@ -499,30 +445,30 @@ static struct uart_clk uart3_16xx = { · 2 unmodified lines | |||
| 499 | .sysc_addr = 0xfffb9854, | 445 | .sysc_addr = 0xfffb9854, |
| 500 | }; | 446 | }; |
| 501 | 447 | ||
| 502 | static struct clk usb_clko = { /* 6 MHz output on W4_USB_CLKO */ | 448 | static struct omap1_clk usb_clko = { /* 6 MHz output on W4_USB_CLKO */ |
| 503 | .name = "usb_clko", | ||
| 504 | .ops = &clkops_generic, | 449 | .ops = &clkops_generic, |
| 505 | /* Direct from ULPD, no parent */ | 450 | /* Direct from ULPD, no parent */ |
| 451 | .hw.init = CLK_HW_INIT_NO_PARENT("usb_clko", &omap1_clk_full_ops, 0), | ||
| 506 | .rate = 6000000, | 452 | .rate = 6000000, |
| 507 | .flags = ENABLE_REG_32BIT, | 453 | .flags = ENABLE_REG_32BIT, |
| 508 | .enable_reg = OMAP1_IO_ADDRESS(ULPD_CLOCK_CTRL), | 454 | .enable_reg = OMAP1_IO_ADDRESS(ULPD_CLOCK_CTRL), |
| 509 | .enable_bit = USB_MCLK_EN_BIT, | 455 | .enable_bit = USB_MCLK_EN_BIT, |
| 510 | }; | 456 | }; |
| 511 | 457 | ||
| 512 | static struct clk usb_hhc_ck1510 = { | 458 | static struct omap1_clk usb_hhc_ck1510 = { |
| 513 | .name = "usb_hhc_ck", | ||
| 514 | .ops = &clkops_generic, | 459 | .ops = &clkops_generic, |
| 515 | /* Direct from ULPD, no parent */ | 460 | /* Direct from ULPD, no parent */ |
| 461 | .hw.init = CLK_HW_INIT_NO_PARENT("usb_hhc_ck", &omap1_clk_full_ops, 0), | ||
| 516 | .rate = 48000000, /* Actually 2 clocks, 12MHz and 48MHz */ | 462 | .rate = 48000000, /* Actually 2 clocks, 12MHz and 48MHz */ |
| 517 | .flags = ENABLE_REG_32BIT, | 463 | .flags = ENABLE_REG_32BIT, |
| 518 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), | 464 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), |
| 519 | .enable_bit = USB_HOST_HHC_UHOST_EN, | 465 | .enable_bit = USB_HOST_HHC_UHOST_EN, |
| 520 | }; | 466 | }; |
| 521 | 467 | ||
| 522 | static struct clk usb_hhc_ck16xx = { | 468 | static struct omap1_clk usb_hhc_ck16xx = { |
| 523 | .name = "usb_hhc_ck", | ||
| 524 | .ops = &clkops_generic, | 469 | .ops = &clkops_generic, |
| 525 | /* Direct from ULPD, no parent */ | 470 | /* Direct from ULPD, no parent */ |
| 471 | .hw.init = CLK_HW_INIT_NO_PARENT("usb_hhc_ck", &omap1_clk_full_ops, 0), | ||
| 526 | .rate = 48000000, | 472 | .rate = 48000000, |
| 527 | /* OTG_SYSCON_2.OTG_PADEN == 0 (not 1510-compatible) */ | 473 | /* OTG_SYSCON_2.OTG_PADEN == 0 (not 1510-compatible) */ |
| 528 | .flags = ENABLE_REG_32BIT, | 474 | .flags = ENABLE_REG_32BIT, |
| @@ -530,46 +476,46 @@ static struct clk usb_hhc_ck16xx = { · 1 unmodified line | |||
| 530 | .enable_bit = OTG_SYSCON_2_UHOST_EN_SHIFT | 476 | .enable_bit = OTG_SYSCON_2_UHOST_EN_SHIFT |
| 531 | }; | 477 | }; |
| 532 | 478 | ||
| 533 | static struct clk usb_dc_ck = { | 479 | static struct omap1_clk usb_dc_ck = { |
| 534 | .name = "usb_dc_ck", | ||
| 535 | .ops = &clkops_generic, | 480 | .ops = &clkops_generic, |
| 536 | /* Direct from ULPD, no parent */ | 481 | /* Direct from ULPD, no parent */ |
| 482 | .hw.init = CLK_HW_INIT_NO_PARENT("usb_dc_ck", &omap1_clk_full_ops, 0), | ||
| 537 | .rate = 48000000, | 483 | .rate = 48000000, |
| 538 | .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG), | 484 | .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG), |
| 539 | .enable_bit = SOFT_USB_OTG_DPLL_REQ_SHIFT, | 485 | .enable_bit = SOFT_USB_OTG_DPLL_REQ_SHIFT, |
| 540 | }; | 486 | }; |
| 541 | 487 | ||
| 542 | static struct clk uart1_7xx = { | 488 | static struct omap1_clk uart1_7xx = { |
| 543 | .name = "uart1_ck", | ||
| 544 | .ops = &clkops_generic, | 489 | .ops = &clkops_generic, |
| 545 | /* Direct from ULPD, no parent */ | 490 | /* Direct from ULPD, no parent */ |
| 491 | .hw.init = CLK_HW_INIT_NO_PARENT("uart1_ck", &omap1_clk_full_ops, 0), | ||
| 546 | .rate = 12000000, | 492 | .rate = 12000000, |
| 547 | .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG), | 493 | .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG), |
| 548 | .enable_bit = 9, | 494 | .enable_bit = 9, |
| 549 | }; | 495 | }; |
| 550 | 496 | ||
| 551 | static struct clk uart2_7xx = { | 497 | static struct omap1_clk uart2_7xx = { |
| 552 | .name = "uart2_ck", | ||
| 553 | .ops = &clkops_generic, | 498 | .ops = &clkops_generic, |
| 554 | /* Direct from ULPD, no parent */ | 499 | /* Direct from ULPD, no parent */ |
| 500 | .hw.init = CLK_HW_INIT_NO_PARENT("uart2_ck", &omap1_clk_full_ops, 0), | ||
| 555 | .rate = 12000000, | 501 | .rate = 12000000, |
| 556 | .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG), | 502 | .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG), |
| 557 | .enable_bit = 11, | 503 | .enable_bit = 11, |
| 558 | }; | 504 | }; |
| 559 | 505 | ||
| 560 | static struct clk mclk_1510 = { | 506 | static struct omap1_clk mclk_1510 = { |
| 561 | .name = "mclk", | ||
| 562 | .ops = &clkops_generic, | 507 | .ops = &clkops_generic, |
| 563 | /* Direct from ULPD, no parent. May be enabled by ext hardware. */ | 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 | .rate = 12000000, | 510 | .rate = 12000000, |
| 565 | .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG), | 511 | .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG), |
| 566 | .enable_bit = SOFT_COM_MCKO_REQ_SHIFT, | 512 | .enable_bit = SOFT_COM_MCKO_REQ_SHIFT, |
| 567 | }; | 513 | }; |
| 568 | 514 | ||
| 569 | static struct clk mclk_16xx = { | 515 | static struct omap1_clk mclk_16xx = { |
| 570 | .name = "mclk", | ||
| 571 | .ops = &clkops_generic, | 516 | .ops = &clkops_generic, |
| 572 | /* Direct from ULPD, no parent. May be enabled by ext hardware. */ | 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 | .enable_reg = OMAP1_IO_ADDRESS(COM_CLK_DIV_CTRL_SEL), | 519 | .enable_reg = OMAP1_IO_ADDRESS(COM_CLK_DIV_CTRL_SEL), |
| 574 | .enable_bit = COM_ULPD_PLL_CLK_REQ, | 520 | .enable_bit = COM_ULPD_PLL_CLK_REQ, |
| 575 | .set_rate = &omap1_set_ext_clk_rate, | 521 | .set_rate = &omap1_set_ext_clk_rate, |
| @@ -577,17 +523,16 @@ static struct clk mclk_16xx = { · 1 unmodified line | |||
| 577 | .init = &omap1_init_ext_clk, | 523 | .init = &omap1_init_ext_clk, |
| 578 | }; | 524 | }; |
| 579 | 525 | ||
| 580 | static struct clk bclk_1510 = { | 526 | static struct omap1_clk bclk_1510 = { |
| 581 | .name = "bclk", | ||
| 582 | .ops = &clkops_generic, | ||
| 583 | /* Direct from ULPD, no parent. May be enabled by ext hardware. */ | 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 | .rate = 12000000, | 529 | .rate = 12000000, |
| 585 | }; | 530 | }; |
| 586 | 531 | ||
| 587 | static struct clk bclk_16xx = { | 532 | static struct omap1_clk bclk_16xx = { |
| 588 | .name = "bclk", | ||
| 589 | .ops = &clkops_generic, | 533 | .ops = &clkops_generic, |
| 590 | /* Direct from ULPD, no parent. May be enabled by ext hardware. */ | 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 | .enable_reg = OMAP1_IO_ADDRESS(SWD_CLK_DIV_CTRL_SEL), | 536 | .enable_reg = OMAP1_IO_ADDRESS(SWD_CLK_DIV_CTRL_SEL), |
| 592 | .enable_bit = SWD_ULPD_PLL_CLK_REQ, | 537 | .enable_bit = SWD_ULPD_PLL_CLK_REQ, |
| 593 | .set_rate = &omap1_set_ext_clk_rate, | 538 | .set_rate = &omap1_set_ext_clk_rate, |
| @@ -595,11 +540,10 @@ static struct clk bclk_16xx = { · 1 unmodified line | |||
| 595 | .init = &omap1_init_ext_clk, | 540 | .init = &omap1_init_ext_clk, |
| 596 | }; | 541 | }; |
| 597 | 542 | ||
| 598 | static struct clk mmc1_ck = { | 543 | static struct omap1_clk mmc1_ck = { |
| 599 | .name = "mmc1_ck", | ||
| 600 | .ops = &clkops_generic, | 544 | .ops = &clkops_generic, |
| 601 | /* Functional clock is direct from ULPD, interface clock is ARMPER */ | 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 | .rate = 48000000, | 547 | .rate = 48000000, |
| 604 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, | 548 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, |
| 605 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), | 549 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), |
| @@ -610,32 +554,29 @@ static struct clk mmc1_ck = { · 4 unmodified lines | |||
| 610 | * XXX MOD_CONF_CTRL_0 bit 20 is defined in the 1510 TRM as | 554 | * XXX MOD_CONF_CTRL_0 bit 20 is defined in the 1510 TRM as |
| 611 | * CONF_MOD_MCBSP3_AUXON ?? | 555 | * CONF_MOD_MCBSP3_AUXON ?? |
| 612 | */ | 556 | */ |
| 613 | static struct clk mmc2_ck = { | 557 | static struct omap1_clk mmc2_ck = { |
| 614 | .name = "mmc2_ck", | ||
| 615 | .ops = &clkops_generic, | 558 | .ops = &clkops_generic, |
| 616 | /* Functional clock is direct from ULPD, interface clock is ARMPER */ | 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 | .rate = 48000000, | 561 | .rate = 48000000, |
| 619 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, | 562 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, |
| 620 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), | 563 | .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0), |
| 621 | .enable_bit = 20, | 564 | .enable_bit = 20, |
| 622 | }; | 565 | }; |
| 623 | 566 | ||
| 624 | static struct clk mmc3_ck = { | 567 | static struct omap1_clk mmc3_ck = { |
| 625 | .name = "mmc3_ck", | ||
| 626 | .ops = &clkops_generic, | 568 | .ops = &clkops_generic, |
| 627 | /* Functional clock is direct from ULPD, interface clock is ARMPER */ | 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 | .rate = 48000000, | 571 | .rate = 48000000, |
| 630 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, | 572 | .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, |
| 631 | .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG), | 573 | .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG), |
| 632 | .enable_bit = SOFT_MMC_DPLL_REQ_SHIFT, | 574 | .enable_bit = SOFT_MMC_DPLL_REQ_SHIFT, |
| 633 | }; | 575 | }; |
| 634 | 576 | ||
| 635 | static struct clk virtual_ck_mpu = { | 577 | static struct omap1_clk virtual_ck_mpu = { |
| 636 | .name = "mpu", | 578 | /* Is smarter alias for arm_ck */ |
| 637 | .ops = &clkops_null, | 579 | .hw.init = CLK_HW_INIT("mpu", "arm_ck", &omap1_clk_rate_ops, 0), |
| 638 | .parent = &arm_ck, /* Is smarter alias for */ | ||
| 639 | .recalc = &followparent_recalc, | 580 | .recalc = &followparent_recalc, |
| 640 | .set_rate = &omap1_select_table_rate, | 581 | .set_rate = &omap1_select_table_rate, |
| 641 | .round_rate = &omap1_round_to_table_rate, | 582 | .round_rate = &omap1_round_to_table_rate, |
| @@ -643,20 +584,14 @@ static struct clk virtual_ck_mpu = { · 1 unmodified line | |||
| 643 | 584 | ||
| 644 | /* virtual functional clock domain for I2C. Just for making sure that ARMXOR_CK | 585 | /* virtual functional clock domain for I2C. Just for making sure that ARMXOR_CK |
| 645 | remains active during MPU idle whenever this is enabled */ | 586 | remains active during MPU idle whenever this is enabled */ |
| 646 | static struct clk i2c_fck = { | 587 | static struct omap1_clk i2c_fck = { |
| 647 | .name = "i2c_fck", | 588 | .hw.init = CLK_HW_INIT("i2c_fck", "armxor_ck", &omap1_clk_gate_ops, 0), |
| 648 | .ops = &clkops_null, | ||
| 649 | .flags = CLOCK_NO_IDLE_PARENT, | 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 = { | 592 | static struct omap1_clk i2c_ick = { |
| 655 | .name = "i2c_ick", | 593 | .hw.init = CLK_HW_INIT("i2c_ick", "armper_ck", &omap1_clk_gate_ops, 0), |
| 656 | .ops = &clkops_null, | ||
| 657 | .flags = CLOCK_NO_IDLE_PARENT, | 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 | static struct omap_clk omap_clks[] = { | 601 | static struct omap_clk omap_clks[] = { |
| 667 | /* non-ULPD clocks */ | 602 | /* non-ULPD clocks */ |
| 668 | CLK(NULL, "ck_ref", &ck_ref, CK_16XX | CK_1510 | CK_310 | CK_7XX), | 603 | CLK(NULL, "ck_ref", &ck_ref.hw, CK_16XX | CK_1510 | CK_310 | CK_7XX), |
| 669 | CLK(NULL, "ck_dpll1", &ck_dpll1, 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 | /* CK_GEN1 clocks */ | 605 | /* CK_GEN1 clocks */ |
| 671 | CLK(NULL, "ck_dpll1out", &ck_dpll1out.clk, CK_16XX), | 606 | CLK(NULL, "ck_dpll1out", &ck_dpll1out.clk.hw, CK_16XX), |
| 672 | CLK(NULL, "ck_sossi", &sossi_ck, CK_16XX), | 607 | CLK(NULL, "ck_sossi", &sossi_ck.hw, CK_16XX), |
| 673 | CLK(NULL, "arm_ck", &arm_ck, CK_16XX | CK_1510 | CK_310), | 608 | CLK(NULL, "arm_ck", &arm_ck.hw, CK_16XX | CK_1510 | CK_310), |
| 674 | CLK(NULL, "armper_ck", &armper_ck.clk, CK_16XX | CK_1510 | CK_310), | 609 | CLK(NULL, "armper_ck", &armper_ck.clk.hw, CK_16XX | CK_1510 | CK_310), |
| 675 | CLK("omap_gpio.0", "ick", &arm_gpio_ck, CK_1510 | CK_310), | 610 | CLK("omap_gpio.0", "ick", &arm_gpio_ck.hw, CK_1510 | CK_310), |
| 676 | CLK(NULL, "armxor_ck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX), | 611 | CLK(NULL, "armxor_ck", &armxor_ck.clk.hw, CK_16XX | CK_1510 | CK_310 | CK_7XX), |
| 677 | CLK(NULL, "armtim_ck", &armtim_ck.clk, CK_16XX | CK_1510 | CK_310), | 612 | CLK(NULL, "armtim_ck", &armtim_ck.clk.hw, CK_16XX | CK_1510 | CK_310), |
| 678 | CLK("omap_wdt", "fck", &armwdt_ck.clk, CK_16XX | CK_1510 | CK_310), | 613 | CLK("omap_wdt", "fck", &armwdt_ck.clk.hw, CK_16XX | CK_1510 | CK_310), |
| 679 | CLK("omap_wdt", "ick", &armper_ck.clk, CK_16XX), | 614 | CLK("omap_wdt", "ick", &armper_ck.clk.hw, CK_16XX), |
| 680 | CLK("omap_wdt", "ick", &dummy_ck, CK_1510 | CK_310), | 615 | CLK("omap_wdt", "ick", &dummy_ck.hw, CK_1510 | CK_310), |
| 681 | CLK(NULL, "arminth_ck", &arminth_ck1510, CK_1510 | CK_310), | 616 | CLK(NULL, "arminth_ck", &arminth_ck1510.hw, CK_1510 | CK_310), |
| 682 | CLK(NULL, "arminth_ck", &arminth_ck16xx, CK_16XX), | 617 | CLK(NULL, "arminth_ck", &arminth_ck16xx.hw, CK_16XX), |
| 683 | /* CK_GEN2 clocks */ | 618 | /* CK_GEN2 clocks */ |
| 684 | CLK(NULL, "dsp_ck", &dsp_ck, CK_16XX | CK_1510 | CK_310), | 619 | CLK(NULL, "dsp_ck", &dsp_ck.hw, CK_16XX | CK_1510 | CK_310), |
| 685 | CLK(NULL, "dspmmu_ck", &dspmmu_ck, CK_16XX | CK_1510 | CK_310), | 620 | CLK(NULL, "dspmmu_ck", &dspmmu_ck.hw, CK_16XX | CK_1510 | CK_310), |
| 686 | CLK(NULL, "dspper_ck", &dspper_ck, CK_16XX | CK_1510 | CK_310), | 621 | CLK(NULL, "dspper_ck", &dspper_ck.hw, CK_16XX | CK_1510 | CK_310), |
| 687 | CLK(NULL, "dspxor_ck", &dspxor_ck, CK_16XX | CK_1510 | CK_310), | 622 | CLK(NULL, "dspxor_ck", &dspxor_ck.hw, CK_16XX | CK_1510 | CK_310), |
| 688 | CLK(NULL, "dsptim_ck", &dsptim_ck, CK_16XX | CK_1510 | CK_310), | 623 | CLK(NULL, "dsptim_ck", &dsptim_ck.hw, CK_16XX | CK_1510 | CK_310), |
| 689 | /* CK_GEN3 clocks */ | 624 | /* CK_GEN3 clocks */ |
| 690 | CLK(NULL, "tc_ck", &tc_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX), | 625 | CLK(NULL, "tc_ck", &tc_ck.clk.hw, CK_16XX | CK_1510 | CK_310 | CK_7XX), |
| 691 | CLK(NULL, "tipb_ck", &tipb_ck, CK_1510 | CK_310), | 626 | CLK(NULL, "tipb_ck", &tipb_ck.hw, CK_1510 | CK_310), |
| 692 | CLK(NULL, "l3_ocpi_ck", &l3_ocpi_ck, CK_16XX | CK_7XX), | 627 | CLK(NULL, "l3_ocpi_ck", &l3_ocpi_ck.hw, CK_16XX | CK_7XX), |
| 693 | CLK(NULL, "tc1_ck", &tc1_ck, CK_16XX), | 628 | CLK(NULL, "tc1_ck", &tc1_ck.hw, CK_16XX), |
| 694 | CLK(NULL, "tc2_ck", &tc2_ck, CK_16XX), | 629 | CLK(NULL, "tc2_ck", &tc2_ck.hw, CK_16XX), |
| 695 | CLK(NULL, "dma_ck", &dma_ck, CK_16XX | CK_1510 | CK_310), | 630 | CLK(NULL, "dma_ck", &dma_ck.hw, CK_16XX | CK_1510 | CK_310), |
| 696 | CLK(NULL, "dma_lcdfree_ck", &dma_lcdfree_ck, CK_16XX), | 631 | CLK(NULL, "dma_lcdfree_ck", &dma_lcdfree_ck.hw, CK_16XX), |
| 697 | CLK(NULL, "api_ck", &api_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX), | 632 | CLK(NULL, "api_ck", &api_ck.clk.hw, CK_16XX | CK_1510 | CK_310 | CK_7XX), |
| 698 | CLK(NULL, "lb_ck", &lb_ck.clk, CK_1510 | CK_310), | 633 | CLK(NULL, "lb_ck", &lb_ck.clk.hw, CK_1510 | CK_310), |
| 699 | CLK(NULL, "rhea1_ck", &rhea1_ck, CK_16XX), | 634 | CLK(NULL, "rhea1_ck", &rhea1_ck.hw, CK_16XX), |
| 700 | CLK(NULL, "rhea2_ck", &rhea2_ck, CK_16XX), | 635 | CLK(NULL, "rhea2_ck", &rhea2_ck.hw, CK_16XX), |
| 701 | CLK(NULL, "lcd_ck", &lcd_ck_16xx, CK_16XX | CK_7XX), | 636 | CLK(NULL, "lcd_ck", &lcd_ck_16xx.hw, CK_16XX | CK_7XX), |
| 702 | CLK(NULL, "lcd_ck", &lcd_ck_1510.clk, CK_1510 | CK_310), | 637 | CLK(NULL, "lcd_ck", &lcd_ck_1510.clk.hw, CK_1510 | CK_310), |
| 703 | /* ULPD clocks */ | 638 | /* ULPD clocks */ |
| 704 | CLK(NULL, "uart1_ck", &uart1_1510, CK_1510 | CK_310), | 639 | CLK(NULL, "uart1_ck", &uart1_1510.hw, CK_1510 | CK_310), |
| 705 | CLK(NULL, "uart1_ck", &uart1_16xx.clk, CK_16XX), | 640 | CLK(NULL, "uart1_ck", &uart1_16xx.clk.hw, CK_16XX), |
| 706 | CLK(NULL, "uart1_ck", &uart1_7xx, CK_7XX), | 641 | CLK(NULL, "uart1_ck", &uart1_7xx.hw, CK_7XX), |
| 707 | CLK(NULL, "uart2_ck", &uart2_ck, CK_16XX | CK_1510 | CK_310), | 642 | CLK(NULL, "uart2_ck", &uart2_ck.hw, CK_16XX | CK_1510 | CK_310), |
| 708 | CLK(NULL, "uart2_ck", &uart2_7xx, CK_7XX), | 643 | CLK(NULL, "uart2_ck", &uart2_7xx.hw, CK_7XX), |
| 709 | CLK(NULL, "uart3_ck", &uart3_1510, CK_1510 | CK_310), | 644 | CLK(NULL, "uart3_ck", &uart3_1510.hw, CK_1510 | CK_310), |
| 710 | CLK(NULL, "uart3_ck", &uart3_16xx.clk, CK_16XX), | 645 | CLK(NULL, "uart3_ck", &uart3_16xx.clk.hw, CK_16XX), |
| 711 | CLK(NULL, "usb_clko", &usb_clko, CK_16XX | CK_1510 | CK_310), | 646 | CLK(NULL, "usb_clko", &usb_clko.hw, CK_16XX | CK_1510 | CK_310), |
| 712 | CLK(NULL, "usb_hhc_ck", &usb_hhc_ck1510, CK_1510 | CK_310), | 647 | CLK(NULL, "usb_hhc_ck", &usb_hhc_ck1510.hw, CK_1510 | CK_310), |
| 713 | CLK(NULL, "usb_hhc_ck", &usb_hhc_ck16xx, CK_16XX), | 648 | CLK(NULL, "usb_hhc_ck", &usb_hhc_ck16xx.hw, CK_16XX), |
| 714 | CLK(NULL, "usb_dc_ck", &usb_dc_ck, CK_16XX | CK_7XX), | 649 | CLK(NULL, "usb_dc_ck", &usb_dc_ck.hw, CK_16XX | CK_7XX), |
| 715 | CLK(NULL, "mclk", &mclk_1510, CK_1510 | CK_310), | 650 | CLK(NULL, "mclk", &mclk_1510.hw, CK_1510 | CK_310), |
| 716 | CLK(NULL, "mclk", &mclk_16xx, CK_16XX), | 651 | CLK(NULL, "mclk", &mclk_16xx.hw, CK_16XX), |
| 717 | CLK(NULL, "bclk", &bclk_1510, CK_1510 | CK_310), | 652 | CLK(NULL, "bclk", &bclk_1510.hw, CK_1510 | CK_310), |
| 718 | CLK(NULL, "bclk", &bclk_16xx, CK_16XX), | 653 | CLK(NULL, "bclk", &bclk_16xx.hw, CK_16XX), |
| 719 | CLK("mmci-omap.0", "fck", &mmc1_ck, CK_16XX | CK_1510 | CK_310), | 654 | CLK("mmci-omap.0", "fck", &mmc1_ck.hw, CK_16XX | CK_1510 | CK_310), |
| 720 | CLK("mmci-omap.0", "fck", &mmc3_ck, CK_7XX), | 655 | CLK("mmci-omap.0", "fck", &mmc3_ck.hw, CK_7XX), |
| 721 | CLK("mmci-omap.0", "ick", &armper_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX), | 656 | CLK("mmci-omap.0", "ick", &armper_ck.clk.hw, CK_16XX | CK_1510 | CK_310 | CK_7XX), |
| 722 | CLK("mmci-omap.1", "fck", &mmc2_ck, CK_16XX), | 657 | CLK("mmci-omap.1", "fck", &mmc2_ck.hw, CK_16XX), |
| 723 | CLK("mmci-omap.1", "ick", &armper_ck.clk, CK_16XX), | 658 | CLK("mmci-omap.1", "ick", &armper_ck.clk.hw, CK_16XX), |
| 724 | /* Virtual clocks */ | 659 | /* Virtual clocks */ |
| 725 | CLK(NULL, "mpu", &virtual_ck_mpu, CK_16XX | CK_1510 | CK_310), | 660 | CLK(NULL, "mpu", &virtual_ck_mpu.hw, CK_16XX | CK_1510 | CK_310), |
| 726 | CLK("omap_i2c.1", "fck", &i2c_fck, CK_16XX | CK_1510 | CK_310 | CK_7XX), | 661 | CLK("omap_i2c.1", "fck", &i2c_fck.hw, CK_16XX | CK_1510 | CK_310 | CK_7XX), |
| 727 | CLK("omap_i2c.1", "ick", &i2c_ick, CK_16XX), | 662 | CLK("omap_i2c.1", "ick", &i2c_ick.hw, CK_16XX), |
| 728 | CLK("omap_i2c.1", "ick", &dummy_ck, CK_1510 | CK_310 | CK_7XX), | 663 | CLK("omap_i2c.1", "ick", &dummy_ck.hw, CK_1510 | CK_310 | CK_7XX), |
| 729 | CLK("omap1_spi100k.1", "fck", &dummy_ck, CK_7XX), | 664 | CLK("omap1_spi100k.1", "fck", &dummy_ck.hw, CK_7XX), |
| 730 | CLK("omap1_spi100k.1", "ick", &dummy_ck, CK_7XX), | 665 | CLK("omap1_spi100k.1", "ick", &dummy_ck.hw, CK_7XX), |
| 731 | CLK("omap1_spi100k.2", "fck", &dummy_ck, CK_7XX), | 666 | CLK("omap1_spi100k.2", "fck", &dummy_ck.hw, CK_7XX), |
| 732 | CLK("omap1_spi100k.2", "ick", &dummy_ck, CK_7XX), | 667 | CLK("omap1_spi100k.2", "ick", &dummy_ck.hw, CK_7XX), |
| 733 | CLK("omap_uwire", "fck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310), | 668 | CLK("omap_uwire", "fck", &armxor_ck.clk.hw, CK_16XX | CK_1510 | CK_310), |
| 734 | CLK("omap-mcbsp.1", "ick", &dspper_ck, CK_16XX), | 669 | CLK("omap-mcbsp.1", "ick", &dspper_ck.hw, CK_16XX), |
| 735 | CLK("omap-mcbsp.1", "ick", &dummy_ck, CK_1510 | CK_310), | 670 | CLK("omap-mcbsp.1", "ick", &dummy_ck.hw, CK_1510 | CK_310), |
| 736 | CLK("omap-mcbsp.2", "ick", &armper_ck.clk, CK_16XX), | 671 | CLK("omap-mcbsp.2", "ick", &armper_ck.clk.hw, CK_16XX), |
| 737 | CLK("omap-mcbsp.2", "ick", &dummy_ck, CK_1510 | CK_310), | 672 | CLK("omap-mcbsp.2", "ick", &dummy_ck.hw, CK_1510 | CK_310), |
| 738 | CLK("omap-mcbsp.3", "ick", &dspper_ck, CK_16XX), | 673 | CLK("omap-mcbsp.3", "ick", &dspper_ck.hw, CK_16XX), |
| 739 | CLK("omap-mcbsp.3", "ick", &dummy_ck, CK_1510 | CK_310), | 674 | CLK("omap-mcbsp.3", "ick", &dummy_ck.hw, CK_1510 | CK_310), |
| 740 | CLK("omap-mcbsp.1", "fck", &dspxor_ck, CK_16XX | CK_1510 | CK_310), | 675 | CLK("omap-mcbsp.1", "fck", &dspxor_ck.hw, CK_16XX | CK_1510 | CK_310), |
| 741 | CLK("omap-mcbsp.2", "fck", &armper_ck.clk, CK_16XX | CK_1510 | CK_310), | 676 | CLK("omap-mcbsp.2", "fck", &armper_ck.clk.hw, CK_16XX | CK_1510 | CK_310), |
| 742 | CLK("omap-mcbsp.3", "fck", &dspxor_ck, 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 | /* By default all idlect1 clocks are allowed to idle */ | 713 | /* By default all idlect1 clocks are allowed to idle */ |
| 779 | arm_idlect1_mask = ~0; | 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 | cpu_mask = 0; | 716 | cpu_mask = 0; |
| 785 | if (cpu_is_omap1710()) | 717 | if (cpu_is_omap1710()) |
| 786 | cpu_mask |= CK_1710; | 718 | cpu_mask |= CK_1710; |
| @@ -793,16 +725,10 @@ int __init omap1_clk_init(void) · 6 unmodified lines | |||
| 793 | if (cpu_is_omap310()) | 725 | if (cpu_is_omap310()) |
| 794 | cpu_mask |= CK_310; | 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 | /* Pointers to these clocks are needed by code in clock.c */ | 728 | /* Pointers to these clocks are needed by code in clock.c */ |
| 803 | api_ck_p = clk_get(NULL, "api_ck"); | 729 | api_ck_p = &api_ck.clk; |
| 804 | ck_dpll1_p = clk_get(NULL, "ck_dpll1"); | 730 | ck_dpll1_p = &ck_dpll1; |
| 805 | ck_ref_p = clk_get(NULL, "ck_ref"); | 731 | ck_ref_p = &ck_ref; |
| 806 | 732 | ||
| 807 | if (cpu_is_omap7xx()) | 733 | if (cpu_is_omap7xx()) |
| 808 | ck_ref.rate = 13000000; | 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); | 773 | |
| 848 | /* Cache rates for clocks connected to ck_ref (not dpll1) */ | ||
| 849 | propagate_rate(&ck_ref); | ||
| 850 | omap1_show_rates(); | ||
| 851 | if (machine_is_omap_perseus2() || machine_is_omap_fsample()) { | 774 | if (machine_is_omap_perseus2() || machine_is_omap_fsample()) { |
| 852 | /* Select slicer output as OMAP input clock */ | 775 | /* Select slicer output as OMAP input clock */ |
| 853 | omap_writew(omap_readw(OMAP7XX_PCC_UPLD_CTRL) & ~0x1, | 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 | omap_writew(0x0000, ARM_IDLECT2); /* Turn LCD clock off also */ | 803 | omap_writew(0x0000, ARM_IDLECT2); /* Turn LCD clock off also */ |
| 881 | 804 | ||
| 882 | /* | 805 | for (c = omap_clks; c < omap_clks + ARRAY_SIZE(omap_clks); c++) { |
| 883 | * Only enable those clocks we will need, let the drivers | 806 | if (!(c->cpu & cpu_mask)) |
| 884 | * enable other clocks as necessary | 807 | continue; |
| 885 | */ | 808 | |
| 886 | clk_enable(&armper_ck.clk); | 809 | if (c->lk.clk_hw->init) { /* NULL if provider already registered */ |
| 887 | clk_enable(&armxor_ck.clk); | 810 | const struct clk_init_data *init = c->lk.clk_hw->init; |
| 888 | clk_enable(&armtim_ck.clk); /* This should be done by timer code */ | 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()) | 826 | omap1_show_rates(); |
| 891 | clk_enable(&arm_gpio_ck); | ||
| 892 | 827 | ||
| 893 | return 0; | 828 | return 0; |
| 894 | } | 829 | } |
| @@ -900,7 +835,7 @@ void __init omap1_clk_late_init(void) · 5 unmodified lines | |||
| 900 | unsigned long rate = ck_dpll1.rate; | 835 | unsigned long rate = ck_dpll1.rate; |
| 901 | 836 | ||
| 902 | /* Find the highest supported frequency and enable it */ | 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 | pr_err("System frequencies not set, using default. Check your config.\n"); | 839 | pr_err("System frequencies not set, using default. Check your config.\n"); |
| 905 | /* | 840 | /* |
| 906 | * Reprogramming the DPLL is tricky, it must be done from SRAM. | 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 | #define OMAP1_IO_OFFSET 0x00f00000 /* Virtual IO = 0xff0b0000 */ | 64 | #define OMAP1_IO_OFFSET 0x00f00000 /* Virtual IO = 0xff0b0000 */ |
| 65 | #define OMAP1_IO_ADDRESS(pa) IOMEM((pa) - OMAP1_IO_OFFSET) | 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 | #include <asm/mach/map.h> | 15 | #include <asm/mach/map.h> |
| 16 | 16 | ||
| 17 | #include "tc.h" | 17 | #include "tc.h" |
| 18 | #include "mux.h" | ||
| 19 | #include "iomap.h" | 18 | #include "iomap.h" |
| 20 | #include "common.h" | 19 | #include "common.h" |
| 21 | #include "clock.h" | ||
| 22 | 20 | ||
| 23 | /* | 21 | /* |
| 24 | * The machine specific code may provide the extra mapping besides the | 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 | omap_writew(0x0, MPU_PUBLIC_TIPB_CNTL); | 124 | omap_writew(0x0, MPU_PUBLIC_TIPB_CNTL); |
| 127 | omap_writew(0x0, MPU_PRIVATE_TIPB_CNTL); | 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 | void __init omap1_init_late(void) | 128 | void __init omap1_init_late(void) |
| @@ -19,8 +19,7 @@ · 18 unmodified lines | |||
| 19 | 19 | ||
| 20 | #include <asm/mach-types.h> | 20 | #include <asm/mach-types.h> |
| 21 | 21 | ||
| 22 | #include <mach/serial.h> | 22 | #include "serial.h" |
| 23 | |||
| 24 | #include "mux.h" | 23 | #include "mux.h" |
| 25 | #include "pm.h" | 24 | #include "pm.h" |
| 26 | #include "soc.h" | 25 | #include "soc.h" |
File renamed without changes.
| @@ -51,8 +51,10 @@ · 50 unmodified lines | |||
| 51 | #include <asm/mach/time.h> | 51 | #include <asm/mach/time.h> |
| 52 | 52 | ||
| 53 | #include "hardware.h" | 53 | #include "hardware.h" |
| 54 | #include "mux.h" | ||
| 54 | #include "iomap.h" | 55 | #include "iomap.h" |
| 55 | #include "common.h" | 56 | #include "common.h" |
| 57 | #include "clock.h" | ||
| 56 | 58 | ||
| 57 | #ifdef CONFIG_OMAP_MPU_TIMER | 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 | void __init omap1_timer_init(void) | 227 | void __init omap1_timer_init(void) |
| 226 | { | 228 | { |
| 229 | omap1_clk_init(); | ||
| 230 | omap1_mux_init(); | ||
| 231 | |||
| 227 | if (omap_32k_timer_init() != 0) | 232 | if (omap_32k_timer_init() != 0) |
| 228 | omap_mpu_timer_init(); | 233 | omap_mpu_timer_init(); |
| 229 | } | 234 | } |