diff options
author | Rajendra Nayak <rnayak@ti.com> | 2010-12-21 22:01:18 -0500 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2010-12-21 22:01:18 -0500 |
commit | f327e07b0ef9c60a6018799c9f04de10101d8e5a (patch) | |
tree | 4f21b95c3a8f5badb3a1cf69ab75b8edfd1624a6 /arch | |
parent | 3b1e8b21fcbd686445f0bb42f84701b4621cdec6 (diff) |
OMAP: powerdomain: Arch specific funcs for state control
Define the following architecture specific funtions for omap2/3/4
.pwrdm_set_next_pwrst
.pwrdm_read_next_pwrst
.pwrdm_read_pwrst
.pwrdm_read_prev_pwrst
Convert the platform-independent framework to call these functions.
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
[paul@pwsan.com: remove remaining static allocations in powerdomains.h file;
remove path in file header comments, rearranged Makefile changes]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Reviewed-by: Kevin Hilman <khilman@deeprootsystems.com>
Tested-by: Kevin Hilman <khilman@deeprootsystems.com>
Tested-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Tested-by: Rajendra Nayak <rnayak@ti.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-omap2/Makefile | 7 | ||||
-rw-r--r-- | arch/arm/mach-omap2/powerdomain.c | 33 | ||||
-rw-r--r-- | arch/arm/mach-omap2/powerdomain2xxx_3xxx.c | 62 | ||||
-rw-r--r-- | arch/arm/mach-omap2/powerdomain44xx.c | 55 | ||||
-rw-r--r-- | arch/arm/mach-omap2/powerdomains.h | 22 | ||||
-rw-r--r-- | arch/arm/mach-omap2/powerdomains_data.c | 8 |
6 files changed, 175 insertions, 12 deletions
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 00c27ebf709d..c43948c8d543 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
@@ -79,7 +79,12 @@ obj-$(CONFIG_ARCH_OMAP4) += prcm.o cm4xxx.o | |||
79 | 79 | ||
80 | # OMAP powerdomain framework | 80 | # OMAP powerdomain framework |
81 | powerdomain-common += powerdomain.o powerdomains_data.o | 81 | powerdomain-common += powerdomain.o powerdomains_data.o |
82 | obj-y += $(powerdomain-common) | 82 | obj-$(CONFIG_ARCH_OMAP2) += $(powerdomain-common) \ |
83 | powerdomain2xxx_3xxx.o | ||
84 | obj-$(CONFIG_ARCH_OMAP3) += $(powerdomain-common) \ | ||
85 | powerdomain2xxx_3xxx.o | ||
86 | obj-$(CONFIG_ARCH_OMAP4) += $(powerdomain-common) \ | ||
87 | powerdomain44xx.o | ||
83 | 88 | ||
84 | # Clock framework | 89 | # Clock framework |
85 | obj-$(CONFIG_ARCH_OMAP2) += $(clock-common) clock2xxx.o \ | 90 | obj-$(CONFIG_ARCH_OMAP2) += $(clock-common) clock2xxx.o \ |
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c index 3aa3eb335416..0ae1ebf4e974 100644 --- a/arch/arm/mach-omap2/powerdomain.c +++ b/arch/arm/mach-omap2/powerdomain.c | |||
@@ -439,6 +439,8 @@ int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm) | |||
439 | */ | 439 | */ |
440 | int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst) | 440 | int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst) |
441 | { | 441 | { |
442 | int ret = -EINVAL; | ||
443 | |||
442 | if (!pwrdm) | 444 | if (!pwrdm) |
443 | return -EINVAL; | 445 | return -EINVAL; |
444 | 446 | ||
@@ -448,11 +450,10 @@ int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst) | |||
448 | pr_debug("powerdomain: setting next powerstate for %s to %0x\n", | 450 | pr_debug("powerdomain: setting next powerstate for %s to %0x\n", |
449 | pwrdm->name, pwrst); | 451 | pwrdm->name, pwrst); |
450 | 452 | ||
451 | prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK, | 453 | if (arch_pwrdm && arch_pwrdm->pwrdm_set_next_pwrst) |
452 | (pwrst << OMAP_POWERSTATE_SHIFT), | 454 | ret = arch_pwrdm->pwrdm_set_next_pwrst(pwrdm, pwrst); |
453 | pwrdm->prcm_offs, pwrstctrl_reg_offs); | ||
454 | 455 | ||
455 | return 0; | 456 | return ret; |
456 | } | 457 | } |
457 | 458 | ||
458 | /** | 459 | /** |
@@ -465,11 +466,15 @@ int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst) | |||
465 | */ | 466 | */ |
466 | int pwrdm_read_next_pwrst(struct powerdomain *pwrdm) | 467 | int pwrdm_read_next_pwrst(struct powerdomain *pwrdm) |
467 | { | 468 | { |
469 | int ret = -EINVAL; | ||
470 | |||
468 | if (!pwrdm) | 471 | if (!pwrdm) |
469 | return -EINVAL; | 472 | return -EINVAL; |
470 | 473 | ||
471 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, | 474 | if (arch_pwrdm && arch_pwrdm->pwrdm_read_next_pwrst) |
472 | pwrstctrl_reg_offs, OMAP_POWERSTATE_MASK); | 475 | ret = arch_pwrdm->pwrdm_read_next_pwrst(pwrdm); |
476 | |||
477 | return ret; | ||
473 | } | 478 | } |
474 | 479 | ||
475 | /** | 480 | /** |
@@ -482,11 +487,15 @@ int pwrdm_read_next_pwrst(struct powerdomain *pwrdm) | |||
482 | */ | 487 | */ |
483 | int pwrdm_read_pwrst(struct powerdomain *pwrdm) | 488 | int pwrdm_read_pwrst(struct powerdomain *pwrdm) |
484 | { | 489 | { |
490 | int ret = -EINVAL; | ||
491 | |||
485 | if (!pwrdm) | 492 | if (!pwrdm) |
486 | return -EINVAL; | 493 | return -EINVAL; |
487 | 494 | ||
488 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, | 495 | if (arch_pwrdm && arch_pwrdm->pwrdm_read_pwrst) |
489 | pwrstst_reg_offs, OMAP_POWERSTATEST_MASK); | 496 | ret = arch_pwrdm->pwrdm_read_pwrst(pwrdm); |
497 | |||
498 | return ret; | ||
490 | } | 499 | } |
491 | 500 | ||
492 | /** | 501 | /** |
@@ -499,11 +508,15 @@ int pwrdm_read_pwrst(struct powerdomain *pwrdm) | |||
499 | */ | 508 | */ |
500 | int pwrdm_read_prev_pwrst(struct powerdomain *pwrdm) | 509 | int pwrdm_read_prev_pwrst(struct powerdomain *pwrdm) |
501 | { | 510 | { |
511 | int ret = -EINVAL; | ||
512 | |||
502 | if (!pwrdm) | 513 | if (!pwrdm) |
503 | return -EINVAL; | 514 | return -EINVAL; |
504 | 515 | ||
505 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP3430_PM_PREPWSTST, | 516 | if (arch_pwrdm && arch_pwrdm->pwrdm_read_prev_pwrst) |
506 | OMAP3430_LASTPOWERSTATEENTERED_MASK); | 517 | ret = arch_pwrdm->pwrdm_read_prev_pwrst(pwrdm); |
518 | |||
519 | return ret; | ||
507 | } | 520 | } |
508 | 521 | ||
509 | /** | 522 | /** |
diff --git a/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c b/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c new file mode 100644 index 000000000000..a25dd64d609b --- /dev/null +++ b/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | * OMAP2 and OMAP3 powerdomain control | ||
3 | * | ||
4 | * Copyright (C) 2009-2010 Texas Instruments, Inc. | ||
5 | * Copyright (C) 2007-2009 Nokia Corporation | ||
6 | * | ||
7 | * Derived from mach-omap2/powerdomain.c written by Paul Walmsley | ||
8 | * Rajendra Nayak <rnayak@ti.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | #include <linux/io.h> | ||
16 | #include <linux/errno.h> | ||
17 | #include <linux/delay.h> | ||
18 | #include <plat/prcm.h> | ||
19 | #include "prm.h" | ||
20 | #include "prm-regbits-34xx.h" | ||
21 | #include "powerdomains.h" | ||
22 | |||
23 | /* Common functions across OMAP2 and OMAP3 */ | ||
24 | static int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst) | ||
25 | { | ||
26 | prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK, | ||
27 | (pwrst << OMAP_POWERSTATE_SHIFT), | ||
28 | pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL); | ||
29 | return 0; | ||
30 | } | ||
31 | |||
32 | static int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm) | ||
33 | { | ||
34 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, | ||
35 | OMAP2_PM_PWSTCTRL, OMAP_POWERSTATE_MASK); | ||
36 | } | ||
37 | |||
38 | static int omap2_pwrdm_read_pwrst(struct powerdomain *pwrdm) | ||
39 | { | ||
40 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, | ||
41 | OMAP2_PM_PWSTST, OMAP_POWERSTATEST_MASK); | ||
42 | } | ||
43 | |||
44 | /* Applicable only for OMAP3. Not supported on OMAP2 */ | ||
45 | static int omap3_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm) | ||
46 | { | ||
47 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP3430_PM_PREPWSTST, | ||
48 | OMAP3430_LASTPOWERSTATEENTERED_MASK); | ||
49 | } | ||
50 | |||
51 | struct pwrdm_ops omap2_pwrdm_operations = { | ||
52 | .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst, | ||
53 | .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst, | ||
54 | .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst, | ||
55 | }; | ||
56 | |||
57 | struct pwrdm_ops omap3_pwrdm_operations = { | ||
58 | .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst, | ||
59 | .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst, | ||
60 | .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst, | ||
61 | .pwrdm_read_prev_pwrst = omap3_pwrdm_read_prev_pwrst, | ||
62 | }; | ||
diff --git a/arch/arm/mach-omap2/powerdomain44xx.c b/arch/arm/mach-omap2/powerdomain44xx.c new file mode 100644 index 000000000000..5dc337c0e5d5 --- /dev/null +++ b/arch/arm/mach-omap2/powerdomain44xx.c | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | * OMAP4 powerdomain control | ||
3 | * | ||
4 | * Copyright (C) 2009-2010 Texas Instruments, Inc. | ||
5 | * Copyright (C) 2007-2009 Nokia Corporation | ||
6 | * | ||
7 | * Derived from mach-omap2/powerdomain.c written by Paul Walmsley | ||
8 | * Rajendra Nayak <rnayak@ti.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | #include <linux/io.h> | ||
16 | #include <linux/errno.h> | ||
17 | #include <linux/delay.h> | ||
18 | #include <plat/powerdomain.h> | ||
19 | #include <plat/prcm.h> | ||
20 | #include "prm.h" | ||
21 | #include "prm-regbits-44xx.h" | ||
22 | #include "powerdomains.h" | ||
23 | |||
24 | static int omap4_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst) | ||
25 | { | ||
26 | prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK, | ||
27 | (pwrst << OMAP_POWERSTATE_SHIFT), | ||
28 | pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL); | ||
29 | return 0; | ||
30 | } | ||
31 | |||
32 | static int omap4_pwrdm_read_next_pwrst(struct powerdomain *pwrdm) | ||
33 | { | ||
34 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, | ||
35 | OMAP4_PM_PWSTCTRL, OMAP_POWERSTATE_MASK); | ||
36 | } | ||
37 | |||
38 | static int omap4_pwrdm_read_pwrst(struct powerdomain *pwrdm) | ||
39 | { | ||
40 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, | ||
41 | OMAP4_PM_PWSTST, OMAP_POWERSTATEST_MASK); | ||
42 | } | ||
43 | |||
44 | static int omap4_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm) | ||
45 | { | ||
46 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP4_PM_PWSTST, | ||
47 | OMAP4430_LASTPOWERSTATEENTERED_MASK); | ||
48 | } | ||
49 | |||
50 | struct pwrdm_ops omap4_pwrdm_operations = { | ||
51 | .pwrdm_set_next_pwrst = omap4_pwrdm_set_next_pwrst, | ||
52 | .pwrdm_read_next_pwrst = omap4_pwrdm_read_next_pwrst, | ||
53 | .pwrdm_read_pwrst = omap4_pwrdm_read_pwrst, | ||
54 | .pwrdm_read_prev_pwrst = omap4_pwrdm_read_prev_pwrst, | ||
55 | }; | ||
diff --git a/arch/arm/mach-omap2/powerdomains.h b/arch/arm/mach-omap2/powerdomains.h new file mode 100644 index 000000000000..e57bc41ef4aa --- /dev/null +++ b/arch/arm/mach-omap2/powerdomains.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * OMAP2+ powerdomain prototypes | ||
3 | * | ||
4 | * Copyright (C) 2010 Texas Instruments, Inc. | ||
5 | * | ||
6 | * Rajendra Nayak <rnayak@ti.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef ARCH_ARM_MACH_OMAP2_POWERDOMAINS | ||
14 | #define ARCH_ARM_MACH_OMAP2_POWERDOMAINS | ||
15 | |||
16 | #include <plat/powerdomain.h> | ||
17 | |||
18 | extern struct pwrdm_ops omap2_pwrdm_operations; | ||
19 | extern struct pwrdm_ops omap3_pwrdm_operations; | ||
20 | extern struct pwrdm_ops omap4_pwrdm_operations; | ||
21 | |||
22 | #endif /* ARCH_ARM_MACH_OMAP2_POWERDOMAINS */ | ||
diff --git a/arch/arm/mach-omap2/powerdomains_data.c b/arch/arm/mach-omap2/powerdomains_data.c index bf5b39be8240..29690c64bf1e 100644 --- a/arch/arm/mach-omap2/powerdomains_data.c +++ b/arch/arm/mach-omap2/powerdomains_data.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #include "powerdomains24xx.h" | 55 | #include "powerdomains24xx.h" |
56 | #include "powerdomains34xx.h" | 56 | #include "powerdomains34xx.h" |
57 | #include "powerdomains44xx.h" | 57 | #include "powerdomains44xx.h" |
58 | #include "powerdomains.h" | ||
58 | 59 | ||
59 | /* OMAP2/3-common powerdomains */ | 60 | /* OMAP2/3-common powerdomains */ |
60 | 61 | ||
@@ -149,5 +150,10 @@ static struct powerdomain *powerdomains_omap[] __initdata = { | |||
149 | 150 | ||
150 | void pwrdm_fw_init(void) | 151 | void pwrdm_fw_init(void) |
151 | { | 152 | { |
152 | pwrdm_init(powerdomains_omap, NULL); | 153 | if (cpu_is_omap24xx()) |
154 | pwrdm_init(powerdomains_omap, &omap2_pwrdm_operations); | ||
155 | else if (cpu_is_omap34xx()) | ||
156 | pwrdm_init(powerdomains_omap, &omap3_pwrdm_operations); | ||
157 | else if (cpu_is_omap44xx()) | ||
158 | pwrdm_init(powerdomains_omap, &omap4_pwrdm_operations); | ||
153 | } | 159 | } |