OMAP clock, B of F: clockdomain, powerdomain updates
Paul Walmsley
maintainercover OMAP clock, B of F: clockdomain, powerdomain updates
This series is the second of six to bring the mainline kernel OMAP clock code up-to-date with the linux-omap tree.
Major changes in this series:
- Fix clockdomain, powerdomain code and data to match the hardware
- Add PRCM clockdomains
- Add DPLL clockdomains, powerdomains
- Mark all OMAP clocks with clockdomains
- Combine pwrdm, clkdm names and pointers into unions
Some patches have been "compressed" together, as requested by rmk - original commit IDs are in the patch descriptions.
Compile-tested on OSK5912 (OMAP1), H4 and 2430SDP (OMAP2), and BeagleBoard (OMAP3). Boot-tested on 2430SDP and BeagleBoard.
Applies on top of series A, posted earlier.
- Paul
---
Jouni Hogander (1):
OMAP3: PM: Emu_pwrdm is switched off by hardware even when sdti is in use
Paul Walmsley (8):
OMAP2/3 clockdomains: autodeps should respect platform flags
OMAP3 powerdomains: remove RET from SGX power states list
OMAP3 pwrdm: add CORE SAR handling (for USBTLL module)
OMAP2/3 clock: add clockdomains to all remaining clocks; fix clkdm init OMAP3 PRCM: add DPLL1-5 powerdomains, clockdomains; mark clocks OMAP2/3 clockdomains: add CM, PRM, virt_opp_clkdm clockdomains OMAP2/3 clockdomains: combine pwrdm, pwrdm_name into union in struct clockdomain OMAP2/3 clock: combine clkdm, clkdm_name into union in struct clk
Tomi Valkeinen (1):
OMAP: wait for pwrdm transition after clk_enable()
arch/arm/mach-omap2/clock.c | 26 +- arch/arm/mach-omap2/clock24xx.c | 2 arch/arm/mach-omap2/clock24xx.h | 278 ++++++++++--------- arch/arm/mach-omap2/clock34xx.h | 369 +++++++++++++++---------- arch/arm/mach-omap2/clockdomain.c | 58 ++-- arch/arm/mach-omap2/clockdomains.h | 125 ++++++-- arch/arm/mach-omap2/powerdomains.h | 8 - arch/arm/mach-omap2/powerdomains34xx.h | 61 ++++ arch/arm/plat-omap/include/mach/clock.h | 6 arch/arm/plat-omap/include/mach/clockdomain.h | 24 +- arch/arm/plat-omap/include/mach/powerdomain.h | 4 11 files changed, 586 insertions(+), 375 deletions(-)
text data bss dec hex filename
3241423 164192 100912 3506527 35815f vmlinux.beagle.orig
3241711 163872 100912 3506495 35813f vmlinux.beagle
Paul Walmsley
maintainerPATCH 1/10 OMAP2/3 clock: combine clkdm, clkdm_name into union in struct clk
struct clk contains a struct clockdomain *clkdm and const char *clkdm_name. The clkdm_name is only used at initialization to look up the appropriate clkdm pointer. Combining these into a union saves about 850 bytes on 3430SDP. This patch should not cause any change in kernel function.
Boot-tested on 3430SDP ES2; compile-tested with n800_defconfig.
linux-omap source commit is 0e5194e1a84c219bebbb78f305b7a8eabc4a3656.
--- arch/arm/mach-omap2/clock.c | 22 +-- arch/arm/mach-omap2/clock24xx.h | 264 ++++++++++++++++--------------- arch/arm/mach-omap2/clock34xx.h | 256 +++++++++++++++--------------- arch/arm/plat-omap/include/mach/clock.h | 6 - 4 files changed, 275 insertions(+), 273 deletions(-)
arch/arm/mach-omap2/clock.c +11 -11
@@ -77,17 +77,17 @@ void omap2_init_clk_clkdm(struct clk *clk) {struct clockdomain *clkdm; -if (!clk->clkdm_name) +if (!clk->clkdm.name)return ; - clkdm =clkdm_lookup (clk->clkdm_name); + clkdm =clkdm_lookup (clk->clkdm.name);if (clkdm) {pr_debug ("clock: associated clk %s to clkdm %s\n" , - clk->name, clk->clkdm_name); - clk->clkdm = clkdm; + clk->name, clk->clkdm.name); + clk->clkdm.ptr = clkdm; }else {pr_debug ("clock: could not associate clk %s to " -"clkdm %s\n" , clk->name, clk->clkdm_name); +"clkdm %s\n" , clk->name, clk->clkdm.name); } }
@@ -333,8 +333,8 @@ void omap2_clk_disable(struct clk *clk)_omap2_clk_disable (clk);if (clk->parent)omap2_clk_disable (clk->parent); -if (clk->clkdm) -omap2_clkdm_clk_disable (clk->clkdm, clk); +if (clk->clkdm.ptr) +omap2_clkdm_clk_disable (clk->clkdm.ptr, clk); } }
@@ -352,14 +352,14 @@ int omap2_clk_enable(struct clk *clk)return ret; } -if (clk->clkdm) -omap2_clkdm_clk_enable (clk->clkdm, clk); +if (clk->clkdm.ptr) +omap2_clkdm_clk_enable (clk->clkdm.ptr, clk); ret =_omap2_clk_enable (clk);if (ret !=0 ) { -if (clk->clkdm) -omap2_clkdm_clk_disable (clk->clkdm, clk); +if (clk->clkdm.ptr) +omap2_clkdm_clk_disable (clk->clkdm.ptr, clk);if (clk->parent) {omap2_clk_disable (clk->parent);
arch/arm/mach-omap2/clock24xx.h +132 -132
1,056 lines not on this page · raw message
arch/arm/mach-omap2/clock34xx.h +128 -128
1,024 lines not on this page · raw message
arch/arm/plat-omap/include/mach/clock.h +4 -2
@@ -81,8 +81,10 @@ struct clk { u32 clksel_mask; const struct clksel *clksel; struct dpll_data *dpll_data; - const char *clkdm_name; - struct clockdomain *clkdm; + union { + const char *name; + struct clockdomain *ptr; + } clkdm; #else __u8 rate_offset; __u8 src_offset;
Re: [PATCH B 01/10] OMAP2/3 clock: combine clkdm, clkdm_name into union in struct clk
Quoted 15 lines · Paul Walmsley
arch/arm/mach-omap2/clock.c +2
-2@@ -77,17 +77,17 @@ void omap2_init_clk_clkdm(struct clk *clk) {struct clockdomain *clkdm; -if (!clk->clkdm_name) +if (!clk->clkdm.name)return ; - clkdm =clkdm_lookup (clk->clkdm_name); + clkdm =clkdm_lookup (clk->clkdm.name);if (clkdm) {
arch/arm/mach-omap2/clock.c void omap2_init_clk_clkdm(struct clk *clk) · line 91
Quoted 10 lines
arch/arm/mach-omap2/clock.c +3
-3pr_debug ("clock: associated clk %s to clkdm %s\n" , - clk->name, clk->clkdm_name); - clk->clkdm = clkdm; + clk->name, clk->clkdm.name); + clk->clkdm.ptr = clkdm; }else {pr_debug ("clock: could not associate clk %s to " -"clkdm %s\n" , clk->name, clk->clkdm_name); +"clkdm %s\n" , clk->name, clk->clkdm.name); }
This is unsafe - if the clock domain can not be found, you leave the union pointing at the string, and there's no way for this to prevent the clock from being registered.
The result is that:
arch/arm/mach-omap2/clock.c void omap2_clk_disable(struct clk *clk) · line 337
Quoted 4 lines
arch/arm/mach-omap2/clock.c +2
-2-if (clk->clkdm) -omap2_clkdm_clk_disable (clk->clkdm, clk); +if (clk->clkdm.ptr) +omap2_clkdm_clk_disable (clk->clkdm.ptr, clk);
and similar places will pass the pointer to the string, potentially causing an oops, or worse, data corruption due to scribbing over someone elses memory.
So I don't think this patch is acceptable as-is.
Paul Walmsley
maintainerRe: [PATCH B 01/10] OMAP2/3 clock: combine clkdm, clkdm_name into union in struct clk
Quoted 33 lines · Russell King - ARM Linux
Quoted 15 lines · Paul Walmsley
arch/arm/mach-omap2/clock.c +2
-2@@ -77,17 +77,17 @@ void omap2_init_clk_clkdm(struct clk *clk) {struct clockdomain *clkdm; -if (!clk->clkdm_name) +if (!clk->clkdm.name)return ; - clkdm =clkdm_lookup (clk->clkdm_name); + clkdm =clkdm_lookup (clk->clkdm.name);if (clkdm) {arch/arm/mach-omap2/clock.c void omap2_init_clk_clkdm(struct clk *clk) · line 91
Quoted 10 lines
arch/arm/mach-omap2/clock.c +3
-3pr_debug ("clock: associated clk %s to clkdm %s\n" , - clk->name, clk->clkdm_name); - clk->clkdm = clkdm; + clk->name, clk->clkdm.name); + clk->clkdm.ptr = clkdm; }else {pr_debug ("clock: could not associate clk %s to " -"clkdm %s\n" , clk->name, clk->clkdm_name); +"clkdm %s\n" , clk->name, clk->clkdm.name); }This is unsafe - if the clock domain can not be found, you leave the union pointing at the string, and there's no way for this to prevent the clock from being registered.
The result is that:
Quoted 8 lines
arch/arm/mach-omap2/clock.c void omap2_clk_disable(struct clk *clk) · line 337
Quoted 4 lines
arch/arm/mach-omap2/clock.c +2
-2-if (clk->clkdm) -omap2_clkdm_clk_disable (clk->clkdm, clk); +if (clk->clkdm.ptr) +omap2_clkdm_clk_disable (clk->clkdm.ptr, clk);and similar places will pass the pointer to the string, potentially causing an oops, or worse, data corruption due to scribbing over someone elses memory.
Agreed. Now that omap2_init_clk_clkdm() is called by the OMAP arch-specific clk_register(), this should be pretty easy to implement. Will send a patch that applies on top of F 06.
- Paul
Paul Walmsley
maintainerRe: [PATCH B 01/10] OMAP2/3 clock: combine clkdm, clkdm_name into union in struct clk
Hi Russell,
Quoted 8 lines · Paul Walmsley
Quoted 6 lines · Russell King - ARM Linux
Quoted 5 lines · Paul Walmsley
arch/arm/mach-omap2/clock.c +0
-0@@ -77,17 +77,17 @@ void omap2_init_clk_clkdm(struct clk *clk)
...
Quoted 7 lines
Quoted 3 lines
This is unsafe - if the clock domain can not be found, you leave the union pointing at the string, and there's no way for this to prevent the clock from being registered.
Agreed. Now that
omap2_init_clk_clkdm()is called by the OMAP arch-specificclk_register(), this should be pretty easy to implement. Will send a patch that applies on top of F 06.
The following patch prevents a clock with a bad or missing clockdomain from registering. It applies after F 06.
- Paul
From: Paul Walmsley <[email protected]>
Date: Wed, 4 Feb 2009 15:11:20 -0700
OMAP2/3 clock: prevent clock registration with bad or missing clockdomain
If clk_register() is called on a struct clk without a clockdomain name, or a struct clk which contains an invalid clockdomain name, fail the clock registration. This prevents later code from inadvertently dereferencing the clockdomain name string as a struct clockdomain pointer.
Problem reported by Russell King <[email protected]>.
Tested on BeagleBoard ES2.1.
--- arch/arm/mach-omap2/clock.c | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-)
arch/arm/mach-omap2/clock.c +10 -11
@@ -188,26 +188,32 @@ static int _dpll_test_fint(struct clk *clk, u8 n) }/** -* omap2_init_clk_clkdm - look up a clockdomain name, store pointer in clk +* _omap2_init_clk_clkdm - look up a clockdomain name, store pointer in clk * @clk: OMAP clock struct ptr to use * * Convert a clockdomain name stored in a struct clk 'clk' into a * clockdomain pointer, and save it into the struct clk. Intended to be -* called during clk_register(). No return value. +* called during clk_register(). Returns 0 on success or -ENOENT if the +* clockdomain is not found. */ -void omap2_init_clk_clkdm (struct clk *clk) +static int _omap2_init_clk_clkdm (struct clk *clk) {struct clockdomain *clkdm; +int ret; clkdm =clkdm_lookup (clk->clkdm.name);if (clkdm) {pr_debug ("clock: associated clk %s to clkdm %s\n" , clk->name, clk->clkdm.name); clk->clkdm.ptr = clkdm; + ret =0 ; }else {pr_err ("clock: %s: could not associate to clkdm %s\n" , clk->name, clk->clkdm.name); + ret = -ENOENT ; } + +return ret; }/**
@@ -1082,12 +1088,5 @@ void omap2_clk_disable_unused(struct clk *clk)int omap2_clk_register (struct clk *clk) { -if (!clk->clkdm.name) { -pr_debug ("clock: %s: missing clockdomain" , clk->name); -WARN_ON (1 ); -return -EINVAL ; - } - -omap2_init_clk_clkdm (clk); -return 0 ; +return _omap2_init_clk_clkdm (clk); }
Signature · 1 line
1.6.0.2.GIT
Paul Walmsley
maintainerPATCH 2/10 OMAP2/3 clockdomains: combine pwrdm, pwrdm_name into union in struct clockdomain
In reply to Paul Walmsleystruct 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.
Boot-tested on 3430SDP ES2.
linux-omap source commit is 718fc6cd4db902aa2242a736cc3feb8744a4c71a.
--- arch/arm/mach-omap2/clockdomain.c | 58 +++++++++++-------------- arch/arm/mach-omap2/clockdomains.h | 54 ++++++++++++----------- arch/arm/plat-omap/include/mach/clockdomain.h | 24 ++++++---- 3 files changed, 68 insertions(+), 68 deletions(-)
arch/arm/mach-omap2/clockdomain.c +26 -32
@@ -71,14 +71,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 ; } - autodep->pwrdm = pwrdm; + autodep->pwrdm.ptr = pwrdm;return ; }
@@ -95,16 +95,13 @@ static void _clkdm_add_autodeps(struct clockdomain *clkdm) {struct clkdm_pwrdm_autodep *autodep; -for (autodep = autodeps; autodep->pwrdm_name; autodep++) { -if (!autodep->pwrdm) -continue ; - +for (autodep = autodeps; autodep->pwrdm.ptr; autodep++) {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 +117,13 @@ static void _clkdm_del_autodeps(struct clockdomain *clkdm) {struct clkdm_pwrdm_autodep *autodep; -for (autodep = autodeps; autodep->pwrdm_name; autodep++) { -if (!autodep->pwrdm) -continue ; - +for (autodep = autodeps; autodep->pwrdm.ptr; autodep++) {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 +173,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 +196,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 +236,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 +321,7 @@ struct powerdomain *clkdm_get_pwrdm(struct clockdomain *clkdm)if (!clkdm)return NULL ; -return clkdm->pwrdm; +return clkdm->pwrdm.ptr; }
@@ -348,7 +342,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 +374,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 +382,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 +416,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 +424,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 +472,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 +510,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; };
Re: [PATCH B 02/10] OMAP2/3 clockdomains: combine pwrdm, pwrdm_name into union in struct clockdomain
Quoted 5 lines · Paul Walmsley
struct clockdomain contains a struct powerdomain *pwrdm and const char
*pwrdm_name. Thepwrdm_nameis 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.
For the same reasons as B1, this would seem to be unsafe.
Paul Walmsley
maintainerRe: [PATCH B 02/10] OMAP2/3 clockdomains: combine pwrdm, pwrdm_name into union in struct clockdomain
Hello Russell,
Quoted 8 lines · Russell King - ARM Linux
Quoted 5 lines · Paul Walmsley
struct clockdomain contains a struct powerdomain *pwrdm and const char
*pwrdm_name. Thepwrdm_nameis 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.For the same reasons as B1, this would seem to be unsafe.
Fixed; updated patch attached below.
- Paul
Author: Paul Walmsley <[email protected]> Date: Tue Feb 3 02:10:03 2009 -0700
OMAP2/3 clockdomains: combine pwrdm, pwrdm_name into union in struct clockdomain
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 +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; };
Re: [PATCH B 02/10] OMAP2/3 clockdomains: combine pwrdm, pwrdm_name into union in struct clockdomain
Quoted 11 lines · Paul Walmsley
Hello Russell,
Quoted 7 lines · Russell King - ARM Linux
Quoted 5 lines · Paul Walmsley
struct clockdomain contains a struct powerdomain *pwrdm and const char
*pwrdm_name. Thepwrdm_nameis 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.
Quoted 3 lines
Quoted 1 line
For the same reasons as B1, this would seem to be unsafe.
Fixed; updated patch attached below.
Better. Can I have it in email format so git-am can handle it please?
Paul Walmsley
maintainerRe: [PATCH B 02/10] OMAP2/3 clockdomains: combine pwrdm, pwrdm_name into union in struct clockdomain
Hello Russell,
Quoted 10 lines · Russell King - ARM Linux
Quoted 9 lines · Paul Walmsley
Quoted 7 lines · Russell King - ARM Linux
Quoted 5 lines · Paul Walmsley
struct clockdomain contains a struct powerdomain *pwrdm and const char
*pwrdm_name. Thepwrdm_nameis 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.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
For the same reasons as B1, this would seem to be unsafe.
Fixed; updated patch attached below.
Better. Can I have it in email format so git-am can handle it please?
Here it is:
- Paul
From: Paul Walmsley <[email protected]>
Date: Tue, 3 Feb 2009 02:10:03 -0700
OMAP2/3 clockdomains: combine pwrdm, pwrdm_name into union in struct clockdomain
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.0.2.GIT
Paul Walmsley
maintainerPATCH 3/10 OMAP2/3 clockdomains: add CM, PRM, virt_opp_clkdm clockdomains
In reply to Paul WalmsleyAdd clockdomains for the CM and PRM. These replace "wkup_clkdm", a placeholder clockdomain which does not exist on the hardware. Add a clockdomain for virtual OPP clocks, "virt_opp_clkdm". Mark all clocks in the clock tree with a valid clockdomain.
The following TI documents are used as reference:
OMAP2420 Multimedia Processor Silicon Revision 2.1.1, 2.2 TRM Version Q OMAP34xx Multimedia Device Silicon Revision 3.0 Version I TRM OMAP34xx Multimedia High Security (HS) Device Silicon Revision 3.0 Security
Addendum Version B TRM
This patch includes an earlier fix to sys_clkout2's clockdomain by Tomi Valkeinen <[email protected]>.
linux-omap source commits are a4061e5422dae1433264b40178f73dc6f1d6d748, 859207f04c6b64ee714a65a58ee629ddde91bfa8, and f34f5bdd731fe828241d729fd465612a56d7e35f.
--- arch/arm/mach-omap2/clock24xx.h | 49 ++++++++++-------- arch/arm/mach-omap2/clock34xx.h | 70 ++++++++++++++++++------- arch/arm/mach-omap2/clockdomains.h | 30 +++++++++-- arch/arm/plat-omap/include/mach/powerdomain.h | 4 + 4 files changed, 106 insertions(+), 47 deletions(-)
arch/arm/mach-omap2/clock24xx.h +27 -22
@@ -633,7 +633,7 @@ static struct clk func_32k_ck = { .rate = 32000, .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | RATE_FIXED | ALWAYS_ENABLED | RATE_PROPAGATES, - .clkdm = { .name = "wkup_clkdm" }, + .clkdm = { .name = "prm_clkdm" }, .recalc = &propagate_rate, };
@@ -642,7 +642,7 @@ static struct clk osc_ck = { /* (*12, *13, 19.2, *26, 38.4)MHz */ .name = "osc_ck", .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | RATE_PROPAGATES, - .clkdm = { .name = "wkup_clkdm" }, + .clkdm = { .name = "prm_clkdm" }, .enable = &omap2_enable_osc_ck, .disable = &omap2_disable_osc_ck, .recalc = &omap2_osc_clk_recalc,
@@ -654,7 +654,7 @@ static struct clk sys_ck = { /* (*12, *13, 19.2, 26, 38.4)MHz */ .parent = &osc_ck, .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | ALWAYS_ENABLED | RATE_PROPAGATES, - .clkdm = { .name = "wkup_clkdm" }, + .clkdm = { .name = "prm_clkdm" }, .recalc = &omap2_sys_clk_recalc, };
@@ -663,7 +663,7 @@ static struct clk alt_ck = { /* Typical 54M or 48M, may not exist */ .rate = 54000000, .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | RATE_FIXED | ALWAYS_ENABLED | RATE_PROPAGATES, - .clkdm = { .name = "wkup_clkdm" }, + .clkdm = { .name = "prm_clkdm" }, .recalc = &propagate_rate, };
@@ -695,7 +695,7 @@ static struct clk dpll_ck = { .dpll_data = &dpll_dd, .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | RATE_PROPAGATES | ALWAYS_ENABLED, - .clkdm = { .name = "wkup_clkdm" }, + .clkdm = { .name = "prm_clkdm" }, .recalc = &omap2_dpllcore_recalc, .set_rate = &omap2_reprogram_dpllcore, };
@@ -706,7 +706,7 @@ static struct clk apll96_ck = { .rate = 96000000, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | RATE_FIXED | RATE_PROPAGATES | ENABLE_ON_INIT, - .clkdm = { .name = "wkup_clkdm" }, + .clkdm = { .name = "prm_clkdm" }, .enable_reg = _CM_REG_OFFSET(PLL_MOD, CM_CLKEN), .enable_bit = OMAP24XX_EN_96M_PLL_SHIFT, .enable = &omap2_clk_fixed_enable,
@@ -720,7 +720,7 @@ static struct clk apll54_ck = { .rate = 54000000, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | RATE_FIXED | RATE_PROPAGATES | ENABLE_ON_INIT, - .clkdm = { .name = "wkup_clkdm" }, + .clkdm = { .name = "prm_clkdm" }, .enable_reg = _CM_REG_OFFSET(PLL_MOD, CM_CLKEN), .enable_bit = OMAP24XX_EN_54M_PLL_SHIFT, .enable = &omap2_clk_fixed_enable,
@@ -755,7 +755,7 @@ static struct clk func_54m_ck = { .parent = &apll54_ck, /* can also be alt_clk */ .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, - .clkdm = { .name = "wkup_clkdm" }, + .clkdm = { .name = "cm_clkdm" }, .init = &omap2_init_clksel_parent, .clksel_reg = _CM_REG_OFFSET(PLL_MOD, CM_CLKSEL1), .clksel_mask = OMAP24XX_54M_SOURCE,
@@ -768,7 +768,7 @@ static struct clk core_ck = { .parent = &dpll_ck, /* can also be 32k */ .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | ALWAYS_ENABLED | RATE_PROPAGATES, - .clkdm = { .name = "wkup_clkdm" }, + .clkdm = { .name = "cm_clkdm" }, .recalc = &followparent_recalc, };
@@ -795,7 +795,7 @@ static struct clk func_96m_ck = { .parent = &apll96_ck, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, - .clkdm = { .name = "wkup_clkdm" }, + .clkdm = { .name = "cm_clkdm" }, .init = &omap2_init_clksel_parent, .clksel_reg = _CM_REG_OFFSET(PLL_MOD, CM_CLKSEL1), .clksel_mask = OMAP2430_96M_SOURCE,
@@ -828,7 +828,7 @@ static struct clk func_48m_ck = { .parent = &apll96_ck, /* 96M or Alt */ .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, - .clkdm = { .name = "wkup_clkdm" }, + .clkdm = { .name = "cm_clkdm" }, .init = &omap2_init_clksel_parent, .clksel_reg = _CM_REG_OFFSET(PLL_MOD, CM_CLKSEL1), .clksel_mask = OMAP24XX_48M_SOURCE,
@@ -844,15 +844,16 @@ static struct clk func_12m_ck = { .fixed_div = 4, .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, - .clkdm = { .name = "wkup_clkdm" }, + .clkdm = { .name = "cm_clkdm" }, .recalc = &omap2_fixed_divisor_recalc, };/* Secure timer, only available in secure mode */ static struct clk wdt1_osc_ck = { - .name ="ck_wdt1_osc" , + .name ="wdt1_osc_ck" , .parent = &osc_ck, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X , + .clkdm = { .name ="prm_clkdm" }, .recalc = &followparent_recalc, };
@@ -897,7 +898,7 @@ static struct clk sys_clkout_src = { .parent = &func_54m_ck, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | RATE_PROPAGATES | OFFSET_GR_MOD, - .clkdm = { .name = "wkup_clkdm" }, + .clkdm = { .name = "prm_clkdm" }, .enable_reg = _GR_MOD_OFFSET(OMAP24XX_PRCM_CLKOUT_CTRL_OFFSET), .enable_bit = OMAP24XX_CLKOUT_EN_SHIFT, .init = &omap2_init_clksel_parent,
@@ -928,7 +929,7 @@ static struct clk sys_clkout = { .parent = &sys_clkout_src, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | PARENT_CONTROLS_CLOCK | OFFSET_GR_MOD, - .clkdm = { .name = "wkup_clkdm" }, + .clkdm = { .name = "prm_clkdm" }, .clksel_reg = _GR_MOD_OFFSET(OMAP24XX_PRCM_CLKOUT_CTRL_OFFSET), .clksel_mask = OMAP24XX_CLKOUT_DIV_MASK, .clksel = sys_clkout_clksel,
@@ -942,7 +943,7 @@ static struct clk sys_clkout2_src = { .name = "sys_clkout2_src", .parent = &func_54m_ck, .flags = CLOCK_IN_OMAP242X | RATE_PROPAGATES | OFFSET_GR_MOD, - .clkdm = { .name = "wkup_clkdm" }, + .clkdm = { .name = "cm_clkdm" }, .enable_reg = _GR_MOD_OFFSET(OMAP24XX_PRCM_CLKOUT_CTRL_OFFSET), .enable_bit = OMAP2420_CLKOUT2_EN_SHIFT, .init = &omap2_init_clksel_parent,
@@ -965,7 +966,7 @@ static struct clk sys_clkout2 = { .parent = &sys_clkout2_src, .flags =CLOCK_IN_OMAP242X |PARENT_CONTROLS_CLOCK | OFFSET_GR_MOD, - .clkdm = { .name = "wkup_clkdm" }, + .clkdm = { .name = "cm_clkdm" }, .clksel_reg = _GR_MOD_OFFSET(OMAP24XX_PRCM_CLKOUT_CTRL_OFFSET), .clksel_mask = OMAP2420_CLKOUT2_DIV_MASK, .clksel = sys_clkout2_clksel,
@@ -978,7 +979,7 @@ static struct clk emul_ck = { .name = "emul_ck", .parent = &func_54m_ck, .flags = CLOCK_IN_OMAP242X | OFFSET_GR_MOD, - .clkdm = { .name = "wkup_clkdm" }, + .clkdm = { .name = "cm_clkdm" }, .enable_reg = _GR_MOD_OFFSET(OMAP24XX_PRCM_CLKEMUL_CTRL_OFFSET), .enable_bit = OMAP24XX_EMULATION_EN_SHIFT, .recalc = &followparent_recalc,
@@ -2077,27 +2078,29 @@ static struct clk gpios_fck = { .name = "gpios_fck", .parent = &func_32k_ck, .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, - .clkdm = { .name = "wkup_clkdm" }, + .clkdm = { .name = "prm_clkdm" }, .enable_reg = _CM_REG_OFFSET(WKUP_MOD, CM_FCLKEN), .enable_bit = OMAP24XX_EN_GPIOS_SHIFT, .recalc = &followparent_recalc, }; +/* aka WDT2 - REVISIT: we should split wu_l4_iclk from l4_ck */ static struct clk mpu_wdt_ick = { .name ="mpu_wdt_ick" , .parent = &l4_ck, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X , - .clkdm = { .name ="core_l4_clkdm" }, + .clkdm = { .name ="prm_clkdm" }, .enable_reg =_CM_REG_OFFSET (WKUP_MOD ,CM_ICLKEN ), .enable_bit =OMAP24XX_EN_MPU_WDT_SHIFT , .recalc = &followparent_recalc, }; +/* aka WDT2 */ static struct clk mpu_wdt_fck = { .name ="mpu_wdt_fck" , .parent = &func_32k_ck, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X , - .clkdm = { .name ="wkup_clkdm" }, + .clkdm = { .name ="prm_clkdm" }, .enable_reg =_CM_REG_OFFSET (WKUP_MOD ,CM_FCLKEN ), .enable_bit =OMAP24XX_EN_MPU_WDT_SHIFT , .recalc = &followparent_recalc,
@@ -2114,11 +2117,12 @@ static struct clk sync_32k_ick = { .recalc = &followparent_recalc, }; +/* REVISIT: parent is really wu_l4_iclk */ static struct clk wdt1_ick = { .name ="wdt1_ick" , .parent = &l4_ck, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X , - .clkdm = { .name ="core_l4_clkdm" }, + .clkdm = { .name ="prm_clkdm" }, .enable_reg =_CM_REG_OFFSET (WKUP_MOD ,CM_ICLKEN ), .enable_bit =OMAP24XX_EN_WDT1_SHIFT , .recalc = &followparent_recalc,
@@ -2652,6 +2656,7 @@ static struct clk virt_prcm_set = { .name = "virt_prcm_set", .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | VIRTUAL_CLOCK | ALWAYS_ENABLED | DELAYED_APP, + .clkdm = { .name = "virt_opp_clkdm" }, .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 -19
355 lines not on this page · raw message
arch/arm/mach-omap2/clockdomains.h +26 -4
@@ -14,15 +14,35 @@/* * 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 */ -static struct clockdomain wkup_clkdm = { - .name ="wkup_clkdm" , +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 ), +}; + +/* +* virt_opp_clkdm is intended solely for use with virtual OPP clocks, +* e.g., virt_prcm_set, until OPP handling is rationalized. +*/ +static struct clockdomain virt_opp_clkdm = { + .name ="virt_opp_clkdm" , + .pwrdm = { .name ="wkup_pwrdm" }, + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP24XX ), +}; +/* * 2420-only clockdomains */
@@ -265,7 +285,9 @@ static struct clkdm_pwrdm_autodep clkdm_pwrdm_autodeps[] = {static struct clockdomain *clockdomains_omap[] = { - &wkup_clkdm, + &cm_clkdm, + &prm_clkdm, + &virt_opp_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
Re: [PATCH B 03/10] OMAP2/3 clockdomains: add CM, PRM, virt_opp_clkdm clockdomains
Quoted 12 lines · Paul Walmsley
Add clockdomains for the CM and PRM. These replace "
wkup_clkdm", a placeholder clockdomain which does not exist on the hardware. Add a clockdomain for virtual OPP clocks, "virt_opp_clkdm". Mark all clocks in the clock tree with a valid clockdomain.The following TI documents are used as reference:
OMAP2420 Multimedia Processor Silicon Revision 2.1.1, 2.2 TRM Version Q OMAP34xx Multimedia Device Silicon Revision 3.0 Version I TRM OMAP34xx Multimedia High Security (HS) Device Silicon Revision 3.0 Security
Addendum Version B TRM
Quoted 6 lines
This patch includes an earlier fix to sys_clkout2's clockdomain by Tomi Valkeinen <[email protected]>.
linux-omap source commits are
a4061e5422dae1433264b40178f73dc6f1d6d748,859207f04c6b64ee714a65a58ee629ddde91bfa8, andf34f5bdd731fe828241d729fd465612a56d7e35f.
Given my comments on F6, I've so far avoided merging 859207f.
Paul Walmsley
maintainerPATCH 4/10 OMAP3 PRCM: add DPLL1-5 powerdomains, clockdomains; mark clocks
In reply to Paul WalmsleyEach 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
@@ -316,6 +316,7 @@ static struct clk dpll1_ck = { .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, .round_rate = &omap2_dpll_round_rate, .set_rate = &omap3_noncore_dpll_set_rate, + .clkdm = { .name = "dpll1_clkdm" }, .recalc = &omap3_dpll_recalc, };
@@ -328,6 +329,7 @@ static struct clk dpll1_x2_ck = { .parent = &dpll1_ck, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, + .clkdm = { .name = "dpll1_clkdm" }, .recalc = &omap3_clkoutx2_recalc, };
@@ -350,6 +352,7 @@ static struct clk dpll1_x2m2_ck = { .clksel = div16_dpll1_x2m2_clksel, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, + .clkdm = { .name = "dpll1_clkdm" }, .recalc = &omap2_clksel_recalc, };
@@ -387,6 +390,7 @@ static struct clk dpll2_ck = { .disable = &omap3_noncore_dpll_disable, .round_rate = &omap2_dpll_round_rate, .set_rate = &omap3_noncore_dpll_set_rate, + .clkdm = { .name = "dpll2_clkdm" }, .recalc = &omap3_dpll_recalc, };
@@ -409,6 +413,7 @@ static struct clk dpll2_m2_ck = { .clksel = div16_dpll2_m2x2_clksel, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, + .clkdm = { .name = "dpll2_clkdm" }, .recalc = &omap2_clksel_recalc, };
@@ -440,6 +445,7 @@ static struct clk dpll3_ck = { .dpll_data = &dpll3_dd, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, .round_rate = &omap2_dpll_round_rate, + .clkdm = { .name = "dpll3_clkdm" }, .recalc = &omap3_dpll_recalc, };
@@ -452,6 +458,7 @@ static struct clk dpll3_x2_ck = { .parent = &dpll3_ck, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, + .clkdm = { .name = "dpll3_clkdm" }, .recalc = &omap3_clkoutx2_recalc, };
@@ -509,6 +516,7 @@ static struct clk dpll3_m2_ck = { .clksel = div31_dpll3m2_clksel, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, + .clkdm = { .name = "dpll3_clkdm" }, .recalc = &omap2_clksel_recalc, };
@@ -544,6 +552,7 @@ static struct clk dpll3_m2x2_ck = { .clksel = dpll3_m2x2_ck_clksel, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, + .clkdm = { .name = "dpll3_clkdm" }, .recalc = &omap2_clksel_recalc, };
@@ -563,6 +572,7 @@ static struct clk dpll3_m3_ck = { .clksel = div16_dpll3_clksel, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, + .clkdm = { .name = "dpll3_clkdm" }, .recalc = &omap2_clksel_recalc, };
@@ -573,6 +583,7 @@ static struct clk dpll3_m3x2_ck = { .enable_reg = _OMAP34XX_CM_REGADDR(PLL_MOD, CM_CLKEN), .enable_bit = OMAP3430_PWRDN_EMU_CORE_SHIFT, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | INVERT_ENABLE, + .clkdm = { .name = "dpll3_clkdm" }, .recalc = &omap3_clkoutx2_recalc, };
@@ -591,6 +602,7 @@ static struct clk emu_core_alwon_ck = { .clksel = emu_core_alwon_ck_clksel, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, + .clkdm = { .name = "dpll3_clkdm" }, .recalc = &omap2_clksel_recalc, };
@@ -626,6 +638,7 @@ static struct clk dpll4_ck = { .disable = &omap3_noncore_dpll_disable, .round_rate = &omap2_dpll_round_rate, .set_rate = &omap3_noncore_dpll_set_rate, + .clkdm = { .name = "dpll4_clkdm" }, .recalc = &omap3_dpll_recalc, };
@@ -639,6 +652,7 @@ static struct clk dpll4_x2_ck = { .parent = &dpll4_ck, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, + .clkdm = { .name = "dpll4_clkdm" }, .recalc = &omap3_clkoutx2_recalc, };
@@ -657,6 +671,7 @@ static struct clk dpll4_m2_ck = { .clksel = div16_dpll4_clksel, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, + .clkdm = { .name = "dpll4_clkdm" }, .recalc = &omap2_clksel_recalc, };
@@ -667,6 +682,7 @@ static struct clk dpll4_m2x2_ck = { .enable_reg = _OMAP34XX_CM_REGADDR(PLL_MOD, CM_CLKEN), .enable_bit = OMAP3430_PWRDN_96M_SHIFT, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | INVERT_ENABLE, + .clkdm = { .name = "dpll4_clkdm" }, .recalc = &omap3_clkoutx2_recalc, };
@@ -743,6 +759,7 @@ static struct clk dpll4_m3_ck = { .clksel = div16_dpll4_clksel, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, + .clkdm = { .name = "dpll4_clkdm" }, .recalc = &omap2_clksel_recalc, };
@@ -754,6 +771,7 @@ static struct clk dpll4_m3x2_ck = { .enable_reg = _OMAP34XX_CM_REGADDR(PLL_MOD, CM_CLKEN), .enable_bit = OMAP3430_PWRDN_TV_SHIFT, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | INVERT_ENABLE, + .clkdm = { .name = "dpll4_clkdm" }, .recalc = &omap3_clkoutx2_recalc, };
@@ -852,6 +870,7 @@ static struct clk dpll4_m4_ck = { .clksel = div16_dpll4_clksel, .flags =CLOCK_IN_OMAP343X |RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, + .clkdm = { .name = "dpll4_clkdm" }, .recalc = &omap2_clksel_recalc, .set_rate = &omap2_clksel_set_rate, .round_rate = &omap2_clksel_round_rate,
@@ -864,6 +883,7 @@ static struct clk dpll4_m4x2_ck = { .enable_reg = _OMAP34XX_CM_REGADDR(PLL_MOD, CM_CLKEN), .enable_bit = OMAP3430_PWRDN_CAM_SHIFT, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | INVERT_ENABLE, + .clkdm = { .name = "dpll4_clkdm" }, .recalc = &omap3_clkoutx2_recalc, };
@@ -877,6 +897,7 @@ static struct clk dpll4_m5_ck = { .clksel = div16_dpll4_clksel, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, + .clkdm = { .name = "dpll4_clkdm" }, .recalc = &omap2_clksel_recalc, };
@@ -887,6 +908,7 @@ static struct clk dpll4_m5x2_ck = { .enable_reg = _OMAP34XX_CM_REGADDR(PLL_MOD, CM_CLKEN), .enable_bit = OMAP3430_PWRDN_CAM_SHIFT, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | INVERT_ENABLE, + .clkdm = { .name = "dpll4_clkdm" }, .recalc = &omap3_clkoutx2_recalc, };
@@ -900,6 +922,7 @@ static struct clk dpll4_m6_ck = { .clksel = div16_dpll4_clksel, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, + .clkdm = { .name = "dpll4_clkdm" }, .recalc = &omap2_clksel_recalc, };
@@ -911,6 +934,7 @@ static struct clk dpll4_m6x2_ck = { .enable_reg = _OMAP34XX_CM_REGADDR(PLL_MOD, CM_CLKEN), .enable_bit = OMAP3430_PWRDN_EMU_PERIPH_SHIFT, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | INVERT_ENABLE, + .clkdm = { .name = "dpll4_clkdm" }, .recalc = &omap3_clkoutx2_recalc, };
@@ -919,6 +943,7 @@ static struct clk emu_per_alwon_ck = { .parent = &dpll4_m6x2_ck, .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, + .clkdm = { .name = "dpll4_clkdm" }, .recalc = &followparent_recalc, };
@@ -955,6 +980,7 @@ static struct clk dpll5_ck = { .disable = &omap3_noncore_dpll_disable, .round_rate = &omap2_dpll_round_rate, .set_rate = &omap3_noncore_dpll_set_rate, + .clkdm = { .name = "dpll5_clkdm" }, .recalc = &omap3_dpll_recalc, };
@@ -972,6 +998,7 @@ static struct clk dpll5_m2_ck = { .clksel = div16_dpll5_clksel, .flags = CLOCK_IN_OMAP3430ES2 | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, + .clkdm = { .name = "dpll5_clkdm" }, .recalc = &omap2_clksel_recalc, };
arch/arm/mach-omap2/clockdomains.h +35 -0
@@ -259,6 +259,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 */ /*
@@ -321,6 +351,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 */
Re: [PATCH B 04/10] OMAP3 PRCM: add DPLL1-5 powerdomains, clockdomains; mark clocks
Quoted 4 lines · Paul Walmsley
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).
I don't really see the need to mark all these clocks as having a domain. Yes, it makes sense to mark the actual DPLL clocks themselves with the relevent DPLL domain. However, it makes no sense to mark the children as well.
Why? When we enable a clock, we walk up the tree enabling the domains first. So, even if we're enabling a child clock, we will walk the tree up to the DPLL and enable the clock domain before we do anything at all.
Sure, if a clock has a multiplexer and that multiplexer is in a different clock domain from its parent, it makes sense to. But otherwise it doesn't.
Paul Walmsley
maintainerPATCH 5/10 OMAP2/3 clock: add clockdomains to all remaining clocks; fix clkdm init
In reply to Paul WalmsleyAdd clockdomains for all remaining clocks without them, and warn in clk_register() if any are missing a clockdomain. On OMAP2, call omap2_init_clk_clkdm() immediately after clk_register(), just as OMAP3 does. Remove omap2_init_clk_clkdm() from all of the struct clk .init function pointers, since the OMAP2/3 arch clock init code now calls it.
The following TI documents are used as reference:
OMAP2420 Multimedia Processor Silicon Revision 2.1.1, 2.2 TRM Version Q OMAP2430 Multimedia Device Package-on-Package (POP) Silicon Revision 2.1 TRM
Version Q
OMAP34xx Multimedia Device Silicon Revision 3.0 Version I TRM OMAP34xx Multimedia High Security (HS) Device Silicon Revision 3.0 Security
Addendum Version B TRM
The bug caused by the missing call to omap2_init_clk_clkdm() on OMAP2 was reported by Felipe Balbi <[email protected]>.
linux-omap source commits are acea9d4a96dc50aa850d4b808aa560020070fe6e, f2576b3289f6bb58b2a2f0f039aa6caf1f0b7ead, baee1ca8e61aa9df034e1706052a0eefc193f688, and 61d3e74f1f61a92e45a31014ad93372856d3c9d9.
--- arch/arm/mach-omap2/clock.c | 8 ++++--- arch/arm/mach-omap2/clock24xx.c | 2 ++ arch/arm/mach-omap2/clock24xx.h | 7 +++++- arch/arm/mach-omap2/clock34xx.h | 44 ++++++++++++++++++++++----------------- 4 files changed, 38 insertions(+), 23 deletions(-)
arch/arm/mach-omap2/clock.c +5 -3
@@ -77,8 +77,10 @@ void omap2_init_clk_clkdm(struct clk *clk) {struct clockdomain *clkdm; -if (!clk->clkdm.name) +if (!clk->clkdm.name) { +pr_err ("clock: %s: missing clockdomain" , clk->name);return ; + } clkdm =clkdm_lookup (clk->clkdm.name);if (clkdm) {
@@ -86,8 +88,8 @@ void omap2_init_clk_clkdm(struct clk *clk) clk->name, clk->clkdm.name); clk->clkdm.ptr = clkdm; }else { -pr_debug ("clock: could not associate clk %s to " -"clkdm %s\n" , clk->name, clk->clkdm.name); +pr_err ("clock: %s: could not associate to clkdm %s\n" , + clk->name, clk->clkdm.name); } }
arch/arm/mach-omap2/clock24xx.c +2 -0
@@ -567,11 +567,13 @@ int __init omap2_clk_init(void)if ((*clkp)->flags &CLOCK_IN_OMAP242X &&cpu_is_omap2420 ()) {clk_register (*clkp); +omap2_init_clk_clkdm (*clkp);continue ; }if ((*clkp)->flags &CLOCK_IN_OMAP243X &&cpu_is_omap2430 ()) {clk_register (*clkp); +omap2_init_clk_clkdm (*clkp);continue ; } }
arch/arm/mach-omap2/clock24xx.h +6 -1
@@ -1088,12 +1088,13 @@ static struct clk dsp_irate_ick = { .parent = &dsp_fck, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X |DELAYED_APP | CONFIG_PARTICIPANT | PARENT_CONTROLS_CLOCK, + .clkdm = { .name = "dsp_clkdm" }, .clksel_reg = _CM_REG_OFFSET(OMAP24XX_DSP_MOD, CM_CLKSEL), .clksel_mask = OMAP24XX_CLKSEL_DSP_IF_MASK, .clksel = dsp_irate_ick_clksel, .recalc = &omap2_clksel_recalc, .round_rate = &omap2_clksel_round_rate, - .set_rate = &omap2_clksel_set_rate + .set_rate = &omap2_clksel_set_rate };/* 2420 only */
@@ -1101,6 +1102,7 @@ static struct clk dsp_ick = { .name = "dsp_ick", /* apparently ipi and isp */ .parent = &dsp_irate_ick, .flags = CLOCK_IN_OMAP242X | DELAYED_APP | CONFIG_PARTICIPANT, + .clkdm = { .name = "dsp_clkdm" }, .enable_reg = _CM_REG_OFFSET(OMAP24XX_DSP_MOD, CM_ICLKEN), .enable_bit = OMAP2420_EN_DSP_IPI_SHIFT, /* for ipi */ };
@@ -1110,6 +1112,7 @@ static struct clk iva2_1_ick = { .name = "iva2_1_ick", .parent = &dsp_irate_ick, .flags = CLOCK_IN_OMAP243X | DELAYED_APP | CONFIG_PARTICIPANT, + .clkdm = { .name = "dsp_clkdm" }, .enable_reg = _CM_REG_OFFSET(OMAP24XX_DSP_MOD, CM_FCLKEN), .enable_bit = OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT, };
@@ -1689,6 +1692,7 @@ static struct clk gpt7_ick = { .name = "gpt7_ick", .parent = &l4_ck, .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, + .clkdm = { .name = "core_l4_clkdm" }, .enable_reg = _CM_REG_OFFSET(CORE_MOD, CM_ICLKEN1), .enable_bit = OMAP24XX_EN_GPT7_SHIFT, .recalc = &followparent_recalc,
@@ -2582,6 +2586,7 @@ static struct clk mmchs2_fck = { .id = 1, .parent = &func_96m_ck, .flags = CLOCK_IN_OMAP243X, + .clkdm = { .name = "core_l4_clkdm" }, .enable_reg = _CM_REG_OFFSET(CORE_MOD, OMAP24XX_CM_FCLKEN2), .enable_bit = OMAP2430_EN_MMCHS2_SHIFT, .recalc = &followparent_recalc,
arch/arm/mach-omap2/clock34xx.h +25 -19
302 lines not on this page · raw message
-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel FAQ: http://www.arm.linux.org.uk/mailinglists/faq.php Etiquette: http://www.arm.linux.org.uk/mailinglists/etiquette.php
Re: [PATCH B 05/10] OMAP2/3 clock: add clockdomains to all remaining clocks; fix clkdm init
Quoted 5 lines · Paul Walmsley
Add clockdomains for all remaining clocks without them, and warn in
clk_register()if any are missing a clockdomain. On OMAP2, callomap2_init_clk_clkdm()immediately afterclk_register(), just as OMAP3 does. Removeomap2_init_clk_clkdm()from all of the struct clk .init function pointers, since the OMAP2/3 arch clock init code now calls it.
Probably the same comment as B4.
Paul Walmsley
maintainerPATCH 6/10 OMAP3 pwrdm: add CORE SAR handling (for USBTLL module)
In reply to Paul Walmsley34xx TRM Delta G->H notes that the CORE powerdomain has a hardware save-and-restore (SAR) control bit for the USBTLL module, similar to the USBHOST powerdomain SAR bit. Split the existing core_34xx struct powerdomain into two structs, one for ES1 and one for ES2, and add the PWRDM_HAS_HDWR_SAR flag to the ES2 powerdomain.
--- arch/arm/mach-omap2/powerdomains.h | 3 ++- arch/arm/mach-omap2/powerdomains34xx.h | 23 +++++++++++++++++++++-- 2 files changed, 23 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_es1_pwrdm, + &core_34xx_es2_pwrdm, &cam_pwrdm, &dss_pwrdm, &per_pwrdm,
arch/arm/mach-omap2/powerdomains34xx.h +21 -2
@@ -200,12 +200,31 @@ 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_es1_pwrdm = { .name ="core_pwrdm" , .prcm_offs =CORE_MOD , - .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ), + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430ES1 ), + .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_es2_pwrdm = { + .name ="core_pwrdm" , + .prcm_offs =CORE_MOD , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430ES2 ), .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 */
RE: [PATCH B 06/10] OMAP3 pwrdm: add CORE SAR handling (for USBTLL module)
Quoted 10 lines
34xx TRM Delta
G->Hnotes that the CORE powerdomain has a hardware save-and-restore (SAR) control bit for the USBTLL module, similar to the USBHOST powerdomain SAR bit. Split the existingcore_34xxstruct powerdomain into two structs, one for ES1 and one for ES2, and add thePWRDM_HAS_HDWR_SARflag to the ES2 powerdomain.Signed-off-by Paul Walmsley <[email protected]>Signed-off-by Tony Lindgren <[email protected]>arch/arm/mach-omap2/powerdomains34xx.h +2
-0+ +/* No wkdeps or sleepdeps for 34xx core apparently */
arch/arm/mach-omap2/powerdomains34xx.h static struct powerdomain mpu_34xx_pwrdm = { · line 230
Quoted 10 lines
arch/arm/mach-omap2/powerdomains34xx.h +5
-0+static struct powerdomain core_34xx_es2_pwrdm = { + .name ="core_pwrdm" , + .prcm_offs =CORE_MOD , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430ES2 ), .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 */
TLLSAR is not functional till ES3.1 (and beyound). Is it possible to flag it this way?
If you try and use it your system will deadlock on 2nd OFF mode transition due to hardware bug.
Regards,
Richard W.
Paul Walmsley
maintainerRE: [PATCH B 06/10] OMAP3 pwrdm: add CORE SAR handling (for USBTLL module)
Hi Richard,
Quoted 6 lines · Richard
Quoted 6 lines
34xx TRM Delta
G->Hnotes that the CORE powerdomain has a hardware save-and-restore (SAR) control bit for the USBTLL module, similar to the USBHOST powerdomain SAR bit. Split the existingcore_34xxstruct powerdomain into two structs, one for ES1 and one for ES2, and add thePWRDM_HAS_HDWR_SARflag to the ES2 powerdomain.
Quoted 16 lines
Quoted 4 lines
Signed-off-by Paul Walmsley <[email protected]>Signed-off-by Tony Lindgren <[email protected]>arch/arm/mach-omap2/powerdomains34xx.h +2
-0+ +/* No wkdeps or sleepdeps for 34xx core apparently */ arch/arm/mach-omap2/powerdomains34xx.h static struct powerdomain mpu_34xx_pwrdm = { · line 230
Quoted 10 lines
arch/arm/mach-omap2/powerdomains34xx.h +5
-0+static struct powerdomain core_34xx_es2_pwrdm = { + .name ="core_pwrdm" , + .prcm_offs =CORE_MOD , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430ES2 ), .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 */ TLLSAR is not functional till ES3.1 (and beyound). Is it possible to flag it this way?
Yes, it's easy in this case. Thanks for the note. I will send along an updated patch for this.
Quoted 1 line
If you try and use it your system will deadlock on 2nd OFF mode transition due to hardware bug.
- Paul
Paul Walmsley
maintainerRE: [PATCH B 06/10] OMAP3 pwrdm: add CORE SAR handling (for USBTLL module)
Hi Richard,
Quoted 4 lines · Paul Walmsley
Quoted 1 line
TLLSAR is not functional till ES3.1 (and beyound). Is it possible to flag it this way?
Yes, it's easy in this case. Thanks for the note. I will send along an updated patch for this.
N.B. - fixxing this required a separate change to the omap_chip flag system, so I'll send the two necessary patches to the linux-omap mailing list for further testing.
- Paul
Re: [PATCH B 06/10] OMAP3 pwrdm: add CORE SAR handling (for USBTLL module)
Quoted 4 lines · Paul Walmsley
Hi Richard,
On Thu, 29 Jan 2009, Paul Walmsley wrote:
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
TLLSAR is not functional till ES3.1 (and beyound). Is it possible to flag it this way?
Yes, it's easy in this case. Thanks for the note. I will send along an updated patch for this.
N.B. - fixxing this required a separate change to the
omap_chipflag system, so I'll send the two necessary patches to the linux-omap mailing list for further testing.
I'll hold off on this patch then.
Paul Walmsley
maintainerRe: [PATCH B 06/10] OMAP3 pwrdm: add CORE SAR handling (for USBTLL module)
Hello Russell,
Quoted 7 lines · Russell King - ARM Linux
Quoted 6 lines · Paul Walmsley
Hi Richard,
Quoted 2 lines · Paul Walmsley
Quoted 1 line
TLLSAR is not functional till ES3.1 (and beyound). Is it possible to flag it this way?
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Yes, it's easy in this case. Thanks for the note. I will send along an updated patch for this.
N.B. - fixxing this required a separate change to the
omap_chipflag system, so I'll send the two necessary patches to the linux-omap mailing list for further testing.I'll hold off on this patch then.
The patches that obsolete patch B 06 have lasted a week on linux-omap@vger without any comment, so am passing them along in subsequent E-mails.
- Paul
Re: [PATCH B 06/10] OMAP3 pwrdm: add CORE SAR handling (for USBTLL module)
Quoted 14 lines · Paul Walmsley
Hello Russell,
Quoted 10 lines · Russell King - ARM Linux
Quoted 9 lines · Paul Walmsley
Hi Richard,
Quoted 4 lines · Paul Walmsley
Quoted 1 line
TLLSAR is not functional till ES3.1 (and beyound). Is it possible to flag it this way?
Yes, it's easy in this case. Thanks for the note. I will send along an updated patch for this.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
N.B. - fixxing this required a separate change to the
omap_chipflag system, so I'll send the two necessary patches to the linux-omap mailing list for further testing.I'll hold off on this patch then.
The patches that obsolete patch B 06 have lasted a week on linux-omap@vger without any comment, so am passing them along in subsequent E-mails.
It seems that the patches don't obsolete this patch, but instead require this patch to be applied first.
We really really need to get out of this pattern of building fixes on top of bad patches. If a patch is the wrong approach then it is the wrong approach and should be dropped, or it should be merged with the patches which fix stuff up to the new approach.
I'm going to combine B06 with patch 2 and hope things come out right.
Paul Walmsley
maintainerRe: [PATCH B 06/10] OMAP3 pwrdm: add CORE SAR handling (for USBTLL module)
Russell,
Quoted 14 lines · Russell King - ARM Linux
Quoted 13 lines · Paul Walmsley
Quoted 12 lines · Russell King - ARM Linux
Quoted 10 lines · Paul Walmsley
Quoted 4 lines · Paul Walmsley
Quoted 1 line
TLLSAR is not functional till ES3.1 (and beyound). Is it possible to flag it this way?
Yes, it's easy in this case. Thanks for the note. I will send along an updated patch for this.
N.B. - fixxing this required a separate change to the
omap_chipflag system, so I'll send the two necessary patches to the linux-omap mailing list for further testing.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
I'll hold off on this patch then.
The patches that obsolete patch B 06 have lasted a week on linux-omap@vger without any comment, so am passing them along in subsequent E-mails.
It seems that the patches don't obsolete this patch, but instead require this patch to be applied first.
The motivation was to make your life easier; otherwise several later patches would need to be updated and re-posted.
Quoted 4 lines
We really really need to get out of this pattern of building fixes on top of bad patches. If a patch is the wrong approach then it is the wrong approach and should be dropped, or it should be merged with the patches which fix stuff up to the new approach.
How would you like me to handle patch rewrites when they affect later patches in the series, as this one did? Shall I re-send updates of any later affected patches?
- Paul
Paul Walmsley
maintainerPATCH 7/10 OMAP3 powerdomains: remove RET from SGX power states list
In reply to Paul WalmsleyThe 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
@@ -255,6 +255,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 ,
@@ -262,7 +267,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 = {
Paul Walmsley
maintainerPATCH 8/10 OMAP: wait for pwrdm transition after clk_enable()
In reply to Paul WalmsleyFrom: 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
@@ -561,6 +561,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 ; }
Paul Walmsley
maintainerPATCH 9/10 OMAP2/3 clockdomains: autodeps should respect platform flags
In reply to Paul WalmsleyFix 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
@@ -96,6 +96,9 @@ static void _clkdm_add_autodeps(struct clockdomain *clkdm)struct clkdm_pwrdm_autodep *autodep;for (autodep = autodeps; autodep->pwrdm.ptr; autodep++) { +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);
@@ -118,6 +121,9 @@ static void _clkdm_del_autodeps(struct clockdomain *clkdm)struct clkdm_pwrdm_autodep *autodep;for (autodep = autodeps; autodep->pwrdm.ptr; autodep++) { +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);
Paul Walmsley
maintainerPATCH 10/10 OMAP3: PM: Emu_pwrdm is switched off by hardware even when sdti is in use
In reply to Paul WalmsleyFrom: 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
@@ -251,10 +251,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 ), };