OMAP2/3: clock sync with linux-omap
Subsystems (18)
cover OMAP2/3: clock sync with linux-omap
This is the series of patches contained in the 'omap-clks3' branch of Russell King's git repository[1]. Posted on behalf of Russell who had some mail issues in first attempt, and then ran of out time.
This series is proposed to be merged into the next merge window.
Comments to the list appreciated.
Kevin
[1] http://ftp.arm.linux.org.uk/pub/armlinux/kernel/git-cur/linux-2.6-arm.git
Daniel Stone (1):
[ARM] OMAP2: Fix definition of SGX clock register bits
Jouni Hogander (2):
[ARM] OMAP3: PM: Emu_pwrdm is switched off by hardware even when sdti
is in use
[ARM] OMAP34XX: Add miscellaneous definitions related to 34xx
Kevin Hilman (1):
[ARM] OMAP2: Implement CPUfreq frequency table based on PRCM table
Paul Walmsley (34):
[ARM] OMAP2/3: Add non-CORE DPLL rate set code and M, N programming [ARM] OMAP: Fix sparse, checkpatch warnings in OMAP2/3 PRCM/PM code [ARM] OMAP24xx clock: add missing SSI L4 interface clock [ARM] OMAP3: move USBHOST SAR handling from clock framework to
powerdomain layer
[ARM] OMAP3 clock: fix 96MHz clocks
[ARM] OMAP: Make dpll4_m4_ck programmable with clk_set_rate() [ARM] OMAP2/3 clockdomains: combine pwrdm, pwrdm_name into union in
struct clockdomain
[ARM] OMAP2/3 clockdomains: add CM and PRM clkdms
[ARM] OMAP3 clock: move sys_clkout2 clk to core_clkdm [ARM] OMAP3 PRCM: add DPLL1-5 powerdomains, clockdomains; mark clocks [ARM] OMAP3 powerdomains: remove RET from SGX power states list [ARM] OMAP2/3 clockdomains: autodeps should respect platform flags [ARM] OMAP3 clock: fix DPLL jitter correction and rate programming [ARM] OMAP3 clock: DPLL{1,2}_FCLK clksel can divide by 4 [ARM] OMAP3 clock: convert dpll_data.idlest_bit to idlest_mask [ARM] OMAP3 clock: remove unnecessary dpll_data dereferences [ARM] OMAP3 clock: optimize DPLL rate rounding algorithm [ARM] OMAP3 clock: avoid invalid FREQSEL values during DPLL rate
rounding
[ARM] OMAP3 clock: disable DPLL autoidle while waiting for DPLL to
lock
[ARM] OMAP2/3 clock: clean up mach-omap2/clock.c
[ARM] OMAP2 PRCM: clean up CM_IDLEST bits
[ARM] OMAP2 SDRC: move mach-omap2/memory.h into mach/sdrc.h [ARM] OMAP2 SDRC: rename memory.c to sdrc2xxx.c
[ARM] OMAP2 SDRC: separate common OMAP2/3 code from OMAP2xxx code [ARM] OMAP2 SDRC: add SDRAM timing parameter infrastructure [ARM] OMAP3 clock: add omap3_core_dpll_m2_set_rate()
[ARM] OMAP2/3 clock: use standard set_rate fn in
omap2_clk_arch_init()
[ARM] OMAP2/3 clock: don't use a barrier after clk_disable() [ARM] OMAP2xxx clock: consolidate DELAYED_APP clock commits; fix
barrier
[ARM] OMAP2/3 clock: convert remaining MPU barriers into OCP barriers [ARM] OMAP clock: drop clk_get_usecount()
[ARM] OMAP2/3 clock: don't tinker with hardirqs when they are
supposed to be disabled
[ARM] OMAP3: update ES level flags to discriminate between post-ES2
revisions
[ARM] OMAP3 powerdomains: make USBTLL SAR only available on ES3.1 and
beyond
Russell King (44):
[ARM] omap: remove VIRTUAL_CLOCK
[ARM] omap: introduce clock operations structure
[ARM] omap: provide a NULL clock operations structure [ARM] omap: kill PARENT_CONTROLS_CLOCK
[ARM] omap: add default .ops to all remaining OMAP2 clocks [ARM] omap: eliminate unnecessary conditionals in
omap2_clk_wait_ready
[ARM] omap: don't use clkops_omap2_dflt_wait for non-ICLK/FCLK clocks [ARM] omap: remove clk->owner
[ARM] omap: rearrange clock.h structure order
[ARM] omap: remove clk_deny_idle and clk_allow_idle
[ARM] omap: provide a standard clk_get_parent() implementation [ARM] omap: move clock propagation into core omap clock code [ARM] omap: remove unnecessary calls to propagate_rate() [ARM] omap: move propagate_rate() calls into generic omap clock code [ARM] omap: handle RATE_CKCTL via .set_rate/.round_rate methods [ARM] omap: ensure devname is set for dummy devices
[ARM] omap: allow double-registering of clocks
[ARM] omap: convert OMAP1 to use clkdev
[ARM] omap: convert OMAP2 to use clkdev
[ARM] omap: convert OMAP3 to use clkdev
[ARM] omap: remove pre-CLKDEV clk_get/clk_put
[ARM] omap: provide a dummy clock node
[ARM] omap: watchdog: convert clocks to match by devid and conid [ARM] omap: watchdog: provide a dummy ick for OMAP1
[ARM] omap: MMC: convert clocks to match by devid and conid [ARM] omap: MMC: provide a dummy ick for OMAP1
[ARM] omap: mcspi: new short connection id names
[ARM] omap: mcbsp: convert to use fck/ick clocks directly [ARM] omap: i2c: use short connection ids
[ARM] omap: i2c: remove armxor_ck
[ARM] omap: i2c: remove conditional ick clocks
[ARM] omap: w1: convert omap HDQ clocks to match by devid and conid [ARM] omap: spi: arrange for omap_uwire to use connection ID [ARM] omap: convert omap RNG clocks to match by devid and conid [ARM] omap: omap24xxcam: use short connection IDs for omap2 clocks [ARM] omap: hsmmc: new short connection id names
[ARM] omap: clks: call recalc after any rate change
[ARM] omap: create a proper tree of clocks
[ARM] omap: fix usecount decrement bug
[ARM] omap: fix clockdomain enable/disable ordering
[ARM] omap: arrange for clock recalc methods to return the rate [ARM] omap: add support for bypassing DPLLs
[ARM] omap: ensure that failing power domain lookups produce errors [ARM] omap: clk_set_parent: deny changing parent if clock is enabled
Sergio Aguirre (1):
[ARM] OMAP: Add CSI2 clock struct for handling it with clock API
Tero Kristo (1):
[ARM] OMAP3: PM: Make sure clk_disable_unused() order is correct
Tomi Valkeinen (1):
[ARM] OMAP: wait for pwrdm transition after clk_enable()
Tony Lindgren (1):
[ARM] omap: Fix omap1 clock issues
arch/arm/mach-omap1/clock.c | 407 ++++++---- arch/arm/mach-omap1/clock.h | 412 +++------- arch/arm/mach-omap1/mcbsp.c | 52 +- arch/arm/mach-omap2/Makefile | 6 +- arch/arm/mach-omap2/board-2430sdp.c | 2 +- arch/arm/mach-omap2/board-apollon.c | 2 +- arch/arm/mach-omap2/board-generic.c | 2 +- arch/arm/mach-omap2/board-h4.c | 2 +- arch/arm/mach-omap2/board-ldp.c | 2 +- arch/arm/mach-omap2/board-omap3beagle.c | 2 +- arch/arm/mach-omap2/clock.c | 499 +++++++----- arch/arm/mach-omap2/clock.h | 24 +- arch/arm/mach-omap2/clock24xx.c | 377 +++++++-- arch/arm/mach-omap2/clock24xx.h | 525 +++++-------- arch/arm/mach-omap2/clock34xx.c | 582 ++++++++++++-- arch/arm/mach-omap2/clock34xx.h | 1076 +++++++++---------------- arch/arm/mach-omap2/clockdomain.c | 76 +- arch/arm/mach-omap2/clockdomains.h | 118 ++- arch/arm/mach-omap2/cm-regbits-24xx.h | 80 ++- arch/arm/mach-omap2/cm-regbits-34xx.h | 121 +++- arch/arm/mach-omap2/devices.c | 5 +- arch/arm/mach-omap2/id.c | 7 +- arch/arm/mach-omap2/io.c | 8 +- arch/arm/mach-omap2/mcbsp.c | 26 - arch/arm/mach-omap2/memory.c | 191 ----- arch/arm/mach-omap2/memory.h | 43 - arch/arm/mach-omap2/pm.c | 2 +- arch/arm/mach-omap2/powerdomains.h | 8 +- arch/arm/mach-omap2/powerdomains34xx.h | 68 ++- arch/arm/mach-omap2/prcm-common.h | 198 +++-- arch/arm/mach-omap2/prm-regbits-34xx.h | 9 + arch/arm/mach-omap2/prm.h | 24 +- arch/arm/mach-omap2/sdrc.c | 93 +++ arch/arm/mach-omap2/sdrc2xxx.c | 163 ++++ arch/arm/plat-omap/Kconfig | 3 + arch/arm/plat-omap/clock.c | 198 ++--- arch/arm/plat-omap/common.c | 2 +- arch/arm/plat-omap/cpu-omap.c | 57 ++- arch/arm/plat-omap/include/mach/clkdev.h | 13 + arch/arm/plat-omap/include/mach/clock.h | 80 +- arch/arm/plat-omap/include/mach/clockdomain.h | 24 +- arch/arm/plat-omap/include/mach/common.h | 2 +- arch/arm/plat-omap/include/mach/cpu.h | 26 +- arch/arm/plat-omap/include/mach/gpmc.h | 2 +- arch/arm/plat-omap/include/mach/io.h | 4 +- arch/arm/plat-omap/include/mach/mcbsp.h | 6 +- arch/arm/plat-omap/include/mach/pm.h | 12 - arch/arm/plat-omap/include/mach/powerdomain.h | 5 +- arch/arm/plat-omap/include/mach/prcm.h | 5 +- arch/arm/plat-omap/include/mach/sdrc.h | 64 ++- arch/arm/plat-omap/include/mach/system.h | 4 +- arch/arm/plat-omap/mcbsp.c | 90 +-- drivers/char/hw_random/omap-rng.c | 2 +- drivers/i2c/busses/i2c-omap.c | 47 +- drivers/media/video/omap24xxcam.c | 8 +- drivers/mmc/host/omap.c | 24 +- drivers/mmc/host/omap_hsmmc.c | 4 +- drivers/spi/omap2_mcspi.c | 4 +- drivers/spi/omap_uwire.c | 9 +- drivers/w1/masters/omap_hdq.c | 4 +- drivers/watchdog/omap_wdt.c | 94 +-- 61 files changed, 3275 insertions(+), 2730 deletions(-) delete mode 100644 arch/arm/mach-omap2/memory.c delete mode 100644 arch/arm/mach-omap2/memory.h create mode 100644 arch/arm/mach-omap2/sdrc.c create mode 100644 arch/arm/mach-omap2/sdrc2xxx.c create mode 100644 arch/arm/plat-omap/include/mach/clkdev.h
PATCH 1/86 omap: remove VIRTUAL_CLOCK
From: Russell King <[email protected]>
Nothing tests the clock flags for this bit, so it serves no purpose. Remove it.
--- arch/arm/mach-omap1/clock.h | 8 +++----- arch/arm/mach-omap2/clock24xx.h | 2 +- arch/arm/plat-omap/include/mach/clock.h | 1 - 3 files changed, 4 insertions(+), 7 deletions(-)
arch/arm/mach-omap1/clock.h +3 -5
@@ -734,7 +734,7 @@ static struct clk mmc2_ck = {static struct clk virtual_ck_mpu = { .name ="mpu" , .flags =CLOCK_IN_OMAP1510 |CLOCK_IN_OMAP16XX | -CLOCK_IN_OMAP310 |VIRTUAL_CLOCK |ALWAYS_ENABLED , +CLOCK_IN_OMAP310 |ALWAYS_ENABLED , .parent = &arm_ck,/* Is smarter alias for */ .recalc = &followparent_recalc, .set_rate = &omap1_select_table_rate,
@@ -749,8 +749,7 @@ static struct clk i2c_fck = { .name = "i2c_fck", .id = 1, .flags =CLOCK_IN_OMAP310 |CLOCK_IN_OMAP1510 |CLOCK_IN_OMAP16XX | -VIRTUAL_CLOCK |CLOCK_NO_IDLE_PARENT | - ALWAYS_ENABLED, + CLOCK_NO_IDLE_PARENT | ALWAYS_ENABLED, .parent = &armxor_ck.clk, .recalc = &followparent_recalc, .enable = &omap1_clk_enable_generic,
@@ -760,8 +759,7 @@ static struct clk i2c_fck = {static struct clk i2c_ick = { .name ="i2c_ick" , .id =1 , - .flags =CLOCK_IN_OMAP16XX | -VIRTUAL_CLOCK |CLOCK_NO_IDLE_PARENT | + .flags =CLOCK_IN_OMAP16XX |CLOCK_NO_IDLE_PARENT |ALWAYS_ENABLED , .parent = &armper_ck.clk, .recalc = &followparent_recalc,
arch/arm/mach-omap2/clock24xx.h +1 -1
@@ -2629,7 +2629,7 @@ static struct clk mmchsdb2_fck = {static struct clk virt_prcm_set = { .name ="virt_prcm_set" , .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | -VIRTUAL_CLOCK |ALWAYS_ENABLED |DELAYED_APP , +ALWAYS_ENABLED |DELAYED_APP , .parent = &mpu_ck,/* Indexed by mpu speed, no parent */ .recalc = &omap2_table_mpu_recalc,/* sets are keyed on mpu rate */ .set_rate = &omap2_select_table_rate,
arch/arm/plat-omap/include/mach/clock.h +0 -1
@@ -125,7 +125,6 @@ extern void clk_enable_init_clocks(void);#define RATE_CKCTL (1 << 0)/* Main fixed ratio clocks */ #define RATE_FIXED (1 << 1)/* Fixed clock rate */ #define RATE_PROPAGATES (1 << 2)/* Program children too */ -#define VIRTUAL_CLOCK (1 << 3)/* Composite clock from table */ #define ALWAYS_ENABLED (1 << 4)/* Clock cannot be disabled */ #define ENABLE_REG_32BIT (1 << 5)/* Use 32-bit access */ #define VIRTUAL_IO_ADDRESS (1 << 6)/* Clock in virtual address */
Signature · 1 line
1.6.1.2
PATCH 2/86 omap: introduce clock operations structure
From: Russell King <[email protected]>
Collect up all the common enable/disable clock operation functions into a separate operations structure.
--- arch/arm/mach-omap1/clock.c | 30 ++++++- arch/arm/mach-omap1/clock.h | 152 ++++++++++--------------------- arch/arm/mach-omap2/clock.c | 8 +- arch/arm/mach-omap2/clock24xx.c | 16 +++- arch/arm/mach-omap2/clock24xx.h | 13 +-- arch/arm/mach-omap2/clock34xx.c | 10 ++- arch/arm/mach-omap2/clock34xx.h | 11 +-- arch/arm/plat-omap/include/mach/clock.h | 8 +- 8 files changed, 115 insertions(+), 133 deletions(-)
arch/arm/mach-omap1/clock.c +27 -3
@@ -26,8 +26,17 @@#include <mach/clock.h> #include <mach/sram.h> +static const struct clkops clkops_generic; +static const struct clkops clkops_uart; +static const struct clkops clkops_dspck; +#include "clock.h" +static int omap1_clk_enable_generic (struct clk * clk); +static int omap1_clk_enable (struct clk *clk); +static void omap1_clk_disable_generic (struct clk * clk); +static void omap1_clk_disable (struct clk *clk); +__u32 arm_idlect1_mask;/*-------------------------------------------------------------------------
@@ -78,6 +87,11 @@ static void omap1_clk_disable_dsp_domain(struct clk *clk) } } +static const struct clkops clkops_dspck = { + .enable = &omap1_clk_enable_dsp_domain, + .disable = &omap1_clk_disable_dsp_domain, +}; +static int omap1_clk_enable_uart_functional (struct clk *clk) {int ret;
@@ -105,6 +119,11 @@ static void omap1_clk_disable_uart_functional(struct clk *clk)omap1_clk_disable_generic (clk); } +static const struct clkops clkops_uart = { + .enable = &omap1_clk_enable_uart_functional, + .disable = &omap1_clk_disable_uart_functional, +}; +static void omap1_clk_allow_idle (struct clk *clk) {struct arm_idlect1_clk * iclk = (struct arm_idlect1_clk *)clk;
@@ -468,7 +487,7 @@ static int omap1_clk_enable(struct clk *clk)omap1_clk_deny_idle (clk->parent); } - ret = clk->enable (clk); + ret = clk->ops->enable (clk);if (unlikely (ret !=0 ) && clk->parent) {omap1_clk_disable (clk->parent);
@@ -482,7 +501,7 @@ static int omap1_clk_enable(struct clk *clk)static void omap1_clk_disable (struct clk *clk) {if (clk->usecount >0 && !(--clk->usecount)) { - clk->disable (clk); + clk->ops->disable (clk);if (likely (clk->parent)) {omap1_clk_disable (clk->parent);if (clk->flags &CLOCK_NO_IDLE_PARENT )
@@ -561,6 +580,11 @@ static void omap1_clk_disable_generic(struct clk *clk) } } +static const struct clkops clkops_generic = { + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, +}; +static long omap1_clk_round_rate (struct clk *clk,unsigned long rate) {int dsor_exp;
@@ -659,7 +683,7 @@ static void __init omap1_clk_disable_unused(struct clk *clk) }printk (KERN_INFO "Disabling unused clock \"%s\"... " , clk->name); - clk->disable (clk); + clk->ops->disable (clk);printk (" done\n" ); }
arch/arm/mach-omap1/clock.h +48 -104
658 lines not on this page · raw message
arch/arm/mach-omap2/clock.c +4 -4
@@ -274,8 +274,8 @@ int _omap2_clk_enable(struct clk *clk)if (clk->flags & (ALWAYS_ENABLED |PARENT_CONTROLS_CLOCK ))return 0 ; -if (clk->enable) -return clk->enable (clk); +if (clk->ops && clk->ops->enable) +return clk->ops->enable (clk);if (unlikely (clk->enable_reg ==NULL )) { printk(KERN_ERR "clock.c: Enable for %s without enable code\n",
@@ -304,8 +304,8 @@ void _omap2_clk_disable(struct clk *clk)if (clk->flags & (ALWAYS_ENABLED |PARENT_CONTROLS_CLOCK ))return ; -if (clk->disable) { - clk->disable (clk); +if (clk->ops && clk->ops->disable) { + clk->ops->disable (clk);return ; }
arch/arm/mach-omap2/clock24xx.c +15 -1
@@ -34,12 +34,16 @@#include "memory.h" #include "clock.h" -#include "clock24xx.h" #include "prm.h" #include "prm-regbits-24xx.h" #include "cm.h" #include "cm-regbits-24xx.h" +static const struct clkops clkops_oscck; +static const struct clkops clkops_fixed; + +#include "clock24xx.h" +/* CM_CLKEN_PLL.EN_{54,96}M_PLL options (24XX) */ #define EN_APLL_STOPPED 0#define EN_APLL_LOCKED 3
@@ -96,6 +100,11 @@ static void omap2_disable_osc_ck(struct clk *clk) OMAP24XX_PRCM_CLKSRC_CTRL); } +static const struct clkops clkops_oscck = { + .enable = &omap2_enable_osc_ck, + .disable = &omap2_disable_osc_ck, +}; +#ifdef OLD_CK /* Recalculate SYST_CLK */ static void omap2_sys_clk_recalc (struct clk * clk)
@@ -149,6 +158,11 @@ static void omap2_clk_fixed_disable(struct clk *clk)cm_write_mod_reg (cval,PLL_MOD ,CM_CLKEN ); } +static const struct clkops clkops_fixed = { + .enable = &omap2_clk_fixed_enable, + .disable = &omap2_clk_fixed_disable, +}; +/* * Uses the current prcm set to tell if a rate is valid. * You can go slower, but not faster within a given rate set.
arch/arm/mach-omap2/clock24xx.h +3 -10
@@ -31,10 +31,6 @@ static void omap2_sys_clk_recalc(struct clk *clk);static void omap2_osc_clk_recalc (struct clk *clk);static void omap2_sys_clk_recalc (struct clk *clk);static void omap2_dpllcore_recalc (struct clk *clk); -static int omap2_clk_fixed_enable (struct clk *clk); -static void omap2_clk_fixed_disable (struct clk *clk); -static int omap2_enable_osc_ck (struct clk *clk); -static void omap2_disable_osc_ck (struct clk *clk);static int omap2_reprogram_dpllcore (struct clk *clk,unsigned long rate);/* Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated.
@@ -633,11 +629,10 @@ static struct clk func_32k_ck = {/* Typical 12/13MHz in standalone mode, will be 26Mhz in chassis mode */ static struct clk osc_ck = {/* (*12, *13, 19.2, *26, 38.4)MHz */ .name ="osc_ck" , + .ops = &clkops_oscck, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X |RATE_PROPAGATES , .clkdm_name ="wkup_clkdm" , - .enable = &omap2_enable_osc_ck, - .disable = &omap2_disable_osc_ck, .recalc = &omap2_osc_clk_recalc, };
@@ -695,6 +690,7 @@ static struct clk dpll_ck = {static struct clk apll96_ck = { .name ="apll96_ck" , + .ops = &clkops_fixed, .parent = &sys_ck, .rate =96000000 , .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X |
@@ -702,13 +698,12 @@ static struct clk apll96_ck = { .clkdm_name = "wkup_clkdm", .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), .enable_bit = OMAP24XX_EN_96M_PLL_SHIFT, - .enable = &omap2_clk_fixed_enable, - .disable = &omap2_clk_fixed_disable, .recalc = &propagate_rate, };static struct clk apll54_ck = { .name ="apll54_ck" , + .ops = &clkops_fixed, .parent = &sys_ck, .rate =54000000 , .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X |
@@ -716,8 +711,6 @@ static struct clk apll54_ck = { .clkdm_name = "wkup_clkdm", .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), .enable_bit = OMAP24XX_EN_54M_PLL_SHIFT, - .enable = &omap2_clk_fixed_enable, - .disable = &omap2_clk_fixed_disable, .recalc = &propagate_rate, };
arch/arm/mach-omap2/clock34xx.c +9 -1
@@ -33,12 +33,15 @@#include "memory.h" #include "clock.h" -#include "clock34xx.h" #include "prm.h" #include "prm-regbits-34xx.h" #include "cm.h" #include "cm-regbits-34xx.h" +static const struct clkops clkops_noncore_dpll_ops; + +#include "clock34xx.h" +/* CM_AUTOIDLE_PLL*.AUTO_* bit values */ #define DPLL_AUTOIDLE_DISABLE 0x0#define DPLL_AUTOIDLE_LOW_POWER_STOP 0x1
@@ -270,6 +273,11 @@ static void omap3_noncore_dpll_disable(struct clk *clk)_omap3_noncore_dpll_stop (clk); } +static const struct clkops clkops_noncore_dpll_ops = { + .enable = &omap3_noncore_dpll_enable, + .disable = &omap3_noncore_dpll_disable, +}; +/** * omap3_dpll_autoidle_read - read a DPLL's autoidle bits * @clk: struct clk * of the DPLL to read
arch/arm/mach-omap2/clock34xx.h +3 -8
@@ -32,8 +32,6 @@ static void omap3_clkoutx2_recalc(struct clk *clk);static void omap3_dpll_allow_idle (struct clk *clk);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);/* Maximum DPLL multiplier, divider values for OMAP3 */ #define OMAP3_MAX_DPLL_MULT 2048
@@ -347,11 +345,10 @@ static struct dpll_data dpll2_dd = {static struct clk dpll2_ck = { .name ="dpll2_ck" , + .ops = &clkops_noncore_dpll_ops, .parent = &sys_ck, .dpll_data = &dpll2_dd, .flags =CLOCK_IN_OMAP343X |RATE_PROPAGATES , - .enable = &omap3_noncore_dpll_enable, - .disable = &omap3_noncore_dpll_disable, .round_rate = &omap2_dpll_round_rate, .recalc = &omap3_dpll_recalc, };
@@ -582,11 +579,10 @@ static struct dpll_data dpll4_dd = {static struct clk dpll4_ck = { .name ="dpll4_ck" , + .ops = &clkops_noncore_dpll_ops, .parent = &sys_ck, .dpll_data = &dpll4_dd, .flags =CLOCK_IN_OMAP343X |RATE_PROPAGATES , - .enable = &omap3_noncore_dpll_enable, - .disable = &omap3_noncore_dpll_disable, .round_rate = &omap2_dpll_round_rate, .recalc = &omap3_dpll_recalc, };
@@ -884,11 +880,10 @@ static struct dpll_data dpll5_dd = {static struct clk dpll5_ck = { .name ="dpll5_ck" , + .ops = &clkops_noncore_dpll_ops, .parent = &sys_ck, .dpll_data = &dpll5_dd, .flags =CLOCK_IN_OMAP3430ES2 |RATE_PROPAGATES , - .enable = &omap3_noncore_dpll_enable, - .disable = &omap3_noncore_dpll_disable, .round_rate = &omap2_dpll_round_rate, .recalc = &omap3_dpll_recalc, };
arch/arm/plat-omap/include/mach/clock.h +6 -2
@@ -17,6 +17,11 @@ struct module;struct clk ;struct clockdomain ; +struct clkops { +int (*enable)(struct clk *); +void (*disable)(struct clk *); +}; +#if defined(CONFIG_ARCH_OMAP2 ) || defined(CONFIG_ARCH_OMAP3 ) struct clksel_rate {
@@ -59,6 +64,7 @@ struct dpll_data {struct clk {struct list_head node; +const struct clkops *ops;struct module *owner;const char *name;int id;
@@ -72,8 +78,6 @@ struct clk {int (*set_rate)(struct clk *,unsigned long );long (*round_rate)(struct clk *,unsigned long );void (*init)(struct clk *); -int (*enable)(struct clk *); -void (*disable)(struct clk *);#if defined(CONFIG_ARCH_OMAP2 ) || defined(CONFIG_ARCH_OMAP3 )u8 fixed_div;void __iomem *clksel_reg;
Signature · 1 line
1.6.1.2
PATCH 3/86 omap: provide a NULL clock operations structure
From: Russell King <[email protected]>
... and use it for clocks which are ALWAYS_ENABLED. These clocks use a non-NULL enable_reg pointer for other purposes (such as selecting clock rates.)
--- arch/arm/mach-omap1/clock.c | 3 - arch/arm/mach-omap1/clock.h | 78 +++++++++++++--------------- arch/arm/mach-omap2/clock.c | 4 +- arch/arm/mach-omap2/clock24xx.h | 31 ++++++++--- arch/arm/mach-omap2/clock34xx.h | 85 ++++++++++++++++++------------ arch/arm/plat-omap/clock.c | 23 ++++++++- arch/arm/plat-omap/include/mach/clock.h | 4 +- 7 files changed, 135 insertions(+), 93 deletions(-)
arch/arm/mach-omap1/clock.c +0 -3
@@ -515,9 +515,6 @@ static int omap1_clk_enable_generic(struct clk *clk)__u16 regval16;__u32 regval32; -if (clk->flags &ALWAYS_ENABLED ) -return 0 ; -if (unlikely (clk->enable_reg ==NULL )) {printk (KERN_ERR "clock.c: Enable for %s without enable code\n" , clk->name);
arch/arm/mach-omap1/clock.h +36 -42
217 lines not on this page · raw message
arch/arm/mach-omap2/clock.c +2 -2
@@ -271,7 +271,7 @@ int _omap2_clk_enable(struct clk *clk) {u32 regval32; -if (clk->flags & (ALWAYS_ENABLED |PARENT_CONTROLS_CLOCK )) +if (clk->flags &PARENT_CONTROLS_CLOCK )return 0 ;if (clk->ops && clk->ops->enable)
@@ -301,7 +301,7 @@ void _omap2_clk_disable(struct clk *clk) {u32 regval32; -if (clk->flags & (ALWAYS_ENABLED |PARENT_CONTROLS_CLOCK )) +if (clk->flags &PARENT_CONTROLS_CLOCK )return ;if (clk->ops && clk->ops->disable) {
arch/arm/mach-omap2/clock24xx.h +22 -9
@@ -619,9 +619,10 @@ static struct prcm_config rate_table[] = {/* Base external input clocks */ static struct clk func_32k_ck = { .name ="func_32k_ck" , + .ops = &clkops_null, .rate =32000 , .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | -RATE_FIXED |ALWAYS_ENABLED |RATE_PROPAGATES , +RATE_FIXED |RATE_PROPAGATES , .clkdm_name ="wkup_clkdm" , .recalc = &propagate_rate, };
@@ -639,18 +640,20 @@ static struct clk osc_ck = { /* (*12, *13, 19.2, *26, 38.4)MHz *//* Without modem likely 12MHz, with modem likely 13MHz */ static struct clk sys_ck = {/* (*12, *13, 19.2, 26, 38.4)MHz */ .name ="sys_ck" ,/* ~ ref_clk also */ + .ops = &clkops_null, .parent = &osc_ck, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | -ALWAYS_ENABLED |RATE_PROPAGATES , +RATE_PROPAGATES , .clkdm_name ="wkup_clkdm" , .recalc = &omap2_sys_clk_recalc, };static struct clk alt_ck = {/* Typical 54M or 48M, may not exist */ .name ="alt_ck" , + .ops = &clkops_null, .rate =54000000 , .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | -RATE_FIXED |ALWAYS_ENABLED |RATE_PROPAGATES , +RATE_FIXED |RATE_PROPAGATES , .clkdm_name ="wkup_clkdm" , .recalc = &propagate_rate, };
@@ -679,10 +682,11 @@ static struct dpll_data dpll_dd = {*/ static struct clk dpll_ck = { .name ="dpll_ck" , + .ops = &clkops_null, .parent = &sys_ck,/* Can be func_32k also */ .dpll_data = &dpll_dd, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | -RATE_PROPAGATES |ALWAYS_ENABLED , +RATE_PROPAGATES , .clkdm_name ="wkup_clkdm" , .recalc = &omap2_dpllcore_recalc, .set_rate = &omap2_reprogram_dpllcore,
@@ -751,9 +755,10 @@ static struct clk func_54m_ck = {static struct clk core_ck = { .name ="core_ck" , + .ops = &clkops_null, .parent = &dpll_ck,/* can also be 32k */ .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | -ALWAYS_ENABLED |RATE_PROPAGATES , +RATE_PROPAGATES , .clkdm_name ="wkup_clkdm" , .recalc = &followparent_recalc, };
@@ -837,6 +842,7 @@ static struct clk func_12m_ck = {/* Secure timer, only available in secure mode */ static struct clk wdt1_osc_ck = { .name ="ck_wdt1_osc" , + .ops = &clkops_null,/* RMK: missing? */ .parent = &osc_ck, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X , .recalc = &followparent_recalc,
@@ -996,9 +1002,10 @@ static const struct clksel mpu_clksel[] = {static struct clk mpu_ck = {/* Control cpu */ .name ="mpu_ck" , + .ops = &clkops_null, .parent = &core_ck, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | -ALWAYS_ENABLED |DELAYED_APP | +DELAYED_APP |CONFIG_PARTICIPANT |RATE_PROPAGATES , .clkdm_name ="mpu_clkdm" , .init = &omap2_init_clksel_parent,
@@ -1168,9 +1175,10 @@ static const struct clksel core_l3_clksel[] = {static struct clk core_l3_ck = {/* Used for ick and fck, interconnect */ .name ="core_l3_ck" , + .ops = &clkops_null, .parent = &core_ck, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | -ALWAYS_ENABLED |DELAYED_APP | +DELAYED_APP |CONFIG_PARTICIPANT |RATE_PROPAGATES , .clkdm_name ="core_l3_clkdm" , .clksel_reg =OMAP_CM_REGADDR (CORE_MOD ,CM_CLKSEL1 ),
@@ -1231,9 +1239,10 @@ static const struct clksel l4_clksel[] = {static struct clk l4_ck = {/* used both as an ick and fck */ .name ="l4_ck" , + .ops = &clkops_null, .parent = &core_l3_ck, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | -ALWAYS_ENABLED |DELAYED_APP |RATE_PROPAGATES , +DELAYED_APP |RATE_PROPAGATES , .clkdm_name ="core_l4_clkdm" , .clksel_reg =OMAP_CM_REGADDR (CORE_MOD ,CM_CLKSEL1 ), .clksel_mask =OMAP24XX_CLKSEL_L4_MASK ,
@@ -2359,6 +2368,7 @@ static struct clk i2chs1_fck = {static struct clk gpmc_fck = { .name ="gpmc_fck" , + .ops = &clkops_null,/* RMK: missing? */ .parent = &core_l3_ck, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X |ENABLE_ON_INIT ,
@@ -2368,6 +2378,7 @@ static struct clk gpmc_fck = {static struct clk sdma_fck = { .name ="sdma_fck" , + .ops = &clkops_null,/* RMK: missing? */ .parent = &core_l3_ck, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X , .clkdm_name ="core_l3_clkdm" ,
@@ -2376,6 +2387,7 @@ static struct clk sdma_fck = {static struct clk sdma_ick = { .name ="sdma_ick" , + .ops = &clkops_null,/* RMK: missing? */ .parent = &l4_ck, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X , .clkdm_name ="core_l3_clkdm" ,
@@ -2621,8 +2633,9 @@ static struct clk mmchsdb2_fck = {*/ static struct clk virt_prcm_set = { .name ="virt_prcm_set" , + .ops = &clkops_null, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | -ALWAYS_ENABLED |DELAYED_APP , +DELAYED_APP , .parent = &mpu_ck,/* Indexed by mpu speed, no parent */ .recalc = &omap2_table_mpu_recalc,/* sets are keyed on mpu rate */ .set_rate = &omap2_select_table_rate,
arch/arm/mach-omap2/clock34xx.h +51 -34
286 lines not on this page · raw message
arch/arm/plat-omap/clock.c +21 -2
@@ -358,6 +358,23 @@ void clk_enable_init_clocks(void) }EXPORT_SYMBOL (clk_enable_init_clocks); +/* +* Low level helpers +*/ +static int clkll_enable_null (struct clk *clk) +{ +return 0 ; +} + +static void clkll_disable_null (struct clk *clk) +{ +} + +const struct clkops clkops_null = { + .enable = clkll_enable_null, + .disable = clkll_disable_null, +}; +#ifdef CONFIG_CPU_FREQ void clk_init_cpufreq_table (struct cpufreq_frequency_table **table) {
@@ -383,8 +400,10 @@ static int __init clk_disable_unused(void)unsigned long flags;list_for_each_entry (ck, &clocks, node) { -if (ck->usecount >0 || (ck->flags &ALWAYS_ENABLED ) || - ck->enable_reg ==0 ) +if (ck->ops == &clkops_null) +continue ; + +if (ck->usecount >0 || ck->enable_reg ==0 )continue ;spin_lock_irqsave (&clockfw_lock, flags);
arch/arm/plat-omap/include/mach/clock.h +3 -1
@@ -125,11 +125,13 @@ extern void clk_deny_idle(struct clk *clk);extern int clk_get_usecount (struct clk *clk);extern void clk_enable_init_clocks (void ); +extern const struct clkops clkops_null; +/* Clock flags */ #define RATE_CKCTL (1 << 0)/* Main fixed ratio clocks */ #define RATE_FIXED (1 << 1)/* Fixed clock rate */ #define RATE_PROPAGATES (1 << 2)/* Program children too */ -#define ALWAYS_ENABLED (1 << 4)/* Clock cannot be disabled */ +/* bits 3-4 are free */ #define ENABLE_REG_32BIT (1 << 5)/* Use 32-bit access */ #define VIRTUAL_IO_ADDRESS (1 << 6)/* Clock in virtual address */ #define CLOCK_IDLE_CONTROL (1 << 7)
Signature · 1 line
1.6.1.2
PATCH 4/86 omap: kill PARENT_CONTROLS_CLOCK
From: Russell King <[email protected]>
PARENT_CONTROLS_CLOCK just makes enable/disable no-op, and is functionally an alias for ALWAYS_ENABLED. This can be handled in the same way, using clkops_null.
--- arch/arm/mach-omap2/clock.c | 6 - arch/arm/mach-omap2/clock24xx.h | 22 +++-- arch/arm/mach-omap2/clock34xx.h | 196 ++++++++++++++++--------------- arch/arm/plat-omap/include/mach/clock.h | 1 - 4 files changed, 114 insertions(+), 111 deletions(-)
arch/arm/mach-omap2/clock.c +0 -6
@@ -271,9 +271,6 @@ int _omap2_clk_enable(struct clk *clk) {u32 regval32; -if (clk->flags &PARENT_CONTROLS_CLOCK ) -return 0 ; -if (clk->ops && clk->ops->enable)return clk->ops->enable (clk);
@@ -301,9 +298,6 @@ void _omap2_clk_disable(struct clk *clk) {u32 regval32; -if (clk->flags &PARENT_CONTROLS_CLOCK ) -return ; -if (clk->ops && clk->ops->disable) { clk->ops->disable (clk);return ;
arch/arm/mach-omap2/clock24xx.h +14 -8
@@ -742,9 +742,10 @@ static const struct clksel func_54m_clksel[] = {static struct clk func_54m_ck = { .name ="func_54m_ck" , + .ops = &clkops_null, .parent = &apll54_ck,/* can also be alt_clk */ .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | -RATE_PROPAGATES |PARENT_CONTROLS_CLOCK , +RATE_PROPAGATES , .clkdm_name ="wkup_clkdm" , .init = &omap2_init_clksel_parent, .clksel_reg =OMAP_CM_REGADDR (PLL_MOD ,CM_CLKSEL1 ),
@@ -783,9 +784,10 @@ static const struct clksel func_96m_clksel[] = {/* The parent of this clock is not selectable on 2420. */ static struct clk func_96m_ck = { .name ="func_96m_ck" , + .ops = &clkops_null, .parent = &apll96_ck, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | -RATE_PROPAGATES |PARENT_CONTROLS_CLOCK , +RATE_PROPAGATES , .clkdm_name ="wkup_clkdm" , .init = &omap2_init_clksel_parent, .clksel_reg =OMAP_CM_REGADDR (PLL_MOD ,CM_CLKSEL1 ),
@@ -816,9 +818,10 @@ static const struct clksel func_48m_clksel[] = {static struct clk func_48m_ck = { .name ="func_48m_ck" , + .ops = &clkops_null, .parent = &apll96_ck,/* 96M or Alt */ .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | -RATE_PROPAGATES |PARENT_CONTROLS_CLOCK , +RATE_PROPAGATES , .clkdm_name ="wkup_clkdm" , .init = &omap2_init_clksel_parent, .clksel_reg =OMAP_CM_REGADDR (PLL_MOD ,CM_CLKSEL1 ),
@@ -831,10 +834,11 @@ static struct clk func_48m_ck = {static struct clk func_12m_ck = { .name ="func_12m_ck" , + .ops = &clkops_null, .parent = &func_48m_ck, .fixed_div =4 , .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | -RATE_PROPAGATES |PARENT_CONTROLS_CLOCK , +RATE_PROPAGATES , .clkdm_name ="wkup_clkdm" , .recalc = &omap2_fixed_divisor_recalc, };
@@ -917,9 +921,9 @@ static const struct clksel sys_clkout_clksel[] = {static struct clk sys_clkout = { .name ="sys_clkout" , + .ops = &clkops_null, .parent = &sys_clkout_src, - .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | -PARENT_CONTROLS_CLOCK , + .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X , .clkdm_name ="wkup_clkdm" , .clksel_reg =OMAP24XX_PRCM_CLKOUT_CTRL , .clksel_mask =OMAP24XX_CLKOUT_DIV_MASK ,
@@ -954,8 +958,9 @@ static const struct clksel sys_clkout2_clksel[] = {/* In 2430, new in 2420 ES2 */ static struct clk sys_clkout2 = { .name ="sys_clkout2" , + .ops = &clkops_null, .parent = &sys_clkout2_src, - .flags =CLOCK_IN_OMAP242X |PARENT_CONTROLS_CLOCK , + .flags =CLOCK_IN_OMAP242X , .clkdm_name ="wkup_clkdm" , .clksel_reg =OMAP24XX_PRCM_CLKOUT_CTRL , .clksel_mask =OMAP2420_CLKOUT2_DIV_MASK ,
@@ -1076,9 +1081,10 @@ static const struct clksel dsp_irate_ick_clksel[] = {/* This clock does not exist as such in the TRM. */ static struct clk dsp_irate_ick = { .name ="dsp_irate_ick" , + .ops = &clkops_null, .parent = &dsp_fck, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X |DELAYED_APP | -CONFIG_PARTICIPANT |PARENT_CONTROLS_CLOCK , +CONFIG_PARTICIPANT , .clksel_reg =OMAP_CM_REGADDR (OMAP24XX_DSP_MOD ,CM_CLKSEL ), .clksel_mask =OMAP24XX_CLKSEL_DSP_IF_MASK , .clksel = dsp_irate_ick_clksel,
arch/arm/mach-omap2/clock34xx.h +100 -96
657 lines not on this page · raw message
arch/arm/plat-omap/include/mach/clock.h +0 -1
@@ -148,7 +148,6 @@ extern const struct clkops clkops_null;#define CLOCK_IN_OMAP242X (1 << 25)#define CLOCK_IN_OMAP243X (1 << 26)#define CLOCK_IN_OMAP343X (1 << 27)/* clocks common to all 343X */ -#define PARENT_CONTROLS_CLOCK (1 << 28)#define CLOCK_IN_OMAP3430ES1 (1 << 29)/* 3430ES1 clocks only */ #define CLOCK_IN_OMAP3430ES2 (1 << 30)/* 3430ES2 clocks only */
Signature · 1 line
1.6.1.2
PATCH 5/86 omap: add default .ops to all remaining OMAP2 clocks
From: Russell King <[email protected]>
--- arch/arm/mach-omap2/clock.c | 35 ++++++---- arch/arm/mach-omap2/clock.h | 2 + arch/arm/mach-omap2/clock24xx.h | 115 +++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/clock34xx.h | 133 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 271 insertions(+), 14 deletions(-)
arch/arm/mach-omap2/clock.c +21 -14
@@ -264,16 +264,10 @@ static void omap2_clk_wait_ready(struct clk *clk)omap2_wait_clock_ready (st_reg, bit, clk->name); } -/* 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_dflt_clk_enable_wait (struct clk *clk) {u32 regval32; -if (clk->ops && clk->ops->enable) -return clk->ops->enable (clk); -if (unlikely (clk->enable_reg ==NULL )) {printk (KERN_ERR "clock.c: Enable for %s without enable code\n" , clk->name);
@@ -293,16 +287,10 @@ int _omap2_clk_enable(struct clk *clk)return 0 ; } -/* Disables clock without considering parent dependencies or use count */ -void _omap2_clk_disable (struct clk *clk) +static void omap2_dflt_clk_disable (struct clk *clk) {u32 regval32; -if (clk->ops && clk->ops->disable) { - clk->ops->disable (clk); -return ; - } -if (clk->enable_reg ==NULL ) {/* * 'Independent' here refers to a clock which is not
@@ -322,6 +310,25 @@ void _omap2_clk_disable(struct clk *clk)wmb (); } +const struct clkops clkops_omap2_dflt_wait = { + .enable = omap2_dflt_clk_enable_wait, + .disable = omap2_dflt_clk_disable, +}; + +/* Enables clock without considering parent dependencies or use count +* REVISIT: Maybe change this to use clk->enable like on omap1? +*/ +static int _omap2_clk_enable (struct clk *clk) +{ +return clk->ops->enable (clk); +} + +/* Disables clock without considering parent dependencies or use count */ +static void _omap2_clk_disable (struct clk *clk) +{ + clk->ops->disable (clk); +} +void omap2_clk_disable (struct clk *clk) {if (clk->usecount >0 && !(--clk->usecount)) {
arch/arm/mach-omap2/clock.h +2 -0
@@ -51,6 +51,8 @@ u32 omap2_get_dpll_rate(struct clk *clk);int omap2_wait_clock_ready (void __iomem *reg,u32 cval,const char *name);void omap2_clk_prepare_for_reboot (void ); +extern const struct clkops clkops_omap2_dflt_wait; +extern u8 cpu_mask;/* clksel_rate data common to 24xx/343x */
arch/arm/mach-omap2/clock24xx.h +115 -0
805 lines not on this page · raw message
arch/arm/mach-omap2/clock34xx.h +133 -0
931 lines not on this page · raw message
Signature · 1 line
1.6.1.2
PATCH 6/86 omap: eliminate unnecessary conditionals in omap2_clk_wait_ready
From: Russell King <[email protected]>
Rather than employing run-time tests in omap2_clk_wait_ready() to decide whether we need to wait for the clock to become ready, we can set the .ops appropriately.
This change deals with the OMAP24xx and OMAP34xx conditionals only.
--- arch/arm/mach-omap2/clock.c | 42 ++++++++++++++++++++------------------ arch/arm/mach-omap2/clock.h | 1 + arch/arm/mach-omap2/clock24xx.h | 10 ++++---- arch/arm/mach-omap2/clock34xx.h | 14 ++++++------ 4 files changed, 35 insertions(+), 32 deletions(-)
arch/arm/mach-omap2/clock.c +22 -20
@@ -237,23 +237,6 @@ static void omap2_clk_wait_ready(struct clk *clk)else return ; -/* REVISIT: What are the appropriate exclusions for 34XX? */ -/* No check for DSS or cam clocks */ -if (cpu_is_omap24xx () && ((u32 )reg &0x0f ) ==0 ) {/* CM_{F,I}CLKEN1 */ -if (clk->enable_bit ==OMAP24XX_EN_DSS2_SHIFT || - clk->enable_bit ==OMAP24XX_EN_DSS1_SHIFT || - clk->enable_bit ==OMAP24XX_EN_CAM_SHIFT ) -return ; - } - -/* 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 ))) -return ; -/* Check if both functional and interface clocks * are running. */ bit =1 << clk->enable_bit;
@@ -264,7 +247,7 @@ static void omap2_clk_wait_ready(struct clk *clk)omap2_wait_clock_ready (st_reg, bit, clk->name); } -static int omap2_dflt_clk_enable_wait (struct clk *clk) +static int omap2_dflt_clk_enable (struct clk *clk) {u32 regval32;
@@ -282,11 +265,25 @@ static int omap2_dflt_clk_enable_wait(struct clk *clk)__raw_writel (regval32, clk->enable_reg);wmb (); -omap2_clk_wait_ready (clk); -return 0 ; } +static int omap2_dflt_clk_enable_wait (struct clk *clk) +{ +int ret; + +if (unlikely (clk->enable_reg ==NULL )) { +printk (KERN_ERR "clock.c: Enable for %s without enable code\n" , + clk->name); +return 0 ;/* REVISIT: -EINVAL */ + } + + ret =omap2_dflt_clk_enable (clk); +if (ret ==0 ) +omap2_clk_wait_ready (clk); +return ret; +} +static void omap2_dflt_clk_disable (struct clk *clk) {u32 regval32;
@@ -315,6 +312,11 @@ const struct clkops clkops_omap2_dflt_wait = { .disable = omap2_dflt_clk_disable, }; +const struct clkops clkops_omap2_dflt = { + .enable = omap2_dflt_clk_enable, + .disable = omap2_dflt_clk_disable, +}; +/* Enables clock without considering parent dependencies or use count * REVISIT: Maybe change this to use clk->enable like on omap1? */
arch/arm/mach-omap2/clock.h +1 -0
@@ -52,6 +52,7 @@ int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name);void omap2_clk_prepare_for_reboot (void );extern const struct clkops clkops_omap2_dflt_wait; +extern const struct clkops clkops_omap2_dflt;extern u8 cpu_mask;
arch/arm/mach-omap2/clock24xx.h +5 -5
@@ -1455,7 +1455,7 @@ static const struct clksel dss1_fck_clksel[] = {static struct clk dss_ick = {/* Enables both L3,L4 ICLK's */ .name ="dss_ick" , - .ops = &clkops_omap2_dflt_wait, + .ops = &clkops_omap2_dflt, .parent = &l4_ck,/* really both l3 and l4 */ .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X , .clkdm_name ="dss_clkdm" ,
@@ -1466,7 +1466,7 @@ static struct clk dss_ick = { /* Enables both L3,L4 ICLK's */static struct clk dss1_fck = { .name ="dss1_fck" , - .ops = &clkops_omap2_dflt_wait, + .ops = &clkops_omap2_dflt, .parent = &core_ck,/* Core or sys */ .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X |DELAYED_APP ,
@@ -1500,7 +1500,7 @@ static const struct clksel dss2_fck_clksel[] = {static struct clk dss2_fck = {/* Alt clk used in power management */ .name ="dss2_fck" , - .ops = &clkops_omap2_dflt_wait, + .ops = &clkops_omap2_dflt, .parent = &sys_ck,/* fixed at sys_ck or 48MHz */ .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X |DELAYED_APP ,
@@ -2206,7 +2206,7 @@ static struct clk icr_ick = {static struct clk cam_ick = { .name ="cam_ick" , - .ops = &clkops_omap2_dflt_wait, + .ops = &clkops_omap2_dflt, .parent = &l4_ck, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X , .clkdm_name ="core_l4_clkdm" ,
@@ -2222,7 +2222,7 @@ static struct clk cam_ick = {*/ static struct clk cam_fck = { .name ="cam_fck" , - .ops = &clkops_omap2_dflt_wait, + .ops = &clkops_omap2_dflt, .parent = &func_96m_ck, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X , .clkdm_name ="core_l3_clkdm" ,
arch/arm/mach-omap2/clock34xx.h +7 -7
@@ -1652,7 +1652,7 @@ static const struct clksel ssi_ssr_clksel[] = {static struct clk ssi_ssr_fck = { .name ="ssi_ssr_fck" , - .ops = &clkops_omap2_dflt_wait, + .ops = &clkops_omap2_dflt, .init = &omap2_init_clksel_parent, .enable_reg =OMAP_CM_REGADDR (CORE_MOD ,CM_FCLKEN1 ), .enable_bit =OMAP3430_EN_SSI_SHIFT ,
@@ -2064,7 +2064,7 @@ static struct clk ssi_l4_ick = {static struct clk ssi_ick = { .name ="ssi_ick" , - .ops = &clkops_omap2_dflt_wait, + .ops = &clkops_omap2_dflt, .parent = &ssi_l4_ick, .enable_reg =OMAP_CM_REGADDR (CORE_MOD ,CM_ICLKEN1 ), .enable_bit =OMAP3430_EN_SSI_SHIFT ,
@@ -2156,7 +2156,7 @@ static const struct clksel dss1_alwon_fck_clksel[] = {static struct clk dss1_alwon_fck = { .name ="dss1_alwon_fck" , - .ops = &clkops_omap2_dflt_wait, + .ops = &clkops_omap2_dflt, .parent = &dpll4_m4x2_ck, .init = &omap2_init_clksel_parent, .enable_reg =OMAP_CM_REGADDR (OMAP3430_DSS_MOD ,CM_FCLKEN ),
@@ -2171,7 +2171,7 @@ static struct clk dss1_alwon_fck = {static struct clk dss_tv_fck = { .name ="dss_tv_fck" , - .ops = &clkops_omap2_dflt_wait, + .ops = &clkops_omap2_dflt, .parent = &omap_54m_fck, .init = &omap2_init_clk_clkdm, .enable_reg =OMAP_CM_REGADDR (OMAP3430_DSS_MOD ,CM_FCLKEN ),
@@ -2183,7 +2183,7 @@ static struct clk dss_tv_fck = {static struct clk dss_96m_fck = { .name ="dss_96m_fck" , - .ops = &clkops_omap2_dflt_wait, + .ops = &clkops_omap2_dflt, .parent = &omap_96m_fck, .init = &omap2_init_clk_clkdm, .enable_reg =OMAP_CM_REGADDR (OMAP3430_DSS_MOD ,CM_FCLKEN ),
@@ -2195,7 +2195,7 @@ static struct clk dss_96m_fck = {static struct clk dss2_alwon_fck = { .name ="dss2_alwon_fck" , - .ops = &clkops_omap2_dflt_wait, + .ops = &clkops_omap2_dflt, .parent = &sys_ck, .init = &omap2_init_clk_clkdm, .enable_reg =OMAP_CM_REGADDR (OMAP3430_DSS_MOD ,CM_FCLKEN ),
@@ -2208,7 +2208,7 @@ static struct clk dss2_alwon_fck = {static struct clk dss_ick = {/* Handles both L3 and L4 clocks */ .name ="dss_ick" , - .ops = &clkops_omap2_dflt_wait, + .ops = &clkops_omap2_dflt, .parent = &l4_ick, .init = &omap2_init_clk_clkdm, .enable_reg =OMAP_CM_REGADDR (OMAP3430_DSS_MOD ,CM_ICLKEN ),
Signature · 1 line
1.6.1.2
PATCH 7/86 omap: don't use clkops_omap2_dflt_wait for non-ICLK/FCLK clocks
From: Russell King <[email protected]>
The original code in omap2_clk_wait_ready() used to check the low 8 bits to determine whether they were within the FCLKEN or ICLKEN registers. Specifically, the test is satisfied when these offsets are used:
CM_FCLKEN, CM_FCLKEN1, CM_CLKEN, OMAP24XX_CM_FCLKEN2, CM_ICLKEN, CM_ICLKEN1, CM_ICLKEN2, CM_ICLKEN3, OMAP24XX_CM_ICLKEN4 OMAP3430_CM_CLKEN_PLL, OMAP3430ES2_CM_CLKEN2
If one of these offsets isn't used, omap2_clk_wait_ready() merely returns without doing anything. So we should use the non-wait clkops version instead and eliminate that conditional.
--- arch/arm/mach-omap2/clock.c | 14 ++++++-------- arch/arm/mach-omap2/clock24xx.h | 6 +++--- arch/arm/mach-omap2/clock34xx.h | 12 ++++++------ 3 files changed, 15 insertions(+), 17 deletions(-)
arch/arm/mach-omap2/clock.c +6 -8
@@ -228,14 +228,12 @@ static void omap2_clk_wait_ready(struct clk *clk)* it and pull it into struct clk itself somehow. */ reg = clk->enable_reg; -if ((((u32 )reg &0xff ) >=CM_FCLKEN1 ) && - (((u32 )reg &0xff ) <=OMAP24XX_CM_FCLKEN2 )) - other_reg = (void __iomem *)(((u32 )reg & ~0xf0 ) |0x10 );/* CM_ICLKEN* */ -else if ((((u32 )reg &0xff ) >=CM_ICLKEN1 ) && - (((u32 )reg &0xff ) <=OMAP24XX_CM_ICLKEN4 )) - other_reg = (void __iomem *)(((u32 )reg & ~0xf0 ) |0x00 );/* CM_FCLKEN* */ -else -return ; + +/* +* Convert CM_ICLKEN* <-> CM_FCLKEN*. This conversion assumes +* it's just a matter of XORing the bits. +*/ + other_reg = (void __iomem *)((u32 )reg ^ (CM_FCLKEN ^CM_ICLKEN ));/* Check if both functional and interface clocks * are running. */
arch/arm/mach-omap2/clock24xx.h +3 -3
@@ -890,7 +890,7 @@ static const struct clksel common_clkout_src_clksel[] = {static struct clk sys_clkout_src = { .name ="sys_clkout_src" , - .ops = &clkops_omap2_dflt_wait, + .ops = &clkops_omap2_dflt, .parent = &func_54m_ck, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X |RATE_PROPAGATES ,
@@ -937,7 +937,7 @@ static struct clk sys_clkout = {/* In 2430, new in 2420 ES2 */ static struct clk sys_clkout2_src = { .name ="sys_clkout2_src" , - .ops = &clkops_omap2_dflt_wait, + .ops = &clkops_omap2_dflt, .parent = &func_54m_ck, .flags =CLOCK_IN_OMAP242X |RATE_PROPAGATES , .clkdm_name ="wkup_clkdm" ,
@@ -974,7 +974,7 @@ static struct clk sys_clkout2 = {static struct clk emul_ck = { .name ="emul_ck" , - .ops = &clkops_omap2_dflt_wait, + .ops = &clkops_omap2_dflt, .parent = &func_54m_ck, .flags =CLOCK_IN_OMAP242X , .clkdm_name ="wkup_clkdm" ,
arch/arm/mach-omap2/clock34xx.h +6 -6
@@ -216,7 +216,7 @@ static struct clk mcbsp_clks = {static struct clk sys_clkout1 = { .name ="sys_clkout1" , - .ops = &clkops_omap2_dflt_wait, + .ops = &clkops_omap2_dflt, .parent = &osc_sys_ck, .enable_reg =OMAP3430_PRM_CLKOUT_CTRL , .enable_bit =OMAP3430_CLKOUT_EN_SHIFT ,
@@ -967,7 +967,7 @@ static const struct clksel clkout2_src_clksel[] = {static struct clk clkout2_src_ck = { .name ="clkout2_src_ck" , - .ops = &clkops_omap2_dflt_wait, + .ops = &clkops_omap2_dflt, .init = &omap2_init_clksel_parent, .enable_reg =OMAP3430_CM_CLKOUT_CTRL , .enable_bit =OMAP3430_CLKOUT2_EN_SHIFT ,
@@ -1356,7 +1356,7 @@ static struct clk gpt11_fck = {static struct clk cpefuse_fck = { .name ="cpefuse_fck" , - .ops = &clkops_omap2_dflt_wait, + .ops = &clkops_omap2_dflt, .parent = &sys_ck, .enable_reg =OMAP_CM_REGADDR (CORE_MOD ,OMAP3430ES2_CM_FCLKEN3 ), .enable_bit =OMAP3430ES2_EN_CPEFUSE_SHIFT ,
@@ -1366,7 +1366,7 @@ static struct clk cpefuse_fck = {static struct clk ts_fck = { .name ="ts_fck" , - .ops = &clkops_omap2_dflt_wait, + .ops = &clkops_omap2_dflt, .parent = &omap_32k_fck, .enable_reg =OMAP_CM_REGADDR (CORE_MOD ,OMAP3430ES2_CM_FCLKEN3 ), .enable_bit =OMAP3430ES2_EN_TS_SHIFT ,
@@ -1376,7 +1376,7 @@ static struct clk ts_fck = {static struct clk usbtll_fck = { .name ="usbtll_fck" , - .ops = &clkops_omap2_dflt_wait, + .ops = &clkops_omap2_dflt, .parent = &omap_120m_fck, .enable_reg =OMAP_CM_REGADDR (CORE_MOD ,OMAP3430ES2_CM_FCLKEN3 ), .enable_bit =OMAP3430ES2_EN_USBTLL_SHIFT ,
@@ -2295,7 +2295,7 @@ static struct clk usbhost_ick = {static struct clk usbhost_sar_fck = { .name ="usbhost_sar_fck" , - .ops = &clkops_omap2_dflt_wait, + .ops = &clkops_omap2_dflt, .parent = &osc_sys_ck, .init = &omap2_init_clk_clkdm, .enable_reg =OMAP_PRM_REGADDR (OMAP3430ES2_USBHOST_MOD ,PM_PWSTCTRL ),
Signature · 1 line
1.6.1.2
PATCH 8/86 omap: remove clk->owner
From: Russell King <[email protected]>
clk->owner is always NULL, so its existence doesn't serve any useful function other than bloating the kernel by 992 bytes. Remove it.
--- arch/arm/plat-omap/clock.c | 7 ++----- arch/arm/plat-omap/include/mach/clock.h | 1 - 2 files changed, 2 insertions(+), 6 deletions(-)
arch/arm/plat-omap/clock.c +2 -5
@@ -53,15 +53,14 @@ struct clk * clk_get(struct device *dev, const char *id)mutex_lock (&clocks_mutex);list_for_each_entry (p, &clocks, node) { -if (p->id == idno && -strcmp (id, p->name) ==0 &&try_module_get (p->owner)) { +if (p->id == idno &&strcmp (id, p->name) ==0 ) { clk = p; goto found; } }list_for_each_entry (p, &clocks, node) { -if (strcmp (id, p->name) ==0 &&try_module_get (p->owner)) { +if (strcmp (id, p->name) ==0 ) { clk = p;break ; }
@@ -148,8 +147,6 @@ EXPORT_SYMBOL(clk_get_rate);void clk_put (struct clk *clk) { -if (clk && !IS_ERR (clk)) -module_put (clk->owner); }EXPORT_SYMBOL (clk_put);
arch/arm/plat-omap/include/mach/clock.h +0 -1
@@ -65,7 +65,6 @@ struct dpll_data {struct clk {struct list_head node;const struct clkops *ops; -struct module *owner;const char *name;int id;struct clk *parent;
Signature · 1 line
1.6.1.2
PATCH 9/86 omap: rearrange clock.h structure order
From: Russell King <[email protected]>
... to eliminate unnecessary padding. We have rather a lot of these structures, so eliminating unnecessary padding results in a saving of 1488 bytes.
--- arch/arm/plat-omap/include/mach/clock.h | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-)
arch/arm/plat-omap/include/mach/clock.h +9 -9
@@ -25,8 +25,8 @@ struct clkops {#if defined(CONFIG_ARCH_OMAP2 ) || defined(CONFIG_ARCH_OMAP3 )struct clksel_rate { -u8 div;u32 val; +u8 div;u8 flags; };
@@ -39,23 +39,23 @@ struct dpll_data {void __iomem *mult_div1_reg;u32 mult_mask;u32 div1_mask; +unsigned int rate_tolerance; +unsigned long last_rounded_rate;u16 last_rounded_m;u8 last_rounded_n; -unsigned long last_rounded_rate; -unsigned int rate_tolerance; -u16 max_multiplier;u8 max_divider;u32 max_tolerance; +u16 max_multiplier;# if defined(CONFIG_ARCH_OMAP3 )u8 modes;void __iomem *control_reg; +void __iomem *autoidle_reg; +void __iomem *idlest_reg;u32 enable_mask; +u32 autoidle_mask;u8 auto_recal_bit;u8 recal_en_bit;u8 recal_st_bit; -void __iomem *autoidle_reg; -u32 autoidle_mask; -void __iomem *idlest_reg;u8 idlest_bit;# endif };
@@ -71,12 +71,12 @@ struct clk {unsigned long rate;__u32 flags;void __iomem *enable_reg; -__u8 enable_bit; -__s8 usecount;void (*recalc)(struct clk *);int (*set_rate)(struct clk *,unsigned long );long (*round_rate)(struct clk *,unsigned long );void (*init)(struct clk *); +__u8 enable_bit; +__s8 usecount;#if defined(CONFIG_ARCH_OMAP2 ) || defined(CONFIG_ARCH_OMAP3 )u8 fixed_div;void __iomem *clksel_reg;
Signature · 1 line
1.6.1.2
PATCH 10/86 omap: remove clk_deny_idle and clk_allow_idle
From: Russell King <[email protected]>
Nothing makes any use of these functions, so there's little point in providing them.
--- arch/arm/plat-omap/clock.c | 28 ---------------------------- arch/arm/plat-omap/include/mach/clock.h | 2 -- arch/arm/plat-omap/include/mach/pm.h | 12 ------------ 3 files changed, 0 insertions(+), 42 deletions(-)
arch/arm/plat-omap/clock.c +0 -28
@@ -316,34 +316,6 @@ void clk_unregister(struct clk *clk) }EXPORT_SYMBOL (clk_unregister); -void clk_deny_idle (struct clk *clk) -{ -unsigned long flags; - -if (clk ==NULL ||IS_ERR (clk)) -return ; - -spin_lock_irqsave (&clockfw_lock, flags); -if (arch_clock->clk_deny_idle) - arch_clock->clk_deny_idle (clk); -spin_unlock_irqrestore (&clockfw_lock, flags); -} -EXPORT_SYMBOL (clk_deny_idle); - -void clk_allow_idle (struct clk *clk) -{ -unsigned long flags; - -if (clk ==NULL ||IS_ERR (clk)) -return ; - -spin_lock_irqsave (&clockfw_lock, flags); -if (arch_clock->clk_allow_idle) - arch_clock->clk_allow_idle (clk); -spin_unlock_irqrestore (&clockfw_lock, flags); -} -EXPORT_SYMBOL (clk_allow_idle); -void clk_enable_init_clocks (void ) {struct clk *clkp;
arch/arm/plat-omap/include/mach/clock.h +0 -2
@@ -119,8 +119,6 @@ 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 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 );
arch/arm/plat-omap/include/mach/pm.h +0 -12
@@ -118,18 +118,6 @@extern void prevent_idle_sleep (void );extern void allow_idle_sleep (void ); -/** -* clk_deny_idle - Prevents the clock from being idled during MPU idle -* @clk: clock signal handle -*/ -void clk_deny_idle (struct clk *clk); - -/** -* clk_allow_idle - Counters previous clk_deny_idle -* @clk: clock signal handle -*/ -void clk_allow_idle (struct clk *clk); -extern void omap_pm_idle (void );extern void omap_pm_suspend (void );extern void omap730_cpu_suspend (unsigned short ,unsigned short );
Signature · 1 line
1.6.1.2
PATCH 11/86 omap: provide a standard clk_get_parent() implementation
From: Russell King <[email protected]>
which only has to return clk->parent.
--- arch/arm/plat-omap/clock.c | 13 +------------ arch/arm/plat-omap/include/mach/clock.h | 1 - 2 files changed, 1 insertions(+), 13 deletions(-)
arch/arm/plat-omap/clock.c +1 -12
@@ -207,18 +207,7 @@ EXPORT_SYMBOL(clk_set_parent);struct clk *clk_get_parent (struct clk *clk) { -unsigned long flags; -struct clk * ret =NULL ; - -if (clk ==NULL ||IS_ERR (clk)) -return ret; - -spin_lock_irqsave (&clockfw_lock, flags); -if (arch_clock->clk_get_parent) - ret = arch_clock->clk_get_parent (clk); -spin_unlock_irqrestore (&clockfw_lock, flags); - -return ret; +return clk->parent; }EXPORT_SYMBOL (clk_get_parent);
arch/arm/plat-omap/include/mach/clock.h +0 -1
@@ -102,7 +102,6 @@ struct clk_functions {long (*clk_round_rate)(struct clk *clk,unsigned long rate);int (*clk_set_rate)(struct clk *clk,unsigned long rate);int (*clk_set_parent)(struct clk *clk,struct clk *parent); -struct clk * (*clk_get_parent)(struct clk *clk);void (*clk_allow_idle)(struct clk *clk);void (*clk_deny_idle)(struct clk *clk);void (*clk_disable_unused)(struct clk *clk);
Signature · 1 line
1.6.1.2
PATCH 12/86 omap: move clock propagation into core omap clock code
From: Russell King <[email protected]>
Move the clock propagation calls for set_parent and set_rate into the core omap clock code, rather than having these calls scattered throughout the OMAP1 and OMAP2 implementations.
--- arch/arm/mach-omap1/clock.c | 3 --- arch/arm/mach-omap2/clock.c | 6 ------ arch/arm/plat-omap/clock.c | 6 +++++- 3 files changed, 5 insertions(+), 10 deletions(-)
arch/arm/mach-omap1/clock.c +0 -3
@@ -628,9 +628,6 @@ static int omap1_clk_set_rate(struct clk *clk, unsigned long rate) ret =0 ; } -if (unlikely (ret ==0 && (clk->flags &RATE_PROPAGATES ))) -propagate_rate (clk); -return ret; }
arch/arm/mach-omap2/clock.c +0 -6
@@ -684,9 +684,6 @@ int omap2_clk_set_rate(struct clk *clk, unsigned long rate)if (clk->set_rate !=NULL ) ret = clk->set_rate (clk, rate); -if (unlikely (ret ==0 && (clk->flags &RATE_PROPAGATES ))) -propagate_rate (clk); -return ret; }
@@ -774,9 +771,6 @@ 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 )) -propagate_rate (clk); -return 0 ; }
arch/arm/plat-omap/clock.c +5 -1
@@ -182,6 +182,8 @@ int clk_set_rate(struct clk *clk, unsigned long rate)spin_lock_irqsave (&clockfw_lock, flags);if (arch_clock->clk_set_rate) ret = arch_clock->clk_set_rate (clk, rate); +if (ret ==0 && (clk->flags &RATE_PROPAGATES )) +propagate_rate (clk);spin_unlock_irqrestore (&clockfw_lock, flags);return ret;
@@ -198,7 +200,9 @@ int clk_set_parent(struct clk *clk, struct clk *parent)spin_lock_irqsave (&clockfw_lock, flags);if (arch_clock->clk_set_parent) - ret = arch_clock->clk_set_parent (clk, parent); + ret = arch_clock->clk_set_parent (clk, parent); +if (ret ==0 && (clk->flags &RATE_PROPAGATES )) +propagate_rate (clk);spin_unlock_irqrestore (&clockfw_lock, flags);return ret;
Signature · 1 line
1.6.1.2
PATCH 13/86 omap: remove unnecessary calls to propagate_rate()
From: Russell King <[email protected]>
We've always called propagate_rate() in the parent function to the .set_rate methods, so there's no point having the .set_rate methods also call this heavy-weight function - it's mere duplication of what's happening elsewhere.
--- arch/arm/mach-omap1/clock.c | 9 +-------- 1 files changed, 1 insertions(+), 8 deletions(-)
arch/arm/mach-omap1/clock.c +1 -8
@@ -308,7 +308,6 @@ static int omap1_select_table_rate(struct clk * clk, unsigned long rate)omap_sram_reprogram_clock (ptr->dpllctl_val, ptr->ckctl_val); ck_dpll1.rate = ptr->pll_rate; -propagate_rate (&ck_dpll1);return 0 ; }
@@ -333,9 +332,6 @@ static int omap1_clk_set_rate_dsp_domain(struct clk *clk, unsigned long rate) ret =0 ; } -if (unlikely (ret ==0 && (clk->flags &RATE_PROPAGATES ))) -propagate_rate (clk); -return ret; }
@@ -442,8 +438,6 @@ static int omap1_set_sossi_rate(struct clk *clk, unsigned long rate)omap_writel (l,MOD_CONF_CTRL_1 ); clk->rate = p_rate / (div +1 ); -if (unlikely (clk->flags &RATE_PROPAGATES )) -propagate_rate (clk);return 0 ; }
@@ -787,7 +781,6 @@ int __init omap1_clk_init(void) } } } -propagate_rate (&ck_dpll1);#else /* Find the highest supported frequency and enable it */ if (omap1_select_table_rate (&virtual_ck_mpu, ~0 )) {
@@ -796,9 +789,9 @@ int __init omap1_clk_init(void)omap_writew (0x2290 ,DPLL_CTL );omap_writew (cpu_is_omap730 () ?0x3005 :0x1005 ,ARM_CKCTL ); ck_dpll1.rate =60000000 ; -propagate_rate (&ck_dpll1); }#endif +propagate_rate (&ck_dpll1);/* Cache rates for clocks connected to ck_ref (not dpll1) */ propagate_rate (&ck_ref); printk(KERN_INFO "Clocking rate (xtal/DPLL1/MPU): "
Signature · 1 line
1.6.1.2
PATCH 14/86 omap: move propagate_rate() calls into generic omap clock code
From: Russell King <[email protected]>
propagate_rate() is recursive, so it makes sense to minimise the amount of stack which is used for each recursion. So, rather than recursing back into it from the ->recalc functions if RATE_PROPAGATES is set, do that test at the higher level.
--- arch/arm/mach-omap1/clock.c | 6 ------ arch/arm/mach-omap2/clock.c | 6 ------ arch/arm/mach-omap2/clock24xx.c | 6 ++---- arch/arm/mach-omap2/clock24xx.h | 4 ---- arch/arm/mach-omap2/clock34xx.c | 5 ----- arch/arm/mach-omap2/clock34xx.h | 10 ---------- arch/arm/plat-omap/clock.c | 14 +++++++++----- 7 files changed, 11 insertions(+), 40 deletions(-)
arch/arm/mach-omap1/clock.c +0 -6
@@ -244,9 +244,6 @@ static void omap1_ckctl_recalc(struct clk * clk)if (unlikely (clk->rate == clk->parent->rate / dsor))return ;/* No change, quick exit */ clk->rate = clk->parent->rate / dsor; - -if (unlikely (clk->flags &RATE_PROPAGATES )) -propagate_rate (clk); }static void omap1_ckctl_recalc_dsp_domain (struct clk * clk)
@@ -267,9 +264,6 @@ static void omap1_ckctl_recalc_dsp_domain(struct clk * clk)if (unlikely (clk->rate == clk->parent->rate / dsor))return ;/* No change, quick exit */ clk->rate = clk->parent->rate / dsor; - -if (unlikely (clk->flags &RATE_PROPAGATES )) -propagate_rate (clk); }/* MPU virtual clock functions */
arch/arm/mach-omap2/clock.c +0 -6
@@ -167,9 +167,6 @@ void omap2_fixed_divisor_recalc(struct clk *clk)WARN_ON (!clk->fixed_div); clk->rate = clk->parent->rate / clk->fixed_div; - -if (clk->flags &RATE_PROPAGATES ) -propagate_rate (clk); }/**
@@ -392,9 +389,6 @@ void omap2_clksel_recalc(struct clk *clk) 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 )) -propagate_rate (clk); }/**
arch/arm/mach-omap2/clock24xx.c +2 -4
@@ -199,8 +199,6 @@ long omap2_dpllcore_round_rate(unsigned long target_rate)static void omap2_dpllcore_recalc (struct clk *clk) { clk->rate =omap2_get_dpll_rate_24xx (clk); - -propagate_rate (clk); }static int omap2_reprogram_dpllcore (struct clk *clk,unsigned long rate)
@@ -442,13 +440,11 @@ static u32 omap2_get_sysclkdiv(void)static void omap2_osc_clk_recalc (struct clk *clk) { clk->rate =omap2_get_apll_clkin () *omap2_get_sysclkdiv (); -propagate_rate (clk); }static void omap2_sys_clk_recalc (struct clk *clk) { clk->rate = clk->parent->rate /omap2_get_sysclkdiv (); -propagate_rate (clk); }/*
@@ -502,7 +498,9 @@ int __init omap2_clk_init(void)clk_init (&omap2_clk_functions);omap2_osc_clk_recalc (&osc_ck); +propagate_rate (&osc_ck);omap2_sys_clk_recalc (&sys_ck); +propagate_rate (&sys_ck); for (clkp = onchip_24xx_clks; clkp < onchip_24xx_clks + ARRAY_SIZE(onchip_24xx_clks);
arch/arm/mach-omap2/clock24xx.h +0 -4
@@ -624,7 +624,6 @@ static struct clk func_32k_ck = { .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | RATE_FIXED | RATE_PROPAGATES, .clkdm_name = "wkup_clkdm", - .recalc = &propagate_rate, };/* Typical 12/13MHz in standalone mode, will be 26Mhz in chassis mode */
@@ -655,7 +654,6 @@ static struct clk alt_ck = { /* Typical 54M or 48M, may not exist */ .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | RATE_FIXED | RATE_PROPAGATES, .clkdm_name = "wkup_clkdm", - .recalc = &propagate_rate, };/*
@@ -702,7 +700,6 @@ static struct clk apll96_ck = { .clkdm_name = "wkup_clkdm", .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), .enable_bit = OMAP24XX_EN_96M_PLL_SHIFT, - .recalc = &propagate_rate, };static struct clk apll54_ck = {
@@ -715,7 +712,6 @@ static struct clk apll54_ck = { .clkdm_name = "wkup_clkdm", .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), .enable_bit = OMAP24XX_EN_54M_PLL_SHIFT, - .recalc = &propagate_rate, };/*
arch/arm/mach-omap2/clock34xx.c +0 -5
@@ -57,8 +57,6 @@ static const struct clkops clkops_noncore_dpll_ops;static void omap3_dpll_recalc (struct clk *clk) { clk->rate =omap2_get_dpll_rate (clk); - -propagate_rate (clk); }/* _omap3_dpll_write_clken - write clken_bits arg to a DPLL's enable bits */
@@ -388,9 +386,6 @@ static void omap3_clkoutx2_recalc(struct clk *clk) clk->rate = clk->parent->rate; else clk->rate = clk->parent->rate * 2; - -if (clk->flags &RATE_PROPAGATES ) -propagate_rate (clk); }/* Common clock code */
arch/arm/mach-omap2/clock34xx.h +0 -10
@@ -58,7 +58,6 @@ static struct clk omap_32k_fck = { .ops = &clkops_null, .rate = 32768, .flags = CLOCK_IN_OMAP343X | RATE_FIXED | RATE_PROPAGATES, - .recalc = &propagate_rate, };static struct clk secure_32k_fck = {
@@ -66,7 +65,6 @@ static struct clk secure_32k_fck = { .ops = &clkops_null, .rate = 32768, .flags = CLOCK_IN_OMAP343X | RATE_FIXED | RATE_PROPAGATES, - .recalc = &propagate_rate, };/* Virtual source clocks for osc_sys_ck */
@@ -75,7 +73,6 @@ static struct clk virt_12m_ck = { .ops = &clkops_null, .rate = 12000000, .flags = CLOCK_IN_OMAP343X | RATE_FIXED | RATE_PROPAGATES, - .recalc = &propagate_rate, };static struct clk virt_13m_ck = {
@@ -83,7 +80,6 @@ static struct clk virt_13m_ck = { .ops = &clkops_null, .rate = 13000000, .flags = CLOCK_IN_OMAP343X | RATE_FIXED | RATE_PROPAGATES, - .recalc = &propagate_rate, };static struct clk virt_16_8m_ck = {
@@ -91,7 +87,6 @@ static struct clk virt_16_8m_ck = { .ops = &clkops_null, .rate = 16800000, .flags = CLOCK_IN_OMAP3430ES2 | RATE_FIXED | RATE_PROPAGATES, - .recalc = &propagate_rate, };static struct clk virt_19_2m_ck = {
@@ -99,7 +94,6 @@ static struct clk virt_19_2m_ck = { .ops = &clkops_null, .rate = 19200000, .flags = CLOCK_IN_OMAP343X | RATE_FIXED | RATE_PROPAGATES, - .recalc = &propagate_rate, };static struct clk virt_26m_ck = {
@@ -107,7 +101,6 @@ static struct clk virt_26m_ck = { .ops = &clkops_null, .rate = 26000000, .flags = CLOCK_IN_OMAP343X | RATE_FIXED | RATE_PROPAGATES, - .recalc = &propagate_rate, };static struct clk virt_38_4m_ck = {
@@ -115,7 +108,6 @@ static struct clk virt_38_4m_ck = { .ops = &clkops_null, .rate = 38400000, .flags = CLOCK_IN_OMAP343X | RATE_FIXED | RATE_PROPAGATES, - .recalc = &propagate_rate, };static const struct clksel_rate osc_sys_12m_rates[] = {
@@ -201,7 +193,6 @@ static struct clk sys_altclk = { .name = "sys_altclk", .ops = &clkops_null, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES, - .recalc = &propagate_rate, };/* Optional external clock input for some McBSPs */
@@ -209,7 +200,6 @@ static struct clk mcbsp_clks = { .name = "mcbsp_clks", .ops = &clkops_null, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES, - .recalc = &propagate_rate, };/* PRM EXTERNAL CLOCK OUTPUT */
arch/arm/plat-omap/clock.c +9 -5
@@ -246,8 +246,6 @@ void followparent_recalc(struct clk *clk)return ; clk->rate = clk->parent->rate; -if (unlikely (clk->flags &RATE_PROPAGATES )) -propagate_rate (clk); }/* Propagate rate to children */
@@ -261,8 +259,10 @@ void propagate_rate(struct clk * tclk)list_for_each_entry (clkp, &clocks, node) {if (likely (clkp->parent != tclk))continue ; -if (likely ((u32 )clkp->recalc)) +if (clkp->recalc) clkp->recalc (clkp); +if (clkp->flags &RATE_PROPAGATES ) +propagate_rate (clkp); } }
@@ -278,8 +278,12 @@ void recalculate_root_clocks(void)struct clk *clkp;list_for_each_entry (clkp, &clocks, node) { -if (unlikely (!clkp->parent) &&likely ((u32 )clkp->recalc)) - clkp->recalc (clkp); +if (!clkp->parent) { +if (clkp->recalc) + clkp->recalc (clkp); +if (clkp->flags &RATE_PROPAGATES ) +propagate_rate (clkp); + } } }
Signature · 1 line
1.6.1.2
PATCH 15/86 omap: handle RATE_CKCTL via .set_rate/.round_rate methods
From: Russell King <[email protected]>
It makes no sense to have the CKCTL rate selection implemented as a flag and a special exception in the top level set_rate/round_rate methods. Provide CKCTL set_rate/round_rate methods, and use these for where ever RATE_CKCTL is used and they're not already overridden. This allows us to remove the RATE_CKCTL flag.
--- arch/arm/mach-omap1/clock.c | 96 ++++++++++++++---------------- arch/arm/mach-omap1/clock.h | 38 ++++++++---- arch/arm/plat-omap/include/mach/clock.h | 2 +- 3 files changed, 72 insertions(+), 64 deletions(-)
arch/arm/mach-omap1/clock.c +45 -51
@@ -216,9 +216,6 @@ static int calc_dsor_exp(struct clk *clk, unsigned long rate)struct clk * parent;unsigned dsor_exp; -if (unlikely (!(clk->flags &RATE_CKCTL ))) -return -EINVAL ; - parent = clk->parent;if (unlikely (parent ==NULL ))return -EIO ;
@@ -307,26 +304,52 @@ static int omap1_select_table_rate(struct clk * clk, unsigned long rate)static int omap1_clk_set_rate_dsp_domain (struct clk *clk,unsigned long rate) { -int ret = -EINVAL ; -int dsor_exp; -__u16 regval; - -if (clk->flags &RATE_CKCTL ) { - dsor_exp =calc_dsor_exp (clk, rate); -if (dsor_exp >3 ) - dsor_exp = -EINVAL ; -if (dsor_exp <0 ) -return dsor_exp; - - regval =__raw_readw (DSP_CKCTL ); - regval &= ~(3 << clk->rate_offset); - regval |= dsor_exp << clk->rate_offset; -__raw_writew (regval,DSP_CKCTL ); - clk->rate = clk->parent->rate / (1 << dsor_exp); - ret =0 ; - } +int dsor_exp; +u16 regval; -return ret; + dsor_exp =calc_dsor_exp (clk, rate); +if (dsor_exp >3 ) + dsor_exp = -EINVAL ; +if (dsor_exp <0 ) +return dsor_exp; + + regval =__raw_readw (DSP_CKCTL ); + regval &= ~(3 << clk->rate_offset); + regval |= dsor_exp << clk->rate_offset; +__raw_writew (regval,DSP_CKCTL ); + clk->rate = clk->parent->rate / (1 << dsor_exp); + +return 0 ; +} + +static long omap1_clk_round_rate_ckctl_arm (struct clk *clk,unsigned long rate) +{ +int dsor_exp =calc_dsor_exp (clk, rate); +if (dsor_exp <0 ) +return dsor_exp; +if (dsor_exp >3 ) + dsor_exp =3 ; +return clk->parent->rate / (1 << dsor_exp); +} + +static int omap1_clk_set_rate_ckctl_arm (struct clk *clk,unsigned long rate) +{ +int dsor_exp; +u16 regval; + + dsor_exp =calc_dsor_exp (clk, rate); +if (dsor_exp >3 ) + dsor_exp = -EINVAL ; +if (dsor_exp <0 ) +return dsor_exp; + + regval =omap_readw (ARM_CKCTL ); + regval &= ~(3 << clk->rate_offset); + regval |= dsor_exp << clk->rate_offset; + regval =verify_ckctl_value (regval); +omap_writew (regval,ARM_CKCTL ); + clk->rate = clk->parent->rate / (1 << dsor_exp); +return 0 ; }static long omap1_round_to_table_rate (struct clk * clk,unsigned long rate)
@@ -572,20 +595,9 @@ static const struct clkops clkops_generic = {static long omap1_clk_round_rate (struct clk *clk,unsigned long rate) { -int dsor_exp; -if (clk->flags &RATE_FIXED )return clk->rate; -if (clk->flags &RATE_CKCTL ) { - dsor_exp =calc_dsor_exp (clk, rate); -if (dsor_exp <0 ) -return dsor_exp; -if (dsor_exp >3 ) - dsor_exp =3 ; -return clk->parent->rate / (1 << dsor_exp); - } -if (clk->round_rate !=NULL )return clk->round_rate (clk, rate);
@@ -595,27 +607,9 @@ static long omap1_clk_round_rate(struct clk *clk, unsigned long rate)static int omap1_clk_set_rate (struct clk *clk,unsigned long rate) {int ret = -EINVAL ; -int dsor_exp; -__u16 regval;if (clk->set_rate) ret = clk->set_rate (clk, rate); -else if (clk->flags &RATE_CKCTL ) { - dsor_exp =calc_dsor_exp (clk, rate); -if (dsor_exp >3 ) - dsor_exp = -EINVAL ; -if (dsor_exp <0 ) -return dsor_exp; - - regval =omap_readw (ARM_CKCTL ); - regval &= ~(3 << clk->rate_offset); - regval |= dsor_exp << clk->rate_offset; - regval =verify_ckctl_value (regval); -omap_writew (regval,ARM_CKCTL ); - clk->rate = clk->parent->rate / (1 << dsor_exp); - ret =0 ; - } -return ret; }
arch/arm/mach-omap1/clock.h +26 -12
@@ -27,6 +27,9 @@ static void omap1_init_ext_clk(struct clk * clk);static int omap1_select_table_rate (struct clk * clk,unsigned long rate);static long omap1_round_to_table_rate (struct clk * clk,unsigned long rate); +static int omap1_clk_set_rate_ckctl_arm (struct clk *clk,unsigned long rate); +static long omap1_clk_round_rate_ckctl_arm (struct clk *clk,unsigned long rate); +struct mpu_rate {unsigned long rate;unsigned long xtal;
@@ -189,9 +192,11 @@ static struct clk arm_ck = { .ops = &clkops_null, .parent = &ck_dpll1, .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | - CLOCK_IN_OMAP310 | RATE_CKCTL | RATE_PROPAGATES, + CLOCK_IN_OMAP310 | RATE_PROPAGATES, .rate_offset = CKCTL_ARMDIV_OFFSET, .recalc = &omap1_ckctl_recalc, + .round_rate = omap1_clk_round_rate_ckctl_arm, + .set_rate = omap1_clk_set_rate_ckctl_arm, };static struct arm_idlect1_clk armper_ck = {
@@ -200,12 +205,13 @@ static struct arm_idlect1_clk armper_ck = { .ops = &clkops_generic, .parent = &ck_dpll1, .flags =CLOCK_IN_OMAP1510 |CLOCK_IN_OMAP16XX | -CLOCK_IN_OMAP310 |RATE_CKCTL | - CLOCK_IDLE_CONTROL, + CLOCK_IN_OMAP310 | CLOCK_IDLE_CONTROL, .enable_reg = (void __iomem *)ARM_IDLECT2, .enable_bit = EN_PERCK, .rate_offset = CKCTL_PERDIV_OFFSET, .recalc = &omap1_ckctl_recalc, + .round_rate = omap1_clk_round_rate_ckctl_arm, + .set_rate = omap1_clk_set_rate_ckctl_arm, }, .idlect_shift = 2, };
@@ -279,22 +285,24 @@ static struct clk dsp_ck = { .name = "dsp_ck", .ops = &clkops_generic, .parent = &ck_dpll1, - .flags = CLOCK_IN_OMAP310 | CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | - RATE_CKCTL, + .flags = CLOCK_IN_OMAP310 | CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX, .enable_reg = (void __iomem *)ARM_CKCTL, .enable_bit = EN_DSPCK, .rate_offset = CKCTL_DSPDIV_OFFSET, .recalc = &omap1_ckctl_recalc, + .round_rate = omap1_clk_round_rate_ckctl_arm, + .set_rate = omap1_clk_set_rate_ckctl_arm, };static struct clk dspmmu_ck = { .name ="dspmmu_ck" , .ops = &clkops_null, .parent = &ck_dpll1, - .flags =CLOCK_IN_OMAP310 |CLOCK_IN_OMAP1510 |CLOCK_IN_OMAP16XX | -RATE_CKCTL , + .flags =CLOCK_IN_OMAP310 |CLOCK_IN_OMAP1510 |CLOCK_IN_OMAP16XX , .rate_offset =CKCTL_DSPMMUDIV_OFFSET , .recalc = &omap1_ckctl_recalc, + .round_rate = omap1_clk_round_rate_ckctl_arm, + .set_rate = omap1_clk_set_rate_ckctl_arm, };static struct clk dspper_ck = {
@@ -302,11 +310,12 @@ static struct clk dspper_ck = { .ops = &clkops_dspck, .parent = &ck_dpll1, .flags = CLOCK_IN_OMAP310 | CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | - RATE_CKCTL | VIRTUAL_IO_ADDRESS, + VIRTUAL_IO_ADDRESS, .enable_reg = DSP_IDLECT2, .enable_bit = EN_PERCK, .rate_offset = CKCTL_PERDIV_OFFSET, .recalc = &omap1_ckctl_recalc_dsp_domain, + .round_rate = omap1_clk_round_rate_ckctl_arm, .set_rate = &omap1_clk_set_rate_dsp_domain, };
@@ -340,10 +349,11 @@ static struct arm_idlect1_clk tc_ck = { .parent = &ck_dpll1, .flags =CLOCK_IN_OMAP1510 |CLOCK_IN_OMAP16XX |CLOCK_IN_OMAP730 |CLOCK_IN_OMAP310 | -RATE_CKCTL |RATE_PROPAGATES | - CLOCK_IDLE_CONTROL, + RATE_PROPAGATES | CLOCK_IDLE_CONTROL, .rate_offset = CKCTL_TCDIV_OFFSET, .recalc = &omap1_ckctl_recalc, + .round_rate = omap1_clk_round_rate_ckctl_arm, + .set_rate = omap1_clk_set_rate_ckctl_arm, }, .idlect_shift = 6, };
@@ -466,11 +476,13 @@ static struct clk lcd_ck_16xx = { .name = "lcd_ck", .ops = &clkops_generic, .parent = &ck_dpll1, - .flags = CLOCK_IN_OMAP16XX | CLOCK_IN_OMAP730 | RATE_CKCTL, + .flags = CLOCK_IN_OMAP16XX | CLOCK_IN_OMAP730, .enable_reg = (void __iomem *)ARM_IDLECT2, .enable_bit = EN_LCDCK, .rate_offset = CKCTL_LCDDIV_OFFSET, .recalc = &omap1_ckctl_recalc, + .round_rate = omap1_clk_round_rate_ckctl_arm, + .set_rate = omap1_clk_set_rate_ckctl_arm, };static struct arm_idlect1_clk lcd_ck_1510 = {
@@ -479,11 +491,13 @@ static struct arm_idlect1_clk lcd_ck_1510 = { .ops = &clkops_generic, .parent = &ck_dpll1, .flags =CLOCK_IN_OMAP1510 |CLOCK_IN_OMAP310 | - RATE_CKCTL | CLOCK_IDLE_CONTROL, + CLOCK_IDLE_CONTROL, .enable_reg = (void __iomem *)ARM_IDLECT2, .enable_bit = EN_LCDCK, .rate_offset = CKCTL_LCDDIV_OFFSET, .recalc = &omap1_ckctl_recalc, + .round_rate = omap1_clk_round_rate_ckctl_arm, + .set_rate = omap1_clk_set_rate_ckctl_arm, }, .idlect_shift = 3, };
arch/arm/plat-omap/include/mach/clock.h +1 -1
@@ -124,7 +124,7 @@ extern void clk_enable_init_clocks(void);extern const struct clkops clkops_null;/* Clock flags */ -#define RATE_CKCTL (1 << 0)/* Main fixed ratio clocks */ +/* bit 0 is free */ #define RATE_FIXED (1 << 1)/* Fixed clock rate */ #define RATE_PROPAGATES (1 << 2)/* Program children too */ /* bits 3-4 are free */
Signature · 1 line
1.6.1.2
PATCH 16/86 omap: ensure devname is set for dummy devices
From: Russell King <[email protected]>
This is needed to use these with the clkdev helpers.
--- arch/arm/mach-omap2/devices.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/devices.c +1 -0
@@ -348,6 +348,7 @@ static void __init omap_hsmmc_reset(void) } dummy_pdev.id = i; +dev_set_name (&dummy_pdev.dev,"mmci-omap-hs.%d" , i); iclk =clk_get (dev,"mmchs_ick" );if (iclk &&clk_enable (iclk)) iclk =NULL ;
Signature · 1 line
1.6.1.2
PATCH 17/86 omap: allow double-registering of clocks
From: Russell King <[email protected]>
This stops things blowing up if a 'struct clk' to be passed more than once to clk_register(), which will be required when we decouple struct clk's from their names.
--- arch/arm/plat-omap/clock.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/plat-omap/clock.c +6 -0
@@ -292,6 +292,12 @@ int clk_register(struct clk *clk)if (clk ==NULL ||IS_ERR (clk))return -EINVAL ; +/* +* trap out already registered clocks +*/ +if (clk->node.next || clk->node.prev) +return 0 ; +mutex_lock (&clocks_mutex);list_add (&clk->node, &clocks);if (clk->init)
Signature · 1 line
1.6.1.2
PATCH 18/86 omap: convert OMAP1 to use clkdev
From: Russell King <[email protected]>
--- arch/arm/mach-omap1/clock.c | 117 +++++++++++++++++---- arch/arm/mach-omap1/clock.h | 164 ++++++------------------------ arch/arm/plat-omap/Kconfig | 1 + arch/arm/plat-omap/clock.c | 4 + arch/arm/plat-omap/include/mach/clkdev.h | 13 +++ arch/arm/plat-omap/include/mach/clock.h | 6 +- 6 files changed, 145 insertions(+), 160 deletions(-) create mode 100644 arch/arm/plat-omap/include/mach/clkdev.h
arch/arm/mach-omap1/clock.c +94 -23
@@ -20,6 +20,7 @@#include <linux/io.h> #include <asm/mach-types.h> +#include <asm/clkdev.h> #include <mach/cpu.h> #include <mach/usb.h>
@@ -32,6 +33,83 @@ static const struct clkops clkops_dspck;#include "clock.h" +struct omap_clk { +u32 cpu; +struct clk_lookup lk; +}; + +#define CLK (dev, con, ck, cp) \ + { \ + .cpu = cp, \ + .lk = { \ + .dev_id = dev, \ + .con_id = con, \ + .clk = ck, \ + }, \ + } + +#define CK_310 (1 << 0) +#define CK_730 (1 << 1) +#define CK_1510 (1 << 2) +#define CK_16XX (1 << 3) + +static struct omap_clk omap_clks[] = { +/* non-ULPD clocks */ +CLK (NULL ,"ck_ref" , &ck_ref,CK_16XX |CK_1510 |CK_310 ), +CLK (NULL ,"ck_dpll1" , &ck_dpll1,CK_16XX |CK_1510 |CK_310 ), +/* CK_GEN1 clocks */ +CLK (NULL ,"ck_dpll1out" , &ck_dpll1out.clk,CK_16XX ), +CLK (NULL ,"ck_sossi" , &sossi_ck,CK_16XX ), +CLK (NULL ,"arm_ck" , &arm_ck,CK_16XX |CK_1510 |CK_310 ), +CLK (NULL ,"armper_ck" , &armper_ck.clk,CK_16XX |CK_1510 |CK_310 ), +CLK (NULL ,"arm_gpio_ck" , &arm_gpio_ck,CK_1510 |CK_310 ), +CLK (NULL ,"armxor_ck" , &armxor_ck.clk,CK_16XX |CK_1510 |CK_310 ), +CLK (NULL ,"armtim_ck" , &armtim_ck.clk,CK_16XX |CK_1510 |CK_310 ), +CLK (NULL ,"armwdt_ck" , &armwdt_ck.clk,CK_16XX |CK_1510 |CK_310 ), +CLK (NULL ,"arminth_ck" , &arminth_ck1510,CK_1510 |CK_310 ), +CLK (NULL ,"arminth_ck" , &arminth_ck16xx,CK_16XX ), +/* CK_GEN2 clocks */ +CLK (NULL ,"dsp_ck" , &dsp_ck,CK_16XX |CK_1510 |CK_310 ), +CLK (NULL ,"dspmmu_ck" , &dspmmu_ck,CK_16XX |CK_1510 |CK_310 ), +CLK (NULL ,"dspper_ck" , &dspper_ck,CK_16XX |CK_1510 |CK_310 ), +CLK (NULL ,"dspxor_ck" , &dspxor_ck,CK_16XX |CK_1510 |CK_310 ), +CLK (NULL ,"dsptim_ck" , &dsptim_ck,CK_16XX |CK_1510 |CK_310 ), +/* CK_GEN3 clocks */ +CLK (NULL ,"tc_ck" , &tc_ck.clk,CK_16XX |CK_1510 |CK_310 |CK_730 ), +CLK (NULL ,"tipb_ck" , &tipb_ck,CK_1510 |CK_310 ), +CLK (NULL ,"l3_ocpi_ck" , &l3_ocpi_ck,CK_16XX ), +CLK (NULL ,"tc1_ck" , &tc1_ck,CK_16XX ), +CLK (NULL ,"tc2_ck" , &tc2_ck,CK_16XX ), +CLK (NULL ,"dma_ck" , &dma_ck,CK_16XX |CK_1510 |CK_310 ), +CLK (NULL ,"dma_lcdfree_ck" , &dma_lcdfree_ck,CK_16XX ), +CLK (NULL ,"api_ck" , &api_ck.clk,CK_16XX |CK_1510 |CK_310 ), +CLK (NULL ,"lb_ck" , &lb_ck.clk,CK_1510 |CK_310 ), +CLK (NULL ,"rhea1_ck" , &rhea1_ck,CK_16XX ), +CLK (NULL ,"rhea2_ck" , &rhea2_ck,CK_16XX ), +CLK (NULL ,"lcd_ck" , &lcd_ck_16xx,CK_16XX |CK_730 ), +CLK (NULL ,"lcd_ck" , &lcd_ck_1510.clk,CK_1510 |CK_310 ), +/* ULPD clocks */ +CLK (NULL ,"uart1_ck" , &uart1_1510,CK_1510 |CK_310 ), +CLK (NULL ,"uart1_ck" , &uart1_16xx.clk,CK_16XX ), +CLK (NULL ,"uart2_ck" , &uart2_ck,CK_16XX |CK_1510 |CK_310 ), +CLK (NULL ,"uart3_ck" , &uart3_1510,CK_1510 |CK_310 ), +CLK (NULL ,"uart3_ck" , &uart3_16xx.clk,CK_16XX ), +CLK (NULL ,"usb_clko" , &usb_clko,CK_16XX |CK_1510 |CK_310 ), +CLK (NULL ,"usb_hhc_ck" , &usb_hhc_ck1510,CK_1510 |CK_310 ), +CLK (NULL ,"usb_hhc_ck" , &usb_hhc_ck16xx,CK_16XX ), +CLK (NULL ,"usb_dc_ck" , &usb_dc_ck,CK_16XX ), +CLK (NULL ,"mclk" , &mclk_1510,CK_1510 |CK_310 ), +CLK (NULL ,"mclk" , &mclk_16xx,CK_16XX ), +CLK (NULL ,"bclk" , &bclk_1510,CK_1510 |CK_310 ), +CLK (NULL ,"bclk" , &bclk_16xx,CK_16XX ), +CLK ("mmci-omap.0" ,"mmc_ck" , &mmc1_ck,CK_16XX |CK_1510 |CK_310 ), +CLK ("mmci-omap.1" ,"mmc_ck" , &mmc2_ck,CK_16XX ), +/* Virtual clocks */ +CLK (NULL ,"mpu" , &virtual_ck_mpu,CK_16XX |CK_1510 |CK_310 ), +CLK ("i2c_omap.1" ,"i2c_fck" , &i2c_fck,CK_16XX |CK_1510 |CK_310 ), +CLK ("i2c_omap.1" ,"i2c_ick" , &i2c_ick,CK_16XX ), +}; +static int omap1_clk_enable_generic (struct clk * clk);static int omap1_clk_enable (struct clk *clk);static void omap1_clk_disable_generic (struct clk * clk);
@@ -677,10 +755,10 @@ static struct clk_functions omap1_clk_functions = {int __init omap1_clk_init (void ) { -struct clk ** clkp; +struct omap_clk *c;const struct omap_clock_config *info;int crystal_type =0 ;/* Default 12 MHz */ -u32 reg; +u32 reg, cpu_mask;#ifdef CONFIG_DEBUG_LL /* Resets some clocks that may be left on from bootloader,
@@ -700,27 +778,21 @@ int __init omap1_clk_init(void)/* By default all idlect1 clocks are allowed to idle */ arm_idlect1_mask = ~0 ; -for (clkp = onchip_clks; clkp < onchip_clks+ARRAY_SIZE (onchip_clks); clkp++) { -if (((*clkp)->flags &CLOCK_IN_OMAP1510 ) &&cpu_is_omap1510 ()) { -clk_register (*clkp); -continue ; - } - -if (((*clkp)->flags &CLOCK_IN_OMAP16XX ) &&cpu_is_omap16xx ()) { -clk_register (*clkp); -continue ; - } - -if (((*clkp)->flags &CLOCK_IN_OMAP730 ) &&cpu_is_omap730 ()) { -clk_register (*clkp); -continue ; - } - -if (((*clkp)->flags &CLOCK_IN_OMAP310 ) &&cpu_is_omap310 ()) { -clk_register (*clkp); -continue ; + cpu_mask =0 ; +if (cpu_is_omap16xx ()) + cpu_mask |=CK_16XX ; +if (cpu_is_omap1510 ()) + cpu_mask |=CK_1510 ; +if (cpu_is_omap730 ()) + cpu_mask |=CK_730 ; +if (cpu_is_omap310 ()) + cpu_mask |=CK_310 ; + +for (c = omap_clks; c < omap_clks +ARRAY_SIZE (omap_clks); c++) +if (c->cpu & cpu_mask) { +clkdev_add (&c->lk); +clk_register (c->lk.clk); } - } info = omap_get_config(OMAP_TAG_CLOCK, struct omap_clock_config);if (info !=NULL ) {
@@ -831,4 +903,3 @@ int __init omap1_clk_init(void)return 0 ; } -
arch/arm/mach-omap1/clock.h +32 -132
454 lines not on this page · raw message
arch/arm/plat-omap/Kconfig +1 -0
@@ -11,6 +11,7 @@ choice config ARCH_OMAP1 bool "TI OMAP1" + select COMMON_CLKDEV config ARCH_OMAP2 bool "TI OMAP2"
arch/arm/plat-omap/clock.c +4 -0
@@ -36,6 +36,7 @@ static struct clk_functions *arch_clock;* Standard clock functions defined in include/linux/clk.h *-------------------------------------------------------------------------*/ +#ifndef CONFIG_COMMON_CLKDEV /* * Returns a clock. Note that we first try to use device id on the bus * and clock name. If this fails, we try to use clock name only.
@@ -72,6 +73,7 @@ found: return clk; }EXPORT_SYMBOL (clk_get); +#endif int clk_enable (struct clk *clk) {
@@ -145,10 +147,12 @@ unsigned long clk_get_rate(struct clk *clk) }EXPORT_SYMBOL (clk_get_rate); +#ifndef CONFIG_COMMON_CLKDEV void clk_put (struct clk *clk) { }EXPORT_SYMBOL (clk_put); +#endif /*------------------------------------------------------------------------- * Optional clock functions defined in include/linux/clk.h
arch/arm/plat-omap/include/mach/clkdev.h new file +13 -0
@@ -0,0 +1,13 @@ +#ifndef __MACH_CLKDEV_H +#define __MACH_CLKDEV_H + +static inline int __clk_get (struct clk *clk) +{ +return 1 ; +} + +static inline void __clk_put (struct clk *clk) +{ +} + +#endif
arch/arm/plat-omap/include/mach/clock.h +1 -5
@@ -136,11 +136,7 @@ extern const struct clkops clkops_null;#define CONFIG_PARTICIPANT (1 << 10)/* Fundamental clock */ #define ENABLE_ON_INIT (1 << 11)/* Enable upon framework init */ #define INVERT_ENABLE (1 << 12)/* 0 enables, 1 disables */ -/* bits 13-20 are currently free */ -#define CLOCK_IN_OMAP310 (1 << 21) -#define CLOCK_IN_OMAP730 (1 << 22) -#define CLOCK_IN_OMAP1510 (1 << 23) -#define CLOCK_IN_OMAP16XX (1 << 24) +/* bits 13-24 are currently free */ #define CLOCK_IN_OMAP242X (1 << 25)#define CLOCK_IN_OMAP243X (1 << 26)#define CLOCK_IN_OMAP343X (1 << 27)/* clocks common to all 343X */
Signature · 1 line
1.6.1.2
PATCH 19/86 omap: convert OMAP2 to use clkdev
From: Russell King <[email protected]>
--- arch/arm/mach-omap2/clock24xx.c | 197 ++++++++++++++++-- arch/arm/mach-omap2/clock24xx.h | 353 +++---------------------------- arch/arm/plat-omap/Kconfig | 1 + arch/arm/plat-omap/include/mach/clock.h | 4 +- 4 files changed, 218 insertions(+), 337 deletions(-)
arch/arm/mach-omap2/clock24xx.c +183 -14
@@ -31,6 +31,7 @@#include <mach/clock.h> #include <mach/sram.h> #include <asm/div64.h> +#include <asm/clkdev.h> #include "memory.h" #include "clock.h"
@@ -44,6 +45,177 @@ static const struct clkops clkops_fixed;#include "clock24xx.h" +struct omap_clk { +u32 cpu; +struct clk_lookup lk; +}; + +#define CLK (dev, con, ck, cp) \ + { \ + .cpu = cp, \ + .lk = { \ + .dev_id = dev, \ + .con_id = con, \ + .clk = ck, \ + }, \ + } + +#define CK_243X (1 << 0) +#define CK_242X (1 << 1) + +static struct omap_clk omap24xx_clks[] = { +/* external root sources */ +CLK (NULL ,"func_32k_ck" , &func_32k_ck,CK_243X |CK_242X ), +CLK (NULL ,"osc_ck" , &osc_ck,CK_243X |CK_242X ), +CLK (NULL ,"sys_ck" , &sys_ck,CK_243X |CK_242X ), +CLK (NULL ,"alt_ck" , &alt_ck,CK_243X |CK_242X ), +/* internal analog sources */ +CLK (NULL ,"dpll_ck" , &dpll_ck,CK_243X |CK_242X ), +CLK (NULL ,"apll96_ck" , &apll96_ck,CK_243X |CK_242X ), +CLK (NULL ,"apll54_ck" , &apll54_ck,CK_243X |CK_242X ), +/* internal prcm root sources */ +CLK (NULL ,"func_54m_ck" , &func_54m_ck,CK_243X |CK_242X ), +CLK (NULL ,"core_ck" , &core_ck,CK_243X |CK_242X ), +CLK (NULL ,"func_96m_ck" , &func_96m_ck,CK_243X |CK_242X ), +CLK (NULL ,"func_48m_ck" , &func_48m_ck,CK_243X |CK_242X ), +CLK (NULL ,"func_12m_ck" , &func_12m_ck,CK_243X |CK_242X ), +CLK (NULL ,"ck_wdt1_osc" , &wdt1_osc_ck,CK_243X |CK_242X ), +CLK (NULL ,"sys_clkout_src" , &sys_clkout_src,CK_243X |CK_242X ), +CLK (NULL ,"sys_clkout" , &sys_clkout,CK_243X |CK_242X ), +CLK (NULL ,"sys_clkout2_src" , &sys_clkout2_src,CK_242X ), +CLK (NULL ,"sys_clkout2" , &sys_clkout2,CK_242X ), +CLK (NULL ,"emul_ck" , &emul_ck,CK_242X ), +/* mpu domain clocks */ +CLK (NULL ,"mpu_ck" , &mpu_ck,CK_243X |CK_242X ), +/* dsp domain clocks */ +CLK (NULL ,"dsp_fck" , &dsp_fck,CK_243X |CK_242X ), +CLK (NULL ,"dsp_irate_ick" , &dsp_irate_ick,CK_243X |CK_242X ), +CLK (NULL ,"dsp_ick" , &dsp_ick,CK_242X ), +CLK (NULL ,"iva2_1_ick" , &iva2_1_ick,CK_243X ), +CLK (NULL ,"iva1_ifck" , &iva1_ifck,CK_242X ), +CLK (NULL ,"iva1_mpu_int_ifck" , &iva1_mpu_int_ifck,CK_242X ), +/* GFX domain clocks */ +CLK (NULL ,"gfx_3d_fck" , &gfx_3d_fck,CK_243X |CK_242X ), +CLK (NULL ,"gfx_2d_fck" , &gfx_2d_fck,CK_243X |CK_242X ), +CLK (NULL ,"gfx_ick" , &gfx_ick,CK_243X |CK_242X ), +/* Modem domain clocks */ +CLK (NULL ,"mdm_ick" , &mdm_ick,CK_243X ), +CLK (NULL ,"mdm_osc_ck" , &mdm_osc_ck,CK_243X ), +/* DSS domain clocks */ +CLK (NULL ,"dss_ick" , &dss_ick,CK_243X |CK_242X ), +CLK (NULL ,"dss1_fck" , &dss1_fck,CK_243X |CK_242X ), +CLK (NULL ,"dss2_fck" , &dss2_fck,CK_243X |CK_242X ), +CLK (NULL ,"dss_54m_fck" , &dss_54m_fck,CK_243X |CK_242X ), +/* L3 domain clocks */ +CLK (NULL ,"core_l3_ck" , &core_l3_ck,CK_243X |CK_242X ), +CLK (NULL ,"ssi_fck" , &ssi_ssr_sst_fck,CK_243X |CK_242X ), +CLK (NULL ,"usb_l4_ick" , &usb_l4_ick,CK_243X |CK_242X ), +/* L4 domain clocks */ +CLK (NULL ,"l4_ck" , &l4_ck,CK_243X |CK_242X ), +/* virtual meta-group clock */ +CLK (NULL ,"virt_prcm_set" , &virt_prcm_set,CK_243X |CK_242X ), +/* general l4 interface ck, multi-parent functional clk */ +CLK (NULL ,"gpt1_ick" , &gpt1_ick,CK_243X |CK_242X ), +CLK (NULL ,"gpt1_fck" , &gpt1_fck,CK_243X |CK_242X ), +CLK (NULL ,"gpt2_ick" , &gpt2_ick,CK_243X |CK_242X ), +CLK (NULL ,"gpt2_fck" , &gpt2_fck,CK_243X |CK_242X ), +CLK (NULL ,"gpt3_ick" , &gpt3_ick,CK_243X |CK_242X ), +CLK (NULL ,"gpt3_fck" , &gpt3_fck,CK_243X |CK_242X ), +CLK (NULL ,"gpt4_ick" , &gpt4_ick,CK_243X |CK_242X ), +CLK (NULL ,"gpt4_fck" , &gpt4_fck,CK_243X |CK_242X ), +CLK (NULL ,"gpt5_ick" , &gpt5_ick,CK_243X |CK_242X ), +CLK (NULL ,"gpt5_fck" , &gpt5_fck,CK_243X |CK_242X ), +CLK (NULL ,"gpt6_ick" , &gpt6_ick,CK_243X |CK_242X ), +CLK (NULL ,"gpt6_fck" , &gpt6_fck,CK_243X |CK_242X ), +CLK (NULL ,"gpt7_ick" , &gpt7_ick,CK_243X |CK_242X ), +CLK (NULL ,"gpt7_fck" , &gpt7_fck,CK_243X |CK_242X ), +CLK (NULL ,"gpt8_ick" , &gpt8_ick,CK_243X |CK_242X ), +CLK (NULL ,"gpt8_fck" , &gpt8_fck,CK_243X |CK_242X ), +CLK (NULL ,"gpt9_ick" , &gpt9_ick,CK_243X |CK_242X ), +CLK (NULL ,"gpt9_fck" , &gpt9_fck,CK_243X |CK_242X ), +CLK (NULL ,"gpt10_ick" , &gpt10_ick,CK_243X |CK_242X ), +CLK (NULL ,"gpt10_fck" , &gpt10_fck,CK_243X |CK_242X ), +CLK (NULL ,"gpt11_ick" , &gpt11_ick,CK_243X |CK_242X ), +CLK (NULL ,"gpt11_fck" , &gpt11_fck,CK_243X |CK_242X ), +CLK (NULL ,"gpt12_ick" , &gpt12_ick,CK_243X |CK_242X ), +CLK (NULL ,"gpt12_fck" , &gpt12_fck,CK_243X |CK_242X ), +CLK ("omap-mcbsp.1" ,"mcbsp_ick" , &mcbsp1_ick,CK_243X |CK_242X ), +CLK ("omap-mcbsp.1" ,"mcbsp_fck" , &mcbsp1_fck,CK_243X |CK_242X ), +CLK ("omap-mcbsp.2" ,"mcbsp_ick" , &mcbsp2_ick,CK_243X |CK_242X ), +CLK ("omap-mcbsp.2" ,"mcbsp_fck" , &mcbsp2_fck,CK_243X |CK_242X ), +CLK ("omap-mcbsp.3" ,"mcbsp_ick" , &mcbsp3_ick,CK_243X ), +CLK ("omap-mcbsp.3" ,"mcbsp_fck" , &mcbsp3_fck,CK_243X ), +CLK ("omap-mcbsp.4" ,"mcbsp_ick" , &mcbsp4_ick,CK_243X ), +CLK ("omap-mcbsp.4" ,"mcbsp_fck" , &mcbsp4_fck,CK_243X ), +CLK ("omap-mcbsp.5" ,"mcbsp_ick" , &mcbsp5_ick,CK_243X ), +CLK ("omap-mcbsp.5" ,"mcbsp_fck" , &mcbsp5_fck,CK_243X ), +CLK ("omap2_mcspi.1" ,"mcspi_ick" , &mcspi1_ick,CK_243X |CK_242X ), +CLK ("omap2_mcspi.1" ,"mcspi_fck" , &mcspi1_fck,CK_243X |CK_242X ), +CLK ("omap2_mcspi.2" ,"mcspi_ick" , &mcspi2_ick,CK_243X |CK_242X ), +CLK ("omap2_mcspi.2" ,"mcspi_fck" , &mcspi2_fck,CK_243X |CK_242X ), +CLK ("omap2_mcspi.3" ,"mcspi_ick" , &mcspi3_ick,CK_243X ), +CLK ("omap2_mcspi.3" ,"mcspi_fck" , &mcspi3_fck,CK_243X ), +CLK (NULL ,"uart1_ick" , &uart1_ick,CK_243X |CK_242X ), +CLK (NULL ,"uart1_fck" , &uart1_fck,CK_243X |CK_242X ), +CLK (NULL ,"uart2_ick" , &uart2_ick,CK_243X |CK_242X ), +CLK (NULL ,"uart2_fck" , &uart2_fck,CK_243X |CK_242X ), +CLK (NULL ,"uart3_ick" , &uart3_ick,CK_243X |CK_242X ), +CLK (NULL ,"uart3_fck" , &uart3_fck,CK_243X |CK_242X ), +CLK (NULL ,"gpios_ick" , &gpios_ick,CK_243X |CK_242X ), +CLK (NULL ,"gpios_fck" , &gpios_fck,CK_243X |CK_242X ), +CLK (NULL ,"mpu_wdt_ick" , &mpu_wdt_ick,CK_243X |CK_242X ), +CLK (NULL ,"mpu_wdt_fck" , &mpu_wdt_fck,CK_243X |CK_242X ), +CLK (NULL ,"sync_32k_ick" , &sync_32k_ick,CK_243X |CK_242X ), +CLK (NULL ,"wdt1_ick" , &wdt1_ick,CK_243X |CK_242X ), +CLK (NULL ,"omapctrl_ick" , &omapctrl_ick,CK_243X |CK_242X ), +CLK (NULL ,"icr_ick" , &icr_ick,CK_243X ), +CLK (NULL ,"cam_fck" , &cam_fck,CK_243X |CK_242X ), +CLK (NULL ,"cam_ick" , &cam_ick,CK_243X |CK_242X ), +CLK (NULL ,"mailboxes_ick" , &mailboxes_ick,CK_243X |CK_242X ), +CLK (NULL ,"wdt4_ick" , &wdt4_ick,CK_243X |CK_242X ), +CLK (NULL ,"wdt4_fck" , &wdt4_fck,CK_243X |CK_242X ), +CLK (NULL ,"wdt3_ick" , &wdt3_ick,CK_242X ), +CLK (NULL ,"wdt3_fck" , &wdt3_fck,CK_242X ), +CLK (NULL ,"mspro_ick" , &mspro_ick,CK_243X |CK_242X ), +CLK (NULL ,"mspro_fck" , &mspro_fck,CK_243X |CK_242X ), +CLK (NULL ,"mmc_ick" , &mmc_ick,CK_242X ), +CLK (NULL ,"mmc_fck" , &mmc_fck,CK_242X ), +CLK (NULL ,"fac_ick" , &fac_ick,CK_243X |CK_242X ), +CLK (NULL ,"fac_fck" , &fac_fck,CK_243X |CK_242X ), +CLK (NULL ,"eac_ick" , &eac_ick,CK_242X ), +CLK (NULL ,"eac_fck" , &eac_fck,CK_242X ), +CLK (NULL ,"hdq_ick" , &hdq_ick,CK_243X |CK_242X ), +CLK (NULL ,"hdq_fck" , &hdq_fck,CK_243X |CK_242X ), +CLK ("i2c_omap.1" ,"i2c_ick" , &i2c1_ick,CK_243X |CK_242X ), +CLK ("i2c_omap.1" ,"i2c_fck" , &i2c1_fck,CK_242X ), +CLK ("i2c_omap.1" ,"i2c_fck" , &i2chs1_fck,CK_243X ), +CLK ("i2c_omap.2" ,"i2c_ick" , &i2c2_ick,CK_243X |CK_242X ), +CLK ("i2c_omap.2" ,"i2c_fck" , &i2c2_fck,CK_242X ), +CLK ("i2c_omap.2" ,"i2c_fck" , &i2chs2_fck,CK_243X ), +CLK (NULL ,"gpmc_fck" , &gpmc_fck,CK_243X |CK_242X ), +CLK (NULL ,"sdma_fck" , &sdma_fck,CK_243X |CK_242X ), +CLK (NULL ,"sdma_ick" , &sdma_ick,CK_243X |CK_242X ), +CLK (NULL ,"vlynq_ick" , &vlynq_ick,CK_242X ), +CLK (NULL ,"vlynq_fck" , &vlynq_fck,CK_242X ), +CLK (NULL ,"sdrc_ick" , &sdrc_ick,CK_243X ), +CLK (NULL ,"des_ick" , &des_ick,CK_243X |CK_242X ), +CLK (NULL ,"sha_ick" , &sha_ick,CK_243X |CK_242X ), +CLK (NULL ,"rng_ick" , &rng_ick,CK_243X |CK_242X ), +CLK (NULL ,"aes_ick" , &aes_ick,CK_243X |CK_242X ), +CLK (NULL ,"pka_ick" , &pka_ick,CK_243X |CK_242X ), +CLK (NULL ,"usb_fck" , &usb_fck,CK_243X |CK_242X ), +CLK (NULL ,"usbhs_ick" , &usbhs_ick,CK_243X ), +CLK ("mmci-omap-hs.0" ,"mmchs_ick" , &mmchs1_ick,CK_243X ), +CLK ("mmci-omap-hs.0" ,"mmchs_fck" , &mmchs1_fck,CK_243X ), +CLK ("mmci-omap-hs.1" ,"mmchs_ick" , &mmchs2_ick,CK_243X ), +CLK ("mmci-omap-hs.1" ,"mmchs_fck" , &mmchs2_fck,CK_243X ), +CLK (NULL ,"gpio5_ick" , &gpio5_ick,CK_243X ), +CLK (NULL ,"gpio5_fck" , &gpio5_fck,CK_243X ), +CLK (NULL ,"mdm_intc_ick" , &mdm_intc_ick,CK_243X ), +CLK ("mmci-omap-hs.0" ,"mmchsdb_fck" , &mmchsdb1_fck,CK_243X ), +CLK ("mmci-omap-hs.1" ,"mmchsdb_fck" , &mmchsdb2_fck,CK_243X ), +}; +/* CM_CLKEN_PLL.EN_{54,96}M_PLL options (24XX) */ #define EN_APLL_STOPPED 0#define EN_APLL_LOCKED 3
@@ -487,8 +659,8 @@ arch_initcall(omap2_clk_arch_init);int __init omap2_clk_init (void ) {struct prcm_config *prcm; -struct clk **clkp; -u32 clkrate; +struct omap_clk *c; +u32 clkrate, cpu_mask;if (cpu_is_omap242x ()) cpu_mask =RATE_IN_242X ;
@@ -502,21 +674,18 @@ int __init omap2_clk_init(void)omap2_sys_clk_recalc (&sys_ck);propagate_rate (&sys_ck); -for (clkp = onchip_24xx_clks; - clkp < onchip_24xx_clks +ARRAY_SIZE (onchip_24xx_clks); - clkp++) { + cpu_mask =0 ; +if (cpu_is_omap2420 ()) + cpu_mask |=CK_242X ; +if (cpu_is_omap2430 ()) + cpu_mask |=CK_243X ; -if ((*clkp)->flags &CLOCK_IN_OMAP242X &&cpu_is_omap2420 ()) { -clk_register (*clkp); -continue ; +for (c = omap24xx_clks; c < omap24xx_clks +ARRAY_SIZE (omap24xx_clks); c++) +if (c->cpu & cpu_mask) { +clkdev_add (&c->lk); +clk_register (c->lk.clk); } -if ((*clkp)->flags &CLOCK_IN_OMAP243X &&cpu_is_omap2430 ()) { -clk_register (*clkp); -continue ; - } - } -/* Check the MPU rate set by bootloader */ clkrate =omap2_get_dpll_rate_24xx (&dpll_ck);for (prcm = rate_table; prcm->mpu_speed; prcm++) {
arch/arm/mach-omap2/clock24xx.h +33 -320
1,186 lines not on this page · raw message
arch/arm/plat-omap/Kconfig +1 -0
@@ -16,6 +16,7 @@ config ARCH_OMAP1 config ARCH_OMAP2 bool "TI OMAP2" select CPU_V6 + select COMMON_CLKDEV config ARCH_OMAP3 bool "TI OMAP3"
arch/arm/plat-omap/include/mach/clock.h +1 -3
@@ -136,9 +136,7 @@ extern const struct clkops clkops_null;#define CONFIG_PARTICIPANT (1 << 10)/* Fundamental clock */ #define ENABLE_ON_INIT (1 << 11)/* Enable upon framework init */ #define INVERT_ENABLE (1 << 12)/* 0 enables, 1 disables */ -/* bits 13-24 are currently free */ -#define CLOCK_IN_OMAP242X (1 << 25) -#define CLOCK_IN_OMAP243X (1 << 26) +/* bits 13-26 are currently free */ #define CLOCK_IN_OMAP343X (1 << 27)/* clocks common to all 343X */ #define CLOCK_IN_OMAP3430ES1 (1 << 29)/* 3430ES1 clocks only */ #define CLOCK_IN_OMAP3430ES2 (1 << 30)/* 3430ES2 clocks only */
Signature · 1 line
1.6.1.2
PATCH 20/86 omap: convert OMAP3 to use clkdev
From: Russell King <[email protected]>
--- arch/arm/mach-omap2/clock34xx.c | 268 +++++++++++++++-- arch/arm/mach-omap2/clock34xx.h | 513 +++++-------------------------- arch/arm/plat-omap/Kconfig | 1 + arch/arm/plat-omap/include/mach/clock.h | 5 +- 4 files changed, 331 insertions(+), 456 deletions(-)
arch/arm/mach-omap2/clock34xx.c +244 -24
@@ -30,6 +30,7 @@#include <mach/clock.h> #include <mach/sram.h> #include <asm/div64.h> +#include <asm/clkdev.h> #include "memory.h" #include "clock.h"
@@ -42,6 +43,240 @@ static const struct clkops clkops_noncore_dpll_ops;#include "clock34xx.h" +struct omap_clk { +u32 cpu; +struct clk_lookup lk; +}; + +#define CLK (dev, con, ck, cp) \ + { \ + .cpu = cp, \ + .lk = { \ + .dev_id = dev, \ + .con_id = con, \ + .clk = ck, \ + }, \ + } + +#define CK_343X (1 << 0) +#define CK_3430ES1 (1 << 1) +#define CK_3430ES2 (1 << 2) + +static struct omap_clk omap34xx_clks[] = { +CLK (NULL ,"omap_32k_fck" , &omap_32k_fck,CK_343X ), +CLK (NULL ,"virt_12m_ck" , &virt_12m_ck,CK_343X ), +CLK (NULL ,"virt_13m_ck" , &virt_13m_ck,CK_343X ), +CLK (NULL ,"virt_16_8m_ck" , &virt_16_8m_ck,CK_3430ES2 ), +CLK (NULL ,"virt_19_2m_ck" , &virt_19_2m_ck,CK_343X ), +CLK (NULL ,"virt_26m_ck" , &virt_26m_ck,CK_343X ), +CLK (NULL ,"virt_38_4m_ck" , &virt_38_4m_ck,CK_343X ), +CLK (NULL ,"osc_sys_ck" , &osc_sys_ck,CK_343X ), +CLK (NULL ,"sys_ck" , &sys_ck,CK_343X ), +CLK (NULL ,"sys_altclk" , &sys_altclk,CK_343X ), +CLK (NULL ,"mcbsp_clks" , &mcbsp_clks,CK_343X ), +CLK (NULL ,"sys_clkout1" , &sys_clkout1,CK_343X ), +CLK (NULL ,"dpll1_ck" , &dpll1_ck,CK_343X ), +CLK (NULL ,"dpll1_x2_ck" , &dpll1_x2_ck,CK_343X ), +CLK (NULL ,"dpll1_x2m2_ck" , &dpll1_x2m2_ck,CK_343X ), +CLK (NULL ,"dpll2_ck" , &dpll2_ck,CK_343X ), +CLK (NULL ,"dpll2_m2_ck" , &dpll2_m2_ck,CK_343X ), +CLK (NULL ,"dpll3_ck" , &dpll3_ck,CK_343X ), +CLK (NULL ,"core_ck" , &core_ck,CK_343X ), +CLK (NULL ,"dpll3_x2_ck" , &dpll3_x2_ck,CK_343X ), +CLK (NULL ,"dpll3_m2_ck" , &dpll3_m2_ck,CK_343X ), +CLK (NULL ,"dpll3_m2x2_ck" , &dpll3_m2x2_ck,CK_343X ), +CLK (NULL ,"dpll3_m3_ck" , &dpll3_m3_ck,CK_343X ), +CLK (NULL ,"dpll3_m3x2_ck" , &dpll3_m3x2_ck,CK_343X ), +CLK (NULL ,"emu_core_alwon_ck" , &emu_core_alwon_ck,CK_343X ), +CLK (NULL ,"dpll4_ck" , &dpll4_ck,CK_343X ), +CLK (NULL ,"dpll4_x2_ck" , &dpll4_x2_ck,CK_343X ), +CLK (NULL ,"omap_96m_alwon_fck" , &omap_96m_alwon_fck,CK_343X ), +CLK (NULL ,"omap_96m_fck" , &omap_96m_fck,CK_343X ), +CLK (NULL ,"cm_96m_fck" , &cm_96m_fck,CK_343X ), +CLK (NULL ,"virt_omap_54m_fck" , &virt_omap_54m_fck,CK_343X ), +CLK (NULL ,"omap_54m_fck" , &omap_54m_fck,CK_343X ), +CLK (NULL ,"omap_48m_fck" , &omap_48m_fck,CK_343X ), +CLK (NULL ,"omap_12m_fck" , &omap_12m_fck,CK_343X ), +CLK (NULL ,"dpll4_m2_ck" , &dpll4_m2_ck,CK_343X ), +CLK (NULL ,"dpll4_m2x2_ck" , &dpll4_m2x2_ck,CK_343X ), +CLK (NULL ,"dpll4_m3_ck" , &dpll4_m3_ck,CK_343X ), +CLK (NULL ,"dpll4_m3x2_ck" , &dpll4_m3x2_ck,CK_343X ), +CLK (NULL ,"dpll4_m4_ck" , &dpll4_m4_ck,CK_343X ), +CLK (NULL ,"dpll4_m4x2_ck" , &dpll4_m4x2_ck,CK_343X ), +CLK (NULL ,"dpll4_m5_ck" , &dpll4_m5_ck,CK_343X ), +CLK (NULL ,"dpll4_m5x2_ck" , &dpll4_m5x2_ck,CK_343X ), +CLK (NULL ,"dpll4_m6_ck" , &dpll4_m6_ck,CK_343X ), +CLK (NULL ,"dpll4_m6x2_ck" , &dpll4_m6x2_ck,CK_343X ), +CLK (NULL ,"emu_per_alwon_ck" , &emu_per_alwon_ck,CK_343X ), +CLK (NULL ,"dpll5_ck" , &dpll5_ck,CK_3430ES2 ), +CLK (NULL ,"dpll5_m2_ck" , &dpll5_m2_ck,CK_3430ES2 ), +CLK (NULL ,"omap_120m_fck" , &omap_120m_fck,CK_3430ES2 ), +CLK (NULL ,"clkout2_src_ck" , &clkout2_src_ck,CK_343X ), +CLK (NULL ,"sys_clkout2" , &sys_clkout2,CK_343X ), +CLK (NULL ,"corex2_fck" , &corex2_fck,CK_343X ), +CLK (NULL ,"dpll1_fck" , &dpll1_fck,CK_343X ), +CLK (NULL ,"mpu_ck" , &mpu_ck,CK_343X ), +CLK (NULL ,"arm_fck" , &arm_fck,CK_343X ), +CLK (NULL ,"emu_mpu_alwon_ck" , &emu_mpu_alwon_ck,CK_343X ), +CLK (NULL ,"dpll2_fck" , &dpll2_fck,CK_343X ), +CLK (NULL ,"iva2_ck" , &iva2_ck,CK_343X ), +CLK (NULL ,"l3_ick" , &l3_ick,CK_343X ), +CLK (NULL ,"l4_ick" , &l4_ick,CK_343X ), +CLK (NULL ,"rm_ick" , &rm_ick,CK_343X ), +CLK (NULL ,"gfx_l3_ck" , &gfx_l3_ck,CK_3430ES1 ), +CLK (NULL ,"gfx_l3_fck" , &gfx_l3_fck,CK_3430ES1 ), +CLK (NULL ,"gfx_l3_ick" , &gfx_l3_ick,CK_3430ES1 ), +CLK (NULL ,"gfx_cg1_ck" , &gfx_cg1_ck,CK_3430ES1 ), +CLK (NULL ,"gfx_cg2_ck" , &gfx_cg2_ck,CK_3430ES1 ), +CLK (NULL ,"sgx_fck" , &sgx_fck,CK_3430ES2 ), +CLK (NULL ,"sgx_ick" , &sgx_ick,CK_3430ES2 ), +CLK (NULL ,"d2d_26m_fck" , &d2d_26m_fck,CK_3430ES1 ), +CLK (NULL ,"gpt10_fck" , &gpt10_fck,CK_343X ), +CLK (NULL ,"gpt11_fck" , &gpt11_fck,CK_343X ), +CLK (NULL ,"cpefuse_fck" , &cpefuse_fck,CK_3430ES2 ), +CLK (NULL ,"ts_fck" , &ts_fck,CK_3430ES2 ), +CLK (NULL ,"usbtll_fck" , &usbtll_fck,CK_3430ES2 ), +CLK (NULL ,"core_96m_fck" , &core_96m_fck,CK_343X ), +CLK ("mmci-omap-hs.2" ,"mmchs_fck" , &mmchs3_fck,CK_3430ES2 ), +CLK ("mmci-omap-hs.1" ,"mmchs_fck" , &mmchs2_fck,CK_343X ), +CLK (NULL ,"mspro_fck" , &mspro_fck,CK_343X ), +CLK ("mmci-omap-hs.0" ,"mmchs_fck" , &mmchs1_fck,CK_343X ), +CLK ("i2c_omap.3" ,"i2c_fck" , &i2c3_fck,CK_343X ), +CLK ("i2c_omap.2" ,"i2c_fck" , &i2c2_fck,CK_343X ), +CLK ("i2c_omap.1" ,"i2c_fck" , &i2c1_fck,CK_343X ), +CLK ("omap-mcbsp.5" ,"mcbsp_fck" , &mcbsp5_fck,CK_343X ), +CLK ("omap-mcbsp.1" ,"mcbsp_fck" , &mcbsp1_fck,CK_343X ), +CLK (NULL ,"core_48m_fck" , &core_48m_fck,CK_343X ), +CLK ("omap2_mcspi.4" ,"mcspi_fck" , &mcspi4_fck,CK_343X ), +CLK ("omap2_mcspi.3" ,"mcspi_fck" , &mcspi3_fck,CK_343X ), +CLK ("omap2_mcspi.2" ,"mcspi_fck" , &mcspi2_fck,CK_343X ), +CLK ("omap2_mcspi.1" ,"mcspi_fck" , &mcspi1_fck,CK_343X ), +CLK (NULL ,"uart2_fck" , &uart2_fck,CK_343X ), +CLK (NULL ,"uart1_fck" , &uart1_fck,CK_343X ), +CLK (NULL ,"fshostusb_fck" , &fshostusb_fck,CK_3430ES1 ), +CLK (NULL ,"core_12m_fck" , &core_12m_fck,CK_343X ), +CLK (NULL ,"hdq_fck" , &hdq_fck,CK_343X ), +CLK (NULL ,"ssi_ssr_fck" , &ssi_ssr_fck,CK_343X ), +CLK (NULL ,"ssi_sst_fck" , &ssi_sst_fck,CK_343X ), +CLK (NULL ,"core_l3_ick" , &core_l3_ick,CK_343X ), +CLK (NULL ,"hsotgusb_ick" , &hsotgusb_ick,CK_343X ), +CLK (NULL ,"sdrc_ick" , &sdrc_ick,CK_343X ), +CLK (NULL ,"gpmc_fck" , &gpmc_fck,CK_343X ), +CLK (NULL ,"security_l3_ick" , &security_l3_ick,CK_343X ), +CLK (NULL ,"pka_ick" , &pka_ick,CK_343X ), +CLK (NULL ,"core_l4_ick" , &core_l4_ick,CK_343X ), +CLK (NULL ,"usbtll_ick" , &usbtll_ick,CK_3430ES2 ), +CLK ("mmci-omap-hs.2" ,"mmchs_ick" , &mmchs3_ick,CK_3430ES2 ), +CLK (NULL ,"icr_ick" , &icr_ick,CK_343X ), +CLK (NULL ,"aes2_ick" , &aes2_ick,CK_343X ), +CLK (NULL ,"sha12_ick" , &sha12_ick,CK_343X ), +CLK (NULL ,"des2_ick" , &des2_ick,CK_343X ), +CLK ("mmci-omap-hs.1" ,"mmchs_ick" , &mmchs2_ick,CK_343X ), +CLK ("mmci-omap-hs.0" ,"mmchs_ick" , &mmchs1_ick,CK_343X ), +CLK (NULL ,"mspro_ick" , &mspro_ick,CK_343X ), +CLK (NULL ,"hdq_ick" , &hdq_ick,CK_343X ), +CLK ("omap2_mcspi.4" ,"mcspi_ick" , &mcspi4_ick,CK_343X ), +CLK ("omap2_mcspi.3" ,"mcspi_ick" , &mcspi3_ick,CK_343X ), +CLK ("omap2_mcspi.2" ,"mcspi_ick" , &mcspi2_ick,CK_343X ), +CLK ("omap2_mcspi.1" ,"mcspi_ick" , &mcspi1_ick,CK_343X ), +CLK ("i2c_omap.3" ,"i2c_ick" , &i2c3_ick,CK_343X ), +CLK ("i2c_omap.2" ,"i2c_ick" , &i2c2_ick,CK_343X ), +CLK ("i2c_omap.1" ,"i2c_ick" , &i2c1_ick,CK_343X ), +CLK (NULL ,"uart2_ick" , &uart2_ick,CK_343X ), +CLK (NULL ,"uart1_ick" , &uart1_ick,CK_343X ), +CLK (NULL ,"gpt11_ick" , &gpt11_ick,CK_343X ), +CLK (NULL ,"gpt10_ick" , &gpt10_ick,CK_343X ), +CLK ("omap-mcbsp.5" ,"mcbsp_ick" , &mcbsp5_ick,CK_343X ), +CLK ("omap-mcbsp.1" ,"mcbsp_ick" , &mcbsp1_ick,CK_343X ), +CLK (NULL ,"fac_ick" , &fac_ick,CK_3430ES1 ), +CLK (NULL ,"mailboxes_ick" , &mailboxes_ick,CK_343X ), +CLK (NULL ,"omapctrl_ick" , &omapctrl_ick,CK_343X ), +CLK (NULL ,"ssi_l4_ick" , &ssi_l4_ick,CK_343X ), +CLK (NULL ,"ssi_ick" , &ssi_ick,CK_343X ), +CLK (NULL ,"usb_l4_ick" , &usb_l4_ick,CK_3430ES1 ), +CLK (NULL ,"security_l4_ick2" , &security_l4_ick2,CK_343X ), +CLK (NULL ,"aes1_ick" , &aes1_ick,CK_343X ), +CLK (NULL ,"rng_ick" , &rng_ick,CK_343X ), +CLK (NULL ,"sha11_ick" , &sha11_ick,CK_343X ), +CLK (NULL ,"des1_ick" , &des1_ick,CK_343X ), +CLK (NULL ,"dss1_alwon_fck" , &dss1_alwon_fck,CK_343X ), +CLK (NULL ,"dss_tv_fck" , &dss_tv_fck,CK_343X ), +CLK (NULL ,"dss_96m_fck" , &dss_96m_fck,CK_343X ), +CLK (NULL ,"dss2_alwon_fck" , &dss2_alwon_fck,CK_343X ), +CLK (NULL ,"dss_ick" , &dss_ick,CK_343X ), +CLK (NULL ,"cam_mclk" , &cam_mclk,CK_343X ), +CLK (NULL ,"cam_ick" , &cam_ick,CK_343X ), +CLK (NULL ,"usbhost_120m_fck" , &usbhost_120m_fck,CK_3430ES2 ), +CLK (NULL ,"usbhost_48m_fck" , &usbhost_48m_fck,CK_3430ES2 ), +CLK (NULL ,"usbhost_ick" , &usbhost_ick,CK_3430ES2 ), +CLK (NULL ,"usbhost_sar_fck" , &usbhost_sar_fck,CK_3430ES2 ), +CLK (NULL ,"usim_fck" , &usim_fck,CK_3430ES2 ), +CLK (NULL ,"gpt1_fck" , &gpt1_fck,CK_343X ), +CLK (NULL ,"wkup_32k_fck" , &wkup_32k_fck,CK_343X ), +CLK (NULL ,"gpio1_dbck" , &gpio1_dbck,CK_343X ), +CLK (NULL ,"wdt2_fck" , &wdt2_fck,CK_343X ), +CLK (NULL ,"wkup_l4_ick" , &wkup_l4_ick,CK_343X ), +CLK (NULL ,"usim_ick" , &usim_ick,CK_3430ES2 ), +CLK (NULL ,"wdt2_ick" , &wdt2_ick,CK_343X ), +CLK (NULL ,"wdt1_ick" , &wdt1_ick,CK_343X ), +CLK (NULL ,"gpio1_ick" , &gpio1_ick,CK_343X ), +CLK (NULL ,"omap_32ksync_ick" , &omap_32ksync_ick,CK_343X ), +CLK (NULL ,"gpt12_ick" , &gpt12_ick,CK_343X ), +CLK (NULL ,"gpt1_ick" , &gpt1_ick,CK_343X ), +CLK (NULL ,"per_96m_fck" , &per_96m_fck,CK_343X ), +CLK (NULL ,"per_48m_fck" , &per_48m_fck,CK_343X ), +CLK (NULL ,"uart3_fck" , &uart3_fck,CK_343X ), +CLK (NULL ,"gpt2_fck" , &gpt2_fck,CK_343X ), +CLK (NULL ,"gpt3_fck" , &gpt3_fck,CK_343X ), +CLK (NULL ,"gpt4_fck" , &gpt4_fck,CK_343X ), +CLK (NULL ,"gpt5_fck" , &gpt5_fck,CK_343X ), +CLK (NULL ,"gpt6_fck" , &gpt6_fck,CK_343X ), +CLK (NULL ,"gpt7_fck" , &gpt7_fck,CK_343X ), +CLK (NULL ,"gpt8_fck" , &gpt8_fck,CK_343X ), +CLK (NULL ,"gpt9_fck" , &gpt9_fck,CK_343X ), +CLK (NULL ,"per_32k_alwon_fck" , &per_32k_alwon_fck,CK_343X ), +CLK (NULL ,"gpio6_dbck" , &gpio6_dbck,CK_343X ), +CLK (NULL ,"gpio5_dbck" , &gpio5_dbck,CK_343X ), +CLK (NULL ,"gpio4_dbck" , &gpio4_dbck,CK_343X ), +CLK (NULL ,"gpio3_dbck" , &gpio3_dbck,CK_343X ), +CLK (NULL ,"gpio2_dbck" , &gpio2_dbck,CK_343X ), +CLK (NULL ,"wdt3_fck" , &wdt3_fck,CK_343X ), +CLK (NULL ,"per_l4_ick" , &per_l4_ick,CK_343X ), +CLK (NULL ,"gpio6_ick" , &gpio6_ick,CK_343X ), +CLK (NULL ,"gpio5_ick" , &gpio5_ick,CK_343X ), +CLK (NULL ,"gpio4_ick" , &gpio4_ick,CK_343X ), +CLK (NULL ,"gpio3_ick" , &gpio3_ick,CK_343X ), +CLK (NULL ,"gpio2_ick" , &gpio2_ick,CK_343X ), +CLK (NULL ,"wdt3_ick" , &wdt3_ick,CK_343X ), +CLK (NULL ,"uart3_ick" , &uart3_ick,CK_343X ), +CLK (NULL ,"gpt9_ick" , &gpt9_ick,CK_343X ), +CLK (NULL ,"gpt8_ick" , &gpt8_ick,CK_343X ), +CLK (NULL ,"gpt7_ick" , &gpt7_ick,CK_343X ), +CLK (NULL ,"gpt6_ick" , &gpt6_ick,CK_343X ), +CLK (NULL ,"gpt5_ick" , &gpt5_ick,CK_343X ), +CLK (NULL ,"gpt4_ick" , &gpt4_ick,CK_343X ), +CLK (NULL ,"gpt3_ick" , &gpt3_ick,CK_343X ), +CLK (NULL ,"gpt2_ick" , &gpt2_ick,CK_343X ), +CLK ("omap-mcbsp.2" ,"mcbsp_ick" , &mcbsp2_ick,CK_343X ), +CLK ("omap-mcbsp.3" ,"mcbsp_ick" , &mcbsp3_ick,CK_343X ), +CLK ("omap-mcbsp.4" ,"mcbsp_ick" , &mcbsp4_ick,CK_343X ), +CLK ("omap-mcbsp.2" ,"mcbsp_fck" , &mcbsp2_fck,CK_343X ), +CLK ("omap-mcbsp.3" ,"mcbsp_fck" , &mcbsp3_fck,CK_343X ), +CLK ("omap-mcbsp.4" ,"mcbsp_fck" , &mcbsp4_fck,CK_343X ), +CLK (NULL ,"emu_src_ck" , &emu_src_ck,CK_343X ), +CLK (NULL ,"pclk_fck" , &pclk_fck,CK_343X ), +CLK (NULL ,"pclkx2_fck" , &pclkx2_fck,CK_343X ), +CLK (NULL ,"atclk_fck" , &atclk_fck,CK_343X ), +CLK (NULL ,"traceclk_src_fck" , &traceclk_src_fck,CK_343X ), +CLK (NULL ,"traceclk_fck" , &traceclk_fck,CK_343X ), +CLK (NULL ,"sr1_fck" , &sr1_fck,CK_343X ), +CLK (NULL ,"sr2_fck" , &sr2_fck,CK_343X ), +CLK (NULL ,"sr_l4_ick" , &sr_l4_ick,CK_343X ), +CLK (NULL ,"secure_32k_fck" , &secure_32k_fck,CK_343X ), +CLK (NULL ,"gpt12_fck" , &gpt12_fck,CK_343X ), +CLK (NULL ,"wdt1_fck" , &wdt1_fck,CK_343X ), +}; +/* CM_AUTOIDLE_PLL*.AUTO_* bit values */ #define DPLL_AUTOIDLE_DISABLE 0x0#define DPLL_AUTOIDLE_LOW_POWER_STOP 0x1
@@ -453,26 +688,13 @@ arch_initcall(omap2_clk_arch_init);int __init omap2_clk_init (void ) {/* struct prcm_config *prcm; */ -struct clk **clkp; +struct omap_clk *c;/* u32 clkrate; */ u32 cpu_clkflg; -/* REVISIT: Ultimately this will be used for multiboot */ -#if 0 -if (cpu_is_omap242x ()) { - cpu_mask =RATE_IN_242X ; - cpu_clkflg =CLOCK_IN_OMAP242X ; - clkp = onchip_24xx_clks; - }else if (cpu_is_omap2430 ()) { - cpu_mask =RATE_IN_243X ; - cpu_clkflg =CLOCK_IN_OMAP243X ; - clkp = onchip_24xx_clks; - } -#endif if (cpu_is_omap34xx ()) { cpu_mask =RATE_IN_343X ; - cpu_clkflg =CLOCK_IN_OMAP343X ; - clkp = onchip_34xx_clks; + cpu_clkflg =CK_343X ;/* * Update this if there are further clock changes between ES2
@@ -480,23 +702,21 @@ int __init omap2_clk_init(void)*/ if (omap_rev () ==OMAP3430_REV_ES1_0 ) {/* No 3430ES1-only rates exist, so no RATE_IN_3430ES1 */ - cpu_clkflg |=CLOCK_IN_OMAP3430ES1 ; + cpu_clkflg |=CK_3430ES1 ; }else { cpu_mask |=RATE_IN_3430ES2 ; - cpu_clkflg |=CLOCK_IN_OMAP3430ES2 ; + cpu_clkflg |=CK_3430ES2 ; } }clk_init (&omap2_clk_functions); -for (clkp = onchip_34xx_clks; - clkp < onchip_34xx_clks +ARRAY_SIZE (onchip_34xx_clks); - clkp++) { -if ((*clkp)->flags & cpu_clkflg) { -clk_register (*clkp); -omap2_init_clk_clkdm (*clkp); +for (c = omap34xx_clks; c < omap34xx_clks +ARRAY_SIZE (omap34xx_clks); c++) +if (c->cpu & cpu_clkflg) { +clkdev_add (&c->lk); +clk_register (c->lk.clk); +omap2_init_clk_clkdm (c->lk.clk); } - }/* REVISIT: Not yet ready for OMAP3 */ #if 0
arch/arm/mach-omap2/clock34xx.h +85 -428
1,785 lines not on this page · raw message
arch/arm/plat-omap/Kconfig +1 -0
@@ -21,6 +21,7 @@ config ARCH_OMAP2 config ARCH_OMAP3 bool "TI OMAP3" select CPU_V7 + select COMMON_CLKDEV endchoice
arch/arm/plat-omap/include/mach/clock.h +1 -4
@@ -136,10 +136,7 @@ extern const struct clkops clkops_null; #define CONFIG_PARTICIPANT (1 << 10) /* Fundamental clock */ #define ENABLE_ON_INIT (1 << 11) /* Enable upon framework init */ #define INVERT_ENABLE (1 << 12) /* 0 enables, 1 disables */ -/* bits 13-26 are currently free */ -#define CLOCK_IN_OMAP343X (1 << 27) /* clocks common to all 343X */ -#define CLOCK_IN_OMAP3430ES1 (1 << 29) /* 3430ES1 clocks only */ -#define CLOCK_IN_OMAP3430ES2 (1 << 30) /* 3430ES2 clocks only */ +/* bits 13-31 are currently free */ /* Clksel_rate flags */ #define DEFAULT_RATE (1 << 0)
Signature · 1 line
1.6.1.2
PATCH 21/86 omap: remove pre-CLKDEV clk_get/clk_put
From: Russell King <[email protected]>
--- arch/arm/plat-omap/clock.c | 46 -------------------------------------------- 1 files changed, 0 insertions(+), 46 deletions(-)
arch/arm/plat-omap/clock.c +0 -46
@@ -36,45 +36,6 @@ static struct clk_functions *arch_clock;* Standard clock functions defined in include/linux/clk.h *-------------------------------------------------------------------------*/ -#ifndef CONFIG_COMMON_CLKDEV -/* -* Returns a clock. Note that we first try to use device id on the bus -* and clock name. If this fails, we try to use clock name only. -*/ -struct clk *clk_get (struct device *dev,const char *id) -{ -struct clk *p, *clk =ERR_PTR (-ENOENT ); -int idno; - -if (dev ==NULL || dev->bus != &platform_bus_type) - idno =-1 ; -else - idno =to_platform_device (dev)->id; - -mutex_lock (&clocks_mutex); - -list_for_each_entry (p, &clocks, node) { -if (p->id == idno &&strcmp (id, p->name) ==0 ) { - clk = p; - goto found; - } - } - -list_for_each_entry (p, &clocks, node) { -if (strcmp (id, p->name) ==0 ) { - clk = p; -break ; - } - } - -found: -mutex_unlock (&clocks_mutex); - -return clk; -} -EXPORT_SYMBOL (clk_get); -#endif -int clk_enable (struct clk *clk) {unsigned long flags;
@@ -147,13 +108,6 @@ unsigned long clk_get_rate(struct clk *clk) }EXPORT_SYMBOL (clk_get_rate); -#ifndef CONFIG_COMMON_CLKDEV -void clk_put (struct clk *clk) -{ -} -EXPORT_SYMBOL (clk_put); -#endif -/*------------------------------------------------------------------------- * Optional clock functions defined in include/linux/clk.h *-------------------------------------------------------------------------*/
Signature · 1 line
1.6.1.2
PATCH 22/86 omap: provide a dummy clock node
From: Russell King <[email protected]>
By providing a dummy clock node, we can eliminate the SoC conditional clock handing in the OMAP drivers, moving this knowledge out of the driver and into the machine clock support code.
--- arch/arm/mach-omap1/clock.c | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-)
arch/arm/mach-omap1/clock.c +20 -0
@@ -33,6 +33,26 @@ static const struct clkops clkops_dspck;#include "clock.h" +static int clk_omap1_dummy_enable (struct clk *clk) +{ +return 0 ; +} + +static void clk_omap1_dummy_disable (struct clk *clk) +{ +} + +static const struct clkops clkops_dummy = { + .enable = clk_omap1_dummy_enable, + .disable = clk_omap1_dummy_disable, +}; + +static struct clk dummy_ck = { + .name ="dummy" , + .ops = &clkops_dummy, + .flags =RATE_FIXED , +}; +struct omap_clk {u32 cpu;struct clk_lookup lk;
Signature · 1 line
1.6.1.2
PATCH 23/86 omap: watchdog: convert clocks to match by devid and conid
From: Russell King <[email protected]>
This eliminates the need for separate OMAP24xx and OMAP34xx clock requesting code sections.
--- arch/arm/mach-omap1/clock.c | 2 +- arch/arm/mach-omap2/clock24xx.c | 4 +- arch/arm/mach-omap2/clock34xx.c | 4 +- drivers/watchdog/omap_wdt.c | 93 ++++++++++---------------------------- 4 files changed, 30 insertions(+), 73 deletions(-)
arch/arm/mach-omap1/clock.c +1 -1
@@ -85,7 +85,7 @@ static struct omap_clk omap_clks[] = {CLK (NULL ,"arm_gpio_ck" , &arm_gpio_ck,CK_1510 |CK_310 ),CLK (NULL ,"armxor_ck" , &armxor_ck.clk,CK_16XX |CK_1510 |CK_310 ),CLK (NULL ,"armtim_ck" , &armtim_ck.clk,CK_16XX |CK_1510 |CK_310 ), -CLK (NULL ,"armwdt_ck" , &armwdt_ck.clk,CK_16XX |CK_1510 |CK_310 ), +CLK ("omap_wdt" ,"fck" , &armwdt_ck.clk,CK_16XX |CK_1510 |CK_310 ),CLK (NULL ,"arminth_ck" , &arminth_ck1510,CK_1510 |CK_310 ), CLK(NULL, "arminth_ck", &arminth_ck16xx, CK_16XX),/* CK_GEN2 clocks */
arch/arm/mach-omap2/clock24xx.c +2 -2
@@ -163,8 +163,8 @@ static struct omap_clk omap24xx_clks[] = {CLK (NULL ,"uart3_fck" , &uart3_fck,CK_243X |CK_242X ),CLK (NULL ,"gpios_ick" , &gpios_ick,CK_243X |CK_242X ),CLK (NULL ,"gpios_fck" , &gpios_fck,CK_243X |CK_242X ), -CLK (NULL ,"mpu_wdt_ick" , &mpu_wdt_ick,CK_243X |CK_242X ), -CLK (NULL ,"mpu_wdt_fck" , &mpu_wdt_fck,CK_243X |CK_242X ), +CLK ("omap_wdt" ,"ick" , &mpu_wdt_ick,CK_243X |CK_242X ), +CLK ("omap_wdt" ,"fck" , &mpu_wdt_fck,CK_243X |CK_242X ),CLK (NULL ,"sync_32k_ick" , &sync_32k_ick,CK_243X |CK_242X ),CLK (NULL ,"wdt1_ick" , &wdt1_ick,CK_243X |CK_242X ), CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_243X | CK_242X),
arch/arm/mach-omap2/clock34xx.c +2 -2
@@ -214,10 +214,10 @@ static struct omap_clk omap34xx_clks[] = {CLK (NULL ,"gpt1_fck" , &gpt1_fck,CK_343X ),CLK (NULL ,"wkup_32k_fck" , &wkup_32k_fck,CK_343X ),CLK (NULL ,"gpio1_dbck" , &gpio1_dbck,CK_343X ), -CLK (NULL ,"wdt2_fck" , &wdt2_fck,CK_343X ), +CLK ("omap_wdt" ,"fck" , &wdt2_fck,CK_343X ),CLK (NULL ,"wkup_l4_ick" , &wkup_l4_ick,CK_343X ),CLK (NULL ,"usim_ick" , &usim_ick,CK_3430ES2 ), -CLK (NULL ,"wdt2_ick" , &wdt2_ick,CK_343X ), +CLK ("omap_wdt" ,"ick" , &wdt2_ick,CK_343X ),CLK (NULL ,"wdt1_ick" , &wdt1_ick,CK_343X ),CLK (NULL ,"gpio1_ick" , &gpio1_ick,CK_343X ), CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick, CK_343X),
drivers/watchdog/omap_wdt.c +25 -68
136 lines not on this page · raw message
Signature · 1 line
1.6.1.2
PATCH 24/86 omap: watchdog: provide a dummy ick for OMAP1
From: Russell King <[email protected]>
Eliminate the OMAP1 vs OMAP2 clock knowledge in the watchdog driver.
--- arch/arm/mach-omap1/clock.c | 2 ++ drivers/watchdog/omap_wdt.c | 23 ++++++++--------------- 2 files changed, 10 insertions(+), 15 deletions(-)
arch/arm/mach-omap1/clock.c +2 -0
@@ -86,6 +86,8 @@ static struct omap_clk omap_clks[] = {CLK (NULL ,"armxor_ck" , &armxor_ck.clk,CK_16XX |CK_1510 |CK_310 ),CLK (NULL ,"armtim_ck" , &armtim_ck.clk,CK_16XX |CK_1510 |CK_310 ),CLK ("omap_wdt" ,"fck" , &armwdt_ck.clk,CK_16XX |CK_1510 |CK_310 ), +CLK ("omap_wdt" ,"ick" , &armper_ck.clk,CK_16XX ), +CLK ("omap_wdt" ,"ick" , &dummy_ck,CK_1510 |CK_310 ),CLK (NULL ,"arminth_ck" , &arminth_ck1510,CK_1510 |CK_310 ), CLK(NULL, "arminth_ck", &arminth_ck16xx, CK_16XX),/* CK_GEN2 clocks */
drivers/watchdog/omap_wdt.c +8 -15
@@ -145,8 +145,7 @@ static int omap_wdt_open(struct inode *inode, struct file *file)if (test_and_set_bit (1 , (unsigned long *)&(wdev->omap_wdt_users)))return -EBUSY ; -if (wdev->ick) -clk_enable (wdev->ick);/* Enable the interface clock */ +clk_enable (wdev->ick);/* Enable the interface clock */ clk_enable (wdev->fck);/* Enable the functional clock */ /* initialize prescaler */
@@ -176,8 +175,7 @@ static int omap_wdt_release(struct inode *inode, struct file *file)omap_wdt_disable (wdev); -if (wdev->ick) -clk_disable (wdev->ick); +clk_disable (wdev->ick);clk_disable (wdev->fck);#else printk (KERN_CRIT "omap_wdt: Unexpected close, not stopping!\n" );
@@ -294,13 +292,11 @@ static int __init omap_wdt_probe(struct platform_device *pdev) wdev->omap_wdt_users =0 ; wdev->mem = mem; -if (cpu_is_omap24xx () ||cpu_is_omap34xx ()) { - wdev->ick =clk_get (&pdev->dev,"ick" ); -if (IS_ERR (wdev->ick)) { - ret =PTR_ERR (wdev->ick); - wdev->ick =NULL ; - goto err_clk; - } + wdev->ick =clk_get (&pdev->dev,"ick" ); +if (IS_ERR (wdev->ick)) { + ret =PTR_ERR (wdev->ick); + wdev->ick =NULL ; + goto err_clk; } wdev->fck =clk_get (&pdev->dev,"fck" );if (IS_ERR (wdev->fck)) {
@@ -383,10 +379,7 @@ static int omap_wdt_remove(struct platform_device *pdev)release_mem_region (res->start, res->end - res->start +1 );platform_set_drvdata (pdev,NULL ); -if (wdev->ick) { -clk_put (wdev->ick); - } - +clk_put (wdev->ick);clk_put (wdev->fck);iounmap (wdev->base);
Signature · 1 line
1.6.1.2
PATCH 25/86 omap: MMC: convert clocks to match by devid and conid
From: Russell King <[email protected]>
Convert OMAP MMC driver to match clocks using the device ID and a connection ID rather than a clock name. This allows us to eliminate the OMAP1/OMAP2 differences for the function clock.
--- arch/arm/mach-omap1/clock.c | 4 ++-- arch/arm/mach-omap2/clock24xx.c | 4 ++-- drivers/mmc/host/omap.c | 7 ++----- 3 files changed, 6 insertions(+), 9 deletions(-)
arch/arm/mach-omap1/clock.c +2 -2
@@ -124,8 +124,8 @@ static struct omap_clk omap_clks[] = {CLK (NULL ,"mclk" , &mclk_16xx,CK_16XX ),CLK (NULL ,"bclk" , &bclk_1510,CK_1510 |CK_310 ),CLK (NULL ,"bclk" , &bclk_16xx,CK_16XX ), -CLK ("mmci-omap.0" ,"mmc_ck" , &mmc1_ck,CK_16XX |CK_1510 |CK_310 ), -CLK ("mmci-omap.1" ,"mmc_ck" , &mmc2_ck,CK_16XX ), +CLK ("mmci-omap.0" ,"fck" , &mmc1_ck,CK_16XX |CK_1510 |CK_310 ), +CLK ("mmci-omap.1" ,"fck" , &mmc2_ck,CK_16XX ),/* Virtual clocks */ CLK (NULL ,"mpu" , &virtual_ck_mpu,CK_16XX |CK_1510 |CK_310 ), CLK("i2c_omap.1", "i2c_fck", &i2c_fck, CK_16XX | CK_1510 | CK_310),
arch/arm/mach-omap2/clock24xx.c +2 -2
@@ -178,8 +178,8 @@ static struct omap_clk omap24xx_clks[] = {CLK (NULL ,"wdt3_fck" , &wdt3_fck,CK_242X ),CLK (NULL ,"mspro_ick" , &mspro_ick,CK_243X |CK_242X ),CLK (NULL ,"mspro_fck" , &mspro_fck,CK_243X |CK_242X ), -CLK (NULL ,"mmc_ick" , &mmc_ick,CK_242X ), -CLK (NULL ,"mmc_fck" , &mmc_fck,CK_242X ), +CLK ("mmci-omap.0" ,"ick" , &mmc_ick,CK_242X ), +CLK ("mmci-omap.0" ,"fck" , &mmc_fck,CK_242X ),CLK (NULL ,"fac_ick" , &fac_ick,CK_243X |CK_242X ),CLK (NULL ,"fac_fck" , &fac_fck,CK_243X |CK_242X ), CLK(NULL, "eac_ick", &eac_ick, CK_242X),
drivers/mmc/host/omap.c +2 -5
@@ -1461,16 +1461,13 @@ static int __init mmc_omap_probe(struct platform_device *pdev) goto err_ioremap;if (cpu_is_omap24xx ()) { - host->iclk =clk_get (&pdev->dev,"mmc_ick" ); + host->iclk =clk_get (&pdev->dev,"ick" );if (IS_ERR (host->iclk)) goto err_free_mmc_host;clk_enable (host->iclk); } -if (!cpu_is_omap24xx ()) - host->fclk =clk_get (&pdev->dev,"mmc_ck" ); -else - host->fclk =clk_get (&pdev->dev,"mmc_fck" ); + host->fclk =clk_get (&pdev->dev,"fck" );if (IS_ERR (host->fclk)) { ret =PTR_ERR (host->fclk);
Signature · 1 line
1.6.1.2
PATCH 26/86 omap: MMC: provide a dummy ick for OMAP1
From: Russell King <[email protected]>
Eliminate the OMAP1 vs OMAP2 clock knowledge in the MMC driver.
--- arch/arm/mach-omap1/clock.c | 2 ++ drivers/mmc/host/omap.c | 19 ++++++++----------- 2 files changed, 10 insertions(+), 11 deletions(-)
arch/arm/mach-omap1/clock.c +2 -0
@@ -125,7 +125,9 @@ static struct omap_clk omap_clks[] = {CLK (NULL ,"bclk" , &bclk_1510,CK_1510 |CK_310 ),CLK (NULL ,"bclk" , &bclk_16xx,CK_16XX ),CLK ("mmci-omap.0" ,"fck" , &mmc1_ck,CK_16XX |CK_1510 |CK_310 ), +CLK ("mmci-omap.0" ,"ick" , &armper_ck.clk,CK_16XX |CK_1510 |CK_310 ),CLK ("mmci-omap.1" ,"fck" , &mmc2_ck,CK_16XX ), +CLK ("mmci-omap.1" ,"ick" , &armper_ck.clk,CK_16XX ),/* Virtual clocks */ CLK (NULL ,"mpu" , &virtual_ck_mpu,CK_16XX |CK_1510 |CK_310 ), CLK("i2c_omap.1", "i2c_fck", &i2c_fck, CK_16XX | CK_1510 | CK_310),
drivers/mmc/host/omap.c +8 -11
@@ -1460,15 +1460,12 @@ static int __init mmc_omap_probe(struct platform_device *pdev)if (!host->virt_base) goto err_ioremap; -if (cpu_is_omap24xx ()) { - host->iclk =clk_get (&pdev->dev,"ick" ); -if (IS_ERR (host->iclk)) - goto err_free_mmc_host; -clk_enable (host->iclk); - } + host->iclk =clk_get (&pdev->dev,"ick" ); +if (IS_ERR (host->iclk)) + goto err_free_mmc_host; +clk_enable (host->iclk); host->fclk =clk_get (&pdev->dev,"fck" ); -if (IS_ERR (host->fclk)) { ret =PTR_ERR (host->fclk); goto err_free_iclk;
@@ -1533,10 +1530,10 @@ static int mmc_omap_remove(struct platform_device *pdev)if (host->pdata->cleanup) host->pdata->cleanup (&pdev->dev); -if (host->iclk && !IS_ERR (host->iclk)) -clk_put (host->iclk); -if (host->fclk && !IS_ERR (host->fclk)) -clk_put (host->fclk); +mmc_omap_fclk_enable (host,0 ); +clk_put (host->fclk); +clk_disable (host->iclk); +clk_put (host->iclk);iounmap (host->virt_base); release_mem_region(pdev->resource[0].start,
Signature · 1 line
1.6.1.2
PATCH 27/86 omap: mcspi: new short connection id names
From: Russell King <[email protected]>
... rather than the clock names themselves.
--- arch/arm/mach-omap2/clock24xx.c | 12 ++++++------ arch/arm/mach-omap2/clock34xx.c | 16 ++++++++-------- drivers/spi/omap2_mcspi.c | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-)
arch/arm/mach-omap2/clock24xx.c +6 -6
@@ -149,12 +149,12 @@ static struct omap_clk omap24xx_clks[] = {CLK ("omap-mcbsp.4" ,"mcbsp_fck" , &mcbsp4_fck,CK_243X ),CLK ("omap-mcbsp.5" ,"mcbsp_ick" , &mcbsp5_ick,CK_243X ),CLK ("omap-mcbsp.5" ,"mcbsp_fck" , &mcbsp5_fck,CK_243X ), -CLK ("omap2_mcspi.1" ,"mcspi_ick" , &mcspi1_ick,CK_243X |CK_242X ), -CLK ("omap2_mcspi.1" ,"mcspi_fck" , &mcspi1_fck,CK_243X |CK_242X ), -CLK ("omap2_mcspi.2" ,"mcspi_ick" , &mcspi2_ick,CK_243X |CK_242X ), -CLK ("omap2_mcspi.2" ,"mcspi_fck" , &mcspi2_fck,CK_243X |CK_242X ), -CLK ("omap2_mcspi.3" ,"mcspi_ick" , &mcspi3_ick,CK_243X ), -CLK ("omap2_mcspi.3" ,"mcspi_fck" , &mcspi3_fck,CK_243X ), +CLK ("omap2_mcspi.1" ,"ick" , &mcspi1_ick,CK_243X |CK_242X ), +CLK ("omap2_mcspi.1" ,"fck" , &mcspi1_fck,CK_243X |CK_242X ), +CLK ("omap2_mcspi.2" ,"ick" , &mcspi2_ick,CK_243X |CK_242X ), +CLK ("omap2_mcspi.2" ,"fck" , &mcspi2_fck,CK_243X |CK_242X ), +CLK ("omap2_mcspi.3" ,"ick" , &mcspi3_ick,CK_243X ), +CLK ("omap2_mcspi.3" ,"fck" , &mcspi3_fck,CK_243X ),CLK (NULL ,"uart1_ick" , &uart1_ick,CK_243X |CK_242X ),CLK (NULL ,"uart1_fck" , &uart1_fck,CK_243X |CK_242X ), CLK(NULL, "uart2_ick", &uart2_ick, CK_243X | CK_242X),
arch/arm/mach-omap2/clock34xx.c +8 -8
@@ -147,10 +147,10 @@ static struct omap_clk omap34xx_clks[] = {CLK ("omap-mcbsp.5" ,"mcbsp_fck" , &mcbsp5_fck,CK_343X ),CLK ("omap-mcbsp.1" ,"mcbsp_fck" , &mcbsp1_fck,CK_343X ),CLK (NULL ,"core_48m_fck" , &core_48m_fck,CK_343X ), -CLK ("omap2_mcspi.4" ,"mcspi_fck" , &mcspi4_fck,CK_343X ), -CLK ("omap2_mcspi.3" ,"mcspi_fck" , &mcspi3_fck,CK_343X ), -CLK ("omap2_mcspi.2" ,"mcspi_fck" , &mcspi2_fck,CK_343X ), -CLK ("omap2_mcspi.1" ,"mcspi_fck" , &mcspi1_fck,CK_343X ), +CLK ("omap2_mcspi.4" ,"fck" , &mcspi4_fck,CK_343X ), +CLK ("omap2_mcspi.3" ,"fck" , &mcspi3_fck,CK_343X ), +CLK ("omap2_mcspi.2" ,"fck" , &mcspi2_fck,CK_343X ), +CLK ("omap2_mcspi.1" ,"fck" , &mcspi1_fck,CK_343X ),CLK (NULL ,"uart2_fck" , &uart2_fck,CK_343X ),CLK (NULL ,"uart1_fck" , &uart1_fck,CK_343X ), CLK(NULL, "fshostusb_fck", &fshostusb_fck, CK_3430ES1),
@@ -175,10 +175,10 @@ static struct omap_clk omap34xx_clks[] = {CLK ("mmci-omap-hs.0" ,"mmchs_ick" , &mmchs1_ick,CK_343X ),CLK (NULL ,"mspro_ick" , &mspro_ick,CK_343X ),CLK (NULL ,"hdq_ick" , &hdq_ick,CK_343X ), -CLK ("omap2_mcspi.4" ,"mcspi_ick" , &mcspi4_ick,CK_343X ), -CLK ("omap2_mcspi.3" ,"mcspi_ick" , &mcspi3_ick,CK_343X ), -CLK ("omap2_mcspi.2" ,"mcspi_ick" , &mcspi2_ick,CK_343X ), -CLK ("omap2_mcspi.1" ,"mcspi_ick" , &mcspi1_ick,CK_343X ), +CLK ("omap2_mcspi.4" ,"ick" , &mcspi4_ick,CK_343X ), +CLK ("omap2_mcspi.3" ,"ick" , &mcspi3_ick,CK_343X ), +CLK ("omap2_mcspi.2" ,"ick" , &mcspi2_ick,CK_343X ), +CLK ("omap2_mcspi.1" ,"ick" , &mcspi1_ick,CK_343X ),CLK ("i2c_omap.3" ,"i2c_ick" , &i2c3_ick,CK_343X ),CLK ("i2c_omap.2" ,"i2c_ick" , &i2c2_ick,CK_343X ), CLK("i2c_omap.1", "i2c_ick", &i2c1_ick, CK_343X),
drivers/spi/omap2_mcspi.c +2 -2
@@ -1021,13 +1021,13 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)spin_lock_init (&mcspi->lock);INIT_LIST_HEAD (&mcspi->msg_queue); - mcspi->ick =clk_get (&pdev->dev,"mcspi_ick" ); + mcspi->ick =clk_get (&pdev->dev,"ick" );if (IS_ERR (mcspi->ick)) {dev_dbg (&pdev->dev,"can't get mcspi_ick\n" ); status =PTR_ERR (mcspi->ick); goto err1a; } - mcspi->fck =clk_get (&pdev->dev,"mcspi_fck" ); + mcspi->fck =clk_get (&pdev->dev,"fck" );if (IS_ERR (mcspi->fck)) {dev_dbg (&pdev->dev,"can't get mcspi_fck\n" ); status =PTR_ERR (mcspi->fck);
Signature · 1 line
1.6.1.2
PATCH 28/86 omap: mcbsp: convert to use fck/ick clocks directly
From: Russell King <[email protected]>
Rather than introducing a special 'mcbsp_clk' with code behind it in mach-omap*/mcbsp.c to handle the SoC specifics, arrange for the mcbsp driver to be like any other driver. mcbsp requests its fck and ick clocks directly, and the SoC specific code deals with selecting the correct clock.
There is one oddity to deal with - OMAP1 fiddles with the DSP clocks and DSP reset, so we move this to the two callback functions.
--- arch/arm/mach-omap1/clock.c | 9 +++ arch/arm/mach-omap1/mcbsp.c | 52 +++++++++++------- arch/arm/mach-omap2/clock24xx.c | 20 ++++---- arch/arm/mach-omap2/clock34xx.c | 20 ++++---- arch/arm/mach-omap2/mcbsp.c | 26 --------- arch/arm/plat-omap/include/mach/mcbsp.h | 6 +-- arch/arm/plat-omap/mcbsp.c | 90 +++++++++++++------------------ 7 files changed, 100 insertions(+), 123 deletions(-)
arch/arm/mach-omap1/clock.c +9 -0
@@ -132,6 +132,15 @@ static struct omap_clk omap_clks[] = {CLK (NULL ,"mpu" , &virtual_ck_mpu,CK_16XX |CK_1510 |CK_310 ),CLK ("i2c_omap.1" ,"i2c_fck" , &i2c_fck,CK_16XX |CK_1510 |CK_310 ),CLK ("i2c_omap.1" ,"i2c_ick" , &i2c_ick,CK_16XX ), +CLK ("omap-mcbsp.1" ,"ick" , &dspper_ck,CK_16XX ), +CLK ("omap-mcbsp.1" ,"ick" , &dummy_ck,CK_1510 |CK_310 ), +CLK ("omap-mcbsp.2" ,"ick" , &armper_ck.clk,CK_16XX ), +CLK ("omap-mcbsp.2" ,"ick" , &dummy_ck,CK_1510 |CK_310 ), +CLK ("omap-mcbsp.3" ,"ick" , &dspper_ck,CK_16XX ), +CLK ("omap-mcbsp.3" ,"ick" , &dummy_ck,CK_1510 |CK_310 ), +CLK ("omap-mcbsp.1" ,"fck" , &dspxor_ck,CK_16XX |CK_1510 |CK_310 ), +CLK ("omap-mcbsp.2" ,"fck" , &armper_ck.clk,CK_16XX |CK_1510 |CK_310 ), + CLK("omap-mcbsp.3", "fck", &dspxor_ck, CK_16XX | CK_1510 | CK_310), };static int omap1_clk_enable_generic (struct clk * clk);
arch/arm/mach-omap1/mcbsp.c +32 -20
93 lines not on this page · raw message
arch/arm/mach-omap2/clock24xx.c +10 -10
@@ -139,16 +139,16 @@ static struct omap_clk omap24xx_clks[] = {CLK (NULL ,"gpt11_fck" , &gpt11_fck,CK_243X |CK_242X ),CLK (NULL ,"gpt12_ick" , &gpt12_ick,CK_243X |CK_242X ),CLK (NULL ,"gpt12_fck" , &gpt12_fck,CK_243X |CK_242X ), -CLK ("omap-mcbsp.1" ,"mcbsp_ick" , &mcbsp1_ick,CK_243X |CK_242X ), -CLK ("omap-mcbsp.1" ,"mcbsp_fck" , &mcbsp1_fck,CK_243X |CK_242X ), -CLK ("omap-mcbsp.2" ,"mcbsp_ick" , &mcbsp2_ick,CK_243X |CK_242X ), -CLK ("omap-mcbsp.2" ,"mcbsp_fck" , &mcbsp2_fck,CK_243X |CK_242X ), -CLK ("omap-mcbsp.3" ,"mcbsp_ick" , &mcbsp3_ick,CK_243X ), -CLK ("omap-mcbsp.3" ,"mcbsp_fck" , &mcbsp3_fck,CK_243X ), -CLK ("omap-mcbsp.4" ,"mcbsp_ick" , &mcbsp4_ick,CK_243X ), -CLK ("omap-mcbsp.4" ,"mcbsp_fck" , &mcbsp4_fck,CK_243X ), -CLK ("omap-mcbsp.5" ,"mcbsp_ick" , &mcbsp5_ick,CK_243X ), -CLK ("omap-mcbsp.5" ,"mcbsp_fck" , &mcbsp5_fck,CK_243X ), +CLK ("omap-mcbsp.1" ,"ick" , &mcbsp1_ick,CK_243X |CK_242X ), +CLK ("omap-mcbsp.1" ,"fck" , &mcbsp1_fck,CK_243X |CK_242X ), +CLK ("omap-mcbsp.2" ,"ick" , &mcbsp2_ick,CK_243X |CK_242X ), +CLK ("omap-mcbsp.2" ,"fck" , &mcbsp2_fck,CK_243X |CK_242X ), +CLK ("omap-mcbsp.3" ,"ick" , &mcbsp3_ick,CK_243X ), +CLK ("omap-mcbsp.3" ,"fck" , &mcbsp3_fck,CK_243X ), +CLK ("omap-mcbsp.4" ,"ick" , &mcbsp4_ick,CK_243X ), +CLK ("omap-mcbsp.4" ,"fck" , &mcbsp4_fck,CK_243X ), +CLK ("omap-mcbsp.5" ,"ick" , &mcbsp5_ick,CK_243X ), +CLK ("omap-mcbsp.5" ,"fck" , &mcbsp5_fck,CK_243X ),CLK ("omap2_mcspi.1" ,"ick" , &mcspi1_ick,CK_243X |CK_242X ),CLK ("omap2_mcspi.1" ,"fck" , &mcspi1_fck,CK_243X |CK_242X ), CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_243X | CK_242X),
arch/arm/mach-omap2/clock34xx.c +10 -10
@@ -144,8 +144,8 @@ static struct omap_clk omap34xx_clks[] = {CLK ("i2c_omap.3" ,"i2c_fck" , &i2c3_fck,CK_343X ),CLK ("i2c_omap.2" ,"i2c_fck" , &i2c2_fck,CK_343X ),CLK ("i2c_omap.1" ,"i2c_fck" , &i2c1_fck,CK_343X ), -CLK ("omap-mcbsp.5" ,"mcbsp_fck" , &mcbsp5_fck,CK_343X ), -CLK ("omap-mcbsp.1" ,"mcbsp_fck" , &mcbsp1_fck,CK_343X ), +CLK ("omap-mcbsp.5" ,"fck" , &mcbsp5_fck,CK_343X ), +CLK ("omap-mcbsp.1" ,"fck" , &mcbsp1_fck,CK_343X ),CLK (NULL ,"core_48m_fck" , &core_48m_fck,CK_343X ),CLK ("omap2_mcspi.4" ,"fck" , &mcspi4_fck,CK_343X ), CLK("omap2_mcspi.3", "fck", &mcspi3_fck, CK_343X),
@@ -186,8 +186,8 @@ static struct omap_clk omap34xx_clks[] = {CLK (NULL ,"uart1_ick" , &uart1_ick,CK_343X ),CLK (NULL ,"gpt11_ick" , &gpt11_ick,CK_343X ),CLK (NULL ,"gpt10_ick" , &gpt10_ick,CK_343X ), -CLK ("omap-mcbsp.5" ,"mcbsp_ick" , &mcbsp5_ick,CK_343X ), -CLK ("omap-mcbsp.1" ,"mcbsp_ick" , &mcbsp1_ick,CK_343X ), +CLK ("omap-mcbsp.5" ,"ick" , &mcbsp5_ick,CK_343X ), +CLK ("omap-mcbsp.1" ,"ick" , &mcbsp1_ick,CK_343X ),CLK (NULL ,"fac_ick" , &fac_ick,CK_3430ES1 ),CLK (NULL ,"mailboxes_ick" , &mailboxes_ick,CK_343X ), CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_343X),
@@ -257,12 +257,12 @@ static struct omap_clk omap34xx_clks[] = {CLK (NULL ,"gpt4_ick" , &gpt4_ick,CK_343X ),CLK (NULL ,"gpt3_ick" , &gpt3_ick,CK_343X ),CLK (NULL ,"gpt2_ick" , &gpt2_ick,CK_343X ), -CLK ("omap-mcbsp.2" ,"mcbsp_ick" , &mcbsp2_ick,CK_343X ), -CLK ("omap-mcbsp.3" ,"mcbsp_ick" , &mcbsp3_ick,CK_343X ), -CLK ("omap-mcbsp.4" ,"mcbsp_ick" , &mcbsp4_ick,CK_343X ), -CLK ("omap-mcbsp.2" ,"mcbsp_fck" , &mcbsp2_fck,CK_343X ), -CLK ("omap-mcbsp.3" ,"mcbsp_fck" , &mcbsp3_fck,CK_343X ), -CLK ("omap-mcbsp.4" ,"mcbsp_fck" , &mcbsp4_fck,CK_343X ), +CLK ("omap-mcbsp.2" ,"ick" , &mcbsp2_ick,CK_343X ), +CLK ("omap-mcbsp.3" ,"ick" , &mcbsp3_ick,CK_343X ), +CLK ("omap-mcbsp.4" ,"ick" , &mcbsp4_ick,CK_343X ), +CLK ("omap-mcbsp.2" ,"fck" , &mcbsp2_fck,CK_343X ), +CLK ("omap-mcbsp.3" ,"fck" , &mcbsp3_fck,CK_343X ), +CLK ("omap-mcbsp.4" ,"fck" , &mcbsp4_fck,CK_343X ),CLK (NULL ,"emu_src_ck" , &emu_src_ck,CK_343X ),CLK (NULL ,"pclk_fck" , &pclk_fck,CK_343X ), CLK(NULL, "pclkx2_fck", &pclkx2_fck, CK_343X),
arch/arm/mach-omap2/mcbsp.c +0 -26
@@ -24,8 +24,6 @@#include <mach/cpu.h> #include <mach/mcbsp.h> -const char *clk_names[] = {"mcbsp_ick" ,"mcbsp_fck" }; -static void omap2_mcbsp2_mux_setup (void ) {omap_cfg_reg (Y15_24XX_MCBSP2_CLKX );
@@ -57,8 +55,6 @@ static struct omap_mcbsp_platform_data omap2420_mcbsp_pdata[] = { .rx_irq = INT_24XX_MCBSP1_IRQ_RX, .tx_irq = INT_24XX_MCBSP1_IRQ_TX, .ops = &omap2_mcbsp_ops, - .clk_names = clk_names, - .num_clks = 2, }, { .phys_base = OMAP24XX_MCBSP2_BASE,
@@ -67,8 +63,6 @@ static struct omap_mcbsp_platform_data omap2420_mcbsp_pdata[] = { .rx_irq = INT_24XX_MCBSP2_IRQ_RX, .tx_irq = INT_24XX_MCBSP2_IRQ_TX, .ops = &omap2_mcbsp_ops, - .clk_names = clk_names, - .num_clks = 2, }, };#define OMAP2420_MCBSP_PDATA_SZ ARRAY_SIZE(omap2420_mcbsp_pdata)
@@ -86,8 +80,6 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = { .rx_irq = INT_24XX_MCBSP1_IRQ_RX, .tx_irq = INT_24XX_MCBSP1_IRQ_TX, .ops = &omap2_mcbsp_ops, - .clk_names = clk_names, - .num_clks = 2, }, { .phys_base = OMAP24XX_MCBSP2_BASE,
@@ -96,8 +88,6 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = { .rx_irq = INT_24XX_MCBSP2_IRQ_RX, .tx_irq = INT_24XX_MCBSP2_IRQ_TX, .ops = &omap2_mcbsp_ops, - .clk_names = clk_names, - .num_clks = 2, }, { .phys_base = OMAP2430_MCBSP3_BASE,
@@ -106,8 +96,6 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = { .rx_irq = INT_24XX_MCBSP3_IRQ_RX, .tx_irq = INT_24XX_MCBSP3_IRQ_TX, .ops = &omap2_mcbsp_ops, - .clk_names = clk_names, - .num_clks = 2, }, { .phys_base = OMAP2430_MCBSP4_BASE,
@@ -116,8 +104,6 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = { .rx_irq = INT_24XX_MCBSP4_IRQ_RX, .tx_irq = INT_24XX_MCBSP4_IRQ_TX, .ops = &omap2_mcbsp_ops, - .clk_names = clk_names, - .num_clks = 2, }, { .phys_base = OMAP2430_MCBSP5_BASE,
@@ -126,8 +112,6 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = { .rx_irq = INT_24XX_MCBSP5_IRQ_RX, .tx_irq = INT_24XX_MCBSP5_IRQ_TX, .ops = &omap2_mcbsp_ops, - .clk_names = clk_names, - .num_clks = 2, }, };#define OMAP2430_MCBSP_PDATA_SZ ARRAY_SIZE(omap2430_mcbsp_pdata)
@@ -145,8 +129,6 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { .rx_irq = INT_24XX_MCBSP1_IRQ_RX, .tx_irq = INT_24XX_MCBSP1_IRQ_TX, .ops = &omap2_mcbsp_ops, - .clk_names = clk_names, - .num_clks = 2, }, { .phys_base = OMAP34XX_MCBSP2_BASE,
@@ -155,8 +137,6 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { .rx_irq = INT_24XX_MCBSP2_IRQ_RX, .tx_irq = INT_24XX_MCBSP2_IRQ_TX, .ops = &omap2_mcbsp_ops, - .clk_names = clk_names, - .num_clks = 2, }, { .phys_base = OMAP34XX_MCBSP3_BASE,
@@ -165,8 +145,6 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { .rx_irq = INT_24XX_MCBSP3_IRQ_RX, .tx_irq = INT_24XX_MCBSP3_IRQ_TX, .ops = &omap2_mcbsp_ops, - .clk_names = clk_names, - .num_clks = 2, }, { .phys_base = OMAP34XX_MCBSP4_BASE,
@@ -175,8 +153,6 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { .rx_irq = INT_24XX_MCBSP4_IRQ_RX, .tx_irq = INT_24XX_MCBSP4_IRQ_TX, .ops = &omap2_mcbsp_ops, - .clk_names = clk_names, - .num_clks = 2, }, { .phys_base = OMAP34XX_MCBSP5_BASE,
@@ -185,8 +161,6 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { .rx_irq = INT_24XX_MCBSP5_IRQ_RX, .tx_irq = INT_24XX_MCBSP5_IRQ_TX, .ops = &omap2_mcbsp_ops, - .clk_names = clk_names, - .num_clks = 2, }, };#define OMAP34XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap34xx_mcbsp_pdata)
arch/arm/plat-omap/include/mach/mcbsp.h +2 -4
@@ -344,8 +344,6 @@ struct omap_mcbsp_platform_data {u8 dma_rx_sync, dma_tx_sync;u16 rx_irq, tx_irq;struct omap_mcbsp_ops *ops; -char const **clk_names; -int num_clks; };struct omap_mcbsp {
@@ -377,8 +375,8 @@ struct omap_mcbsp {/* Protect the field .free, while checking if the mcbsp is in use */ spinlock_t lock;struct omap_mcbsp_platform_data *pdata; -struct clk **clks; -int num_clks; +struct clk *iclk; +struct clk *fclk; };extern struct omap_mcbsp **mcbsp_ptr;extern int omap_mcbsp_count;
arch/arm/plat-omap/mcbsp.c +37 -53
176 lines not on this page · raw message
Signature · 1 line
1.6.1.2
PATCH 29/86 omap: i2c: use short connection ids
From: Russell King <[email protected]>
--- arch/arm/mach-omap1/clock.c | 4 ++-- arch/arm/mach-omap2/clock24xx.c | 12 ++++++------ arch/arm/mach-omap2/clock34xx.c | 12 ++++++------ drivers/i2c/busses/i2c-omap.c | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-)
arch/arm/mach-omap1/clock.c +2 -2
@@ -130,8 +130,8 @@ static struct omap_clk omap_clks[] = {CLK ("mmci-omap.1" ,"ick" , &armper_ck.clk,CK_16XX ),/* Virtual clocks */ CLK (NULL ,"mpu" , &virtual_ck_mpu,CK_16XX |CK_1510 |CK_310 ), -CLK ("i2c_omap.1" ,"i2c_fck" , &i2c_fck,CK_16XX |CK_1510 |CK_310 ), -CLK ("i2c_omap.1" ,"i2c_ick" , &i2c_ick,CK_16XX ), +CLK ("i2c_omap.1" ,"fck" , &i2c_fck,CK_16XX |CK_1510 |CK_310 ), +CLK ("i2c_omap.1" ,"ick" , &i2c_ick,CK_16XX ),CLK ("omap-mcbsp.1" ,"ick" , &dspper_ck,CK_16XX ),CLK ("omap-mcbsp.1" ,"ick" , &dummy_ck,CK_1510 |CK_310 ), CLK("omap-mcbsp.2", "ick", &armper_ck.clk, CK_16XX),
arch/arm/mach-omap2/clock24xx.c +6 -6
@@ -186,12 +186,12 @@ static struct omap_clk omap24xx_clks[] = {CLK (NULL ,"eac_fck" , &eac_fck,CK_242X ),CLK (NULL ,"hdq_ick" , &hdq_ick,CK_243X |CK_242X ),CLK (NULL ,"hdq_fck" , &hdq_fck,CK_243X |CK_242X ), -CLK ("i2c_omap.1" ,"i2c_ick" , &i2c1_ick,CK_243X |CK_242X ), -CLK ("i2c_omap.1" ,"i2c_fck" , &i2c1_fck,CK_242X ), -CLK ("i2c_omap.1" ,"i2c_fck" , &i2chs1_fck,CK_243X ), -CLK ("i2c_omap.2" ,"i2c_ick" , &i2c2_ick,CK_243X |CK_242X ), -CLK ("i2c_omap.2" ,"i2c_fck" , &i2c2_fck,CK_242X ), -CLK ("i2c_omap.2" ,"i2c_fck" , &i2chs2_fck,CK_243X ), +CLK ("i2c_omap.1" ,"ick" , &i2c1_ick,CK_243X |CK_242X ), +CLK ("i2c_omap.1" ,"fck" , &i2c1_fck,CK_242X ), +CLK ("i2c_omap.1" ,"fck" , &i2chs1_fck,CK_243X ), +CLK ("i2c_omap.2" ,"ick" , &i2c2_ick,CK_243X |CK_242X ), +CLK ("i2c_omap.2" ,"fck" , &i2c2_fck,CK_242X ), +CLK ("i2c_omap.2" ,"fck" , &i2chs2_fck,CK_243X ),CLK (NULL ,"gpmc_fck" , &gpmc_fck,CK_243X |CK_242X ),CLK (NULL ,"sdma_fck" , &sdma_fck,CK_243X |CK_242X ), CLK(NULL, "sdma_ick", &sdma_ick, CK_243X | CK_242X),
arch/arm/mach-omap2/clock34xx.c +6 -6
@@ -141,9 +141,9 @@ static struct omap_clk omap34xx_clks[] = {CLK ("mmci-omap-hs.1" ,"mmchs_fck" , &mmchs2_fck,CK_343X ),CLK (NULL ,"mspro_fck" , &mspro_fck,CK_343X ),CLK ("mmci-omap-hs.0" ,"mmchs_fck" , &mmchs1_fck,CK_343X ), -CLK ("i2c_omap.3" ,"i2c_fck" , &i2c3_fck,CK_343X ), -CLK ("i2c_omap.2" ,"i2c_fck" , &i2c2_fck,CK_343X ), -CLK ("i2c_omap.1" ,"i2c_fck" , &i2c1_fck,CK_343X ), +CLK ("i2c_omap.3" ,"fck" , &i2c3_fck,CK_343X ), +CLK ("i2c_omap.2" ,"fck" , &i2c2_fck,CK_343X ), +CLK ("i2c_omap.1" ,"fck" , &i2c1_fck,CK_343X ),CLK ("omap-mcbsp.5" ,"fck" , &mcbsp5_fck,CK_343X ),CLK ("omap-mcbsp.1" ,"fck" , &mcbsp1_fck,CK_343X ), CLK(NULL, "core_48m_fck", &core_48m_fck, CK_343X),
@@ -179,9 +179,9 @@ static struct omap_clk omap34xx_clks[] = {CLK ("omap2_mcspi.3" ,"ick" , &mcspi3_ick,CK_343X ),CLK ("omap2_mcspi.2" ,"ick" , &mcspi2_ick,CK_343X ),CLK ("omap2_mcspi.1" ,"ick" , &mcspi1_ick,CK_343X ), -CLK ("i2c_omap.3" ,"i2c_ick" , &i2c3_ick,CK_343X ), -CLK ("i2c_omap.2" ,"i2c_ick" , &i2c2_ick,CK_343X ), -CLK ("i2c_omap.1" ,"i2c_ick" , &i2c1_ick,CK_343X ), +CLK ("i2c_omap.3" ,"ick" , &i2c3_ick,CK_343X ), +CLK ("i2c_omap.2" ,"ick" , &i2c2_ick,CK_343X ), +CLK ("i2c_omap.1" ,"ick" , &i2c1_ick,CK_343X ),CLK (NULL ,"uart2_ick" , &uart2_ick,CK_343X ),CLK (NULL ,"uart1_ick" , &uart1_ick,CK_343X ), CLK(NULL, "gpt11_ick", &gpt11_ick, CK_343X),
drivers/i2c/busses/i2c-omap.c +2 -2
@@ -194,14 +194,14 @@ static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg)static int __init omap_i2c_get_clocks (struct omap_i2c_dev *dev) {if (cpu_is_omap16xx () ||cpu_class_is_omap2 ()) { - dev->iclk =clk_get (dev->dev,"i2c_ick" ); + dev->iclk =clk_get (dev->dev,"ick" );if (IS_ERR (dev->iclk)) { dev->iclk =NULL ;return -ENODEV ; } } - dev->fclk =clk_get (dev->dev,"i2c_fck" ); + dev->fclk =clk_get (dev->dev,"fck" );if (IS_ERR (dev->fclk)) {if (dev->iclk !=NULL ) {clk_put (dev->iclk);
Signature · 1 line
1.6.1.2
PATCH 30/86 omap: i2c: remove armxor_ck
From: Russell King <[email protected]>
On OMAP1, the I2C functional clock (fck) is the armxor_ck, so there's no need to get "armxor_ck" separately.
--- drivers/i2c/busses/i2c-omap.c | 17 ++++++++--------- 1 files changed, 8 insertions(+), 9 deletions(-)
drivers/i2c/busses/i2c-omap.c +8 -9
@@ -312,15 +312,14 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)omap_i2c_write_reg (dev,OMAP_I2C_CON_REG ,0 );if (cpu_class_is_omap1 ()) { -struct clk *armxor_ck; - - armxor_ck =clk_get (NULL ,"armxor_ck" ); -if (IS_ERR (armxor_ck)) -dev_warn (dev->dev,"Could not get armxor_ck\n" ); -else { - fclk_rate =clk_get_rate (armxor_ck); -clk_put (armxor_ck); - } +/* +* The I2C functional clock is the armxor_ck, so there's +* no need to get "armxor_ck" separately. Now, if OMAP2420 +* always returns 12MHz for the functional clock, we can +* do this bit unconditionally. +*/ + fclk_rate =clk_get_rate (dev->fclk); +/* TRM for 5912 says the I2C clock must be prescaled to be * between 7 - 12 MHz. The XOR input clock is typically * 12, 13 or 19.2 MHz. So we should have code that produces:
Signature · 1 line
1.6.1.2
PATCH 31/86 omap: i2c: remove conditional ick clocks
From: Russell King <[email protected]>
By providing a dummy ick for OMAP1510 and OMAP310, we avoid having SoC conditional clock information in i2c-omap.c. Also, fix the error handling by making sure we propagate the error returned via clk_get().
--- arch/arm/mach-omap1/clock.c | 1 + drivers/i2c/busses/i2c-omap.c | 28 +++++++++++++--------------- 2 files changed, 14 insertions(+), 15 deletions(-)
arch/arm/mach-omap1/clock.c +1 -0
@@ -132,6 +132,7 @@ static struct omap_clk omap_clks[] = {CLK (NULL ,"mpu" , &virtual_ck_mpu,CK_16XX |CK_1510 |CK_310 ),CLK ("i2c_omap.1" ,"fck" , &i2c_fck,CK_16XX |CK_1510 |CK_310 ),CLK ("i2c_omap.1" ,"ick" , &i2c_ick,CK_16XX ), +CLK ("i2c_omap.1" ,"ick" , &dummy_ck,CK_1510 |CK_310 ),CLK ("omap-mcbsp.1" ,"ick" , &dspper_ck,CK_16XX ),CLK ("omap-mcbsp.1" ,"ick" , &dummy_ck,CK_1510 |CK_310 ), CLK("omap-mcbsp.2", "ick", &armper_ck.clk, CK_16XX),
drivers/i2c/busses/i2c-omap.c +13 -15
@@ -193,22 +193,24 @@ static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg)static int __init omap_i2c_get_clocks (struct omap_i2c_dev *dev) { -if (cpu_is_omap16xx () ||cpu_class_is_omap2 ()) { - dev->iclk =clk_get (dev->dev,"ick" ); -if (IS_ERR (dev->iclk)) { - dev->iclk =NULL ; -return -ENODEV ; - } +int ret; + + dev->iclk =clk_get (dev->dev,"ick" ); +if (IS_ERR (dev->iclk)) { + ret =PTR_ERR (dev->iclk); + dev->iclk =NULL ; +return ret; } dev->fclk =clk_get (dev->dev,"fck" );if (IS_ERR (dev->fclk)) { + ret =PTR_ERR (dev->fclk);if (dev->iclk !=NULL ) {clk_put (dev->iclk); dev->iclk =NULL ; } dev->fclk =NULL ; -return -ENODEV ; +return ret; }return 0 ;
@@ -218,18 +220,15 @@ static void omap_i2c_put_clocks(struct omap_i2c_dev *dev) {clk_put (dev->fclk); dev->fclk =NULL ; -if (dev->iclk !=NULL ) { -clk_put (dev->iclk); - dev->iclk =NULL ; - } +clk_put (dev->iclk); + dev->iclk =NULL ; }static void omap_i2c_unidle (struct omap_i2c_dev *dev) {WARN_ON (!dev->idle); -if (dev->iclk !=NULL ) -clk_enable (dev->iclk); +clk_enable (dev->iclk);clk_enable (dev->fclk); dev->idle =0 ;if (dev->iestate)
@@ -254,8 +253,7 @@ static void omap_i2c_idle(struct omap_i2c_dev *dev) } dev->idle =1 ;clk_disable (dev->fclk); -if (dev->iclk !=NULL ) -clk_disable (dev->iclk); +clk_disable (dev->iclk); }static int omap_i2c_init (struct omap_i2c_dev *dev)
Signature · 1 line
1.6.1.2
PATCH 32/86 omap: w1: convert omap HDQ clocks to match by devid and conid
From: Russell King <[email protected]>
--- arch/arm/mach-omap2/clock24xx.c | 4 ++-- arch/arm/mach-omap2/clock34xx.c | 4 ++-- drivers/w1/masters/omap_hdq.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/clock24xx.c +2 -2
@@ -184,8 +184,8 @@ static struct omap_clk omap24xx_clks[] = {CLK (NULL ,"fac_fck" , &fac_fck,CK_243X |CK_242X ),CLK (NULL ,"eac_ick" , &eac_ick,CK_242X ),CLK (NULL ,"eac_fck" , &eac_fck,CK_242X ), -CLK (NULL ,"hdq_ick" , &hdq_ick,CK_243X |CK_242X ), -CLK (NULL ,"hdq_fck" , &hdq_fck,CK_243X |CK_242X ), +CLK ("omap_hdq.0" ,"ick" , &hdq_ick,CK_243X |CK_242X ), +CLK ("omap_hdq.1" ,"fck" , &hdq_fck,CK_243X |CK_242X ),CLK ("i2c_omap.1" ,"ick" , &i2c1_ick,CK_243X |CK_242X ),CLK ("i2c_omap.1" ,"fck" , &i2c1_fck,CK_242X ), CLK("i2c_omap.1", "fck", &i2chs1_fck, CK_243X),
arch/arm/mach-omap2/clock34xx.c +2 -2
@@ -155,7 +155,7 @@ static struct omap_clk omap34xx_clks[] = {CLK (NULL ,"uart1_fck" , &uart1_fck,CK_343X ),CLK (NULL ,"fshostusb_fck" , &fshostusb_fck,CK_3430ES1 ),CLK (NULL ,"core_12m_fck" , &core_12m_fck,CK_343X ), -CLK (NULL ,"hdq_fck" , &hdq_fck,CK_343X ), +CLK ("omap_hdq.0" ,"fck" , &hdq_fck,CK_343X ),CLK (NULL ,"ssi_ssr_fck" , &ssi_ssr_fck,CK_343X ),CLK (NULL ,"ssi_sst_fck" , &ssi_sst_fck,CK_343X ), CLK(NULL, "core_l3_ick", &core_l3_ick, CK_343X),
@@ -174,7 +174,7 @@ static struct omap_clk omap34xx_clks[] = {CLK ("mmci-omap-hs.1" ,"mmchs_ick" , &mmchs2_ick,CK_343X ),CLK ("mmci-omap-hs.0" ,"mmchs_ick" , &mmchs1_ick,CK_343X ),CLK (NULL ,"mspro_ick" , &mspro_ick,CK_343X ), -CLK (NULL ,"hdq_ick" , &hdq_ick,CK_343X ), +CLK ("omap_hdq.0" ,"ick" , &hdq_ick,CK_343X ),CLK ("omap2_mcspi.4" ,"ick" , &mcspi4_ick,CK_343X ),CLK ("omap2_mcspi.3" ,"ick" , &mcspi3_ick,CK_343X ), CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_343X),
drivers/w1/masters/omap_hdq.c +2 -2
@@ -590,8 +590,8 @@ static int __init omap_hdq_probe(struct platform_device *pdev) }/* get interface & functional clock objects */ - hdq_data->hdq_ick =clk_get (&pdev->dev,"hdq_ick" ); - hdq_data->hdq_fck =clk_get (&pdev->dev,"hdq_fck" ); + hdq_data->hdq_ick =clk_get (&pdev->dev,"ick" ); + hdq_data->hdq_fck =clk_get (&pdev->dev,"fck" );if (IS_ERR (hdq_data->hdq_ick) ||IS_ERR (hdq_data->hdq_fck)) {dev_dbg (&pdev->dev,"Can't get HDQ clock objects\n" );
Signature · 1 line
1.6.1.2
PATCH 33/86 omap: spi: arrange for omap_uwire to use connection ID
From: Russell King <[email protected]>
... which now means no driver requests the "armxor_ck" clock directly. Also, fix the error handling for clk_get(), ensuring that we propagate the error returned from clk_get().
--- arch/arm/mach-omap1/clock.c | 1 + drivers/spi/omap_uwire.c | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-)
arch/arm/mach-omap1/clock.c +1 -0
@@ -133,6 +133,7 @@ static struct omap_clk omap_clks[] = {CLK ("i2c_omap.1" ,"fck" , &i2c_fck,CK_16XX |CK_1510 |CK_310 ),CLK ("i2c_omap.1" ,"ick" , &i2c_ick,CK_16XX ),CLK ("i2c_omap.1" ,"ick" , &dummy_ck,CK_1510 |CK_310 ), +CLK ("omap_uwire" ,"fck" , &armxor_ck.clk,CK_16XX |CK_1510 |CK_310 ),CLK ("omap-mcbsp.1" ,"ick" , &dspper_ck,CK_16XX ),CLK ("omap-mcbsp.1" ,"ick" , &dummy_ck,CK_1510 |CK_310 ), CLK("omap-mcbsp.2", "ick", &armper_ck.clk, CK_16XX),
drivers/spi/omap_uwire.c +5 -4
@@ -506,11 +506,12 @@ static int __init uwire_probe(struct platform_device *pdev)dev_set_drvdata (&pdev->dev, uwire); - uwire->ck =clk_get (&pdev->dev,"armxor_ck" ); -if (!uwire->ck ||IS_ERR (uwire->ck)) { -dev_dbg (&pdev->dev,"no mpu_xor_clk ?\n" ); + uwire->ck =clk_get (&pdev->dev,"fck" ); +if (IS_ERR (uwire->ck)) { + status =PTR_ERR (uwire->ck); +dev_dbg (&pdev->dev,"no functional clock?\n" );spi_master_put (master); -return -ENODEV ; +return status; }clk_enable (uwire->ck);
Signature · 1 line
1.6.1.2
PATCH 34/86 omap: convert omap RNG clocks to match by devid and conid
From: Russell King <[email protected]>
--- arch/arm/mach-omap2/clock24xx.c | 2 +- arch/arm/mach-omap2/clock34xx.c | 2 +- drivers/char/hw_random/omap-rng.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/clock24xx.c +1 -1
@@ -200,7 +200,7 @@ static struct omap_clk omap24xx_clks[] = {CLK (NULL ,"sdrc_ick" , &sdrc_ick,CK_243X ),CLK (NULL ,"des_ick" , &des_ick,CK_243X |CK_242X ),CLK (NULL ,"sha_ick" , &sha_ick,CK_243X |CK_242X ), -CLK (NULL ,"rng_ick" , &rng_ick,CK_243X |CK_242X ), +CLK ("omap_rng" ,"ick" , &rng_ick,CK_243X |CK_242X ),CLK (NULL ,"aes_ick" , &aes_ick,CK_243X |CK_242X ),CLK (NULL ,"pka_ick" , &pka_ick,CK_243X |CK_242X ), CLK(NULL, "usb_fck", &usb_fck, CK_243X | CK_242X),
arch/arm/mach-omap2/clock34xx.c +1 -1
@@ -196,7 +196,7 @@ static struct omap_clk omap34xx_clks[] = {CLK (NULL ,"usb_l4_ick" , &usb_l4_ick,CK_3430ES1 ),CLK (NULL ,"security_l4_ick2" , &security_l4_ick2,CK_343X ),CLK (NULL ,"aes1_ick" , &aes1_ick,CK_343X ), -CLK (NULL ,"rng_ick" , &rng_ick,CK_343X ), +CLK ("omap_rng" ,"ick" , &rng_ick,CK_343X ),CLK (NULL ,"sha11_ick" , &sha11_ick,CK_343X ),CLK (NULL ,"des1_ick" , &des1_ick,CK_343X ), CLK(NULL, "dss1_alwon_fck", &dss1_alwon_fck, CK_343X),
drivers/char/hw_random/omap-rng.c +1 -1
@@ -102,7 +102,7 @@ static int __init omap_rng_probe(struct platform_device *pdev)return -EBUSY ;if (cpu_is_omap24xx ()) { - rng_ick =clk_get (&pdev->dev,"rng_ick" ); + rng_ick =clk_get (&pdev->dev,"ick" );if (IS_ERR (rng_ick)) {dev_err (&pdev->dev,"Could not get rng_ick\n" ); ret =PTR_ERR (rng_ick);
Signature · 1 line
1.6.1.2
PATCH 35/86 omap: omap24xxcam: use short connection IDs for omap2 clocks
From: Russell King <[email protected]>
--- arch/arm/mach-omap2/clock24xx.c | 4 ++-- drivers/media/video/omap24xxcam.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/clock24xx.c +2 -2
@@ -169,8 +169,8 @@ static struct omap_clk omap24xx_clks[] = {CLK (NULL ,"wdt1_ick" , &wdt1_ick,CK_243X |CK_242X ),CLK (NULL ,"omapctrl_ick" , &omapctrl_ick,CK_243X |CK_242X ),CLK (NULL ,"icr_ick" , &icr_ick,CK_243X ), -CLK (NULL ,"cam_fck" , &cam_fck,CK_243X |CK_242X ), -CLK (NULL ,"cam_ick" , &cam_ick,CK_243X |CK_242X ), +CLK ("omap24xxcam" ,"fck" , &cam_fck,CK_243X |CK_242X ), +CLK ("omap24xxcam" ,"ick" , &cam_ick,CK_243X |CK_242X ),CLK (NULL ,"mailboxes_ick" , &mailboxes_ick,CK_243X |CK_242X ),CLK (NULL ,"wdt4_ick" , &wdt4_ick,CK_243X |CK_242X ), CLK(NULL, "wdt4_fck", &wdt4_fck, CK_243X | CK_242X),
drivers/media/video/omap24xxcam.c +4 -4
@@ -80,17 +80,17 @@ static int omap24xxcam_clock_get(struct omap24xxcam_device *cam) {int rval =0 ; - cam->fck =clk_get (cam->dev,"cam_fck" ); + cam->fck =clk_get (cam->dev,"fck" );if (IS_ERR (cam->fck)) { -dev_err (cam->dev,"can't get cam_fck" ); +dev_err (cam->dev,"can't get camera fck" ); rval =PTR_ERR (cam->fck);omap24xxcam_clock_put (cam);return rval; } - cam->ick =clk_get (cam->dev,"cam_ick" ); + cam->ick =clk_get (cam->dev,"ick" );if (IS_ERR (cam->ick)) { -dev_err (cam->dev,"can't get cam_ick" ); +dev_err (cam->dev,"can't get camera ick" ); rval =PTR_ERR (cam->ick);omap24xxcam_clock_put (cam); }
Signature · 1 line
1.6.1.2
PATCH 36/86 omap: hsmmc: new short connection id names
From: Russell King <[email protected]>
... rather than the clock names themselves.
--- arch/arm/mach-omap2/clock24xx.c | 8 ++++---- arch/arm/mach-omap2/clock34xx.c | 12 ++++++------ arch/arm/mach-omap2/devices.c | 4 ++-- drivers/mmc/host/omap_hsmmc.c | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-)
arch/arm/mach-omap2/clock24xx.c +4 -4
@@ -205,10 +205,10 @@ static struct omap_clk omap24xx_clks[] = {CLK (NULL ,"pka_ick" , &pka_ick,CK_243X |CK_242X ),CLK (NULL ,"usb_fck" , &usb_fck,CK_243X |CK_242X ),CLK (NULL ,"usbhs_ick" , &usbhs_ick,CK_243X ), -CLK ("mmci-omap-hs.0" ,"mmchs_ick" , &mmchs1_ick,CK_243X ), -CLK ("mmci-omap-hs.0" ,"mmchs_fck" , &mmchs1_fck,CK_243X ), -CLK ("mmci-omap-hs.1" ,"mmchs_ick" , &mmchs2_ick,CK_243X ), -CLK ("mmci-omap-hs.1" ,"mmchs_fck" , &mmchs2_fck,CK_243X ), +CLK ("mmci-omap-hs.0" ,"ick" , &mmchs1_ick,CK_243X ), +CLK ("mmci-omap-hs.0" ,"fck" , &mmchs1_fck,CK_243X ), +CLK ("mmci-omap-hs.1" ,"ick" , &mmchs2_ick,CK_243X ), +CLK ("mmci-omap-hs.1" ,"fck" , &mmchs2_fck,CK_243X ),CLK (NULL ,"gpio5_ick" , &gpio5_ick,CK_243X ),CLK (NULL ,"gpio5_fck" , &gpio5_fck,CK_243X ), CLK(NULL, "mdm_intc_ick", &mdm_intc_ick, CK_243X),
arch/arm/mach-omap2/clock34xx.c +6 -6
@@ -137,10 +137,10 @@ static struct omap_clk omap34xx_clks[] = {CLK (NULL ,"ts_fck" , &ts_fck,CK_3430ES2 ),CLK (NULL ,"usbtll_fck" , &usbtll_fck,CK_3430ES2 ),CLK (NULL ,"core_96m_fck" , &core_96m_fck,CK_343X ), -CLK ("mmci-omap-hs.2" ,"mmchs_fck" , &mmchs3_fck,CK_3430ES2 ), -CLK ("mmci-omap-hs.1" ,"mmchs_fck" , &mmchs2_fck,CK_343X ), +CLK ("mmci-omap-hs.2" ,"fck" , &mmchs3_fck,CK_3430ES2 ), +CLK ("mmci-omap-hs.1" ,"fck" , &mmchs2_fck,CK_343X ),CLK (NULL ,"mspro_fck" , &mspro_fck,CK_343X ), -CLK ("mmci-omap-hs.0" ,"mmchs_fck" , &mmchs1_fck,CK_343X ), +CLK ("mmci-omap-hs.0" ,"fck" , &mmchs1_fck,CK_343X ),CLK ("i2c_omap.3" ,"fck" , &i2c3_fck,CK_343X ),CLK ("i2c_omap.2" ,"fck" , &i2c2_fck,CK_343X ), CLK("i2c_omap.1", "fck", &i2c1_fck, CK_343X),
@@ -166,13 +166,13 @@ static struct omap_clk omap34xx_clks[] = {CLK (NULL ,"pka_ick" , &pka_ick,CK_343X ),CLK (NULL ,"core_l4_ick" , &core_l4_ick,CK_343X ),CLK (NULL ,"usbtll_ick" , &usbtll_ick,CK_3430ES2 ), -CLK ("mmci-omap-hs.2" ,"mmchs_ick" , &mmchs3_ick,CK_3430ES2 ), +CLK ("mmci-omap-hs.2" ,"ick" , &mmchs3_ick,CK_3430ES2 ),CLK (NULL ,"icr_ick" , &icr_ick,CK_343X ),CLK (NULL ,"aes2_ick" , &aes2_ick,CK_343X ),CLK (NULL ,"sha12_ick" , &sha12_ick,CK_343X ),CLK (NULL ,"des2_ick" , &des2_ick,CK_343X ), -CLK ("mmci-omap-hs.1" ,"mmchs_ick" , &mmchs2_ick,CK_343X ), -CLK ("mmci-omap-hs.0" ,"mmchs_ick" , &mmchs1_ick,CK_343X ), +CLK ("mmci-omap-hs.1" ,"ick" , &mmchs2_ick,CK_343X ), +CLK ("mmci-omap-hs.0" ,"ick" , &mmchs1_ick,CK_343X ),CLK (NULL ,"mspro_ick" , &mspro_ick,CK_343X ),CLK ("omap_hdq.0" ,"ick" , &hdq_ick,CK_343X ), CLK("omap2_mcspi.4", "ick", &mcspi4_ick, CK_343X),
arch/arm/mach-omap2/devices.c +2 -2
@@ -349,11 +349,11 @@ static void __init omap_hsmmc_reset(void) dummy_pdev.id = i;dev_set_name (&dummy_pdev.dev,"mmci-omap-hs.%d" , i); - iclk =clk_get (dev,"mmchs_ick" ); + iclk =clk_get (dev,"ick" );if (iclk &&clk_enable (iclk)) iclk =NULL ; - fclk =clk_get (dev,"mmchs_fck" ); + fclk =clk_get (dev,"fck" );if (fclk &&clk_enable (fclk)) fclk =NULL ;
drivers/mmc/host/omap_hsmmc.c +2 -2
@@ -920,13 +920,13 @@ static int __init omap_mmc_probe(struct platform_device *pdev)sema_init (&host->sem,1 ); - host->iclk =clk_get (&pdev->dev,"mmchs_ick" ); + host->iclk =clk_get (&pdev->dev,"ick" );if (IS_ERR (host->iclk)) { ret =PTR_ERR (host->iclk); host->iclk =NULL ; goto err1; } - host->fclk =clk_get (&pdev->dev,"mmchs_fck" ); + host->fclk =clk_get (&pdev->dev,"fck" );if (IS_ERR (host->fclk)) { ret =PTR_ERR (host->fclk); host->fclk =NULL ;
Signature · 1 line
1.6.1.2
PATCH 37/86 OMAP2/3: Add non-CORE DPLL rate set code and M, N programming
From: Paul Walmsley <[email protected]>
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 | 137 ++++++++++++++++++++++++++++++- arch/arm/mach-omap2/clock34xx.h | 11 +++ arch/arm/plat-omap/include/mach/clock.h | 1 + 3 files changed, 148 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/clock34xx.c +136 -1
@@ -340,6 +340,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 */ /*
@@ -476,7 +512,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);
@@ -506,11 +542,110 @@ 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 = clk->dpll_data; +u32 v; + +/* 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 ; +} + +static int omap3_dpll4_set_rate (struct clk *clk,unsigned long rate) +{ +/* +* 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 ) { +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); +} +static const struct clkops clkops_noncore_dpll_ops = { .enable = &omap3_noncore_dpll_enable, .disable = &omap3_noncore_dpll_disable, }; +/* 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 +11 -0
@@ -32,6 +32,8 @@ static void omap3_clkoutx2_recalc(struct clk *clk);static void omap3_dpll_allow_idle (struct clk *clk);static void omap3_dpll_deny_idle (struct clk *clk);static u32 omap3_dpll_autoidle_read (struct clk *clk); +static int omap3_noncore_dpll_set_rate (struct clk *clk,unsigned long rate); +static int omap3_dpll4_set_rate (struct clk *clk,unsigned long rate);/* Maximum DPLL multiplier, divider values for OMAP3 */ #define OMAP3_MAX_DPLL_MULT 2048
@@ -254,6 +256,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),
@@ -276,6 +279,7 @@ static struct clk dpll1_ck = { .dpll_data = &dpll1_dd, .flags = RATE_PROPAGATES, .round_rate = &omap2_dpll_round_rate, + .set_rate = &omap3_noncore_dpll_set_rate, .recalc = &omap3_dpll_recalc, };
@@ -321,6 +325,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) |
@@ -344,6 +349,7 @@ static struct clk dpll2_ck = { .dpll_data = &dpll2_dd, .flags = RATE_PROPAGATES, .round_rate = &omap2_dpll_round_rate, + .set_rate = &omap3_noncore_dpll_set_rate, .recalc = &omap3_dpll_recalc, };
@@ -378,6 +384,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,
@@ -558,6 +565,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),
@@ -580,6 +588,7 @@ static struct clk dpll4_ck = { .dpll_data = &dpll4_dd, .flags = RATE_PROPAGATES, .round_rate = &omap2_dpll_round_rate, + .set_rate = &omap3_dpll4_set_rate, .recalc = &omap3_dpll_recalc, };
@@ -864,6 +873,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),
@@ -886,6 +896,7 @@ static struct clk dpll5_ck = { .dpll_data = &dpll5_dd, .flags = RATE_PROPAGATES, .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
@@ -53,6 +53,7 @@ struct dpll_data {void __iomem *idlest_reg;u32 enable_mask;u32 autoidle_mask; +u32 freqsel_mask;u8 auto_recal_bit;u8 recal_en_bit;u8 recal_st_bit;
Signature · 1 line
1.6.1.2
PATCH 38/86 OMAP: Fix sparse, checkpatch warnings in OMAP2/3 PRCM/PM code
From: Paul Walmsley <[email protected]>
Fix 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 | 51 ++++++++++++------------- 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, 44 insertions(+), 41 deletions(-)
arch/arm/mach-omap2/clock.c +25 -26
@@ -26,7 +26,6 @@#include <mach/clock.h> #include <mach/clockdomain.h> -#include <mach/sram.h> #include <mach/cpu.h> #include <asm/div64.h>
@@ -187,11 +186,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 int omap2_dflt_clk_enable_wait(struct clk *clk) {int ret; -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 */
@@ -283,7 +281,7 @@ static void omap2_dflt_clk_disable(struct clk *clk) {u32 regval32; -if (clk->enable_reg ==NULL ) { +if (!clk->enable_reg) {/* * 'Independent' here refers to a clock which is not * controlled by its parent.
@@ -330,7 +328,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);
@@ -343,10 +341,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; }
@@ -356,7 +354,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);
@@ -384,7 +382,7 @@ 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;
@@ -400,8 +398,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;
@@ -450,7 +448,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++) {
@@ -509,7 +507,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 )
@@ -535,7 +533,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++) {
@@ -571,7 +569,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++) {
@@ -596,9 +594,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;
@@ -618,7 +616,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;
@@ -637,7 +635,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);
@@ -675,7 +673,7 @@ 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);return ret;
@@ -696,7 +694,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++) {
@@ -726,7 +724,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)
@@ -734,7 +732,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 )
@@ -794,7 +792,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
@@ -339,7 +339,7 @@ static const struct clkops clkops_fixed = {* 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;
@@ -550,7 +550,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 );
@@ -582,20 +584,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
@@ -113,12 +113,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 int clk_get_usecount (struct clk *clk);extern void clk_enable_init_clocks (void );
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 ();
Signature · 1 line
1.6.1.2
PATCH 39/86 OMAP24xx clock: add missing SSI L4 interface clock
From: Paul Walmsley <[email protected]>
This 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.c | 1 + arch/arm/mach-omap2/clock24xx.h | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/clock24xx.c +1 -0
@@ -112,6 +112,7 @@ static struct omap_clk omap24xx_clks[] = {CLK (NULL ,"usb_l4_ick" , &usb_l4_ick,CK_243X |CK_242X ),/* L4 domain clocks */ CLK (NULL ,"l4_ck" , &l4_ck,CK_243X |CK_242X ), +CLK (NULL ,"ssi_l4_ick" , &ssi_l4_ick,CK_243X |CK_242X ),/* virtual meta-group clock */ CLK(NULL, "virt_prcm_set", &virt_prcm_set, CK_243X | CK_242X),/* general l4 interface ck, multi-parent functional clk */
arch/arm/mach-omap2/clock24xx.h +14 -0
@@ -1276,6 +1276,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" , + .ops = &clkops_omap2_dflt_wait, + .parent = &l4_ck, + .clkdm_name ="core_l4_clkdm" , + .enable_reg =OMAP_CM_REGADDR (CORE_MOD ,CM_ICLKEN2 ), + .enable_bit =OMAP24XX_EN_SSI_SHIFT , + .recalc = &followparent_recalc, +}; +/* * GFX clock domain
Signature · 1 line
1.6.1.2
PATCH 40/86 OMAP3: move USBHOST SAR handling from clock framework to powerdomain layer
From: Paul Walmsley <[email protected]>
Remove 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.c | 1 - arch/arm/mach-omap2/clock34xx.h | 11 ----------- arch/arm/mach-omap2/powerdomains34xx.h | 1 + 3 files changed, 1 insertions(+), 12 deletions(-)
arch/arm/mach-omap2/clock34xx.c +0 -1
@@ -209,7 +209,6 @@ static struct omap_clk omap34xx_clks[] = {CLK (NULL ,"usbhost_120m_fck" , &usbhost_120m_fck,CK_3430ES2 ),CLK (NULL ,"usbhost_48m_fck" , &usbhost_48m_fck,CK_3430ES2 ),CLK (NULL ,"usbhost_ick" , &usbhost_ick,CK_3430ES2 ), -CLK (NULL ,"usbhost_sar_fck" , &usbhost_sar_fck,CK_3430ES2 ),CLK (NULL ,"usim_fck" , &usim_fck,CK_3430ES2 ),CLK (NULL ,"gpt1_fck" , &gpt1_fck,CK_343X ), CLK(NULL, "wkup_32k_fck", &wkup_32k_fck, CK_343X),
arch/arm/mach-omap2/clock34xx.h +0 -11
@@ -2218,17 +2218,6 @@ static struct clk usbhost_ick = { .recalc = &followparent_recalc, }; -static struct clk usbhost_sar_fck = { - .name ="usbhost_sar_fck" , - .ops = &clkops_omap2_dflt, - .parent = &osc_sys_ck, - .init = &omap2_init_clk_clkdm, - .enable_reg =OMAP_PRM_REGADDR (OMAP3430ES2_USBHOST_MOD ,PM_PWSTCTRL ), - .enable_bit =OMAP3430ES2_SAVEANDRESTORE_SHIFT , - .clkdm_name ="usbhost_clkdm" , - .recalc = &followparent_recalc, -}; -/* WKUP */ static const struct clksel_rate usim_96m_rates[] = {
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 */
Signature · 1 line
1.6.1.2
PATCH 41/86 OMAP3 clock: fix 96MHz clocks
From: Paul Walmsley <[email protected]>
Fix 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 | 58 +++++++++++++++++++++------------ arch/arm/mach-omap2/cm-regbits-34xx.h | 8 +++- 2 files changed, 43 insertions(+), 23 deletions(-)
arch/arm/mach-omap2/clock34xx.h +37 -21
@@ -640,6 +640,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" , .ops = &clkops_null,
@@ -652,28 +658,38 @@ static struct clk omap_96m_alwon_fck = { .recalc = &omap2_clksel_recalc, }; -static struct clk omap_96m_fck = { - .name ="omap_96m_fck" , +static struct clk cm_96m_fck = { + .name ="cm_96m_fck" , .ops = &clkops_null, .parent = &omap_96m_alwon_fck, .flags =RATE_PROPAGATES , .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" , +static struct clk omap_96m_fck = { + .name ="omap_96m_fck" , .ops = &clkops_null, - .parent = &dpll4_m2x2_ck, + .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 =RATE_PROPAGATES , .recalc = &omap2_clksel_recalc, };
@@ -742,13 +758,13 @@ static struct clk omap_54m_fck = { .ops = &clkops_null, .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 = RATE_PROPAGATES, .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 } };
@@ -759,7 +775,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 } };
@@ -769,7 +785,7 @@ static struct clk omap_48m_fck = { .ops = &clkops_null, .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 = RATE_PROPAGATES, .recalc = &omap2_clksel_recalc,
@@ -958,10 +974,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 } };
@@ -2782,8 +2798,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
Signature · 1 line
1.6.1.2
PATCH 42/86 OMAP2: Fix definition of SGX clock register bits
From: 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 = { .ops = &clkops_omap2_dflt_wait, .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, .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
Signature · 1 line
1.6.1.2
PATCH 43/86 OMAP: Add CSI2 clock struct for handling it with clock API
From: 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.c | 1 + arch/arm/mach-omap2/clock34xx.h | 11 +++++++++++ arch/arm/mach-omap2/cm-regbits-34xx.h | 2 ++ 3 files changed, 14 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/clock34xx.c +1 -0
@@ -206,6 +206,7 @@ static struct omap_clk omap34xx_clks[] = {CLK (NULL ,"dss_ick" , &dss_ick,CK_343X ),CLK (NULL ,"cam_mclk" , &cam_mclk,CK_343X ),CLK (NULL ,"cam_ick" , &cam_ick,CK_343X ), +CLK (NULL ,"csi2_96m_fck" , &csi2_96m_fck,CK_343X ),CLK (NULL ,"usbhost_120m_fck" , &usbhost_120m_fck,CK_3430ES2 ),CLK (NULL ,"usbhost_48m_fck" , &usbhost_48m_fck,CK_3430ES2 ), CLK(NULL, "usbhost_ick", &usbhost_ick, CK_3430ES2),
arch/arm/mach-omap2/clock34xx.h +11 -0
@@ -2198,6 +2198,17 @@ static struct clk cam_ick = { .recalc = &followparent_recalc, }; +static struct clk csi2_96m_fck = { + .name ="csi2_96m_fck" , + .ops = &clkops_omap2_dflt_wait, + .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 , + .clkdm_name ="cam_clkdm" , + .recalc = &followparent_recalc, +}; +/* USBHOST - 3430ES2 only */ static struct clk usbhost_120m_fck = {
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 */
Signature · 1 line
1.6.1.2
PATCH 44/86 OMAP: Make dpll4_m4_ck programmable with clk_set_rate()
From: Paul Walmsley <[email protected]>
Filling 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
@@ -811,6 +811,8 @@ static struct clk dpll4_m4_ck = { .clksel = div16_dpll4_clksel, .flags = RATE_PROPAGATES, .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 */
Signature · 6 lines
1.6.1.2 -- 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
PATCH 45/86 OMAP2: Implement CPUfreq frequency table based on PRCM table
From: 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
@@ -574,6 +574,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,
@@ -581,6 +620,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 recalculate_root_clocks(void);extern void followparent_recalc (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 extern const struct clkops clkops_null;
Signature · 1 line
1.6.1.2
PATCH 46/86 OMAP2/3 clockdomains: combine pwrdm, pwrdm_name into union in struct clockdomain
From: Paul Walmsley <[email protected]>
struct clockdomain contains a struct powerdomain *pwrdm and const char *pwrdm_name. The pwrdm_name is only used at initialization to look up the appropriate pwrdm pointer. Combining these into a union saves about 100 bytes on 3430SDP. This patch should not cause any change in kernel function.
Updated to gracefully handle autodeps that contain invalid powerdomains, per Russell King's review comments.
Boot-tested on BeagleBoard ES2.1.
linux-omap source commit is 718fc6cd4db902aa2242a736cc3feb8744a4c71a.
--- arch/arm/mach-omap2/clockdomain.c | 59 +++++++++++++------------ arch/arm/mach-omap2/clockdomains.h | 54 ++++++++++++----------- arch/arm/plat-omap/include/mach/clockdomain.h | 24 ++++++---- 3 files changed, 72 insertions(+), 65 deletions(-)
arch/arm/mach-omap2/clockdomain.c +30 -29
@@ -22,6 +22,7 @@#include <linux/delay.h> #include <linux/clk.h> #include <linux/limits.h> +#include <linux/err.h> #include <linux/io.h>
@@ -71,14 +72,14 @@ static void _autodep_lookup(struct clkdm_pwrdm_autodep *autodep)if (!omap_chip_is (autodep->omap_chip))return ; - pwrdm =pwrdm_lookup (autodep->pwrdm_name); + pwrdm =pwrdm_lookup (autodep->pwrdm.name);if (!pwrdm) {pr_debug ("clockdomain: _autodep_lookup: powerdomain %s " -"does not exist\n" , autodep->pwrdm_name); +"does not exist\n" , autodep->pwrdm.name);WARN_ON (1 ); -return ; + pwrdm =ERR_PTR (-ENOENT ); } - autodep->pwrdm = pwrdm; + autodep->pwrdm.ptr = pwrdm;return ; }
@@ -95,16 +96,16 @@ static void _clkdm_add_autodeps(struct clockdomain *clkdm) {struct clkdm_pwrdm_autodep *autodep; -for (autodep = autodeps; autodep->pwrdm_name; autodep++) { -if (!autodep->pwrdm) +for (autodep = autodeps; autodep->pwrdm.ptr; autodep++) { +if (IS_ERR (autodep->pwrdm.ptr))continue ;pr_debug ("clockdomain: adding %s sleepdep/wkdep for " -"pwrdm %s\n" , autodep->pwrdm_name, - clkdm->pwrdm->name); +"pwrdm %s\n" , autodep->pwrdm.ptr->name, + clkdm->pwrdm.ptr->name); -pwrdm_add_sleepdep (clkdm->pwrdm, autodep->pwrdm); -pwrdm_add_wkdep (clkdm->pwrdm, autodep->pwrdm); +pwrdm_add_sleepdep (clkdm->pwrdm.ptr, autodep->pwrdm.ptr); +pwrdm_add_wkdep (clkdm->pwrdm.ptr, autodep->pwrdm.ptr); } }
@@ -120,16 +121,16 @@ static void _clkdm_del_autodeps(struct clockdomain *clkdm) {struct clkdm_pwrdm_autodep *autodep; -for (autodep = autodeps; autodep->pwrdm_name; autodep++) { -if (!autodep->pwrdm) +for (autodep = autodeps; autodep->pwrdm.ptr; autodep++) { +if (IS_ERR (autodep->pwrdm.ptr))continue ;pr_debug ("clockdomain: removing %s sleepdep/wkdep for " -"pwrdm %s\n" , autodep->pwrdm_name, - clkdm->pwrdm->name); +"pwrdm %s\n" , autodep->pwrdm.ptr->name, + clkdm->pwrdm.ptr->name); -pwrdm_del_sleepdep (clkdm->pwrdm, autodep->pwrdm); -pwrdm_del_wkdep (clkdm->pwrdm, autodep->pwrdm); +pwrdm_del_sleepdep (clkdm->pwrdm.ptr, autodep->pwrdm.ptr); +pwrdm_del_wkdep (clkdm->pwrdm.ptr, autodep->pwrdm.ptr); } }
@@ -179,7 +180,7 @@ void clkdm_init(struct clockdomain **clkdms, autodeps = init_autodeps;if (autodeps) -for (autodep = autodeps; autodep->pwrdm_name; autodep++) +for (autodep = autodeps; autodep->pwrdm.ptr; autodep++)_autodep_lookup (autodep); }
@@ -202,13 +203,13 @@ int clkdm_register(struct clockdomain *clkdm)if (!omap_chip_is (clkdm->omap_chip))return -EINVAL ; - pwrdm =pwrdm_lookup (clkdm->pwrdm_name); + pwrdm =pwrdm_lookup (clkdm->pwrdm.name);if (!pwrdm) {pr_debug ("clockdomain: clkdm_register %s: powerdomain %s " -"does not exist\n" , clkdm->name, clkdm->pwrdm_name); +"does not exist\n" , clkdm->name, clkdm->pwrdm.name);return -EINVAL ; } - clkdm->pwrdm = pwrdm; + clkdm->pwrdm.ptr = pwrdm;mutex_lock (&clkdm_mutex);/* Verify that the clockdomain is not already registered */
@@ -242,7 +243,7 @@ int clkdm_unregister(struct clockdomain *clkdm)if (!clkdm)return -EINVAL ; -pwrdm_del_clkdm (clkdm->pwrdm, clkdm); +pwrdm_del_clkdm (clkdm->pwrdm.ptr, clkdm);mutex_lock (&clkdm_mutex);list_del (&clkdm->node);
@@ -327,7 +328,7 @@ struct powerdomain *clkdm_get_pwrdm(struct clockdomain *clkdm)if (!clkdm)return NULL ; -return clkdm->pwrdm; +return clkdm->pwrdm.ptr; }
@@ -348,7 +349,7 @@ static int omap2_clkdm_clktrctrl_read(struct clockdomain *clkdm)if (!clkdm)return -EINVAL ; - v =cm_read_mod_reg (clkdm->pwrdm->prcm_offs,CM_CLKSTCTRL ); + v =cm_read_mod_reg (clkdm->pwrdm.ptr->prcm_offs,CM_CLKSTCTRL ); v &= clkdm->clktrctrl_mask; v >>=__ffs (clkdm->clktrctrl_mask);
@@ -380,7 +381,7 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm)if (cpu_is_omap24xx ()) {cm_set_mod_reg_bits (OMAP24XX_FORCESTATE , - clkdm->pwrdm->prcm_offs,PM_PWSTCTRL ); + clkdm->pwrdm.ptr->prcm_offs,PM_PWSTCTRL ); }else if (cpu_is_omap34xx ()) {
@@ -388,7 +389,7 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm) __ffs(clkdm->clktrctrl_mask));cm_rmw_mod_reg_bits (clkdm->clktrctrl_mask, v, - clkdm->pwrdm->prcm_offs,CM_CLKSTCTRL ); + clkdm->pwrdm.ptr->prcm_offs,CM_CLKSTCTRL ); }else {BUG ();
@@ -422,7 +423,7 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm)if (cpu_is_omap24xx ()) {cm_clear_mod_reg_bits (OMAP24XX_FORCESTATE , - clkdm->pwrdm->prcm_offs,PM_PWSTCTRL ); + clkdm->pwrdm.ptr->prcm_offs,PM_PWSTCTRL ); }else if (cpu_is_omap34xx ()) {
@@ -430,7 +431,7 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm) __ffs(clkdm->clktrctrl_mask));cm_rmw_mod_reg_bits (clkdm->clktrctrl_mask, v, - clkdm->pwrdm->prcm_offs,CM_CLKSTCTRL ); + clkdm->pwrdm.ptr->prcm_offs,CM_CLKSTCTRL ); }else {BUG ();
@@ -478,7 +479,7 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm)cm_rmw_mod_reg_bits (clkdm->clktrctrl_mask, v <<__ffs (clkdm->clktrctrl_mask), - clkdm->pwrdm->prcm_offs, + clkdm->pwrdm.ptr->prcm_offs,CM_CLKSTCTRL ); }
@@ -516,7 +517,7 @@ void omap2_clkdm_deny_idle(struct clockdomain *clkdm)cm_rmw_mod_reg_bits (clkdm->clktrctrl_mask, v <<__ffs (clkdm->clktrctrl_mask), - clkdm->pwrdm->prcm_offs,CM_CLKSTCTRL ); + clkdm->pwrdm.ptr->prcm_offs,CM_CLKSTCTRL );if (atomic_read (&clkdm->usecount) >0 )_clkdm_del_autodeps (clkdm);
arch/arm/mach-omap2/clockdomains.h +28 -26
203 lines not on this page · raw message
arch/arm/plat-omap/include/mach/clockdomain.h +14 -10
@@ -1,5 +1,5 @@/* -* linux/include/asm-arm/arch-omap/clockdomain.h +* arch/arm/plat-omap/include/mach/clockdomain.h * * OMAP2/3 clockdomain framework functions *
@@ -48,11 +48,13 @@*/ struct clkdm_pwrdm_autodep { -/* Name of the powerdomain to add a wkdep/sleepdep on */ -const char *pwrdm_name; +union { +/* Name of the powerdomain to add a wkdep/sleepdep on */ +const char *name; -/* Powerdomain pointer (looked up at clkdm_init() time) */ -struct powerdomain *pwrdm; +/* Powerdomain pointer (looked up at clkdm_init() time) */ +struct powerdomain *ptr; + } pwrdm;/* OMAP chip types that this clockdomain dep is valid on */ const struct omap_chip_id omap_chip;
@@ -64,8 +66,13 @@ struct clockdomain {/* Clockdomain name */ const char *name; -/* Powerdomain enclosing this clockdomain */ -const char *pwrdm_name; +union { +/* Powerdomain enclosing this clockdomain */ +const char *name; + +/* Powerdomain pointer assigned at clkdm_register() */ +struct powerdomain *ptr; + } pwrdm;/* CLKTRCTRL/AUTOSTATE field mask in CM_CLKSTCTRL reg */ const u16 clktrctrl_mask;
@@ -79,9 +86,6 @@ struct clockdomain {/* Usecount tracking */ atomic_t usecount; -/* Powerdomain pointer assigned at clkdm_register() */ -struct powerdomain *pwrdm; -struct list_head node; };
Signature · 1 line
1.6.1.2
PATCH 47/86 OMAP2/3 clockdomains: add CM and PRM clkdms
From: Paul Walmsley <[email protected]>
Add clockdomains for the CM and PRM. These will ultimately replace the "wkup_clkdm", which appears to not actually exist on the hardware.
--- arch/arm/mach-omap2/clockdomains.h | 19 +++++++++++++++++++ arch/arm/plat-omap/include/mach/powerdomain.h | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/clockdomains.h +19 -0
@@ -14,6 +14,11 @@/* * OMAP2/3-common clockdomains +* +* Even though the 2420 has a single PRCM module from the +* interconnect's perspective, internally it does appear to have +* separate PRM and CM clockdomains. The usual test case is +* sys_clkout/sys_clkout2. */ /* This is an implicit clockdomain - it is never defined as such in TRM */
@@ -23,6 +28,18 @@ static struct clockdomain wkup_clkdm = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX | CHIP_IS_OMAP3430), }; +static struct clockdomain prm_clkdm = { + .name ="prm_clkdm" , + .pwrdm = { .name ="wkup_pwrdm" }, + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP24XX |CHIP_IS_OMAP3430 ), +}; + +static struct clockdomain cm_clkdm = { + .name ="cm_clkdm" , + .pwrdm = { .name ="core_pwrdm" }, + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP24XX |CHIP_IS_OMAP3430 ), +}; +/* * 2420-only clockdomains */
@@ -266,6 +283,8 @@ static struct clkdm_pwrdm_autodep clkdm_pwrdm_autodeps[] = {static struct clockdomain *clockdomains_omap[] = { &wkup_clkdm, + &cm_clkdm, + &prm_clkdm, #ifdef CONFIG_ARCH_OMAP2420 &mpu_2420_clkdm,
arch/arm/plat-omap/include/mach/powerdomain.h +2 -2
@@ -50,9 +50,9 @@/* * Maximum number of clockdomains that can be associated with a powerdomain. -* CORE powerdomain is probably the worst case. +* CORE powerdomain on OMAP3 is the worst case */ -#define PWRDM_MAX_CLKDMS 3 +#define PWRDM_MAX_CLKDMS 4/* XXX A completely arbitrary number. What is reasonable here? */ #define PWRDM_TRANSITION_BAILOUT 100000
Signature · 1 line
1.6.1.2
PATCH 48/86 OMAP3 clock: move sys_clkout2 clk to core_clkdm
From: Paul Walmsley <[email protected]>
sys_clkout2 belongs in the core_clkdm (3430 TRM section 4.7.2.2). It's not clear whether it actually is in the CORE clockdomain, or whether it is technically in a different clockdomain; but this is closer to reality than the present configuration.
--- arch/arm/mach-omap2/clock34xx.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/clock34xx.h +1 -0
@@ -993,6 +993,7 @@ static struct clk clkout2_src_ck = { .clksel_mask = OMAP3430_CLKOUT2SOURCE_MASK, .clksel = clkout2_src_clksel, .flags = RATE_PROPAGATES, + .clkdm_name = "core_clkdm", .recalc = &omap2_clksel_recalc, };
Signature · 1 line
1.6.1.2
PATCH 49/86 OMAP3 PRCM: add DPLL1-5 powerdomains, clockdomains; mark clocks
From: Paul Walmsley <[email protected]>
Each DPLL exists in its own powerdomain (cf 34xx TRM figure 4-18) and clockdomain; so, create powerdomain and clockdomain structures for them. Mark each DPLL clock as belonging to their respective DPLL clockdomain. cf. 34xx TRM Table 4-27 (among other references).
linux-omap source commits are acdb615850b9b4f7d1ab68133a16be8c8c0e7419 and a8798a48f33e9268dcc7f30a4b4a3ce4220fe0c9.
--- arch/arm/mach-omap2/clock34xx.h | 27 ++++++++++++++++++++++++ arch/arm/mach-omap2/clockdomains.h | 35 ++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/powerdomains.h | 5 ++++ arch/arm/mach-omap2/powerdomains34xx.h | 31 ++++++++++++++++++++++++++++ 4 files changed, 98 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/clock34xx.h +27 -0
@@ -280,6 +280,7 @@ static struct clk dpll1_ck = { .flags = RATE_PROPAGATES, .round_rate = &omap2_dpll_round_rate, .set_rate = &omap3_noncore_dpll_set_rate, + .clkdm_name = "dpll1_clkdm", .recalc = &omap3_dpll_recalc, };
@@ -292,6 +293,7 @@ static struct clk dpll1_x2_ck = { .ops = &clkops_null, .parent = &dpll1_ck, .flags = RATE_PROPAGATES, + .clkdm_name = "dpll1_clkdm", .recalc = &omap3_clkoutx2_recalc, };
@@ -314,6 +316,7 @@ static struct clk dpll1_x2m2_ck = { .clksel_mask = OMAP3430_MPU_DPLL_CLKOUT_DIV_MASK, .clksel = div16_dpll1_x2m2_clksel, .flags = RATE_PROPAGATES, + .clkdm_name = "dpll1_clkdm", .recalc = &omap2_clksel_recalc, };
@@ -350,6 +353,7 @@ static struct clk dpll2_ck = { .flags = RATE_PROPAGATES, .round_rate = &omap2_dpll_round_rate, .set_rate = &omap3_noncore_dpll_set_rate, + .clkdm_name = "dpll2_clkdm", .recalc = &omap3_dpll_recalc, };
@@ -372,6 +376,7 @@ static struct clk dpll2_m2_ck = { .clksel_mask = OMAP3430_IVA2_DPLL_CLKOUT_DIV_MASK, .clksel = div16_dpll2_m2x2_clksel, .flags = RATE_PROPAGATES, + .clkdm_name = "dpll2_clkdm", .recalc = &omap2_clksel_recalc, };
@@ -404,6 +409,7 @@ static struct clk dpll3_ck = { .dpll_data = &dpll3_dd, .flags = RATE_PROPAGATES, .round_rate = &omap2_dpll_round_rate, + .clkdm_name = "dpll3_clkdm", .recalc = &omap3_dpll_recalc, };
@@ -416,6 +422,7 @@ static struct clk dpll3_x2_ck = { .ops = &clkops_null, .parent = &dpll3_ck, .flags = RATE_PROPAGATES, + .clkdm_name = "dpll3_clkdm", .recalc = &omap3_clkoutx2_recalc, };
@@ -473,6 +480,7 @@ static struct clk dpll3_m2_ck = { .clksel_mask = OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK, .clksel = div31_dpll3m2_clksel, .flags = RATE_PROPAGATES, + .clkdm_name = "dpll3_clkdm", .recalc = &omap2_clksel_recalc, };
@@ -507,6 +515,7 @@ static struct clk dpll3_m2x2_ck = { .clksel_mask = OMAP3430_ST_CORE_CLK_MASK, .clksel = dpll3_m2x2_ck_clksel, .flags = RATE_PROPAGATES, + .clkdm_name = "dpll3_clkdm", .recalc = &omap2_clksel_recalc, };
@@ -526,6 +535,7 @@ static struct clk dpll3_m3_ck = { .clksel_mask = OMAP3430_DIV_DPLL3_MASK, .clksel = div16_dpll3_clksel, .flags = RATE_PROPAGATES, + .clkdm_name = "dpll3_clkdm", .recalc = &omap2_clksel_recalc, };
@@ -537,6 +547,7 @@ static struct clk dpll3_m3x2_ck = { .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), .enable_bit = OMAP3430_PWRDN_EMU_CORE_SHIFT, .flags = RATE_PROPAGATES | INVERT_ENABLE, + .clkdm_name = "dpll3_clkdm", .recalc = &omap3_clkoutx2_recalc, };
@@ -555,6 +566,7 @@ static struct clk emu_core_alwon_ck = { .clksel_mask = OMAP3430_ST_CORE_CLK_MASK, .clksel = emu_core_alwon_ck_clksel, .flags = RATE_PROPAGATES, + .clkdm_name = "dpll3_clkdm", .recalc = &omap2_clksel_recalc, };
@@ -589,6 +601,7 @@ static struct clk dpll4_ck = { .flags = RATE_PROPAGATES, .round_rate = &omap2_dpll_round_rate, .set_rate = &omap3_dpll4_set_rate, + .clkdm_name = "dpll4_clkdm", .recalc = &omap3_dpll_recalc, };
@@ -602,6 +615,7 @@ static struct clk dpll4_x2_ck = { .ops = &clkops_null, .parent = &dpll4_ck, .flags = RATE_PROPAGATES, + .clkdm_name = "dpll4_clkdm", .recalc = &omap3_clkoutx2_recalc, };
@@ -620,6 +634,7 @@ static struct clk dpll4_m2_ck = { .clksel_mask = OMAP3430_DIV_96M_MASK, .clksel = div16_dpll4_clksel, .flags = RATE_PROPAGATES, + .clkdm_name = "dpll4_clkdm", .recalc = &omap2_clksel_recalc, };
@@ -631,6 +646,7 @@ static struct clk dpll4_m2x2_ck = { .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), .enable_bit = OMAP3430_PWRDN_96M_SHIFT, .flags = RATE_PROPAGATES | INVERT_ENABLE, + .clkdm_name = "dpll4_clkdm", .recalc = &omap3_clkoutx2_recalc, };
@@ -704,6 +720,7 @@ static struct clk dpll4_m3_ck = { .clksel_mask = OMAP3430_CLKSEL_TV_MASK, .clksel = div16_dpll4_clksel, .flags = RATE_PROPAGATES, + .clkdm_name = "dpll4_clkdm", .recalc = &omap2_clksel_recalc, };
@@ -716,6 +733,7 @@ static struct clk dpll4_m3x2_ck = { .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), .enable_bit = OMAP3430_PWRDN_TV_SHIFT, .flags = RATE_PROPAGATES | INVERT_ENABLE, + .clkdm_name = "dpll4_clkdm", .recalc = &omap3_clkoutx2_recalc, };
@@ -810,6 +828,7 @@ static struct clk dpll4_m4_ck = { .clksel_mask = OMAP3430_CLKSEL_DSS1_MASK, .clksel = div16_dpll4_clksel, .flags = RATE_PROPAGATES, + .clkdm_name = "dpll4_clkdm", .recalc = &omap2_clksel_recalc, .set_rate = &omap2_clksel_set_rate, .round_rate = &omap2_clksel_round_rate,
@@ -823,6 +842,7 @@ static struct clk dpll4_m4x2_ck = { .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), .enable_bit = OMAP3430_PWRDN_CAM_SHIFT, .flags = RATE_PROPAGATES | INVERT_ENABLE, + .clkdm_name = "dpll4_clkdm", .recalc = &omap3_clkoutx2_recalc, };
@@ -836,6 +856,7 @@ static struct clk dpll4_m5_ck = { .clksel_mask = OMAP3430_CLKSEL_CAM_MASK, .clksel = div16_dpll4_clksel, .flags = RATE_PROPAGATES, + .clkdm_name = "dpll4_clkdm", .recalc = &omap2_clksel_recalc, };
@@ -847,6 +868,7 @@ static struct clk dpll4_m5x2_ck = { .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), .enable_bit = OMAP3430_PWRDN_CAM_SHIFT, .flags = RATE_PROPAGATES | INVERT_ENABLE, + .clkdm_name = "dpll4_clkdm", .recalc = &omap3_clkoutx2_recalc, };
@@ -860,6 +882,7 @@ static struct clk dpll4_m6_ck = { .clksel_mask = OMAP3430_DIV_DPLL4_MASK, .clksel = div16_dpll4_clksel, .flags = RATE_PROPAGATES, + .clkdm_name = "dpll4_clkdm", .recalc = &omap2_clksel_recalc, };
@@ -872,6 +895,7 @@ static struct clk dpll4_m6x2_ck = { .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), .enable_bit = OMAP3430_PWRDN_EMU_PERIPH_SHIFT, .flags = RATE_PROPAGATES | INVERT_ENABLE, + .clkdm_name = "dpll4_clkdm", .recalc = &omap3_clkoutx2_recalc, };
@@ -880,6 +904,7 @@ static struct clk emu_per_alwon_ck = { .ops = &clkops_null, .parent = &dpll4_m6x2_ck, .flags = RATE_PROPAGATES, + .clkdm_name = "dpll4_clkdm", .recalc = &followparent_recalc, };
@@ -915,6 +940,7 @@ static struct clk dpll5_ck = { .flags = RATE_PROPAGATES, .round_rate = &omap2_dpll_round_rate, .set_rate = &omap3_noncore_dpll_set_rate, + .clkdm_name = "dpll5_clkdm", .recalc = &omap3_dpll_recalc, };
@@ -932,6 +958,7 @@ static struct clk dpll5_m2_ck = { .clksel_mask = OMAP3430ES2_DIV_120M_MASK, .clksel = div16_dpll5_clksel, .flags = RATE_PROPAGATES, + .clkdm_name = "dpll5_clkdm", .recalc = &omap2_clksel_recalc, };
arch/arm/mach-omap2/clockdomains.h +35 -0
@@ -256,6 +256,36 @@ static struct clockdomain emu_clkdm = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), }; +static struct clockdomain dpll1_clkdm = { + .name ="dpll1_clkdm" , + .pwrdm = { .name ="dpll1_pwrdm" }, + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ), +}; + +static struct clockdomain dpll2_clkdm = { + .name ="dpll2_clkdm" , + .pwrdm = { .name ="dpll2_pwrdm" }, + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ), +}; + +static struct clockdomain dpll3_clkdm = { + .name ="dpll3_clkdm" , + .pwrdm = { .name ="dpll3_pwrdm" }, + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ), +}; + +static struct clockdomain dpll4_clkdm = { + .name ="dpll4_clkdm" , + .pwrdm = { .name ="dpll4_pwrdm" }, + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ), +}; + +static struct clockdomain dpll5_clkdm = { + .name ="dpll5_clkdm" , + .pwrdm = { .name ="dpll5_pwrdm" }, + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430ES2 ), +}; +#endif /* CONFIG_ARCH_OMAP34XX */ /*
@@ -318,6 +348,11 @@ static struct clockdomain *clockdomains_omap[] = { &usbhost_clkdm, &per_clkdm, &emu_clkdm, + &dpll1_clkdm, + &dpll2_clkdm, + &dpll3_clkdm, + &dpll4_clkdm, + &dpll5_clkdm, #endif NULL,
arch/arm/mach-omap2/powerdomains.h +5 -0
@@ -178,6 +178,11 @@ static struct powerdomain *powerdomains_omap[] __initdata = { &emu_pwrdm, &sgx_pwrdm, &usbhost_pwrdm, + &dpll1_pwrdm, + &dpll2_pwrdm, + &dpll3_pwrdm, + &dpll4_pwrdm, + &dpll5_pwrdm, #endifNULL
arch/arm/mach-omap2/powerdomains34xx.h +31 -0
@@ -322,6 +322,37 @@ static struct powerdomain usbhost_pwrdm = { }, }; +static struct powerdomain dpll1_pwrdm = { + .name ="dpll1_pwrdm" , + .prcm_offs =MPU_MOD , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ), +}; + +static struct powerdomain dpll2_pwrdm = { + .name ="dpll2_pwrdm" , + .prcm_offs =OMAP3430_IVA2_MOD , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ), +}; + +static struct powerdomain dpll3_pwrdm = { + .name ="dpll3_pwrdm" , + .prcm_offs =PLL_MOD , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ), +}; + +static struct powerdomain dpll4_pwrdm = { + .name ="dpll4_pwrdm" , + .prcm_offs =PLL_MOD , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ), +}; + +static struct powerdomain dpll5_pwrdm = { + .name ="dpll5_pwrdm" , + .prcm_offs =PLL_MOD , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430ES2 ), +}; + +#endif /* CONFIG_ARCH_OMAP34XX */
Signature · 1 line
1.6.1.2
PATCH 50/86 OMAP3 powerdomains: remove RET from SGX power states list
From: Paul Walmsley <[email protected]>
The SGX device on OMAP3 does not support retention, so remove RET from the list of possible SGX power states. Problem debugged by Richard Woodruff <[email protected]>.
--- arch/arm/mach-omap2/powerdomains34xx.h | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/powerdomains34xx.h +6 -1
@@ -236,6 +236,11 @@ static struct powerdomain dss_pwrdm = { }, }; +/* +* Although the 34XX TRM Rev K Table 4-371 notes that retention is a +* possible SGX powerstate, the SGX device itself does not support +* retention. +*/ static struct powerdomain sgx_pwrdm = { .name ="sgx_pwrdm" , .prcm_offs =OMAP3430ES2_SGX_MOD ,
@@ -243,7 +248,7 @@ static struct powerdomain sgx_pwrdm = { .wkdep_srcs = gfx_sgx_wkdeps, .sleepdep_srcs = cam_gfx_sleepdeps, /* XXX This is accurate for 3430 SGX, but what about GFX? */ - .pwrsts = PWRSTS_OFF_RET_ON, + .pwrsts = PWRSTS_OFF_ON, .pwrsts_logic_ret = PWRDM_POWER_RET, .banks = 1, .pwrsts_mem_ret = {
Signature · 1 line
1.6.1.2
PATCH 51/86 OMAP: wait for pwrdm transition after clk_enable()
From: Tomi Valkeinen <[email protected]>
Enabling clock in a disabled power domain causes the power domain to be turned on. However, the power transition is not always finished when clk_enable() returns and this randomly crashes the kernel when an interrupt happens right after the clk_enable, and the kernel tries to read the irq status register for that domain.
Why the irq status register is inaccessible, I don't know. Also it doesn't seem to be related to the module being not powered up, but to the transition itself.
The same could perhaps happen after clk_disable also, but I have not witnessed that.
The problem affects at least dss, cam and sgx clocks.
This change waits for the transition to be finished before returning from omap2_clkdm_clk_enable().
--- arch/arm/mach-omap2/clockdomain.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/clockdomain.c +2 -0
@@ -568,6 +568,8 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)else omap2_clkdm_wakeup (clkdm); +pwrdm_wait_transition (clkdm->pwrdm.ptr); +return 0 ; }
Signature · 1 line
1.6.1.2
PATCH 52/86 OMAP2/3 clockdomains: autodeps should respect platform flags
From: Paul Walmsley <[email protected]>
Fix the clockdomain autodep code to respect omap_chip platform flags.
Resolves "Unable to handle kernel paging request at virtual address 5f75706d" panic during power management initialization on OMAP2.
--- arch/arm/mach-omap2/clockdomain.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/clockdomain.c +6 -0
@@ -100,6 +100,9 @@ static void _clkdm_add_autodeps(struct clockdomain *clkdm)if (IS_ERR (autodep->pwrdm.ptr))continue ; +if (!omap_chip_is (autodep->omap_chip)) +continue ; +pr_debug ("clockdomain: adding %s sleepdep/wkdep for " "pwrdm %s\n" , autodep->pwrdm.ptr->name, clkdm->pwrdm.ptr->name);
@@ -125,6 +128,9 @@ static void _clkdm_del_autodeps(struct clockdomain *clkdm)if (IS_ERR (autodep->pwrdm.ptr))continue ; +if (!omap_chip_is (autodep->omap_chip)) +continue ; +pr_debug ("clockdomain: removing %s sleepdep/wkdep for " "pwrdm %s\n" , autodep->pwrdm.ptr->name, clkdm->pwrdm.ptr->name);
Signature · 1 line
1.6.1.2
PATCH 53/86 OMAP3: PM: Emu_pwrdm is switched off by hardware even when sdti is in use
From: Jouni Hogander <[email protected]>
Using sdti doesn't keep emu_pwrdm on if hardware supervised pwrdm transitions are used. This causes sdti stop to work when power management is initialized and hardware supervised pwrdm control is enabled. This patch disables hardware supervised pwrdm control for emu_pwrdm. Now emu_pwrdm is switched off on boot by software when it is not used.
--- arch/arm/mach-omap2/clockdomains.h | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/clockdomains.h +5 -1
@@ -248,10 +248,14 @@ static struct clockdomain per_clkdm = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), }; +/* +* Disable hw supervised mode for emu_clkdm, because emu_pwrdm is +* switched of even if sdti is in use +*/ static struct clockdomain emu_clkdm = { .name ="emu_clkdm" , .pwrdm = { .name ="emu_pwrdm" }, - .flags =CLKDM_CAN_ENABLE_AUTO |CLKDM_CAN_SWSUP , + .flags =/* CLKDM_CAN_ENABLE_AUTO | */ CLKDM_CAN_SWSUP , .clktrctrl_mask =OMAP3430_CLKTRCTRL_EMU_MASK , .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ), };
Signature · 1 line
1.6.1.2
PATCH 54/86 OMAP3 clock: fix DPLL jitter correction and rate programming
From: Paul Walmsley <[email protected]>
Fix DPLL jitter correction programming. Previously, omap3_noncore_dpll_program() stored the FREQSEL jitter correction parameter to the wrong register. This caused jitter correction to be set incorrectly and also caused the DPLL divider to be programmed incorrectly.
Also, fix DPLL divider programming. An off-by-one error existed in omap3_noncore_dpll_program(), causing DPLLs to be programmed with a higher divider than intended.
linux-omap source commit is 5c0ec88a2145cdf2f2c9cc5fae49635c4c2476c7.
--- arch/arm/mach-omap2/clock34xx.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-)
arch/arm/mach-omap2/clock34xx.c +8 -5
@@ -563,14 +563,17 @@ static int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel)/* 3430 ES2 TRM: 4.7.6.9 DPLL Programming Sequence */ _omap3_noncore_dpll_bypass (clk); +/* Set jitter correction */ + v =__raw_readl (dd->control_reg); + v &= ~dd->freqsel_mask; + v |= freqsel <<__ffs (dd->freqsel_mask); +__raw_writel (v, dd->control_reg); + +/* Set DPLL multiplier, divider */ 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); - + v |= (n -1 ) <<__ffs (dd->div1_mask);__raw_writel (v, dd->mult_div1_reg);/* We let the clock framework set the other output dividers later */
Signature · 1 line
1.6.1.2
PATCH 55/86 OMAP3 clock: DPLL{1,2}_FCLK clksel can divide by 4
From: Paul Walmsley <[email protected]>
OMAP34xx ES2 TRM Delta G to H states that the divider for DPLL1_FCLK and DPLL2_FCLK can divide by 4 in addition to dividing by 1 and 2. Encode this into the OMAP3 clock framework.
linux-omap source commit is 050684c18f2ea0b08fdd5233a0cd3c7f96e00a0e.
--- arch/arm/mach-omap2/clock34xx.h | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/clock34xx.h +16 -4
@@ -1060,8 +1060,15 @@ static struct clk corex2_fck = {/* DPLL power domain clock controls */ -static const struct clksel div2_core_clksel[] = { - { .parent = &core_ck, .rates = div2_rates }, +static const struct clksel_rate div4_rates[] = { + { .div =1 , .val =1 , .flags =RATE_IN_343X |DEFAULT_RATE }, + { .div =2 , .val =2 , .flags =RATE_IN_343X }, + { .div =4 , .val =4 , .flags =RATE_IN_343X }, + { .div =0 } +}; + +static const struct clksel div4_core_clksel[] = { + { .parent = &core_ck, .rates = div4_rates }, { .parent =NULL } };
@@ -1076,7 +1083,7 @@ static struct clk dpll1_fck = { .init = &omap2_init_clksel_parent, .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL), .clksel_mask = OMAP3430_MPU_CLK_SRC_MASK, - .clksel = div2_core_clksel, + .clksel = div4_core_clksel, .flags = RATE_PROPAGATES, .recalc = &omap2_clksel_recalc, };
@@ -1151,7 +1158,7 @@ static struct clk dpll2_fck = { .init = &omap2_init_clksel_parent, .clksel_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL), .clksel_mask = OMAP3430_IVA2_CLK_SRC_MASK, - .clksel = div2_core_clksel, + .clksel = div4_core_clksel, .flags = RATE_PROPAGATES, .recalc = &omap2_clksel_recalc, };
@@ -1187,6 +1194,11 @@ static struct clk iva2_ck = {/* Common interface clocks */ +static const struct clksel div2_core_clksel[] = { + { .parent = &core_ck, .rates = div2_rates }, + { .parent =NULL } +}; +static struct clk l3_ick = { .name ="l3_ick" , .ops = &clkops_null,
Signature · 1 line
1.6.1.2
PATCH 56/86 OMAP3 clock: convert dpll_data.idlest_bit to idlest_mask
From: Paul Walmsley <[email protected]>
Convert struct dpll_data.idlest_bit field to idlest_mask. Needed since OMAP2 uses two bits for DPLL IDLEST rather than one.
While here, add the missing idlest_* fields for DPLL3.
linux-omap source commits are 25bab0f176b0a97be18a1b38153f266c3a155784 and b0f7fd17db2aaf8e6e9a2732ae3f4de0874db01c.
--- arch/arm/mach-omap2/clock34xx.c | 6 ++---- arch/arm/mach-omap2/clock34xx.h | 10 ++++++---- arch/arm/plat-omap/include/mach/clock.h | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-)
arch/arm/mach-omap2/clock34xx.c +2 -4
@@ -314,14 +314,12 @@ static int _omap3_wait_dpll_status(struct clk *clk, u8 state)const struct dpll_data *dd;int i =0 ;int ret = -EINVAL ; -u32 idlest_mask; dd = clk->dpll_data; - state <<= dd->idlest_bit; - idlest_mask =1 << dd->idlest_bit; + state <<=__ffs (dd->idlest_mask); -while (((__raw_readl (dd->idlest_reg) & idlest_mask) != state) && +while (((__raw_readl (dd->idlest_reg) & dd->idlest_mask) != state) && i <MAX_DPLL_WAIT_TRIES ) { i++;udelay (1 );
arch/arm/mach-omap2/clock34xx.h +6 -4
@@ -266,7 +266,7 @@ static struct dpll_data dpll1_dd = { .autoidle_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_AUTOIDLE_PLL), .autoidle_mask = OMAP3430_AUTO_MPU_DPLL_MASK, .idlest_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL), - .idlest_bit = OMAP3430_ST_MPU_CLK_SHIFT, + .idlest_mask = OMAP3430_ST_MPU_CLK_MASK, .max_multiplier = OMAP3_MAX_DPLL_MULT, .max_divider =OMAP3_MAX_DPLL_DIV , .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
@@ -339,7 +339,7 @@ static struct dpll_data dpll2_dd = { .autoidle_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_AUTOIDLE_PLL), .autoidle_mask = OMAP3430_AUTO_IVA2_DPLL_MASK, .idlest_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_IDLEST_PLL), - .idlest_bit = OMAP3430_ST_IVA2_CLK_SHIFT, + .idlest_mask = OMAP3430_ST_IVA2_CLK_MASK, .max_multiplier = OMAP3_MAX_DPLL_MULT, .max_divider =OMAP3_MAX_DPLL_DIV , .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
@@ -397,6 +397,8 @@ static struct dpll_data dpll3_dd = { .recal_st_bit = OMAP3430_CORE_DPLL_ST_SHIFT, .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE), .autoidle_mask = OMAP3430_AUTO_CORE_DPLL_MASK, + .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), + .idlest_mask = OMAP3430_ST_CORE_CLK_MASK, .max_multiplier = OMAP3_MAX_DPLL_MULT, .max_divider =OMAP3_MAX_DPLL_DIV , .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
@@ -587,7 +589,7 @@ static struct dpll_data dpll4_dd = { .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE), .autoidle_mask = OMAP3430_AUTO_PERIPH_DPLL_MASK, .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), - .idlest_bit = OMAP3430_ST_PERIPH_CLK_SHIFT, + .idlest_mask = OMAP3430_ST_PERIPH_CLK_MASK, .max_multiplier = OMAP3_MAX_DPLL_MULT, .max_divider =OMAP3_MAX_DPLL_DIV , .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
@@ -926,7 +928,7 @@ static struct dpll_data dpll5_dd = { .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_AUTOIDLE2_PLL), .autoidle_mask = OMAP3430ES2_AUTO_PERIPH2_DPLL_MASK, .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST2), - .idlest_bit = OMAP3430ES2_ST_PERIPH2_CLK_SHIFT, + .idlest_mask = OMAP3430ES2_ST_PERIPH2_CLK_MASK, .max_multiplier = OMAP3_MAX_DPLL_MULT, .max_divider =OMAP3_MAX_DPLL_DIV , .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
arch/arm/plat-omap/include/mach/clock.h +1 -1
@@ -54,10 +54,10 @@ struct dpll_data {u32 enable_mask;u32 autoidle_mask;u32 freqsel_mask; +u32 idlest_mask;u8 auto_recal_bit;u8 recal_en_bit;u8 recal_st_bit; -u8 idlest_bit;# endif };
Signature · 1 line
1.6.1.2
PATCH 57/86 OMAP3 clock: remove unnecessary dpll_data dereferences
From: Paul Walmsley <[email protected]>
Remove some clutter from omap2_dpll_round_rate().
linux-omap source commit is 4625dceb8583c02a6d67ededc9f6a8347b6b8cb7.
--- arch/arm/mach-omap2/clock.c | 23 +++++++++++++---------- 1 files changed, 13 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/clock.c +13 -10
@@ -877,19 +877,22 @@ long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate)int m, n, r, e, scaled_max_m;unsigned long scaled_rt_rp, new_rate;int min_e =-1 , min_e_m =-1 , min_e_n =-1 ; +struct dpll_data *dd;if (!clk || !clk->dpll_data)return ~0 ; + dd = clk->dpll_data; +pr_debug ("clock: starting DPLL round_rate for clock %s, target rate " "%ld\n" , clk->name, target_rate); scaled_rt_rp = target_rate / (clk->parent->rate /DPLL_SCALE_FACTOR ); - scaled_max_m = clk->dpll_data->max_multiplier *DPLL_SCALE_FACTOR ; + scaled_max_m = dd->max_multiplier *DPLL_SCALE_FACTOR ; - clk->dpll_data->last_rounded_rate =0 ; + dd->last_rounded_rate =0 ; -for (n = clk->dpll_data->max_divider; n >=DPLL_MIN_DIVIDER ; n--) { +for (n = dd->max_divider; n >=DPLL_MIN_DIVIDER ; n--) {/* Compute the scaled DPLL multiplier, based on the divider */ m = scaled_rt_rp * n;
@@ -909,7 +912,7 @@ long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate) "(new_rate = %ld)\n", n, m, e, new_rate);if (min_e ==-1 || - min_e >= (int )(abs (e) - clk->dpll_data->rate_tolerance)) { + min_e >= (int )(abs (e) - dd->rate_tolerance)) { min_e = e; min_e_m = m; min_e_n = n;
@@ -932,17 +935,17 @@ long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate)return ~0 ; } - clk->dpll_data->last_rounded_m = min_e_m; - clk->dpll_data->last_rounded_n = min_e_n; - clk->dpll_data->last_rounded_rate = -_dpll_compute_new_rate (clk->parent->rate, min_e_m, min_e_n); + dd->last_rounded_m = min_e_m; + dd->last_rounded_n = min_e_n; + dd->last_rounded_rate =_dpll_compute_new_rate (clk->parent->rate, + min_e_m, min_e_n);pr_debug ("clock: final least error: e = %d, m = %d, n = %d\n" , min_e, min_e_m, min_e_n);pr_debug ("clock: final rate: %ld (target rate: %ld)\n" , - clk->dpll_data->last_rounded_rate, target_rate); + dd->last_rounded_rate, target_rate); -return clk->dpll_data->last_rounded_rate; +return dd->last_rounded_rate; }/*-------------------------------------------------------------------------
Signature · 1 line
1.6.1.2
PATCH 58/86 OMAP3 clock: optimize DPLL rate rounding algorithm
From: Paul Walmsley <[email protected]>
The previous DPLL rate rounding algorithm counted the divider (N) down from the maximum to 1. Since we currently use a broad DPLL rate tolerance, and lower N values are more power-efficient, we can often bypass several iterations through the loop by counting N upwards from 1.
Peter de Schrijver <[email protected]> put up with several test cycles of this patch - thanks Peter.
linux-omap source commit is 6f6d82bb2f80fa20a841ac3e95a6f44a5a156188.
--- arch/arm/mach-omap2/clock.c | 35 ++++++++++++++++++----------------- 1 files changed, 18 insertions(+), 17 deletions(-)
arch/arm/mach-omap2/clock.c +18 -17
@@ -45,7 +45,7 @@#define DPLL_MIN_DIVIDER 1/* Possible error results from _dpll_test_mult */ -#define DPLL_MULT_UNDERFLOW (1 << 0) +#define DPLL_MULT_UNDERFLOW -1/* * Scale factor to mitigate roundoff errors in DPLL rate rounding.
@@ -826,7 +826,7 @@ static int _dpll_test_mult(int *m, int n, unsigned long *new_rate,unsigned long target_rate, unsigned long parent_rate) { - int flags = 0, carry = 0; + int r = 0, carry = 0;/* Unscale m and round if necessary */ if (*m %DPLL_SCALE_FACTOR >=DPLL_ROUNDING_VAL )
@@ -847,13 +847,13 @@ static int _dpll_test_mult(int *m, int n, unsigned long *new_rate,if (*m <DPLL_MIN_MULTIPLIER ) { *m =DPLL_MIN_MULTIPLIER ; *new_rate =0 ; - flags =DPLL_MULT_UNDERFLOW ; + r =DPLL_MULT_UNDERFLOW ; }if (*new_rate ==0 ) *new_rate =_dpll_compute_new_rate (parent_rate, *m, n); -return flags; +return r; }/**
@@ -892,21 +892,27 @@ long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate) dd->last_rounded_rate =0 ; -for (n = dd->max_divider; n >=DPLL_MIN_DIVIDER ; n--) { +for (n =DPLL_MIN_DIVIDER ; n <= dd->max_divider; n++) {/* Compute the scaled DPLL multiplier, based on the divider */ m = scaled_rt_rp * n;/* -* Since we're counting n down, a m overflow means we can -* can immediately skip to the next n +* Since we're counting n up, a m overflow means we +* can bail out completely (since as n increases in +* the next iteration, there's no way that m can +* increase beyond the current m) */ if (m > scaled_max_m) -continue ; +break ; r =_dpll_test_mult (&m, n, &new_rate, target_rate, clk->parent->rate); +/* m can't be set low enough for this n - try with a larger n */ +if (r ==DPLL_MULT_UNDERFLOW ) +continue ; + e = target_rate - new_rate;pr_debug ("clock: n = %d: m = %d: rate error is %d " "(new_rate = %ld)\n" , n, m, e, new_rate);
@@ -918,16 +924,11 @@ long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate) min_e_n = n;pr_debug ("clock: found new least error %d\n" , min_e); - } -/* -* Since we're counting n down, a m underflow means we -* can bail out completely (since as n decreases in -* the next iteration, there's no way that m can -* increase beyond the current m) -*/ -if (r &DPLL_MULT_UNDERFLOW ) -break ; +/* We found good settings -- bail out now */ +if (min_e <= clk->dpll_data->rate_tolerance) +break ; + } }if (min_e <0 ) {
Signature · 1 line
1.6.1.2
PATCH 59/86 OMAP3 clock: avoid invalid FREQSEL values during DPLL rate rounding
From: Paul Walmsley <[email protected]>
The DPLL FREQSEL jitter correction bits are set based on a table in the 34xx TRM, Table 4-38, according to the DPLL's internal clock frequency "Fint." Several Fint frequency ranges are missing from this table. Previously, we allowed these Fint frequency ranges to be selected in the rate rounding code, but did not change the FREQSEL bits. Correspondence with the OMAP hardware team indicates that Fint values not in the table should not be used. So, prevent them from being selected during DPLL rate rounding. This removes warnings and also can prevent the chip from locking up.
The first pass through the rate rounding code will update the DPLL max and min dividers appropriately, so later rate rounding passes will run faster than the first.
Peter de Schrijver <[email protected]> put up with several test cycles of this patch - thanks Peter.
linux-omap source commit is f9c1b82f55b60fc39eaa6e7aa1fbe380c0ffe2e9.
--- arch/arm/mach-omap2/clock.c | 67 ++++++++++++++++++++++++++++++- arch/arm/mach-omap2/clock24xx.h | 1 + arch/arm/mach-omap2/clock34xx.h | 5 ++ arch/arm/plat-omap/include/mach/clock.h | 1 + 4 files changed, 72 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/clock.c +65 -2
@@ -58,12 +58,68 @@#define DPLL_ROUNDING_VAL ((DPLL_SCALE_BASE / 2) * \ (DPLL_SCALE_FACTOR / DPLL_SCALE_BASE)) +/* DPLL valid Fint frequency band limits - from 34xx TRM Section 4.7.6.2 */ +#define DPLL_FINT_BAND1_MIN 750000 +#define DPLL_FINT_BAND1_MAX 2100000 +#define DPLL_FINT_BAND2_MIN 7500000 +#define DPLL_FINT_BAND2_MAX 21000000 + +/* _dpll_test_fint() return codes */ +#define DPLL_FINT_UNDERFLOW -1 +#define DPLL_FINT_INVALID -2 +u8 cpu_mask;/*------------------------------------------------------------------------- * OMAP2/3 specific clock functions *-------------------------------------------------------------------------*/ +/* +* _dpll_test_fint - test whether an Fint value is valid for the DPLL +* @clk: DPLL struct clk to test +* @n: divider value (N) to test +* +* Tests whether a particular divider @n will result in a valid DPLL +* internal clock frequency Fint. See the 34xx TRM 4.7.6.2 "DPLL Jitter +* Correction". Returns 0 if OK, -1 if the enclosing loop can terminate +* (assuming that it is counting N upwards), or -2 if the enclosing loop +* should skip to the next iteration (again assuming N is increasing). +*/ +static int _dpll_test_fint (struct clk *clk,u8 n) +{ +struct dpll_data *dd; +long fint; +int ret =0 ; + + dd = clk->dpll_data; + +/* DPLL divider must result in a valid jitter correction val */ + fint = clk->parent->rate / (n +1 ); +if (fint <DPLL_FINT_BAND1_MIN ) { + +pr_debug ("rejecting n=%d due to Fint failure, " +"lowering max_divider\n" , n); + dd->max_divider = n; + ret =DPLL_FINT_UNDERFLOW ; + + }else if (fint >DPLL_FINT_BAND1_MAX && + fint <DPLL_FINT_BAND2_MIN ) { + +pr_debug ("rejecting n=%d due to Fint failure\n" , n); + ret =DPLL_FINT_INVALID ; + + }else if (fint >DPLL_FINT_BAND2_MAX ) { + +pr_debug ("rejecting n=%d due to Fint failure, " +"boosting min_divider\n" , n); + dd->min_divider = n; + ret =DPLL_FINT_INVALID ; + + } + +return ret; +} +/** * omap2_init_clk_clkdm - look up a clockdomain name, store pointer in clk * @clk: OMAP clock struct ptr to use
@@ -892,7 +948,14 @@ long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate) dd->last_rounded_rate =0 ; -for (n =DPLL_MIN_DIVIDER ; n <= dd->max_divider; n++) { +for (n = dd->min_divider; n <= dd->max_divider; n++) { + +/* Is the (input clk, divider) pair valid for the DPLL? */ + r =_dpll_test_fint (clk, n); +if (r ==DPLL_FINT_UNDERFLOW ) +break ; +else if (r ==DPLL_FINT_INVALID ) +continue ;/* Compute the scaled DPLL multiplier, based on the divider */ m = scaled_rt_rp * n;
@@ -926,7 +989,7 @@ long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate)pr_debug ("clock: found new least error %d\n" , min_e);/* We found good settings -- bail out now */ -if (min_e <= clk->dpll_data->rate_tolerance) +if (min_e <= dd->rate_tolerance)break ; } }
arch/arm/mach-omap2/clock24xx.h +1 -0
@@ -666,6 +666,7 @@ static struct dpll_data dpll_dd = { .mult_mask = OMAP24XX_DPLL_MULT_MASK, .div1_mask = OMAP24XX_DPLL_DIV_MASK, .max_multiplier = 1024, + .min_divider = 1, .max_divider = 16, .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE };
arch/arm/mach-omap2/clock34xx.h +5 -0
@@ -268,6 +268,7 @@ static struct dpll_data dpll1_dd = { .idlest_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL), .idlest_mask = OMAP3430_ST_MPU_CLK_MASK, .max_multiplier = OMAP3_MAX_DPLL_MULT, + .min_divider = 1, .max_divider = OMAP3_MAX_DPLL_DIV, .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE };
@@ -341,6 +342,7 @@ static struct dpll_data dpll2_dd = { .idlest_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_IDLEST_PLL), .idlest_mask = OMAP3430_ST_IVA2_CLK_MASK, .max_multiplier = OMAP3_MAX_DPLL_MULT, + .min_divider = 1, .max_divider = OMAP3_MAX_DPLL_DIV, .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE };
@@ -400,6 +402,7 @@ static struct dpll_data dpll3_dd = { .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), .idlest_mask = OMAP3430_ST_CORE_CLK_MASK, .max_multiplier = OMAP3_MAX_DPLL_MULT, + .min_divider = 1, .max_divider = OMAP3_MAX_DPLL_DIV, .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE };
@@ -591,6 +594,7 @@ static struct dpll_data dpll4_dd = { .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), .idlest_mask = OMAP3430_ST_PERIPH_CLK_MASK, .max_multiplier = OMAP3_MAX_DPLL_MULT, + .min_divider = 1, .max_divider = OMAP3_MAX_DPLL_DIV, .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE };
@@ -930,6 +934,7 @@ static struct dpll_data dpll5_dd = { .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST2), .idlest_mask = OMAP3430ES2_ST_PERIPH2_CLK_MASK, .max_multiplier = OMAP3_MAX_DPLL_MULT, + .min_divider = 1, .max_divider = OMAP3_MAX_DPLL_DIV, .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE };
arch/arm/plat-omap/include/mach/clock.h +1 -0
@@ -43,6 +43,7 @@ struct dpll_data {unsigned long last_rounded_rate;u16 last_rounded_m;u8 last_rounded_n; +u8 min_divider;u8 max_divider;u32 max_tolerance;u16 max_multiplier;
Signature · 1 line
1.6.1.2
PATCH 60/86 OMAP3 clock: disable DPLL autoidle while waiting for DPLL to lock
From: Paul Walmsley <[email protected]>
During _omap3_noncore_dpll_lock(), if a DPLL has no active downstream clocks and DPLL autoidle is enabled, the DPLL may never lock, since it will enter autoidle immediately. To resolve this, disable DPLL autoidle while locking the DPLL, and unconditionally wait for the DPLL to lock. This fixes some bugs where the kernel would hang when returning from retention or return the wrong rate for the DPLL.
This patch is a collaboration with Peter de Schrijver <[email protected]> and Kevin Hilman <[email protected]>.
linux-omap source commit is 3b7de4be879f1f4f55ae59882a5cbd80f6dcf0f0.
--- arch/arm/mach-omap2/clock34xx.c | 15 +++++---------- 1 files changed, 5 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/clock34xx.c +5 -10
@@ -398,19 +398,14 @@ static int _omap3_noncore_dpll_lock(struct clk *clk) ai =omap3_dpll_autoidle_read (clk); +omap3_dpll_deny_idle (clk); +_omap3_dpll_write_clken (clk,DPLL_LOCKED ); -if (ai) { -/* -* If no downstream clocks are enabled, CM_IDLEST bit -* may never become active, so don't wait for DPLL to lock. -*/ - r =0 ; + r =_omap3_wait_dpll_status (clk,1 ); + +if (ai)omap3_dpll_allow_idle (clk); - }else { - r =_omap3_wait_dpll_status (clk,1 ); -omap3_dpll_deny_idle (clk); - };return r; }
Signature · 1 line
1.6.1.2
PATCH 61/86 OMAP2/3 clock: clean up mach-omap2/clock.c
From: Paul Walmsley <[email protected]>
This patch rolls up several cleanup patches.
1. Some unnecessarily verbose variable names are used in several clock.c functions; clean these up per CodingStyle.
2. Remove omap2_get_clksel() and just use clk->clksel_reg and clk->clksel_mask directly.
3. Get rid of void __iomem * usage in omap2_clksel_get_src_field. Prepend the function name with an underscore to highlight that it is a static function.
linux-omap source commits are 7fa95e007ea2f3c4d0ecd2779d809756e7775894, af0ea23f1ee4a5bea3b026e38761b47089f9048a, and 91c0c979b47c44b08f80e4f8d4c990fb158d82c4.
--- arch/arm/mach-omap2/clock.c | 98 +++++++++++++++--------------------------- 1 files changed, 35 insertions(+), 63 deletions(-)
arch/arm/mach-omap2/clock.c +35 -63
@@ -298,7 +298,7 @@ static void omap2_clk_wait_ready(struct clk *clk)static int omap2_dflt_clk_enable (struct clk *clk) { -u32 regval32; +u32 v;if (unlikely (clk->enable_reg ==NULL )) { printk(KERN_ERR "clock.c: Enable for %s without enable code\n",
@@ -306,12 +306,12 @@ static int omap2_dflt_clk_enable(struct clk *clk)return 0 ;/* REVISIT: -EINVAL */ } - regval32 =__raw_readl (clk->enable_reg); + v =__raw_readl (clk->enable_reg);if (clk->flags &INVERT_ENABLE ) - regval32 &= ~(1 << clk->enable_bit); + v &= ~(1 << clk->enable_bit);else - regval32 |= (1 << clk->enable_bit); -__raw_writel (regval32, clk->enable_reg); + v |= (1 << clk->enable_bit); +__raw_writel (v, clk->enable_reg);wmb ();return 0 ;
@@ -335,7 +335,7 @@ static int omap2_dflt_clk_enable_wait(struct clk *clk)static void omap2_dflt_clk_disable (struct clk *clk) { -u32 regval32; +u32 v;if (!clk->enable_reg) {/*
@@ -347,12 +347,12 @@ static void omap2_dflt_clk_disable(struct clk *clk)return ; } - regval32 =__raw_readl (clk->enable_reg); + v =__raw_readl (clk->enable_reg);if (clk->flags &INVERT_ENABLE ) - regval32 |= (1 << clk->enable_bit); + v |= (1 << clk->enable_bit);else - regval32 &= ~(1 << clk->enable_bit); -__raw_writel (regval32, clk->enable_reg); + v &= ~(1 << clk->enable_bit); +__raw_writel (v, clk->enable_reg);wmb (); }
@@ -644,23 +644,6 @@ u32 omap2_divisor_to_clksel(struct clk *clk, u32 div) }/** -* omap2_get_clksel - find clksel register addr & field mask for a clk -* @clk: struct clk to use -* @field_mask: ptr to u32 to store the register field mask -* -* Returns the address of the clksel register upon success or NULL on error. -*/ -static void __iomem *omap2_get_clksel (struct clk *clk,u32 *field_mask) -{ -if (!clk->clksel_reg || (clk->clksel_mask ==0 )) -return NULL ; - - *field_mask = clk->clksel_mask; - -return clk->clksel_reg; -} - -/** * omap2_clksel_get_divisor - get current divider applied to parent clock. * @clk: OMAP struct clk to use. *
@@ -668,40 +651,36 @@ static void __iomem *omap2_get_clksel(struct clk *clk, u32 *field_mask)*/ u32 omap2_clksel_get_divisor (struct clk *clk) { -u32 field_mask, field_val; -void __iomem *div_addr; +u32 v; - div_addr =omap2_get_clksel (clk, &field_mask); -if (!div_addr) +if (!clk->clksel_mask)return 0 ; - field_val =__raw_readl (div_addr) & field_mask; - field_val >>=__ffs (field_mask); + v =__raw_readl (clk->clksel_reg) & clk->clksel_mask; + v >>=__ffs (clk->clksel_mask); -return omap2_clksel_to_divisor (clk, field_val); +return omap2_clksel_to_divisor (clk, v); }int omap2_clksel_set_rate (struct clk *clk,unsigned long rate) { -u32 field_mask, field_val, reg_val, validrate, new_div =0 ; -void __iomem *div_addr; +u32 v, field_val, validrate, new_div =0 ; - validrate =omap2_clksel_round_rate_div (clk, rate, &new_div); -if (validrate != rate) +if (!clk->clksel_mask)return -EINVAL ; - div_addr =omap2_get_clksel (clk, &field_mask); -if (!div_addr) + validrate =omap2_clksel_round_rate_div (clk, rate, &new_div); +if (validrate != rate)return -EINVAL ; field_val =omap2_divisor_to_clksel (clk, new_div);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 (clk->clksel_reg); + v &= ~clk->clksel_mask; + v |= field_val <<__ffs (clk->clksel_mask); +__raw_writel (v, clk->clksel_reg);wmb (); clk->rate = clk->parent->rate / new_div;
@@ -737,18 +716,14 @@ int omap2_clk_set_rate(struct clk *clk, unsigned long rate)/* * Converts encoded control register address into a full address -* On error, *src_addr will be returned as 0. +* On error, the return value (parent_div) will be 0. */ -static u32 omap2_clksel_get_src_field (void __iomem **src_addr, -struct clk *src_clk,u32 *field_mask, -struct clk *clk,u32 *parent_div) +static u32 _omap2_clksel_get_src_field (struct clk *src_clk,struct clk *clk, +u32 *field_val) {const struct clksel *clks;const struct clksel_rate *clkr; - *parent_div =0 ; - *src_addr =NULL ; - clks =omap2_get_clksel_by_parent (clk, src_clk);if (!clks)return 0 ;
@@ -768,17 +743,14 @@ static u32 omap2_clksel_get_src_field(void __iomem **src_addr,/* Should never happen. Add a clksel mask to the struct clk. */ WARN_ON (clk->clksel_mask ==0 ); - *field_mask = clk->clksel_mask; - *src_addr = clk->clksel_reg; - *parent_div = clkr->div; + *field_val = clkr->val; -return clkr->val; +return clkr->div; }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; +u32 field_val, v, parent_div;if (clk->flags &CONFIG_PARTICIPANT )return -EINVAL ;
@@ -786,18 +758,18 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)if (!clk->clksel)return -EINVAL ; - field_val =omap2_clksel_get_src_field (&src_addr, new_parent, - &field_mask, clk, &parent_div); -if (!src_addr) + parent_div =_omap2_clksel_get_src_field (new_parent, clk, &field_val); +if (!parent_div)return -EINVAL ;if (clk->usecount >0 )_omap2_clk_disable (clk);/* Set new source value (previous dividers if any in effect) */ - reg_val =__raw_readl (src_addr) & ~field_mask; - reg_val |= (field_val <<__ffs (field_mask)); -__raw_writel (reg_val, src_addr); + v =__raw_readl (clk->clksel_reg); + v &= ~clk->clksel_mask; + v |= field_val <<__ffs (clk->clksel_mask); +__raw_writel (v, clk->clksel_reg);wmb ();if (clk->flags &DELAYED_APP &&cpu_is_omap24xx ()) {
Signature · 1 line
1.6.1.2
PATCH 62/86 OMAP34XX: Add miscellaneous definitions related to 34xx
From: Jouni Hogander <[email protected]>
--- arch/arm/mach-omap2/cm-regbits-34xx.h | 7 +++++++ arch/arm/mach-omap2/prm-regbits-34xx.h | 9 +++++++++ arch/arm/mach-omap2/prm.h | 24 +++++++++++++----------- 3 files changed, 29 insertions(+), 11 deletions(-)
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/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 +13 -11
@@ -141,6 +141,19 @@#define PM_PWSTCTRL 0x00e0#define PM_PWSTST 0x00e4 +/* Omap2 specific registers */ +#define OMAP24XX_PM_WKEN2 0x00a4 +#define OMAP24XX_PM_WKST2 0x00b4 + +#define OMAP24XX_PRCM_IRQSTATUS_DSP 0x00f0/* IVA mod */ +#define OMAP24XX_PRCM_IRQENABLE_DSP 0x00f4/* IVA mod */ +#define OMAP24XX_PRCM_IRQSTATUS_IVA 0x00f8 +#define OMAP24XX_PRCM_IRQENABLE_IVA 0x00fc + +/* Omap3 specific registers */ +#define OMAP3430ES2_PM_WKEN3 0x00f0 +#define OMAP3430ES2_PM_WKST3 0x00b8 +#define OMAP3430_PM_MPUGRPSEL 0x00a4#define OMAP3430_PM_MPUGRPSEL1 OMAP3430_PM_MPUGRPSEL
@@ -153,16 +166,6 @@#define OMAP3430_PRM_IRQENABLE_IVA2 0x00fc -/* Architecture-specific registers */ - -#define OMAP24XX_PM_WKEN2 0x00a4 -#define OMAP24XX_PM_WKST2 0x00b4 - -#define OMAP24XX_PRCM_IRQSTATUS_DSP 0x00f0/* IVA mod */ -#define OMAP24XX_PRCM_IRQENABLE_DSP 0x00f4/* IVA mod */ -#define OMAP24XX_PRCM_IRQSTATUS_IVA 0x00f8 -#define OMAP24XX_PRCM_IRQENABLE_IVA 0x00fc -#ifndef __ASSEMBLER__/* Power/reset management domain register get/set */
@@ -228,7 +231,6 @@ static inline u32 prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)#define OMAP_RSTTIME1_SHIFT 0#define OMAP_RSTTIME1_MASK (0xff << 0) -/* PRM_RSTCTRL */ /* Named RM_RSTCTRL_WKUP on the 24xx */ /* 2420 calls RST_DPLL3 'RST_DPLL' */
Signature · 1 line
1.6.1.2
PATCH 63/86 OMAP2 PRCM: clean up CM_IDLEST bits
From: Paul Walmsley <[email protected]>
This patch fixes a few OMAP2xxx CM_IDLEST bits that were incorrectly marked as being OMAP2xxx-wide, when they were actually 2420-specific.
Also, originally when the PRCM register macros were defined, bit shift macros used a "_SHIFT" suffix, and mask macros used none. This became a source of bugs and confusion, as the mask macros were mistakenly used for shift values. Gradually, the mask macros have been updated, piece by piece, to add a "_MASK" suffix on the end to clarify. This patch applies this change to the CM_IDLEST_* register bits.
The patch also adds a few bits that were missing, mostly from the 3430ES1 to ES2 revisions.
linux-omap source commits are d18eff5b5fa15e170794397a6a94486d1f774f77, e1f1a5cc24615fb790cc763c96d1c5cfe6296f5b, and part of 9fe6b6cf8d9e0cbb429fd64553a4b3160a9e99e1
--- arch/arm/mach-omap2/cm-regbits-24xx.h | 80 +++++++++----- arch/arm/mach-omap2/cm-regbits-34xx.h | 96 ++++++++++++---- arch/arm/mach-omap2/prcm-common.h | 198 ++++++++++++++++++++++----------- 3 files changed, 257 insertions(+), 117 deletions(-)
arch/arm/mach-omap2/cm-regbits-24xx.h +53 -27
@@ -110,35 +110,56 @@#define OMAP24XX_EN_DES (1 << 0)/* CM_IDLEST1_CORE specific bits */ -#define OMAP24XX_ST_MAILBOXES (1 << 30) -#define OMAP24XX_ST_WDT4 (1 << 29) -#define OMAP2420_ST_WDT3 (1 << 28) -#define OMAP24XX_ST_MSPRO (1 << 27) -#define OMAP24XX_ST_FAC (1 << 25) -#define OMAP2420_ST_EAC (1 << 24) -#define OMAP24XX_ST_HDQ (1 << 23) -#define OMAP24XX_ST_I2C2 (1 << 20) -#define OMAP24XX_ST_I2C1 (1 << 19) -#define OMAP24XX_ST_MCBSP2 (1 << 16) -#define OMAP24XX_ST_MCBSP1 (1 << 15) -#define OMAP24XX_ST_DSS (1 << 0) +#define OMAP24XX_ST_MAILBOXES_SHIFT 30 +#define OMAP24XX_ST_MAILBOXES_MASK (1 << 30) +#define OMAP24XX_ST_WDT4_SHIFT 29 +#define OMAP24XX_ST_WDT4_MASK (1 << 29) +#define OMAP2420_ST_WDT3_SHIFT 28 +#define OMAP2420_ST_WDT3_MASK (1 << 28) +#define OMAP24XX_ST_MSPRO_SHIFT 27 +#define OMAP24XX_ST_MSPRO_MASK (1 << 27) +#define OMAP24XX_ST_FAC_SHIFT 25 +#define OMAP24XX_ST_FAC_MASK (1 << 25) +#define OMAP2420_ST_EAC_SHIFT 24 +#define OMAP2420_ST_EAC_MASK (1 << 24) +#define OMAP24XX_ST_HDQ_SHIFT 23 +#define OMAP24XX_ST_HDQ_MASK (1 << 23) +#define OMAP2420_ST_I2C2_SHIFT 20 +#define OMAP2420_ST_I2C2_MASK (1 << 20) +#define OMAP2420_ST_I2C1_SHIFT 19 +#define OMAP2420_ST_I2C1_MASK (1 << 19) +#define OMAP24XX_ST_MCBSP2_SHIFT 16 +#define OMAP24XX_ST_MCBSP2_MASK (1 << 16) +#define OMAP24XX_ST_MCBSP1_SHIFT 15 +#define OMAP24XX_ST_MCBSP1_MASK (1 << 15) +#define OMAP24XX_ST_DSS_SHIFT 0 +#define OMAP24XX_ST_DSS_MASK (1 << 0)/* CM_IDLEST2_CORE */ -#define OMAP2430_ST_MCBSP5 (1 << 5) -#define OMAP2430_ST_MCBSP4 (1 << 4) -#define OMAP2430_ST_MCBSP3 (1 << 3) -#define OMAP24XX_ST_SSI (1 << 1) +#define OMAP2430_ST_MCBSP5_SHIFT 5 +#define OMAP2430_ST_MCBSP5_MASK (1 << 5) +#define OMAP2430_ST_MCBSP4_SHIFT 4 +#define OMAP2430_ST_MCBSP4_MASK (1 << 4) +#define OMAP2430_ST_MCBSP3_SHIFT 3 +#define OMAP2430_ST_MCBSP3_MASK (1 << 3) +#define OMAP24XX_ST_SSI_SHIFT 1 +#define OMAP24XX_ST_SSI_MASK (1 << 1)/* CM_IDLEST3_CORE */ /* 2430 only */ -#define OMAP2430_ST_SDRC (1 << 2) +#define OMAP2430_ST_SDRC_MASK (1 << 2)/* CM_IDLEST4_CORE */ -#define OMAP24XX_ST_PKA (1 << 4) -#define OMAP24XX_ST_AES (1 << 3) -#define OMAP24XX_ST_RNG (1 << 2) -#define OMAP24XX_ST_SHA (1 << 1) -#define OMAP24XX_ST_DES (1 << 0) +#define OMAP24XX_ST_PKA_SHIFT 4 +#define OMAP24XX_ST_PKA_MASK (1 << 4) +#define OMAP24XX_ST_AES_SHIFT 3 +#define OMAP24XX_ST_AES_MASK (1 << 3) +#define OMAP24XX_ST_RNG_SHIFT 2 +#define OMAP24XX_ST_RNG_MASK (1 << 2) +#define OMAP24XX_ST_SHA_SHIFT 1 +#define OMAP24XX_ST_SHA_MASK (1 << 1) +#define OMAP24XX_ST_DES_SHIFT 0 +#define OMAP24XX_ST_DES_MASK (1 << 0)/* CM_AUTOIDLE1_CORE */ #define OMAP24XX_AUTO_CAM (1 << 31)
@@ -275,11 +296,16 @@#define OMAP24XX_EN_32KSYNC (1 << 1)/* CM_IDLEST_WKUP specific bits */ -#define OMAP2430_ST_ICR (1 << 6) -#define OMAP24XX_ST_OMAPCTRL (1 << 5) -#define OMAP24XX_ST_WDT1 (1 << 4) -#define OMAP24XX_ST_MPU_WDT (1 << 3) -#define OMAP24XX_ST_32KSYNC (1 << 1) +#define OMAP2430_ST_ICR_SHIFT 6 +#define OMAP2430_ST_ICR_MASK (1 << 6) +#define OMAP24XX_ST_OMAPCTRL_SHIFT 5 +#define OMAP24XX_ST_OMAPCTRL_MASK (1 << 5) +#define OMAP24XX_ST_WDT1_SHIFT 4 +#define OMAP24XX_ST_WDT1_MASK (1 << 4) +#define OMAP24XX_ST_MPU_WDT_SHIFT 3 +#define OMAP24XX_ST_MPU_WDT_MASK (1 << 3) +#define OMAP24XX_ST_32KSYNC_SHIFT 1 +#define OMAP24XX_ST_32KSYNC_MASK (1 << 1)/* CM_AUTOIDLE_WKUP */ #define OMAP24XX_AUTO_OMAPCTRL (1 << 5)
arch/arm/mach-omap2/cm-regbits-34xx.h +71 -25
146 lines not on this page · raw message
arch/arm/mach-omap2/prcm-common.h +133 -65
232 lines not on this page · raw message
Signature · 1 line
1.6.1.2
PATCH 64/86 omap: Fix omap1 clock issues
From: Tony Lindgren <[email protected]>
This fixes booting, and is a step toward fixing things properly:
- Make enable_reg u32 instead of u16
[rmk: virtual addresses are void __iomem *, not u32]
- Get rid of VIRTUAL_IO_ADDRESS for clocks
- Use __raw_read/write instead of omap_read/write for clock registers
This patch adds a bunch of compile warnings until omap1 clock also uses offsets.
linux-omap source commit is 9d1dff8638c9e96a401e1885f9948662e9ff9636.
--- arch/arm/mach-omap1/clock.c | 77 +++++++++--------------------- arch/arm/mach-omap1/clock.h | 63 ++++++++++++------------- arch/arm/plat-omap/include/mach/clock.h | 1 - 3 files changed, 53 insertions(+), 88 deletions(-)
arch/arm/mach-omap1/clock.c +23 -54
@@ -163,7 +163,7 @@ static void omap1_watchdog_recalc(struct clk * clk)static void omap1_uart_recalc (struct clk * clk) { -unsigned int val =omap_readl (clk->enable_reg); +unsigned int val =__raw_readl (clk->enable_reg);if (val & clk->enable_bit) clk->rate =48000000 ;else
@@ -517,14 +517,14 @@ static int omap1_set_uart_rate(struct clk * clk, unsigned long rate) {unsigned int val; - val =omap_readl (clk->enable_reg); + val =__raw_readl (clk->enable_reg);if (rate ==12000000 ) val &= ~(1 << clk->enable_bit);else if (rate ==48000000 ) val |= (1 << clk->enable_bit);else return -EINVAL ; -omap_writel (val, clk->enable_reg); +__raw_writel (val, clk->enable_reg); clk->rate = rate;return 0 ;
@@ -543,8 +543,8 @@ static int omap1_set_ext_clk_rate(struct clk * clk, unsigned long rate)else ratio_bits = (dsor -2 ) <<2 ; - ratio_bits |=omap_readw (clk->enable_reg) & ~0xfd ; -omap_writew (ratio_bits, clk->enable_reg); + ratio_bits |=__raw_readw (clk->enable_reg) & ~0xfd ; +__raw_writew (ratio_bits, clk->enable_reg);return 0 ; }
@@ -583,8 +583,8 @@ static void omap1_init_ext_clk(struct clk * clk)__u16 ratio_bits;/* Determine current rate and ensure clock is based on 96MHz APLL */ - ratio_bits =omap_readw (clk->enable_reg) & ~1 ; -omap_writew (ratio_bits, clk->enable_reg); + ratio_bits =__raw_readw (clk->enable_reg) & ~1 ; +__raw_writew (ratio_bits, clk->enable_reg); ratio_bits = (ratio_bits &0xfc ) >>2 ;if (ratio_bits >6 )
@@ -646,25 +646,13 @@ static int omap1_clk_enable_generic(struct clk *clk) }if (clk->flags &ENABLE_REG_32BIT ) { -if (clk->flags &VIRTUAL_IO_ADDRESS ) { - regval32 =__raw_readl (clk->enable_reg); - regval32 |= (1 << clk->enable_bit); -__raw_writel (regval32, clk->enable_reg); - }else { - regval32 =omap_readl (clk->enable_reg); - regval32 |= (1 << clk->enable_bit); -omap_writel (regval32, clk->enable_reg); - } + regval32 =__raw_readl (clk->enable_reg); + regval32 |= (1 << clk->enable_bit); +__raw_writel (regval32, clk->enable_reg); }else { -if (clk->flags &VIRTUAL_IO_ADDRESS ) { - regval16 =__raw_readw (clk->enable_reg); - regval16 |= (1 << clk->enable_bit); -__raw_writew (regval16, clk->enable_reg); - }else { - regval16 =omap_readw (clk->enable_reg); - regval16 |= (1 << clk->enable_bit); -omap_writew (regval16, clk->enable_reg); - } + regval16 =__raw_readw (clk->enable_reg); + regval16 |= (1 << clk->enable_bit); +__raw_writew (regval16, clk->enable_reg); }return 0 ;
@@ -679,25 +667,13 @@ static void omap1_clk_disable_generic(struct clk *clk)return ;if (clk->flags &ENABLE_REG_32BIT ) { -if (clk->flags &VIRTUAL_IO_ADDRESS ) { - regval32 =__raw_readl (clk->enable_reg); - regval32 &= ~(1 << clk->enable_bit); -__raw_writel (regval32, clk->enable_reg); - }else { - regval32 =omap_readl (clk->enable_reg); - regval32 &= ~(1 << clk->enable_bit); -omap_writel (regval32, clk->enable_reg); - } + regval32 =__raw_readl (clk->enable_reg); + regval32 &= ~(1 << clk->enable_bit); +__raw_writel (regval32, clk->enable_reg); }else { -if (clk->flags &VIRTUAL_IO_ADDRESS ) { - regval16 =__raw_readw (clk->enable_reg); - regval16 &= ~(1 << clk->enable_bit); -__raw_writew (regval16, clk->enable_reg); - }else { - regval16 =omap_readw (clk->enable_reg); - regval16 &= ~(1 << clk->enable_bit); -omap_writew (regval16, clk->enable_reg); - } + regval16 =__raw_readw (clk->enable_reg); + regval16 &= ~(1 << clk->enable_bit); +__raw_writew (regval16, clk->enable_reg); } }
@@ -745,17 +721,10 @@ static void __init omap1_clk_disable_unused(struct clk *clk) }/* Is the clock already disabled? */ -if (clk->flags &ENABLE_REG_32BIT ) { -if (clk->flags &VIRTUAL_IO_ADDRESS ) - regval32 =__raw_readl (clk->enable_reg); -else - regval32 =omap_readl (clk->enable_reg); - }else { -if (clk->flags &VIRTUAL_IO_ADDRESS ) - regval32 =__raw_readw (clk->enable_reg); -else - regval32 =omap_readw (clk->enable_reg); - } +if (clk->flags &ENABLE_REG_32BIT ) + regval32 =__raw_readl (clk->enable_reg); +else + regval32 =__raw_readw (clk->enable_reg);if ((regval32 & (1 << clk->enable_bit)) ==0 )return ;
arch/arm/mach-omap1/clock.h +30 -33
255 lines not on this page · raw message
arch/arm/plat-omap/include/mach/clock.h +0 -1
@@ -134,7 +134,6 @@ extern const struct clkops clkops_null;#define RATE_PROPAGATES (1 << 2)/* Program children too */ /* bits 3-4 are free */ #define ENABLE_REG_32BIT (1 << 5)/* Use 32-bit access */ -#define VIRTUAL_IO_ADDRESS (1 << 6)/* Clock in virtual address */ #define CLOCK_IDLE_CONTROL (1 << 7)#define CLOCK_NO_IDLE_PARENT (1 << 8)#define DELAYED_APP (1 << 9)/* Delay application of clock */
Signature · 1 line
1.6.1.2
PATCH 65/86 OMAP2 SDRC: move mach-omap2/memory.h into mach/sdrc.h
From: Paul Walmsley <[email protected]>
Move the contents of the arch/arm/mach-omap2/memory.h file to the existing mach/sdrc.h file, and remove memory.h. Modify files which include memory.h to include asm/arch/sdrc.h instead.
linux-omap source commit is e7ae2d89921372fc4b9712a32cc401d645597807.
--- arch/arm/mach-omap2/clock.c | 2 +- arch/arm/mach-omap2/clock24xx.c | 2 +- arch/arm/mach-omap2/clock34xx.c | 2 +- arch/arm/mach-omap2/io.c | 4 +- arch/arm/mach-omap2/memory.c | 9 ++++++- arch/arm/mach-omap2/memory.h | 43 -------------------------------- arch/arm/plat-omap/include/mach/gpmc.h | 2 +- arch/arm/plat-omap/include/mach/sdrc.h | 21 +++++++++++++++ 8 files changed, 35 insertions(+), 50 deletions(-) delete mode 100644 arch/arm/mach-omap2/memory.h
arch/arm/mach-omap2/clock.c +1 -1
@@ -29,7 +29,7 @@#include <mach/cpu.h> #include <asm/div64.h> -#include "memory.h" +#include <mach/sdrc.h> #include "sdrc.h" #include "clock.h" #include "prm.h"
arch/arm/mach-omap2/clock24xx.c +1 -1
@@ -33,7 +33,7 @@#include <asm/div64.h> #include <asm/clkdev.h> -#include "memory.h" +#include <mach/sdrc.h> #include "clock.h" #include "prm.h" #include "prm-regbits-24xx.h"
arch/arm/mach-omap2/clock34xx.c +1 -1
@@ -32,7 +32,7 @@#include <asm/div64.h> #include <asm/clkdev.h> -#include "memory.h" +#include <mach/sdrc.h> #include "clock.h" #include "prm.h" #include "prm-regbits-34xx.h"
arch/arm/mach-omap2/io.c +2 -2
@@ -27,8 +27,8 @@#include <mach/mux.h> #include <mach/omapfb.h> #include <mach/sram.h> - -#include "memory.h" +#include <mach/sdrc.h> +#include <mach/gpmc.h> #include "clock.h"
arch/arm/mach-omap2/memory.c +8 -1
@@ -29,9 +29,16 @@#include "prm.h" -#include "memory.h" +#include <mach/sdrc.h> #include "sdrc.h" +/* Memory timing, DLL mode flags */ +#define M_DDR 1 +#define M_LOCK_CTRL (1 << 2) +#define M_UNLOCK 0 +#define M_LOCK 1 + +void __iomem *omap2_sdrc_base;void __iomem *omap2_sms_base;
arch/arm/mach-omap2/memory.h deleted +0 -43
43 lines not on this page · raw message
arch/arm/plat-omap/include/mach/gpmc.h +1 -1
@@ -103,6 +103,6 @@ extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base);extern void gpmc_cs_free (int cs);extern int gpmc_cs_set_reserved (int cs,int reserved);extern int gpmc_cs_reserved (int cs); -extern void gpmc_init (void ); +extern void __init gpmc_init (void );#endif
arch/arm/plat-omap/include/mach/sdrc.h +21 -0
@@ -74,4 +74,25 @@#define SMS_SYSCONFIG 0x010/* REVISIT: fill in other SMS registers here */ +#ifndef __ASSEMBLER__ + +struct memory_timings { +u32 m_type;/* ddr = 1, sdr = 0 */ +u32 dll_mode;/* use lock mode = 1, unlock mode = 0 */ +u32 slow_dll_ctrl;/* unlock mode, dll value for slow speed */ +u32 fast_dll_ctrl;/* unlock mode, dll value for fast speed */ +u32 base_cs;/* base chip select to use for calculations */ +}; + +extern void omap2_init_memory_params (u32 force_lock_to_unlock_mode); +extern u32 omap2_memory_get_slow_dll_ctrl (void ); +extern u32 omap2_memory_get_fast_dll_ctrl (void ); +extern u32 omap2_memory_get_type (void ); +u32 omap2_dll_force_needed (void ); +u32 omap2_reprogram_sdrc (u32 level,u32 force); +void __init omap2_init_memory (void ); + +#endif + +#endif
Signature · 1 line
1.6.1.2
PATCH 66/86 OMAP2 SDRC: rename memory.c to sdrc2xxx.c
From: Paul Walmsley <[email protected]>
Rename arch/arm/mach-omap2/memory.c to arch/arm/mach-omap2/sdrc2xxx.c, since it contains exclusively SDRAM-related functions. Most of the functions are also OMAP2xxx-specific - those which are common will be separated out in a following patch.
linux-omap source commit is fe212f797e2efef9dc88bcb5db7cf9db3f9f562e.
--- arch/arm/mach-omap2/Makefile | 2 +- arch/arm/mach-omap2/memory.c | 198 ---------------------------------------- arch/arm/mach-omap2/sdrc2xxx.c | 198 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 199 insertions(+), 199 deletions(-) delete mode 100644 arch/arm/mach-omap2/memory.c create mode 100644 arch/arm/mach-omap2/sdrc2xxx.c
arch/arm/mach-omap2/Makefile +1 -1
@@ -3,7 +3,7 @@ # # Common support -obj-y := irq.o id.o io.o memory.o control.o prcm.o clock.o mux.o \ +obj-y := irq.o id.o io.o sdrc2xxx.o control.o prcm.o clock.o mux.o \ devices.o serial.o gpmc.o timer-gp.o powerdomain.o \ clockdomain.o
arch/arm/mach-omap2/memory.c deleted +0 -198
198 lines not on this page · raw message
arch/arm/mach-omap2/sdrc2xxx.c new file +198 -0
198 lines not on this page · raw message
Signature · 1 line
1.6.1.2
PATCH 67/86 OMAP2 SDRC: separate common OMAP2/3 code from OMAP2xxx code
From: Paul Walmsley <[email protected]>
Separate SDRC code common to OMAP2/3 from mach-omap2/sdrc2xxx.c to mach-omap2/sdrc.c. Rename the OMAP2xxx-specific functions to use an 'omap2xxx' prefix rather than an 'omap2' prefix, and use "sdrc" in the function names rather than "memory." Mark several functions as static that should not be used outside the sdrc2xxx.c file.
linux-omap source commit is bf1612b9d8d29379558500cd5de9ae0367c41fc4.
--- arch/arm/mach-omap2/Makefile | 6 ++- arch/arm/mach-omap2/clock24xx.c | 23 +++++----- arch/arm/mach-omap2/io.c | 2 +- arch/arm/mach-omap2/sdrc.c | 57 +++++++++++++++++++++++++ arch/arm/mach-omap2/sdrc2xxx.c | 67 +++++++---------------------- arch/arm/plat-omap/common.c | 2 +- arch/arm/plat-omap/include/mach/common.h | 2 +- arch/arm/plat-omap/include/mach/sdrc.h | 37 ++++++++++------- 8 files changed, 115 insertions(+), 81 deletions(-) create mode 100644 arch/arm/mach-omap2/sdrc.c
arch/arm/mach-omap2/Makefile +5 -1
@@ -3,7 +3,7 @@ # # Common support -obj-y := irq.o id.o io.o sdrc2xxx.o control.o prcm.o clock.o mux.o \ +obj-y := irq.o id.o io.o sdrc.o control.o prcm.o clock.o mux.o \ devices.o serial.o gpmc.o timer-gp.o powerdomain.o \ clockdomain.o
@@ -14,6 +14,10 @@ obj-$(CONFIG_ARCH_OMAP2420) += sram242x.o obj-$(CONFIG_ARCH_OMAP2430) += sram243x.o obj-$(CONFIG_ARCH_OMAP3) += sram34xx.o +# SMS/SDRC +obj-$(CONFIG_ARCH_OMAP2) += sdrc2xxx.o +# obj-$(CONFIG_ARCH_OMAP3) += sdrc3xxx.o + # Power Management ifeq ($(CONFIG_PM),y) obj-y += pm.o
arch/arm/mach-omap2/clock24xx.c +12 -11
@@ -389,9 +389,9 @@ static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate) mult &=OMAP24XX_CORE_CLK_SRC_MASK ;if ((rate == (cur_rate /2 )) && (mult ==2 )) { -omap2_reprogram_sdrc (CORE_CLK_SRC_DPLL ,1 ); +omap2xxx_sdrc_reprogram (CORE_CLK_SRC_DPLL ,1 ); }else if ((rate == (cur_rate *2 )) && (mult ==1 )) { -omap2_reprogram_sdrc (CORE_CLK_SRC_DPLL_X2 ,1 ); +omap2xxx_sdrc_reprogram (CORE_CLK_SRC_DPLL_X2 ,1 ); }else if (rate != cur_rate) { valid_rate =omap2_dpllcore_round_rate (rate);if (valid_rate != rate)
@@ -430,15 +430,16 @@ static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)if (rate == curr_prcm_set->xtal_speed)/* If asking for 1-1 */ bypass =1 ; -omap2_reprogram_sdrc (CORE_CLK_SRC_DPLL_X2 ,1 );/* For init_mem */ +/* For omap2xxx_sdrc_init_params() */ +omap2xxx_sdrc_reprogram (CORE_CLK_SRC_DPLL_X2 ,1 );/* Force dll lock mode */ omap2_set_prcm (tmpset.cm_clksel1_pll, tmpset.base_sdrc_rfr, bypass);/* Errata: ret dll entry state */ -omap2_init_memory_params (omap2_dll_force_needed ()); -omap2_reprogram_sdrc (done_rate,0 ); +omap2xxx_sdrc_init_params (omap2xxx_sdrc_dll_is_unlocked ()); +omap2xxx_sdrc_reprogram (done_rate,0 ); }omap2_dpllcore_recalc (&dpll_ck); ret =0 ;
@@ -525,9 +526,9 @@ static int omap2_select_table_rate(struct clk *clk, unsigned long rate) cur_rate =omap2_get_dpll_rate_24xx (&dpll_ck);if (prcm->dpll_speed == cur_rate /2 ) { -omap2_reprogram_sdrc (CORE_CLK_SRC_DPLL ,1 ); +omap2xxx_sdrc_reprogram (CORE_CLK_SRC_DPLL ,1 ); }else if (prcm->dpll_speed == cur_rate *2 ) { -omap2_reprogram_sdrc (CORE_CLK_SRC_DPLL_X2 ,1 ); +omap2xxx_sdrc_reprogram (CORE_CLK_SRC_DPLL_X2 ,1 ); }else if (prcm->dpll_speed != cur_rate) {local_irq_save (flags);
@@ -558,14 +559,14 @@ static int omap2_select_table_rate(struct clk *clk, unsigned long rate)cm_write_mod_reg (prcm->cm_clksel_mdm,OMAP2430_MDM_MOD ,CM_CLKSEL ); -/* x2 to enter init_mem */ -omap2_reprogram_sdrc (CORE_CLK_SRC_DPLL_X2 ,1 ); +/* x2 to enter omap2xxx_sdrc_init_params() */ +omap2xxx_sdrc_reprogram (CORE_CLK_SRC_DPLL_X2 ,1 );omap2_set_prcm (prcm->cm_clksel1_pll, prcm->base_sdrc_rfr, bypass); -omap2_init_memory_params (omap2_dll_force_needed ()); -omap2_reprogram_sdrc (done_rate,0 ); +omap2xxx_sdrc_init_params (omap2xxx_sdrc_dll_is_unlocked ()); +omap2xxx_sdrc_reprogram (done_rate,0 );local_irq_restore (flags); }
arch/arm/mach-omap2/io.c +1 -1
@@ -201,6 +201,6 @@ void __init omap2_init_common_hw(void)pwrdm_init (powerdomains_omap);clkdm_init (clockdomains_omap, clkdm_pwrdm_autodeps);omap2_clk_init (); -omap2_init_memory (); +omap2_sdrc_init ();gpmc_init (); }
arch/arm/mach-omap2/sdrc.c new file +57 -0
57 lines not on this page · raw message
arch/arm/mach-omap2/sdrc2xxx.c +16 -51
124 lines not on this page · raw message
arch/arm/plat-omap/common.c +1 -1
@@ -249,7 +249,7 @@ static struct omap_globals *omap2_globals;static void __init __omap2_set_globals (void ) {omap2_set_globals_tap (omap2_globals); -omap2_set_globals_memory (omap2_globals); +omap2_set_globals_sdrc (omap2_globals);omap2_set_globals_control (omap2_globals);omap2_set_globals_prcm (omap2_globals); }
arch/arm/plat-omap/include/mach/common.h +1 -1
@@ -65,7 +65,7 @@ void omap2_set_globals_343x(void);/* These get called from omap2_set_globals_xxxx(), do not call these */ void omap2_set_globals_tap (struct omap_globals *); -void omap2_set_globals_memory (struct omap_globals *); +void omap2_set_globals_sdrc (struct omap_globals *);void omap2_set_globals_control (struct omap_globals *);void omap2_set_globals_prcm (struct omap_globals *);
arch/arm/plat-omap/include/mach/sdrc.h +22 -15
@@ -4,10 +4,12 @@/* * OMAP2/3 SDRC/SMS register definitions * -* Copyright (C) 2007 Texas Instruments, Inc. -* Copyright (C) 2007 Nokia Corporation +* Copyright (C) 2007-2008 Texas Instruments, Inc. +* Copyright (C) 2007-2008 Nokia Corporation * -* Written by Paul Walmsley +* Tony Lindgren +* Paul Walmsley +* Richard Woodruff * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as
@@ -64,18 +66,25 @@* SMS register access */ - -#define OMAP242X_SMS_REGADDR (reg) IO_ADDRESS(OMAP2420_SMS_BASE + reg) -#define OMAP243X_SMS_REGADDR (reg) IO_ADDRESS(OMAP243X_SMS_BASE + reg) -#define OMAP343X_SMS_REGADDR (reg) IO_ADDRESS(OMAP343X_SMS_BASE + reg) +#define OMAP242X_SMS_REGADDR (reg) \ + (void __iomem *)IO_ADDRESS(OMAP2420_SMS_BASE + reg) +#define OMAP243X_SMS_REGADDR (reg) \ + (void __iomem *)IO_ADDRESS(OMAP243X_SMS_BASE + reg) +#define OMAP343X_SMS_REGADDR (reg) \ + (void __iomem *)IO_ADDRESS(OMAP343X_SMS_BASE + reg)/* SMS register offsets - read/write with sms_{read,write}_reg() */ #define SMS_SYSCONFIG 0x010/* REVISIT: fill in other SMS registers here */ + #ifndef __ASSEMBLER__ +void __init omap2_sdrc_init(void); + +#ifdef CONFIG_ARCH_OMAP2 + struct memory_timings { u32 m_type; /* ddr = 1, sdr = 0 */ u32 dll_mode; /* use lock mode = 1, unlock mode = 0 */
@@ -84,15 +93,13 @@ struct memory_timings {u32 base_cs;/* base chip select to use for calculations */ }; -extern void omap2_init_memory_params (u32 force_lock_to_unlock_mode); -extern u32 omap2_memory_get_slow_dll_ctrl (void ); -extern u32 omap2_memory_get_fast_dll_ctrl (void ); -extern u32 omap2_memory_get_type (void ); -u32 omap2_dll_force_needed (void ); -u32 omap2_reprogram_sdrc (u32 level,u32 force); -void __init omap2_init_memory (void ); +extern void omap2xxx_sdrc_init_params (u32 force_lock_to_unlock_mode); -#endif +u32 omap2xxx_sdrc_dll_is_unlocked (void ); +u32 omap2xxx_sdrc_reprogram (u32 level,u32 force); + +#endif /* CONFIG_ARCH_OMAP2 */ +#endif /* __ASSEMBLER__ */ #endif
Signature · 1 line
1.6.1.2
PATCH 68/86 OMAP2 SDRC: add SDRAM timing parameter infrastructure
From: Paul Walmsley <[email protected]>
For a given SDRAM clock rate, SDRAM chips require memory controllers to use a specific set of timing minimums and maximums to transfer data reliably. These parameters can be different for different memory chips and can also potentially vary by board.
This patch adds the infrastructure for board-*.c files to pass this timing data to the SDRAM controller init function. The timing data is specified in an 'omap_sdrc_params' structure, in terms of SDRC controller register values. An array of these structs, one per SDRC target clock rate, is passed by the board-*.c file to omap2_init_common_hw().
This patch does not define the values for different memory chips, nor does it use the values for anything; those will come in subsequent patches.
linux-omap source commit is bc84ecfc795c2d1c5cda8da4127cf972f488a696.
--- arch/arm/mach-omap2/board-2430sdp.c | 2 +- arch/arm/mach-omap2/board-apollon.c | 2 +- arch/arm/mach-omap2/board-generic.c | 2 +- arch/arm/mach-omap2/board-h4.c | 2 +- arch/arm/mach-omap2/board-ldp.c | 2 +- arch/arm/mach-omap2/board-omap3beagle.c | 2 +- arch/arm/mach-omap2/io.c | 4 +- arch/arm/mach-omap2/sdrc.c | 38 ++++++++++++++++++++++++++++++- arch/arm/plat-omap/include/mach/io.h | 4 ++- arch/arm/plat-omap/include/mach/sdrc.h | 24 ++++++++++++++++++- 10 files changed, 71 insertions(+), 11 deletions(-)
arch/arm/mach-omap2/board-2430sdp.c +1 -1
@@ -185,7 +185,7 @@ out:static void __init omap_2430sdp_init_irq (void ) { -omap2_init_common_hw (); +omap2_init_common_hw (NULL );omap_init_irq ();omap_gpio_init ();sdp2430_init_smc91x ();
arch/arm/mach-omap2/board-apollon.c +1 -1
@@ -249,7 +249,7 @@ out:static void __init omap_apollon_init_irq (void ) { -omap2_init_common_hw (); +omap2_init_common_hw (NULL );omap_init_irq ();omap_gpio_init ();apollon_init_smc91x ();
arch/arm/mach-omap2/board-generic.c +1 -1
@@ -33,7 +33,7 @@static void __init omap_generic_init_irq (void ) { -omap2_init_common_hw (); +omap2_init_common_hw (NULL );omap_init_irq (); }
arch/arm/mach-omap2/board-h4.c +1 -1
@@ -363,7 +363,7 @@ static void __init h4_init_flash(void)static void __init omap_h4_init_irq (void ) { -omap2_init_common_hw (); +omap2_init_common_hw (NULL );omap_init_irq ();omap_gpio_init ();h4_init_flash ();
arch/arm/mach-omap2/board-ldp.c +1 -1
@@ -98,7 +98,7 @@ static inline void __init ldp_init_smc911x(void)static void __init omap_ldp_init_irq (void ) { -omap2_init_common_hw (); +omap2_init_common_hw (NULL );omap_init_irq ();omap_gpio_init ();ldp_init_smc911x ();
arch/arm/mach-omap2/board-omap3beagle.c +1 -1
@@ -184,7 +184,7 @@ static int __init omap3_beagle_i2c_init(void)static void __init omap3_beagle_init_irq (void ) { -omap2_init_common_hw (); +omap2_init_common_hw (NULL );omap_init_irq ();omap_gpio_init (); }
arch/arm/mach-omap2/io.c +2 -2
@@ -195,12 +195,12 @@ void __init omap2_map_common_io(void)omapfb_reserve_sdram (); } -void __init omap2_init_common_hw (void ) +void __init omap2_init_common_hw (struct omap_sdrc_params *sp) {omap2_mux_init ();pwrdm_init (powerdomains_omap);clkdm_init (clockdomains_omap, clkdm_pwrdm_autodeps);omap2_clk_init (); -omap2_sdrc_init (); +omap2_sdrc_init (sp);gpmc_init (); }
arch/arm/mach-omap2/sdrc.c +37 -1
@@ -12,6 +12,7 @@* it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ +#undef DEBUG#include <linux/module.h> #include <linux/kernel.h>
@@ -31,9 +32,42 @@#include <mach/sdrc.h> #include "sdrc.h" +static struct omap_sdrc_params *sdrc_init_params; +void __iomem *omap2_sdrc_base;void __iomem *omap2_sms_base; + +/** +* omap2_sdrc_get_params - return SDRC register values for a given clock rate +* @r: SDRC clock rate (in Hz) +* +* Return pre-calculated values for the SDRC_ACTIM_CTRLA, +* SDRC_ACTIM_CTRLB, SDRC_RFR_CTRL, and SDRC_MR registers, for a given +* SDRC clock rate 'r'. These parameters control various timing +* delays in the SDRAM controller that are expressed in terms of the +* number of SDRC clock cycles to wait; hence the clock rate +* dependency. Note that sdrc_init_params must be sorted rate +* descending. Also assumes that both chip-selects use the same +* timing parameters. Returns a struct omap_sdrc_params * upon +* success, or NULL upon failure. +*/ +struct omap_sdrc_params *omap2_sdrc_get_params (unsigned long r) +{ +struct omap_sdrc_params *sp; + + sp = sdrc_init_params; + +while (sp->rate != r) + sp++; + +if (!sp->rate) +return NULL ; + +return sp; +} + +void __init omap2_set_globals_sdrc (struct omap_globals *omap2_globals) { omap2_sdrc_base = omap2_globals->sdrc;
@@ -41,7 +75,7 @@ void __init omap2_set_globals_sdrc(struct omap_globals *omap2_globals) }/* turn on smart idle modes for SDRAM scheduler and controller */ -void __init omap2_sdrc_init (void ) +void __init omap2_sdrc_init (struct omap_sdrc_params *sp) {u32 l;
@@ -54,4 +88,6 @@ void __init omap2_sdrc_init(void) l &= ~(0x3 <<3 ); l |= (0x2 <<3 );sdrc_write_reg (l,SDRC_SYSCONFIG ); + + sdrc_init_params = sp; }
arch/arm/plat-omap/include/mach/io.h +3 -1
@@ -185,11 +185,13 @@#define omap_writew (v,a) __raw_writew(v, IO_ADDRESS(a))#define omap_writel (v,a) __raw_writel(v, IO_ADDRESS(a)) +struct omap_sdrc_params ; +extern void omap1_map_common_io (void );extern void omap1_init_common_hw (void );extern void omap2_map_common_io (void ); -extern void omap2_init_common_hw (void ); +extern void omap2_init_common_hw (struct omap_sdrc_params *sp);#define __arch_ioremap (p,s,t) omap_ioremap(p,s,t)#define __arch_iounmap (v) omap_iounmap(v)
arch/arm/plat-omap/include/mach/sdrc.h +23 -1
@@ -81,7 +81,29 @@#ifndef __ASSEMBLER__ -void __init omap2_sdrc_init (void ); +/** +* struct omap_sdrc_params - SDRC parameters for a given SDRC clock rate +* @rate: SDRC clock rate (in Hz) +* @actim_ctrla: Value to program to SDRC_ACTIM_CTRLA for this rate +* @actim_ctrlb: Value to program to SDRC_ACTIM_CTRLB for this rate +* @rfr_ctrl: Value to program to SDRC_RFR_CTRL for this rate +* @mr: Value to program to SDRC_MR for this rate +* +* This structure holds a pre-computed set of register values for the +* SDRC for a given SDRC clock rate and SDRAM chip. These are +* intended to be pre-computed and specified in an array in the board-*.c +* files. The structure is keyed off the 'rate' field. +*/ +struct omap_sdrc_params { +unsigned long rate; +u32 actim_ctrla; +u32 actim_ctrlb; +u32 rfr_ctrl; +u32 mr; +}; + +void __init omap2_sdrc_init (struct omap_sdrc_params *sp); +struct omap_sdrc_params *omap2_sdrc_get_params (unsigned long r);#ifdef CONFIG_ARCH_OMAP2
Signature · 1 line
1.6.1.2
PATCH 69/86 OMAP3 clock: add omap3_core_dpll_m2_set_rate()
From: Paul Walmsley <[email protected]>
Add the omap3_core_dpll_m2_set_rate() function to the OMAP3 clock code, which calls into the SRAM function omap3_sram_configure_core_dpll() to change the CORE DPLL M2 divider. (SRAM code is necessary since rate changes on clocks upstream from the SDRC can glitch SDRAM accesses.)
Use this function for the set_rate function pointer in the dpll3_m2_ck struct clk. With this function in place, PM/OPP code should be able to alter SDRAM speed via code similar to:
clk_set_rate(&dpll3_m2_ck, target_rate).
linux-omap source commit is 7f8b2b0f4fe52238c67d79dedcd2794dcef4dddd.
--- arch/arm/mach-omap2/clock34xx.c | 65 +++++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/clock34xx.h | 9 ++--- 2 files changed, 69 insertions(+), 5 deletions(-)
arch/arm/mach-omap2/clock34xx.c +65 -0
@@ -634,6 +634,71 @@ static int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate)return omap3_noncore_dpll_set_rate (clk, rate); } + +/* +* CORE DPLL (DPLL3) rate programming functions +* +* These call into SRAM code to do the actual CM writes, since the SDRAM +* is clocked from DPLL3. +*/ + +/** +* omap3_core_dpll_m2_set_rate - set CORE DPLL M2 divider +* @clk: struct clk * of DPLL to set +* @rate: rounded target rate +* +* Program the DPLL M2 divider with the rounded target rate. Returns +* -EINVAL upon error, or 0 upon success. +*/ +static int omap3_core_dpll_m2_set_rate (struct clk *clk,unsigned long rate) +{ +u32 new_div =0 ; +unsigned long validrate, sdrcrate; +struct omap_sdrc_params *sp; + +if (!clk || !rate) +return -EINVAL ; + +if (clk != &dpll3_m2_ck) +return -EINVAL ; + +if (rate == clk->rate) +return 0 ; + + validrate =omap2_clksel_round_rate_div (clk, rate, &new_div); +if (validrate != rate) +return -EINVAL ; + + sdrcrate = sdrc_ick.rate; +if (rate > clk->rate) + sdrcrate <<= ((rate / clk->rate) -1 ); +else + sdrcrate >>= ((clk->rate / rate) -1 ); + + sp =omap2_sdrc_get_params (sdrcrate); +if (!sp) +return -EINVAL ; + +pr_info ("clock: changing CORE DPLL rate from %lu to %lu\n" , clk->rate, + validrate); +pr_info ("clock: SDRC timing params used: %08x %08x %08x\n" , + sp->rfr_ctrl, sp->actim_ctrla, sp->actim_ctrlb); + +/* REVISIT: SRAM code doesn't support other M2 divisors yet */ +WARN_ON (new_div !=1 && new_div !=2 ); + +/* REVISIT: Add SDRC_MR changing to this code also */ +local_irq_disable (); +omap3_configure_core_dpll (sp->rfr_ctrl, sp->actim_ctrla, + sp->actim_ctrlb, new_div); +local_irq_enable (); + +omap2_clksel_recalc (clk); + +return 0 ; +} + +static const struct clkops clkops_noncore_dpll_ops = { .enable = &omap3_noncore_dpll_enable, .disable = &omap3_noncore_dpll_disable,
arch/arm/mach-omap2/clock34xx.h +4 -5
@@ -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_set_rate (struct clk *clk,unsigned long rate);static int omap3_dpll4_set_rate (struct clk *clk,unsigned long rate); +static int omap3_core_dpll_m2_set_rate (struct clk *clk,unsigned long rate);/* Maximum DPLL multiplier, divider values for OMAP3 */ #define OMAP3_MAX_DPLL_MULT 2048
@@ -471,11 +472,7 @@ static const struct clksel div31_dpll3m2_clksel[] = { { .parent = NULL } }; -/* -* DPLL3 output M2 -* REVISIT: This DPLL output divider must be changed in SRAM, so until -* that code is ready, this should remain a 'read-only' clksel clock. -*/ +/* DPLL3 output M2 - primary control point for CORE speed */ static struct clk dpll3_m2_ck = { .name ="dpll3_m2_ck" , .ops = &clkops_null,
@@ -486,6 +483,8 @@ static struct clk dpll3_m2_ck = { .clksel = div31_dpll3m2_clksel, .flags = RATE_PROPAGATES, .clkdm_name = "dpll3_clkdm", + .round_rate = &omap2_clksel_round_rate, + .set_rate = &omap3_core_dpll_m2_set_rate, .recalc = &omap2_clksel_recalc, };
Signature · 1 line
1.6.1.2
PATCH 70/86 OMAP3: PM: Make sure clk_disable_unused() order is correct
From: Tero Kristo <[email protected]>
Current implementation will disable clocks in the order defined in clock34xx.h, at least DPLL4_M2X2 will hang in certain cases (and prevent retention / off) if clocks are not disabled in correct order. This patch makes sure the parent clocks will be active when disabling a clock.
linux-omap source commit is 672680063420ef8c8c4e7271984bb9cc08171d29.
--- arch/arm/mach-omap2/clock.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/clock.c +5 -1
@@ -1000,6 +1000,10 @@ void omap2_clk_disable_unused(struct clk *clk)return ;printk (KERN_INFO "Disabling unused clock \"%s\"\n" , clk->name); - _omap2_clk_disable(clk); +if (cpu_is_omap34xx ()) { +omap2_clk_enable (clk); +omap2_clk_disable (clk); + }else + _omap2_clk_disable(clk); }#endif
Signature · 1 line
1.6.1.2
PATCH 71/86 OMAP2/3 clock: use standard set_rate fn in omap2_clk_arch_init()
From: Paul Walmsley <[email protected]>
Use the standard clk_set_rate() function in omap2_clk_arch_init() rather than omap2_select_table_rate() -- this will ensure that clock rates are recalculated and propagated correctly after those operations are consolidated into clk_set_rate().
linux-omap source commit is 03c03330017eeb445b01957608ff5db49a7151b6.
--- arch/arm/mach-omap2/clock24xx.c | 2 +- arch/arm/mach-omap2/clock34xx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/clock24xx.c +1 -1
@@ -688,7 +688,7 @@ static int __init omap2_clk_arch_init(void)if (!mpurate)return -EINVAL ; -if (omap2_select_table_rate (&virt_prcm_set, mpurate)) +if (clk_set_rate (&virt_prcm_set, mpurate))printk (KERN_ERR "Could not find matching MPU rate\n" );recalculate_root_clocks ();
arch/arm/mach-omap2/clock34xx.c +1 -1
@@ -866,7 +866,7 @@ static int __init omap2_clk_arch_init(void)/* REVISIT: not yet ready for 343x */ #if 0 -if (omap2_select_table_rate (&virt_prcm_set, mpurate)) +if (clk_set_rate (&virt_prcm_set, mpurate))printk (KERN_ERR "Could not find matching MPU rate\n" );#endif
Signature · 1 line
1.6.1.2
PATCH 72/86 omap: clks: call recalc after any rate change
From: Russell King <[email protected]>
This implements the remainder of:
OMAP clock: move rate recalc, propagation code up to plat-omap/clock.c
from Paul Walmsley which is not covered by the previous:
[ARM] omap: move clock propagation into core omap clock code [ARM] omap: remove unnecessary calls to propagate_rate() [ARM] omap: move propagate_rate() calls into generic omap clock code
commits.
--- arch/arm/mach-omap2/clock24xx.c | 2 -- arch/arm/mach-omap2/clock34xx.c | 4 ---- arch/arm/plat-omap/clock.c | 16 ++++++++++++---- 3 files changed, 12 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/clock24xx.c +0 -2
@@ -441,7 +441,6 @@ static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)omap2xxx_sdrc_init_params (omap2xxx_sdrc_dll_is_unlocked ());omap2xxx_sdrc_reprogram (done_rate,0 ); } -omap2_dpllcore_recalc (&dpll_ck); ret =0 ; dpll_exit:
@@ -570,7 +569,6 @@ static int omap2_select_table_rate(struct clk *clk, unsigned long rate)local_irq_restore (flags); } -omap2_dpllcore_recalc (&dpll_ck);return 0 ; }
arch/arm/mach-omap2/clock34xx.c +0 -4
@@ -614,8 +614,6 @@ static int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate)omap3_noncore_dpll_program (clk, dd->last_rounded_m, dd->last_rounded_n, freqsel); -omap3_dpll_recalc (clk); -return 0 ; }
@@ -693,8 +691,6 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate) sp->actim_ctrlb, new_div);local_irq_enable (); -omap2_clksel_recalc (clk); -return 0 ; }
arch/arm/plat-omap/clock.c +12 -4
@@ -140,8 +140,12 @@ int clk_set_rate(struct clk *clk, unsigned long rate)spin_lock_irqsave (&clockfw_lock, flags);if (arch_clock->clk_set_rate) ret = arch_clock->clk_set_rate (clk, rate); -if (ret ==0 && (clk->flags &RATE_PROPAGATES )) -propagate_rate (clk); +if (ret ==0 ) { +if (clk->recalc) + clk->recalc (clk); +if (clk->flags &RATE_PROPAGATES ) +propagate_rate (clk); + }spin_unlock_irqrestore (&clockfw_lock, flags);return ret;
@@ -159,8 +163,12 @@ int clk_set_parent(struct clk *clk, struct clk *parent)spin_lock_irqsave (&clockfw_lock, flags);if (arch_clock->clk_set_parent) ret = arch_clock->clk_set_parent (clk, parent); -if (ret ==0 && (clk->flags &RATE_PROPAGATES )) -propagate_rate (clk); +if (ret ==0 ) { +if (clk->recalc) + clk->recalc (clk); +if (clk->flags &RATE_PROPAGATES ) +propagate_rate (clk); + }spin_unlock_irqrestore (&clockfw_lock, flags);return ret;
Signature · 1 line
1.6.1.2
PATCH 73/86 omap: create a proper tree of clocks
From: Russell King <[email protected]>
Traditionally, we've tracked the parent/child relationships between clk structures by setting the child's parent member to point at the upstream clock. As a result, when decending the tree, we have had to scan all clocks to find the children.
Avoid this wasteful scanning by keeping a list of the clock's children.
--- arch/arm/mach-omap1/clock.c | 3 + arch/arm/mach-omap1/clock.h | 7 +-- arch/arm/mach-omap2/clock.c | 4 +- arch/arm/mach-omap2/clock24xx.c | 3 + arch/arm/mach-omap2/clock24xx.h | 28 +++------ arch/arm/mach-omap2/clock34xx.c | 3 + arch/arm/mach-omap2/clock34xx.h | 96 +++++-------------------------- arch/arm/plat-omap/clock.c | 51 ++++++++++------ arch/arm/plat-omap/include/mach/clock.h | 7 ++- 9 files changed, 74 insertions(+), 128 deletions(-)
arch/arm/mach-omap1/clock.c +3 -0
@@ -782,6 +782,9 @@ int __init omap1_clk_init(void)/* By default all idlect1 clocks are allowed to idle */ arm_idlect1_mask = ~0 ; +for (c = omap_clks; c < omap_clks +ARRAY_SIZE (omap_clks); c++) +clk_init_one (c->lk.clk); + cpu_mask =0 ;if (cpu_is_omap16xx ()) cpu_mask |=CK_16XX ;
arch/arm/mach-omap1/clock.h +2 -5
@@ -155,7 +155,6 @@ static struct clk ck_dpll1 = { .name = "ck_dpll1", .ops = &clkops_null, .parent = &ck_ref, - .flags = RATE_PROPAGATES, };static struct arm_idlect1_clk ck_dpll1out = {
@@ -163,8 +162,7 @@ static struct arm_idlect1_clk ck_dpll1out = { .name = "ck_dpll1out", .ops = &clkops_generic, .parent = &ck_dpll1, - .flags =CLOCK_IDLE_CONTROL | - ENABLE_REG_32BIT | RATE_PROPAGATES, + .flags = CLOCK_IDLE_CONTROL | ENABLE_REG_32BIT, .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2), .enable_bit = EN_CKOUT_ARM, .recalc = &followparent_recalc,
@@ -187,7 +185,6 @@ static struct clk arm_ck = { .name = "arm_ck", .ops = &clkops_null, .parent = &ck_dpll1, - .flags = RATE_PROPAGATES, .rate_offset = CKCTL_ARMDIV_OFFSET, .recalc = &omap1_ckctl_recalc, .round_rate = omap1_clk_round_rate_ckctl_arm,
@@ -328,7 +325,7 @@ static struct arm_idlect1_clk tc_ck = { .name = "tc_ck", .ops = &clkops_null, .parent = &ck_dpll1, - .flags = RATE_PROPAGATES | CLOCK_IDLE_CONTROL, + .flags = CLOCK_IDLE_CONTROL, .rate_offset = CKCTL_TCDIV_OFFSET, .recalc = &omap1_ckctl_recalc, .round_rate = omap1_clk_round_rate_ckctl_arm,
arch/arm/mach-omap2/clock.c +2 -2
@@ -175,7 +175,7 @@ void omap2_init_clksel_parent(struct clk *clk) clk->name, clks->parent->name, ((clk->parent) ? clk->parent->name : "NULL")); - clk->parent = clks->parent; +clk_reparent (clk, clks->parent); }; found =1 ; }
@@ -780,7 +780,7 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)if (clk->usecount >0 )_omap2_clk_enable (clk); - clk->parent = new_parent; +clk_reparent (clk, new_parent);/* CLKSEL clocks follow their parents' rates, divided by a divisor */ clk->rate = new_parent->rate;
arch/arm/mach-omap2/clock24xx.c +3 -0
@@ -718,6 +718,9 @@ int __init omap2_clk_init(void)omap2_sys_clk_recalc (&sys_ck);propagate_rate (&sys_ck); +for (c = omap24xx_clks; c < omap24xx_clks +ARRAY_SIZE (omap24xx_clks); c++) +clk_init_one (c->lk.clk); + cpu_mask =0 ;if (cpu_is_omap2420 ()) cpu_mask |=CK_242X ;
arch/arm/mach-omap2/clock24xx.h +9 -19
@@ -621,7 +621,7 @@ static struct clk func_32k_ck = { .name = "func_32k_ck", .ops = &clkops_null, .rate = 32000, - .flags = RATE_FIXED | RATE_PROPAGATES, + .flags = RATE_FIXED, .clkdm_name = "wkup_clkdm", };
@@ -629,7 +629,6 @@ static struct clk func_32k_ck = {static struct clk osc_ck = {/* (*12, *13, 19.2, *26, 38.4)MHz */ .name ="osc_ck" , .ops = &clkops_oscck, - .flags =RATE_PROPAGATES , .clkdm_name ="wkup_clkdm" , .recalc = &omap2_osc_clk_recalc, };
@@ -639,7 +638,6 @@ static struct clk sys_ck = { /* (*12, *13, 19.2, 26, 38.4)MHz */ .name = "sys_ck", /* ~ ref_clk also */ .ops = &clkops_null, .parent = &osc_ck, - .flags = RATE_PROPAGATES, .clkdm_name = "wkup_clkdm", .recalc = &omap2_sys_clk_recalc, };
@@ -648,7 +646,7 @@ static struct clk alt_ck = { /* Typical 54M or 48M, may not exist */ .name = "alt_ck", .ops = &clkops_null, .rate = 54000000, - .flags = RATE_FIXED | RATE_PROPAGATES, + .flags = RATE_FIXED, .clkdm_name = "wkup_clkdm", };
@@ -680,7 +678,6 @@ static struct clk dpll_ck = { .ops = &clkops_null, .parent = &sys_ck, /* Can be func_32k also */ .dpll_data = &dpll_dd, - .flags = RATE_PROPAGATES, .clkdm_name = "wkup_clkdm", .recalc = &omap2_dpllcore_recalc, .set_rate = &omap2_reprogram_dpllcore,
@@ -691,7 +688,7 @@ static struct clk apll96_ck = { .ops = &clkops_fixed, .parent = &sys_ck, .rate = 96000000, - .flags = RATE_FIXED | RATE_PROPAGATES | ENABLE_ON_INIT, + .flags = RATE_FIXED | ENABLE_ON_INIT, .clkdm_name = "wkup_clkdm", .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), .enable_bit = OMAP24XX_EN_96M_PLL_SHIFT,
@@ -702,7 +699,7 @@ static struct clk apll54_ck = { .ops = &clkops_fixed, .parent = &sys_ck, .rate = 54000000, - .flags = RATE_FIXED | RATE_PROPAGATES | ENABLE_ON_INIT, + .flags = RATE_FIXED | ENABLE_ON_INIT, .clkdm_name = "wkup_clkdm", .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), .enable_bit = OMAP24XX_EN_54M_PLL_SHIFT,
@@ -734,7 +731,6 @@ static struct clk func_54m_ck = { .name = "func_54m_ck", .ops = &clkops_null, .parent = &apll54_ck, /* can also be alt_clk */ - .flags = RATE_PROPAGATES, .clkdm_name = "wkup_clkdm", .init = &omap2_init_clksel_parent, .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
@@ -747,7 +743,6 @@ static struct clk core_ck = { .name = "core_ck", .ops = &clkops_null, .parent = &dpll_ck, /* can also be 32k */ - .flags = RATE_PROPAGATES, .clkdm_name = "wkup_clkdm", .recalc = &followparent_recalc, };
@@ -774,7 +769,6 @@ static struct clk func_96m_ck = { .name = "func_96m_ck", .ops = &clkops_null, .parent = &apll96_ck, - .flags = RATE_PROPAGATES, .clkdm_name = "wkup_clkdm", .init = &omap2_init_clksel_parent, .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
@@ -807,7 +801,6 @@ static struct clk func_48m_ck = { .name = "func_48m_ck", .ops = &clkops_null, .parent = &apll96_ck, /* 96M or Alt */ - .flags = RATE_PROPAGATES, .clkdm_name = "wkup_clkdm", .init = &omap2_init_clksel_parent, .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
@@ -823,7 +816,6 @@ static struct clk func_12m_ck = { .ops = &clkops_null, .parent = &func_48m_ck, .fixed_div = 4, - .flags = RATE_PROPAGATES, .clkdm_name = "wkup_clkdm", .recalc = &omap2_fixed_divisor_recalc, };
@@ -876,7 +868,6 @@ static struct clk sys_clkout_src = { .name = "sys_clkout_src", .ops = &clkops_omap2_dflt, .parent = &func_54m_ck, - .flags = RATE_PROPAGATES, .clkdm_name = "wkup_clkdm", .enable_reg = OMAP24XX_PRCM_CLKOUT_CTRL, .enable_bit = OMAP24XX_CLKOUT_EN_SHIFT,
@@ -921,7 +912,6 @@ static struct clk sys_clkout2_src = { .name = "sys_clkout2_src", .ops = &clkops_omap2_dflt, .parent = &func_54m_ck, - .flags = RATE_PROPAGATES, .clkdm_name = "wkup_clkdm", .enable_reg = OMAP24XX_PRCM_CLKOUT_CTRL, .enable_bit = OMAP2420_CLKOUT2_EN_SHIFT,
@@ -992,7 +982,7 @@ static struct clk mpu_ck = { /* Control cpu */ .name = "mpu_ck", .ops = &clkops_null, .parent = &core_ck, - .flags = DELAYED_APP | CONFIG_PARTICIPANT | RATE_PROPAGATES, + .flags = DELAYED_APP | CONFIG_PARTICIPANT, .clkdm_name = "mpu_clkdm", .init = &omap2_init_clksel_parent, .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, CM_CLKSEL),
@@ -1034,7 +1024,7 @@ static struct clk dsp_fck = { .name = "dsp_fck", .ops = &clkops_omap2_dflt_wait, .parent = &core_ck, - .flags = DELAYED_APP | CONFIG_PARTICIPANT | RATE_PROPAGATES, + .flags = DELAYED_APP | CONFIG_PARTICIPANT, .clkdm_name = "dsp_clkdm", .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN), .enable_bit = OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT,
@@ -1102,7 +1092,7 @@ static struct clk iva1_ifck = { .name = "iva1_ifck", .ops = &clkops_omap2_dflt_wait, .parent = &core_ck, - .flags = CONFIG_PARTICIPANT | RATE_PROPAGATES | DELAYED_APP, + .flags = CONFIG_PARTICIPANT | DELAYED_APP, .clkdm_name = "iva1_clkdm", .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN), .enable_bit = OMAP2420_EN_IVA_COP_SHIFT,
@@ -1165,7 +1155,7 @@ static struct clk core_l3_ck = { /* Used for ick and fck, interconnect */ .name = "core_l3_ck", .ops = &clkops_null, .parent = &core_ck, - .flags = DELAYED_APP | CONFIG_PARTICIPANT | RATE_PROPAGATES, + .flags = DELAYED_APP | CONFIG_PARTICIPANT, .clkdm_name = "core_l3_clkdm", .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1), .clksel_mask = OMAP24XX_CLKSEL_L3_MASK,
@@ -1227,7 +1217,7 @@ static struct clk l4_ck = { /* used both as an ick and fck */ .name = "l4_ck", .ops = &clkops_null, .parent = &core_l3_ck, - .flags = DELAYED_APP | RATE_PROPAGATES, + .flags = DELAYED_APP, .clkdm_name = "core_l4_clkdm", .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1), .clksel_mask = OMAP24XX_CLKSEL_L4_MASK,
arch/arm/mach-omap2/clock34xx.c +3 -0
@@ -904,6 +904,9 @@ int __init omap2_clk_init(void)clk_init (&omap2_clk_functions);for (c = omap34xx_clks; c < omap34xx_clks +ARRAY_SIZE (omap34xx_clks); c++) +clk_init_one (c->lk.clk); + +for (c = omap34xx_clks; c < omap34xx_clks +ARRAY_SIZE (omap34xx_clks); c++)if (c->cpu & cpu_clkflg) {clkdev_add (&c->lk);clk_register (c->lk.clk);
arch/arm/mach-omap2/clock34xx.h +15 -81
582 lines not on this page · raw message
arch/arm/plat-omap/clock.c +32 -19
100 lines not on this page · raw message
arch/arm/plat-omap/include/mach/clock.h +5 -2
@@ -70,6 +70,8 @@ struct clk {const char *name;int id;struct clk *parent; +struct list_head children; +struct list_head sibling;/* node for children */ unsigned long rate;__u32 flags;void __iomem *enable_reg;
@@ -115,7 +117,9 @@ struct clk_functions {extern unsigned int mpurate;extern int clk_init (struct clk_functions *custom_clocks); +extern void clk_init_one (struct clk *clk);extern int clk_register (struct clk *clk); +extern void clk_reparent (struct clk *child,struct clk *parent);extern void clk_unregister (struct clk *clk);extern void propagate_rate (struct clk *clk);extern void recalculate_root_clocks (void );
@@ -131,8 +135,7 @@ extern const struct clkops clkops_null;/* Clock flags */ /* bit 0 is free */ #define RATE_FIXED (1 << 1)/* Fixed clock rate */ -#define RATE_PROPAGATES (1 << 2)/* Program children too */ -/* bits 3-4 are free */ +/* bits 2-4 are free */ #define ENABLE_REG_32BIT (1 << 5)/* Use 32-bit access */ #define CLOCK_IDLE_CONTROL (1 << 7)#define CLOCK_NO_IDLE_PARENT (1 << 8)
Signature · 1 line
1.6.1.2
PATCH 74/86 OMAP2/3 clock: don't use a barrier after clk_disable()
From: Paul Walmsley <[email protected]>
clk_disable() previously used an ARM barrier, wmb(), to try to ensure that the hardware write completed before continuing. There are some problems with this approach.
The first problem is that wmb() only ensures that the write leaves the ARM -- not that it actually reaches the endpoint device. In this case, the endpoint device - either the PRM, CM, or SCM - is three interconnects away from the ARM, and the final interconnect is low-speed. And the OCP interconnects will post the write, who knows how long that will take to complete. So the wmb() is not really what we want.
Worse, the wmb() is indiscriminate; it will cause the ARM to flush any other unrelated buffered writes and wait for the local interconnect to acknowledge them - potentially very expensive.
This first problem could be fixed by doing a readback of the same PRM/CM/SCM register. Since these devices use a single OCP thread, this will cause the MPU to wait for the write to complete.
But the primary problem is a conceptual one: clk_disable() should not need any kind of barrier. clk_enable() needs one since device driver code must not access a device until its clocks are known to be enabled. But clk_disable() has no such restriction.
Since blocking the MPU on a PRM/CM/SCM write can be a very high-latency operation - several hundred MPU cycles - it's worth avoiding this barrier if possible.
linux-omap source commit is f4aacad2c0ed1055622d5c1e910befece24ef0e2.
--- arch/arm/mach-omap2/clock.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/clock.c +1 -1
@@ -353,7 +353,7 @@ static void omap2_dflt_clk_disable(struct clk *clk)else v &= ~(1 << clk->enable_bit);__raw_writel (v, clk->enable_reg); -wmb (); +/* No OCP barrier needed here since it is a disable operation */ }const struct clkops clkops_omap2_dflt_wait = {
Signature · 1 line
1.6.1.2
PATCH 75/86 OMAP2xxx clock: consolidate DELAYED_APP clock commits; fix barrier
From: Paul Walmsley <[email protected]>
Consolidate the commit code for DELAYED_APP clocks into a subroutine, _omap2xxx_clk_commit(). Also convert the MPU barrier wmb() into an OCP barrier, since with an MPU barrier, we have no guarantee that the write actually reached the endpoint device.
linux-omap source commit is 0f5bdb736515801b296125d16937a21ff7b3cfdc.
--- arch/arm/mach-omap2/clock.c | 33 ++++++++++++++++++++++++--------- 1 files changed, 24 insertions(+), 9 deletions(-)
arch/arm/mach-omap2/clock.c +24 -9
@@ -74,6 +74,28 @@ u8 cpu_mask;* OMAP2/3 specific clock functions *-------------------------------------------------------------------------*/ +/** +* _omap2xxx_clk_commit - commit clock parent/rate changes in hardware +* @clk: struct clk * +* +* If @clk has the DELAYED_APP flag set, meaning that parent/rate changes +* don't take effect until the VALID_CONFIG bit is written, write the +* VALID_CONFIG bit and wait for the write to complete. No return value. +*/ +static void _omap2xxx_clk_commit (struct clk *clk) +{ +if (!cpu_is_omap24xx ()) +return ; + +if (!(clk->flags &DELAYED_APP )) +return ; + +prm_write_mod_reg (OMAP24XX_VALID_CONFIG ,OMAP24XX_GR_MOD , +OMAP24XX_PRCM_CLKCFG_CTRL_OFFSET ); +/* OCP barrier */ +prm_read_mod_reg (OMAP24XX_GR_MOD ,OMAP24XX_PRCM_CLKCFG_CTRL_OFFSET ); +} +/* * _dpll_test_fint - test whether an Fint value is valid for the DPLL * @clk: DPLL struct clk to test
@@ -685,11 +707,7 @@ int omap2_clksel_set_rate(struct clk *clk, unsigned long rate) clk->rate = clk->parent->rate / new_div; -if (clk->flags &DELAYED_APP &&cpu_is_omap24xx ()) { -prm_write_mod_reg (OMAP24XX_VALID_CONFIG , -OMAP24XX_GR_MOD ,OMAP24XX_PRCM_CLKCFG_CTRL_OFFSET ); -wmb (); - } +_omap2xxx_clk_commit (clk);return 0 ; }
@@ -772,10 +790,7 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)__raw_writel (v, clk->clksel_reg);wmb (); -if (clk->flags &DELAYED_APP &&cpu_is_omap24xx ()) { -__raw_writel (OMAP24XX_VALID_CONFIG ,OMAP24XX_PRCM_CLKCFG_CTRL ); -wmb (); - } +_omap2xxx_clk_commit (clk);if (clk->usecount >0 )_omap2_clk_enable (clk);
Signature · 1 line
1.6.1.2
PATCH 76/86 OMAP2/3 clock: convert remaining MPU barriers into OCP barriers
From: Paul Walmsley <[email protected]>
Several parts of the OMAP2/3 clock code use wmb() to try to ensure that the hardware write completes before continuing. This approach is
problematic: wmb() only ensures that the write leaves the ARM. It does not ensure that the write actually reaches the endpoint device. The endpoint device in this case - either the PRM, CM, or SCM - is three interconnects away from the ARM - and the final interconnect is low-speed. And the OCP interconnects will post the write, and who knows how long that will take to complete. So the wmb() is not what we want. Worse, the wmb() is indiscriminate; it causes the ARM to flush any other unrelated buffered writes and wait for the local interconnect to acknowledge them - potentially very expensive.
Fix this by converting the wmb()s into readbacks of the same PRM/CM/SCM register. Since the PRM/CM/SCM devices use a single OCP thread, this will cause the MPU to block while waiting for posted writes to that device to complete.
linux-omap source commit is 260f5487848681b4d8ea7430a709a601bbcb21d1.
--- arch/arm/mach-omap2/clock.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/clock.c +3 -3
@@ -334,7 +334,7 @@ static int omap2_dflt_clk_enable(struct clk *clk)else v |= (1 << clk->enable_bit);__raw_writel (v, clk->enable_reg); -wmb (); + v =__raw_readl (clk->enable_reg);/* OCP barrier */ return 0 ; }
@@ -703,7 +703,7 @@ int omap2_clksel_set_rate(struct clk *clk, unsigned long rate) v &= ~clk->clksel_mask; v |= field_val <<__ffs (clk->clksel_mask);__raw_writel (v, clk->clksel_reg); -wmb (); + v =__raw_readl (clk->clksel_reg);/* OCP barrier */ clk->rate = clk->parent->rate / new_div;
@@ -788,7 +788,7 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent) v &= ~clk->clksel_mask; v |= field_val <<__ffs (clk->clksel_mask);__raw_writel (v, clk->clksel_reg); -wmb (); + v =__raw_readl (clk->clksel_reg);/* OCP barrier */ _omap2xxx_clk_commit (clk);
Signature · 1 line
1.6.1.2
PATCH 77/86 OMAP clock: drop clk_get_usecount()
From: Paul Walmsley <[email protected]>
This function is race-prone and mistakenly conveys the impression to drivers that it is part of the clock interface. Get rid of it: core code that absolutely needs this can just check clk->usecount. Drivers should not use it at all.
linux-omap source commit is 5df9e4adc2f6a6d55aca53ee27b8baad18897c05.
--- arch/arm/plat-omap/clock.c | 16 ---------------- arch/arm/plat-omap/include/mach/clock.h | 1 - 2 files changed, 0 insertions(+), 17 deletions(-)
arch/arm/plat-omap/clock.c +0 -16
@@ -76,22 +76,6 @@ out: }EXPORT_SYMBOL (clk_disable); -int clk_get_usecount (struct clk *clk) -{ -unsigned long flags; -int ret =0 ; - -if (clk ==NULL ||IS_ERR (clk)) -return 0 ; - -spin_lock_irqsave (&clockfw_lock, flags); - ret = clk->usecount; -spin_unlock_irqrestore (&clockfw_lock, flags); - -return ret; -} -EXPORT_SYMBOL (clk_get_usecount); -unsigned long clk_get_rate (struct clk *clk) {unsigned long flags;
arch/arm/plat-omap/include/mach/clock.h +0 -1
@@ -124,7 +124,6 @@ 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 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);
Signature · 1 line
1.6.1.2
PATCH 78/86 omap: fix usecount decrement bug
From: Russell King <[email protected]>
Based upon a patch from Paul Walmsley <[email protected]>:
If _omap2_clk_enable() fails, the clock's usecount must be decremented by one no matter whether the clock has a parent or not.
but reorganised a bit.
--- arch/arm/mach-omap2/clock.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/clock.c +10 -10
@@ -419,30 +419,30 @@ int omap2_clk_enable(struct clk *clk)int ret =0 ;if (clk->usecount++ ==0 ) { -if (clk->parent) +if (clk->parent) { ret =omap2_clk_enable (clk->parent); - -if (ret !=0 ) { - clk->usecount--; -return ret; +if (ret) + goto err; }if (clk->clkdm)omap2_clkdm_clk_enable (clk->clkdm, clk); ret =_omap2_clk_enable (clk); - -if (ret !=0 ) { +if (ret) {if (clk->clkdm)omap2_clkdm_clk_disable (clk->clkdm, clk); -if (clk->parent) { +if (clk->parent)omap2_clk_disable (clk->parent); - clk->usecount--; - } + + goto err; } } +return ret; +err: + clk->usecount--;return ret; }
Signature · 1 line
1.6.1.2
PATCH 79/86 omap: fix clockdomain enable/disable ordering
From: Russell King <[email protected]>
Based on a patch from Paul Walmsley <[email protected]>:
omap2_clk_enable() should enable a clock's clockdomain before attempting to enable its parent clock's clockdomain. Similarly, in the unlikely event that the parent clock enable fails, the clockdomain should be disabled.
linux-omap source commit is 6d6e285e5a7912b1ea68fadac387304c914aaba8.
--- arch/arm/mach-omap2/clock.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/clock.c +5 -6
@@ -419,20 +419,17 @@ int omap2_clk_enable(struct clk *clk)int ret =0 ;if (clk->usecount++ ==0 ) { +if (clk->clkdm) +omap2_clkdm_clk_enable (clk->clkdm, clk); +if (clk->parent) { ret =omap2_clk_enable (clk->parent);if (ret) goto err; } -if (clk->clkdm) -omap2_clkdm_clk_enable (clk->clkdm, clk); - ret =_omap2_clk_enable (clk);if (ret) { -if (clk->clkdm) -omap2_clkdm_clk_disable (clk->clkdm, clk); -if (clk->parent)omap2_clk_disable (clk->parent);
@@ -442,6 +439,8 @@ int omap2_clk_enable(struct clk *clk)return ret; err: +if (clk->clkdm) +omap2_clkdm_clk_disable (clk->clkdm, clk); clk->usecount--;return ret; }
Signature · 1 line
1.6.1.2
PATCH 80/86 OMAP2/3 clock: don't tinker with hardirqs when they are supposed to be disabled
From: Paul Walmsley <[email protected]>
Clock rate change code executes inside a spinlock with hardirqs disabled. The only code that should be messing around with the hardirq state should be the plat-omap/clock.c code. In the omap2_reprogram_dpllcore() case, this probably just wastes cycles, but in the omap3_core_dpll_m2_set_rate() case, this is a nasty bug.
linux-omap source commit is b9b6208dadb5e0d8b290900a3ffa911673ca97ed.
--- arch/arm/mach-omap2/clock24xx.c | 12 +++--------- arch/arm/mach-omap2/clock34xx.c | 2 -- 2 files changed, 3 insertions(+), 11 deletions(-)
arch/arm/mach-omap2/clock24xx.c +3 -9
@@ -380,10 +380,7 @@ static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)u32 bypass =0 ;struct prcm_config tmpset;const struct dpll_data *dd; -unsigned long flags; -int ret = -EINVAL ; -local_irq_save (flags); cur_rate =omap2_get_dpll_rate_24xx (&dpll_ck); mult =cm_read_mod_reg (PLL_MOD ,CM_CLKSEL2 ); mult &=OMAP24XX_CORE_CLK_SRC_MASK ;
@@ -395,7 +392,7 @@ static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate) }else if (rate != cur_rate) { valid_rate =omap2_dpllcore_round_rate (rate);if (valid_rate != rate) - goto dpll_exit; +return -EINVAL ;if (mult ==1 ) low = curr_prcm_set->dpll_speed;
@@ -404,7 +401,7 @@ static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate) dd = clk->dpll_data;if (!dd) - goto dpll_exit; +return -EINVAL ; tmpset.cm_clksel1_pll =__raw_readl (dd->mult_div1_reg); tmpset.cm_clksel1_pll &= ~(dd->mult_mask |
@@ -441,11 +438,8 @@ static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)omap2xxx_sdrc_init_params (omap2xxx_sdrc_dll_is_unlocked ());omap2xxx_sdrc_reprogram (done_rate,0 ); } - ret =0 ; -dpll_exit: -local_irq_restore (flags); -return (ret); +return 0 ; }/**
arch/arm/mach-omap2/clock34xx.c +0 -2
@@ -686,10 +686,8 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)WARN_ON (new_div !=1 && new_div !=2 );/* REVISIT: Add SDRC_MR changing to this code also */ -local_irq_disable ();omap3_configure_core_dpll (sp->rfr_ctrl, sp->actim_ctrla, sp->actim_ctrlb, new_div); -local_irq_enable ();return 0 ; }
Signature · 1 line
1.6.1.2
PATCH 81/86 omap: arrange for clock recalc methods to return the rate
From: Russell King <[email protected]>
linux-omap source commit 33d000c99ee393fe2042f93e8422f94976d276ce introduces a way to "dry run" clock changes before they're committed. However, this involves putting logic to handle this into each and every recalc function, and unfortunately due to the caching, led to some bugs.
Solve both of issues by making the recalc methods always return the clock rate for the clock, which the caller decides what to do with.
--- arch/arm/mach-omap1/clock.c | 32 +++++++++++------------------- arch/arm/mach-omap1/clock.h | 10 ++++---- arch/arm/mach-omap2/clock.c | 17 ++++++++------- arch/arm/mach-omap2/clock.h | 4 +- arch/arm/mach-omap2/clock24xx.c | 20 +++++++++--------- arch/arm/mach-omap2/clock24xx.h | 10 ++++---- arch/arm/mach-omap2/clock34xx.c | 12 ++++++---- arch/arm/mach-omap2/clock34xx.h | 4 +- arch/arm/plat-omap/clock.c | 15 +++++-------- arch/arm/plat-omap/include/mach/clock.h | 4 +- 10 files changed, 60 insertions(+), 68 deletions(-)
arch/arm/mach-omap1/clock.c +12 -20
@@ -156,27 +156,25 @@ __u32 arm_idlect1_mask;* Omap1 specific clock functions *-------------------------------------------------------------------------*/ -static void omap1_watchdog_recalc (struct clk * clk) +static unsigned long omap1_watchdog_recalc (struct clk *clk) { - clk->rate = clk->parent->rate /14 ; +return clk->parent->rate /14 ; } -static void omap1_uart_recalc (struct clk * clk) +static unsigned long omap1_uart_recalc (struct clk *clk) {unsigned int val =__raw_readl (clk->enable_reg); -if (val & clk->enable_bit) - clk->rate =48000000 ; -else - clk->rate =12000000 ; +return val & clk->enable_bit ?48000000 :12000000 ; } -static void omap1_sossi_recalc (struct clk *clk) +static unsigned long omap1_sossi_recalc (struct clk *clk) {u32 div =omap_readl (MOD_CONF_CTRL_1 ); div = (div >>17 ) &0x7 ; div++; - clk->rate = clk->parent->rate / div; + +return clk->parent->rate / div; }static int omap1_clk_enable_dsp_domain (struct clk *clk)
@@ -344,19 +342,15 @@ static int calc_dsor_exp(struct clk *clk, unsigned long rate)return dsor_exp; } -static void omap1_ckctl_recalc (struct clk * clk) +static unsigned long omap1_ckctl_recalc (struct clk *clk) { -int dsor; -/* Calculate divisor encoded as 2-bit exponent */ - dsor =1 << (3 & (omap_readw (ARM_CKCTL ) >> clk->rate_offset)); +int dsor =1 << (3 & (omap_readw (ARM_CKCTL ) >> clk->rate_offset)); -if (unlikely (clk->rate == clk->parent->rate / dsor)) -return ;/* No change, quick exit */ - clk->rate = clk->parent->rate / dsor; +return clk->parent->rate / dsor; } -static void omap1_ckctl_recalc_dsp_domain (struct clk * clk) +static unsigned long omap1_ckctl_recalc_dsp_domain (struct clk *clk) {int dsor;
@@ -371,9 +365,7 @@ static void omap1_ckctl_recalc_dsp_domain(struct clk * clk) dsor =1 << (3 & (__raw_readw (DSP_CKCTL ) >> clk->rate_offset));omap1_clk_disable (&api_ck.clk); -if (unlikely (clk->rate == clk->parent->rate / dsor)) -return ;/* No change, quick exit */ - clk->rate = clk->parent->rate / dsor; +return clk->parent->rate / dsor; }/* MPU virtual clock functions */
arch/arm/mach-omap1/clock.h +5 -5
@@ -13,14 +13,14 @@#ifndef __ARCH_ARM_MACH_OMAP1_CLOCK_H#define __ARCH_ARM_MACH_OMAP1_CLOCK_H -static void omap1_ckctl_recalc (struct clk * clk); -static void omap1_watchdog_recalc (struct clk * clk); +static unsigned long omap1_ckctl_recalc (struct clk *clk); +static unsigned long omap1_watchdog_recalc (struct clk *clk);static int omap1_set_sossi_rate (struct clk *clk,unsigned long rate); -static void omap1_sossi_recalc (struct clk *clk); -static void omap1_ckctl_recalc_dsp_domain (struct clk * clk); +static unsigned long omap1_sossi_recalc (struct clk *clk); +static unsigned long omap1_ckctl_recalc_dsp_domain (struct clk *clk);static int omap1_clk_set_rate_dsp_domain (struct clk * clk,unsigned long rate);static int omap1_set_uart_rate (struct clk * clk,unsigned long rate); -static void omap1_uart_recalc (struct clk * clk); +static unsigned long omap1_uart_recalc (struct clk *clk);static int omap1_set_ext_clk_rate (struct clk * clk,unsigned long rate);static long omap1_round_ext_clk_rate (struct clk * clk,unsigned long rate);static void omap1_init_ext_clk (struct clk * clk);
arch/arm/mach-omap2/clock.c +9 -8
@@ -239,11 +239,11 @@ u32 omap2_get_dpll_rate(struct clk *clk)* Used for clocks that have the same value as the parent clock, * divided by some factor */ -void omap2_fixed_divisor_recalc (struct clk *clk) +unsigned long omap2_fixed_divisor_recalc (struct clk *clk) {WARN_ON (!clk->fixed_div); - clk->rate = clk->parent->rate / clk->fixed_div; +return clk->parent->rate / clk->fixed_div; }/**
@@ -449,21 +449,22 @@ err:* Used for clocks that are part of CLKSEL_xyz governed clocks. * REVISIT: Maybe change to use clk->enable() functions like on omap1? */ -void omap2_clksel_recalc (struct clk *clk) +unsigned long omap2_clksel_recalc (struct clk *clk) { +unsigned long rate;u32 div =0 ;pr_debug ("clock: recalc'ing clksel clk %s\n" , clk->name); div =omap2_clksel_get_divisor (clk);if (div ==0 ) -return ; +return clk->rate; -if (clk->rate == (clk->parent->rate / div)) -return ; - clk->rate = clk->parent->rate / div; + rate = clk->parent->rate / div; + +pr_debug ("clock: new clock rate is %ld (div %d)\n" , rate, div); -pr_debug ("clock: new clock rate is %ld (div %d)\n" , clk->rate, div); +return rate; }/**
arch/arm/mach-omap2/clock.h +2 -2
@@ -36,7 +36,7 @@ void omap2_clk_disable_unused(struct clk *clk);#define omap2_clk_disable_unused NULL#endif -void omap2_clksel_recalc (struct clk *clk); +unsigned long omap2_clksel_recalc (struct clk *clk);void omap2_init_clk_clkdm (struct clk *clk);void omap2_init_clksel_parent (struct clk *clk);u32 omap2_clksel_get_divisor (struct clk *clk);
@@ -44,7 +44,7 @@ u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate, u32 *new_div);u32 omap2_clksel_to_divisor (struct clk *clk,u32 field_val);u32 omap2_divisor_to_clksel (struct clk *clk,u32 div); -void omap2_fixed_divisor_recalc (struct clk *clk); +unsigned long omap2_fixed_divisor_recalc (struct clk *clk);long omap2_clksel_round_rate (struct clk *clk,unsigned long target_rate);int omap2_clksel_set_rate (struct clk *clk,unsigned long rate);u32 omap2_get_dpll_rate (struct clk *clk);
arch/arm/mach-omap2/clock24xx.c +10 -10
@@ -369,9 +369,9 @@ static long omap2_dpllcore_round_rate(unsigned long target_rate) } -static void omap2_dpllcore_recalc (struct clk *clk) +static unsigned long omap2_dpllcore_recalc (struct clk *clk) { - clk->rate =omap2_get_dpll_rate_24xx (clk); +return omap2_get_dpll_rate_24xx (clk); }static int omap2_reprogram_dpllcore (struct clk *clk,unsigned long rate)
@@ -448,9 +448,9 @@ static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)* * Set virt_prcm_set's rate to the mpu_speed field of the current PRCM set. */ -static void omap2_table_mpu_recalc (struct clk *clk) +static unsigned long omap2_table_mpu_recalc (struct clk *clk) { - clk->rate = curr_prcm_set->mpu_speed; +return curr_prcm_set->mpu_speed; }/*
@@ -647,14 +647,14 @@ static u32 omap2_get_sysclkdiv(void)return div; } -static void omap2_osc_clk_recalc (struct clk *clk) +static unsigned long omap2_osc_clk_recalc (struct clk *clk) { - clk->rate =omap2_get_apll_clkin () *omap2_get_sysclkdiv (); +return omap2_get_apll_clkin () *omap2_get_sysclkdiv (); } -static void omap2_sys_clk_recalc (struct clk *clk) +static unsigned long omap2_sys_clk_recalc (struct clk *clk) { - clk->rate = clk->parent->rate /omap2_get_sysclkdiv (); +return clk->parent->rate /omap2_get_sysclkdiv (); }/*
@@ -707,9 +707,9 @@ int __init omap2_clk_init(void)clk_init (&omap2_clk_functions); -omap2_osc_clk_recalc (&osc_ck); + osc_ck.rate =omap2_osc_clk_recalc (&osc_ck);propagate_rate (&osc_ck); -omap2_sys_clk_recalc (&sys_ck); + sys_ck.rate =omap2_sys_clk_recalc (&sys_ck);propagate_rate (&sys_ck);for (c = omap24xx_clks; c < omap24xx_clks +ARRAY_SIZE (omap24xx_clks); c++)
arch/arm/mach-omap2/clock24xx.h +5 -5
@@ -24,13 +24,13 @@#include "cm-regbits-24xx.h" #include "sdrc.h" -static void omap2_table_mpu_recalc (struct clk *clk); +static unsigned long omap2_table_mpu_recalc (struct clk *clk);static int omap2_select_table_rate (struct clk *clk,unsigned long rate);static long omap2_round_to_table_rate (struct clk *clk,unsigned long rate); -static void omap2_sys_clk_recalc (struct clk *clk); -static void omap2_osc_clk_recalc (struct clk *clk); -static void omap2_sys_clk_recalc (struct clk *clk); -static void omap2_dpllcore_recalc (struct clk *clk); +static unsigned long omap2_sys_clk_recalc (struct clk *clk); +static unsigned long omap2_osc_clk_recalc (struct clk *clk); +static unsigned long omap2_sys_clk_recalc (struct clk *clk); +static unsigned long omap2_dpllcore_recalc (struct clk *clk);static int omap2_reprogram_dpllcore (struct clk *clk,unsigned long rate);/* Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated.
arch/arm/mach-omap2/clock34xx.c +7 -5
@@ -289,9 +289,9 @@ static struct omap_clk omap34xx_clks[] = {* * Recalculate and propagate the DPLL rate. */ -static void omap3_dpll_recalc (struct clk *clk) +static unsigned long omap3_dpll_recalc (struct clk *clk) { - clk->rate =omap2_get_dpll_rate (clk); +return omap2_get_dpll_rate (clk); }/* _omap3_dpll_write_clken - write clken_bits arg to a DPLL's enable bits */
@@ -787,9 +787,10 @@ static void omap3_dpll_deny_idle(struct clk *clk)* Using parent clock DPLL data, look up DPLL state. If locked, set our * rate to the dpll_clk * 2; otherwise, just use dpll_clk. */ -static void omap3_clkoutx2_recalc (struct clk *clk) +static unsigned long omap3_clkoutx2_recalc (struct clk *clk) {const struct dpll_data *dd; +unsigned long rate;u32 v;struct clk *pclk;
@@ -808,9 +809,10 @@ static void omap3_clkoutx2_recalc(struct clk *clk) v =__raw_readl (dd->control_reg) & dd->enable_mask; v >>=__ffs (dd->enable_mask);if (v !=DPLL_LOCKED ) - clk->rate = clk->parent->rate; + rate = clk->parent->rate;else - clk->rate = clk->parent->rate *2 ; + rate = clk->parent->rate *2 ; +return rate; }/* Common clock code */
arch/arm/mach-omap2/clock34xx.h +2 -2
@@ -27,8 +27,8 @@#include "prm.h" #include "prm-regbits-34xx.h" -static void omap3_dpll_recalc (struct clk *clk); -static void omap3_clkoutx2_recalc (struct clk *clk); +static unsigned long omap3_dpll_recalc (struct clk *clk); +static unsigned long omap3_clkoutx2_recalc (struct clk *clk);static void omap3_dpll_allow_idle (struct clk *clk);static void omap3_dpll_deny_idle (struct clk *clk);static u32 omap3_dpll_autoidle_read (struct clk *clk);
arch/arm/plat-omap/clock.c +6 -9
@@ -126,7 +126,7 @@ int clk_set_rate(struct clk *clk, unsigned long rate) ret = arch_clock->clk_set_rate (clk, rate);if (ret ==0 ) {if (clk->recalc) - clk->recalc (clk); + clk->rate = clk->recalc (clk);propagate_rate (clk); }spin_unlock_irqrestore (&clockfw_lock, flags);
@@ -148,7 +148,7 @@ int clk_set_parent(struct clk *clk, struct clk *parent) ret = arch_clock->clk_set_parent (clk, parent);if (ret ==0 ) {if (clk->recalc) - clk->recalc (clk); + clk->rate = clk->recalc (clk);propagate_rate (clk); }spin_unlock_irqrestore (&clockfw_lock, flags);
@@ -188,12 +188,9 @@ static int __init omap_clk_setup(char *str)__setup ("mpurate=" , omap_clk_setup);/* Used for clocks that always have same value as the parent clock */ -void followparent_recalc (struct clk *clk) +unsigned long followparent_recalc (struct clk *clk) { -if (clk ==NULL ||IS_ERR (clk)) -return ; - - clk->rate = clk->parent->rate; +return clk->parent->rate; }void clk_reparent (struct clk *child,struct clk *parent)
@@ -214,7 +211,7 @@ void propagate_rate(struct clk * tclk)list_for_each_entry (clkp, &tclk->children, sibling) {if (clkp->recalc) - clkp->recalc (clkp); + clkp->rate = clkp->recalc (clkp);propagate_rate (clkp); } }
@@ -234,7 +231,7 @@ void recalculate_root_clocks(void)list_for_each_entry (clkp, &root_clks, sibling) {if (clkp->recalc) - clkp->recalc (clkp); + clkp->rate = clkp->recalc (clkp);propagate_rate (clkp); } }
arch/arm/plat-omap/include/mach/clock.h +2 -2
@@ -75,7 +75,7 @@ struct clk {unsigned long rate;__u32 flags;void __iomem *enable_reg; -void (*recalc)(struct clk *); +unsigned long (*recalc)(struct clk *);int (*set_rate)(struct clk *,unsigned long );long (*round_rate)(struct clk *,unsigned long );void (*init)(struct clk *);
@@ -123,7 +123,7 @@ extern void clk_reparent(struct clk *child, struct clk *parent);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 unsigned long followparent_recalc (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);
Signature · 1 line
1.6.1.2
PATCH 82/86 omap: add support for bypassing DPLLs
From: Russell King <[email protected]>
This roughly corresponds with OMAP commits: 7d06c48, 3241b19, 88b5d9b, 18a5500, 9c909ac, 5c6497b, 8b1f0bd, 2ac1da8.
For both OMAP2 and OMAP3, we note the reference and bypass clocks in the DPLL data structure. Whenever we modify the DPLL rate, we first ensure that both the reference and bypass clocks are enabled. Then, we decide whether to use the reference and DPLL, or the bypass clock if the desired rate is identical to the bypass rate, and program the DPLL appropriately. Finally, we update the clock's parent, and then disable the unused clocks.
This keeps the parents correctly balanced, and more importantly ensures that the bypass clock is running whenever we reprogram the DPLL. This is especially important because the procedure for reprogramming the DPLL involves switching to the bypass clock.
--- arch/arm/mach-omap2/clock.c | 47 +++++++-- arch/arm/mach-omap2/clock.h | 15 +++ arch/arm/mach-omap2/clock24xx.c | 39 +++++--- arch/arm/mach-omap2/clock24xx.h | 4 + arch/arm/mach-omap2/clock34xx.c | 90 ++++++++++++---- arch/arm/mach-omap2/clock34xx.h | 177 +++++-------------------------- arch/arm/mach-omap2/sdrc2xxx.c | 2 +- arch/arm/plat-omap/include/mach/clock.h | 11 +-- 8 files changed, 186 insertions(+), 199 deletions(-)
arch/arm/mach-omap2/clock.c +37 -10
@@ -211,25 +211,52 @@ void omap2_init_clksel_parent(struct clk *clk)return ; } -/* Returns the DPLL rate */ +/** +* omap2_get_dpll_rate - returns the current DPLL CLKOUT rate +* @clk: struct clk * of a DPLL +* +* DPLLs can be locked or bypassed - basically, enabled or disabled. +* When locked, the DPLL output depends on the M and N values. When +* bypassed, on OMAP2xxx, the output rate is either the 32KiHz clock +* or sys_clk. Bypass rates on OMAP3 depend on the DPLL: DPLLs 1 and +* 2 are bypassed with dpll1_fclk and dpll2_fclk respectively +* (generated by DPLL3), while DPLL 3, 4, and 5 bypass rates are sys_clk. +* Returns the current DPLL CLKOUT rate (*not* CLKOUTX2) if the DPLL is +* locked, or the appropriate bypass rate if the DPLL is bypassed, or 0 +* if the clock @clk is not a DPLL. +*/ u32 omap2_get_dpll_rate (struct clk *clk) {long long dpll_clk; -u32 dpll_mult, dpll_div, dpll; +u32 dpll_mult, dpll_div, v;struct dpll_data *dd; dd = clk->dpll_data; -/* REVISIT: What do we return on error? */ if (!dd)return 0 ; - dpll =__raw_readl (dd->mult_div1_reg); - dpll_mult = dpll & dd->mult_mask; +/* Return bypass rate if DPLL is bypassed */ + v =__raw_readl (dd->control_reg); + v &= dd->enable_mask; + v >>=__ffs (dd->enable_mask); + +if (cpu_is_omap24xx ()) { +if (v ==OMAP2XXX_EN_DPLL_LPBYPASS || + v ==OMAP2XXX_EN_DPLL_FRBYPASS ) +return dd->clk_bypass->rate; + }else if (cpu_is_omap34xx ()) { +if (v ==OMAP3XXX_EN_DPLL_LPBYPASS || + v ==OMAP3XXX_EN_DPLL_FRBYPASS ) +return dd->clk_bypass->rate; + } + + v =__raw_readl (dd->mult_div1_reg); + dpll_mult = v & dd->mult_mask; dpll_mult >>=__ffs (dd->mult_mask); - dpll_div = dpll & dd->div1_mask; + dpll_div = v & dd->div1_mask; dpll_div >>=__ffs (dd->div1_mask); - dpll_clk = (long long )clk->parent->rate * dpll_mult; + dpll_clk = (long long )dd->clk_ref->rate * dpll_mult;do_div (dpll_clk, dpll_div +1 );return dpll_clk;
@@ -930,7 +957,7 @@ long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate)pr_debug ("clock: starting DPLL round_rate for clock %s, target rate " "%ld\n" , clk->name, target_rate); - scaled_rt_rp = target_rate / (clk->parent->rate /DPLL_SCALE_FACTOR ); + scaled_rt_rp = target_rate / (dd->clk_ref->rate /DPLL_SCALE_FACTOR ); scaled_max_m = dd->max_multiplier *DPLL_SCALE_FACTOR ; dd->last_rounded_rate =0 ;
@@ -957,7 +984,7 @@ long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate)break ; r =_dpll_test_mult (&m, n, &new_rate, target_rate, - clk->parent->rate); + dd->clk_ref->rate);/* m can't be set low enough for this n - try with a larger n */ if (r ==DPLL_MULT_UNDERFLOW )
@@ -988,7 +1015,7 @@ long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate) dd->last_rounded_m = min_e_m; dd->last_rounded_n = min_e_n; - dd->last_rounded_rate =_dpll_compute_new_rate (clk->parent->rate, + dd->last_rounded_rate =_dpll_compute_new_rate (dd->clk_ref->rate, min_e_m, min_e_n); pr_debug("clock: final least error: e = %d, m = %d, n = %d\n",
arch/arm/mach-omap2/clock.h +15 -0
@@ -21,6 +21,21 @@/* The maximum error between a target DPLL rate and the rounded rate in Hz */ #define DEFAULT_DPLL_RATE_TOLERANCE 50000 +/* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */ +#define CORE_CLK_SRC_32K 0x0 +#define CORE_CLK_SRC_DPLL 0x1 +#define CORE_CLK_SRC_DPLL_X2 0x2 + +/* OMAP2xxx CM_CLKEN_PLL.EN_DPLL bits - for omap2_get_dpll_rate() */ +#define OMAP2XXX_EN_DPLL_LPBYPASS 0x1 +#define OMAP2XXX_EN_DPLL_FRBYPASS 0x2 +#define OMAP2XXX_EN_DPLL_LOCKED 0x3 + +/* OMAP3xxx CM_CLKEN_PLL*.EN_*_DPLL bits - for omap2_get_dpll_rate() */ +#define OMAP3XXX_EN_DPLL_LPBYPASS 0x5 +#define OMAP3XXX_EN_DPLL_FRBYPASS 0x6 +#define OMAP3XXX_EN_DPLL_LOCKED 0x7 +int omap2_clk_init (void );int omap2_clk_enable (struct clk *clk);void omap2_clk_disable (struct clk *clk);
arch/arm/mach-omap2/clock24xx.c +26 -13
@@ -236,19 +236,32 @@ static struct clk *sclk;* Omap24xx specific clock functions *-------------------------------------------------------------------------*/ -/* This actually returns the rate of core_ck, not dpll_ck. */ -static u32 omap2_get_dpll_rate_24xx (struct clk *tclk) +/** +* omap2xxx_clk_get_core_rate - return the CORE_CLK rate +* @clk: pointer to the combined dpll_ck + core_ck (currently "dpll_ck") +* +* Returns the CORE_CLK rate. CORE_CLK can have one of three rate +* sources on OMAP2xxx: the DPLL CLKOUT rate, DPLL CLKOUTX2, or 32KHz +* (the latter is unusual). This currently should be called with +* struct clk *dpll_ck, which is a composite clock of dpll_ck and +* core_ck. +*/ +static unsigned long omap2xxx_clk_get_core_rate (struct clk *clk) { -long long dpll_clk; -u8 amult; +long long core_clk; +u32 v; - dpll_clk =omap2_get_dpll_rate (tclk); + core_clk =omap2_get_dpll_rate (clk); - amult =cm_read_mod_reg (PLL_MOD ,CM_CLKSEL2 ); - amult &=OMAP24XX_CORE_CLK_SRC_MASK ; - dpll_clk *= amult; + v =cm_read_mod_reg (PLL_MOD ,CM_CLKSEL2 ); + v &=OMAP24XX_CORE_CLK_SRC_MASK ; + +if (v ==CORE_CLK_SRC_32K ) + core_clk =32768 ; +else + core_clk *= v; -return dpll_clk; +return core_clk; }static int omap2_enable_osc_ck (struct clk *clk)
@@ -371,7 +384,7 @@ static long omap2_dpllcore_round_rate(unsigned long target_rate)static unsigned long omap2_dpllcore_recalc (struct clk *clk) { -return omap2_get_dpll_rate_24xx (clk); +return omap2xxx_clk_get_core_rate (clk); }static int omap2_reprogram_dpllcore (struct clk *clk,unsigned long rate)
@@ -381,7 +394,7 @@ static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)struct prcm_config tmpset;const struct dpll_data *dd; - cur_rate =omap2_get_dpll_rate_24xx (&dpll_ck); + cur_rate =omap2xxx_clk_get_core_rate (&dpll_ck); mult =cm_read_mod_reg (PLL_MOD ,CM_CLKSEL2 ); mult &=OMAP24XX_CORE_CLK_SRC_MASK ;
@@ -516,7 +529,7 @@ static int omap2_select_table_rate(struct clk *clk, unsigned long rate) } curr_prcm_set = prcm; - cur_rate =omap2_get_dpll_rate_24xx (&dpll_ck); + cur_rate =omap2xxx_clk_get_core_rate (&dpll_ck);if (prcm->dpll_speed == cur_rate /2 ) {omap2xxx_sdrc_reprogram (CORE_CLK_SRC_DPLL ,1 );
@@ -728,7 +741,7 @@ int __init omap2_clk_init(void) }/* Check the MPU rate set by bootloader */ - clkrate =omap2_get_dpll_rate_24xx (&dpll_ck); + clkrate =omap2xxx_clk_get_core_rate (&dpll_ck);for (prcm = rate_table; prcm->mpu_speed; prcm++) {if (!(prcm->flags & cpu_mask))continue ;
arch/arm/mach-omap2/clock24xx.h +4 -0
@@ -663,6 +663,10 @@ static struct dpll_data dpll_dd = { .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), .mult_mask = OMAP24XX_DPLL_MULT_MASK, .div1_mask = OMAP24XX_DPLL_DIV_MASK, + .clk_bypass = &sys_ck, + .clk_ref = &sys_ck, + .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), + .enable_mask = OMAP24XX_EN_DPLL_MASK, .max_multiplier = 1024, .min_divider = 1, .max_divider = 16,
arch/arm/mach-omap2/clock34xx.c +71 -19
155 lines not on this page · raw message
arch/arm/mach-omap2/clock34xx.h +28 -149
343 lines not on this page · raw message
arch/arm/mach-omap2/sdrc2xxx.c +1 -1
@@ -29,7 +29,7 @@#include <mach/sram.h> #include "prm.h" - +#include "clock.h" #include <mach/sdrc.h> #include "sdrc.h"
arch/arm/plat-omap/include/mach/clock.h +4 -7
@@ -39,6 +39,10 @@ struct dpll_data {void __iomem *mult_div1_reg;u32 mult_mask;u32 div1_mask; +struct clk *clk_bypass; +struct clk *clk_ref; +void __iomem *control_reg; +u32 enable_mask;unsigned int rate_tolerance;unsigned long last_rounded_rate;u16 last_rounded_m;
@@ -49,10 +53,8 @@ struct dpll_data {u16 max_multiplier;# if defined(CONFIG_ARCH_OMAP3 )u8 modes; -void __iomem *control_reg;void __iomem *autoidle_reg;void __iomem *idlest_reg; -u32 enable_mask;u32 autoidle_mask;u32 freqsel_mask;u32 idlest_mask;
@@ -154,9 +156,4 @@ extern const struct clkops clkops_null;#define RATE_IN_24XX (RATE_IN_242X | RATE_IN_243X) -/* CM_CLKSEL2_PLL.CORE_CLK_SRC options (24XX) */ -#define CORE_CLK_SRC_32K 0 -#define CORE_CLK_SRC_DPLL 1 -#define CORE_CLK_SRC_DPLL_X2 2 -#endif
Signature · 1 line
1.6.1.2
PATCH 83/86 OMAP3: update ES level flags to discriminate between post-ES2 revisions
From: Paul Walmsley <[email protected]>
Some OMAP3 chip behaviors change in ES levels after ES2. Modify the existing omap_chip flags to add options for ES3.0 and ES3.1.
Add a new macro, CHIP_GE_OMAP3430ES2, to cover ES levels from ES2 onwards - a common pattern for OMAP3 features. Update all current users of the omap_chip macros to use this new macro.
Also add CHIP_GE_OMAP3430ES3_1 to cover the USBTLL SAR errata case (described and fixed in the following patch)
--- arch/arm/mach-omap2/clockdomains.h | 6 +++--- arch/arm/mach-omap2/id.c | 7 ++++++- arch/arm/mach-omap2/powerdomains34xx.h | 6 +++--- arch/arm/plat-omap/include/mach/cpu.h | 26 ++++++++++++++++++++------ 4 files changed, 32 insertions(+), 13 deletions(-)
arch/arm/mach-omap2/clockdomains.h +3 -3
@@ -182,7 +182,7 @@ static struct clockdomain sgx_clkdm = { .pwrdm = { .name = "sgx_pwrdm" }, .flags = CLKDM_CAN_HWSUP_SWSUP, .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_SGX_MASK, - .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES2), + .omap_chip = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2), };/*
@@ -237,7 +237,7 @@ static struct clockdomain usbhost_clkdm = { .pwrdm = { .name = "usbhost_pwrdm" }, .flags = CLKDM_CAN_HWSUP_SWSUP, .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_USBHOST_MASK, - .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES2), + .omap_chip = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2), };static struct clockdomain per_clkdm = {
@@ -287,7 +287,7 @@ static struct clockdomain dpll4_clkdm = {static struct clockdomain dpll5_clkdm = { .name ="dpll5_clkdm" , .pwrdm = { .name ="dpll5_pwrdm" }, - .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430ES2 ), + .omap_chip =OMAP_CHIP_INIT (CHIP_GE_OMAP3430ES2 ), };#endif /* CONFIG_ARCH_OMAP34XX */
arch/arm/mach-omap2/id.c +6 -1
@@ -217,8 +217,13 @@ void __init omap2_check_revision(void) omap_chip.oc =CHIP_IS_OMAP3430 ;if (omap_rev () ==OMAP3430_REV_ES1_0 ) omap_chip.oc |=CHIP_IS_OMAP3430ES1 ; -else if (omap_rev () >OMAP3430_REV_ES1_0 ) +else if (omap_rev () >=OMAP3430_REV_ES2_0 && +omap_rev () <=OMAP3430_REV_ES2_1 ) omap_chip.oc |=CHIP_IS_OMAP3430ES2 ; +else if (omap_rev () ==OMAP3430_REV_ES3_0 ) + omap_chip.oc |=CHIP_IS_OMAP3430ES3_0 ; +else if (omap_rev () ==OMAP3430_REV_ES3_1 ) + omap_chip.oc |=CHIP_IS_OMAP3430ES3_1 ; }else {pr_err ("Uninitialized omap_chip, please fix!\n" ); }
arch/arm/mach-omap2/powerdomains34xx.h +3 -3
@@ -244,7 +244,7 @@ static struct powerdomain dss_pwrdm = {static struct powerdomain sgx_pwrdm = { .name ="sgx_pwrdm" , .prcm_offs =OMAP3430ES2_SGX_MOD , - .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430ES2 ), + .omap_chip =OMAP_CHIP_INIT (CHIP_GE_OMAP3430ES2 ), .wkdep_srcs = gfx_sgx_wkdeps, .sleepdep_srcs = cam_gfx_sleepdeps,/* XXX This is accurate for 3430 SGX, but what about GFX? */
@@ -312,7 +312,7 @@ static struct powerdomain neon_pwrdm = {static struct powerdomain usbhost_pwrdm = { .name ="usbhost_pwrdm" , .prcm_offs =OMAP3430ES2_USBHOST_MOD , - .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430ES2 ), + .omap_chip =OMAP_CHIP_INIT (CHIP_GE_OMAP3430ES2 ), .wkdep_srcs = per_usbhost_wkdeps, .sleepdep_srcs = dss_per_usbhost_sleepdeps, .pwrsts =PWRSTS_OFF_RET_ON ,
@@ -354,7 +354,7 @@ static struct powerdomain dpll4_pwrdm = {static struct powerdomain dpll5_pwrdm = { .name ="dpll5_pwrdm" , .prcm_offs =PLL_MOD , - .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430ES2 ), + .omap_chip =OMAP_CHIP_INIT (CHIP_GE_OMAP3430ES2 ), };
arch/arm/plat-omap/include/mach/cpu.h +20 -6
@@ -355,13 +355,27 @@ IS_OMAP_TYPE(3430, 0x3430)* use omap_chip_is(). * */ -#define CHIP_IS_OMAP2420 (1 << 0) -#define CHIP_IS_OMAP2430 (1 << 1) -#define CHIP_IS_OMAP3430 (1 << 2) -#define CHIP_IS_OMAP3430ES1 (1 << 3) -#define CHIP_IS_OMAP3430ES2 (1 << 4) +#define CHIP_IS_OMAP2420 (1 << 0) +#define CHIP_IS_OMAP2430 (1 << 1) +#define CHIP_IS_OMAP3430 (1 << 2) +#define CHIP_IS_OMAP3430ES1 (1 << 3) +#define CHIP_IS_OMAP3430ES2 (1 << 4) +#define CHIP_IS_OMAP3430ES3_0 (1 << 5) +#define CHIP_IS_OMAP3430ES3_1 (1 << 6) + +#define CHIP_IS_OMAP24XX (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430) + +/* +* "GE" here represents "greater than or equal to" in terms of ES +* levels. So CHIP_GE_OMAP3430ES2 is intended to match all OMAP3430 +* chips at ES2 and beyond, but not, for example, any OMAP lines after +* OMAP3. +*/ +#define CHIP_GE_OMAP3430ES2 (CHIP_IS_OMAP3430ES2 | \ + CHIP_IS_OMAP3430ES3_0 | \ + CHIP_IS_OMAP3430ES3_1) +#define CHIP_GE_OMAP3430ES3_1 (CHIP_IS_OMAP3430ES3_1) -#define CHIP_IS_OMAP24XX (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430)int omap_chip_is (struct omap_chip_id oci);int omap_type (void );
Signature · 1 line
1.6.1.2
PATCH 84/86 OMAP3 powerdomains: make USBTLL SAR only available on ES3.1 and beyond
From: Paul Walmsley <[email protected]>
Richard Woodruff writes that chip errata prevent USBTLL SAR from working on OMAP3 ES levels before ES3.1:
http://marc.info/?l=linux-arm-kernel&m=123319614808833&w=2
Update the OMAP3 powerdomain structures appropriately.
--- arch/arm/mach-omap2/powerdomains.h | 3 ++- arch/arm/mach-omap2/powerdomains34xx.h | 25 +++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/powerdomains.h +2 -1
@@ -171,7 +171,8 @@ static struct powerdomain *powerdomains_omap[] __initdata = { &iva2_pwrdm, &mpu_34xx_pwrdm, &neon_pwrdm, - &core_34xx_pwrdm, + &core_34xx_pre_es3_1_pwrdm, + &core_34xx_es3_1_pwrdm, &cam_pwrdm, &dss_pwrdm, &per_pwrdm,
arch/arm/mach-omap2/powerdomains34xx.h +23 -2
@@ -200,12 +200,33 @@ static struct powerdomain mpu_34xx_pwrdm = { };/* No wkdeps or sleepdeps for 34xx core apparently */ -static struct powerdomain core_34xx_pwrdm = { +static struct powerdomain core_34xx_pre_es3_1_pwrdm = { .name ="core_pwrdm" , .prcm_offs =CORE_MOD , - .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ), + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430ES1 | +CHIP_IS_OMAP3430ES2 | +CHIP_IS_OMAP3430ES3_0 ), + .pwrsts =PWRSTS_OFF_RET_ON , + .dep_bit =OMAP3430_EN_CORE_SHIFT , + .banks =2 , + .pwrsts_mem_ret = { + [0 ] =PWRSTS_OFF_RET ,/* MEM1RETSTATE */ + [1 ] =PWRSTS_OFF_RET ,/* MEM2RETSTATE */ + }, + .pwrsts_mem_on = { + [0 ] =PWRSTS_OFF_RET_ON ,/* MEM1ONSTATE */ + [1 ] =PWRSTS_OFF_RET_ON ,/* MEM2ONSTATE */ + }, +}; + +/* No wkdeps or sleepdeps for 34xx core apparently */ +static struct powerdomain core_34xx_es3_1_pwrdm = { + .name ="core_pwrdm" , + .prcm_offs =CORE_MOD , + .omap_chip =OMAP_CHIP_INIT (CHIP_GE_OMAP3430ES3_1 ), .pwrsts =PWRSTS_OFF_RET_ON , .dep_bit =OMAP3430_EN_CORE_SHIFT , + .flags =PWRDM_HAS_HDWR_SAR ,/* for USBTLL only */ .banks =2 , .pwrsts_mem_ret = { [0 ] =PWRSTS_OFF_RET ,/* MEM1RETSTATE */
Signature · 1 line
1.6.1.2
PATCH 85/86 omap: ensure that failing power domain lookups produce errors
From: Russell King <[email protected]>
Use pr_err() for errors rather than pr_debug(). pr_debug() are compiled away unless -DDEBUG is used.
--- arch/arm/mach-omap2/clockdomain.c | 13 +++++-------- 1 files changed, 5 insertions(+), 8 deletions(-)
arch/arm/mach-omap2/clockdomain.c +5 -8
@@ -74,14 +74,11 @@ static void _autodep_lookup(struct clkdm_pwrdm_autodep *autodep) pwrdm =pwrdm_lookup (autodep->pwrdm.name);if (!pwrdm) { -pr_debug ("clockdomain: _autodep_lookup: powerdomain %s " -"does not exist\n" , autodep->pwrdm.name); -WARN_ON (1 ); +pr_err ("clockdomain: autodeps: powerdomain %s does not exist\n" , + autodep->pwrdm.name); pwrdm =ERR_PTR (-ENOENT ); } autodep->pwrdm.ptr = pwrdm; - -return ; }/*
@@ -211,8 +208,8 @@ int clkdm_register(struct clockdomain *clkdm) pwrdm =pwrdm_lookup (clkdm->pwrdm.name);if (!pwrdm) { -pr_debug ("clockdomain: clkdm_register %s: powerdomain %s " -"does not exist\n" , clkdm->name, clkdm->pwrdm.name); +pr_err ("clockdomain: %s: powerdomain %s does not exist\n" , + clkdm->name, clkdm->pwrdm.name);return -EINVAL ; } clkdm->pwrdm.ptr = pwrdm;
@@ -222,7 +219,7 @@ int clkdm_register(struct clockdomain *clkdm)if (_clkdm_lookup (clkdm->name)) { ret = -EEXIST ; goto cr_unlock; - }; + }list_add (&clkdm->node, &clkdm_list);
Signature · 1 line
1.6.1.2
PATCH 86/86 omap: clk_set_parent: deny changing parent if clock is enabled
From: Russell King <[email protected]>
Richard Woodruff writes:
| The historic usage of this has been against single use leaf clocks | (1st instance of gptimer). When it was used it did: | clk_get() | clk_set_parent() | clk_enable() | | This usage was ok for that. Use on a disabled clock is needed. | | If there are multiple users on the clock or it is enabled there are | problems. | | The call can still be unfriendly if 2 different drivers are using the | clock with their own clock get/enable. It might be the function should | return an error if usecount != 0 to stop surprises. It is all around | better if the parenting is done when the clock is off.
This is a good reason to ensure that the clock is not enabled when clk_set_parent() is called.
--- arch/arm/mach-omap2/clock.c | 6 ------ arch/arm/plat-omap/clock.c | 17 ++++++++++------- 2 files changed, 10 insertions(+), 13 deletions(-)
arch/arm/mach-omap2/clock.c +0 -6
@@ -807,9 +807,6 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)if (!parent_div)return -EINVAL ; -if (clk->usecount >0 ) -_omap2_clk_disable (clk); -/* Set new source value (previous dividers if any in effect) */ v =__raw_readl (clk->clksel_reg); v &= ~clk->clksel_mask;
@@ -819,9 +816,6 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)_omap2xxx_clk_commit (clk); -if (clk->usecount >0 ) -_omap2_clk_enable (clk); -clk_reparent (clk, new_parent);/* CLKSEL clocks follow their parents' rates, divided by a divisor */
arch/arm/plat-omap/clock.c +10 -7
@@ -144,13 +144,16 @@ int clk_set_parent(struct clk *clk, struct clk *parent)return ret;spin_lock_irqsave (&clockfw_lock, flags); -if (arch_clock->clk_set_parent) - ret = arch_clock->clk_set_parent (clk, parent); -if (ret ==0 ) { -if (clk->recalc) - clk->rate = clk->recalc (clk); -propagate_rate (clk); - } +if (clk->usecount ==0 ) { +if (arch_clock->clk_set_parent) + ret = arch_clock->clk_set_parent (clk, parent); +if (ret ==0 ) { +if (clk->recalc) + clk->rate = clk->recalc (clk); +propagate_rate (clk); + } + }else + ret = -EBUSY ;spin_unlock_irqrestore (&clockfw_lock, flags);return ret;
Signature · 1 line
1.6.1.2
RE: [PATCH 38/86] [ARM] OMAP: Fix sparse, checkpatch warnings in OMAP2/3 PRCM/PM code
In reply to Kevin HilmanQuoted 6 lines
From: [email protected] [mailto:[email protected]] On Behalf Of Kevin Hilman
Sent: Thursday, March 12, 2009 1:28 PM
To: [email protected]
Subject: [PATCH 38/86] [ARM] OMAP: Fix sparse, checkpatch warnings in OMAP2/3 PRCM/PM code
Patch fails apply to kernel.org master: 0038
Applying: OMAP: Fix sparse, checkpatch warnings in OMAP2/3 PRCM/PM code
error: patch failed: arch/arm/mach-omap2/clock.c:571
error: arch/arm/mach-omap2/clock.c: patch does not apply
Quoted 1 line
Re: [PATCH 38/86] [ARM] OMAP: Fix sparse, checkpatch warnings in OMAP2/3 PRCM/PM code
Quoted 6 lines · Vikram
Quoted 5 lines
From: [email protected] [mailto:[email protected]] On Behalf Of Kevin Hilman
Sent: Thursday, March 12, 2009 1:28 PM
To: [email protected]
Subject: [PATCH 38/86] [ARM] OMAP: Fix sparse, checkpatch warnings in OMAP2/3 PRCM/PM code
Quoted 6 lines
Patch fails apply to kernel.org master: 0038
Applying: OMAP: Fix sparse, checkpatch warnings in OMAP2/3 PRCM/PM code
error: patch failed:arch/arm/mach-omap2/clock.c:571
error:arch/arm/mach-omap2/clock.c: patch does not apply
Sorry, I forgot to mention this in PATCH 00/86.
This series is not against vanilla kernel.org. It is against one of Tony's 'omap-fixes' branches that Russell had already pulled in.
If you want to build/boot test, I suggest using Russell's branch directly.
Kevin
Quoted 5 lines · Kevin Hilman
This is the series of patches contained in the 'omap-clks3' branch of Russell King's git repository[1]. Posted on behalf of Russell who had some mail issues in first attempt, and then ran of out time.
This series is proposed to be merged into the next merge window.
FYI... I've rebased a minimal subset of the PM branch on top of this series and have been able to hit full-chip retention in suspend and idle.
I'm OK with this being merged.
Kevin
Quoted 190 lines
Comments to the list appreciated.
Kevin
[1] http://ftp.arm.linux.org.uk/pub/armlinux/kernel/git-cur/linux-2.6-arm.git
Daniel Stone (1):
[ARM] OMAP2: Fix definition of SGX clock register bitsJouni Hogander (2):
[ARM] OMAP3: PM:Emu_pwrdmis switched off by hardware even when sdti
is in use
[ARM] OMAP34XX: Add miscellaneous definitions related to 34xxKevin Hilman (1):
[ARM] OMAP2: Implement CPUfreq frequency table based on PRCM tablePaul Walmsley (34):
[ARM] OMAP2/3: Add non-CORE DPLL rate set code and M, N programming [ARM] OMAP: Fix sparse, checkpatch warnings in OMAP2/3 PRCM/PM code [ARM] OMAP24xx clock: add missing SSI L4 interface clock [ARM] OMAP3: move USBHOST SAR handling from clock framework to
powerdomain layer
[ARM] OMAP3 clock: fix 96MHz clocks
[ARM] OMAP: Makedpll4_m4_ckprogrammable withclk_set_rate()[ARM] OMAP2/3 clockdomains: combine pwrdm,pwrdm_nameinto union in
struct clockdomain
[ARM] OMAP2/3 clockdomains: add CM and PRM clkdms
[ARM] OMAP3 clock: movesys_clkout2clk tocore_clkdm[ARM] OMAP3 PRCM: add DPLL1-5 powerdomains, clockdomains; mark clocks [ARM] OMAP3 powerdomains: remove RET from SGX power states list [ARM] OMAP2/3 clockdomains: autodeps should respect platform flags [ARM] OMAP3 clock: fix DPLL jitter correction and rate programming [ARM] OMAP3 clock: DPLL{1,2}_FCLK clksel can divide by 4 [ARM] OMAP3 clock: convert dpll_data.idlest_bit toidlest_mask[ARM] OMAP3 clock: remove unnecessarydpll_datadereferences [ARM] OMAP3 clock: optimize DPLL rate rounding algorithm [ARM] OMAP3 clock: avoid invalid FREQSEL values during DPLL rate
rounding
[ARM] OMAP3 clock: disable DPLL autoidle while waiting for DPLL to
lock
[ARM] OMAP2/3 clock: clean upmach-omap2/clock.c
[ARM] OMAP2 PRCM: clean upCM_IDLESTbits
[ARM] OMAP2 SDRC: movemach-omap2/memory.hintomach/sdrc.h[ARM] OMAP2 SDRC: renamememory.ctosdrc2xxx.c
[ARM] OMAP2 SDRC: separate common OMAP2/3 code from OMAP2xxx code [ARM] OMAP2 SDRC: add SDRAM timing parameter infrastructure [ARM] OMAP3 clock: addomap3_core_dpll_m2_set_rate()
[ARM] OMAP2/3 clock: use standardset_ratefn inomap2_clk_arch_init()[ARM] OMAP2/3 clock: don't use a barrier after
clk_disable()[ARM] OMAP2xxx clock: consolidateDELAYED_APPclock commits; fix
barrier
[ARM] OMAP2/3 clock: convert remaining MPU barriers into OCP barriers [ARM] OMAP clock: dropclk_get_usecount()
[ARM] OMAP2/3 clock: don't tinker with hardirqs when they are
supposed to be disabled
[ARM] OMAP3: update ES level flags to discriminate between post-ES2
revisions
[ARM] OMAP3 powerdomains: make USBTLL SAR only available on ES3.1 and
beyondRussell King (44):
[ARM] omap: removeVIRTUAL_CLOCK
[ARM] omap: introduce clock operations structure
[ARM] omap: provide a NULL clock operations structure [ARM] omap: killPARENT_CONTROLS_CLOCK
[ARM] omap: add default .ops to all remaining OMAP2 clocks [ARM] omap: eliminate unnecessary conditionals in
omap2_clk_wait_ready
[ARM] omap: don't useclkops_omap2_dflt_waitfor non-ICLK/FCLK clocks [ARM] omap: removeclk->owner
[ARM] omap: rearrangeclock.hstructure order
[ARM] omap: removeclk_deny_idleandclk_allow_idle
[ARM] omap: provide a standardclk_get_parent()implementation [ARM] omap: move clock propagation into core omap clock code [ARM] omap: remove unnecessary calls topropagate_rate()[ARM] omap: movepropagate_rate()calls into generic omap clock code [ARM] omap: handleRATE_CKCTLvia .set_rate/.round_rate methods [ARM] omap: ensure devname is set for dummy devices
[ARM] omap: allow double-registering of clocks
[ARM] omap: convert OMAP1 to use clkdev
[ARM] omap: convert OMAP2 to use clkdev
[ARM] omap: convert OMAP3 to use clkdev
[ARM] omap: remove pre-CLKDEV clk_get/clk_put
[ARM] omap: provide a dummy clock node
[ARM] omap: watchdog: convert clocks to match by devid and conid [ARM] omap: watchdog: provide a dummy ick for OMAP1
[ARM] omap: MMC: convert clocks to match by devid and conid [ARM] omap: MMC: provide a dummy ick for OMAP1
[ARM] omap: mcspi: new short connection id names
[ARM] omap: mcbsp: convert to use fck/ick clocks directly [ARM] omap: i2c: use short connection ids
[ARM] omap: i2c: removearmxor_ck
[ARM] omap: i2c: remove conditional ick clocks
[ARM] omap: w1: convert omap HDQ clocks to match by devid and conid [ARM] omap: spi: arrange foromap_uwireto use connection ID [ARM] omap: convert omap RNG clocks to match by devid and conid [ARM] omap: omap24xxcam: use short connection IDs for omap2 clocks [ARM] omap: hsmmc: new short connection id names
[ARM] omap: clks: call recalc after any rate change
[ARM] omap: create a proper tree of clocks
[ARM] omap: fix usecount decrement bug
[ARM] omap: fix clockdomain enable/disable ordering
[ARM] omap: arrange for clock recalc methods to return the rate [ARM] omap: add support for bypassing DPLLs
[ARM] omap: ensure that failing power domain lookups produce errors [ARM] omap:clk_set_parent: deny changing parent if clock is enabledSergio Aguirre (1):
[ARM] OMAP: Add CSI2 clock struct for handling it with clock APITero Kristo (1):
[ARM] OMAP3: PM: Make sureclk_disable_unused()order is correctTomi Valkeinen (1):
[ARM] OMAP: wait for pwrdm transition afterclk_enable()Tony Lindgren (1):
[ARM] omap: Fix omap1 clock issuesarch/arm/mach-omap1/clock.c | 407 ++++++---- arch/arm/mach-omap1/clock.h | 412 +++------- arch/arm/mach-omap1/mcbsp.c | 52 +- arch/arm/mach-omap2/Makefile | 6 +- arch/arm/mach-omap2/board-2430sdp.c | 2 +- arch/arm/mach-omap2/board-apollon.c | 2 +- arch/arm/mach-omap2/board-generic.c | 2 +- arch/arm/mach-omap2/board-h4.c | 2 +- arch/arm/mach-omap2/board-ldp.c | 2 +- arch/arm/mach-omap2/board-omap3beagle.c | 2 +- arch/arm/mach-omap2/clock.c | 499 +++++++----- arch/arm/mach-omap2/clock.h | 24 +- arch/arm/mach-omap2/clock24xx.c | 377 +++++++-- arch/arm/mach-omap2/clock24xx.h | 525 +++++-------- arch/arm/mach-omap2/clock34xx.c | 582 ++++++++++++-- arch/arm/mach-omap2/clock34xx.h | 1076 +++++++++---------------- arch/arm/mach-omap2/clockdomain.c | 76 +- arch/arm/mach-omap2/clockdomains.h | 118 ++- arch/arm/mach-omap2/cm-regbits-24xx.h | 80 ++- arch/arm/mach-omap2/cm-regbits-34xx.h | 121 +++- arch/arm/mach-omap2/devices.c | 5 +- arch/arm/mach-omap2/id.c | 7 +- arch/arm/mach-omap2/io.c | 8 +- arch/arm/mach-omap2/mcbsp.c | 26 - arch/arm/mach-omap2/memory.c | 191 ----- arch/arm/mach-omap2/memory.h | 43 - arch/arm/mach-omap2/pm.c | 2 +- arch/arm/mach-omap2/powerdomains.h | 8 +- arch/arm/mach-omap2/powerdomains34xx.h | 68 ++- arch/arm/mach-omap2/prcm-common.h | 198 +++-- arch/arm/mach-omap2/prm-regbits-34xx.h | 9 + arch/arm/mach-omap2/prm.h | 24 +- arch/arm/mach-omap2/sdrc.c | 93 +++ arch/arm/mach-omap2/sdrc2xxx.c | 163 ++++ arch/arm/plat-omap/Kconfig | 3 + arch/arm/plat-omap/clock.c | 198 ++--- arch/arm/plat-omap/common.c | 2 +- arch/arm/plat-omap/cpu-omap.c | 57 ++- arch/arm/plat-omap/include/mach/clkdev.h | 13 + arch/arm/plat-omap/include/mach/clock.h | 80 +- arch/arm/plat-omap/include/mach/clockdomain.h | 24 +- arch/arm/plat-omap/include/mach/common.h | 2 +- arch/arm/plat-omap/include/mach/cpu.h | 26 +- arch/arm/plat-omap/include/mach/gpmc.h | 2 +- arch/arm/plat-omap/include/mach/io.h | 4 +- arch/arm/plat-omap/include/mach/mcbsp.h | 6 +- arch/arm/plat-omap/include/mach/pm.h | 12 - arch/arm/plat-omap/include/mach/powerdomain.h | 5 +- arch/arm/plat-omap/include/mach/prcm.h | 5 +- arch/arm/plat-omap/include/mach/sdrc.h | 64 ++- arch/arm/plat-omap/include/mach/system.h | 4 +- arch/arm/plat-omap/mcbsp.c | 90 +-- drivers/char/hw_random/omap-rng.c | 2 +- drivers/i2c/busses/i2c-omap.c | 47 +- drivers/media/video/omap24xxcam.c | 8 +- drivers/mmc/host/omap.c | 24 +- drivers/mmc/host/omap_hsmmc.c | 4 +- drivers/spi/omap2_mcspi.c | 4 +- drivers/spi/omap_uwire.c | 9 +- drivers/w1/masters/omap_hdq.c | 4 +- drivers/watchdog/omap_wdt.c | 94 +-- 61 files changed, 3275 insertions(+), 2730 deletions(-) delete mode 100644 arch/arm/mach-omap2/memory.c delete mode 100644 arch/arm/mach-omap2/memory.h create mode 100644 arch/arm/mach-omap2/sdrc.c create mode 100644 arch/arm/mach-omap2/sdrc2xxx.c create mode 100644 arch/arm/plat-omap/include/mach/clkdev.h
Paul Walmsley
maintainerHello Russell,
Quoted 7 lines · Kevin Hilman
This is the series of patches contained in the 'omap-clks3' branch of Russell King's git repository[1]. Posted on behalf of Russell who had some mail issues in first attempt, and then ran of out time.
This series is proposed to be merged into the next merge window.
Comments to the list appreciated.
I've spent some time reviewing these patches.
Many of the changes you've implemented are an improvement over the previous code. Some of the patches would ordinarily prompt further comments and revision, but the benefit of merging these patches upstream in this merge window exceeds the benefit of further revision.
So my preference would be to see this current set sent upstream for this merge window.
regards,
- Paul
Quoted 14 lines · Paul Walmsley
Hello Russell,
Quoted 7 lines · Kevin Hilman
This is the series of patches contained in the 'omap-clks3' branch of Russell King's git repository[1]. Posted on behalf of Russell who had some mail issues in first attempt, and then ran of out time.
This series is proposed to be merged into the next merge window.
Comments to the list appreciated.
I've spent some time reviewing these patches.
Quoted 7 lines
Many of the changes you've implemented are an improvement over the previous code. Some of the patches would ordinarily prompt further comments and revision, but the benefit of merging these patches upstream in this merge window exceeds the benefit of further revision.
So my preference would be to see this current set sent upstream for this merge window.
Right on, looks good to me too.