OMAP clock, A of F: preliminaries
Subsystems (6)
Paul Walmsley
maintainercover OMAP clock, A of F: preliminaries
This series A is the first of six to bring the mainline kernel OMAP clock code up-to-date with the linux-omap tree.
Major changes in this series:
. Clean up sparse, checkpatch issues in PM code . Synchronize clock tree with what is on the hardware . Add DPLL programming code
. Use PRCM rates for CPUfreq
Some patches have been "compressed" together, as requested by rmk - original commit IDs are in the patch descriptions.
Compile-tested on OSK5912 (OMAP1), H4 and 2430SDP (OMAP2), and BeagleBoard (OMAP3). Boot-tested on 2430SDP and BeagleBoard.
Applies on 5ee810072175042775e39bdd3eaaa68884c27805.
- Paul
---
Daniel Stone (1):
OMAP2: Fix definition of SGX clock register bits
Kevin Hilman (1):
OMAP2: Implement CPUfreq frequency table based on PRCM table
Paul Walmsley (6):
OMAP: Make dpll4_m4_ck programmable with clk_set_rate()
OMAP3 clock: fix 96MHz clocks
OMAP3: move USBHOST SAR handling from clock framework to powerdomain layer OMAP24xx clock: add missing SSI L4 interface clock
OMAP: Fix sparse, checkpatch warnings in OMAP2/3 PRCM/PM code OMAP2/3: Add non-CORE DPLL rate set code and M,N programming
Sergio Aguirre (1):
OMAP: Add CSI2 clock struct for handling it with clock API.
Tony Lindgren (1):
OMAP2/3: Remove OMAP_PRM_REGADDR, OMAP_CM_REGADDR
arch/arm/mach-omap2/clock.c | 83 ++-- arch/arm/mach-omap2/clock.h | 2 arch/arm/mach-omap2/clock24xx.c | 145 +++++-- arch/arm/mach-omap2/clock24xx.h | 335 +++++++++------- arch/arm/mach-omap2/clock34xx.c | 141 +++++++ arch/arm/mach-omap2/clock34xx.h | 516 +++++++++++++------------ arch/arm/mach-omap2/cm-regbits-34xx.h | 25 + arch/arm/mach-omap2/cm.h | 17 - arch/arm/mach-omap2/memory.c | 3 arch/arm/mach-omap2/pm.c | 2 arch/arm/mach-omap2/powerdomains34xx.h | 1 arch/arm/mach-omap2/prm-regbits-34xx.h | 9 arch/arm/mach-omap2/prm.h | 166 ++++---- arch/arm/mach-omap2/sram242x.S | 5 arch/arm/mach-omap2/sram243x.S | 5 arch/arm/plat-omap/common.c | 1 arch/arm/plat-omap/cpu-omap.c | 57 +++ arch/arm/plat-omap/include/mach/clock.h | 11 - arch/arm/plat-omap/include/mach/common.h | 5 arch/arm/plat-omap/include/mach/powerdomain.h | 1 arch/arm/plat-omap/include/mach/prcm.h | 5 arch/arm/plat-omap/include/mach/system.h | 4 22 files changed, 949 insertions(+), 590 deletions(-)
text data bss dec hex filename
3240479 164160 100912 3505551 357d8f vmlinux.beagle.orig 3241423 164192 100912 3506527 35815f vmlinux.beagle
Paul Walmsley
maintainerPATCH 1/10 OMAP2/3: Add non-CORE DPLL rate set code and M, N programming
Add non-CORE DPLL rate set code and M,N programming for OMAP3. Connect it to OMAP34xx DPLLs 1, 2, 4, 5 via the clock framework.
You may see some warnings on rate sets from the freqsel code. The table that TI presented in the 3430 TRM Rev F does not cover Fint < 750000, which definitely occurs in practice. However, the lack of this freqsel case does not appear to impair the DPLL rate change.
linux-omap source commit is 689fe67c6d1ad8f52f7f7b139a3274b79bf3e784.
--- arch/arm/mach-omap2/clock34xx.c | 141 +++++++++++++++++++++++++++++++ arch/arm/mach-omap2/clock34xx.h | 10 ++ arch/arm/plat-omap/include/mach/clock.h | 1 3 files changed, 151 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/clock34xx.c +140 -1
@@ -104,6 +104,42 @@ static int _omap3_wait_dpll_status(struct clk *clk, u8 state)return ret; } +/* From 3430 TRM ES2 4.7.6.2 */ +static u16 _omap3_dpll_compute_freqsel (struct clk *clk,u8 n) +{ +unsigned long fint; +u16 f =0 ; + + fint = clk->parent->rate / (n +1 ); + +pr_debug ("clock: fint is %lu\n" , fint); + +if (fint >=750000 && fint <=1000000 ) + f =0x3 ; +else if (fint >1000000 && fint <=1250000 ) + f =0x4 ; +else if (fint >1250000 && fint <=1500000 ) + f =0x5 ; +else if (fint >1500000 && fint <=1750000 ) + f =0x6 ; +else if (fint >1750000 && fint <=2100000 ) + f =0x7 ; +else if (fint >7500000 && fint <=10000000 ) + f =0xB ; +else if (fint >10000000 && fint <=12500000 ) + f =0xC ; +else if (fint >12500000 && fint <=15000000 ) + f =0xD ; +else if (fint >15000000 && fint <=17500000 ) + f =0xE ; +else if (fint >17500000 && fint <=21000000 ) + f =0xF ; +else +pr_debug ("clock: unknown freqsel setting for %d\n" , n); + +return f; +} +/* Non-CORE DPLL (e.g., DPLLs that do not control SDRC) clock functions */ /*
@@ -240,7 +276,7 @@ static int omap3_noncore_dpll_enable(struct clk *clk)if (clk == &dpll3_ck)return -EINVAL ; -if (clk->parent->rate ==clk_get_rate (clk)) +if (clk->parent->rate ==omap2_get_dpll_rate (clk)) r =_omap3_noncore_dpll_bypass (clk);else r =_omap3_noncore_dpll_lock (clk);
@@ -270,6 +306,109 @@ static void omap3_noncore_dpll_disable(struct clk *clk)_omap3_noncore_dpll_stop (clk); } + +/* Non-CORE DPLL rate set code */ + +/* +* omap3_noncore_dpll_program - set non-core DPLL M,N values directly +* @clk: struct clk * of DPLL to set +* @m: DPLL multiplier to set +* @n: DPLL divider to set +* @freqsel: FREQSEL value to set +* +* Program the DPLL with the supplied M, N values, and wait for the DPLL to +* lock.. Returns -EINVAL upon error, or 0 upon success. +*/ +static int omap3_noncore_dpll_program (struct clk *clk,u16 m,u8 n,u16 freqsel) +{ +struct dpll_data *dd; +u32 v; + +if (!clk) +return -EINVAL ; + + dd = clk->dpll_data; +if (!dd) +return -EINVAL ; + +/* +* According to the 12-5 CDP code from TI, "Limitation 2.5" +* on 3430ES1 prevents us from changing DPLL multipliers or dividers +* on DPLL4. +*/ +if (omap_rev () ==OMAP3430_REV_ES1_0 && + !strcmp ("dpll4_ck" , clk->name)) { +printk (KERN_ERR "clock: DPLL4 cannot change rate due to " +"silicon 'Limitation 2.5' on 3430ES1.\n" ); +return -EINVAL ; + } + +/* 3430 ES2 TRM: 4.7.6.9 DPLL Programming Sequence */ +_omap3_noncore_dpll_bypass (clk); + + v =__raw_readl (dd->mult_div1_reg); + v &= ~(dd->mult_mask | dd->div1_mask); + +/* Set mult (M), div1 (N), freqsel */ + v |= m <<__ffs (dd->mult_mask); + v |= n <<__ffs (dd->div1_mask); + v |= freqsel <<__ffs (dd->freqsel_mask); + +__raw_writel (v, dd->mult_div1_reg); + +/* We let the clock framework set the other output dividers later */ + +/* REVISIT: Set ramp-up delay? */ + +_omap3_noncore_dpll_lock (clk); + +return 0 ; +} + +/** +* omap3_noncore_dpll_set_rate - set non-core DPLL rate +* @clk: struct clk * of DPLL to set +* @rate: rounded target rate +* +* Program the DPLL with the rounded target rate. Returns -EINVAL upon +* error, or 0 upon success. +*/ +static int omap3_noncore_dpll_set_rate (struct clk *clk,unsigned long rate) +{ +u16 freqsel; +struct dpll_data *dd; + +if (!clk || !rate) +return -EINVAL ; + + dd = clk->dpll_data; +if (!dd) +return -EINVAL ; + +if (rate ==omap2_get_dpll_rate (clk)) +return 0 ; + +if (dd->last_rounded_rate != rate) +omap2_dpll_round_rate (clk, rate); + +if (dd->last_rounded_rate ==0 ) +return -EINVAL ; + + freqsel =_omap3_dpll_compute_freqsel (clk, dd->last_rounded_n); +if (!freqsel) +WARN_ON (1 ); + +omap3_noncore_dpll_program (clk, dd->last_rounded_m, dd->last_rounded_n, + freqsel); + +omap3_dpll_recalc (clk); + +return 0 ; +} + +/* DPLL autoidle read/set code */ + +/** * omap3_dpll_autoidle_read - read a DPLL's autoidle bits * @clk: struct clk * of the DPLL to read
arch/arm/mach-omap2/clock34xx.h +10 -0
@@ -34,6 +34,7 @@ static void omap3_dpll_deny_idle(struct clk *clk);static u32 omap3_dpll_autoidle_read (struct clk *clk);static int omap3_noncore_dpll_enable (struct clk *clk);static void omap3_noncore_dpll_disable (struct clk *clk); +static int omap3_noncore_dpll_set_rate (struct clk *clk,unsigned long rate);/* Maximum DPLL multiplier, divider values for OMAP3 */ #define OMAP3_MAX_DPLL_MULT 2048
@@ -263,6 +264,7 @@ static struct dpll_data dpll1_dd = { .mult_div1_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL), .mult_mask = OMAP3430_MPU_DPLL_MULT_MASK, .div1_mask = OMAP3430_MPU_DPLL_DIV_MASK, + .freqsel_mask = OMAP3430_MPU_DPLL_FREQSEL_MASK, .control_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKEN_PLL), .enable_mask = OMAP3430_EN_MPU_DPLL_MASK, .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
@@ -284,6 +286,7 @@ static struct clk dpll1_ck = { .dpll_data = &dpll1_dd, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, .round_rate = &omap2_dpll_round_rate, + .set_rate = &omap3_noncore_dpll_set_rate, .recalc = &omap3_dpll_recalc, };
@@ -329,6 +332,7 @@ static struct dpll_data dpll2_dd = { .mult_div1_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL), .mult_mask = OMAP3430_IVA2_DPLL_MULT_MASK, .div1_mask = OMAP3430_IVA2_DPLL_DIV_MASK, + .freqsel_mask = OMAP3430_IVA2_DPLL_FREQSEL_MASK, .control_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKEN_PLL), .enable_mask = OMAP3430_EN_IVA2_DPLL_MASK, .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED) |
@@ -353,6 +357,7 @@ static struct clk dpll2_ck = { .enable = &omap3_noncore_dpll_enable, .disable = &omap3_noncore_dpll_disable, .round_rate = &omap2_dpll_round_rate, + .set_rate = &omap3_noncore_dpll_set_rate, .recalc = &omap3_dpll_recalc, };
@@ -387,6 +392,7 @@ static struct dpll_data dpll3_dd = { .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), .mult_mask = OMAP3430_CORE_DPLL_MULT_MASK, .div1_mask = OMAP3430_CORE_DPLL_DIV_MASK, + .freqsel_mask = OMAP3430_CORE_DPLL_FREQSEL_MASK, .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), .enable_mask = OMAP3430_EN_CORE_DPLL_MASK, .auto_recal_bit = OMAP3430_EN_CORE_DPLL_DRIFTGUARD_SHIFT,
@@ -565,6 +571,7 @@ static struct dpll_data dpll4_dd = { .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL2), .mult_mask = OMAP3430_PERIPH_DPLL_MULT_MASK, .div1_mask = OMAP3430_PERIPH_DPLL_DIV_MASK, + .freqsel_mask = OMAP3430_PERIPH_DPLL_FREQSEL_MASK, .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), .enable_mask = OMAP3430_EN_PERIPH_DPLL_MASK, .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
@@ -588,6 +595,7 @@ static struct clk dpll4_ck = { .enable = &omap3_noncore_dpll_enable, .disable = &omap3_noncore_dpll_disable, .round_rate = &omap2_dpll_round_rate, + .set_rate = &omap3_noncore_dpll_set_rate, .recalc = &omap3_dpll_recalc, };
@@ -867,6 +875,7 @@ static struct dpll_data dpll5_dd = { .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL4), .mult_mask = OMAP3430ES2_PERIPH2_DPLL_MULT_MASK, .div1_mask = OMAP3430ES2_PERIPH2_DPLL_DIV_MASK, + .freqsel_mask = OMAP3430ES2_PERIPH2_DPLL_FREQSEL_MASK, .control_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKEN2), .enable_mask = OMAP3430ES2_EN_PERIPH2_DPLL_MASK, .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
@@ -890,6 +899,7 @@ static struct clk dpll5_ck = { .enable = &omap3_noncore_dpll_enable, .disable = &omap3_noncore_dpll_disable, .round_rate = &omap2_dpll_round_rate, + .set_rate = &omap3_noncore_dpll_set_rate, .recalc = &omap3_dpll_recalc, };
arch/arm/plat-omap/include/mach/clock.h +1 -0
@@ -42,6 +42,7 @@ struct dpll_data {u8 max_divider;u32 max_tolerance;# if defined(CONFIG_ARCH_OMAP3 ) +u32 freqsel_mask;u8 modes;void __iomem *control_reg;u32 enable_mask;
Re: [PATCH A 01/10] OMAP2/3: Add non-CORE DPLL rate set code and M, N programming
Since it's been posted to lists, comments are going to be made...
arch/arm/mach-omap2/clock34xx.c static void omap3_noncore_dpll_disable(struct clk *clk) · line 344
Quoted 11 lines · Paul Walmsley
arch/arm/mach-omap2/clock34xx.c +11
-0+/* +* According to the 12-5 CDP code from TI, "Limitation 2.5" +* on 3430ES1 prevents us from changing DPLL multipliers or dividers +* on DPLL4. +*/ +if (omap_rev () ==OMAP3430_REV_ES1_0 && + !strcmp ("dpll4_ck" , clk->name)) { +printk (KERN_ERR "clock: DPLL4 cannot change rate due to " +"silicon 'Limitation 2.5' on 3430ES1.\n" ); +return -EINVAL ; + }
Yuck. That's revolting and extremely fragile. Don't play these games. You've got plenty of free flag bits in clk->flags which could be used to prevent the DPLL from being changed. You've also got other ways to prevent it - eg, setting dpll_data to NULL.
To do exception handling based on strcmp(), or even worse register offset and bit position (as is done elsewhere in the OMAP code) is utterly insane.
However, what's worse is that, below...
Quoted 17 lines
arch/arm/mach-omap2/clock34xx.c +17
-0+static int omap3_noncore_dpll_set_rate (struct clk *clk,unsigned long rate) +{ +u16 freqsel; +struct dpll_data *dd; + +if (!clk || !rate) +return -EINVAL ; + + dd = clk->dpll_data; +if (!dd) +return -EINVAL ; + +if (rate ==omap2_get_dpll_rate (clk)) +return 0 ; + +if (dd->last_rounded_rate != rate) +omap2_dpll_round_rate (clk, rate);
arch/arm/mach-omap2/clock34xx.c static void omap3_noncore_dpll_disable(struct clk *clk) · line 402
Quoted 10 lines
arch/arm/mach-omap2/clock34xx.c +10
-0+ +if (dd->last_rounded_rate ==0 ) +return -EINVAL ; + + freqsel =_omap3_dpll_compute_freqsel (clk, dd->last_rounded_n); +if (!freqsel) +WARN_ON (1 ); + +omap3_noncore_dpll_program (clk, dd->last_rounded_m, dd->last_rounded_n, + freqsel);
The return value from the above test isn't checked, so this function will succeed even for dpll4_ck.
Re: [PATCH A 01/10] OMAP2/3: Add non-CORE DPLL rate set code and M, N programming
Quoted 20 lines · Russell King - ARM Linux
Since it's been posted to lists, comments are going to be made...
arch/arm/mach-omap2/clock34xx.c static void omap3_noncore_dpll_disable(struct clk *clk) · line 344
Quoted 11 lines · Paul Walmsley
arch/arm/mach-omap2/clock34xx.c +11
-0+/* +* According to the 12-5 CDP code from TI, "Limitation 2.5" +* on 3430ES1 prevents us from changing DPLL multipliers or dividers +* on DPLL4. +*/ +if (omap_rev () ==OMAP3430_REV_ES1_0 && + !strcmp ("dpll4_ck" , clk->name)) { +printk (KERN_ERR "clock: DPLL4 cannot change rate due to " +"silicon 'Limitation 2.5' on 3430ES1.\n" ); +return -EINVAL ; + }Yuck. That's revolting and extremely fragile. Don't play these games. You've got plenty of free flag bits in
clk->flagswhich could be used to prevent the DPLL from being changed. You've also got other ways to prevent it - eg, settingdpll_datato NULL.
Quoted 2 lines
To do exception handling based on
strcmp(), or even worse register offset and bit position (as is done elsewhere in the OMAP code) is utterly insane.
To further expand on this point, this patch also has:
@@ -588,6 +595,7 @@ static struct clk dpll4_ck = {
.enable = &omap3_noncore_dpll_enable,
.disable = &omap3_noncore_dpll_disable,
.round_rate = &omap2_dpll_round_rate,
+ .set_rate = &omap3_noncore_dpll_set_rate,
.recalc = &omap3_dpll_recalc,};
We can handle this exception by replacing that set_rate function with one which knows about this explicit quirk for this clock. In other words, rather than having that strcmp(), the following would be a much better way to handle this exception:
static int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate)
{
if (omap_rev() == OMAP3430_REV_ES1_0) {
printk(KERN_ERR "clock: DPLL4 cannot change rate due to "
"silicon 'Limitation 2.5' on 3430ES1.\n");
return -EINVAL;
}
return omap3_noncore_dpll_set_rate(clk, rate);
}Paul Walmsley
maintainerRe: [PATCH A 01/10] OMAP2/3: Add non-CORE DPLL rate set code and M, N programming
In reply to Russell King - ARM LinuxHello Russell,
Quoted 1 line · Russell King - ARM Linux
Since it's been posted to lists, comments are going to be made...
Yes, that was the point.
Quoted 9 lines · Paul Walmsley
Quoted 8 lines
arch/arm/mach-omap2/clock34xx.c +8
-0+/* +* According to the 12-5 CDP code from TI, "Limitation 2.5" +* on 3430ES1 prevents us from changing DPLL multipliers or dividers +* on DPLL4. +*/ +if (omap_rev () ==OMAP3430_REV_ES1_0 && + !strcmp ("dpll4_ck" , clk->name)) { + printk(KERN_ERR "clock: DPLL4 cannot change rate due to "
Quoted 8 lines
arch/arm/mach-omap2/clock34xx.c static void omap3_noncore_dpll_disable(struct clk *clk) · line 344
Quoted 3 lines
arch/arm/mach-omap2/clock34xx.c +3
-0+ "silicon 'Limitation 2.5' on 3430ES1.\n"); +return -EINVAL ; + }Yuck. That's revolting and extremely fragile. Don't play these games. You've got plenty of free flag bits in
clk->flagswhich could be used to prevent the DPLL from being changed. You've also got other ways to prevent it - eg, settingdpll_datato NULL.
dpll_data is used for other DPLL register settings (such as autoidle and mode setting), so we should probably leave dpll_data as-is. Your proposed fix in your subsequent message sounds good (viz., adding a separate static omap3_dpll4_set_rate() function).
Quoted 4 lines
However, what's worse is that, below...
Quoted 2 lines
arch/arm/mach-omap2/clock34xx.c +2
-0+static int omap3_noncore_dpll_set_rate (struct clk *clk,unsigned long rate) +{
...
Quoted 5 lines
arch/arm/mach-omap2/clock34xx.c static void omap3_noncore_dpll_disable(struct clk *clk) · line 402
Quoted 2 lines
arch/arm/mach-omap2/clock34xx.c +2
-0+omap3_noncore_dpll_program (clk, dd->last_rounded_m, dd->last_rounded_n, + freqsel);The return value from the above test isn't checked, so this function will succeed even for
dpll4_ck.
Indeed, the return value should be passed along to the caller. The previous check does, however, prevent the DPLL4 registers from being written on 3430ES1.
Quoted 1 line
From your subsequent message, it sounds like you've merged a version of
this patch with your proposed fixes. Please let me know if you'd like me to send an updated version of this patch anyway.
- Paul
Re: [PATCH A 01/10] OMAP2/3: Add non-CORE DPLL rate set code and M, N programming
In reply to Paul WalmsleyQuoted 13 lines · Paul Walmsley
arch/arm/mach-omap2/clock34xx.c +13
-0+/* Non-CORE DPLL rate set code */ + +/* +* omap3_noncore_dpll_program - set non-core DPLL M,N values directly +* @clk: struct clk * of DPLL to set +* @m: DPLL multiplier to set +* @n: DPLL divider to set +* @freqsel: FREQSEL value to set +* +* Program the DPLL with the supplied M, N values, and wait for the DPLL to +* lock.. Returns -EINVAL upon error, or 0 upon success. +*/ +static int omap3_noncore_dpll_program (struct clk *clk,u16 m,u8 n,u16 freqsel)
arch/arm/mach-omap2/clock34xx.c static void omap3_noncore_dpll_disable(struct clk *clk) · line 332
Quoted 10 lines
arch/arm/mach-omap2/clock34xx.c +10
-0+{ +struct dpll_data *dd; +u32 v; + +if (!clk) +return -EINVAL ; + + dd = clk->dpll_data; +if (!dd) +return -EINVAL ;
Final point... this is only called from the function below, which also checks that clk and clk->dpll_data are both non-NULL. So these checks are unnecessary.
Quoted 32 lines
arch/arm/mach-omap2/clock34xx.c +32
-0+static int omap3_noncore_dpll_set_rate (struct clk *clk,unsigned long rate) +{ +u16 freqsel; +struct dpll_data *dd; + +if (!clk || !rate) +return -EINVAL ; + + dd = clk->dpll_data; +if (!dd) +return -EINVAL ; + +if (rate ==omap2_get_dpll_rate (clk)) +return 0 ; + +if (dd->last_rounded_rate != rate) +omap2_dpll_round_rate (clk, rate); + +if (dd->last_rounded_rate ==0 ) +return -EINVAL ; + + freqsel =_omap3_dpll_compute_freqsel (clk, dd->last_rounded_n); +if (!freqsel) +WARN_ON (1 ); + +omap3_noncore_dpll_program (clk, dd->last_rounded_m, dd->last_rounded_n, + freqsel); + +omap3_dpll_recalc (clk); + +return 0 ; +}
Paul Walmsley
maintainerRe: [PATCH A 01/10] OMAP2/3: Add non-CORE DPLL rate set code and M, N programming
Quoted 20 lines · Russell King - ARM Linux
Quoted 19 lines · Paul Walmsley
arch/arm/mach-omap2/clock34xx.c +19
-0+/* Non-CORE DPLL rate set code */ + +/* +* omap3_noncore_dpll_program - set non-core DPLL M,N values directly +* @clk: struct clk * of DPLL to set +* @m: DPLL multiplier to set +* @n: DPLL divider to set +* @freqsel: FREQSEL value to set +* +* Program the DPLL with the supplied M, N values, and wait for the DPLL to +* lock.. Returns -EINVAL upon error, or 0 upon success. +*/ +static int omap3_noncore_dpll_program (struct clk *clk,u16 m,u8 n,u16 freqsel) +{ +struct dpll_data *dd; +u32 v; + +if (!clk) +return -EINVAL ;
Quoted 8 lines
arch/arm/mach-omap2/clock34xx.c static void omap3_noncore_dpll_disable(struct clk *clk) · line 332
Quoted 4 lines
arch/arm/mach-omap2/clock34xx.c +4
-0+ + dd = clk->dpll_data; +if (!dd) +return -EINVAL ;Final point... this is only called from the function below, which also checks that clk and
clk->dpll_dataare both non-NULL. So these checks are unnecessary.
Okay. Do you want to take care of that in your merged version of this patch, or would you like me to send an updated version, along with that custom dpll4 set_rate function?
- Paul
Re: [PATCH A 01/10] OMAP2/3: Add non-CORE DPLL rate set code and M, N programming
Quoted 8 lines · Paul Walmsley
Quoted 3 lines · Russell King - ARM Linux
Final point... this is only called from the function below, which also checks that clk and
clk->dpll_dataare both non-NULL. So these checks are unnecessary.Okay. Do you want to take care of that in your merged version of this patch, or would you like me to send an updated version, along with that custom dpll4
set_ratefunction?
No thanks, I've already taken care of these - both were simple to address.
Paul Walmsley
maintainerPATCH 2/10 OMAP: Fix sparse, checkpatch warnings in OMAP2/3 PRCM/PM code
In reply to Paul WalmsleyFix sparse & checkpatch warnings in OMAP2/3 PRCM & PM code. This mostly consists of:
- converting pointer comparisons to integers in form similar to (ptr == 0) to the standard idiom (!ptr)
- labeling a few non-static private functions as static
- adding prototypes for *_init() functions in the appropriate header files, and getting rid of the corresponding open-coded extern prototypes in other C files
- renaming the variable 'sclk' in mach-omap2/clock.c:omap2_get_apll_clkin to avoid shadowing an earlier declaration
Clean up checkpatch issues. This mostly involves:
- converting some asm/ includes to linux/ includes
- cleaning up some whitespace
- getting rid of braces for conditionals with single following statements
Also take care of a few odds and ends, including:
- getting rid of unlikely() and likely() - none of this code is particularly fast-path code, so the performance impact seems slim; and some of those likely() and unlikely() indicators are probably not as accurate as the ARM's branch predictor
- removing some superfluous casts
linux-omap source commit is 347df59f5d20fdf905afbc26b1328b0e28a8a01b.
--- arch/arm/mach-omap2/clock.c | 61 ++++++++++++------------- arch/arm/mach-omap2/clock.h | 2 - arch/arm/mach-omap2/clock24xx.c | 16 ++++--- arch/arm/mach-omap2/pm.c | 2 - arch/arm/plat-omap/include/mach/clock.h | 4 +- arch/arm/plat-omap/include/mach/powerdomain.h | 1 arch/arm/plat-omap/include/mach/prcm.h | 5 +- arch/arm/plat-omap/include/mach/system.h | 4 +- 8 files changed, 49 insertions(+), 46 deletions(-)
arch/arm/mach-omap2/clock.c +30 -31
@@ -26,7 +26,6 @@#include <mach/clock.h> #include <mach/clockdomain.h> -#include <mach/sram.h> #include <mach/cpu.h> #include <asm/div64.h>
@@ -190,11 +189,10 @@ int omap2_wait_clock_ready(void __iomem *reg, u32 mask, const char *name)* 24xx uses 0 to indicate not ready, and 1 to indicate ready. * 34xx reverses this, just to keep us on our toes */ -if (cpu_mask & (RATE_IN_242X |RATE_IN_243X )) { +if (cpu_mask & (RATE_IN_242X |RATE_IN_243X )) ena = mask; - }else if (cpu_mask &RATE_IN_343X ) { +else if (cpu_mask &RATE_IN_343X ) ena =0 ; - }/* Wait for lock */ while (((__raw_readl(reg) & mask) != ena) &&
@@ -267,7 +265,7 @@ static void omap2_clk_wait_ready(struct clk *clk)/* Enables clock without considering parent dependencies or use count * REVISIT: Maybe change this to use clk->enable like on omap1? */ -int _omap2_clk_enable (struct clk *clk) +static int _omap2_clk_enable (struct clk *clk) {u32 regval32;
@@ -277,7 +275,7 @@ int _omap2_clk_enable(struct clk *clk)if (clk->enable)return clk->enable (clk); -if (unlikely (clk->enable_reg ==NULL )) { +if (!clk->enable_reg) {printk (KERN_ERR "clock.c: Enable for %s without enable code\n" , clk->name);return 0 ;/* REVISIT: -EINVAL */
@@ -297,7 +295,7 @@ int _omap2_clk_enable(struct clk *clk) }/* Disables clock without considering parent dependencies or use count */ -void _omap2_clk_disable (struct clk *clk) +static void _omap2_clk_disable (struct clk *clk) {u32 regval32;
@@ -309,7 +307,7 @@ void _omap2_clk_disable(struct clk *clk)return ; } -if (clk->enable_reg ==NULL ) { +if (!clk->enable_reg) {/* * 'Independent' here refers to a clock which is not * controlled by its parent.
@@ -332,7 +330,7 @@ void omap2_clk_disable(struct clk *clk) {if (clk->usecount >0 && !(--clk->usecount)) {_omap2_clk_disable (clk); -if (likely ((u32 )clk->parent)) +if (clk->parent)omap2_clk_disable (clk->parent);if (clk->clkdm)omap2_clkdm_clk_disable (clk->clkdm, clk);
@@ -345,10 +343,10 @@ int omap2_clk_enable(struct clk *clk)int ret =0 ;if (clk->usecount++ ==0 ) { -if (likely ((u32 )clk->parent)) +if (clk->parent) ret =omap2_clk_enable (clk->parent); -if (unlikely (ret !=0 )) { +if (ret !=0 ) { clk->usecount--;return ret; }
@@ -358,7 +356,7 @@ int omap2_clk_enable(struct clk *clk) ret =_omap2_clk_enable (clk); -if (unlikely (ret !=0 )) { +if (ret !=0 ) {if (clk->clkdm)omap2_clkdm_clk_disable (clk->clkdm, clk);
@@ -386,13 +384,13 @@ void omap2_clksel_recalc(struct clk *clk)if (div ==0 )return ; -if (unlikely (clk->rate == clk->parent->rate / div)) +if (clk->rate == (clk->parent->rate / div))return ; clk->rate = clk->parent->rate / div;pr_debug ("clock: new clock rate is %ld (div %d)\n" , clk->rate, div); -if (unlikely (clk->flags &RATE_PROPAGATES )) +if (clk->flags &RATE_PROPAGATES )propagate_rate (clk); }
@@ -405,8 +403,8 @@ void omap2_clksel_recalc(struct clk *clk)* the element associated with the supplied parent clock address. * Returns a pointer to the struct clksel on success or NULL on error. */ -const struct clksel *omap2_get_clksel_by_parent (struct clk *clk, -struct clk *src_clk) +static const struct clksel *omap2_get_clksel_by_parent (struct clk *clk, +struct clk *src_clk) {const struct clksel *clks;
@@ -455,7 +453,7 @@ u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate, *new_div =1 ; clks =omap2_get_clksel_by_parent (clk, clk->parent); -if (clks ==NULL ) +if (!clks)return ~0 ;for (clkr = clks->rates; clkr->div; clkr++) {
@@ -514,7 +512,7 @@ long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate)/* Given a clock and a rate apply a clock specific rounding function */ long omap2_clk_round_rate (struct clk *clk,unsigned long rate) { -if (clk->round_rate !=NULL ) +if (clk->round_rate)return clk->round_rate (clk, rate);if (clk->flags &RATE_FIXED )
@@ -540,7 +538,7 @@ u32 omap2_clksel_to_divisor(struct clk *clk, u32 field_val)const struct clksel_rate *clkr; clks =omap2_get_clksel_by_parent (clk, clk->parent); -if (clks ==NULL ) +if (!clks)return 0 ;for (clkr = clks->rates; clkr->div; clkr++) {
@@ -576,7 +574,7 @@ u32 omap2_divisor_to_clksel(struct clk *clk, u32 div)WARN_ON (div ==0 ); clks =omap2_get_clksel_by_parent (clk, clk->parent); -if (clks ==NULL ) +if (!clks)return 0 ;for (clkr = clks->rates; clkr->div; clkr++) {
@@ -601,9 +599,9 @@ u32 omap2_divisor_to_clksel(struct clk *clk, u32 div)* * Returns the address of the clksel register upon success or NULL on error. */ -void __iomem *omap2_get_clksel (struct clk *clk,u32 *field_mask) +static void __iomem *omap2_get_clksel (struct clk *clk,u32 *field_mask) { -if (unlikely ((clk->clksel_reg ==NULL ) || (clk->clksel_mask ==NULL ))) +if (!clk->clksel_reg || (clk->clksel_mask ==0 ))return NULL ; *field_mask = clk->clksel_mask;
@@ -623,7 +621,7 @@ u32 omap2_clksel_get_divisor(struct clk *clk)void __iomem *div_addr; div_addr =omap2_get_clksel (clk, &field_mask); -if (div_addr ==NULL ) +if (!div_addr)return 0 ; field_val =__raw_readl (div_addr) & field_mask;
@@ -642,7 +640,7 @@ int omap2_clksel_set_rate(struct clk *clk, unsigned long rate)return -EINVAL ; div_addr =omap2_get_clksel (clk, &field_mask); -if (div_addr ==NULL ) +if (!div_addr)return -EINVAL ; field_val =omap2_divisor_to_clksel (clk, new_div);
@@ -680,10 +678,10 @@ int omap2_clk_set_rate(struct clk *clk, unsigned long rate)return -EINVAL ;/* dpll_ck, core_ck, virt_prcm_set; plus all clksel clocks */ -if (clk->set_rate !=NULL ) +if (clk->set_rate) ret = clk->set_rate (clk, rate); -if (unlikely (ret ==0 && (clk->flags &RATE_PROPAGATES ))) +if (ret ==0 && (clk->flags &RATE_PROPAGATES ))propagate_rate (clk);return ret;
@@ -704,7 +702,7 @@ static u32 omap2_clksel_get_src_field(void __iomem **src_addr, *src_addr =NULL ; clks =omap2_get_clksel_by_parent (clk, src_clk); -if (clks ==NULL ) +if (!clks)return 0 ;for (clkr = clks->rates; clkr->div; clkr++) {
@@ -734,7 +732,7 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)void __iomem *src_addr;u32 field_val, field_mask, reg_val, parent_div; -if (unlikely (clk->flags &CONFIG_PARTICIPANT )) +if (clk->flags &CONFIG_PARTICIPANT )return -EINVAL ;if (!clk->clksel)
@@ -742,7 +740,7 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent) field_val =omap2_clksel_get_src_field (&src_addr, new_parent, &field_mask, clk, &parent_div); -if (src_addr ==NULL ) +if (!src_addr)return -EINVAL ;if (clk->usecount >0 )
@@ -773,7 +771,7 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)pr_debug ("clock: set parent of %s to %s (new rate %ld)\n" , clk->name, clk->parent->name, clk->rate); -if (unlikely (clk->flags &RATE_PROPAGATES )) +if (clk->flags &RATE_PROPAGATES )propagate_rate (clk);return 0 ;
@@ -805,7 +803,8 @@ int omap2_dpll_set_rate_tolerance(struct clk *clk, unsigned int tolerance)return 0 ; } -static unsigned long _dpll_compute_new_rate (unsigned long parent_rate,unsigned int m,unsigned int n) +static unsigned long _dpll_compute_new_rate (unsigned long parent_rate, +unsigned int m,unsigned int n) {unsigned long long num;
arch/arm/mach-omap2/clock.h +1 -1
@@ -27,7 +27,7 @@ void omap2_clk_disable(struct clk *clk);long omap2_clk_round_rate (struct clk *clk,unsigned long rate);int omap2_clk_set_rate (struct clk *clk,unsigned long rate);int omap2_clk_set_parent (struct clk *clk,struct clk *new_parent); -int omap2_dpll_rate_tolerance_set (struct clk *clk,unsigned int tolerance); +int omap2_dpll_set_rate_tolerance (struct clk *clk,unsigned int tolerance);long omap2_dpll_round_rate (struct clk *clk,unsigned long target_rate);#ifdef CONFIG_OMAP_RESET_CLOCKS
arch/arm/mach-omap2/clock24xx.c +9 -7
@@ -153,7 +153,7 @@ static void omap2_clk_fixed_disable(struct clk *clk)* Uses the current prcm set to tell if a rate is valid. * You can go slower, but not faster within a given rate set. */ -long omap2_dpllcore_round_rate (unsigned long target_rate) +static long omap2_dpllcore_round_rate (unsigned long target_rate) {u32 high, low, core_clk_src;
@@ -366,7 +366,9 @@ static int omap2_select_table_rate(struct clk *clk, unsigned long rate)/* Major subsystem dividers */ tmp =cm_read_mod_reg (CORE_MOD ,CM_CLKSEL1 ) &OMAP24XX_CLKSEL_DSS2_MASK ; -cm_write_mod_reg (prcm->cm_clksel1_core | tmp,CORE_MOD ,CM_CLKSEL1 ); +cm_write_mod_reg (prcm->cm_clksel1_core | tmp,CORE_MOD , +CM_CLKSEL1 ); +if (cpu_is_omap2430 ())cm_write_mod_reg (prcm->cm_clksel_mdm,OMAP2430_MDM_MOD ,CM_CLKSEL );
@@ -398,20 +400,20 @@ static struct clk_functions omap2_clk_functions = {static u32 omap2_get_apll_clkin (void ) { -u32 aplls, sclk =0 ; +u32 aplls, srate =0 ; aplls =cm_read_mod_reg (PLL_MOD ,CM_CLKSEL1 ); aplls &=OMAP24XX_APLLS_CLKIN_MASK ; aplls >>=OMAP24XX_APLLS_CLKIN_SHIFT ;if (aplls ==APLLS_CLKIN_19_2MHZ ) - sclk =19200000 ; + srate =19200000 ;else if (aplls ==APLLS_CLKIN_13MHZ ) - sclk =13000000 ; + srate =13000000 ;else if (aplls ==APLLS_CLKIN_12MHZ ) - sclk =12000000 ; + srate =12000000 ; -return sclk; +return srate; }static u32 omap2_get_sysclkdiv (void )
arch/arm/mach-omap2/pm.c +1 -1
@@ -103,7 +103,7 @@ static struct platform_suspend_ops omap_pm_ops = { .valid = suspend_valid_only_mem, }; -int __init omap2_pm_init (void ) +static int __init omap2_pm_init (void ) {return 0 ; }
arch/arm/plat-omap/include/mach/clock.h +2 -2
@@ -111,12 +111,12 @@ struct clk_functions {extern unsigned int mpurate; -extern int clk_init (struct clk_functions * custom_clocks); +extern int clk_init (struct clk_functions *custom_clocks);extern int clk_register (struct clk *clk);extern void clk_unregister (struct clk *clk);extern void propagate_rate (struct clk *clk);extern void recalculate_root_clocks (void ); -extern void followparent_recalc (struct clk * clk); +extern void followparent_recalc (struct clk *clk);extern void clk_allow_idle (struct clk *clk);extern void clk_deny_idle (struct clk *clk);extern int clk_get_usecount (struct clk *clk);
arch/arm/plat-omap/include/mach/powerdomain.h +1 -0
@@ -145,6 +145,7 @@ int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm);int pwrdm_set_next_pwrst (struct powerdomain *pwrdm,u8 pwrst);int pwrdm_read_next_pwrst (struct powerdomain *pwrdm); +int pwrdm_read_pwrst (struct powerdomain *pwrdm);int pwrdm_read_prev_pwrst (struct powerdomain *pwrdm);int pwrdm_clear_all_prev_pwrst (struct powerdomain *pwrdm);
arch/arm/plat-omap/include/mach/prcm.h +3 -2
@@ -20,10 +20,11 @@* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __ASM_ARM_ARCH_DPM_PRCM_H -#define __ASM_ARM_ARCH_DPM_PRCM_H +#ifndef __ASM_ARM_ARCH_OMAP_PRCM_H +#define __ASM_ARM_ARCH_OMAP_PRCM_Hu32 omap_prcm_get_reset_sources (void ); +void omap_prcm_arch_reset (char mode);#endif
arch/arm/plat-omap/include/mach/system.h +2 -2
@@ -9,12 +9,12 @@#include <asm/mach-types.h> #include <mach/hardware.h> +#include <mach/prcm.h> +#ifndef CONFIG_MACH_VOICEBLUE #define voiceblue_reset () do {} while (0)#endif -extern void omap_prcm_arch_reset (char mode); -static inline void arch_idle (void ) {cpu_do_idle ();
Paul Walmsley
maintainerPATCH 3/10 OMAP24xx clock: add missing SSI L4 interface clock
In reply to Paul WalmsleyThis patch adds a missing OMAP24xx clock, the SSI L4 interface clock, as "ssi_l4_ick".
linux-omap source commit is ace129d39b3107d330d4cf6934385d13521f2fec.
--- arch/arm/mach-omap2/clock24xx.h | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/clock24xx.h +15 -0
@@ -1290,6 +1290,20 @@ static struct clk ssi_ssr_sst_fck = { .set_rate = &omap2_clksel_set_rate }; +/* +* Presumably this is the same as SSI_ICLK. +* TRM contradicts itself on what clockdomain SSI_ICLK is in +*/ +static struct clk ssi_l4_ick = { + .name ="ssi_l4_ick" , + .parent = &l4_ck, + .clkdm_name ="core_l4_clkdm" , + .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X , + .enable_reg =OMAP_CM_REGADDR (CORE_MOD ,CM_ICLKEN2 ), + .enable_bit =OMAP24XX_EN_SSI_SHIFT , + .recalc = &followparent_recalc, +}; +/* * GFX clock domain
@@ -2685,6 +2699,7 @@ static struct clk *onchip_24xx_clks[] __initdata = { &usb_l4_ick,/* L4 domain clocks */ &l4_ck,/* used as both core_l4 and wu_l4 */ + &ssi_l4_ick,/* virtual meta-group clock */ &virt_prcm_set,/* general l4 interface ck, multi-parent functional clk */
Paul Walmsley
maintainerPATCH 4/10 OMAP3: move USBHOST SAR handling from clock framework to powerdomain layer
In reply to Paul WalmsleyRemove usbhost_sar_fclk from the OMAP3 clock framework. The bit that the clock was tweaking doesn't actually enable or disable a clock; it controls whether the hardware will save and restore USBHOST state when the powerdomain changes state. (That happens to coincidentally enable a clock for the duration of the operation, hence the earlier confusion.)
In place of the clock, mark the USBHOST powerdomain as supporting hardware save-and-restore functionality.
linux-omap source commit is f3ceac86a9d425d101d606d87a5af44afef27179.
--- arch/arm/mach-omap2/clock34xx.h | 12 ------------ arch/arm/mach-omap2/powerdomains34xx.h | 1 + 2 files changed, 1 insertions(+), 12 deletions(-)
arch/arm/mach-omap2/clock34xx.h +0 -12
@@ -2216,17 +2216,6 @@ static struct clk usbhost_ick = { .recalc = &followparent_recalc, }; -static struct clk usbhost_sar_fck = { - .name ="usbhost_sar_fck" , - .parent = &osc_sys_ck, - .init = &omap2_init_clk_clkdm, - .enable_reg =OMAP_PRM_REGADDR (OMAP3430ES2_USBHOST_MOD ,PM_PWSTCTRL ), - .enable_bit =OMAP3430ES2_SAVEANDRESTORE_SHIFT , - .flags =CLOCK_IN_OMAP3430ES2 , - .clkdm_name ="usbhost_clkdm" , - .recalc = &followparent_recalc, -}; -/* WKUP */ static const struct clksel_rate usim_96m_rates[] = {
@@ -3174,7 +3163,6 @@ static struct clk *onchip_34xx_clks[] __initdata = { &usbhost_120m_fck, &usbhost_48m_fck, &usbhost_ick, - &usbhost_sar_fck, &usim_fck, &gpt1_fck, &wkup_32k_fck,
arch/arm/mach-omap2/powerdomains34xx.h +1 -0
@@ -312,6 +312,7 @@ static struct powerdomain usbhost_pwrdm = { .sleepdep_srcs = dss_per_usbhost_sleepdeps, .pwrsts = PWRSTS_OFF_RET_ON, .pwrsts_logic_ret = PWRDM_POWER_RET, + .flags = PWRDM_HAS_HDWR_SAR, /* for USBHOST ctrlr only */ .banks = 1, .pwrsts_mem_ret = { [0] = PWRDM_POWER_RET, /* MEMRETSTATE */
Paul Walmsley
maintainerPATCH 5/10 OMAP3 clock: fix 96MHz clocks
In reply to Paul WalmsleyFix some bugs in the OMAP3 clock tree pertaining to the 96MHz clocks. The 96MHz portion of the clock tree should now have reasonable fidelity to the 34xx TRM Rev I.
One remaining question mark: it's not clear exactly which 96MHz source clock the USIM uses. This patch sticks with the previous setting, which seems reasonable.
linux-omap source commit is 15c706e8179ce238c3ba70a25846a36b73bd2359.
--- arch/arm/mach-omap2/clock34xx.h | 60 +++++++++++++++++++++------------ arch/arm/mach-omap2/cm-regbits-34xx.h | 8 +++- 2 files changed, 44 insertions(+), 24 deletions(-)
arch/arm/mach-omap2/clock34xx.h +38 -22
@@ -646,6 +646,12 @@ static const struct clksel omap_96m_alwon_fck_clksel[] = { { .parent = NULL } }; +/* +* DPLL4 generates DPLL4_M2X2_CLK which is then routed into the PRM as +* PRM_96M_ALWON_(F)CLK. Two clocks then emerge from the PRM: +* 96M_ALWON_FCLK (called "omap_96m_alwon_fck" below) and +* CM_96K_(F)CLK. +*/ static struct clk omap_96m_alwon_fck = { .name ="omap_96m_alwon_fck" , .parent = &dpll4_m2x2_ck,
@@ -654,31 +660,41 @@ static struct clk omap_96m_alwon_fck = { .clksel_mask = OMAP3430_ST_PERIPH_CLK_MASK, .clksel = omap_96m_alwon_fck_clksel, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | - PARENT_CONTROLS_CLOCK, + PARENT_CONTROLS_CLOCK, .recalc = &omap2_clksel_recalc, }; -static struct clk omap_96m_fck = { - .name ="omap_96m_fck" , +static struct clk cm_96m_fck = { + .name ="cm_96m_fck" , .parent = &omap_96m_alwon_fck, .flags =CLOCK_IN_OMAP343X |RATE_PROPAGATES |PARENT_CONTROLS_CLOCK , .recalc = &followparent_recalc, }; -static const struct clksel cm_96m_fck_clksel[] = { - { .parent = &sys_ck, .rates = dpll_bypass_rates }, - { .parent = &dpll4_m2x2_ck, .rates = dpll_locked_rates }, +static const struct clksel_rate omap_96m_dpll_rates[] = { + { .div =1 , .val =0 , .flags =RATE_IN_343X |DEFAULT_RATE }, + { .div =0 } +}; + +static const struct clksel_rate omap_96m_sys_rates[] = { + { .div =1 , .val =1 , .flags =RATE_IN_343X |DEFAULT_RATE }, + { .div =0 } +}; + +static const struct clksel omap_96m_fck_clksel[] = { + { .parent = &cm_96m_fck, .rates = omap_96m_dpll_rates }, + { .parent = &sys_ck, .rates = omap_96m_sys_rates }, { .parent =NULL } }; -static struct clk cm_96m_fck = { - .name ="cm_96m_fck" , - .parent = &dpll4_m2x2_ck, +static struct clk omap_96m_fck = { + .name ="omap_96m_fck" , + .parent = &sys_ck, .init = &omap2_init_clksel_parent, - .clksel_reg =OMAP_CM_REGADDR (PLL_MOD ,CM_IDLEST ), - .clksel_mask =OMAP3430_ST_PERIPH_CLK_MASK , - .clksel = cm_96m_fck_clksel, + .clksel_reg =OMAP_CM_REGADDR (PLL_MOD ,CM_CLKSEL1 ), + .clksel_mask =OMAP3430_SOURCE_96M_MASK , + .clksel = omap_96m_fck_clksel, .flags =CLOCK_IN_OMAP343X |RATE_PROPAGATES |PARENT_CONTROLS_CLOCK , .recalc = &omap2_clksel_recalc,
@@ -746,14 +762,14 @@ static struct clk omap_54m_fck = { .name = "omap_54m_fck", .init = &omap2_init_clksel_parent, .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), - .clksel_mask = OMAP3430_SOURCE_54M, + .clksel_mask = OMAP3430_SOURCE_54M_MASK, .clksel = omap_54m_clksel, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, .recalc = &omap2_clksel_recalc, }; -static const struct clksel_rate omap_48m_96md2_rates[] = { +static const struct clksel_rate omap_48m_cm96m_rates[] = { { .div =2 , .val =0 , .flags =RATE_IN_343X |DEFAULT_RATE }, { .div =0 } };
@@ -764,7 +780,7 @@ static const struct clksel_rate omap_48m_alt_rates[] = { };static const struct clksel omap_48m_clksel[] = { - { .parent = &cm_96m_fck, .rates = omap_48m_96md2_rates }, + { .parent = &cm_96m_fck, .rates = omap_48m_cm96m_rates }, { .parent = &sys_altclk, .rates = omap_48m_alt_rates }, { .parent =NULL } };
@@ -773,7 +789,7 @@ static struct clk omap_48m_fck = { .name = "omap_48m_fck", .init = &omap2_init_clksel_parent, .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), - .clksel_mask = OMAP3430_SOURCE_48M, + .clksel_mask = OMAP3430_SOURCE_48M_MASK, .clksel = omap_48m_clksel, .flags =CLOCK_IN_OMAP343X |RATE_PROPAGATES | PARENT_CONTROLS_CLOCK,
@@ -961,10 +977,10 @@ static const struct clksel_rate clkout2_src_54m_rates[] = { };static const struct clksel clkout2_src_clksel[] = { - { .parent = &core_ck, .rates = clkout2_src_core_rates }, - { .parent = &sys_ck, .rates = clkout2_src_sys_rates }, - { .parent = &omap_96m_alwon_fck, .rates = clkout2_src_96m_rates }, - { .parent = &omap_54m_fck, .rates = clkout2_src_54m_rates }, + { .parent = &core_ck, .rates = clkout2_src_core_rates }, + { .parent = &sys_ck, .rates = clkout2_src_sys_rates }, + { .parent = &cm_96m_fck, .rates = clkout2_src_96m_rates }, + { .parent = &omap_54m_fck, .rates = clkout2_src_54m_rates }, { .parent =NULL } };
@@ -2777,8 +2793,8 @@ static struct clk mcbsp4_ick = { };static const struct clksel mcbsp_234_clksel[] = { - { .parent = &per_96m_fck, .rates = common_mcbsp_96m_rates }, - { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates }, + { .parent = &core_96m_fck, .rates = common_mcbsp_96m_rates }, + { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates }, { .parent =NULL } };
arch/arm/mach-omap2/cm-regbits-34xx.h +6 -2
@@ -449,8 +449,12 @@#define OMAP3430_CORE_DPLL_MULT_MASK (0x7ff << 16)#define OMAP3430_CORE_DPLL_DIV_SHIFT 8#define OMAP3430_CORE_DPLL_DIV_MASK (0x7f << 8) -#define OMAP3430_SOURCE_54M (1 << 5) -#define OMAP3430_SOURCE_48M (1 << 3) +#define OMAP3430_SOURCE_96M_SHIFT 6 +#define OMAP3430_SOURCE_96M_MASK (1 << 6) +#define OMAP3430_SOURCE_54M_SHIFT 5 +#define OMAP3430_SOURCE_54M_MASK (1 << 5) +#define OMAP3430_SOURCE_48M_SHIFT 3 +#define OMAP3430_SOURCE_48M_MASK (1 << 3)/* CM_CLKSEL2_PLL */ #define OMAP3430_PERIPH_DPLL_MULT_SHIFT 8
Paul Walmsley
maintainerPATCH 6/10 OMAP2: Fix definition of SGX clock register bits
In reply to Paul WalmsleyFrom: Daniel Stone <[email protected]>
The GFX/SGX functional and interface clocks have different masks, for some unknown reason, so split EN_SGX_SHIFT into one each for fclk and iclk.
Correct according to the TRM and the far more important 'does this actually work at all?' metric.
linux-omap source commit is de1121fdb899f762b9e717f44eaf3fae7c00cd3e.
--- arch/arm/mach-omap2/clock34xx.h | 4 ++-- arch/arm/mach-omap2/cm-regbits-34xx.h | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/clock34xx.h +2 -2
@@ -1293,7 +1293,7 @@ static struct clk sgx_fck = { .name = "sgx_fck", .init = &omap2_init_clksel_parent, .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_FCLKEN), - .enable_bit = OMAP3430ES2_EN_SGX_SHIFT, + .enable_bit = OMAP3430ES2_CM_FCLKEN_SGX_EN_SGX_SHIFT, .clksel_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_CLKSEL), .clksel_mask = OMAP3430ES2_CLKSEL_SGX_MASK, .clksel = sgx_clksel,
@@ -1307,7 +1307,7 @@ static struct clk sgx_ick = { .parent = &l3_ick, .init = &omap2_init_clk_clkdm, .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_ICLKEN), - .enable_bit = OMAP3430ES2_EN_SGX_SHIFT, + .enable_bit = OMAP3430ES2_CM_ICLKEN_SGX_EN_SGX_SHIFT, .flags = CLOCK_IN_OMAP3430ES2, .clkdm_name = "sgx_clkdm", .recalc = &followparent_recalc,
arch/arm/mach-omap2/cm-regbits-34xx.h +6 -2
@@ -332,8 +332,12 @@#define OMAP3430ES1_CLKACTIVITY_GFX_MASK (1 << 0)/* CM_FCLKEN_SGX */ -#define OMAP3430ES2_EN_SGX_SHIFT 1 -#define OMAP3430ES2_EN_SGX_MASK (1 << 1) +#define OMAP3430ES2_CM_FCLKEN_SGX_EN_SGX_SHIFT 1 +#define OMAP3430ES2_CM_FCLKEN_SGX_EN_SGX_MASK (1 << 1) + +/* CM_ICLKEN_SGX */ +#define OMAP3430ES2_CM_ICLKEN_SGX_EN_SGX_SHIFT 0 +#define OMAP3430ES2_CM_ICLKEN_SGX_EN_SGX_MASK (1 << 0)/* CM_CLKSEL_SGX */ #define OMAP3430ES2_CLKSEL_SGX_SHIFT 0
Paul Walmsley
maintainerPATCH 7/10 OMAP: Add CSI2 clock struct for handling it with clock API.
In reply to Paul WalmsleyFrom: Sergio Aguirre <[email protected]>
Add CSI2 clock struct for handling it with clock API when TI PM is disabled.
linux-omap source commit is 8b20f4498928459276bd3366e3381ad595d23432.
--- arch/arm/mach-omap2/clock34xx.h | 12 ++++++++++++ arch/arm/mach-omap2/cm-regbits-34xx.h | 2 ++ 2 files changed, 14 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/clock34xx.h +12 -0
@@ -2196,6 +2196,17 @@ static struct clk cam_ick = { .recalc = &followparent_recalc, }; +static struct clk csi2_96m_fck = { + .name ="csi2_96m_fck" , + .parent = &core_96m_fck, + .init = &omap2_init_clk_clkdm, + .enable_reg =OMAP_CM_REGADDR (OMAP3430_CAM_MOD ,CM_FCLKEN ), + .enable_bit =OMAP3430_EN_CSI2_SHIFT , + .flags =CLOCK_IN_OMAP343X , + .clkdm_name ="cam_clkdm" , + .recalc = &followparent_recalc, +}; +/* USBHOST - 3430ES2 only */ static struct clk usbhost_120m_fck = {
@@ -3176,6 +3187,7 @@ static struct clk *onchip_34xx_clks[] __initdata = { &dss_ick, &cam_mclk, &cam_ick, + &csi2_96m_fck, &usbhost_120m_fck, &usbhost_48m_fck, &usbhost_ick,
arch/arm/mach-omap2/cm-regbits-34xx.h +2 -0
@@ -524,6 +524,8 @@#define OMAP3430_CLKACTIVITY_DSS_MASK (1 << 0)/* CM_FCLKEN_CAM specific bits */ +#define OMAP3430_EN_CSI2 (1 << 1) +#define OMAP3430_EN_CSI2_SHIFT 1/* CM_ICLKEN_CAM specific bits */
Paul Walmsley
maintainerPATCH 8/10 OMAP: Make dpll4_m4_ck programmable with clk_set_rate()
In reply to Paul WalmsleyFilling the set_rate and round_rate fields of dpll4_m4_ck makes this clock programmable through clk_set_rate(). This is needed to give omapfb control over the dss1_alwon_fck rate.
This patch includes a fix from Tomi Valkeinen <[email protected]>.
linux-omap source commits are e42218d45afbc3e654e289e021e6b80c657b16c2 and 9d211b761b3cdf7736602ecf7e68f8a298c13278.
--- arch/arm/mach-omap2/clock34xx.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/clock34xx.h +2 -0
@@ -816,6 +816,8 @@ static struct clk dpll4_m4_ck = { .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, .recalc = &omap2_clksel_recalc, + .set_rate = &omap2_clksel_set_rate, + .round_rate = &omap2_clksel_round_rate, };/* The PWRDN bit is apparently only available on 3430ES2 and above */
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Paul Walmsley
maintainerPATCH 9/10 OMAP2/3: Remove OMAP_PRM_REGADDR, OMAP_CM_REGADDR
In reply to Paul WalmsleyFrom: Tony Lindgren <[email protected]>
Remove OMAP_PRM_REGADDR and OMAP_CM_REGADDR. Use prm_read/write_mod_reg() or cm_read/write_mod_reg() instead. For assembly, use OMAPXXXX_PRM_REGADDR or OMAPXXXX_CM_REGADDR macros.
linux-omap source commits are 158e5d7128ed806b5b4eec0839e73727fa7a1f8a and 84029a1dee973d8037e67d4cd02acb833f6b9b97.
--- arch/arm/mach-omap2/clock.c | 22 +- arch/arm/mach-omap2/clock24xx.c | 87 ++++-- arch/arm/mach-omap2/clock24xx.h | 322 ++++++++++++----------- arch/arm/mach-omap2/clock34xx.h | 420 +++++++++++++++--------------- arch/arm/mach-omap2/cm-regbits-34xx.h | 7 + arch/arm/mach-omap2/cm.h | 17 - arch/arm/mach-omap2/memory.c | 3 arch/arm/mach-omap2/prm-regbits-34xx.h | 9 + arch/arm/mach-omap2/prm.h | 166 +++++------- arch/arm/mach-omap2/sram242x.S | 5 arch/arm/mach-omap2/sram243x.S | 5 arch/arm/plat-omap/common.c | 1 arch/arm/plat-omap/include/mach/clock.h | 3 arch/arm/plat-omap/include/mach/common.h | 5 14 files changed, 570 insertions(+), 502 deletions(-)
arch/arm/mach-omap2/clock.c +13 -9
@@ -27,6 +27,7 @@#include <mach/clock.h> #include <mach/clockdomain.h> #include <mach/cpu.h> +#include <mach/prcm.h> #include <asm/div64.h> #include "memory.h"
@@ -247,9 +248,9 @@ static void omap2_clk_wait_ready(struct clk *clk)/* REVISIT: What are the appropriate exclusions for 34XX? */ /* OMAP3: ignore DSS-mod clocks */ if (cpu_is_omap34xx () && - (((u32 )reg & ~0xff ) == (u32 )OMAP_CM_REGADDR (OMAP3430_DSS_MOD ,0 ) || - ((((u32 )reg & ~0xff ) == (u32 )OMAP_CM_REGADDR (CORE_MOD ,0 )) && - clk->enable_bit ==OMAP3430_EN_SSI_SHIFT ))) + (((u32 )reg & ~0xff ) ==cm_read_mod_reg (OMAP3430_DSS_MOD ,0 ) || + ((((u32 )reg & ~0xff ) ==cm_read_mod_reg (CORE_MOD ,0 )) && + clk->enable_bit ==OMAP3430_EN_SSI_SHIFT )))return ;/* Check if both functional and interface clocks
@@ -632,8 +633,9 @@ u32 omap2_clksel_get_divisor(struct clk *clk)int omap2_clksel_set_rate (struct clk *clk,unsigned long rate) { -u32 field_mask, field_val, reg_val, validrate, new_div =0 ; +u32 field_mask, field_val, validrate, new_div =0 ;void __iomem *div_addr; +u32 v; validrate =omap2_clksel_round_rate_div (clk, rate, &new_div);if (validrate != rate)
@@ -647,10 +649,11 @@ int omap2_clksel_set_rate(struct clk *clk, unsigned long rate)if (field_val == ~0 )return -EINVAL ; - reg_val =__raw_readl (div_addr); - reg_val &= ~field_mask; - reg_val |= (field_val <<__ffs (field_mask)); -__raw_writel (reg_val, div_addr); + v =__raw_readl (div_addr); + v &= ~field_mask; + v |= field_val <<__ffs (field_mask); +__raw_writel (v, div_addr); +wmb (); clk->rate = clk->parent->rate / new_div;
@@ -753,7 +756,8 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)wmb ();if (clk->flags &DELAYED_APP &&cpu_is_omap24xx ()) { -__raw_writel (OMAP24XX_VALID_CONFIG ,OMAP24XX_PRCM_CLKCFG_CTRL ); +prm_write_mod_reg (OMAP24XX_VALID_CONFIG , +OMAP24XX_GR_MOD ,OMAP24XX_PRCM_CLKCFG_CTRL_OFFSET );wmb (); }
arch/arm/mach-omap2/clock24xx.c +60 -27
140 lines not on this page · raw message
arch/arm/mach-omap2/clock24xx.h +165 -157
1,142 lines not on this page · raw message
arch/arm/mach-omap2/clock34xx.h +216 -204
1,520 lines not on this page · raw message
arch/arm/mach-omap2/cm-regbits-34xx.h +7 -0
@@ -208,6 +208,10 @@ #define OMAP3430ES2_ST_USBTLL_MASK (1 << 2) /* CM_AUTOIDLE1_CORE */ +#define OMAP3430ES2_AUTO_MMC3 (1 << 30) +#define OMAP3430ES2_AUTO_MMC3_SHIFT 30 +#define OMAP3430ES2_AUTO_ICR (1 << 29) +#define OMAP3430ES2_AUTO_ICR_SHIFT 29 #define OMAP3430_AUTO_AES2 (1 << 28) #define OMAP3430_AUTO_AES2_SHIFT 28 #define OMAP3430_AUTO_SHA12 (1 << 27)
@@ -276,6 +280,9 @@ #define OMAP3430_AUTO_DES1_SHIFT 0 /* CM_AUTOIDLE3_CORE */ +#define OMAP3430ES2_AUTO_USBHOST (1 << 0) +#define OMAP3430ES2_AUTO_USBHOST_SHIFT 0 +#define OMAP3430ES2_AUTO_USBTLL (1 << 2) #define OMAP3430ES2_AUTO_USBTLL_SHIFT 2 #define OMAP3430ES2_AUTO_USBTLL_MASK (1 << 2)
arch/arm/mach-omap2/cm.h +6 -11
@@ -16,29 +16,25 @@ #include "prcm-common.h" -#ifndef __ASSEMBLER__ -#define OMAP_CM_REGADDR(module, reg) \ - IO_ADDRESS(OMAP2_CM_BASE + (module) + (reg)) -#else #define OMAP2420_CM_REGADDR(module, reg) \ IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg)) #define OMAP2430_CM_REGADDR(module, reg) \ IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg)) #define OMAP34XX_CM_REGADDR(module, reg) \ IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg)) -#endif /* * Architecture-specific global CM registers - * Use cm_{read,write}_reg() with these registers. + * Use __raw_{read,write}l() with these registers. * These registers appear once per CM module. */ -#define OMAP3430_CM_REVISION OMAP_CM_REGADDR(OCP_MOD, 0x0000) -#define OMAP3430_CM_SYSCONFIG OMAP_CM_REGADDR(OCP_MOD, 0x0010) -#define OMAP3430_CM_POLCTRL OMAP_CM_REGADDR(OCP_MOD, 0x009c) +#define OMAP3430_CM_REVISION OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000) +#define OMAP3430_CM_SYSCONFIG OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010) +#define OMAP3430_CM_POLCTRL OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c) -#define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070) +#define OMAP3430_CM_CLKOUT_CTRL \ + OMAP34XX_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070) /* * Module specific CM registers from CM_BASE + domain offset
@@ -67,7 +63,6 @@ #define CM_CLKSEL2 0x0044 #define CM_CLKSTCTRL 0x0048 - /* Architecture-specific registers */ #define OMAP24XX_CM_FCLKEN2 0x0004
arch/arm/mach-omap2/memory.c +2 -1
@@ -93,7 +93,8 @@ u32 omap2_reprogram_sdrc(u32 level, u32 force) m_type = omap2_memory_get_type(); local_irq_save(flags); - __raw_writel(0xffff, OMAP24XX_PRCM_VOLTSETUP); + prm_write_mod_reg(0xffff, OMAP24XX_GR_MOD, + OMAP24XX_PRCM_VOLTSETUP_OFFSET); omap2_sram_reprogram_sdrc(level, dll_ctrl, m_type); curr_perf_level = level; local_irq_restore(flags);
arch/arm/mach-omap2/prm-regbits-34xx.h +9 -0
@@ -366,6 +366,7 @@ /* PM_WKEN_WKUP specific bits */ #define OMAP3430_EN_IO (1 << 8) +#define OMAP3430_EN_GPIO1 (1 << 3) /* PM_MPUGRPSEL_WKUP specific bits */
@@ -452,6 +453,14 @@ #define OMAP3430_CMDRA0_MASK (0xff << 0) /* PRM_VC_CMD_VAL_0 specific bits */ +#define OMAP3430_VC_CMD_ON_SHIFT 24 +#define OMAP3430_VC_CMD_ON_MASK (0xFF << 24) +#define OMAP3430_VC_CMD_ONLP_SHIFT 16 +#define OMAP3430_VC_CMD_ONLP_MASK (0xFF << 16) +#define OMAP3430_VC_CMD_RET_SHIFT 8 +#define OMAP3430_VC_CMD_RET_MASK (0xFF << 8) +#define OMAP3430_VC_CMD_OFF_SHIFT 0 +#define OMAP3430_VC_CMD_OFF_MASK (0xFF << 0) /* PRM_VC_CMD_VAL_1 specific bits */
arch/arm/mach-omap2/prm.h +74 -92
54 lines not on this page · raw message
arch/arm/plat-omap/include/mach/clock.h +2 -1
Lines of this file are not shown. View the raw message.
arch/arm/plat-omap/include/mach/common.h +5 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Re: [PATCH A 09/10] OMAP2/3: Remove OMAP_PRM_REGADDR, OMAP_CM_REGADDR
Quoted 13 lines · Paul Walmsley
arch/arm/mach-omap2/clock.c +1
-0@@ -27,6 +27,7 @@#include <mach/clock.h> #include <mach/clockdomain.h> #include <mach/cpu.h> +#include <mach/prcm.h> #include <asm/div64.h> #include "memory.h"
arch/arm/mach-omap2/clock.c static void omap2_clk_wait_ready(struct clk *clk) · line 254
Quoted 10 lines
arch/arm/mach-omap2/clock.c +3
-3@@ -247,9 +248,9 @@ static void omap2_clk_wait_ready(struct clk *clk)/* REVISIT: What are the appropriate exclusions for 34XX? */ /* OMAP3: ignore DSS-mod clocks */ if (cpu_is_omap34xx () && - (((u32 )reg & ~0xff ) == (u32 )OMAP_CM_REGADDR (OMAP3430_DSS_MOD ,0 ) || - ((((u32 )reg & ~0xff ) == (u32 )OMAP_CM_REGADDR (CORE_MOD ,0 )) && - clk->enable_bit ==OMAP3430_EN_SSI_SHIFT ))) + (((u32 )reg & ~0xff ) ==cm_read_mod_reg (OMAP3430_DSS_MOD ,0 ) || + ((((u32 )reg & ~0xff ) ==cm_read_mod_reg (CORE_MOD ,0 )) && + clk->enable_bit ==OMAP3430_EN_SSI_SHIFT )))return ;
As suggested in patch 2, I hate this approach. It's far better to deal with this by changing the way we handle enabling and disabling clocks, hence my
"[ARM] omap: eliminate unnecessary conditionals in omap2_clk_wait_ready"
Quoted 39 lines
arch/arm/mach-omap2/clock.c +31
-0@@ -476,6 +466,37 @@ static int __init omap2_clk_arch_init(void) }arch_initcall (omap2_clk_arch_init); +static u32 prm_base; +static u32 cm_base; + +/* +* Since we share clock data for 242x and 243x, we need to rewrite some +* some register base offsets. Assume offset is at prm_base if flagged, +* else assume it's cm_base. +*/ +static inline void omap2_clk_check_reg (u32 flags,void __iomem **reg) +{ +u32 tmp = (__force u32)*reg; + +if ((tmp >>24 ) !=0 ) +return ; + +if (flags &OFFSET_GR_MOD ) + tmp += prm_base; +else + tmp += cm_base; + + *reg = (__force void __iomem *)tmp; +} + +void __init omap2_clk_rewrite_base (struct clk *clk) +{ +omap2_clk_check_reg (clk->flags, &clk->clksel_reg); +omap2_clk_check_reg (clk->flags, &clk->enable_reg); +if (clk->dpll_data) +omap2_clk_check_reg (0 , &clk->dpll_data->mult_div1_reg); +} +int __init omap2_clk_init (void ) {struct prcm_config *prcm;
arch/arm/mach-omap2/clock.c int __init omap2_clk_init(void) · line 516
Quoted 9 lines
arch/arm/mach-omap2/clock.c +6
-0@@ -487,6 +508,12 @@ int __init omap2_clk_init(void)else if (cpu_is_omap2430 ()) cpu_mask =RATE_IN_243X ; +for (clkp = onchip_24xx_clks; + clkp < onchip_24xx_clks +ARRAY_SIZE (onchip_24xx_clks); + clkp++) { +omap2_clk_rewrite_base (*clkp); + } +
I'm afraid this also fails to satisfy my decency filter. Let's summarise what's going on here.
- the structure initializers are setup to cast integer register offsets to void __iomem *.
- the code above walks all clock structures, looking for what could be considered an offset (iow, bits 31-24 of the pointer being zero).
- it looks at the OFFSET_GR_MOD flag to determine which base to add in
- the base address is not 'void __iomem *' but 'u32'.
- we update the void __iomem * pointers in the structure.
So, we have a base address which is an integer, and an offset which is an void __iomem *.
I can see why you want to do this, but I think it needs more thought. I'll sit on this patch for a while.
In the mean time, I've fixed up patches 1-8,10 to apply on top of my patch set.
However, still waiting for a few to come through: D6, E2 and F2. No, these aren't suck in any of my mail spools or list admin queues.
Paul Walmsley
maintainerRe: [PATCH A 09/10] OMAP2/3: Remove OMAP_PRM_REGADDR, OMAP_CM_REGADDR
Hi Russell,
Quoted 29 lines · Russell King - ARM Linux
Quoted 13 lines · Paul Walmsley
arch/arm/mach-omap2/clock.c +1
-0@@ -27,6 +27,7 @@#include <mach/clock.h> #include <mach/clockdomain.h> #include <mach/cpu.h> +#include <mach/prcm.h> #include <asm/div64.h> #include "memory.h" arch/arm/mach-omap2/clock.c static void omap2_clk_wait_ready(struct clk *clk) · line 254
Quoted 10 lines
arch/arm/mach-omap2/clock.c +3
-3@@ -247,9 +248,9 @@ static void omap2_clk_wait_ready(struct clk *clk)/* REVISIT: What are the appropriate exclusions for 34XX? */ /* OMAP3: ignore DSS-mod clocks */ if (cpu_is_omap34xx () && - (((u32 )reg & ~0xff ) == (u32 )OMAP_CM_REGADDR (OMAP3430_DSS_MOD ,0 ) || - ((((u32 )reg & ~0xff ) == (u32 )OMAP_CM_REGADDR (CORE_MOD ,0 )) && - clk->enable_bit ==OMAP3430_EN_SSI_SHIFT ))) + (((u32 )reg & ~0xff ) ==cm_read_mod_reg (OMAP3430_DSS_MOD ,0 ) || + ((((u32 )reg & ~0xff ) ==cm_read_mod_reg (CORE_MOD ,0 )) && + clk->enable_bit ==OMAP3430_EN_SSI_SHIFT )))return ;As suggested in patch 2, I hate this approach. It's far better to deal with this by changing the way we handle enabling and disabling clocks, hence my
Quoted 1 line
"[ARM] omap: eliminate unnecessary conditionals in
omap2_clk_wait_ready"
This function is radically cleaned up in a following patch, patch D 10. I regret that I wasn't able to compress the above patch with D 10, but the change delta between the two patches was quite large.
Quoted 60 lines
Quoted 39 lines
arch/arm/mach-omap2/clock.c +31
-0@@ -476,6 +466,37 @@ static int __init omap2_clk_arch_init(void) }arch_initcall (omap2_clk_arch_init); +static u32 prm_base; +static u32 cm_base; + +/* +* Since we share clock data for 242x and 243x, we need to rewrite some +* some register base offsets. Assume offset is at prm_base if flagged, +* else assume it's cm_base. +*/ +static inline void omap2_clk_check_reg (u32 flags,void __iomem **reg) +{ +u32 tmp = (__force u32)*reg; + +if ((tmp >>24 ) !=0 ) +return ; + +if (flags &OFFSET_GR_MOD ) + tmp += prm_base; +else + tmp += cm_base; + + *reg = (__force void __iomem *)tmp; +} + +void __init omap2_clk_rewrite_base (struct clk *clk) +{ +omap2_clk_check_reg (clk->flags, &clk->clksel_reg); +omap2_clk_check_reg (clk->flags, &clk->enable_reg); +if (clk->dpll_data) +omap2_clk_check_reg (0 , &clk->dpll_data->mult_div1_reg); +} +int __init omap2_clk_init (void ) {struct prcm_config *prcm;arch/arm/mach-omap2/clock.c int __init omap2_clk_init(void) · line 516
Quoted 9 lines
arch/arm/mach-omap2/clock.c +6
-0@@ -487,6 +508,12 @@ int __init omap2_clk_init(void)else if (cpu_is_omap2430 ()) cpu_mask =RATE_IN_243X ; +for (clkp = onchip_24xx_clks; + clkp < onchip_24xx_clks +ARRAY_SIZE (onchip_24xx_clks); + clkp++) { +omap2_clk_rewrite_base (*clkp); + } +I'm afraid this also fails to satisfy my decency filter. Let's summarise what's going on here.
- the structure initializers are setup to cast integer register offsets to void
__iomem*.
- the code above walks all clock structures, looking for what could be considered an offset (iow, bits 31-24 of the pointer being zero).
- it looks at theOFFSET_GR_MODflag to determine which base to add in
- the base address is not 'void__iomem*' but 'u32'.
- we update the void__iomem* pointers in the structure.
Quoted 5 lines
So, we have a base address which is an integer, and an offset which is an void
__iomem*.I can see why you want to do this, but I think it needs more thought. I'll sit on this patch for a while.
I agree with your decency filter. I believe that patch was written for expediency. It turns out that all of the register rewriting code is ultimately unnecessary, and is wiped out in patch D 08.
Quoted 5 lines
In the mean time, I've fixed up patches 1-8,10 to apply on top of my patch set.
However, still waiting for a few to come through: D6, E2 and F2. No, these aren't suck in any of my mail spools or list admin queues.
The patches did make it to linux-kernel and linux-omap, but these three patches were bounced by the linux-arm-kernel mailing list manager with the following error message:
---
Remote host said: 550-Subjects containing xxx are taboo to many list subscribers; we have no
550 option but to reject your message. Sorry.
---
The subject lines of these patches contain words like 'OMAP2xxx'. Would you like me to resend these patches to your list with the subject lines changed?
- Paul
Re: [PATCH A 09/10] OMAP2/3: Remove OMAP_PRM_REGADDR, OMAP_CM_REGADDR
Quoted 102 lines · Paul Walmsley
Hi Russell,
Quoted 29 lines · Russell King - ARM Linux
Quoted 13 lines · Paul Walmsley
arch/arm/mach-omap2/clock.c +1
-0@@ -27,6 +27,7 @@#include <mach/clock.h> #include <mach/clockdomain.h> #include <mach/cpu.h> +#include <mach/prcm.h> #include <asm/div64.h> #include "memory.h" arch/arm/mach-omap2/clock.c static void omap2_clk_wait_ready(struct clk *clk) · line 254
Quoted 10 lines
arch/arm/mach-omap2/clock.c +3
-3@@ -247,9 +248,9 @@ static void omap2_clk_wait_ready(struct clk *clk)/* REVISIT: What are the appropriate exclusions for 34XX? */ /* OMAP3: ignore DSS-mod clocks */ if (cpu_is_omap34xx () && - (((u32 )reg & ~0xff ) == (u32 )OMAP_CM_REGADDR (OMAP3430_DSS_MOD ,0 ) || - ((((u32 )reg & ~0xff ) == (u32 )OMAP_CM_REGADDR (CORE_MOD ,0 )) && - clk->enable_bit ==OMAP3430_EN_SSI_SHIFT ))) + (((u32 )reg & ~0xff ) ==cm_read_mod_reg (OMAP3430_DSS_MOD ,0 ) || + ((((u32 )reg & ~0xff ) ==cm_read_mod_reg (CORE_MOD ,0 )) && + clk->enable_bit ==OMAP3430_EN_SSI_SHIFT )))return ;As suggested in patch 2, I hate this approach. It's far better to deal with this by changing the way we handle enabling and disabling clocks, hence my
Quoted 1 line
"[ARM] omap: eliminate unnecessary conditionals in
omap2_clk_wait_ready"This function is radically cleaned up in a following patch, patch D 10. I regret that I wasn't able to compress the above patch with D 10, but the change delta between the two patches was quite large.
Quoted 63 lines
Quoted 39 lines
arch/arm/mach-omap2/clock.c +31
-0@@ -476,6 +466,37 @@ static int __init omap2_clk_arch_init(void) }arch_initcall (omap2_clk_arch_init); +static u32 prm_base; +static u32 cm_base; + +/* +* Since we share clock data for 242x and 243x, we need to rewrite some +* some register base offsets. Assume offset is at prm_base if flagged, +* else assume it's cm_base. +*/ +static inline void omap2_clk_check_reg (u32 flags,void __iomem **reg) +{ +u32 tmp = (__force u32)*reg; + +if ((tmp >>24 ) !=0 ) +return ; + +if (flags &OFFSET_GR_MOD ) + tmp += prm_base; +else + tmp += cm_base; + + *reg = (__force void __iomem *)tmp; +} + +void __init omap2_clk_rewrite_base (struct clk *clk) +{ +omap2_clk_check_reg (clk->flags, &clk->clksel_reg); +omap2_clk_check_reg (clk->flags, &clk->enable_reg); +if (clk->dpll_data) +omap2_clk_check_reg (0 , &clk->dpll_data->mult_div1_reg); +} +int __init omap2_clk_init (void ) {struct prcm_config *prcm;arch/arm/mach-omap2/clock.c int __init omap2_clk_init(void) · line 516
Quoted 9 lines
arch/arm/mach-omap2/clock.c +6
-0@@ -487,6 +508,12 @@ int __init omap2_clk_init(void)else if (cpu_is_omap2430 ()) cpu_mask =RATE_IN_243X ; +for (clkp = onchip_24xx_clks; + clkp < onchip_24xx_clks +ARRAY_SIZE (onchip_24xx_clks); + clkp++) { +omap2_clk_rewrite_base (*clkp); + } +I'm afraid this also fails to satisfy my decency filter. Let's summarise what's going on here.
- the structure initializers are setup to cast integer register offsets to void
__iomem*.
- the code above walks all clock structures, looking for what could be considered an offset (iow, bits 31-24 of the pointer being zero).
- it looks at theOFFSET_GR_MODflag to determine which base to add in
- the base address is not 'void__iomem*' but 'u32'.
- we update the void__iomem* pointers in the structure.So, we have a base address which is an integer, and an offset which is an void
__iomem*.
Quoted 7 lines
Quoted 2 lines
I can see why you want to do this, but I think it needs more thought. I'll sit on this patch for a while.
I agree with your decency filter. I believe that patch was written for expediency. It turns out that all of the register rewriting code is ultimately unnecessary, and is wiped out in patch D 08.
What about the rest of the *_PRM_REGADDR() accessor macro changes in this patch?
The rest of the PM core code uses these and so does not build on top of the Russell's omap-clks3 branch.
Kevin
Paul Walmsley
maintainerRe: [PATCH A 09/10] OMAP2/3: Remove OMAP_PRM_REGADDR, OMAP_CM_REGADDR
Hi Kevin,
Quoted 5 lines · Kevin Hilman
What about the rest of the
*_PRM_REGADDR()accessor macro changes in this patch?The rest of the PM core code uses these and so does not build on top of the Russell's omap-clks3 branch.
yes, all of the *_{PRM,CM}_REGADDR() work should be kept.
- Paul
Re: [PATCH A 09/10] OMAP2/3: Remove OMAP_PRM_REGADDR, OMAP_CM_REGADDR
Quoted 11 lines · Paul Walmsley
Hi Kevin,
Quoted 5 lines · Kevin Hilman
What about the rest of the
*_PRM_REGADDR()accessor macro changes in this patch?The rest of the PM core code uses these and so does not build on top of the Russell's omap-clks3 branch.
yes, all of the *_{PRM,CM}_REGADDR() work should be kept.
Well, in case it wasn't clear from my previous mail, I'm not merging this.
Re: [PATCH A 09/10] OMAP2/3: Remove OMAP_PRM_REGADDR, OMAP_CM_REGADDR
Quoted 8 lines · Russell King - ARM Linux
Quoted 7 lines · Paul Walmsley
Hi Kevin,
Quoted 3 lines · Kevin Hilman
What about the rest of the
*_PRM_REGADDR()accessor macro changes in this patch?
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
The rest of the PM core code uses these and so does not build on top of the Russell's omap-clks3 branch.
yes, all of the *_{PRM,CM}_REGADDR() work should be kept.
Well, in case it wasn't clear from my previous mail, I'm not merging this.
It was clear why you weren't merging the couple pieces that you referenced, but it wasn't clear whether you had problems with the rest of the patch.
Kevin
Re: [PATCH A 09/10] OMAP2/3: Remove OMAP_PRM_REGADDR, OMAP_CM_REGADDR
Quoted 13 lines · Kevin Hilman
Quoted 11 lines · Russell King - ARM Linux
Quoted 10 lines · Paul Walmsley
Hi Kevin,
Quoted 5 lines · Kevin Hilman
What about the rest of the
*_PRM_REGADDR()accessor macro changes in this patch?The rest of the PM core code uses these and so does not build on top of the Russell's omap-clks3 branch.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
yes, all of the *_{PRM,CM}_REGADDR() work should be kept.
Well, in case it wasn't clear from my previous mail, I'm not merging this.
It was clear why you weren't merging the couple pieces that you referenced, but it wasn't clear whether you had problems with the rest of the patch.
Because it's just plain wrong. It persists in creating new instances of crap that I've already removed, such as using 'u32' instead of void __iomem pointers for register addresses.
It persists in the init-time fixup of addresses. The clkdm.name->clkdm.ptr fixup is unreliable without having a flag to say whether it's been done or not.
And so forth.
Basically, rewriting stuff in place from one representation to another representation with no way to tell whether it's been done is just plain silly and a recipe for madness.
While the powerdomain stuff can be (and has been) failed, clocks can't be failed as a result of the rewrites not working - since they're referenced by other clocks, we'd need some way to ensure all childs of a failed parent also fail.
Moreover, the approach taken in the series of patches introducing it requires some clocks to be split up just for the sake of supporting this alternative method - I'm referring here to the creation of the mcbsp src clocks.
If I look at the remaining patch dependencies, then it works out as something like this:
+---[A 09] OMAP2/3: Remove OMAP_PRM_REGADDR, OMAP_CM_REGADDR
+---[D 05] OMAP2 clock: add clk.prcm_mod field; annotate OMAP2xxx clocks
+---[D 06] OMAP3 clock: add "prcm_mod" field to OMAP3xxx clocks
+---[D 07] OMAP2/3 clock: add _omap2_clk_{read,write}_reg()
+---[D 08] OMAP2/3 clock: use clk->prcm_mod for all struct clk register addres
+---[D 09] OMAP2/3 clock: encode target IDLEST bits
+---[F 05] OMAP clock: add OMAP chip family-specific clk_register() option
+---[D 04] OMAP3 clock: split mcbspX_src_fck from mcbspX_fck
|
| +-[B 01] OMAP2/3 clock: combine clkdm, clkdm_name into union in struct clk
| +-[B 03] OMAP2/3 clockdomains: add CM, PRM, virt_opp_clkdm clockdomains
| +-[B 05] OMAP2/3 clock: add clockdomains to all remaining clocks; fix clkdm
| |
+-+-[F 12] OMAP2/3 McBSP: add temporary clockdomain fix for McBSP virtual cloc
|
+-[F 06] OMAP2/3 clock: every clock must have a clkdmwhere D4 is a side effect of the way register addresses are being handled (iow D6), and F12 is a side effect of requiring F6 and D4. Moreover, the virt_opp_clkdm part of B03 is a side effect of F6.
If we're having to introduce work-arounds for ways things are being done, that's a sure sign that the original change was not correct.
Also, from what I've heard, the register access issue is going to be far larger and is going to require _significant_ rework when OMAP4 becomes available - apparantly, not only are the unit base addresses different, but also the offsets within each functional unit.
So, rather than continuing with what is a sub-standard approach, I think it needs more thought and consideration, and in my opinion it is not ready for mainline.
So, what can we do to cleanly sort this out? I have an idea, but I need time to work on it... time I don't think I can spend this late in the kernel cycle.
So at this point I'm going to say: okay, the above patches are not going to get merged. I'm going to push out what I have onto the list later today, and if nothing comes back I'll merge the omap-clks3 branch into the devel branch for the next merge window.
Paul Walmsley
maintainerRe: [PATCH A 09/10] OMAP2/3: Remove OMAP_PRM_REGADDR, OMAP_CM_REGADDR
Hello Richard
Quoted 18 lines · Russell King - ARM Linux
Quoted 17 lines · Kevin Hilman
Quoted 14 lines · Russell King - ARM Linux
Quoted 11 lines · Paul Walmsley
Hi Kevin,
Quoted 5 lines · Kevin Hilman
What about the rest of the
*_PRM_REGADDR()accessor macro changes in this patch?The rest of the PM core code uses these and so does not build on top of the Russell's omap-clks3 branch.
yes, all of the *_{PRM,CM}_REGADDR() work should be kept.
Well, in case it wasn't clear from my previous mail, I'm not merging this.
Quoted 8 lines
Quoted 3 lines
It was clear why you weren't merging the couple pieces that you referenced, but it wasn't clear whether you had problems with the rest of the patch.
Because it's just plain wrong. It persists in creating new instances of crap that I've already removed, such as using 'u32' instead of void
__iomempointers for register addresses.
It persists in the init-time fixup of addresses.
Sounds like there has been some miscommunication. From our previous E-mail on this topic,
http://lkml.org/lkml/2009/1/29/32
... we agreed that the register rewriting part of this patch should not be merged; and noted that the register base rewriting was removed by D 10. (At the end of the six series, all virtual addresses are typed as void __iomem *.)
Quoted 2 lines
The
clkdm.name->clkdm.ptrfixup is unreliable without having a flag to say whether it's been done or not.
Could we just add a simple CLOCK_INITED clock flag to resolve your concerns here? Or are you referring to a different problem?
Quoted 6 lines
And so forth.
While the powerdomain stuff can be (and has been) failed, clocks can't be failed as a result of the rewrites not working - since they're referenced by other clocks, we'd need some way to ensure all childs of a failed parent also fail.
This seems to be an inherent issue with the structure of the clock tree itself, with parent pointers to static structures, rather than with clockdomain rewriting. Undoubtedly we could put plenty more validity checks into the clock code. The question is whether they would be worth the code space/development time tradeoff. Most of the validity problems observed during the last few years of work prompted checks to be added.
Quoted 4 lines
Moreover, the approach taken in the series of patches introducing it requires some clocks to be split up just for the sake of supporting this alternative method - I'm referring here to the creation of the mcbsp src clocks.
It's true that the mcbsp_fck clocks needed to split to accomodate the PRCM module + register offset change, but as noted before, I don't think it affects anything in practice. It's an internal clock tree structure detail that ultimately won't be exposed to the driver. It doesn't involve any rewriting.
Quoted 20 lines
If I look at the remaining patch dependencies, then it works out as something like this:
+---[A 09] OMAP2/3: Remove OMAP_PRM_REGADDR, OMAP_CM_REGADDR +---[D 05] OMAP2 clock: add clk.prcm_mod field; annotate OMAP2xxx clocks +---[D 06] OMAP3 clock: add "prcm_mod" field to OMAP3xxx clocks +---[D 07] OMAP2/3 clock: add _omap2_clk_{read,write}_reg() +---[D 08] OMAP2/3 clock: use clk->prcm_mod for all struct clk register addres +---[D 09] OMAP2/3 clock: encode target IDLEST bits +---[F 05] OMAP clock: add OMAP chip family-specific clk_register() option +---[D 04] OMAP3 clock: split mcbspX_src_fck from mcbspX_fck | | +-[B 01] OMAP2/3 clock: combine clkdm, clkdm_name into union in struct clk | +-[B 03] OMAP2/3 clockdomains: add CM, PRM, virt_opp_clkdm clockdomains | +-[B 05] OMAP2/3 clock: add clockdomains to all remaining clocks; fix clkdm | | +-+-[F 12] OMAP2/3 McBSP: add temporary clockdomain fix for McBSP virtual cloc | +-[F 06] OMAP2/3 clock: every clock must have a clkdm
Quoted 6 lines
where D4 is a side effect of the way register addresses are being handled (iow D6), and F12 is a side effect of requiring F6 and D4. Moreover, the
virt_opp_clkdmpart of B03 is a side effect of F6.If we're having to introduce work-arounds for ways things are being done, that's a sure sign that the original change was not correct.
Or that we haven't yet had the opportunity to implement a more wide-ranging code change, as is the case with the virt_opp_clkdm. That is slated for removal; it's currently removed for OMAP3 in development code.
The working model has been to work on individual pieces separately, to build towards an end-goal, rather than making a huge set of changes all at once with multiple interlocking code pieces.
Patch F 12 is no longer needed, as we discussed earlier. It was only needed because the old McBSP driver used some buggy custom clocks, and this has already been fixed in the driver.
Quoted 4 lines
Also, from what I've heard, the register access issue is going to be far larger and is going to require _significant_ rework when OMAP4 becomes available - apparantly, not only are the unit base addresses different, but also the offsets within each functional unit.
OMAP4 will require many changes, to many other parts of the code also. It would be unfortunate if many of the OMAP2/3 changes will stall until the OMAP4 work is completed - that's several months away at least.
Quoted 7 lines
So, rather than continuing with what is a sub-standard approach, I think it needs more thought and consideration, and in my opinion it is not ready for mainline.
So, what can we do to cleanly sort this out? I have an idea, but I need time to work on it... time I don't think I can spend this late in the kernel cycle.
Can you propose your idea for discussion? That way, we can discuss it, and if it works out, we can go forward with implementing it, if you wind up being busy with other things.
Quoted 4 lines
So at this point I'm going to say: okay, the above patches are not going to get merged. I'm going to push out what I have onto the list later today, and if nothing comes back I'll merge the omap-clks3 branch into the devel branch for the next merge window.
regards,
- Paul
Paul Walmsley
maintainerRe: [PATCH A 09/10] OMAP2/3: Remove OMAP_PRM_REGADDR, OMAP_CM_REGADDR
Quoted 1 line · Paul Walmsley
Hello Richard
(my apologies, of course this should have been, "Hello Russell")
- Paul
Paul Walmsley
maintainerPATCH 10/10 OMAP2: Implement CPUfreq frequency table based on PRCM table
In reply to Paul WalmsleyFrom: Kevin Hilman <[email protected]>
This patch adds a CPUfreq frequency-table implementation for OMAP2 by walking the PRCM rate-table for available entries and adding them to a CPUfreq table.
CPUfreq can then be used to manage switching between all the available entries in the PRCM rate table. Either use the CPUfreq sysfs interface directly, (see Section 3 of Documentation/cpu-freq/user-guide.txt) or use the cpufrequtils package:
http://www.kernel.org/pub/linux/utils/kernel/cpufreq/cpufrequtils.html
Updated to try to use cpufreq_table if it exists.
linux-omap source commit is 77ce544fa48deb7a2003f454624e3ca10d37ab87.
--- arch/arm/mach-omap2/clock24xx.c | 42 +++++++++++++++++++++++ arch/arm/plat-omap/cpu-omap.c | 57 +++++++++++++++++++++++++++++-- arch/arm/plat-omap/include/mach/clock.h | 3 ++ 3 files changed, 98 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/clock24xx.c +42 -0
@@ -378,6 +378,45 @@ static int omap2_select_table_rate(struct clk *clk, unsigned long rate)return 0 ; } +#ifdef CONFIG_CPU_FREQ +/* +* Walk PRCM rate table and fillout cpufreq freq_table +*/ +static struct cpufreq_frequency_table freq_table[ARRAY_SIZE (rate_table)]; + +void omap2_clk_init_cpufreq_table (struct cpufreq_frequency_table **table) +{ +struct prcm_config *prcm; +int i =0 ; + +for (prcm = rate_table; prcm->mpu_speed; prcm++) { +if (!(prcm->flags & cpu_mask)) +continue ; +if (prcm->xtal_speed != sys_ck.rate) +continue ; + +/* don't put bypass rates in table */ +if (prcm->dpll_speed == prcm->xtal_speed) +continue ; + + freq_table[i].index = i; + freq_table[i].frequency = prcm->mpu_speed /1000 ; + i++; + } + +if (i ==0 ) { +printk (KERN_WARNING "%s: failed to initialize frequency " +"table\n" , __func__); +return ; + } + + freq_table[i].index = i; + freq_table[i].frequency =CPUFREQ_TABLE_END ; + + *table = &freq_table[0 ]; +} +#endif +static struct clk_functions omap2_clk_functions = { .clk_enable = omap2_clk_enable, .clk_disable = omap2_clk_disable,
@@ -385,6 +424,9 @@ static struct clk_functions omap2_clk_functions = { .clk_set_rate = omap2_clk_set_rate, .clk_set_parent = omap2_clk_set_parent, .clk_disable_unused = omap2_clk_disable_unused, +#ifdef CONFIG_CPU_FREQ + .clk_init_cpufreq_table = omap2_clk_init_cpufreq_table, +#endif };static u32 omap2_get_apll_clkin (void )
arch/arm/plat-omap/cpu-omap.c +53 -4
112 lines not on this page · raw message
arch/arm/plat-omap/include/mach/clock.h +3 -0
@@ -121,6 +121,9 @@ extern void clk_allow_idle(struct clk *clk);extern void clk_deny_idle (struct clk *clk);extern int clk_get_usecount (struct clk *clk);extern void clk_enable_init_clocks (void ); +#ifdef CONFIG_CPU_FREQ +extern void clk_init_cpufreq_table (struct cpufreq_frequency_table **table); +#endif /* Clock flags */ #define RATE_CKCTL (1 << 0)/* Main fixed ratio clocks */