* [RFC][PATCH 0/2] Fix prm/cm accessor api's usage on OMAP4
@ 2010-08-10 15:02 Rajendra Nayak
2010-08-10 15:02 ` [RFC][PATCH 1/2] OMAP4: PRCM: Add prcm_mpu_base to omap_globals Rajendra Nayak
0 siblings, 1 reply; 10+ messages in thread
From: Rajendra Nayak @ 2010-08-10 15:02 UTC (permalink / raw)
To: linux-omap; +Cc: khilman, paul, b-cousson, Rajendra Nayak
Hi,
This RFC patch series fixes the prm and cm accessor api usage which is
broken today on OMAP4.
OMAP's have always had PRCM split into PRM for power and reset
management and CM for clock management.
In OMAP4 the split (physically) is not very straight forward and
there are instances of clock management control registers in PRM
and vice versa.
However it still makes sense, even on OMAP4 to logically split
PRCM into PRM and CM for better understanding and to avoid adding
additonal complexity in higher level frameworks which rely on the
accessor api;s to do the low level register accesses.
Hence this patch series makes sure that any clock management code can
use the cm_read/write* accessor apis (without knowing the physical split)
and power and reset management code can use prm_read/write*
accessor api;s.
regards,
Rajendra
Rajendra Nayak (2):
OMAP4: PRCM: Add prcm_mpu_base to omap_globals
OMAP4: PRCM: Fix usage of prm/cm accessor api's for OMAP4
arch/arm/mach-omap2/cm.h | 4 +-
arch/arm/mach-omap2/prcm-common.h | 58 +++++++++++++++---------
arch/arm/mach-omap2/prcm.c | 73 ++++++++++++++++++++++++++++--
arch/arm/mach-omap2/prm.h | 4 +-
arch/arm/plat-omap/common.c | 1 +
arch/arm/plat-omap/include/plat/common.h | 1 +
6 files changed, 112 insertions(+), 29 deletions(-)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [RFC][PATCH 1/2] OMAP4: PRCM: Add prcm_mpu_base to omap_globals
2010-08-10 15:02 [RFC][PATCH 0/2] Fix prm/cm accessor api's usage on OMAP4 Rajendra Nayak
@ 2010-08-10 15:02 ` Rajendra Nayak
2010-08-10 15:02 ` [RFC][PATCH 2/2] OMAP4: PRCM: Fix usage of prm/cm accessor api's for OMAP4 Rajendra Nayak
0 siblings, 1 reply; 10+ messages in thread
From: Rajendra Nayak @ 2010-08-10 15:02 UTC (permalink / raw)
To: linux-omap; +Cc: khilman, paul, b-cousson, Rajendra Nayak
OMAP4 has a local PRCM (for individual CPU control) block.
Hence add a new prcm_mpu_base to handle this in the omap_globals
structure.
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
---
arch/arm/mach-omap2/prcm.c | 5 +++++
arch/arm/plat-omap/common.c | 1 +
arch/arm/plat-omap/include/plat/common.h | 1 +
3 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index c201374..4df30d0 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -35,6 +35,7 @@
#include "prm-regbits-24xx.h"
static void __iomem *prm_base;
+static void __iomem *prcm_mpu_base;
static void __iomem *cm_base;
static void __iomem *cm2_base;
@@ -282,6 +283,10 @@ void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals)
prm_base = ioremap(omap2_globals->prm, SZ_8K);
WARN_ON(!prm_base);
}
+ if (omap2_globals->prcm_mpu) {
+ prcm_mpu_base = ioremap(omap2_globals->prcm_mpu, SZ_8K);
+ WARN_ON(!prcm_mpu_base);
+ }
if (omap2_globals->cm) {
cm_base = ioremap(omap2_globals->cm, SZ_8K);
WARN_ON(!cm_base);
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 3008e71..8603a46 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -338,6 +338,7 @@ static struct omap_globals omap4_globals = {
.tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
.ctrl = OMAP443X_CTRL_BASE,
.prm = OMAP4430_PRM_BASE,
+ .prcm_mpu = OMAP4430_PRCM_MPU_BASE,
.cm = OMAP4430_CM_BASE,
.cm2 = OMAP4430_CM2_BASE,
.uart1_phys = OMAP4_UART1_BASE,
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
index 9776b41..47baf9d 100644
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/include/plat/common.h
@@ -48,6 +48,7 @@ struct omap_globals {
unsigned long sms; /* SDRAM Memory Scheduler */
unsigned long ctrl; /* System Control Module */
unsigned long prm; /* Power and Reset Management */
+ unsigned long prcm_mpu; /* Local MPU PRM */
unsigned long cm; /* Clock Management */
unsigned long cm2;
unsigned long uart1_phys;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [RFC][PATCH 2/2] OMAP4: PRCM: Fix usage of prm/cm accessor api's for OMAP4
2010-08-10 15:02 ` [RFC][PATCH 1/2] OMAP4: PRCM: Add prcm_mpu_base to omap_globals Rajendra Nayak
@ 2010-08-10 15:02 ` Rajendra Nayak
2010-08-24 21:39 ` Kevin Hilman
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Rajendra Nayak @ 2010-08-10 15:02 UTC (permalink / raw)
To: linux-omap; +Cc: khilman, paul, b-cousson, Rajendra Nayak
OMAP's have always had PRCM split into PRM for power and reset
management and CM for clock management.
In OMAP4 the split (physically) is not very straight forward and
there are instances of clock management control registers in PRM
and vice versa.
However it still makes sense, even on OMAP4 to logically split
PRCM into PRM and CM for better understanding and to avoid adding
additonal complexity in higher level frameworks which rely on the
accessor api;s to do the low level register accesses.
Hence this patch makes sure that any clock management code can
use the cm_read/write* accessor apis (without knowing the physical split)
and power and reset management code can use prm_read/write*
accessor api;s.
To do this the submodule offsets within PRM/CM1 and CM2 have additonal
info embedded in them specifying what base address to use while
trying to access registers in the given submodule.
The 16 bit signed submodule offset is defined for OMAP4 as
<Bit 15> | <Bit 14:13> | <Bit 12:0>
<Sign bit> | <base identifier> | <submodule offset from base>
For older OMAP's the base identifier is always set to 0.
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
---
arch/arm/mach-omap2/cm.h | 4 +-
arch/arm/mach-omap2/prcm-common.h | 58 ++++++++++++++++++++-----------
arch/arm/mach-omap2/prcm.c | 68 ++++++++++++++++++++++++++++++++++--
arch/arm/mach-omap2/prm.h | 4 +-
4 files changed, 105 insertions(+), 29 deletions(-)
diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h
index a02ca30..7b7ef09 100644
--- a/arch/arm/mach-omap2/cm.h
+++ b/arch/arm/mach-omap2/cm.h
@@ -23,9 +23,9 @@
#define OMAP34XX_CM_REGADDR(module, reg) \
OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg))
#define OMAP44XX_CM1_REGADDR(module, reg) \
- OMAP2_L4_IO_ADDRESS(OMAP4430_CM1_BASE + (module) + (reg))
+ OMAP2_L4_IO_ADDRESS(OMAP4430_CM1_BASE + ((module) & (MOD_MASK)) + (reg))
#define OMAP44XX_CM2_REGADDR(module, reg) \
- OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE + (module) + (reg))
+ OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE + ((module) & (MOD_MASK)) + (reg))
#include "cm44xx.h"
diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h
index 995b7ed..b93d33e 100644
--- a/arch/arm/mach-omap2/prcm-common.h
+++ b/arch/arm/mach-omap2/prcm-common.h
@@ -57,10 +57,26 @@
#define BITFIELD(l_bit, u_bit) \
(BITS(u_bit) & ~((BITS(l_bit)) >> 1))
-/* OMAP44XX specific module offsets */
+/*
+ * OMAP44XX specific module offsets
+ * The 16 bit submodule offset is defined for OMAP4 as
+ * <Bit 15> | <Bit 14:13> | <Bit 12:0>
+ * <Sign bit> | <base identifier> | <submodule offset from base>
+ */
-/* CM1 instances */
+#define DEFAULT_BASE 0x0
+#define PRM_BASE 0x1
+#define PRCM_MPU_BASE 0x2
+#define CM2_BASE 0x3
+#define BASE_ID_SHIFT 13
+#define MOD_MASK ((1 << BASE_ID_SHIFT)-1)
+
+#define PRM_BASE_ID (PRM_BASE << BASE_ID_SHIFT)
+#define PRCM_MPU_BASE_ID (PRCM_MPU_BASE << BASE_ID_SHIFT)
+#define CM2_BASE_ID (CM2_BASE << BASE_ID_SHIFT)
+
+/* CM1 instances */
#define OMAP4430_CM1_OCP_SOCKET_MOD 0x0000
#define OMAP4430_CM1_CKGEN_MOD 0x0100
#define OMAP4430_CM1_MPU_MOD 0x0300
@@ -71,19 +87,19 @@
/* CM2 instances */
-#define OMAP4430_CM2_OCP_SOCKET_MOD 0x0000
-#define OMAP4430_CM2_CKGEN_MOD 0x0100
-#define OMAP4430_CM2_ALWAYS_ON_MOD 0x0600
-#define OMAP4430_CM2_CORE_MOD 0x0700
-#define OMAP4430_CM2_IVAHD_MOD 0x0f00
-#define OMAP4430_CM2_CAM_MOD 0x1000
-#define OMAP4430_CM2_DSS_MOD 0x1100
-#define OMAP4430_CM2_GFX_MOD 0x1200
-#define OMAP4430_CM2_L3INIT_MOD 0x1300
-#define OMAP4430_CM2_L4PER_MOD 0x1400
-#define OMAP4430_CM2_CEFUSE_MOD 0x1600
-#define OMAP4430_CM2_RESTORE_MOD 0x1e00
-#define OMAP4430_CM2_INSTR_MOD 0x1f00
+#define OMAP4430_CM2_OCP_SOCKET_MOD 0x0000 | CM2_BASE_ID
+#define OMAP4430_CM2_CKGEN_MOD 0x0100 | CM2_BASE_ID
+#define OMAP4430_CM2_ALWAYS_ON_MOD 0x0600 | CM2_BASE_ID
+#define OMAP4430_CM2_CORE_MOD 0x0700 | CM2_BASE_ID
+#define OMAP4430_CM2_IVAHD_MOD 0x0f00 | CM2_BASE_ID
+#define OMAP4430_CM2_CAM_MOD 0x1000 | CM2_BASE_ID
+#define OMAP4430_CM2_DSS_MOD 0x1100 | CM2_BASE_ID
+#define OMAP4430_CM2_GFX_MOD 0x1200 | CM2_BASE_ID
+#define OMAP4430_CM2_L3INIT_MOD 0x1300 | CM2_BASE_ID
+#define OMAP4430_CM2_L4PER_MOD 0x1400 | CM2_BASE_ID
+#define OMAP4430_CM2_CEFUSE_MOD 0x1600 | CM2_BASE_ID
+#define OMAP4430_CM2_RESTORE_MOD 0x1e00 | CM2_BASE_ID
+#define OMAP4430_CM2_INSTR_MOD 0x1f00 | CM2_BASE_ID
/* PRM instances */
@@ -102,9 +118,9 @@
#define OMAP4430_PRM_L4PER_MOD 0x1400
#define OMAP4430_PRM_CEFUSE_MOD 0x1600
#define OMAP4430_PRM_WKUP_MOD 0x1700
-#define OMAP4430_PRM_WKUP_CM_MOD 0x1800
+#define OMAP4430_PRM_WKUP_CM_MOD 0x1800 | PRM_BASE_ID
#define OMAP4430_PRM_EMU_MOD 0x1900
-#define OMAP4430_PRM_EMU_CM_MOD 0x1a00
+#define OMAP4430_PRM_EMU_CM_MOD 0x1a00 | PRM_BASE_ID
#define OMAP4430_PRM_DEVICE_MOD 0x1b00
#define OMAP4430_PRM_INSTR_MOD 0x1f00
@@ -114,10 +130,10 @@
/* PRCM_MPU instances */
-#define OMAP4430_PRCM_MPU_OCP_SOCKET_PRCM_MOD 0x0000
-#define OMAP4430_PRCM_MPU_DEVICE_PRM_MOD 0x0200
-#define OMAP4430_PRCM_MPU_CPU0_MOD 0x0400
-#define OMAP4430_PRCM_MPU_CPU1_MOD 0x0800
+#define OMAP4430_PRCM_MPU_OCP_SOCKET_PRCM_MOD 0x0000 | PRCM_MPU_BASE_ID
+#define OMAP4430_PRCM_MPU_DEVICE_PRM_MOD 0x0200 | PRCM_MPU_BASE_ID
+#define OMAP4430_PRCM_MPU_CPU0_MOD 0x0400 | PRCM_MPU_BASE_ID
+#define OMAP4430_PRCM_MPU_CPU1_MOD 0x0800 | PRCM_MPU_BASE_ID
/* 24XX register bits shared between CM & PRM registers */
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index 4df30d0..124e866 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -182,13 +182,40 @@ static inline void __omap_prcm_write(u32 value, void __iomem *base,
/* Read a register in a PRM module */
u32 prm_read_mod_reg(s16 module, u16 idx)
{
- return __omap_prcm_read(prm_base, module, idx);
+ u32 base = 0;
+
+ base = abs(module) >> BASE_ID_SHIFT;
+ module &= MOD_MASK;
+
+ switch (base) {
+ case PRCM_MPU_BASE:
+ return __omap_prcm_read(prcm_mpu_base, module, idx);
+ case DEFAULT_BASE:
+ return __omap_prcm_read(prm_base, module, idx);
+ default:
+ pr_err("Unknown PRM submodule base\n");
+ }
+ return 0;
}
/* Write into a register in a PRM module */
void prm_write_mod_reg(u32 val, s16 module, u16 idx)
{
- __omap_prcm_write(val, prm_base, module, idx);
+ u32 base = 0;
+
+ base = abs(module) >> BASE_ID_SHIFT;
+
+ switch (base) {
+ case PRCM_MPU_BASE:
+ __omap_prcm_write(val, prcm_mpu_base, module, idx);
+ break;
+ case DEFAULT_BASE:
+ __omap_prcm_write(val, prm_base, module, idx);
+ break;
+ default:
+ pr_err("Unknown PRM submodule base\n");
+ break;
+ }
}
/* Read-modify-write a register in a PRM module. Caller must lock */
@@ -219,13 +246,46 @@ u32 prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
/* Read a register in a CM module */
u32 cm_read_mod_reg(s16 module, u16 idx)
{
- return __omap_prcm_read(cm_base, module, idx);
+ u32 base = 0;
+
+ base = abs(module) >> BASE_ID_SHIFT;
+ module &= MOD_MASK;
+
+ switch (base) {
+ case PRM_BASE:
+ return __omap_prcm_read(prm_base, module, idx);
+ case CM2_BASE:
+ return __omap_prcm_read(cm2_base, module, idx);
+ case DEFAULT_BASE:
+ return __omap_prcm_read(cm_base, module, idx);
+ default:
+ pr_err("Unknown CM submodule base\n");
+ }
+ return 0;
}
/* Write into a register in a CM module */
void cm_write_mod_reg(u32 val, s16 module, u16 idx)
{
- __omap_prcm_write(val, cm_base, module, idx);
+ u32 base = 0;
+
+ base = abs(module) >> BASE_ID_SHIFT;
+ module &= MOD_MASK;
+
+ switch (base) {
+ case PRM_BASE:
+ __omap_prcm_write(val, prm_base, module, idx);
+ break;
+ case CM2_BASE:
+ __omap_prcm_write(val, cm2_base, module, idx);
+ break;
+ case DEFAULT_BASE:
+ __omap_prcm_write(val, cm_base, module, idx);
+ break;
+ default:
+ pr_err("Unknown CM submodule base\n");
+ break;
+ }
}
/* Read-modify-write a register in a CM module. Caller must lock */
diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h
index 588873b..72456cc 100644
--- a/arch/arm/mach-omap2/prm.h
+++ b/arch/arm/mach-omap2/prm.h
@@ -23,9 +23,9 @@
#define OMAP34XX_PRM_REGADDR(module, reg) \
OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg))
#define OMAP44XX_PRM_REGADDR(module, reg) \
- OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE + (module) + (reg))
+ OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE + ((module) & (MOD_MASK)) + (reg))
#define OMAP44XX_PRCM_MPU_REGADDR(module, reg) \
- OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE + (module) + (reg))
+ OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE + ((module) & (MOD_MASK)) + (reg))
#include "prm44xx.h"
--
1.7.0.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [RFC][PATCH 2/2] OMAP4: PRCM: Fix usage of prm/cm accessor api's for OMAP4
2010-08-10 15:02 ` [RFC][PATCH 2/2] OMAP4: PRCM: Fix usage of prm/cm accessor api's for OMAP4 Rajendra Nayak
@ 2010-08-24 21:39 ` Kevin Hilman
2010-08-25 8:56 ` Nayak, Rajendra
2010-09-23 14:15 ` Nayak, Rajendra
2010-10-14 18:44 ` Paul Walmsley
2 siblings, 1 reply; 10+ messages in thread
From: Kevin Hilman @ 2010-08-24 21:39 UTC (permalink / raw)
To: Rajendra Nayak; +Cc: linux-omap, paul, b-cousson
Rajendra Nayak <rnayak@ti.com> writes:
> OMAP's have always had PRCM split into PRM for power and reset
> management and CM for clock management.
> In OMAP4 the split (physically) is not very straight forward and
> there are instances of clock management control registers in PRM
> and vice versa.
> However it still makes sense, even on OMAP4 to logically split
> PRCM into PRM and CM for better understanding and to avoid adding
> additonal complexity in higher level frameworks which rely on the
> accessor api;s to do the low level register accesses.
>
> Hence this patch makes sure that any clock management code can
> use the cm_read/write* accessor apis (without knowing the physical split)
> and power and reset management code can use prm_read/write*
> accessor api;s.
>
> To do this the submodule offsets within PRM/CM1 and CM2 have additonal
> info embedded in them specifying what base address to use while
> trying to access registers in the given submodule.
>
> The 16 bit signed submodule offset is defined for OMAP4 as
> <Bit 15> | <Bit 14:13> | <Bit 12:0>
> <Sign bit> | <base identifier> | <submodule offset from base>
>
> For older OMAP's the base identifier is always set to 0.
>
> Signed-off-by: Rajendra Nayak <rnayak@ti.com>
> Cc: Kevin Hilman <khilman@deeprootsystems.com>
> Cc: Paul Walmsley <paul@pwsan.com>
> Cc: Benoit Cousson <b-cousson@ti.com>
I'm OK with this approach, but I don't like the extra overhead added for
every PRCM access on OMAP2/3.
What if you keep the original functions and add new functions for OMAP4,
and use function pointers init'd at runtime (based on the existence of
prcm_mpu_base)
Kevin
> ---
> arch/arm/mach-omap2/cm.h | 4 +-
> arch/arm/mach-omap2/prcm-common.h | 58 ++++++++++++++++++++-----------
> arch/arm/mach-omap2/prcm.c | 68 ++++++++++++++++++++++++++++++++++--
> arch/arm/mach-omap2/prm.h | 4 +-
> 4 files changed, 105 insertions(+), 29 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h
> index a02ca30..7b7ef09 100644
> --- a/arch/arm/mach-omap2/cm.h
> +++ b/arch/arm/mach-omap2/cm.h
> @@ -23,9 +23,9 @@
> #define OMAP34XX_CM_REGADDR(module, reg) \
> OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg))
> #define OMAP44XX_CM1_REGADDR(module, reg) \
> - OMAP2_L4_IO_ADDRESS(OMAP4430_CM1_BASE + (module) + (reg))
> + OMAP2_L4_IO_ADDRESS(OMAP4430_CM1_BASE + ((module) & (MOD_MASK)) + (reg))
> #define OMAP44XX_CM2_REGADDR(module, reg) \
> - OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE + (module) + (reg))
> + OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE + ((module) & (MOD_MASK)) + (reg))
>
> #include "cm44xx.h"
>
> diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h
> index 995b7ed..b93d33e 100644
> --- a/arch/arm/mach-omap2/prcm-common.h
> +++ b/arch/arm/mach-omap2/prcm-common.h
> @@ -57,10 +57,26 @@
> #define BITFIELD(l_bit, u_bit) \
> (BITS(u_bit) & ~((BITS(l_bit)) >> 1))
>
> -/* OMAP44XX specific module offsets */
> +/*
> + * OMAP44XX specific module offsets
> + * The 16 bit submodule offset is defined for OMAP4 as
> + * <Bit 15> | <Bit 14:13> | <Bit 12:0>
> + * <Sign bit> | <base identifier> | <submodule offset from base>
> + */
>
> -/* CM1 instances */
> +#define DEFAULT_BASE 0x0
> +#define PRM_BASE 0x1
> +#define PRCM_MPU_BASE 0x2
> +#define CM2_BASE 0x3
>
> +#define BASE_ID_SHIFT 13
> +#define MOD_MASK ((1 << BASE_ID_SHIFT)-1)
> +
> +#define PRM_BASE_ID (PRM_BASE << BASE_ID_SHIFT)
> +#define PRCM_MPU_BASE_ID (PRCM_MPU_BASE << BASE_ID_SHIFT)
> +#define CM2_BASE_ID (CM2_BASE << BASE_ID_SHIFT)
> +
> +/* CM1 instances */
> #define OMAP4430_CM1_OCP_SOCKET_MOD 0x0000
> #define OMAP4430_CM1_CKGEN_MOD 0x0100
> #define OMAP4430_CM1_MPU_MOD 0x0300
> @@ -71,19 +87,19 @@
>
> /* CM2 instances */
>
> -#define OMAP4430_CM2_OCP_SOCKET_MOD 0x0000
> -#define OMAP4430_CM2_CKGEN_MOD 0x0100
> -#define OMAP4430_CM2_ALWAYS_ON_MOD 0x0600
> -#define OMAP4430_CM2_CORE_MOD 0x0700
> -#define OMAP4430_CM2_IVAHD_MOD 0x0f00
> -#define OMAP4430_CM2_CAM_MOD 0x1000
> -#define OMAP4430_CM2_DSS_MOD 0x1100
> -#define OMAP4430_CM2_GFX_MOD 0x1200
> -#define OMAP4430_CM2_L3INIT_MOD 0x1300
> -#define OMAP4430_CM2_L4PER_MOD 0x1400
> -#define OMAP4430_CM2_CEFUSE_MOD 0x1600
> -#define OMAP4430_CM2_RESTORE_MOD 0x1e00
> -#define OMAP4430_CM2_INSTR_MOD 0x1f00
> +#define OMAP4430_CM2_OCP_SOCKET_MOD 0x0000 | CM2_BASE_ID
> +#define OMAP4430_CM2_CKGEN_MOD 0x0100 | CM2_BASE_ID
> +#define OMAP4430_CM2_ALWAYS_ON_MOD 0x0600 | CM2_BASE_ID
> +#define OMAP4430_CM2_CORE_MOD 0x0700 | CM2_BASE_ID
> +#define OMAP4430_CM2_IVAHD_MOD 0x0f00 | CM2_BASE_ID
> +#define OMAP4430_CM2_CAM_MOD 0x1000 | CM2_BASE_ID
> +#define OMAP4430_CM2_DSS_MOD 0x1100 | CM2_BASE_ID
> +#define OMAP4430_CM2_GFX_MOD 0x1200 | CM2_BASE_ID
> +#define OMAP4430_CM2_L3INIT_MOD 0x1300 | CM2_BASE_ID
> +#define OMAP4430_CM2_L4PER_MOD 0x1400 | CM2_BASE_ID
> +#define OMAP4430_CM2_CEFUSE_MOD 0x1600 | CM2_BASE_ID
> +#define OMAP4430_CM2_RESTORE_MOD 0x1e00 | CM2_BASE_ID
> +#define OMAP4430_CM2_INSTR_MOD 0x1f00 | CM2_BASE_ID
>
> /* PRM instances */
>
> @@ -102,9 +118,9 @@
> #define OMAP4430_PRM_L4PER_MOD 0x1400
> #define OMAP4430_PRM_CEFUSE_MOD 0x1600
> #define OMAP4430_PRM_WKUP_MOD 0x1700
> -#define OMAP4430_PRM_WKUP_CM_MOD 0x1800
> +#define OMAP4430_PRM_WKUP_CM_MOD 0x1800 | PRM_BASE_ID
> #define OMAP4430_PRM_EMU_MOD 0x1900
> -#define OMAP4430_PRM_EMU_CM_MOD 0x1a00
> +#define OMAP4430_PRM_EMU_CM_MOD 0x1a00 | PRM_BASE_ID
> #define OMAP4430_PRM_DEVICE_MOD 0x1b00
> #define OMAP4430_PRM_INSTR_MOD 0x1f00
>
> @@ -114,10 +130,10 @@
>
> /* PRCM_MPU instances */
>
> -#define OMAP4430_PRCM_MPU_OCP_SOCKET_PRCM_MOD 0x0000
> -#define OMAP4430_PRCM_MPU_DEVICE_PRM_MOD 0x0200
> -#define OMAP4430_PRCM_MPU_CPU0_MOD 0x0400
> -#define OMAP4430_PRCM_MPU_CPU1_MOD 0x0800
> +#define OMAP4430_PRCM_MPU_OCP_SOCKET_PRCM_MOD 0x0000 | PRCM_MPU_BASE_ID
> +#define OMAP4430_PRCM_MPU_DEVICE_PRM_MOD 0x0200 | PRCM_MPU_BASE_ID
> +#define OMAP4430_PRCM_MPU_CPU0_MOD 0x0400 | PRCM_MPU_BASE_ID
> +#define OMAP4430_PRCM_MPU_CPU1_MOD 0x0800 | PRCM_MPU_BASE_ID
>
>
> /* 24XX register bits shared between CM & PRM registers */
> diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
> index 4df30d0..124e866 100644
> --- a/arch/arm/mach-omap2/prcm.c
> +++ b/arch/arm/mach-omap2/prcm.c
> @@ -182,13 +182,40 @@ static inline void __omap_prcm_write(u32 value, void __iomem *base,
> /* Read a register in a PRM module */
> u32 prm_read_mod_reg(s16 module, u16 idx)
> {
> - return __omap_prcm_read(prm_base, module, idx);
> + u32 base = 0;
> +
> + base = abs(module) >> BASE_ID_SHIFT;
> + module &= MOD_MASK;
> +
> + switch (base) {
> + case PRCM_MPU_BASE:
> + return __omap_prcm_read(prcm_mpu_base, module, idx);
> + case DEFAULT_BASE:
> + return __omap_prcm_read(prm_base, module, idx);
> + default:
> + pr_err("Unknown PRM submodule base\n");
> + }
> + return 0;
> }
>
> /* Write into a register in a PRM module */
> void prm_write_mod_reg(u32 val, s16 module, u16 idx)
> {
> - __omap_prcm_write(val, prm_base, module, idx);
> + u32 base = 0;
> +
> + base = abs(module) >> BASE_ID_SHIFT;
> +
> + switch (base) {
> + case PRCM_MPU_BASE:
> + __omap_prcm_write(val, prcm_mpu_base, module, idx);
> + break;
> + case DEFAULT_BASE:
> + __omap_prcm_write(val, prm_base, module, idx);
> + break;
> + default:
> + pr_err("Unknown PRM submodule base\n");
> + break;
> + }
> }
>
> /* Read-modify-write a register in a PRM module. Caller must lock */
> @@ -219,13 +246,46 @@ u32 prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
> /* Read a register in a CM module */
> u32 cm_read_mod_reg(s16 module, u16 idx)
> {
> - return __omap_prcm_read(cm_base, module, idx);
> + u32 base = 0;
> +
> + base = abs(module) >> BASE_ID_SHIFT;
> + module &= MOD_MASK;
> +
> + switch (base) {
> + case PRM_BASE:
> + return __omap_prcm_read(prm_base, module, idx);
> + case CM2_BASE:
> + return __omap_prcm_read(cm2_base, module, idx);
> + case DEFAULT_BASE:
> + return __omap_prcm_read(cm_base, module, idx);
> + default:
> + pr_err("Unknown CM submodule base\n");
> + }
> + return 0;
> }
>
> /* Write into a register in a CM module */
> void cm_write_mod_reg(u32 val, s16 module, u16 idx)
> {
> - __omap_prcm_write(val, cm_base, module, idx);
> + u32 base = 0;
> +
> + base = abs(module) >> BASE_ID_SHIFT;
> + module &= MOD_MASK;
> +
> + switch (base) {
> + case PRM_BASE:
> + __omap_prcm_write(val, prm_base, module, idx);
> + break;
> + case CM2_BASE:
> + __omap_prcm_write(val, cm2_base, module, idx);
> + break;
> + case DEFAULT_BASE:
> + __omap_prcm_write(val, cm_base, module, idx);
> + break;
> + default:
> + pr_err("Unknown CM submodule base\n");
> + break;
> + }
> }
>
> /* Read-modify-write a register in a CM module. Caller must lock */
> diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h
> index 588873b..72456cc 100644
> --- a/arch/arm/mach-omap2/prm.h
> +++ b/arch/arm/mach-omap2/prm.h
> @@ -23,9 +23,9 @@
> #define OMAP34XX_PRM_REGADDR(module, reg) \
> OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg))
> #define OMAP44XX_PRM_REGADDR(module, reg) \
> - OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE + (module) + (reg))
> + OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE + ((module) & (MOD_MASK)) + (reg))
> #define OMAP44XX_PRCM_MPU_REGADDR(module, reg) \
> - OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE + (module) + (reg))
> + OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE + ((module) & (MOD_MASK)) + (reg))
>
> #include "prm44xx.h"
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [RFC][PATCH 2/2] OMAP4: PRCM: Fix usage of prm/cm accessor api's for OMAP4
2010-08-24 21:39 ` Kevin Hilman
@ 2010-08-25 8:56 ` Nayak, Rajendra
2010-08-25 18:16 ` Kevin Hilman
0 siblings, 1 reply; 10+ messages in thread
From: Nayak, Rajendra @ 2010-08-25 8:56 UTC (permalink / raw)
To: Kevin Hilman; +Cc: linux-omap, paul, Cousson, Benoit
> -----Original Message-----
> From: Kevin Hilman [mailto:khilman@deeprootsystems.com]
> Sent: Wednesday, August 25, 2010 3:10 AM
> To: Nayak, Rajendra
> Cc: linux-omap@vger.kernel.org; paul@pwsan.com; Cousson, Benoit
> Subject: Re: [RFC][PATCH 2/2] OMAP4: PRCM: Fix usage of prm/cm accessor api's for
> OMAP4
>
> Rajendra Nayak <rnayak@ti.com> writes:
>
> > OMAP's have always had PRCM split into PRM for power and reset
> > management and CM for clock management.
> > In OMAP4 the split (physically) is not very straight forward and
> > there are instances of clock management control registers in PRM
> > and vice versa.
> > However it still makes sense, even on OMAP4 to logically split
> > PRCM into PRM and CM for better understanding and to avoid adding
> > additonal complexity in higher level frameworks which rely on the
> > accessor api;s to do the low level register accesses.
> >
> > Hence this patch makes sure that any clock management code can
> > use the cm_read/write* accessor apis (without knowing the physical split)
> > and power and reset management code can use prm_read/write*
> > accessor api;s.
> >
> > To do this the submodule offsets within PRM/CM1 and CM2 have additonal
> > info embedded in them specifying what base address to use while
> > trying to access registers in the given submodule.
> >
> > The 16 bit signed submodule offset is defined for OMAP4 as
> > <Bit 15> | <Bit 14:13> | <Bit 12:0>
> > <Sign bit> | <base identifier> | <submodule offset from base>
> >
> > For older OMAP's the base identifier is always set to 0.
> >
> > Signed-off-by: Rajendra Nayak <rnayak@ti.com>
> > Cc: Kevin Hilman <khilman@deeprootsystems.com>
> > Cc: Paul Walmsley <paul@pwsan.com>
> > Cc: Benoit Cousson <b-cousson@ti.com>
>
> I'm OK with this approach, but I don't like the extra overhead added for
> every PRCM access on OMAP2/3.
>
> What if you keep the original functions and add new functions for OMAP4,
> and use function pointers init'd at runtime (based on the existence of
> prcm_mpu_base)
Hi Kevin,
I actually have a series to split the powerdomain f/w into platform specific and platform independent functions. With that I should be able to get rid of this single function (for prm) for omap2/3 and omap4 and have separate functions. I can do a similar split for clockdomain framework and do the same for the cm functions.
I will post the powerdomain split patches soon for review. Do you think it still makes sense to have this function pointer approach in the interim?
Regards,
Rajendra
>
> Kevin
>
>
> > ---
> > arch/arm/mach-omap2/cm.h | 4 +-
> > arch/arm/mach-omap2/prcm-common.h | 58 ++++++++++++++++++++----
> -------
> > arch/arm/mach-omap2/prcm.c | 68
> ++++++++++++++++++++++++++++++++++--
> > arch/arm/mach-omap2/prm.h | 4 +-
> > 4 files changed, 105 insertions(+), 29 deletions(-)
> >
> > diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h
> > index a02ca30..7b7ef09 100644
> > --- a/arch/arm/mach-omap2/cm.h
> > +++ b/arch/arm/mach-omap2/cm.h
> > @@ -23,9 +23,9 @@
> > #define OMAP34XX_CM_REGADDR(module, reg) \
> > OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) +
> (reg))
> > #define OMAP44XX_CM1_REGADDR(module, reg) \
> > - OMAP2_L4_IO_ADDRESS(OMAP4430_CM1_BASE + (module) +
> (reg))
> > + OMAP2_L4_IO_ADDRESS(OMAP4430_CM1_BASE + ((module) &
> (MOD_MASK)) + (reg))
> > #define OMAP44XX_CM2_REGADDR(module, reg) \
> > - OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE + (module) +
> (reg))
> > + OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE + ((module) &
> (MOD_MASK)) + (reg))
> >
> > #include "cm44xx.h"
> >
> > diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-
> common.h
> > index 995b7ed..b93d33e 100644
> > --- a/arch/arm/mach-omap2/prcm-common.h
> > +++ b/arch/arm/mach-omap2/prcm-common.h
> > @@ -57,10 +57,26 @@
> > #define BITFIELD(l_bit, u_bit) \
> > (BITS(u_bit) & ~((BITS(l_bit)) >> 1))
> >
> > -/* OMAP44XX specific module offsets */
> > +/*
> > + * OMAP44XX specific module offsets
> > + * The 16 bit submodule offset is defined for OMAP4 as
> > + * <Bit 15> | <Bit 14:13> | <Bit 12:0>
> > + * <Sign bit> | <base identifier> | <submodule offset from base>
> > + */
> >
> > -/* CM1 instances */
> > +#define DEFAULT_BASE 0x0
> > +#define PRM_BASE 0x1
> > +#define PRCM_MPU_BASE 0x2
> > +#define CM2_BASE 0x3
> >
> > +#define BASE_ID_SHIFT 13
> > +#define MOD_MASK ((1 << BASE_ID_SHIFT)-1)
> > +
> > +#define PRM_BASE_ID (PRM_BASE << BASE_ID_SHIFT)
> > +#define PRCM_MPU_BASE_ID (PRCM_MPU_BASE << BASE_ID_SHIFT)
> > +#define CM2_BASE_ID (CM2_BASE << BASE_ID_SHIFT)
> > +
> > +/* CM1 instances */
> > #define OMAP4430_CM1_OCP_SOCKET_MOD 0x0000
> > #define OMAP4430_CM1_CKGEN_MOD 0x0100
> > #define OMAP4430_CM1_MPU_MOD 0x0300
> > @@ -71,19 +87,19 @@
> >
> > /* CM2 instances */
> >
> > -#define OMAP4430_CM2_OCP_SOCKET_MOD 0x0000
> > -#define OMAP4430_CM2_CKGEN_MOD 0x0100
> > -#define OMAP4430_CM2_ALWAYS_ON_MOD 0x0600
> > -#define OMAP4430_CM2_CORE_MOD 0x0700
> > -#define OMAP4430_CM2_IVAHD_MOD 0x0f00
> > -#define OMAP4430_CM2_CAM_MOD 0x1000
> > -#define OMAP4430_CM2_DSS_MOD 0x1100
> > -#define OMAP4430_CM2_GFX_MOD 0x1200
> > -#define OMAP4430_CM2_L3INIT_MOD 0x1300
> > -#define OMAP4430_CM2_L4PER_MOD 0x1400
> > -#define OMAP4430_CM2_CEFUSE_MOD 0x1600
> > -#define OMAP4430_CM2_RESTORE_MOD 0x1e00
> > -#define OMAP4430_CM2_INSTR_MOD 0x1f00
> > +#define OMAP4430_CM2_OCP_SOCKET_MOD 0x0000 | CM2_BASE_ID
> > +#define OMAP4430_CM2_CKGEN_MOD 0x0100 | CM2_BASE_ID
> > +#define OMAP4430_CM2_ALWAYS_ON_MOD 0x0600 | CM2_BASE_ID
> > +#define OMAP4430_CM2_CORE_MOD 0x0700 | CM2_BASE_ID
> > +#define OMAP4430_CM2_IVAHD_MOD 0x0f00 | CM2_BASE_ID
> > +#define OMAP4430_CM2_CAM_MOD 0x1000 | CM2_BASE_ID
> > +#define OMAP4430_CM2_DSS_MOD 0x1100 | CM2_BASE_ID
> > +#define OMAP4430_CM2_GFX_MOD 0x1200 | CM2_BASE_ID
> > +#define OMAP4430_CM2_L3INIT_MOD 0x1300 | CM2_BASE_ID
> > +#define OMAP4430_CM2_L4PER_MOD 0x1400 | CM2_BASE_ID
> > +#define OMAP4430_CM2_CEFUSE_MOD 0x1600 | CM2_BASE_ID
> > +#define OMAP4430_CM2_RESTORE_MOD 0x1e00 | CM2_BASE_ID
> > +#define OMAP4430_CM2_INSTR_MOD 0x1f00 | CM2_BASE_ID
> >
> > /* PRM instances */
> >
> > @@ -102,9 +118,9 @@
> > #define OMAP4430_PRM_L4PER_MOD 0x1400
> > #define OMAP4430_PRM_CEFUSE_MOD 0x1600
> > #define OMAP4430_PRM_WKUP_MOD 0x1700
> > -#define OMAP4430_PRM_WKUP_CM_MOD 0x1800
> > +#define OMAP4430_PRM_WKUP_CM_MOD 0x1800 | PRM_BASE_ID
> > #define OMAP4430_PRM_EMU_MOD 0x1900
> > -#define OMAP4430_PRM_EMU_CM_MOD 0x1a00
> > +#define OMAP4430_PRM_EMU_CM_MOD 0x1a00 | PRM_BASE_ID
> > #define OMAP4430_PRM_DEVICE_MOD 0x1b00
> > #define OMAP4430_PRM_INSTR_MOD 0x1f00
> >
> > @@ -114,10 +130,10 @@
> >
> > /* PRCM_MPU instances */
> >
> > -#define OMAP4430_PRCM_MPU_OCP_SOCKET_PRCM_MOD 0x0000
> > -#define OMAP4430_PRCM_MPU_DEVICE_PRM_MOD 0x0200
> > -#define OMAP4430_PRCM_MPU_CPU0_MOD 0x0400
> > -#define OMAP4430_PRCM_MPU_CPU1_MOD 0x0800
> > +#define OMAP4430_PRCM_MPU_OCP_SOCKET_PRCM_MOD 0x0000 |
> PRCM_MPU_BASE_ID
> > +#define OMAP4430_PRCM_MPU_DEVICE_PRM_MOD 0x0200 |
> PRCM_MPU_BASE_ID
> > +#define OMAP4430_PRCM_MPU_CPU0_MOD 0x0400 |
> PRCM_MPU_BASE_ID
> > +#define OMAP4430_PRCM_MPU_CPU1_MOD 0x0800 |
> PRCM_MPU_BASE_ID
> >
> >
> > /* 24XX register bits shared between CM & PRM registers */
> > diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
> > index 4df30d0..124e866 100644
> > --- a/arch/arm/mach-omap2/prcm.c
> > +++ b/arch/arm/mach-omap2/prcm.c
> > @@ -182,13 +182,40 @@ static inline void __omap_prcm_write(u32 value, void
> __iomem *base,
> > /* Read a register in a PRM module */
> > u32 prm_read_mod_reg(s16 module, u16 idx)
> > {
> > - return __omap_prcm_read(prm_base, module, idx);
> > + u32 base = 0;
> > +
> > + base = abs(module) >> BASE_ID_SHIFT;
> > + module &= MOD_MASK;
> > +
> > + switch (base) {
> > + case PRCM_MPU_BASE:
> > + return __omap_prcm_read(prcm_mpu_base, module, idx);
> > + case DEFAULT_BASE:
> > + return __omap_prcm_read(prm_base, module, idx);
> > + default:
> > + pr_err("Unknown PRM submodule base\n");
> > + }
> > + return 0;
> > }
> >
> > /* Write into a register in a PRM module */
> > void prm_write_mod_reg(u32 val, s16 module, u16 idx)
> > {
> > - __omap_prcm_write(val, prm_base, module, idx);
> > + u32 base = 0;
> > +
> > + base = abs(module) >> BASE_ID_SHIFT;
> > +
> > + switch (base) {
> > + case PRCM_MPU_BASE:
> > + __omap_prcm_write(val, prcm_mpu_base, module, idx);
> > + break;
> > + case DEFAULT_BASE:
> > + __omap_prcm_write(val, prm_base, module, idx);
> > + break;
> > + default:
> > + pr_err("Unknown PRM submodule base\n");
> > + break;
> > + }
> > }
> >
> > /* Read-modify-write a register in a PRM module. Caller must lock */
> > @@ -219,13 +246,46 @@ u32 prm_read_mod_bits_shift(s16 domain, s16 idx, u32
> mask)
> > /* Read a register in a CM module */
> > u32 cm_read_mod_reg(s16 module, u16 idx)
> > {
> > - return __omap_prcm_read(cm_base, module, idx);
> > + u32 base = 0;
> > +
> > + base = abs(module) >> BASE_ID_SHIFT;
> > + module &= MOD_MASK;
> > +
> > + switch (base) {
> > + case PRM_BASE:
> > + return __omap_prcm_read(prm_base, module, idx);
> > + case CM2_BASE:
> > + return __omap_prcm_read(cm2_base, module, idx);
> > + case DEFAULT_BASE:
> > + return __omap_prcm_read(cm_base, module, idx);
> > + default:
> > + pr_err("Unknown CM submodule base\n");
> > + }
> > + return 0;
> > }
> >
> > /* Write into a register in a CM module */
> > void cm_write_mod_reg(u32 val, s16 module, u16 idx)
> > {
> > - __omap_prcm_write(val, cm_base, module, idx);
> > + u32 base = 0;
> > +
> > + base = abs(module) >> BASE_ID_SHIFT;
> > + module &= MOD_MASK;
> > +
> > + switch (base) {
> > + case PRM_BASE:
> > + __omap_prcm_write(val, prm_base, module, idx);
> > + break;
> > + case CM2_BASE:
> > + __omap_prcm_write(val, cm2_base, module, idx);
> > + break;
> > + case DEFAULT_BASE:
> > + __omap_prcm_write(val, cm_base, module, idx);
> > + break;
> > + default:
> > + pr_err("Unknown CM submodule base\n");
> > + break;
> > + }
> > }
> >
> > /* Read-modify-write a register in a CM module. Caller must lock */
> > diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h
> > index 588873b..72456cc 100644
> > --- a/arch/arm/mach-omap2/prm.h
> > +++ b/arch/arm/mach-omap2/prm.h
> > @@ -23,9 +23,9 @@
> > #define OMAP34XX_PRM_REGADDR(module, reg) \
> > OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg))
> > #define OMAP44XX_PRM_REGADDR(module, reg) \
> > - OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE + (module) + (reg))
> > + OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE + ((module) &
> (MOD_MASK)) + (reg))
> > #define OMAP44XX_PRCM_MPU_REGADDR(module, reg) \
> > - OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE + (module) +
> (reg))
> > + OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE + ((module) &
> (MOD_MASK)) + (reg))
> >
> > #include "prm44xx.h"
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC][PATCH 2/2] OMAP4: PRCM: Fix usage of prm/cm accessor api's for OMAP4
2010-08-25 8:56 ` Nayak, Rajendra
@ 2010-08-25 18:16 ` Kevin Hilman
0 siblings, 0 replies; 10+ messages in thread
From: Kevin Hilman @ 2010-08-25 18:16 UTC (permalink / raw)
To: Nayak, Rajendra; +Cc: linux-omap, paul, Cousson, Benoit
"Nayak, Rajendra" <rnayak@ti.com> writes:
>> -----Original Message-----
>> From: Kevin Hilman [mailto:khilman@deeprootsystems.com]
>> Sent: Wednesday, August 25, 2010 3:10 AM
>> To: Nayak, Rajendra
>> Cc: linux-omap@vger.kernel.org; paul@pwsan.com; Cousson, Benoit
>> Subject: Re: [RFC][PATCH 2/2] OMAP4: PRCM: Fix usage of prm/cm accessor api's for
>> OMAP4
>>
>> Rajendra Nayak <rnayak@ti.com> writes:
>>
>> > OMAP's have always had PRCM split into PRM for power and reset
>> > management and CM for clock management.
>> > In OMAP4 the split (physically) is not very straight forward and
>> > there are instances of clock management control registers in PRM
>> > and vice versa.
>> > However it still makes sense, even on OMAP4 to logically split
>> > PRCM into PRM and CM for better understanding and to avoid adding
>> > additonal complexity in higher level frameworks which rely on the
>> > accessor api;s to do the low level register accesses.
>> >
>> > Hence this patch makes sure that any clock management code can
>> > use the cm_read/write* accessor apis (without knowing the physical split)
>> > and power and reset management code can use prm_read/write*
>> > accessor api;s.
>> >
>> > To do this the submodule offsets within PRM/CM1 and CM2 have additonal
>> > info embedded in them specifying what base address to use while
>> > trying to access registers in the given submodule.
>> >
>> > The 16 bit signed submodule offset is defined for OMAP4 as
>> > <Bit 15> | <Bit 14:13> | <Bit 12:0>
>> > <Sign bit> | <base identifier> | <submodule offset from base>
>> >
>> > For older OMAP's the base identifier is always set to 0.
>> >
>> > Signed-off-by: Rajendra Nayak <rnayak@ti.com>
>> > Cc: Kevin Hilman <khilman@deeprootsystems.com>
>> > Cc: Paul Walmsley <paul@pwsan.com>
>> > Cc: Benoit Cousson <b-cousson@ti.com>
>>
>> I'm OK with this approach, but I don't like the extra overhead added for
>> every PRCM access on OMAP2/3.
>>
>> What if you keep the original functions and add new functions for OMAP4,
>> and use function pointers init'd at runtime (based on the existence of
>> prcm_mpu_base)
> I actually have a series to split the powerdomain f/w into platform
> specific and platform independent functions. With that I should be
> able to get rid of this single function (for prm) for omap2/3 and
> omap4 and have separate functions. I can do a similar split for
> clockdomain framework and do the same for the cm functions. I will
> post the powerdomain split patches soon for review.
OK.
> Do you think it still makes sense to have this function pointer approach in the interim?
No, it sounds like your split-up approach is better all around.
Kevin
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [RFC][PATCH 2/2] OMAP4: PRCM: Fix usage of prm/cm accessor api's for OMAP4
2010-08-10 15:02 ` [RFC][PATCH 2/2] OMAP4: PRCM: Fix usage of prm/cm accessor api's for OMAP4 Rajendra Nayak
2010-08-24 21:39 ` Kevin Hilman
@ 2010-09-23 14:15 ` Nayak, Rajendra
2010-10-14 18:44 ` Paul Walmsley
2 siblings, 0 replies; 10+ messages in thread
From: Nayak, Rajendra @ 2010-09-23 14:15 UTC (permalink / raw)
To: linux-omap; +Cc: khilman, paul, Cousson, Benoit
> -----Original Message-----
> From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
> owner@vger.kernel.org] On Behalf Of Nayak, Rajendra
> Sent: Tuesday, August 10, 2010 8:33 PM
> To: linux-omap@vger.kernel.org
> Cc: khilman@deeprootsystems.com; paul@pwsan.com; Cousson, Benoit; Nayak,
> Rajendra
> Subject: [RFC][PATCH 2/2] OMAP4: PRCM: Fix usage of prm/cm accessor api's for
> OMAP4
>
> OMAP's have always had PRCM split into PRM for power and reset
> management and CM for clock management.
> In OMAP4 the split (physically) is not very straight forward and
> there are instances of clock management control registers in PRM
> and vice versa.
> However it still makes sense, even on OMAP4 to logically split
> PRCM into PRM and CM for better understanding and to avoid adding
> additonal complexity in higher level frameworks which rely on the
> accessor api;s to do the low level register accesses.
>
> Hence this patch makes sure that any clock management code can
> use the cm_read/write* accessor apis (without knowing the physical split)
> and power and reset management code can use prm_read/write*
> accessor api;s.
>
> To do this the submodule offsets within PRM/CM1 and CM2 have additonal
> info embedded in them specifying what base address to use while
> trying to access registers in the given submodule.
>
> The 16 bit signed submodule offset is defined for OMAP4 as
> <Bit 15> | <Bit 14:13> | <Bit 12:0>
> <Sign bit> | <base identifier> | <submodule offset from base>
>
> For older OMAP's the base identifier is always set to 0.
Hi Paul,
Any thoughts on this patch/approach?
Regards,
Rajendra
>
> Signed-off-by: Rajendra Nayak <rnayak@ti.com>
> Cc: Kevin Hilman <khilman@deeprootsystems.com>
> Cc: Paul Walmsley <paul@pwsan.com>
> Cc: Benoit Cousson <b-cousson@ti.com>
> ---
> arch/arm/mach-omap2/cm.h | 4 +-
> arch/arm/mach-omap2/prcm-common.h | 58 ++++++++++++++++++++------
> -----
> arch/arm/mach-omap2/prcm.c | 68
> ++++++++++++++++++++++++++++++++++--
> arch/arm/mach-omap2/prm.h | 4 +-
> 4 files changed, 105 insertions(+), 29 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h
> index a02ca30..7b7ef09 100644
> --- a/arch/arm/mach-omap2/cm.h
> +++ b/arch/arm/mach-omap2/cm.h
> @@ -23,9 +23,9 @@
> #define OMAP34XX_CM_REGADDR(module, reg) \
> OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) +
> (reg))
> #define OMAP44XX_CM1_REGADDR(module, reg) \
> - OMAP2_L4_IO_ADDRESS(OMAP4430_CM1_BASE + (module) +
> (reg))
> + OMAP2_L4_IO_ADDRESS(OMAP4430_CM1_BASE + ((module) &
> (MOD_MASK)) + (reg))
> #define OMAP44XX_CM2_REGADDR(module, reg) \
> - OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE + (module) +
> (reg))
> + OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE + ((module) &
> (MOD_MASK)) + (reg))
>
> #include "cm44xx.h"
>
> diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-
> common.h
> index 995b7ed..b93d33e 100644
> --- a/arch/arm/mach-omap2/prcm-common.h
> +++ b/arch/arm/mach-omap2/prcm-common.h
> @@ -57,10 +57,26 @@
> #define BITFIELD(l_bit, u_bit) \
> (BITS(u_bit) & ~((BITS(l_bit)) >> 1))
>
> -/* OMAP44XX specific module offsets */
> +/*
> + * OMAP44XX specific module offsets
> + * The 16 bit submodule offset is defined for OMAP4 as
> + * <Bit 15> | <Bit 14:13> | <Bit 12:0>
> + * <Sign bit> | <base identifier> | <submodule offset from base>
> + */
>
> -/* CM1 instances */
> +#define DEFAULT_BASE 0x0
> +#define PRM_BASE 0x1
> +#define PRCM_MPU_BASE 0x2
> +#define CM2_BASE 0x3
>
> +#define BASE_ID_SHIFT 13
> +#define MOD_MASK ((1 << BASE_ID_SHIFT)-1)
> +
> +#define PRM_BASE_ID (PRM_BASE << BASE_ID_SHIFT)
> +#define PRCM_MPU_BASE_ID (PRCM_MPU_BASE << BASE_ID_SHIFT)
> +#define CM2_BASE_ID (CM2_BASE << BASE_ID_SHIFT)
> +
> +/* CM1 instances */
> #define OMAP4430_CM1_OCP_SOCKET_MOD 0x0000
> #define OMAP4430_CM1_CKGEN_MOD 0x0100
> #define OMAP4430_CM1_MPU_MOD 0x0300
> @@ -71,19 +87,19 @@
>
> /* CM2 instances */
>
> -#define OMAP4430_CM2_OCP_SOCKET_MOD 0x0000
> -#define OMAP4430_CM2_CKGEN_MOD 0x0100
> -#define OMAP4430_CM2_ALWAYS_ON_MOD 0x0600
> -#define OMAP4430_CM2_CORE_MOD 0x0700
> -#define OMAP4430_CM2_IVAHD_MOD 0x0f00
> -#define OMAP4430_CM2_CAM_MOD 0x1000
> -#define OMAP4430_CM2_DSS_MOD 0x1100
> -#define OMAP4430_CM2_GFX_MOD 0x1200
> -#define OMAP4430_CM2_L3INIT_MOD 0x1300
> -#define OMAP4430_CM2_L4PER_MOD 0x1400
> -#define OMAP4430_CM2_CEFUSE_MOD 0x1600
> -#define OMAP4430_CM2_RESTORE_MOD 0x1e00
> -#define OMAP4430_CM2_INSTR_MOD 0x1f00
> +#define OMAP4430_CM2_OCP_SOCKET_MOD 0x0000 | CM2_BASE_ID
> +#define OMAP4430_CM2_CKGEN_MOD 0x0100 | CM2_BASE_ID
> +#define OMAP4430_CM2_ALWAYS_ON_MOD 0x0600 | CM2_BASE_ID
> +#define OMAP4430_CM2_CORE_MOD 0x0700 | CM2_BASE_ID
> +#define OMAP4430_CM2_IVAHD_MOD 0x0f00 | CM2_BASE_ID
> +#define OMAP4430_CM2_CAM_MOD 0x1000 | CM2_BASE_ID
> +#define OMAP4430_CM2_DSS_MOD 0x1100 | CM2_BASE_ID
> +#define OMAP4430_CM2_GFX_MOD 0x1200 | CM2_BASE_ID
> +#define OMAP4430_CM2_L3INIT_MOD 0x1300 | CM2_BASE_ID
> +#define OMAP4430_CM2_L4PER_MOD 0x1400 | CM2_BASE_ID
> +#define OMAP4430_CM2_CEFUSE_MOD 0x1600 | CM2_BASE_ID
> +#define OMAP4430_CM2_RESTORE_MOD 0x1e00 | CM2_BASE_ID
> +#define OMAP4430_CM2_INSTR_MOD 0x1f00 | CM2_BASE_ID
>
> /* PRM instances */
>
> @@ -102,9 +118,9 @@
> #define OMAP4430_PRM_L4PER_MOD 0x1400
> #define OMAP4430_PRM_CEFUSE_MOD 0x1600
> #define OMAP4430_PRM_WKUP_MOD 0x1700
> -#define OMAP4430_PRM_WKUP_CM_MOD 0x1800
> +#define OMAP4430_PRM_WKUP_CM_MOD 0x1800 | PRM_BASE_ID
> #define OMAP4430_PRM_EMU_MOD 0x1900
> -#define OMAP4430_PRM_EMU_CM_MOD 0x1a00
> +#define OMAP4430_PRM_EMU_CM_MOD 0x1a00 | PRM_BASE_ID
> #define OMAP4430_PRM_DEVICE_MOD 0x1b00
> #define OMAP4430_PRM_INSTR_MOD 0x1f00
>
> @@ -114,10 +130,10 @@
>
> /* PRCM_MPU instances */
>
> -#define OMAP4430_PRCM_MPU_OCP_SOCKET_PRCM_MOD 0x0000
> -#define OMAP4430_PRCM_MPU_DEVICE_PRM_MOD 0x0200
> -#define OMAP4430_PRCM_MPU_CPU0_MOD 0x0400
> -#define OMAP4430_PRCM_MPU_CPU1_MOD 0x0800
> +#define OMAP4430_PRCM_MPU_OCP_SOCKET_PRCM_MOD 0x0000 |
> PRCM_MPU_BASE_ID
> +#define OMAP4430_PRCM_MPU_DEVICE_PRM_MOD 0x0200 |
> PRCM_MPU_BASE_ID
> +#define OMAP4430_PRCM_MPU_CPU0_MOD 0x0400 |
> PRCM_MPU_BASE_ID
> +#define OMAP4430_PRCM_MPU_CPU1_MOD 0x0800 |
> PRCM_MPU_BASE_ID
>
>
> /* 24XX register bits shared between CM & PRM registers */
> diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
> index 4df30d0..124e866 100644
> --- a/arch/arm/mach-omap2/prcm.c
> +++ b/arch/arm/mach-omap2/prcm.c
> @@ -182,13 +182,40 @@ static inline void __omap_prcm_write(u32 value, void
> __iomem *base,
> /* Read a register in a PRM module */
> u32 prm_read_mod_reg(s16 module, u16 idx)
> {
> - return __omap_prcm_read(prm_base, module, idx);
> + u32 base = 0;
> +
> + base = abs(module) >> BASE_ID_SHIFT;
> + module &= MOD_MASK;
> +
> + switch (base) {
> + case PRCM_MPU_BASE:
> + return __omap_prcm_read(prcm_mpu_base, module, idx);
> + case DEFAULT_BASE:
> + return __omap_prcm_read(prm_base, module, idx);
> + default:
> + pr_err("Unknown PRM submodule base\n");
> + }
> + return 0;
> }
>
> /* Write into a register in a PRM module */
> void prm_write_mod_reg(u32 val, s16 module, u16 idx)
> {
> - __omap_prcm_write(val, prm_base, module, idx);
> + u32 base = 0;
> +
> + base = abs(module) >> BASE_ID_SHIFT;
> +
> + switch (base) {
> + case PRCM_MPU_BASE:
> + __omap_prcm_write(val, prcm_mpu_base, module, idx);
> + break;
> + case DEFAULT_BASE:
> + __omap_prcm_write(val, prm_base, module, idx);
> + break;
> + default:
> + pr_err("Unknown PRM submodule base\n");
> + break;
> + }
> }
>
> /* Read-modify-write a register in a PRM module. Caller must lock */
> @@ -219,13 +246,46 @@ u32 prm_read_mod_bits_shift(s16 domain, s16 idx, u32
> mask)
> /* Read a register in a CM module */
> u32 cm_read_mod_reg(s16 module, u16 idx)
> {
> - return __omap_prcm_read(cm_base, module, idx);
> + u32 base = 0;
> +
> + base = abs(module) >> BASE_ID_SHIFT;
> + module &= MOD_MASK;
> +
> + switch (base) {
> + case PRM_BASE:
> + return __omap_prcm_read(prm_base, module, idx);
> + case CM2_BASE:
> + return __omap_prcm_read(cm2_base, module, idx);
> + case DEFAULT_BASE:
> + return __omap_prcm_read(cm_base, module, idx);
> + default:
> + pr_err("Unknown CM submodule base\n");
> + }
> + return 0;
> }
>
> /* Write into a register in a CM module */
> void cm_write_mod_reg(u32 val, s16 module, u16 idx)
> {
> - __omap_prcm_write(val, cm_base, module, idx);
> + u32 base = 0;
> +
> + base = abs(module) >> BASE_ID_SHIFT;
> + module &= MOD_MASK;
> +
> + switch (base) {
> + case PRM_BASE:
> + __omap_prcm_write(val, prm_base, module, idx);
> + break;
> + case CM2_BASE:
> + __omap_prcm_write(val, cm2_base, module, idx);
> + break;
> + case DEFAULT_BASE:
> + __omap_prcm_write(val, cm_base, module, idx);
> + break;
> + default:
> + pr_err("Unknown CM submodule base\n");
> + break;
> + }
> }
>
> /* Read-modify-write a register in a CM module. Caller must lock */
> diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h
> index 588873b..72456cc 100644
> --- a/arch/arm/mach-omap2/prm.h
> +++ b/arch/arm/mach-omap2/prm.h
> @@ -23,9 +23,9 @@
> #define OMAP34XX_PRM_REGADDR(module, reg) \
> OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg))
> #define OMAP44XX_PRM_REGADDR(module, reg) \
> - OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE + (module) + (reg))
> + OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE + ((module) &
> (MOD_MASK)) + (reg))
> #define OMAP44XX_PRCM_MPU_REGADDR(module, reg) \
> - OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE + (module) +
> (reg))
> + OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE + ((module) &
> (MOD_MASK)) + (reg))
>
> #include "prm44xx.h"
>
> --
> 1.7.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC][PATCH 2/2] OMAP4: PRCM: Fix usage of prm/cm accessor api's for OMAP4
2010-08-10 15:02 ` [RFC][PATCH 2/2] OMAP4: PRCM: Fix usage of prm/cm accessor api's for OMAP4 Rajendra Nayak
2010-08-24 21:39 ` Kevin Hilman
2010-09-23 14:15 ` Nayak, Rajendra
@ 2010-10-14 18:44 ` Paul Walmsley
2010-10-15 16:07 ` Cousson, Benoit
2 siblings, 1 reply; 10+ messages in thread
From: Paul Walmsley @ 2010-10-14 18:44 UTC (permalink / raw)
To: Rajendra Nayak; +Cc: linux-omap, khilman, b-cousson
Hello Rajendra,
On Tue, 10 Aug 2010, Rajendra Nayak wrote:
> OMAP's have always had PRCM split into PRM for power and reset
> management and CM for clock management.
> In OMAP4 the split (physically) is not very straight forward and
> there are instances of clock management control registers in PRM
> and vice versa.
> However it still makes sense, even on OMAP4 to logically split
> PRCM into PRM and CM for better understanding and to avoid adding
> additonal complexity in higher level frameworks which rely on the
> accessor api;s to do the low level register accesses.
>
> Hence this patch makes sure that any clock management code can
> use the cm_read/write* accessor apis (without knowing the physical split)
> and power and reset management code can use prm_read/write*
> accessor api;s.
>
> To do this the submodule offsets within PRM/CM1 and CM2 have additonal
> info embedded in them specifying what base address to use while
> trying to access registers in the given submodule.
>
> The 16 bit signed submodule offset is defined for OMAP4 as
> <Bit 15> | <Bit 14:13> | <Bit 12:0>
> <Sign bit> | <base identifier> | <submodule offset from base>
The concern that I have with embedding multiple parameters into a single
parameter is that it seems like a hack. Why not add an extra parameter
for the base identifier, rather than packing it into an existing
parameter?
I am not necessarily opposed to your patch as it exists. But I would like
to hear your opinions first on separating out the base identifier
parameter as a separate function parameter, and then adding an extra field
for it into any data structure that would need it. Could you write
briefly if you see any significant advantages/disadvantages to that
approach?
> For older OMAP's the base identifier is always set to 0.
>
> Signed-off-by: Rajendra Nayak <rnayak@ti.com>
> Cc: Kevin Hilman <khilman@deeprootsystems.com>
> Cc: Paul Walmsley <paul@pwsan.com>
> Cc: Benoit Cousson <b-cousson@ti.com>
> ---
> arch/arm/mach-omap2/cm.h | 4 +-
> arch/arm/mach-omap2/prcm-common.h | 58 ++++++++++++++++++++-----------
> arch/arm/mach-omap2/prcm.c | 68 ++++++++++++++++++++++++++++++++++--
> arch/arm/mach-omap2/prm.h | 4 +-
> 4 files changed, 105 insertions(+), 29 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h
> index a02ca30..7b7ef09 100644
> --- a/arch/arm/mach-omap2/cm.h
> +++ b/arch/arm/mach-omap2/cm.h
> @@ -23,9 +23,9 @@
> #define OMAP34XX_CM_REGADDR(module, reg) \
> OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg))
> #define OMAP44XX_CM1_REGADDR(module, reg) \
> - OMAP2_L4_IO_ADDRESS(OMAP4430_CM1_BASE + (module) + (reg))
> + OMAP2_L4_IO_ADDRESS(OMAP4430_CM1_BASE + ((module) & (MOD_MASK)) + (reg))
> #define OMAP44XX_CM2_REGADDR(module, reg) \
> - OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE + (module) + (reg))
> + OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE + ((module) & (MOD_MASK)) + (reg))
>
> #include "cm44xx.h"
>
> diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h
> index 995b7ed..b93d33e 100644
> --- a/arch/arm/mach-omap2/prcm-common.h
> +++ b/arch/arm/mach-omap2/prcm-common.h
> @@ -57,10 +57,26 @@
> #define BITFIELD(l_bit, u_bit) \
> (BITS(u_bit) & ~((BITS(l_bit)) >> 1))
>
> -/* OMAP44XX specific module offsets */
> +/*
> + * OMAP44XX specific module offsets
> + * The 16 bit submodule offset is defined for OMAP4 as
> + * <Bit 15> | <Bit 14:13> | <Bit 12:0>
> + * <Sign bit> | <base identifier> | <submodule offset from base>
> + */
>
> -/* CM1 instances */
> +#define DEFAULT_BASE 0x0
> +#define PRM_BASE 0x1
> +#define PRCM_MPU_BASE 0x2
> +#define CM2_BASE 0x3
>
> +#define BASE_ID_SHIFT 13
> +#define MOD_MASK ((1 << BASE_ID_SHIFT)-1)
> +
> +#define PRM_BASE_ID (PRM_BASE << BASE_ID_SHIFT)
> +#define PRCM_MPU_BASE_ID (PRCM_MPU_BASE << BASE_ID_SHIFT)
> +#define CM2_BASE_ID (CM2_BASE << BASE_ID_SHIFT)
> +
> +/* CM1 instances */
> #define OMAP4430_CM1_OCP_SOCKET_MOD 0x0000
> #define OMAP4430_CM1_CKGEN_MOD 0x0100
> #define OMAP4430_CM1_MPU_MOD 0x0300
> @@ -71,19 +87,19 @@
>
> /* CM2 instances */
>
> -#define OMAP4430_CM2_OCP_SOCKET_MOD 0x0000
> -#define OMAP4430_CM2_CKGEN_MOD 0x0100
> -#define OMAP4430_CM2_ALWAYS_ON_MOD 0x0600
> -#define OMAP4430_CM2_CORE_MOD 0x0700
> -#define OMAP4430_CM2_IVAHD_MOD 0x0f00
> -#define OMAP4430_CM2_CAM_MOD 0x1000
> -#define OMAP4430_CM2_DSS_MOD 0x1100
> -#define OMAP4430_CM2_GFX_MOD 0x1200
> -#define OMAP4430_CM2_L3INIT_MOD 0x1300
> -#define OMAP4430_CM2_L4PER_MOD 0x1400
> -#define OMAP4430_CM2_CEFUSE_MOD 0x1600
> -#define OMAP4430_CM2_RESTORE_MOD 0x1e00
> -#define OMAP4430_CM2_INSTR_MOD 0x1f00
> +#define OMAP4430_CM2_OCP_SOCKET_MOD 0x0000 | CM2_BASE_ID
> +#define OMAP4430_CM2_CKGEN_MOD 0x0100 | CM2_BASE_ID
> +#define OMAP4430_CM2_ALWAYS_ON_MOD 0x0600 | CM2_BASE_ID
> +#define OMAP4430_CM2_CORE_MOD 0x0700 | CM2_BASE_ID
> +#define OMAP4430_CM2_IVAHD_MOD 0x0f00 | CM2_BASE_ID
> +#define OMAP4430_CM2_CAM_MOD 0x1000 | CM2_BASE_ID
> +#define OMAP4430_CM2_DSS_MOD 0x1100 | CM2_BASE_ID
> +#define OMAP4430_CM2_GFX_MOD 0x1200 | CM2_BASE_ID
> +#define OMAP4430_CM2_L3INIT_MOD 0x1300 | CM2_BASE_ID
> +#define OMAP4430_CM2_L4PER_MOD 0x1400 | CM2_BASE_ID
> +#define OMAP4430_CM2_CEFUSE_MOD 0x1600 | CM2_BASE_ID
> +#define OMAP4430_CM2_RESTORE_MOD 0x1e00 | CM2_BASE_ID
> +#define OMAP4430_CM2_INSTR_MOD 0x1f00 | CM2_BASE_ID
>
> /* PRM instances */
>
> @@ -102,9 +118,9 @@
> #define OMAP4430_PRM_L4PER_MOD 0x1400
> #define OMAP4430_PRM_CEFUSE_MOD 0x1600
> #define OMAP4430_PRM_WKUP_MOD 0x1700
> -#define OMAP4430_PRM_WKUP_CM_MOD 0x1800
> +#define OMAP4430_PRM_WKUP_CM_MOD 0x1800 | PRM_BASE_ID
> #define OMAP4430_PRM_EMU_MOD 0x1900
> -#define OMAP4430_PRM_EMU_CM_MOD 0x1a00
> +#define OMAP4430_PRM_EMU_CM_MOD 0x1a00 | PRM_BASE_ID
> #define OMAP4430_PRM_DEVICE_MOD 0x1b00
> #define OMAP4430_PRM_INSTR_MOD 0x1f00
>
> @@ -114,10 +130,10 @@
>
> /* PRCM_MPU instances */
>
> -#define OMAP4430_PRCM_MPU_OCP_SOCKET_PRCM_MOD 0x0000
> -#define OMAP4430_PRCM_MPU_DEVICE_PRM_MOD 0x0200
> -#define OMAP4430_PRCM_MPU_CPU0_MOD 0x0400
> -#define OMAP4430_PRCM_MPU_CPU1_MOD 0x0800
> +#define OMAP4430_PRCM_MPU_OCP_SOCKET_PRCM_MOD 0x0000 | PRCM_MPU_BASE_ID
> +#define OMAP4430_PRCM_MPU_DEVICE_PRM_MOD 0x0200 | PRCM_MPU_BASE_ID
> +#define OMAP4430_PRCM_MPU_CPU0_MOD 0x0400 | PRCM_MPU_BASE_ID
> +#define OMAP4430_PRCM_MPU_CPU1_MOD 0x0800 | PRCM_MPU_BASE_ID
>
>
> /* 24XX register bits shared between CM & PRM registers */
> diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
> index 4df30d0..124e866 100644
> --- a/arch/arm/mach-omap2/prcm.c
> +++ b/arch/arm/mach-omap2/prcm.c
> @@ -182,13 +182,40 @@ static inline void __omap_prcm_write(u32 value, void __iomem *base,
> /* Read a register in a PRM module */
> u32 prm_read_mod_reg(s16 module, u16 idx)
> {
> - return __omap_prcm_read(prm_base, module, idx);
> + u32 base = 0;
> +
> + base = abs(module) >> BASE_ID_SHIFT;
> + module &= MOD_MASK;
> +
> + switch (base) {
> + case PRCM_MPU_BASE:
> + return __omap_prcm_read(prcm_mpu_base, module, idx);
> + case DEFAULT_BASE:
> + return __omap_prcm_read(prm_base, module, idx);
> + default:
> + pr_err("Unknown PRM submodule base\n");
> + }
> + return 0;
> }
>
> /* Write into a register in a PRM module */
> void prm_write_mod_reg(u32 val, s16 module, u16 idx)
> {
> - __omap_prcm_write(val, prm_base, module, idx);
> + u32 base = 0;
> +
> + base = abs(module) >> BASE_ID_SHIFT;
> +
> + switch (base) {
> + case PRCM_MPU_BASE:
> + __omap_prcm_write(val, prcm_mpu_base, module, idx);
> + break;
> + case DEFAULT_BASE:
> + __omap_prcm_write(val, prm_base, module, idx);
> + break;
> + default:
> + pr_err("Unknown PRM submodule base\n");
> + break;
> + }
> }
>
> /* Read-modify-write a register in a PRM module. Caller must lock */
> @@ -219,13 +246,46 @@ u32 prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
> /* Read a register in a CM module */
> u32 cm_read_mod_reg(s16 module, u16 idx)
> {
> - return __omap_prcm_read(cm_base, module, idx);
> + u32 base = 0;
> +
> + base = abs(module) >> BASE_ID_SHIFT;
> + module &= MOD_MASK;
> +
> + switch (base) {
> + case PRM_BASE:
> + return __omap_prcm_read(prm_base, module, idx);
> + case CM2_BASE:
> + return __omap_prcm_read(cm2_base, module, idx);
> + case DEFAULT_BASE:
> + return __omap_prcm_read(cm_base, module, idx);
> + default:
> + pr_err("Unknown CM submodule base\n");
> + }
> + return 0;
> }
>
> /* Write into a register in a CM module */
> void cm_write_mod_reg(u32 val, s16 module, u16 idx)
> {
> - __omap_prcm_write(val, cm_base, module, idx);
> + u32 base = 0;
> +
> + base = abs(module) >> BASE_ID_SHIFT;
> + module &= MOD_MASK;
> +
> + switch (base) {
> + case PRM_BASE:
> + __omap_prcm_write(val, prm_base, module, idx);
> + break;
> + case CM2_BASE:
> + __omap_prcm_write(val, cm2_base, module, idx);
> + break;
> + case DEFAULT_BASE:
> + __omap_prcm_write(val, cm_base, module, idx);
> + break;
> + default:
> + pr_err("Unknown CM submodule base\n");
> + break;
> + }
> }
>
> /* Read-modify-write a register in a CM module. Caller must lock */
> diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h
> index 588873b..72456cc 100644
> --- a/arch/arm/mach-omap2/prm.h
> +++ b/arch/arm/mach-omap2/prm.h
> @@ -23,9 +23,9 @@
> #define OMAP34XX_PRM_REGADDR(module, reg) \
> OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg))
> #define OMAP44XX_PRM_REGADDR(module, reg) \
> - OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE + (module) + (reg))
> + OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE + ((module) & (MOD_MASK)) + (reg))
> #define OMAP44XX_PRCM_MPU_REGADDR(module, reg) \
> - OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE + (module) + (reg))
> + OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE + ((module) & (MOD_MASK)) + (reg))
>
> #include "prm44xx.h"
>
> --
> 1.7.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
- Paul
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC][PATCH 2/2] OMAP4: PRCM: Fix usage of prm/cm accessor api's for OMAP4
2010-10-14 18:44 ` Paul Walmsley
@ 2010-10-15 16:07 ` Cousson, Benoit
2010-10-18 22:52 ` Tony Lindgren
0 siblings, 1 reply; 10+ messages in thread
From: Cousson, Benoit @ 2010-10-15 16:07 UTC (permalink / raw)
To: Paul Walmsley; +Cc: Nayak, Rajendra, linux-omap, khilman
Hi Paul,
On 10/14/2010 8:44 PM, Paul Walmsley wrote:
> Hello Rajendra,
>
> On Tue, 10 Aug 2010, Rajendra Nayak wrote:
>
>> OMAP's have always had PRCM split into PRM for power and reset
>> management and CM for clock management.
>> In OMAP4 the split (physically) is not very straight forward and
>> there are instances of clock management control registers in PRM
>> and vice versa.
>> However it still makes sense, even on OMAP4 to logically split
>> PRCM into PRM and CM for better understanding and to avoid adding
>> additonal complexity in higher level frameworks which rely on the
>> accessor api;s to do the low level register accesses.
>>
>> Hence this patch makes sure that any clock management code can
>> use the cm_read/write* accessor apis (without knowing the physical split)
>> and power and reset management code can use prm_read/write*
>> accessor api;s.
>>
>> To do this the submodule offsets within PRM/CM1 and CM2 have additonal
>> info embedded in them specifying what base address to use while
>> trying to access registers in the given submodule.
>>
>> The 16 bit signed submodule offset is defined for OMAP4 as
>> <Bit 15> |<Bit 14:13> |<Bit 12:0>
>> <Sign bit> |<base identifier> |<submodule offset from base>
>
> The concern that I have with embedding multiple parameters into a single
> parameter is that it seems like a hack. Why not add an extra parameter
> for the base identifier, rather than packing it into an existing
> parameter?
The primary constraint that lead us to that proposal was to minimize the
impact on the existing code and API for previous OMAPs.
That was clearly the goal #1.
The other one was the relative simplicity of the implementation.
The user of these OMAP4430_XXXX_MOD macros does not have to care if this
is a real offset or just an id.
> I am not necessarily opposed to your patch as it exists. But I would like
> to hear your opinions first on separating out the base identifier
> parameter as a separate function parameter, and then adding an extra field
> for it into any data structure that would need it. Could you write
> briefly if you see any significant advantages/disadvantages to that
> approach?
The disadvantage is the relative complexity for the caller of this API,
that will have to know what partition should be used.
It is fine if the caller is the powerdomain or clockdomain fmwk, but
what about all the other callers we have here and there?
When we looked at that in Bangalore, we realized that a bunch of code is
using these prm/cm APIs. Maybe some cleanup can be done, like in the
save / restore part, but we still have some user of that.
For the moment, I do not really see any advantage of such approach.
The partitioning is changing on every OMAPs, so we do have to abstract
that. If it is not done at that level, we will have to define another
API on top of that to do exactly the same job.
Regards,
Benoit
>
>> For older OMAP's the base identifier is always set to 0.
>>
>> Signed-off-by: Rajendra Nayak<rnayak@ti.com>
>> Cc: Kevin Hilman<khilman@deeprootsystems.com>
>> Cc: Paul Walmsley<paul@pwsan.com>
>> Cc: Benoit Cousson<b-cousson@ti.com>
>> ---
>> arch/arm/mach-omap2/cm.h | 4 +-
>> arch/arm/mach-omap2/prcm-common.h | 58 ++++++++++++++++++++-----------
>> arch/arm/mach-omap2/prcm.c | 68 ++++++++++++++++++++++++++++++++++--
>> arch/arm/mach-omap2/prm.h | 4 +-
>> 4 files changed, 105 insertions(+), 29 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h
>> index a02ca30..7b7ef09 100644
>> --- a/arch/arm/mach-omap2/cm.h
>> +++ b/arch/arm/mach-omap2/cm.h
>> @@ -23,9 +23,9 @@
>> #define OMAP34XX_CM_REGADDR(module, reg) \
>> OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg))
>> #define OMAP44XX_CM1_REGADDR(module, reg) \
>> - OMAP2_L4_IO_ADDRESS(OMAP4430_CM1_BASE + (module) + (reg))
>> + OMAP2_L4_IO_ADDRESS(OMAP4430_CM1_BASE + ((module)& (MOD_MASK)) + (reg))
>> #define OMAP44XX_CM2_REGADDR(module, reg) \
>> - OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE + (module) + (reg))
>> + OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE + ((module)& (MOD_MASK)) + (reg))
>>
>> #include "cm44xx.h"
>>
>> diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h
>> index 995b7ed..b93d33e 100644
>> --- a/arch/arm/mach-omap2/prcm-common.h
>> +++ b/arch/arm/mach-omap2/prcm-common.h
>> @@ -57,10 +57,26 @@
>> #define BITFIELD(l_bit, u_bit) \
>> (BITS(u_bit)& ~((BITS(l_bit))>> 1))
>>
>> -/* OMAP44XX specific module offsets */
>> +/*
>> + * OMAP44XX specific module offsets
>> + * The 16 bit submodule offset is defined for OMAP4 as
>> + *<Bit 15> |<Bit 14:13> |<Bit 12:0>
>> + *<Sign bit> |<base identifier> |<submodule offset from base>
>> + */
>>
>> -/* CM1 instances */
>> +#define DEFAULT_BASE 0x0
>> +#define PRM_BASE 0x1
>> +#define PRCM_MPU_BASE 0x2
>> +#define CM2_BASE 0x3
>>
>> +#define BASE_ID_SHIFT 13
>> +#define MOD_MASK ((1<< BASE_ID_SHIFT)-1)
>> +
>> +#define PRM_BASE_ID (PRM_BASE<< BASE_ID_SHIFT)
>> +#define PRCM_MPU_BASE_ID (PRCM_MPU_BASE<< BASE_ID_SHIFT)
>> +#define CM2_BASE_ID (CM2_BASE<< BASE_ID_SHIFT)
>> +
>> +/* CM1 instances */
>> #define OMAP4430_CM1_OCP_SOCKET_MOD 0x0000
>> #define OMAP4430_CM1_CKGEN_MOD 0x0100
>> #define OMAP4430_CM1_MPU_MOD 0x0300
>> @@ -71,19 +87,19 @@
>>
>> /* CM2 instances */
>>
>> -#define OMAP4430_CM2_OCP_SOCKET_MOD 0x0000
>> -#define OMAP4430_CM2_CKGEN_MOD 0x0100
>> -#define OMAP4430_CM2_ALWAYS_ON_MOD 0x0600
>> -#define OMAP4430_CM2_CORE_MOD 0x0700
>> -#define OMAP4430_CM2_IVAHD_MOD 0x0f00
>> -#define OMAP4430_CM2_CAM_MOD 0x1000
>> -#define OMAP4430_CM2_DSS_MOD 0x1100
>> -#define OMAP4430_CM2_GFX_MOD 0x1200
>> -#define OMAP4430_CM2_L3INIT_MOD 0x1300
>> -#define OMAP4430_CM2_L4PER_MOD 0x1400
>> -#define OMAP4430_CM2_CEFUSE_MOD 0x1600
>> -#define OMAP4430_CM2_RESTORE_MOD 0x1e00
>> -#define OMAP4430_CM2_INSTR_MOD 0x1f00
>> +#define OMAP4430_CM2_OCP_SOCKET_MOD 0x0000 | CM2_BASE_ID
>> +#define OMAP4430_CM2_CKGEN_MOD 0x0100 | CM2_BASE_ID
>> +#define OMAP4430_CM2_ALWAYS_ON_MOD 0x0600 | CM2_BASE_ID
>> +#define OMAP4430_CM2_CORE_MOD 0x0700 | CM2_BASE_ID
>> +#define OMAP4430_CM2_IVAHD_MOD 0x0f00 | CM2_BASE_ID
>> +#define OMAP4430_CM2_CAM_MOD 0x1000 | CM2_BASE_ID
>> +#define OMAP4430_CM2_DSS_MOD 0x1100 | CM2_BASE_ID
>> +#define OMAP4430_CM2_GFX_MOD 0x1200 | CM2_BASE_ID
>> +#define OMAP4430_CM2_L3INIT_MOD 0x1300 | CM2_BASE_ID
>> +#define OMAP4430_CM2_L4PER_MOD 0x1400 | CM2_BASE_ID
>> +#define OMAP4430_CM2_CEFUSE_MOD 0x1600 | CM2_BASE_ID
>> +#define OMAP4430_CM2_RESTORE_MOD 0x1e00 | CM2_BASE_ID
>> +#define OMAP4430_CM2_INSTR_MOD 0x1f00 | CM2_BASE_ID
>>
>> /* PRM instances */
>>
>> @@ -102,9 +118,9 @@
>> #define OMAP4430_PRM_L4PER_MOD 0x1400
>> #define OMAP4430_PRM_CEFUSE_MOD 0x1600
>> #define OMAP4430_PRM_WKUP_MOD 0x1700
>> -#define OMAP4430_PRM_WKUP_CM_MOD 0x1800
>> +#define OMAP4430_PRM_WKUP_CM_MOD 0x1800 | PRM_BASE_ID
>> #define OMAP4430_PRM_EMU_MOD 0x1900
>> -#define OMAP4430_PRM_EMU_CM_MOD 0x1a00
>> +#define OMAP4430_PRM_EMU_CM_MOD 0x1a00 | PRM_BASE_ID
>> #define OMAP4430_PRM_DEVICE_MOD 0x1b00
>> #define OMAP4430_PRM_INSTR_MOD 0x1f00
>>
>> @@ -114,10 +130,10 @@
>>
>> /* PRCM_MPU instances */
>>
>> -#define OMAP4430_PRCM_MPU_OCP_SOCKET_PRCM_MOD 0x0000
>> -#define OMAP4430_PRCM_MPU_DEVICE_PRM_MOD 0x0200
>> -#define OMAP4430_PRCM_MPU_CPU0_MOD 0x0400
>> -#define OMAP4430_PRCM_MPU_CPU1_MOD 0x0800
>> +#define OMAP4430_PRCM_MPU_OCP_SOCKET_PRCM_MOD 0x0000 | PRCM_MPU_BASE_ID
>> +#define OMAP4430_PRCM_MPU_DEVICE_PRM_MOD 0x0200 | PRCM_MPU_BASE_ID
>> +#define OMAP4430_PRCM_MPU_CPU0_MOD 0x0400 | PRCM_MPU_BASE_ID
>> +#define OMAP4430_PRCM_MPU_CPU1_MOD 0x0800 | PRCM_MPU_BASE_ID
>>
>>
>> /* 24XX register bits shared between CM& PRM registers */
>> diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
>> index 4df30d0..124e866 100644
>> --- a/arch/arm/mach-omap2/prcm.c
>> +++ b/arch/arm/mach-omap2/prcm.c
>> @@ -182,13 +182,40 @@ static inline void __omap_prcm_write(u32 value, void __iomem *base,
>> /* Read a register in a PRM module */
>> u32 prm_read_mod_reg(s16 module, u16 idx)
>> {
>> - return __omap_prcm_read(prm_base, module, idx);
>> + u32 base = 0;
>> +
>> + base = abs(module)>> BASE_ID_SHIFT;
>> + module&= MOD_MASK;
>> +
>> + switch (base) {
>> + case PRCM_MPU_BASE:
>> + return __omap_prcm_read(prcm_mpu_base, module, idx);
>> + case DEFAULT_BASE:
>> + return __omap_prcm_read(prm_base, module, idx);
>> + default:
>> + pr_err("Unknown PRM submodule base\n");
>> + }
>> + return 0;
>> }
>>
>> /* Write into a register in a PRM module */
>> void prm_write_mod_reg(u32 val, s16 module, u16 idx)
>> {
>> - __omap_prcm_write(val, prm_base, module, idx);
>> + u32 base = 0;
>> +
>> + base = abs(module)>> BASE_ID_SHIFT;
>> +
>> + switch (base) {
>> + case PRCM_MPU_BASE:
>> + __omap_prcm_write(val, prcm_mpu_base, module, idx);
>> + break;
>> + case DEFAULT_BASE:
>> + __omap_prcm_write(val, prm_base, module, idx);
>> + break;
>> + default:
>> + pr_err("Unknown PRM submodule base\n");
>> + break;
>> + }
>> }
>>
>> /* Read-modify-write a register in a PRM module. Caller must lock */
>> @@ -219,13 +246,46 @@ u32 prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
>> /* Read a register in a CM module */
>> u32 cm_read_mod_reg(s16 module, u16 idx)
>> {
>> - return __omap_prcm_read(cm_base, module, idx);
>> + u32 base = 0;
>> +
>> + base = abs(module)>> BASE_ID_SHIFT;
>> + module&= MOD_MASK;
>> +
>> + switch (base) {
>> + case PRM_BASE:
>> + return __omap_prcm_read(prm_base, module, idx);
>> + case CM2_BASE:
>> + return __omap_prcm_read(cm2_base, module, idx);
>> + case DEFAULT_BASE:
>> + return __omap_prcm_read(cm_base, module, idx);
>> + default:
>> + pr_err("Unknown CM submodule base\n");
>> + }
>> + return 0;
>> }
>>
>> /* Write into a register in a CM module */
>> void cm_write_mod_reg(u32 val, s16 module, u16 idx)
>> {
>> - __omap_prcm_write(val, cm_base, module, idx);
>> + u32 base = 0;
>> +
>> + base = abs(module)>> BASE_ID_SHIFT;
>> + module&= MOD_MASK;
>> +
>> + switch (base) {
>> + case PRM_BASE:
>> + __omap_prcm_write(val, prm_base, module, idx);
>> + break;
>> + case CM2_BASE:
>> + __omap_prcm_write(val, cm2_base, module, idx);
>> + break;
>> + case DEFAULT_BASE:
>> + __omap_prcm_write(val, cm_base, module, idx);
>> + break;
>> + default:
>> + pr_err("Unknown CM submodule base\n");
>> + break;
>> + }
>> }
>>
>> /* Read-modify-write a register in a CM module. Caller must lock */
>> diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h
>> index 588873b..72456cc 100644
>> --- a/arch/arm/mach-omap2/prm.h
>> +++ b/arch/arm/mach-omap2/prm.h
>> @@ -23,9 +23,9 @@
>> #define OMAP34XX_PRM_REGADDR(module, reg) \
>> OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg))
>> #define OMAP44XX_PRM_REGADDR(module, reg) \
>> - OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE + (module) + (reg))
>> + OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE + ((module)& (MOD_MASK)) + (reg))
>> #define OMAP44XX_PRCM_MPU_REGADDR(module, reg) \
>> - OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE + (module) + (reg))
>> + OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE + ((module)& (MOD_MASK)) + (reg))
>>
>> #include "prm44xx.h"
>>
>> --
>> 1.7.0.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>
>
> - Paul
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC][PATCH 2/2] OMAP4: PRCM: Fix usage of prm/cm accessor api's for OMAP4
2010-10-15 16:07 ` Cousson, Benoit
@ 2010-10-18 22:52 ` Tony Lindgren
0 siblings, 0 replies; 10+ messages in thread
From: Tony Lindgren @ 2010-10-18 22:52 UTC (permalink / raw)
To: Cousson, Benoit; +Cc: Paul Walmsley, Nayak, Rajendra, linux-omap, khilman
* Cousson, Benoit <b-cousson@ti.com> [101015 08:58]:
> Hi Paul,
>
> On 10/14/2010 8:44 PM, Paul Walmsley wrote:
> >Hello Rajendra,
> >
> >On Tue, 10 Aug 2010, Rajendra Nayak wrote:
> >
> >>OMAP's have always had PRCM split into PRM for power and reset
> >>management and CM for clock management.
> >>In OMAP4 the split (physically) is not very straight forward and
> >>there are instances of clock management control registers in PRM
> >>and vice versa.
> >>However it still makes sense, even on OMAP4 to logically split
> >>PRCM into PRM and CM for better understanding and to avoid adding
> >>additonal complexity in higher level frameworks which rely on the
> >>accessor api;s to do the low level register accesses.
> >>
> >>Hence this patch makes sure that any clock management code can
> >>use the cm_read/write* accessor apis (without knowing the physical split)
> >>and power and reset management code can use prm_read/write*
> >>accessor api;s.
> >>
> >>To do this the submodule offsets within PRM/CM1 and CM2 have additonal
> >>info embedded in them specifying what base address to use while
> >>trying to access registers in the given submodule.
> >>
> >>The 16 bit signed submodule offset is defined for OMAP4 as
> >><Bit 15> |<Bit 14:13> |<Bit 12:0>
> >><Sign bit> |<base identifier> |<submodule offset from base>
> >
> >The concern that I have with embedding multiple parameters into a single
> >parameter is that it seems like a hack. Why not add an extra parameter
> >for the base identifier, rather than packing it into an existing
> >parameter?
>
> The primary constraint that lead us to that proposal was to minimize
> the impact on the existing code and API for previous OMAPs.
> That was clearly the goal #1.
> The other one was the relative simplicity of the implementation.
>
> The user of these OMAP4430_XXXX_MOD macros does not have to care if
> this is a real offset or just an id.
>
> >I am not necessarily opposed to your patch as it exists. But I would like
> >to hear your opinions first on separating out the base identifier
> >parameter as a separate function parameter, and then adding an extra field
> >for it into any data structure that would need it. Could you write
> >briefly if you see any significant advantages/disadvantages to that
> >approach?
>
> The disadvantage is the relative complexity for the caller of this
> API, that will have to know what partition should be used.
> It is fine if the caller is the powerdomain or clockdomain fmwk, but
> what about all the other callers we have here and there?
> When we looked at that in Bangalore, we realized that a bunch of
> code is using these prm/cm APIs. Maybe some cleanup can be done,
> like in the save / restore part, but we still have some user of
> that.
>
> For the moment, I do not really see any advantage of such approach.
> The partitioning is changing on every OMAPs, so we do have to
> abstract that. If it is not done at that level, we will have to
> define another API on top of that to do exactly the same job.
I think we should be able to deal with the partitions properly
by ioremapping them separately as needed. Might as well do it now.
Regards,
Tony
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2010-10-18 22:53 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-10 15:02 [RFC][PATCH 0/2] Fix prm/cm accessor api's usage on OMAP4 Rajendra Nayak
2010-08-10 15:02 ` [RFC][PATCH 1/2] OMAP4: PRCM: Add prcm_mpu_base to omap_globals Rajendra Nayak
2010-08-10 15:02 ` [RFC][PATCH 2/2] OMAP4: PRCM: Fix usage of prm/cm accessor api's for OMAP4 Rajendra Nayak
2010-08-24 21:39 ` Kevin Hilman
2010-08-25 8:56 ` Nayak, Rajendra
2010-08-25 18:16 ` Kevin Hilman
2010-09-23 14:15 ` Nayak, Rajendra
2010-10-14 18:44 ` Paul Walmsley
2010-10-15 16:07 ` Cousson, Benoit
2010-10-18 22:52 ` Tony Lindgren
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.