diff options
author | R Sricharan <r.sricharan@ti.com> | 2012-05-08 01:55:22 -0400 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2012-05-08 01:55:22 -0400 |
commit | 610eb8c218ef214594295776275855640d37ab2a (patch) | |
tree | 861e9a1c103cd40e1cd5321be5c7e4dc033eac2c /arch/arm/mach-omap2/prminst44xx.c | |
parent | 444b3df6b387e6dd55cd9dbc8924e111792d2c42 (diff) |
ARM: OMAP4+: Add prm and cm base init function.
Instead of statically defining seperate arrays for every OMAP4+ archs,
have a generic init function to populate the arrays. This avoids the
need for creating new array for every arch added in the future that
reuses the prm and cm registers read/write code.
Cc: Paul Walmsley <paul@pwsan.com>
Signed-off-by: R Sricharan <r.sricharan@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/mach-omap2/prminst44xx.c')
-rw-r--r-- | arch/arm/mach-omap2/prminst44xx.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/arch/arm/mach-omap2/prminst44xx.c b/arch/arm/mach-omap2/prminst44xx.c index 9b3898a3ac9b..c12320c0ae95 100644 --- a/arch/arm/mach-omap2/prminst44xx.c +++ b/arch/arm/mach-omap2/prminst44xx.c | |||
@@ -18,20 +18,26 @@ | |||
18 | 18 | ||
19 | #include "iomap.h" | 19 | #include "iomap.h" |
20 | #include "common.h" | 20 | #include "common.h" |
21 | #include "prcm-common.h" | ||
21 | #include "prm44xx.h" | 22 | #include "prm44xx.h" |
22 | #include "prminst44xx.h" | 23 | #include "prminst44xx.h" |
23 | #include "prm-regbits-44xx.h" | 24 | #include "prm-regbits-44xx.h" |
24 | #include "prcm44xx.h" | 25 | #include "prcm44xx.h" |
25 | #include "prcm_mpu44xx.h" | 26 | #include "prcm_mpu44xx.h" |
26 | 27 | ||
27 | static u32 _prm_bases[OMAP4_MAX_PRCM_PARTITIONS] = { | 28 | static void __iomem *_prm_bases[OMAP4_MAX_PRCM_PARTITIONS]; |
28 | [OMAP4430_INVALID_PRCM_PARTITION] = 0, | 29 | |
29 | [OMAP4430_PRM_PARTITION] = OMAP4430_PRM_BASE, | 30 | /** |
30 | [OMAP4430_CM1_PARTITION] = 0, | 31 | * omap_prm_base_init - Populates the prm partitions |
31 | [OMAP4430_CM2_PARTITION] = 0, | 32 | * |
32 | [OMAP4430_SCRM_PARTITION] = 0, | 33 | * Populates the base addresses of the _prm_bases |
33 | [OMAP4430_PRCM_MPU_PARTITION] = OMAP4430_PRCM_MPU_BASE, | 34 | * array used for read/write of prm module registers. |
34 | }; | 35 | */ |
36 | void omap_prm_base_init(void) | ||
37 | { | ||
38 | _prm_bases[OMAP4430_PRM_PARTITION] = prm_base; | ||
39 | _prm_bases[OMAP4430_PRCM_MPU_PARTITION] = prcm_mpu_base; | ||
40 | } | ||
35 | 41 | ||
36 | /* Read a register in a PRM instance */ | 42 | /* Read a register in a PRM instance */ |
37 | u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx) | 43 | u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx) |
@@ -39,8 +45,7 @@ u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx) | |||
39 | BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS || | 45 | BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS || |
40 | part == OMAP4430_INVALID_PRCM_PARTITION || | 46 | part == OMAP4430_INVALID_PRCM_PARTITION || |
41 | !_prm_bases[part]); | 47 | !_prm_bases[part]); |
42 | return __raw_readl(OMAP2_L4_IO_ADDRESS(_prm_bases[part] + inst + | 48 | return __raw_readl(_prm_bases[part] + inst + idx); |
43 | idx)); | ||
44 | } | 49 | } |
45 | 50 | ||
46 | /* Write into a register in a PRM instance */ | 51 | /* Write into a register in a PRM instance */ |
@@ -49,7 +54,7 @@ void omap4_prminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx) | |||
49 | BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS || | 54 | BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS || |
50 | part == OMAP4430_INVALID_PRCM_PARTITION || | 55 | part == OMAP4430_INVALID_PRCM_PARTITION || |
51 | !_prm_bases[part]); | 56 | !_prm_bases[part]); |
52 | __raw_writel(val, OMAP2_L4_IO_ADDRESS(_prm_bases[part] + inst + idx)); | 57 | __raw_writel(val, _prm_bases[part] + inst + idx); |
53 | } | 58 | } |
54 | 59 | ||
55 | /* Read-modify-write a register in PRM. Caller must lock */ | 60 | /* Read-modify-write a register in PRM. Caller must lock */ |