* [PATCH-V3 0/3] ARM: OMAP4: Remove hardcoded reg-offs for PWRSTCTRL & PWRSTST
@ 2012-02-03 11:43 Vaibhav Hiremath
2012-02-03 11:43 ` [PATCH-V3 1/3] " Vaibhav Hiremath
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Vaibhav Hiremath @ 2012-02-03 11:43 UTC (permalink / raw)
To: linux-omap
Cc: khilman, rnayak, tony, paul, b-cousson, linux-arm-kernel,
Vaibhav Hiremath
This patch series removes the existing hard-coded way of providing
offset to omap4_prminst_xxx API's and instead use offsets
provided in powerdomainsxxxx_data.
Also, hook up AM33XX device support to existing omap4 PRM code.
Background:
==========
PRM module in AM33XX is closer to OMAP4 PRM module, so it complete
sense to reuse all the code from existing OMAP4 implementation.
Having said that, there is a catch here with respect to AM33XX device,
The register offset in PRM module is not consistent
across (crazy IP integration), for example,
PRM_XXX PWRSTCTRL PWRSTST RSTCTRL RSTST
===============================================
PRM_PER_MOD: 0x0C, 0x08, 0x00, 0x04
PRM_WKUP_MOD: 0x04, 0x08, 0x00, 0x0C
PRM_MPU_MOD: 0x00, 0x04, 0x08, NA
PRM_DEVICE_MOD: NA, NA, 0x00, 0x08
So in order to reuse the existing OMAP4 code, we have to add
seperate entry for register offsets, especially
PWRSTCTRL & PWRSTST.
NOTE: Boot tested on AM335x EVM and AM37xEVM
Changes from V2:
- As per Kevin's comment, created separate prm_base table
for am33xx and added __init function for prminst to
initialize prm_base table during boot time.
- Minor comment from Kevin, to add extra line in patch 1/3
Changes from V1:
- As per Kevin's comment, patch is split into logical
commits for ease of review.
- Added specific comment for cpu_is_xxx check order
change.
Vaibhav Hiremath (3):
ARM: OMAP4: Remove hardcoded reg-offs for PWRSTCTRL & PWRSTST
ARM: OMAP4: prminst: Add boot time __init function for prminst
ARM: OMAP: am33xx: Hook-up am33xx support to existing prm code
arch/arm/mach-omap2/io.c | 3 ++
arch/arm/mach-omap2/omap_hwmod.c | 44 +++++++++++++++++++--------
arch/arm/mach-omap2/powerdomain.h | 4 ++
arch/arm/mach-omap2/powerdomain44xx.c | 24 +++++++-------
arch/arm/mach-omap2/powerdomains44xx_data.c | 9 +++++
arch/arm/mach-omap2/prcm44xx.h | 2 +
arch/arm/mach-omap2/prminst44xx.c | 35 ++++++++++++++++-----
arch/arm/mach-omap2/prminst44xx.h | 2 +-
8 files changed, 89 insertions(+), 34 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH-V3 1/3] ARM: OMAP4: Remove hardcoded reg-offs for PWRSTCTRL & PWRSTST
2012-02-03 11:43 [PATCH-V3 0/3] ARM: OMAP4: Remove hardcoded reg-offs for PWRSTCTRL & PWRSTST Vaibhav Hiremath
@ 2012-02-03 11:43 ` Vaibhav Hiremath
2012-02-03 11:43 ` [PATCH-V3 2/3] ARM: OMAP4: prminst: Add boot time __init function for prminst Vaibhav Hiremath
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Vaibhav Hiremath @ 2012-02-03 11:43 UTC (permalink / raw)
To: linux-omap
Cc: khilman, rnayak, tony, paul, b-cousson, linux-arm-kernel,
Vaibhav Hiremath
This patch removes the existing hard-coded way of providing
offset to omap4_prminst_xxx API's and instead use offsets
provided in powerdomainsxxxx_data.
Very much required for the new device AM33XX, where,
PRM module in AM33XX is closer to OMAP4 PRM module, so it makes
complete sense to reuse all the code from existing OMAP4 implementation.
Having said that, there is a catch here with respect to AM33XX device,
The register offset in PRM module is not consistent
across (crazy IP integration), for example,
PRM_XXX PWRSTCTRL PWRSTST RSTCTRL RSTST
===============================================
PRM_PER_MOD: 0x0C, 0x08, 0x00, 0x04
PRM_WKUP_MOD: 0x04, 0x08, 0x00, 0x0C
PRM_MPU_MOD: 0x00, 0x04, 0x08, NA
PRM_DEVICE_MOD: NA, NA, 0x00, 0x08
So in order to reuse the existing OMAP4 code, we have to add
seperate entry for register offsets, especially
PWRSTCTRL & PWRSTST.
Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
Merge to "Remove-hardcoded-reg-offs-for-PWRSTCT"
---
arch/arm/mach-omap2/powerdomain.h | 4 ++++
arch/arm/mach-omap2/powerdomain44xx.c | 24 ++++++++++++------------
arch/arm/mach-omap2/powerdomains44xx_data.c | 9 +++++++++
3 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h
index 0d72a8a..9ebb872 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -92,6 +92,8 @@ struct powerdomain;
* @pwrdm_clkdms: Clockdomains in this powerdomain
* @node: list_head linking all powerdomains
* @voltdm_node: list_head linking all powerdomains in a voltagedomain
+ * @pwrstctrl_offs: XXX_PWRSTCTRL reg offset from prcm_offs
+ * @pwrstst_offs: XXX_PWRSTST reg offset from prcm_offs
* @state:
* @state_counter:
* @timer:
@@ -121,6 +123,8 @@ struct powerdomain {
unsigned ret_logic_off_counter;
unsigned ret_mem_off_counter[PWRDM_MAX_MEM_BANKS];
+ u8 pwrstctrl_offs;
+ u8 pwrstst_offs;
#ifdef CONFIG_PM_DEBUG
s64 timer;
s64 state_timer[PWRDM_MAX_PWRSTS];
diff --git a/arch/arm/mach-omap2/powerdomain44xx.c b/arch/arm/mach-omap2/powerdomain44xx.c
index a7880af..b088540 100644
--- a/arch/arm/mach-omap2/powerdomain44xx.c
+++ b/arch/arm/mach-omap2/powerdomain44xx.c
@@ -28,7 +28,7 @@ static int omap4_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
omap4_prminst_rmw_inst_reg_bits(OMAP_POWERSTATE_MASK,
(pwrst << OMAP_POWERSTATE_SHIFT),
pwrdm->prcm_partition,
- pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL);
+ pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
return 0;
}
@@ -37,7 +37,7 @@ static int omap4_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
u32 v;
v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
- OMAP4_PM_PWSTCTRL);
+ pwrdm->pwrstctrl_offs);
v &= OMAP_POWERSTATE_MASK;
v >>= OMAP_POWERSTATE_SHIFT;
@@ -49,7 +49,7 @@ static int omap4_pwrdm_read_pwrst(struct powerdomain *pwrdm)
u32 v;
v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
- OMAP4_PM_PWSTST);
+ pwrdm->pwrstst_offs);
v &= OMAP_POWERSTATEST_MASK;
v >>= OMAP_POWERSTATEST_SHIFT;
@@ -61,7 +61,7 @@ static int omap4_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
u32 v;
v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
- OMAP4_PM_PWSTST);
+ pwrdm->pwrstst_offs);
v &= OMAP4430_LASTPOWERSTATEENTERED_MASK;
v >>= OMAP4430_LASTPOWERSTATEENTERED_SHIFT;
@@ -73,7 +73,7 @@ static int omap4_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm)
omap4_prminst_rmw_inst_reg_bits(OMAP4430_LOWPOWERSTATECHANGE_MASK,
(1 << OMAP4430_LOWPOWERSTATECHANGE_SHIFT),
pwrdm->prcm_partition,
- pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL);
+ pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
return 0;
}
@@ -82,7 +82,7 @@ static int omap4_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
omap4_prminst_rmw_inst_reg_bits(OMAP4430_LASTPOWERSTATEENTERED_MASK,
OMAP4430_LASTPOWERSTATEENTERED_MASK,
pwrdm->prcm_partition,
- pwrdm->prcm_offs, OMAP4_PM_PWSTST);
+ pwrdm->prcm_offs, pwrdm->pwrstst_offs);
return 0;
}
@@ -93,7 +93,7 @@ static int omap4_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
v = pwrst << __ffs(OMAP4430_LOGICRETSTATE_MASK);
omap4_prminst_rmw_inst_reg_bits(OMAP4430_LOGICRETSTATE_MASK, v,
pwrdm->prcm_partition, pwrdm->prcm_offs,
- OMAP4_PM_PWSTCTRL);
+ pwrdm->pwrstctrl_offs);
return 0;
}
@@ -107,7 +107,7 @@ static int omap4_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
omap4_prminst_rmw_inst_reg_bits(m, (pwrst << __ffs(m)),
pwrdm->prcm_partition, pwrdm->prcm_offs,
- OMAP4_PM_PWSTCTRL);
+ pwrdm->pwrstctrl_offs);
return 0;
}
@@ -131,7 +131,7 @@ static int omap4_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
u32 v;
v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
- OMAP4_PM_PWSTST);
+ pwrdm->pwrstst_offs);
v &= OMAP4430_LOGICSTATEST_MASK;
v >>= OMAP4430_LOGICSTATEST_SHIFT;
@@ -157,7 +157,7 @@ static int omap4_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
m = omap2_pwrdm_get_mem_bank_stst_mask(bank);
v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
- OMAP4_PM_PWSTST);
+ pwrdm->pwrstst_offs);
v &= m;
v >>= __ffs(m);
@@ -171,7 +171,7 @@ static int omap4_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
- OMAP4_PM_PWSTCTRL);
+ pwrdm->pwrstctrl_offs);
v &= m;
v >>= __ffs(m);
@@ -191,7 +191,7 @@ static int omap4_pwrdm_wait_transition(struct powerdomain *pwrdm)
/* XXX Is this udelay() value meaningful? */
while ((omap4_prminst_read_inst_reg(pwrdm->prcm_partition,
pwrdm->prcm_offs,
- OMAP4_PM_PWSTST) &
+ pwrdm->pwrstst_offs) &
OMAP_INTRANSITION_MASK) &&
(c++ < PWRDM_TRANSITION_BAILOUT))
udelay(1);
diff --git a/arch/arm/mach-omap2/powerdomains44xx_data.c b/arch/arm/mach-omap2/powerdomains44xx_data.c
index 704664c..7cf8dcd 100644
--- a/arch/arm/mach-omap2/powerdomains44xx_data.c
+++ b/arch/arm/mach-omap2/powerdomains44xx_data.c
@@ -352,7 +352,16 @@ static struct powerdomain *powerdomains_omap44xx[] __initdata = {
void __init omap44xx_powerdomains_init(void)
{
+ int i;
+
pwrdm_register_platform_funcs(&omap4_pwrdm_operations);
+ /* Initialise PRM reg offs to default value */
+ for (i = 0; powerdomains_omap44xx[i] != NULL; i++) {
+ struct powerdomain *pwrdm = powerdomains_omap44xx[i];
+
+ pwrdm->pwrstctrl_offs = OMAP4_PM_PWSTCTRL;
+ pwrdm->pwrstst_offs = OMAP4_PM_PWSTST;
+ }
pwrdm_register_pwrdms(powerdomains_omap44xx);
pwrdm_complete_init();
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH-V3 2/3] ARM: OMAP4: prminst: Add boot time __init function for prminst
2012-02-03 11:43 [PATCH-V3 0/3] ARM: OMAP4: Remove hardcoded reg-offs for PWRSTCTRL & PWRSTST Vaibhav Hiremath
2012-02-03 11:43 ` [PATCH-V3 1/3] " Vaibhav Hiremath
@ 2012-02-03 11:43 ` Vaibhav Hiremath
2012-03-02 10:52 ` Paul Walmsley
2012-02-03 11:43 ` [PATCH-V3 3/3] ARM: OMAP: am33xx: Hook-up am33xx support to existing prm code Vaibhav Hiremath
2012-02-07 10:56 ` [PATCH-V3 0/3] ARM: OMAP4: Remove hardcoded reg-offs for PWRSTCTRL & PWRSTST Hiremath, Vaibhav
3 siblings, 1 reply; 6+ messages in thread
From: Vaibhav Hiremath @ 2012-02-03 11:43 UTC (permalink / raw)
To: linux-omap
Cc: khilman, rnayak, tony, paul, b-cousson, linux-arm-kernel,
Vaibhav Hiremath
AM33xx PRM module is closer to OMAP4 PRM module, and
in order to reuse prminst api's we have to address
some of the differences like, base addresses and partitions.
Unlike OMAP4 PRM, AM33xx doesn't have any partitions and
maintains single partition.
So, in order to reuse the existing OMAP4 prminst code
for AM33xx this patch adds,
- Boot time __init function, to initialize _prm_bases
based on cpu_is_xxx
- Instead of maintaining phy addr for PRM partition
in _prm_bases[] table and then changing it to virt addr,
directly maintain respective virt addr.
Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Rajendra Nayak <rnayak@ti.com>
CC: Tony Lindgren <tony@atomide.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
---
arch/arm/mach-omap2/io.c | 2 ++
arch/arm/mach-omap2/prminst44xx.c | 26 ++++++++++++++++++--------
arch/arm/mach-omap2/prminst44xx.h | 2 +-
3 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 2daaec1..aa33cfb 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -39,6 +39,7 @@
#include <plat/omap-pm.h>
#include "voltage.h"
#include "powerdomain.h"
+#include "prminst44xx.h"
#include "clockdomain.h"
#include <plat/omap_hwmod.h>
@@ -486,6 +487,7 @@ void __init omap4430_init_early(void)
omap4xxx_check_features();
omap_common_init_early();
omap44xx_voltagedomains_init();
+ omap44xx_prminst_init();
omap44xx_powerdomains_init();
omap44xx_clockdomains_init();
omap44xx_hwmod_init();
diff --git a/arch/arm/mach-omap2/prminst44xx.c b/arch/arm/mach-omap2/prminst44xx.c
index f6de5bc..68e13bd 100644
--- a/arch/arm/mach-omap2/prminst44xx.c
+++ b/arch/arm/mach-omap2/prminst44xx.c
@@ -24,32 +24,34 @@
#include "prcm44xx.h"
#include "prcm_mpu44xx.h"
-static u32 _prm_bases[OMAP4_MAX_PRCM_PARTITIONS] = {
+static u32 **_prm_bases;
+static u32 max_prm_partitions;
+
+static u32 *omap44xx_prm_bases[] = {
[OMAP4430_INVALID_PRCM_PARTITION] = 0,
- [OMAP4430_PRM_PARTITION] = OMAP4430_PRM_BASE,
+ [OMAP4430_PRM_PARTITION] = OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE),
[OMAP4430_CM1_PARTITION] = 0,
[OMAP4430_CM2_PARTITION] = 0,
[OMAP4430_SCRM_PARTITION] = 0,
- [OMAP4430_PRCM_MPU_PARTITION] = OMAP4430_PRCM_MPU_BASE,
+ [OMAP4430_PRCM_MPU_PARTITION] = OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE),
};
/* Read a register in a PRM instance */
u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx)
{
- BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
+ BUG_ON(part >= max_prm_partitions ||
part == OMAP4430_INVALID_PRCM_PARTITION ||
!_prm_bases[part]);
- return __raw_readl(OMAP2_L4_IO_ADDRESS(_prm_bases[part] + inst +
- idx));
+ return __raw_readl(_prm_bases[part] + ((inst + idx)/sizeof(u32)));
}
/* Write into a register in a PRM instance */
void omap4_prminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx)
{
- BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
+ BUG_ON(part >= max_prm_partitions ||
part == OMAP4430_INVALID_PRCM_PARTITION ||
!_prm_bases[part]);
- __raw_writel(val, OMAP2_L4_IO_ADDRESS(_prm_bases[part] + inst + idx));
+ __raw_writel(val, _prm_bases[part] + ((inst + idx)/sizeof(u32)));
}
/* Read-modify-write a register in PRM. Caller must lock */
@@ -174,3 +176,11 @@ void omap4_prminst_global_warm_sw_reset(void)
OMAP4430_PRM_DEVICE_INST,
OMAP4_PRM_RSTCTRL_OFFSET);
}
+
+void __init omap44xx_prminst_init(void)
+{
+ if (cpu_is_omap44xx()) {
+ _prm_bases = omap44xx_prm_bases;
+ max_prm_partitions = ARRAY_SIZE(omap44xx_prm_bases);
+ }
+}
diff --git a/arch/arm/mach-omap2/prminst44xx.h b/arch/arm/mach-omap2/prminst44xx.h
index 46f2efb..9a44c68 100644
--- a/arch/arm/mach-omap2/prminst44xx.h
+++ b/arch/arm/mach-omap2/prminst44xx.h
@@ -29,5 +29,5 @@ extern int omap4_prminst_assert_hardreset(u8 shift, u8 part, s16 inst,
u16 rstctrl_offs);
extern int omap4_prminst_deassert_hardreset(u8 shift, u8 part, s16 inst,
u16 rstctrl_offs);
-
+extern void __init omap44xx_prminst_init(void);
#endif
--
1.7.0.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH-V3 3/3] ARM: OMAP: am33xx: Hook-up am33xx support to existing prm code
2012-02-03 11:43 [PATCH-V3 0/3] ARM: OMAP4: Remove hardcoded reg-offs for PWRSTCTRL & PWRSTST Vaibhav Hiremath
2012-02-03 11:43 ` [PATCH-V3 1/3] " Vaibhav Hiremath
2012-02-03 11:43 ` [PATCH-V3 2/3] ARM: OMAP4: prminst: Add boot time __init function for prminst Vaibhav Hiremath
@ 2012-02-03 11:43 ` Vaibhav Hiremath
2012-02-07 10:56 ` [PATCH-V3 0/3] ARM: OMAP4: Remove hardcoded reg-offs for PWRSTCTRL & PWRSTST Hiremath, Vaibhav
3 siblings, 0 replies; 6+ messages in thread
From: Vaibhav Hiremath @ 2012-02-03 11:43 UTC (permalink / raw)
To: linux-omap
Cc: khilman, rnayak, tony, paul, b-cousson, linux-arm-kernel,
Vaibhav Hiremath
Reuse existing omap4 prminst code for am33xx device,
add separate prm base table for am33xx device and initialize
it during __init for future use.
Also, since cpu_is_omap34xx() check is true for am33xx family of
devices, we must change the order of cpu_is_xxxx check, so first
check for cpu_is_am33xx() to follow right execution path.
Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Rajendra Nayak <rnayak@ti.com>
CC: Tony Lindgren <tony@atomide.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
---
arch/arm/mach-omap2/io.c | 1 +
arch/arm/mach-omap2/omap_hwmod.c | 44 ++++++++++++++++++++++++++-----------
arch/arm/mach-omap2/prcm44xx.h | 2 +
arch/arm/mach-omap2/prminst44xx.c | 9 +++++++
4 files changed, 43 insertions(+), 13 deletions(-)
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index aa33cfb..df94693 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -475,6 +475,7 @@ void __init am33xx_init_early(void)
{
omap2_set_globals_am33xx();
omap_common_init_early();
+ omap44xx_prminst_init();
omap3xxx_clk_init();
}
#endif
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index e91c4a0..0fb5287 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1289,14 +1289,20 @@ static int _assert_hardreset(struct omap_hwmod *oh, const char *name)
if (IS_ERR_VALUE(ret))
return ret;
- if (cpu_is_omap24xx() || cpu_is_omap34xx())
- return omap2_prm_assert_hardreset(oh->prcm.omap2.module_offs,
- ohri.rst_shift);
- else if (cpu_is_omap44xx())
+ /*
+ * In order to use omap4 prm code for am33xx family of devices,
+ * first check cpu_is_am33xx here.
+ *
+ * Note: cpu_is_omap34xx is true for am33xx device as well.
+ */
+ if (cpu_is_omap44xx() || cpu_is_am33xx())
return omap4_prminst_assert_hardreset(ohri.rst_shift,
oh->clkdm->pwrdm.ptr->prcm_partition,
oh->clkdm->pwrdm.ptr->prcm_offs,
oh->prcm.omap4.rstctrl_offs);
+ else if (cpu_is_omap24xx() || cpu_is_omap34xx())
+ return omap2_prm_assert_hardreset(oh->prcm.omap2.module_offs,
+ ohri.rst_shift);
else
return -EINVAL;
}
@@ -1323,11 +1329,13 @@ static int _deassert_hardreset(struct omap_hwmod *oh, const char *name)
if (IS_ERR_VALUE(ret))
return ret;
- if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
- ret = omap2_prm_deassert_hardreset(oh->prcm.omap2.module_offs,
- ohri.rst_shift,
- ohri.st_shift);
- } else if (cpu_is_omap44xx()) {
+ /*
+ * In order to use omap4 prm code for am33xx family of devices,
+ * first check cpu_is_am33xx here.
+ *
+ * Note: cpu_is_omap34xx is true for am33xx device as well.
+ */
+ if (cpu_is_omap44xx() || cpu_is_am33xx()) {
if (ohri.st_shift)
pr_err("omap_hwmod: %s: %s: hwmod data error: OMAP4 does not support st_shift\n",
oh->name, name);
@@ -1335,6 +1343,10 @@ static int _deassert_hardreset(struct omap_hwmod *oh, const char *name)
oh->clkdm->pwrdm.ptr->prcm_partition,
oh->clkdm->pwrdm.ptr->prcm_offs,
oh->prcm.omap4.rstctrl_offs);
+ } else if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
+ ret = omap2_prm_deassert_hardreset(oh->prcm.omap2.module_offs,
+ ohri.rst_shift,
+ ohri.st_shift);
} else {
return -EINVAL;
}
@@ -1365,14 +1377,20 @@ static int _read_hardreset(struct omap_hwmod *oh, const char *name)
if (IS_ERR_VALUE(ret))
return ret;
- if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
- return omap2_prm_is_hardreset_asserted(oh->prcm.omap2.module_offs,
- ohri.st_shift);
- } else if (cpu_is_omap44xx()) {
+ /*
+ * In order to use omap4 prm code for am33xx family of devices,
+ * first check cpu_is_am33xx here.
+ *
+ * Note: cpu_is_omap34xx is true for am33xx device as well.
+ */
+ if (cpu_is_omap44xx() || cpu_is_am33xx()) {
return omap4_prminst_is_hardreset_asserted(ohri.rst_shift,
oh->clkdm->pwrdm.ptr->prcm_partition,
oh->clkdm->pwrdm.ptr->prcm_offs,
oh->prcm.omap4.rstctrl_offs);
+ } else if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
+ return omap2_prm_is_hardreset_asserted(oh->prcm.omap2.module_offs,
+ ohri.st_shift);
} else {
return -EINVAL;
}
diff --git a/arch/arm/mach-omap2/prcm44xx.h b/arch/arm/mach-omap2/prcm44xx.h
index 7334ffb..02e5a8b 100644
--- a/arch/arm/mach-omap2/prcm44xx.h
+++ b/arch/arm/mach-omap2/prcm44xx.h
@@ -31,6 +31,8 @@
#define OMAP4430_CM2_PARTITION 3
#define OMAP4430_SCRM_PARTITION 4
#define OMAP4430_PRCM_MPU_PARTITION 5
+/* AM33XX PRCM is closer to OMAP4, so try to reuse all API's */
+#define AM33XX_PRM_PARTITION 1
/*
* OMAP4_MAX_PRCM_PARTITIONS: set to the highest value of the PRCM partition
diff --git a/arch/arm/mach-omap2/prminst44xx.c b/arch/arm/mach-omap2/prminst44xx.c
index 68e13bd..5fd13b4 100644
--- a/arch/arm/mach-omap2/prminst44xx.c
+++ b/arch/arm/mach-omap2/prminst44xx.c
@@ -19,6 +19,7 @@
#include "common.h"
#include "prm44xx.h"
+#include "prm33xx.h"
#include "prminst44xx.h"
#include "prm-regbits-44xx.h"
#include "prcm44xx.h"
@@ -36,6 +37,11 @@ static u32 *omap44xx_prm_bases[] = {
[OMAP4430_PRCM_MPU_PARTITION] = OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE),
};
+static u32 *am33xx_prm_bases[] = {
+ [OMAP4430_INVALID_PRCM_PARTITION] = 0,
+ [AM33XX_PRM_PARTITION] = AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRM_BASE),
+};
+
/* Read a register in a PRM instance */
u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx)
{
@@ -182,5 +188,8 @@ void __init omap44xx_prminst_init(void)
if (cpu_is_omap44xx()) {
_prm_bases = omap44xx_prm_bases;
max_prm_partitions = ARRAY_SIZE(omap44xx_prm_bases);
+ } else if (cpu_is_am33xx()) {
+ _prm_bases = am33xx_prm_bases;
+ max_prm_partitions = ARRAY_SIZE(am33xx_prm_bases);
}
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: [PATCH-V3 0/3] ARM: OMAP4: Remove hardcoded reg-offs for PWRSTCTRL & PWRSTST
2012-02-03 11:43 [PATCH-V3 0/3] ARM: OMAP4: Remove hardcoded reg-offs for PWRSTCTRL & PWRSTST Vaibhav Hiremath
` (2 preceding siblings ...)
2012-02-03 11:43 ` [PATCH-V3 3/3] ARM: OMAP: am33xx: Hook-up am33xx support to existing prm code Vaibhav Hiremath
@ 2012-02-07 10:56 ` Hiremath, Vaibhav
3 siblings, 0 replies; 6+ messages in thread
From: Hiremath, Vaibhav @ 2012-02-07 10:56 UTC (permalink / raw)
To: Hiremath, Vaibhav, linux-omap@vger.kernel.org
Cc: Hilman, Kevin, Nayak, Rajendra, tony@atomide.com, paul@pwsan.com,
Cousson, Benoit, linux-arm-kernel@lists.infradead.org
On Fri, Feb 03, 2012 at 17:13:53, Hiremath, Vaibhav wrote:
> This patch series removes the existing hard-coded way of providing
> offset to omap4_prminst_xxx API's and instead use offsets
> provided in powerdomainsxxxx_data.
> Also, hook up AM33XX device support to existing omap4 PRM code.
>
> Background:
> ==========
> PRM module in AM33XX is closer to OMAP4 PRM module, so it complete
> sense to reuse all the code from existing OMAP4 implementation.
> Having said that, there is a catch here with respect to AM33XX device,
>
> The register offset in PRM module is not consistent
> across (crazy IP integration), for example,
>
> PRM_XXX PWRSTCTRL PWRSTST RSTCTRL RSTST
> ===============================================
> PRM_PER_MOD: 0x0C, 0x08, 0x00, 0x04
> PRM_WKUP_MOD: 0x04, 0x08, 0x00, 0x0C
> PRM_MPU_MOD: 0x00, 0x04, 0x08, NA
> PRM_DEVICE_MOD: NA, NA, 0x00, 0x08
>
> So in order to reuse the existing OMAP4 code, we have to add
> seperate entry for register offsets, especially
> PWRSTCTRL & PWRSTST.
>
> NOTE: Boot tested on AM335x EVM and AM37xEVM
>
> Changes from V2:
> - As per Kevin's comment, created separate prm_base table
> for am33xx and added __init function for prminst to
> initialize prm_base table during boot time.
> - Minor comment from Kevin, to add extra line in patch 1/3
> Changes from V1:
> - As per Kevin's comment, patch is split into logical
> commits for ease of review.
> - Added specific comment for cpu_is_xxx check order
> change.
>
>
> Vaibhav Hiremath (3):
> ARM: OMAP4: Remove hardcoded reg-offs for PWRSTCTRL & PWRSTST
> ARM: OMAP4: prminst: Add boot time __init function for prminst
> ARM: OMAP: am33xx: Hook-up am33xx support to existing prm code
>
Kevin,
Any comments on this patch-series?
Thanks,
Vaibhav
> arch/arm/mach-omap2/io.c | 3 ++
> arch/arm/mach-omap2/omap_hwmod.c | 44 +++++++++++++++++++--------
> arch/arm/mach-omap2/powerdomain.h | 4 ++
> arch/arm/mach-omap2/powerdomain44xx.c | 24 +++++++-------
> arch/arm/mach-omap2/powerdomains44xx_data.c | 9 +++++
> arch/arm/mach-omap2/prcm44xx.h | 2 +
> arch/arm/mach-omap2/prminst44xx.c | 35 ++++++++++++++++-----
> arch/arm/mach-omap2/prminst44xx.h | 2 +-
> 8 files changed, 89 insertions(+), 34 deletions(-)
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH-V3 2/3] ARM: OMAP4: prminst: Add boot time __init function for prminst
2012-02-03 11:43 ` [PATCH-V3 2/3] ARM: OMAP4: prminst: Add boot time __init function for prminst Vaibhav Hiremath
@ 2012-03-02 10:52 ` Paul Walmsley
0 siblings, 0 replies; 6+ messages in thread
From: Paul Walmsley @ 2012-03-02 10:52 UTC (permalink / raw)
To: Vaibhav Hiremath
Cc: linux-omap, khilman, rnayak, tony, b-cousson, linux-arm-kernel
Hi
On Fri, 3 Feb 2012, Vaibhav Hiremath wrote:
> AM33xx PRM module is closer to OMAP4 PRM module, and
> in order to reuse prminst api's we have to address
> some of the differences like, base addresses and partitions.
> Unlike OMAP4 PRM, AM33xx doesn't have any partitions and
> maintains single partition.
>
> So, in order to reuse the existing OMAP4 prminst code
> for AM33xx this patch adds,
>
> - Boot time __init function, to initialize _prm_bases
> based on cpu_is_xxx
> - Instead of maintaining phy addr for PRM partition
> in _prm_bases[] table and then changing it to virt addr,
> directly maintain respective virt addr.
So as was mentioned in another thread, the prminst code is really for
cases where there are PRM registers split across multiple IP blocks. So
far this doesn't appear to the case with AM33xx. A better approach is
probably to create a prm33xx.c, as was done in the branch that was
mentioned in my last message.
Another problem with this patch is that it causes a large number of
warnings from sparse -- the type casts aren't right or are missing. Please
make sure that your patches don't add any sparse warnings before posting.
You can do this with 'make C=2' assuming that you have sparse installed.
- Paul
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-03-02 10:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-03 11:43 [PATCH-V3 0/3] ARM: OMAP4: Remove hardcoded reg-offs for PWRSTCTRL & PWRSTST Vaibhav Hiremath
2012-02-03 11:43 ` [PATCH-V3 1/3] " Vaibhav Hiremath
2012-02-03 11:43 ` [PATCH-V3 2/3] ARM: OMAP4: prminst: Add boot time __init function for prminst Vaibhav Hiremath
2012-03-02 10:52 ` Paul Walmsley
2012-02-03 11:43 ` [PATCH-V3 3/3] ARM: OMAP: am33xx: Hook-up am33xx support to existing prm code Vaibhav Hiremath
2012-02-07 10:56 ` [PATCH-V3 0/3] ARM: OMAP4: Remove hardcoded reg-offs for PWRSTCTRL & PWRSTST Hiremath, Vaibhav
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).