aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2014-05-16 18:26:22 -0400
committerTony Lindgren <tony@atomide.com>2014-05-16 18:26:22 -0400
commitea351c1603df0607b68eb4663b82ba7a70519d2e (patch)
tree3288badcd529986d417c4b999cdba5006f469fd3 /arch
parentbe2d62844819b3536233b7fc726b8f17d9fa7f05 (diff)
parent70fcebf1965b66d73bd8ae7955bd663ab8012c56 (diff)
Merge tag 'for-v3.16/prcm-cleanup-a' of git://git.kernel.org/pub/scm/linux/kernel/git/pjw/omap-pending into omap-for-v3.16/prcm
Some OMAP PRCM cleanup patches. These help prepare to convert the PRCM code into drivers. Basic build, boot, and PM test results are available here: http://www.pwsan.com/omap/testlogs/prcm-cleanup-v3.16/20140515213244/ Conflicts: arch/arm/mach-omap2/cm3xxx.c arch/arm/mach-omap2/cm44xx.c Also fixed up new section mismatch warnings.
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/clockdomain.h3
-rw-r--r--arch/arm/mach-omap2/cm2xxx.c15
-rw-r--r--arch/arm/mach-omap2/cm33xx.h3
-rw-r--r--arch/arm/mach-omap2/cm3xxx.c25
-rw-r--r--arch/arm/mach-omap2/cm3xxx.h5
-rw-r--r--arch/arm/mach-omap2/cm44xx.c11
-rw-r--r--arch/arm/mach-omap2/cm_common.c2
-rw-r--r--arch/arm/mach-omap2/cminst44xx.c10
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c1
-rw-r--r--arch/arm/mach-omap2/powerdomain-common.c1
-rw-r--r--arch/arm/mach-omap2/powerdomain.c1
-rw-r--r--arch/arm/mach-omap2/powerdomain.h3
-rw-r--r--arch/arm/mach-omap2/prcm-common.h24
-rw-r--r--arch/arm/mach-omap2/prcm_mpu44xx.h1
-rw-r--r--arch/arm/mach-omap2/prm.h10
-rw-r--r--arch/arm/mach-omap2/prm2xxx.c13
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.c1
-rw-r--r--arch/arm/mach-omap2/prm33xx.c1
-rw-r--r--arch/arm/mach-omap2/prm3xxx.c22
-rw-r--r--arch/arm/mach-omap2/prm44xx.c20
-rw-r--r--arch/arm/mach-omap2/prm_common.c17
21 files changed, 95 insertions, 94 deletions
diff --git a/arch/arm/mach-omap2/clockdomain.h b/arch/arm/mach-omap2/clockdomain.h
index f17f00697cc0..82c37b1becc4 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -18,7 +18,6 @@
18 18
19#include "powerdomain.h" 19#include "powerdomain.h"
20#include "clock.h" 20#include "clock.h"
21#include "omap_hwmod.h"
22 21
23/* 22/*
24 * Clockdomain flags 23 * Clockdomain flags
@@ -98,6 +97,8 @@ struct clkdm_dep {
98/* Possible flags for struct clockdomain._flags */ 97/* Possible flags for struct clockdomain._flags */
99#define _CLKDM_FLAG_HWSUP_ENABLED BIT(0) 98#define _CLKDM_FLAG_HWSUP_ENABLED BIT(0)
100 99
100struct omap_hwmod;
101
101/** 102/**
102 * struct clockdomain - OMAP clockdomain 103 * struct clockdomain - OMAP clockdomain
103 * @name: clockdomain name 104 * @name: clockdomain name
diff --git a/arch/arm/mach-omap2/cm2xxx.c b/arch/arm/mach-omap2/cm2xxx.c
index ce25abbcffae..8be6ea50c092 100644
--- a/arch/arm/mach-omap2/cm2xxx.c
+++ b/arch/arm/mach-omap2/cm2xxx.c
@@ -18,9 +18,6 @@
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/io.h> 19#include <linux/io.h>
20 20
21#include "soc.h"
22#include "iomap.h"
23#include "common.h"
24#include "prm2xxx.h" 21#include "prm2xxx.h"
25#include "cm.h" 22#include "cm.h"
26#include "cm2xxx.h" 23#include "cm2xxx.h"
@@ -390,7 +387,7 @@ void omap2xxx_cm_set_mod_dividers(u32 mpu, u32 dsp, u32 gfx, u32 core, u32 mdm)
390 tmp = omap2_cm_read_mod_reg(CORE_MOD, CM_CLKSEL1) & 387 tmp = omap2_cm_read_mod_reg(CORE_MOD, CM_CLKSEL1) &
391 OMAP24XX_CLKSEL_DSS2_MASK; 388 OMAP24XX_CLKSEL_DSS2_MASK;
392 omap2_cm_write_mod_reg(core | tmp, CORE_MOD, CM_CLKSEL1); 389 omap2_cm_write_mod_reg(core | tmp, CORE_MOD, CM_CLKSEL1);
393 if (cpu_is_omap2430()) 390 if (mdm)
394 omap2_cm_write_mod_reg(mdm, OMAP2430_MDM_MOD, CM_CLKSEL); 391 omap2_cm_write_mod_reg(mdm, OMAP2430_MDM_MOD, CM_CLKSEL);
395} 392}
396 393
@@ -405,19 +402,11 @@ static struct cm_ll_data omap2xxx_cm_ll_data = {
405 402
406int __init omap2xxx_cm_init(void) 403int __init omap2xxx_cm_init(void)
407{ 404{
408 if (!cpu_is_omap24xx())
409 return 0;
410
411 return cm_register(&omap2xxx_cm_ll_data); 405 return cm_register(&omap2xxx_cm_ll_data);
412} 406}
413 407
414static void __exit omap2xxx_cm_exit(void) 408static void __exit omap2xxx_cm_exit(void)
415{ 409{
416 if (!cpu_is_omap24xx()) 410 cm_unregister(&omap2xxx_cm_ll_data);
417 return;
418
419 /* Should never happen */
420 WARN(cm_unregister(&omap2xxx_cm_ll_data),
421 "%s: cm_ll_data function pointer mismatch\n", __func__);
422} 411}
423__exitcall(omap2xxx_cm_exit); 412__exitcall(omap2xxx_cm_exit);
diff --git a/arch/arm/mach-omap2/cm33xx.h b/arch/arm/mach-omap2/cm33xx.h
index cfb8891b0c0e..15a778ce7707 100644
--- a/arch/arm/mach-omap2/cm33xx.h
+++ b/arch/arm/mach-omap2/cm33xx.h
@@ -17,11 +17,8 @@
17#ifndef __ARCH_ARM_MACH_OMAP2_CM_33XX_H 17#ifndef __ARCH_ARM_MACH_OMAP2_CM_33XX_H
18#define __ARCH_ARM_MACH_OMAP2_CM_33XX_H 18#define __ARCH_ARM_MACH_OMAP2_CM_33XX_H
19 19
20#include "common.h"
21
22#include "cm.h" 20#include "cm.h"
23#include "cm-regbits-33xx.h" 21#include "cm-regbits-33xx.h"
24#include "iomap.h"
25 22
26/* CM base address */ 23/* CM base address */
27#define AM33XX_CM_BASE 0x44e00000 24#define AM33XX_CM_BASE 0x44e00000
diff --git a/arch/arm/mach-omap2/cm3xxx.c b/arch/arm/mach-omap2/cm3xxx.c
index 9079f2558b1b..129a4e7f6ef5 100644
--- a/arch/arm/mach-omap2/cm3xxx.c
+++ b/arch/arm/mach-omap2/cm3xxx.c
@@ -18,9 +18,6 @@
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/io.h> 19#include <linux/io.h>
20 20
21#include "soc.h"
22#include "iomap.h"
23#include "common.h"
24#include "prm2xxx_3xxx.h" 21#include "prm2xxx_3xxx.h"
25#include "cm.h" 22#include "cm.h"
26#include "cm3xxx.h" 23#include "cm3xxx.h"
@@ -388,7 +385,8 @@ void omap3_cm_save_context(void)
388 omap2_cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_CLKSEL1); 385 omap2_cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_CLKSEL1);
389 cm_context.iva2_cm_clksel2 = 386 cm_context.iva2_cm_clksel2 =
390 omap2_cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_CLKSEL2); 387 omap2_cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_CLKSEL2);
391 cm_context.cm_sysconfig = readl_relaxed(OMAP3430_CM_SYSCONFIG); 388 cm_context.cm_sysconfig =
389 omap2_cm_read_mod_reg(OCP_MOD, OMAP3430_CM_SYSCONFIG);
392 cm_context.sgx_cm_clksel = 390 cm_context.sgx_cm_clksel =
393 omap2_cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_CLKSEL); 391 omap2_cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_CLKSEL);
394 cm_context.dss_cm_clksel = 392 cm_context.dss_cm_clksel =
@@ -418,7 +416,8 @@ void omap3_cm_save_context(void)
418 omap2_cm_read_mod_reg(PLL_MOD, OMAP3430ES2_CM_CLKSEL5); 416 omap2_cm_read_mod_reg(PLL_MOD, OMAP3430ES2_CM_CLKSEL5);
419 cm_context.pll_cm_clken2 = 417 cm_context.pll_cm_clken2 =
420 omap2_cm_read_mod_reg(PLL_MOD, OMAP3430ES2_CM_CLKEN2); 418 omap2_cm_read_mod_reg(PLL_MOD, OMAP3430ES2_CM_CLKEN2);
421 cm_context.cm_polctrl = readl_relaxed(OMAP3430_CM_POLCTRL); 419 cm_context.cm_polctrl =
420 omap2_cm_read_mod_reg(OCP_MOD, OMAP3430_CM_POLCTRL);
422 cm_context.iva2_cm_fclken = 421 cm_context.iva2_cm_fclken =
423 omap2_cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_FCLKEN); 422 omap2_cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_FCLKEN);
424 cm_context.iva2_cm_clken_pll = 423 cm_context.iva2_cm_clken_pll =
@@ -519,7 +518,8 @@ void omap3_cm_restore_context(void)
519 CM_CLKSEL1); 518 CM_CLKSEL1);
520 omap2_cm_write_mod_reg(cm_context.iva2_cm_clksel2, OMAP3430_IVA2_MOD, 519 omap2_cm_write_mod_reg(cm_context.iva2_cm_clksel2, OMAP3430_IVA2_MOD,
521 CM_CLKSEL2); 520 CM_CLKSEL2);
522 writel_relaxed(cm_context.cm_sysconfig, OMAP3430_CM_SYSCONFIG); 521 omap2_cm_write_mod_reg(cm_context.cm_sysconfig, OCP_MOD,
522 OMAP3430_CM_SYSCONFIG);
523 omap2_cm_write_mod_reg(cm_context.sgx_cm_clksel, OMAP3430ES2_SGX_MOD, 523 omap2_cm_write_mod_reg(cm_context.sgx_cm_clksel, OMAP3430ES2_SGX_MOD,
524 CM_CLKSEL); 524 CM_CLKSEL);
525 omap2_cm_write_mod_reg(cm_context.dss_cm_clksel, OMAP3430_DSS_MOD, 525 omap2_cm_write_mod_reg(cm_context.dss_cm_clksel, OMAP3430_DSS_MOD,
@@ -547,7 +547,8 @@ void omap3_cm_restore_context(void)
547 OMAP3430ES2_CM_CLKSEL5); 547 OMAP3430ES2_CM_CLKSEL5);
548 omap2_cm_write_mod_reg(cm_context.pll_cm_clken2, PLL_MOD, 548 omap2_cm_write_mod_reg(cm_context.pll_cm_clken2, PLL_MOD,
549 OMAP3430ES2_CM_CLKEN2); 549 OMAP3430ES2_CM_CLKEN2);
550 writel_relaxed(cm_context.cm_polctrl, OMAP3430_CM_POLCTRL); 550 omap2_cm_write_mod_reg(cm_context.cm_polctrl, OCP_MOD,
551 OMAP3430_CM_POLCTRL);
551 omap2_cm_write_mod_reg(cm_context.iva2_cm_fclken, OMAP3430_IVA2_MOD, 552 omap2_cm_write_mod_reg(cm_context.iva2_cm_fclken, OMAP3430_IVA2_MOD,
552 CM_FCLKEN); 553 CM_FCLKEN);
553 omap2_cm_write_mod_reg(cm_context.iva2_cm_clken_pll, OMAP3430_IVA2_MOD, 554 omap2_cm_write_mod_reg(cm_context.iva2_cm_clken_pll, OMAP3430_IVA2_MOD,
@@ -669,19 +670,11 @@ static struct cm_ll_data omap3xxx_cm_ll_data = {
669 670
670int __init omap3xxx_cm_init(void) 671int __init omap3xxx_cm_init(void)
671{ 672{
672 if (!cpu_is_omap34xx())
673 return 0;
674
675 return cm_register(&omap3xxx_cm_ll_data); 673 return cm_register(&omap3xxx_cm_ll_data);
676} 674}
677 675
678static void __exit omap3xxx_cm_exit(void) 676static void __exit omap3xxx_cm_exit(void)
679{ 677{
680 if (!cpu_is_omap34xx()) 678 cm_unregister(&omap3xxx_cm_ll_data);
681 return;
682
683 /* Should never happen */
684 WARN(cm_unregister(&omap3xxx_cm_ll_data),
685 "%s: cm_ll_data function pointer mismatch\n", __func__);
686} 679}
687__exitcall(omap3xxx_cm_exit); 680__exitcall(omap3xxx_cm_exit);
diff --git a/arch/arm/mach-omap2/cm3xxx.h b/arch/arm/mach-omap2/cm3xxx.h
index 8224c91b4d7a..7a16b5598127 100644
--- a/arch/arm/mach-omap2/cm3xxx.h
+++ b/arch/arm/mach-omap2/cm3xxx.h
@@ -29,9 +29,8 @@
29 * These registers appear once per CM module. 29 * These registers appear once per CM module.
30 */ 30 */
31 31
32#define OMAP3430_CM_REVISION OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000) 32#define OMAP3430_CM_SYSCONFIG 0x0010
33#define OMAP3430_CM_SYSCONFIG OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010) 33#define OMAP3430_CM_POLCTRL 0x009c
34#define OMAP3430_CM_POLCTRL OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c)
35 34
36#define OMAP3_CM_CLKOUT_CTRL_OFFSET 0x0070 35#define OMAP3_CM_CLKOUT_CTRL_OFFSET 0x0070
37#define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070) 36#define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
diff --git a/arch/arm/mach-omap2/cm44xx.c b/arch/arm/mach-omap2/cm44xx.c
index 30b6d9743b73..fe5cc7bae489 100644
--- a/arch/arm/mach-omap2/cm44xx.c
+++ b/arch/arm/mach-omap2/cm44xx.c
@@ -18,35 +18,32 @@
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/io.h> 19#include <linux/io.h>
20 20
21#include "iomap.h"
22#include "common.h"
23#include "cm.h" 21#include "cm.h"
24#include "cm1_44xx.h" 22#include "cm1_44xx.h"
25#include "cm2_44xx.h" 23#include "cm2_44xx.h"
26#include "cm-regbits-44xx.h"
27 24
28/* CM1 hardware module low-level functions */ 25/* CM1 hardware module low-level functions */
29 26
30/* Read a register in CM1 */ 27/* Read a register in CM1 */
31u32 omap4_cm1_read_inst_reg(s16 inst, u16 reg) 28u32 omap4_cm1_read_inst_reg(s16 inst, u16 reg)
32{ 29{
33 return readl_relaxed(OMAP44XX_CM1_REGADDR(inst, reg)); 30 return readl_relaxed(cm_base + inst + reg);
34} 31}
35 32
36/* Write into a register in CM1 */ 33/* Write into a register in CM1 */
37void omap4_cm1_write_inst_reg(u32 val, s16 inst, u16 reg) 34void omap4_cm1_write_inst_reg(u32 val, s16 inst, u16 reg)
38{ 35{
39 writel_relaxed(val, OMAP44XX_CM1_REGADDR(inst, reg)); 36 writel_relaxed(val, cm_base + inst + reg);
40} 37}
41 38
42/* Read a register in CM2 */ 39/* Read a register in CM2 */
43u32 omap4_cm2_read_inst_reg(s16 inst, u16 reg) 40u32 omap4_cm2_read_inst_reg(s16 inst, u16 reg)
44{ 41{
45 return readl_relaxed(OMAP44XX_CM2_REGADDR(inst, reg)); 42 return readl_relaxed(cm2_base + inst + reg);
46} 43}
47 44
48/* Write into a register in CM2 */ 45/* Write into a register in CM2 */
49void omap4_cm2_write_inst_reg(u32 val, s16 inst, u16 reg) 46void omap4_cm2_write_inst_reg(u32 val, s16 inst, u16 reg)
50{ 47{
51 writel_relaxed(val, OMAP44XX_CM2_REGADDR(inst, reg)); 48 writel_relaxed(val, cm2_base + inst + reg);
52} 49}
diff --git a/arch/arm/mach-omap2/cm_common.c b/arch/arm/mach-omap2/cm_common.c
index 40b3b5a84458..8f6c4710877e 100644
--- a/arch/arm/mach-omap2/cm_common.c
+++ b/arch/arm/mach-omap2/cm_common.c
@@ -14,11 +14,11 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/bug.h>
17 18
18#include "cm2xxx.h" 19#include "cm2xxx.h"
19#include "cm3xxx.h" 20#include "cm3xxx.h"
20#include "cm44xx.h" 21#include "cm44xx.h"
21#include "common.h"
22 22
23/* 23/*
24 * cm_ll_data: function pointers to SoC-specific implementations of 24 * cm_ll_data: function pointers to SoC-specific implementations of
diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c
index 2f44257171dd..12aca56942c0 100644
--- a/arch/arm/mach-omap2/cminst44xx.c
+++ b/arch/arm/mach-omap2/cminst44xx.c
@@ -21,8 +21,6 @@
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#include "iomap.h"
25#include "common.h"
26#include "clockdomain.h" 24#include "clockdomain.h"
27#include "cm.h" 25#include "cm.h"
28#include "cm1_44xx.h" 26#include "cm1_44xx.h"
@@ -30,12 +28,18 @@
30#include "cm44xx.h" 28#include "cm44xx.h"
31#include "cminst44xx.h" 29#include "cminst44xx.h"
32#include "cm-regbits-34xx.h" 30#include "cm-regbits-34xx.h"
33#include "cm-regbits-44xx.h"
34#include "prcm44xx.h" 31#include "prcm44xx.h"
35#include "prm44xx.h" 32#include "prm44xx.h"
36#include "prcm_mpu44xx.h" 33#include "prcm_mpu44xx.h"
37#include "prcm-common.h" 34#include "prcm-common.h"
38 35
36#define OMAP4430_IDLEST_SHIFT 16
37#define OMAP4430_IDLEST_MASK (0x3 << 16)
38#define OMAP4430_CLKTRCTRL_SHIFT 0
39#define OMAP4430_CLKTRCTRL_MASK (0x3 << 0)
40#define OMAP4430_MODULEMODE_SHIFT 0
41#define OMAP4430_MODULEMODE_MASK (0x3 << 0)
42
39/* 43/*
40 * CLKCTRL_IDLEST_*: possible values for the CM_*_CLKCTRL.IDLEST bitfield: 44 * CLKCTRL_IDLEST_*: possible values for the CM_*_CLKCTRL.IDLEST bitfield:
41 * 45 *
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
index 0f178623e7da..a579b89ce9b7 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
@@ -24,6 +24,7 @@
24#include "prm33xx.h" 24#include "prm33xx.h"
25#include "omap_hwmod_33xx_43xx_common_data.h" 25#include "omap_hwmod_33xx_43xx_common_data.h"
26#include "prcm43xx.h" 26#include "prcm43xx.h"
27#include "common.h"
27 28
28#define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl)) 29#define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl))
29#define RSTCTRL(oh, rstctrl) ((oh).prcm.omap4.rstctrl_offs = (rstctrl)) 30#define RSTCTRL(oh, rstctrl) ((oh).prcm.omap4.rstctrl_offs = (rstctrl))
diff --git a/arch/arm/mach-omap2/powerdomain-common.c b/arch/arm/mach-omap2/powerdomain-common.c
index c0aeabfcf009..c40e5f009826 100644
--- a/arch/arm/mach-omap2/powerdomain-common.c
+++ b/arch/arm/mach-omap2/powerdomain-common.c
@@ -17,7 +17,6 @@
17#include "pm.h" 17#include "pm.h"
18#include "cm.h" 18#include "cm.h"
19#include "cm-regbits-34xx.h" 19#include "cm-regbits-34xx.h"
20#include "cm-regbits-44xx.h"
21#include "prm-regbits-34xx.h" 20#include "prm-regbits-34xx.h"
22#include "prm-regbits-44xx.h" 21#include "prm-regbits-44xx.h"
23 22
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index 93a2a6e4260f..faebd5f076af 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -32,6 +32,7 @@
32 32
33#include "powerdomain.h" 33#include "powerdomain.h"
34#include "clockdomain.h" 34#include "clockdomain.h"
35#include "voltage.h"
35 36
36#include "soc.h" 37#include "soc.h"
37#include "pm.h" 38#include "pm.h"
diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h
index da5a59ae77b6..f4727117f6cc 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -21,8 +21,6 @@
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23 23
24#include "voltage.h"
25
26/* Powerdomain basic power states */ 24/* Powerdomain basic power states */
27#define PWRDM_POWER_OFF 0x0 25#define PWRDM_POWER_OFF 0x0
28#define PWRDM_POWER_RET 0x1 26#define PWRDM_POWER_RET 0x1
@@ -75,6 +73,7 @@
75 73
76struct clockdomain; 74struct clockdomain;
77struct powerdomain; 75struct powerdomain;
76struct voltagedomain;
78 77
79/** 78/**
80 * struct powerdomain - OMAP powerdomain 79 * struct powerdomain - OMAP powerdomain
diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h
index 0e841fd9498a..a8e4b582c527 100644
--- a/arch/arm/mach-omap2/prcm-common.h
+++ b/arch/arm/mach-omap2/prcm-common.h
@@ -428,6 +428,28 @@
428#define MAX_IOPAD_LATCH_TIME 100 428#define MAX_IOPAD_LATCH_TIME 100
429# ifndef __ASSEMBLER__ 429# ifndef __ASSEMBLER__
430 430
431#include <linux/delay.h>
432
433/**
434 * omap_test_timeout - busy-loop, testing a condition
435 * @cond: condition to test until it evaluates to true
436 * @timeout: maximum number of microseconds in the timeout
437 * @index: loop index (integer)
438 *
439 * Loop waiting for @cond to become true or until at least @timeout
440 * microseconds have passed. To use, define some integer @index in the
441 * calling code. After running, if @index == @timeout, then the loop has
442 * timed out.
443 */
444#define omap_test_timeout(cond, timeout, index) \
445({ \
446 for (index = 0; index < timeout; index++) { \
447 if (cond) \
448 break; \
449 udelay(1); \
450 } \
451})
452
431/** 453/**
432 * struct omap_prcm_irq - describes a PRCM interrupt bit 454 * struct omap_prcm_irq - describes a PRCM interrupt bit
433 * @name: a short name describing the interrupt type, e.g. "wkup" or "io" 455 * @name: a short name describing the interrupt type, e.g. "wkup" or "io"
@@ -458,6 +480,7 @@ struct omap_prcm_irq {
458 * @ocp_barrier: fn ptr to force buffered PRM writes to complete 480 * @ocp_barrier: fn ptr to force buffered PRM writes to complete
459 * @save_and_clear_irqen: fn ptr to save and clear IRQENABLE regs 481 * @save_and_clear_irqen: fn ptr to save and clear IRQENABLE regs
460 * @restore_irqen: fn ptr to save and clear IRQENABLE regs 482 * @restore_irqen: fn ptr to save and clear IRQENABLE regs
483 * @reconfigure_io_chain: fn ptr to reconfigure IO chain
461 * @saved_mask: IRQENABLE regs are saved here during suspend 484 * @saved_mask: IRQENABLE regs are saved here during suspend
462 * @priority_mask: 1 bit per IRQ, set to 1 if omap_prcm_irq.priority = true 485 * @priority_mask: 1 bit per IRQ, set to 1 if omap_prcm_irq.priority = true
463 * @base_irq: base dynamic IRQ number, returned from irq_alloc_descs() in init 486 * @base_irq: base dynamic IRQ number, returned from irq_alloc_descs() in init
@@ -479,6 +502,7 @@ struct omap_prcm_irq_setup {
479 void (*ocp_barrier)(void); 502 void (*ocp_barrier)(void);
480 void (*save_and_clear_irqen)(u32 *saved_mask); 503 void (*save_and_clear_irqen)(u32 *saved_mask);
481 void (*restore_irqen)(u32 *saved_mask); 504 void (*restore_irqen)(u32 *saved_mask);
505 void (*reconfigure_io_chain)(void);
482 u32 *saved_mask; 506 u32 *saved_mask;
483 u32 *priority_mask; 507 u32 *priority_mask;
484 int base_irq; 508 int base_irq;
diff --git a/arch/arm/mach-omap2/prcm_mpu44xx.h b/arch/arm/mach-omap2/prcm_mpu44xx.h
index 059bd4f49035..ac9cb4550239 100644
--- a/arch/arm/mach-omap2/prcm_mpu44xx.h
+++ b/arch/arm/mach-omap2/prcm_mpu44xx.h
@@ -26,7 +26,6 @@
26#define __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H 26#define __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H
27 27
28#include "prcm_mpu_44xx_54xx.h" 28#include "prcm_mpu_44xx_54xx.h"
29#include "common.h"
30 29
31#define OMAP4430_PRCM_MPU_BASE 0x48243000 30#define OMAP4430_PRCM_MPU_BASE 0x48243000
32 31
diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h
index 623db40fdbbd..48480d557b61 100644
--- a/arch/arm/mach-omap2/prm.h
+++ b/arch/arm/mach-omap2/prm.h
@@ -17,10 +17,18 @@
17 17
18# ifndef __ASSEMBLER__ 18# ifndef __ASSEMBLER__
19extern void __iomem *prm_base; 19extern void __iomem *prm_base;
20extern u16 prm_features;
20extern void omap2_set_globals_prm(void __iomem *prm); 21extern void omap2_set_globals_prm(void __iomem *prm);
21int of_prcm_init(void); 22int of_prcm_init(void);
22# endif 23# endif
23 24
25/*
26 * prm_features flag values
27 *
28 * PRM_HAS_IO_WAKEUP: has IO wakeup capability
29 * PRM_HAS_VOLTAGE: has voltage domains
30 */
31#define PRM_HAS_IO_WAKEUP (1 << 0)
24 32
25/* 33/*
26 * MAX_MODULE_SOFTRESET_WAIT: Maximum microseconds to wait for OMAP 34 * MAX_MODULE_SOFTRESET_WAIT: Maximum microseconds to wait for OMAP
@@ -118,6 +126,7 @@ struct prm_reset_src_map {
118 * @read_reset_sources: ptr to the SoC PRM-specific get_reset_source impl 126 * @read_reset_sources: ptr to the SoC PRM-specific get_reset_source impl
119 * @was_any_context_lost_old: ptr to the SoC PRM context loss test fn 127 * @was_any_context_lost_old: ptr to the SoC PRM context loss test fn
120 * @clear_context_loss_flags_old: ptr to the SoC PRM context loss flag clear fn 128 * @clear_context_loss_flags_old: ptr to the SoC PRM context loss flag clear fn
129 * @late_init: ptr to the late init function
121 * 130 *
122 * XXX @was_any_context_lost_old and @clear_context_loss_flags_old are 131 * XXX @was_any_context_lost_old and @clear_context_loss_flags_old are
123 * deprecated. 132 * deprecated.
@@ -126,6 +135,7 @@ struct prm_ll_data {
126 u32 (*read_reset_sources)(void); 135 u32 (*read_reset_sources)(void);
127 bool (*was_any_context_lost_old)(u8 part, s16 inst, u16 idx); 136 bool (*was_any_context_lost_old)(u8 part, s16 inst, u16 idx);
128 void (*clear_context_loss_flags_old)(u8 part, s16 inst, u16 idx); 137 void (*clear_context_loss_flags_old)(u8 part, s16 inst, u16 idx);
138 int (*late_init)(void);
129}; 139};
130 140
131extern int prm_register(struct prm_ll_data *pld); 141extern int prm_register(struct prm_ll_data *pld);
diff --git a/arch/arm/mach-omap2/prm2xxx.c b/arch/arm/mach-omap2/prm2xxx.c
index 418de9c3b319..a3a3cca2bcc4 100644
--- a/arch/arm/mach-omap2/prm2xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx.c
@@ -18,9 +18,6 @@
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20 20
21#include "soc.h"
22#include "common.h"
23#include "vp.h"
24#include "powerdomain.h" 21#include "powerdomain.h"
25#include "clockdomain.h" 22#include "clockdomain.h"
26#include "prm2xxx.h" 23#include "prm2xxx.h"
@@ -201,19 +198,11 @@ static struct prm_ll_data omap2xxx_prm_ll_data = {
201 198
202int __init omap2xxx_prm_init(void) 199int __init omap2xxx_prm_init(void)
203{ 200{
204 if (!cpu_is_omap24xx())
205 return 0;
206
207 return prm_register(&omap2xxx_prm_ll_data); 201 return prm_register(&omap2xxx_prm_ll_data);
208} 202}
209 203
210static void __exit omap2xxx_prm_exit(void) 204static void __exit omap2xxx_prm_exit(void)
211{ 205{
212 if (!cpu_is_omap24xx()) 206 prm_unregister(&omap2xxx_prm_ll_data);
213 return;
214
215 /* Should never happen */
216 WARN(prm_unregister(&omap2xxx_prm_ll_data),
217 "%s: prm_ll_data function pointer mismatch\n", __func__);
218} 207}
219__exitcall(omap2xxx_prm_exit); 208__exitcall(omap2xxx_prm_exit);
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.c b/arch/arm/mach-omap2/prm2xxx_3xxx.c
index 947f6adfed0c..c13b4e293ffa 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.c
@@ -16,7 +16,6 @@
16#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/io.h> 17#include <linux/io.h>
18 18
19#include "common.h"
20#include "powerdomain.h" 19#include "powerdomain.h"
21#include "prm2xxx_3xxx.h" 20#include "prm2xxx_3xxx.h"
22#include "prm-regbits-24xx.h" 21#include "prm-regbits-24xx.h"
diff --git a/arch/arm/mach-omap2/prm33xx.c b/arch/arm/mach-omap2/prm33xx.c
index 93ba48a7d907..62709cd2f9c5 100644
--- a/arch/arm/mach-omap2/prm33xx.c
+++ b/arch/arm/mach-omap2/prm33xx.c
@@ -19,7 +19,6 @@
19#include <linux/err.h> 19#include <linux/err.h>
20#include <linux/io.h> 20#include <linux/io.h>
21 21
22#include "common.h"
23#include "powerdomain.h" 22#include "powerdomain.h"
24#include "prm33xx.h" 23#include "prm33xx.h"
25#include "prm-regbits-33xx.h" 24#include "prm-regbits-33xx.h"
diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c
index 7721990d2006..4bd7a2dca8af 100644
--- a/arch/arm/mach-omap2/prm3xxx.c
+++ b/arch/arm/mach-omap2/prm3xxx.c
@@ -43,6 +43,7 @@ static struct omap_prcm_irq_setup omap3_prcm_irq_setup = {
43 .ocp_barrier = &omap3xxx_prm_ocp_barrier, 43 .ocp_barrier = &omap3xxx_prm_ocp_barrier,
44 .save_and_clear_irqen = &omap3xxx_prm_save_and_clear_irqen, 44 .save_and_clear_irqen = &omap3xxx_prm_save_and_clear_irqen,
45 .restore_irqen = &omap3xxx_prm_restore_irqen, 45 .restore_irqen = &omap3xxx_prm_restore_irqen,
46 .reconfigure_io_chain = &omap3xxx_prm_reconfigure_io_chain,
46}; 47};
47 48
48/* 49/*
@@ -246,7 +247,7 @@ void omap3xxx_prm_reconfigure_io_chain(void)
246 */ 247 */
247static void __init omap3xxx_prm_enable_io_wakeup(void) 248static void __init omap3xxx_prm_enable_io_wakeup(void)
248{ 249{
249 if (omap3_has_io_wakeup()) 250 if (prm_features & PRM_HAS_IO_WAKEUP)
250 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, 251 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD,
251 PM_WKEN); 252 PM_WKEN);
252} 253}
@@ -400,23 +401,26 @@ struct pwrdm_ops omap3_pwrdm_operations = {
400 * 401 *
401 */ 402 */
402 403
404static int omap3xxx_prm_late_init(void);
405
403static struct prm_ll_data omap3xxx_prm_ll_data = { 406static struct prm_ll_data omap3xxx_prm_ll_data = {
404 .read_reset_sources = &omap3xxx_prm_read_reset_sources, 407 .read_reset_sources = &omap3xxx_prm_read_reset_sources,
408 .late_init = &omap3xxx_prm_late_init,
405}; 409};
406 410
407int __init omap3xxx_prm_init(void) 411int __init omap3xxx_prm_init(void)
408{ 412{
409 if (!cpu_is_omap34xx()) 413 if (omap3_has_io_wakeup())
410 return 0; 414 prm_features |= PRM_HAS_IO_WAKEUP;
411 415
412 return prm_register(&omap3xxx_prm_ll_data); 416 return prm_register(&omap3xxx_prm_ll_data);
413} 417}
414 418
415static int __init omap3xxx_prm_late_init(void) 419static int omap3xxx_prm_late_init(void)
416{ 420{
417 int ret; 421 int ret;
418 422
419 if (!cpu_is_omap34xx()) 423 if (!(prm_features & PRM_HAS_IO_WAKEUP))
420 return 0; 424 return 0;
421 425
422 omap3xxx_prm_enable_io_wakeup(); 426 omap3xxx_prm_enable_io_wakeup();
@@ -427,15 +431,9 @@ static int __init omap3xxx_prm_late_init(void)
427 431
428 return ret; 432 return ret;
429} 433}
430omap_subsys_initcall(omap3xxx_prm_late_init);
431 434
432static void __exit omap3xxx_prm_exit(void) 435static void __exit omap3xxx_prm_exit(void)
433{ 436{
434 if (!cpu_is_omap34xx()) 437 prm_unregister(&omap3xxx_prm_ll_data);
435 return;
436
437 /* Should never happen */
438 WARN(prm_unregister(&omap3xxx_prm_ll_data),
439 "%s: prm_ll_data function pointer mismatch\n", __func__);
440} 438}
441__exitcall(omap3xxx_prm_exit); 439__exitcall(omap3xxx_prm_exit);
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index 94a43b3cf0f0..a7f6ea27180a 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -47,6 +47,7 @@ static struct omap_prcm_irq_setup omap4_prcm_irq_setup = {
47 .ocp_barrier = &omap44xx_prm_ocp_barrier, 47 .ocp_barrier = &omap44xx_prm_ocp_barrier,
48 .save_and_clear_irqen = &omap44xx_prm_save_and_clear_irqen, 48 .save_and_clear_irqen = &omap44xx_prm_save_and_clear_irqen,
49 .restore_irqen = &omap44xx_prm_restore_irqen, 49 .restore_irqen = &omap44xx_prm_restore_irqen,
50 .reconfigure_io_chain = &omap44xx_prm_reconfigure_io_chain,
50}; 51};
51 52
52/* 53/*
@@ -649,6 +650,8 @@ struct pwrdm_ops omap4_pwrdm_operations = {
649 .pwrdm_has_voltdm = omap4_check_vcvp, 650 .pwrdm_has_voltdm = omap4_check_vcvp,
650}; 651};
651 652
653static int omap44xx_prm_late_init(void);
654
652/* 655/*
653 * XXX document 656 * XXX document
654 */ 657 */
@@ -656,34 +659,29 @@ static struct prm_ll_data omap44xx_prm_ll_data = {
656 .read_reset_sources = &omap44xx_prm_read_reset_sources, 659 .read_reset_sources = &omap44xx_prm_read_reset_sources,
657 .was_any_context_lost_old = &omap44xx_prm_was_any_context_lost_old, 660 .was_any_context_lost_old = &omap44xx_prm_was_any_context_lost_old,
658 .clear_context_loss_flags_old = &omap44xx_prm_clear_context_loss_flags_old, 661 .clear_context_loss_flags_old = &omap44xx_prm_clear_context_loss_flags_old,
662 .late_init = &omap44xx_prm_late_init,
659}; 663};
660 664
661int __init omap44xx_prm_init(void) 665int __init omap44xx_prm_init(void)
662{ 666{
663 if (!cpu_is_omap44xx() && !soc_is_omap54xx() && !soc_is_dra7xx()) 667 if (cpu_is_omap44xx())
664 return 0; 668 prm_features |= PRM_HAS_IO_WAKEUP;
665 669
666 return prm_register(&omap44xx_prm_ll_data); 670 return prm_register(&omap44xx_prm_ll_data);
667} 671}
668 672
669static int __init omap44xx_prm_late_init(void) 673static int omap44xx_prm_late_init(void)
670{ 674{
671 if (!cpu_is_omap44xx()) 675 if (!(prm_features & PRM_HAS_IO_WAKEUP))
672 return 0; 676 return 0;
673 677
674 omap44xx_prm_enable_io_wakeup(); 678 omap44xx_prm_enable_io_wakeup();
675 679
676 return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup); 680 return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup);
677} 681}
678omap_subsys_initcall(omap44xx_prm_late_init);
679 682
680static void __exit omap44xx_prm_exit(void) 683static void __exit omap44xx_prm_exit(void)
681{ 684{
682 if (!cpu_is_omap44xx()) 685 prm_unregister(&omap44xx_prm_ll_data);
683 return;
684
685 /* Should never happen */
686 WARN(prm_unregister(&omap44xx_prm_ll_data),
687 "%s: prm_ll_data function pointer mismatch\n", __func__);
688} 686}
689__exitcall(omap44xx_prm_exit); 687__exitcall(omap44xx_prm_exit);
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index b4c4ab9c8044..25e8b8232115 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -62,6 +62,8 @@ static struct omap_prcm_irq_setup *prcm_irq_setup;
62/* prm_base: base virtual address of the PRM IP block */ 62/* prm_base: base virtual address of the PRM IP block */
63void __iomem *prm_base; 63void __iomem *prm_base;
64 64
65u16 prm_features;
66
65/* 67/*
66 * prm_ll_data: function pointers to SoC-specific implementations of 68 * prm_ll_data: function pointers to SoC-specific implementations of
67 * common PRM functions 69 * common PRM functions
@@ -330,12 +332,7 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup)
330 332
331 if (of_have_populated_dt()) { 333 if (of_have_populated_dt()) {
332 int irq = omap_prcm_event_to_irq("io"); 334 int irq = omap_prcm_event_to_irq("io");
333 if (cpu_is_omap34xx()) 335 omap_pcs_legacy_init(irq, irq_setup->reconfigure_io_chain);
334 omap_pcs_legacy_init(irq,
335 omap3xxx_prm_reconfigure_io_chain);
336 else
337 omap_pcs_legacy_init(irq,
338 omap44xx_prm_reconfigure_io_chain);
339 } 336 }
340 337
341 return 0; 338 return 0;
@@ -530,3 +527,11 @@ int __init of_prcm_init(void)
530 527
531 return 0; 528 return 0;
532} 529}
530
531static int __init prm_late_init(void)
532{
533 if (prm_ll_data->late_init)
534 return prm_ll_data->late_init();
535 return 0;
536}
537subsys_initcall(prm_late_init);