Skip to contentSkip to conversation

ARM: OMAP2+: Add voltagedomain, powerdomain & PRM support for AM33XX device

PATCH Superseded Vaibhav Hiremath 6 participants 32 messages Mar 30, 2012 – May 29, 2012

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v4 cover ARM: OMAP2+: Add voltagedomain, powerdomain & PRM support for AM33XX device

After some healthy discussion, now we have come to the conclusion and decided to handle AM33XX PRM/CM part separately; as AM33XX-PRCM module is different than OMAP3 and OMAP4 architecture.

The difference becomes very interesting/weird when it comes to the consistency for register offsets in PRM address space and bit-field offsets inside PRM registers,
So along with Powerdomain data and PRM api's required for AM33XX device, this patch series adds,

- XXX_RSTST register offset to "struct omap_hwmod_omap4_prcm"
- PWRSTCTRL & PWRSTST register offsets to "struct powerdomain"
- Logicretstate and mem_on/ret/pwrst/retst mask to "struct powerdomain"

Testing: This patch series has been boot tested on AM37xEVM and AM335x
based BeagleBone community board.

Thanks to Paul here...for helping and concluding on this, shortly I will submit similar patch for CM, clockdomain and clock-tree support for AM33xx.

This patch-series is created on top of "linux-omap/cleanup" branch, and also gets applied to "linux-omap/master" branch.
The patches are also available at -
https://github.com/hvaibhav/am335x-linux/tree/am335x-prm-cm

Changes from previous versions:
===============================

Quoted 1 line

From V3:

- No code change, only added Voltagedomain patch (from V2 series) to this series.

Quoted 1 line

From V1 & V2:

- Rolled back to my original approach, where AM33xx device was handled separately (RFC version).
- As per Paul's comments, added Register offsets & bit-fields masks.

Vaibhav Hiremath (4):
ARM: OMAP3+: am33xx: Add voltage domain data
ARM: OMAP3/4: omap_hwmod: Add rstst_off field to struct
omap_hwmod_omap4_prcm
ARM: OMAP2+: powerdomain: Add offset & mask fields to struct
powerdomain
ARM: OMAP3+: am33xx: Add powerdomain & PRM support

 arch/arm/mach-omap2/Makefile                  |    6 +
 arch/arm/mach-omap2/io.c                      |    2 +
 arch/arm/mach-omap2/omap_hwmod.c              |   32 ++-
 arch/arm/mach-omap2/powerdomain.h             |   23 ++-
 arch/arm/mach-omap2/powerdomain33xx.c         |  230 ++++++++++++++++
 arch/arm/mach-omap2/powerdomains33xx_data.c   |  185 +++++++++++++
 arch/arm/mach-omap2/prm-regbits-33xx.h        |  357 +++++++++++++++++++++++++
 arch/arm/mach-omap2/prm33xx.c                 |  134 +++++++++
 arch/arm/mach-omap2/prm33xx.h                 |  129 +++++++++
 arch/arm/mach-omap2/voltage.h                 |    1 +
 arch/arm/mach-omap2/voltagedomains33xx_data.c |   43 +++
 arch/arm/plat-omap/include/plat/omap_hwmod.h  |    2 +
 12 files changed, 1139 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/mach-omap2/powerdomain33xx.c
 create mode 100644 arch/arm/mach-omap2/powerdomains33xx_data.c
 create mode 100644 arch/arm/mach-omap2/prm-regbits-33xx.h
 create mode 100644 arch/arm/mach-omap2/prm33xx.c
 create mode 100644 arch/arm/mach-omap2/prm33xx.h
 create mode 100644 arch/arm/mach-omap2/voltagedomains33xx_data.c
#1 lore raw

PATCH v4 1/4 ARM: OMAP3+: am33xx: Add voltage domain data

Currently dummy voltage domain data is being created in order to succeed boot process, nothing has been done w.r.t actual hardware (voltage control).

Also, hook up the AM33XX voltage domain to OMAP framework.

Cc Benoit Cousson <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Rajendra Nayak <[email protected]>
---
 arch/arm/mach-omap2/Makefile                  |    2 +
 arch/arm/mach-omap2/io.c                      |    1 +
 arch/arm/mach-omap2/voltage.h                 |    1 +
 arch/arm/mach-omap2/voltagedomains33xx_data.c |   43 +++++++++++++++++++++++++
 4 files changed, 47 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/voltagedomains33xx_data.c
arch/arm/mach-omap2/Makefile +2 -0
index 74ae499..8d90f9f 100644
@@ -99,6 +99,8 @@ obj-$(CONFIG_ARCH_OMAP2)		+= $(voltagedomain-common) \
 					   voltagedomains2xxx_data.o
 obj-$(CONFIG_ARCH_OMAP3)		+= $(voltagedomain-common) \
 					   voltagedomains3xxx_data.o
+obj-$(CONFIG_SOC_OMAPAM33XX)		+= $(voltagedomain-common) \
+					   voltagedomains33xx_data.o
 obj-$(CONFIG_ARCH_OMAP4)		+= $(voltagedomain-common) \
 					   voltagedomains44xx_data.o
 
arch/arm/mach-omap2/io.c +1 -0
index 51d4df8..523fb6d 100644
@@ -466,6 +466,7 @@ void __init am33xx_init_early(void)
 {
 	omap2_set_globals_am33xx();
 	omap_common_init_early();
+	am33xx_voltagedomains_init();
 	omap3xxx_clk_init();
 }
 #endif
arch/arm/mach-omap2/voltage.h +1 -0
index 16a1b09..a7c43c1 100644
@@ -156,6 +156,7 @@ int omap_voltage_late_init(void);
 
 extern void omap2xxx_voltagedomains_init(void);
 extern void omap3xxx_voltagedomains_init(void);
+extern void am33xx_voltagedomains_init(void);
 extern void omap44xx_voltagedomains_init(void);
 
 struct voltagedomain *voltdm_lookup(const char *name);
arch/arm/mach-omap2/voltagedomains33xx_data.c new file +43 -0

43 lines not on this page · raw message

--
1.7.0.4

maintainer
#2 lore raw

PATCH v4 1/4 ARM: OMAP3+: am33xx: Add voltage domain data

Hi Vaibhav, Kevin,

Quoted 6 lines · Vaibhav Hiremath

Currently dummy voltage domain data is being created in order to succeed boot process, nothing has been done w.r.t actual hardware (voltage control).

Also, hook up the AM33XX voltage domain to OMAP framework.

Quoted 7 lines
Cc Benoit Cousson <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Rajendra Nayak <[email protected]>

Looks okay to me. Kevin, you want to ack this one and I will queue it? Either that, or if you want to take it, I will ack it.

- Paul

#3 lore raw

PATCH v4 1/4 ARM: OMAP3+: am33xx: Add voltage domain data

Quoted 18 lines · Paul Walmsley

Hi Vaibhav, Kevin,

Quoted 6 lines · Vaibhav Hiremath

Currently dummy voltage domain data is being created in order to succeed boot process, nothing has been done w.r.t actual hardware (voltage control).

Also, hook up the AM33XX voltage domain to OMAP framework.

Quoted 7 lines
Cc Benoit Cousson <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Rajendra Nayak <[email protected]>
Quoted 2 lines

Looks okay to me. Kevin, you want to ack this one and I will queue it? Either that, or if you want to take it, I will ack it.

You can take it with the others.

#4 lore raw

PATCH v4 2/4 ARM: OMAP3/4: omap_hwmod: Add rstst_off field to struct omap_hwmod_omap4_prcm

In reply to Vaibhav Hiremath

In case of AM33XX device, XXX_RSTST register offset is not consistent across PRM modules/instances,

PRM_XXX RSTST
=========================

PRM_PER_MOD:       0x04
PRM_WKUP_MOD:      0x0C
PRM_MPU_MOD:       NA
PRM_DEVICE_MOD:    0x08

This means, we need to pass on XXX_RSTST register offset information through omap_hwmod data, similar to XXX_RSTCTRL.

Currently, this field is only applicable and used for AM33XX devices.

Cc Benoit Cousson <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Rajendra Nayak <[email protected]>
---
 arch/arm/plat-omap/include/plat/omap_hwmod.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/plat-omap/include/plat/omap_hwmod.h +2 -0
index 9ae87eb..50f42ec 100644
@@ -374,11 +374,13 @@ struct omap_hwmod_omap2_prcm {
  * struct omap_hwmod_omap4_prcm - OMAP4-specific PRCM data
  * @clkctrl_reg: PRCM address of the clock control register
  * @rstctrl_reg: address of the XXX_RSTCTRL register located in the PRM
+ * @rstst_reg: (AM33XX Only) address of the XXX_RSTST register located in the PRM
  * @submodule_wkdep_bit: bit shift of the WKDEP range
  */
 struct omap_hwmod_omap4_prcm {
 	u16		clkctrl_offs;
 	u16		rstctrl_offs;
+	u16		rstst_offs;
 	u16		context_offs;
 	u8		submodule_wkdep_bit;
 	u8		modulemode;

--
1.7.0.4

#5 lore raw

PATCH v4 2/4 ARM: OMAP3/4: omap_hwmod: Add rstst_off field to struct omap_hwmod_omap4_prcm

Quoted 34 lines · Vaibhav

In case of AM33XX device, XXX_RSTST register offset is not consistent across PRM modules/instances,

PRM_XXX RSTST
=========================

PRM_PER_MOD:       0x04
PRM_WKUP_MOD:      0x0C
PRM_MPU_MOD:       NA
PRM_DEVICE_MOD:    0x08

This means, we need to pass on XXX_RSTST register offset information through omap_hwmod data, similar to XXX_RSTCTRL.

Currently, this field is only applicable and used for AM33XX devices.

Cc Benoit Cousson <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Rajendra Nayak <[email protected]>
---
 arch/arm/plat-omap/include/plat/omap_hwmod.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/plat-omap/include/plat/omap_hwmod.h +0 -0
index 9ae87eb..50f42ec 100644
@@ -374,11 +374,13 @@ struct omap_hwmod_omap2_prcm {
  * struct omap_hwmod_omap4_prcm - OMAP4-specific PRCM data
  * @clkctrl_reg: PRCM address of the clock control register
  * @rstctrl_reg: address of the XXX_RSTCTRL register located in the PRM

arch/arm/plat-omap/include/plat/omap_hwmod.h struct omap_hwmod_omap2_prcm { · line 386

Quoted 10 lines
arch/arm/plat-omap/include/plat/omap_hwmod.h +2 -0
+ * @rstst_reg: (AM33XX Only) address of the XXX_RSTST register located in the PRM
  * @submodule_wkdep_bit: bit shift of the WKDEP range
  */
 struct omap_hwmod_omap4_prcm {
 	u16		clkctrl_offs;
 	u16		rstctrl_offs;
+	u16		rstst_offs;
 	u16		context_offs;
 	u8		submodule_wkdep_bit;
 	u8		modulemode;

Paul,

We have missed this patch from the series, can you merge this one as well?

Thanks,
Vaibhav

#6 lore raw

PATCH v4 3/4 ARM: OMAP2+: powerdomain: Add offset & mask fields to struct powerdomain

In reply to Vaibhav Hiremath

In case of AM33xx family of devices, there is no consistency between PWRSTCTRL & PWRSTST register offsers in PRM space, for example -

PRM_XXX PWRSTCTRL PWRSTST
=======================================

PRM_PER_MOD:      0x0C,         0x08
PRM_WKUP_MOD:     0x04,         0x08
PRM_MPU_MOD:      0x00,         0x04
PRM_DEVICE_MOD:   NA,           NA

And also, there is no consistency between bit-offsets inside PWRSTCTRL & PWRSTST register, for example -

PRM_XXX LOGICRET MEMON MEMRET
=======================================

GFX_PWRCTRL:      2,        17,    6
PER_PWRCTRL:      3,        25,    29
MPU_PWRCTRL:      2,        18,    22
WKUP_PWRCTRL:     3,        NA,    NA

This means, we need to maintain and pass on all this information in powerdomain handle; so adding fields for,
- PWRSTCTRL/ST register offset
- Logic retention state mask
- mem_on/ret/pwrst/retst mask

Currently, this fields is only applicable and used for AM33XX devices.

Cc Benoit Cousson <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Rajendra Nayak <[email protected]>
---
 arch/arm/mach-omap2/powerdomain.h |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/powerdomain.h +17 -0
index 0d72a8a..8fc50b2 100644
@@ -92,6 +92,15 @@ 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: (AM33XX only) XXX_PWRSTCTRL reg offset from prcm_offs
+ * @pwrstst_offs: (AM33XX only) XXX_PWRSTST reg offset from prcm_offs
+ * @logicretstate_mask: (AM33XX only) mask for logic retention bitfield
+ *	in @pwrstctrl_offs
+ * @mem_on_mask: (AM33XX only) mask for mem on bitfield in @pwrstctrl_offs
+ * @mem_ret_mask: (AM33XX only) mask for mem retention bitfield in @pwrstctrl_offs
+ * @mem_pwrst_mask: (AM33XX only) mask for mem state bitfield in @pwrstst_offs
+ * @mem_retst_mask: (AM33XX only) mask for mem retention state bitfield
+ *	in @pwrstctrl_offs
  * @state:
  * @state_counter:
  * @timer:
@@ -121,6 +130,14 @@ struct powerdomain {
 	unsigned ret_logic_off_counter;
 	unsigned ret_mem_off_counter[PWRDM_MAX_MEM_BANKS];
 
+	const u8 pwrstctrl_offs;
+	const u8 pwrstst_offs;
+	const u32 logicretstate_mask;
+	const u32 mem_on_mask[PWRDM_MAX_MEM_BANKS];
+	const u32 mem_ret_mask[PWRDM_MAX_MEM_BANKS];
+	const u32 mem_pwrst_mask[PWRDM_MAX_MEM_BANKS];
+	const u32 mem_retst_mask[PWRDM_MAX_MEM_BANKS];
+
 #ifdef CONFIG_PM_DEBUG
 	s64 timer;
 	s64 state_timer[PWRDM_MAX_PWRSTS];

--
1.7.0.4

#7 lore raw

PATCH v4 4/4 ARM: OMAP3+: am33xx: Add powerdomain & PRM support

In reply to Vaibhav Hiremath

As far as PRM/CM/PRCM modules are concerned, AM33XX device is different than OMAP3 and OMAP4 architectures; so we need to handle it separately.
This patch adds support for, Powerdomain, Powerdomain data, PRM api's required for AM33XX device.

And also, hooks up AM33XX powerdomain to existing OMAP framework.

Cc Benoit Cousson <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Rajendra Nayak <[email protected]>
---
 arch/arm/mach-omap2/Makefile                |    4 +
 arch/arm/mach-omap2/io.c                    |    1 +
 arch/arm/mach-omap2/omap_hwmod.c            |   32 +++-
 arch/arm/mach-omap2/powerdomain.h           |    6 +-
 arch/arm/mach-omap2/powerdomain33xx.c       |  230 +++++++++++++++++
 arch/arm/mach-omap2/powerdomains33xx_data.c |  185 ++++++++++++++
 arch/arm/mach-omap2/prm-regbits-33xx.h      |  357 +++++++++++++++++++++++++++
 arch/arm/mach-omap2/prm33xx.c               |  134 ++++++++++
 arch/arm/mach-omap2/prm33xx.h               |  129 ++++++++++
 9 files changed, 1073 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/mach-omap2/powerdomain33xx.c
 create mode 100644 arch/arm/mach-omap2/powerdomains33xx_data.c
 create mode 100644 arch/arm/mach-omap2/prm-regbits-33xx.h
 create mode 100644 arch/arm/mach-omap2/prm33xx.c
 create mode 100644 arch/arm/mach-omap2/prm33xx.h
arch/arm/mach-omap2/Makefile +4 -0
index 8d90f9f..8220369 100644
@@ -114,6 +114,10 @@ obj-$(CONFIG_ARCH_OMAP3)		+= $(powerdomain-common) \
 					   powerdomain2xxx_3xxx.o \
 					   powerdomains3xxx_data.o \
 					   powerdomains2xxx_3xxx_data.o
+obj-$(CONFIG_SOC_OMAPAM33XX)		+= $(powerdomain-common) \
+					   prm33xx.o \
+					   powerdomain33xx.o \
+					   powerdomains33xx_data.o
 obj-$(CONFIG_ARCH_OMAP4)		+= $(powerdomain-common) \
 					   powerdomain44xx.o \
 					   powerdomains44xx_data.o
arch/arm/mach-omap2/io.c +1 -0
index 523fb6d..b8fd170 100644
@@ -467,6 +467,7 @@ void __init am33xx_init_early(void)
 	omap2_set_globals_am33xx();
 	omap_common_init_early();
 	am33xx_voltagedomains_init();
+	am33xx_powerdomains_init();
 	omap3xxx_clk_init();
 }
 #endif
arch/arm/mach-omap2/omap_hwmod.c +29 -3
index 5192cab..97b47f2 100644
@@ -150,6 +150,7 @@
 #include "cminst44xx.h"
 #include "prm2xxx_3xxx.h"
 #include "prm44xx.h"
+#include "prm33xx.h"
 #include "prminst44xx.h"
 #include "mux.h"
 
@@ -1288,7 +1289,15 @@ 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())
+	/*
+	 * cpu_is_omap34xx() is true for am33xx device as well, so
+	 * fist check for cpu_is_am33xx().
+	 */
+	if (cpu_is_am33xx())
+		return am33xx_prm_assert_hardreset(ohri.rst_shift,
+				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 if (cpu_is_omap44xx())
@@ -1322,7 +1331,16 @@ 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()) {
+	/*
+	 * cpu_is_omap34xx() is true for am33xx device as well, so
+	 * fist check for cpu_is_am33xx().
+	 */
+	if (cpu_is_am33xx()) {
+		return am33xx_prm_deassert_hardreset(ohri.rst_shift,
+				oh->clkdm->pwrdm.ptr->prcm_offs,
+				oh->prcm.omap4.rstctrl_offs,
+				oh->prcm.omap4.rstst_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);
@@ -1364,7 +1382,15 @@ 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()) {
+	/*
+	 * cpu_is_omap34xx() is true for am33xx device as well, so
+	 * fist check for cpu_is_am33xx().
+	 */
+	if (cpu_is_am33xx()) {
+		return am33xx_prm_is_hardreset_asserted(ohri.rst_shift,
+				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 if (cpu_is_omap44xx()) {
arch/arm/mach-omap2/powerdomain.h +4 -2
index 8fc50b2..53e42a9 100644
@@ -67,9 +67,9 @@
 
 /*
  * Maximum number of clockdomains that can be associated with a powerdomain.
- * CORE powerdomain on OMAP4 is the worst case
+ * PER powerdomain on AM33XX is the worst case
  */
-#define PWRDM_MAX_CLKDMS	9
+#define PWRDM_MAX_CLKDMS	11
 
 /* XXX A completely arbitrary number. What is reasonable here? */
 #define PWRDM_TRANSITION_BAILOUT 100000
@@ -240,10 +240,12 @@ bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm);
 extern void omap242x_powerdomains_init(void);
 extern void omap243x_powerdomains_init(void);
 extern void omap3xxx_powerdomains_init(void);
+extern void am33xx_powerdomains_init(void);
 extern void omap44xx_powerdomains_init(void);
 
 extern struct pwrdm_ops omap2_pwrdm_operations;
 extern struct pwrdm_ops omap3_pwrdm_operations;
+extern struct pwrdm_ops am33xx_pwrdm_operations;
 extern struct pwrdm_ops omap4_pwrdm_operations;
 
 /* Common Internal functions used across OMAP rev's */
arch/arm/mach-omap2/powerdomain33xx.c new file +230 -0

230 lines not on this page · raw message

arch/arm/mach-omap2/powerdomains33xx_data.c new file +185 -0

185 lines not on this page · raw message

arch/arm/mach-omap2/prm-regbits-33xx.h new file +357 -0

357 lines not on this page · raw message

arch/arm/mach-omap2/prm33xx.c new file +134 -0

134 lines not on this page · raw message

arch/arm/mach-omap2/prm33xx.h new file +129 -0

129 lines not on this page · raw message

--
1.7.0.4

#8 lore raw

PATCH v4 4/4 ARM: OMAP3+: am33xx: Add powerdomain & PRM support

Quoted 7 lines · Vaibhav Hiremath

As far as PRM/CM/PRCM modules are concerned, AM33XX device is different than OMAP3 and OMAP4 architectures; so we need to handle it separately.
This patch adds support for, Powerdomain, Powerdomain data, PRM api's required for AM33XX device.

And also, hooks up AM33XX powerdomain to existing OMAP framework.

[...]

arch/arm/mach-omap2/omap_hwmod.c static int _assert_hardreset(struct omap_hwmod *oh, const char *name) · line 1299

Quoted 13 lines
arch/arm/mach-omap2/omap_hwmod.c +8 -1
@@ -1288,7 +1289,15 @@ 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())
+	/*
+	 * cpu_is_omap34xx() is true for am33xx device as well, so
+	 * fist check for cpu_is_am33xx().
+	 */
+	if (cpu_is_am33xx())
+		return am33xx_prm_assert_hardreset(ohri.rst_shift,
+				oh->clkdm->pwrdm.ptr->prcm_offs,
+				oh->prcm.omap4.rstctrl_offs);

This still troubles me. I *really* don't like that we have a dependence on cpu_is* call ordering. This is very fragile and error prone.

I also don't like all the cpu_is* checking currently in omap_hwmod.c (which is here before you added this) and have an idea on how to clean it up, I should have a patch by tomorrow for this. That should help adding am33xx support here without needing all the cpu_is* checking.

That being said, I just did a simple experiment[1] to see why cpu_is_omap34xx() needs to be true for AM33xx in the first place. Based on my quick experiment, it does not appear to be needed. I think our lives will be much simpler if cpu_is_omap34xx() is not true for the AM335x family.

Can you have a look at my test branch[1] and see what you think? I changed the omap_revision for AM335x so that cpu_is_omap34xx() is no longer true on this platform. Then, I only needed to fixup the SRAM init, and it boots just fine on my BeagleBone.

I really think we need to go this route, because having cpu_is_omap34xx() true on AM335x is causing more headaches than it is solving problems. This will require you to rework a little bit these clock/power/voltage domain patches, but I belive it will greatly simplify the maintainability of the end result.

Kevin

[1] git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git tmp/am335x-cpu-is-hacking

#9 lore raw

PATCH v4 4/4 ARM: OMAP3+: am33xx: Add powerdomain & PRM support

Quoted 45 lines · Kevin
Quoted 7 lines · Vaibhav Hiremath

As far as PRM/CM/PRCM modules are concerned, AM33XX device is different than OMAP3 and OMAP4 architectures; so we need to handle it separately.
This patch adds support for, Powerdomain, Powerdomain data, PRM api's required for AM33XX device.

And also, hooks up AM33XX powerdomain to existing OMAP framework.

[...]

arch/arm/mach-omap2/omap_hwmod.c static int _assert_hardreset(struct omap_hwmod *oh, const char *name) · line 1299

Quoted 13 lines
arch/arm/mach-omap2/omap_hwmod.c +8 -1
@@ -1288,7 +1289,15 @@ 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())
+	/*
+	 * cpu_is_omap34xx() is true for am33xx device as well, so
+	 * fist check for cpu_is_am33xx().
+	 */
+	if (cpu_is_am33xx())
+		return am33xx_prm_assert_hardreset(ohri.rst_shift,
+				oh->clkdm->pwrdm.ptr->prcm_offs,
+				oh->prcm.omap4.rstctrl_offs);

This still troubles me. I *really* don't like that we have a dependence on cpu_is* call ordering. This is very fragile and error prone.

I also don't like all the cpu_is* checking currently in omap_hwmod.c (which is here before you added this) and have an idea on how to clean it up, I should have a patch by tomorrow for this. That should help adding am33xx support here without needing all the cpu_is* checking.

That being said, I just did a simple experiment[1] to see why cpu_is_omap34xx() needs to be true for AM33xx in the first place. Based on my quick experiment, it does not appear to be needed. I think our lives will be much simpler if cpu_is_omap34xx() is not true for the AM335x family.

Can you have a look at my test branch[1] and see what you think? I changed the omap_revision for AM335x so that cpu_is_omap34xx() is no longer true on this platform. Then, I only needed to fixup the SRAM init, and it boots just fine on my BeagleBone.

Quoted 6 lines

I really think we need to go this route, because having cpu_is_omap34xx() true on AM335x is causing more headaches than it is solving problems. This will require you to rework a little bit these clock/power/voltage domain patches, but I belive it will greatly simplify the maintainability of the end result.

Let me spend some time, and explore your changes; I think getting system to boot should not be only criteria here. But honestly, I fully agree with you that, we are creating more issue,
adding more cpu_is_xxx() checks, with cpu_is_34xx() true for AM33xx.

As I have done in the past initially, I recommend and vote for,

1. Creating separate family cpu_is_am33xx() for AM33xx device.
OR
2. Bring it to omap44xx family, since prcm block is closer to omap4 and not with omap3. Also,

Tony,
I will let tony make a decision on this. By the time, Tony makes his decision, I will spend time to explore your (Kevin's below) branch.

Thanks,
Vaibhav

Quoted 5 lines

Kevin

[1] git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git tmp/am335x-cpu-is-hacking

maintainer
#10 lore raw

PATCH v4 4/4 ARM: OMAP3+: am33xx: Add powerdomain & PRM support

Quoted 65 lines · Hiremath, Vaibhav
Quoted 45 lines · Kevin
Quoted 7 lines · Vaibhav Hiremath

As far as PRM/CM/PRCM modules are concerned, AM33XX device is different than OMAP3 and OMAP4 architectures; so we need to handle it separately.
This patch adds support for, Powerdomain, Powerdomain data, PRM api's required for AM33XX device.

And also, hooks up AM33XX powerdomain to existing OMAP framework.

[...]

arch/arm/mach-omap2/omap_hwmod.c static int _assert_hardreset(struct omap_hwmod *oh, const char *name) · line 1299

Quoted 13 lines
arch/arm/mach-omap2/omap_hwmod.c +8 -1
@@ -1288,7 +1289,15 @@ 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())
+	/*
+	 * cpu_is_omap34xx() is true for am33xx device as well, so
+	 * fist check for cpu_is_am33xx().
+	 */
+	if (cpu_is_am33xx())
+		return am33xx_prm_assert_hardreset(ohri.rst_shift,
+				oh->clkdm->pwrdm.ptr->prcm_offs,
+				oh->prcm.omap4.rstctrl_offs);

This still troubles me. I *really* don't like that we have a dependence on cpu_is* call ordering. This is very fragile and error prone.

I also don't like all the cpu_is* checking currently in omap_hwmod.c (which is here before you added this) and have an idea on how to clean it up, I should have a patch by tomorrow for this. That should help adding am33xx support here without needing all the cpu_is* checking.

That being said, I just did a simple experiment[1] to see why cpu_is_omap34xx() needs to be true for AM33xx in the first place. Based on my quick experiment, it does not appear to be needed. I think our lives will be much simpler if cpu_is_omap34xx() is not true for the AM335x family.

Can you have a look at my test branch[1] and see what you think? I changed the omap_revision for AM335x so that cpu_is_omap34xx() is no longer true on this platform. Then, I only needed to fixup the SRAM init, and it boots just fine on my BeagleBone.

Quoted 6 lines

I really think we need to go this route, because having cpu_is_omap34xx() true on AM335x is causing more headaches than it is solving problems. This will require you to rework a little bit these clock/power/voltage domain patches, but I belive it will greatly simplify the maintainability of the end result.

Let me spend some time, and explore your changes; I think getting system to boot should not be only criteria here. But honestly, I fully agree with you that, we are creating more issue,
adding more cpu_is_xxx() checks, with cpu_is_34xx() true for AM33xx.

As I have done in the past initially, I recommend and vote for,

1. Creating separate family cpu_is_am33xx() for AM33xx device.
OR
2. Bring it to omap44xx family, since prcm block is closer to omap4 and not with omap3. Also,

Quoted 3 lines

Tony,
I will let tony make a decision on this. By the time, Tony makes his decision, I will spend time to explore your (Kevin's below) branch.

Just to summarize, I guess it's pretty obvious that we need cpu_is_am33xx here. In general work on getting rid of the cpu_is_xxxx checks as they are not safe to use with single zImage in initcalls.

Tony

#11 lore raw

PATCH v4 4/4 ARM: OMAP3+: am33xx: Add powerdomain & PRM support

In reply to Kevin Hilman

Kevin Hilman <[email protected]> writes:

[...]

Quoted 4 lines

I also don't like all the cpu_is* checking currently in omap_hwmod.c (which is here before you added this) and have an idea on how to clean it up, I should have a patch by tomorrow for this. That should help adding am33xx support here without needing all the cpu_is* checking.

Series just posted:

http://marc.info/?l=linux-omap&m=133555727831379&w=2

Kevin

#12 lore raw

v4 cover ARM: OMAP2+: Add voltagedomain, powerdomain & PRM support for AM33XX device

In reply to Vaibhav Hiremath
Quoted 18 lines · Vaibhav

After some healthy discussion, now we have come to the conclusion and decided to handle AM33XX PRM/CM part separately; as AM33XX-PRCM module is different than OMAP3 and OMAP4 architecture.

The difference becomes very interesting/weird when it comes to the consistency for register offsets in PRM address space and bit-field offsets inside PRM registers,
So along with Powerdomain data and PRM api's required for AM33XX device, this patch series adds,

- XXX_RSTST register offset to "struct omap_hwmod_omap4_prcm"
- PWRSTCTRL & PWRSTST register offsets to "struct powerdomain"
- Logicretstate and mem_on/ret/pwrst/retst mask to "struct powerdomain"

Testing: This patch series has been boot tested on AM37xEVM and AM335x
based BeagleBone community board.

Quoted 9 lines

Thanks to Paul here...for helping and concluding on this, shortly I will submit similar patch for CM, clockdomain and clock-tree support for AM33xx.

This patch-series is created on top of "linux-omap/cleanup" branch, and also gets applied to "linux-omap/master" branch.
The patches are also available at -
https://github.com/hvaibhav/am335x-linux/tree/am335x-prm-cm

Please use "am335x-upstream-staging" branch, to able to boot on BeagleBone board, due to missing clock & hwmod data.

I am in the process of submitting these patches.

Thanks,
Vaibhav

maintainer
#13 lore raw

v4 cover ARM: OMAP2+: Add voltagedomain, powerdomain & PRM support for AM33XX device

In reply to Vaibhav Hiremath

Hello Vaibhav,

Quoted 3 lines · Vaibhav Hiremath

After some healthy discussion, now we have come to the conclusion and decided to handle AM33XX PRM/CM part separately; as AM33XX-PRCM module is different than OMAP3 and OMAP4 architecture.

Have been reviewing these patch sets here. Are these associated with any board file? I had to hand-apply several patch sets due to some differences in mach-omap2/io.c. Upon looking more closely, and looking at your GitHub branch:

https://github.com/hvaibhav/am335x-linux/tree/am335x-prm-cm

it seems that internally you've been modifying the AM3517 EVM board file to test the BeagleBone? But due to the init_early changes, this is presumably not going to work if we want to keep the AM3517EVM working -- is this your understanding as well?

I'm kind of wondering how we're to test these...

...

BTW, the branch that I'm experimenting with is at
git://git.pwsan.com/linux-2.6 -- branch name 'am33xx_support_3.5' -- I am still reviewing the patches there.

- Paul

#14 lore raw

v4 cover ARM: OMAP2+: Add voltagedomain, powerdomain & PRM support for AM33XX device

Quoted 13 lines · Paul Walmsley

Hello Vaibhav,

Quoted 3 lines · Vaibhav Hiremath

After some healthy discussion, now we have come to the conclusion and decided to handle AM33XX PRM/CM part separately; as AM33XX-PRCM module is different than OMAP3 and OMAP4 architecture.

Have been reviewing these patch sets here. Are these associated with any board file? I had to hand-apply several patch sets due to some differences in mach-omap2/io.c. Upon looking more closely, and looking at your GitHub branch:

Quoted 7 lines

https://github.com/hvaibhav/am335x-linux/tree/am335x-prm-cm

it seems that internally you've been modifying the AM3517 EVM board file to test the BeagleBone? But due to the init_early changes, this is presumably not going to work if we want to keep the AM3517EVM working -- is this your understanding as well?

Yes, we are using am3517evm file for AM33XX MACHINE_INIT definition here. These patches have been reviewed and accepted in the list, only thing is they couldn't make it to upstream during v3.4 merge window.

I believe Tony is going to push them for v3.5 now.

Quoted 2 lines

I'm kind of wondering how we're to test these...

I maintain multiple branches along with one superset branch in my gitorious tree, for example, currently I have,

Individual features branches:
----------------------------
32ksync-timer-cleanup : 32k timer cleanup am335x-baseport-for-tony : baseport patches (reviewed & accepted) am335x-prm-cm-hwmod : prm/cm/hwmod patches

superset branch:
---------------
am335x-upstream-staging:

I merge all feature branches into this superset branch and one additional Patch, required to get beaglebone to boot.

Quoted 6 lines

...

BTW, the branch that I'm experimenting with is at
git://git.pwsan.com/linux-2.6 -- branch name 'am33xx_support_3.5' -- I am still reviewing the patches there.

Thanks Paul, really appreciate your help here. I will take a look at this and let you know. Also, please let me know if you have any comments in the patch.

I really want to target for v3.5 merge window, and atleast get all basic prm/cm/clock/hwmod things upstream.

Thanks,
Vaibhav

Quoted 3 lines

- Paul

maintainer
#15 lore raw

v4 cover ARM: OMAP2+: Add voltagedomain, powerdomain & PRM support for AM33XX device

Hi Vaibhav,

Quoted 5 lines · Vaibhav

Yes, we are using am3517evm file for AM33XX MACHINE_INIT definition here. These patches have been reviewed and accepted in the list, only thing is they couldn't make it to upstream during v3.4 merge window.

I believe Tony is going to push them for v3.5 now.

Hmm, but if you modify the AM3517EVM board file to call am33xx_init_early(), won't that break the AM3517EVM board? Wouldn't a separate board file be needed for the AM33xx?

- Paul

#16 lore raw

v4 cover ARM: OMAP2+: Add voltagedomain, powerdomain & PRM support for AM33XX device

Quoted 8 lines · Paul Walmsley

Hi Vaibhav,

Quoted 4 lines · Vaibhav

Yes, we are using am3517evm file for AM33XX MACHINE_INIT definition here. These patches have been reviewed and accepted in the list, only thing is they couldn't make it to upstream during v3.4 merge window.

Quoted 6 lines
Quoted 1 line

I believe Tony is going to push them for v3.5 now.

Hmm, but if you modify the AM3517EVM board file to call am33xx_init_early(), won't that break the AM3517EVM board? Wouldn't a separate board file be needed for the AM33xx?

Paul,
It has been taken care of in Makefile,

arch/arm/mach-omap2/Makefile +1 -0
index 49f92bc..f51ce0b 100644
@@ -236,6 +236,7 @@ obj-$(CONFIG_MACH_CRANEBOARD)               += board-am3517crane.o
 obj-$(CONFIG_MACH_SBC3530)             += board-omap3stalker.o
 obj-$(CONFIG_MACH_TI8168EVM)           += board-ti8168evm.o
 obj-$(CONFIG_MACH_TI8148EVM)           += board-ti8168evm.o
+obj-$(CONFIG_MACH_AM335XEVM)           += board-am3517evm.o
 
 

Thanks,
Vaibhav

Quoted 3 lines

- Paul

maintainer
#17 lore raw

v4 cover ARM: OMAP2+: Add voltagedomain, powerdomain & PRM support for AM33XX device

In reply to Paul Walmsley
Quoted 8 lines · Paul Walmsley

Hi Vaibhav,

Quoted 4 lines · Vaibhav

Yes, we are using am3517evm file for AM33XX MACHINE_INIT definition here. These patches have been reviewed and accepted in the list, only thing is they couldn't make it to upstream during v3.4 merge window.

Quoted 5 lines
Quoted 1 line

I believe Tony is going to push them for v3.5 now.

Hmm, but if you modify the AM3517EVM board file to call am33xx_init_early(), won't that break the AM3517EVM board? Wouldn't a separate board file be needed for the AM33xx?

You can have multiple MACHINE_START entries in a board-*.c file if that's what you're asking.

Regards,

Tony

maintainer
#18 lore raw

v4 cover ARM: OMAP2+: Add voltagedomain, powerdomain & PRM support for AM33XX device

In reply to Hiremath, Vaibhav
Quoted 7 lines · Hiremath, Vaibhav

On Thu, Apr 12, 2012 at 13:56:06, Paul Walmsley wrote:

Yes, we are using am3517evm file for AM33XX MACHINE_INIT definition here. These patches have been reviewed and accepted in the list, only thing is they couldn't make it to upstream during v3.4 merge window.

I believe Tony is going to push them for v3.5 now.

Hmm care to clarify which patches are you talking about here?

Tony

#19 lore raw

v4 cover ARM: OMAP2+: Add voltagedomain, powerdomain & PRM support for AM33XX device

Quoted 11 lines · Tony Lindgren
Quoted 7 lines · Hiremath, Vaibhav

On Thu, Apr 12, 2012 at 13:56:06, Paul Walmsley wrote:

Yes, we are using am3517evm file for AM33XX MACHINE_INIT definition here. These patches have been reviewed and accepted in the list, only thing is they couldn't make it to upstream during v3.4 merge window.

I believe Tony is going to push them for v3.5 now.

Hmm care to clarify which patches are you talking about here?

Tony,
I was referring to initial 2 baseport patches which we have dropped due dependency on mach-types.

arm:omap:am33xx: Add AM335XEVM machine support
arm:omap:am33xx: Add low level debugging support

One patch (which was independent) from this series, made its way to upstream,
ARM: OMAP2+: id: Add am33xx SoC type detection

Can you please make sure that, it gets included into your next pull request?

Thanks,
Vaibhav

Quoted 2 lines

Tony

maintainer
#20 lore raw

v4 cover ARM: OMAP2+: Add voltagedomain, powerdomain & PRM support for AM33XX device

Quoted 13 lines · Hiremath, Vaibhav
Quoted 11 lines · Tony Lindgren
Quoted 7 lines · Hiremath, Vaibhav

On Thu, Apr 12, 2012 at 13:56:06, Paul Walmsley wrote:

Yes, we are using am3517evm file for AM33XX MACHINE_INIT definition here. These patches have been reviewed and accepted in the list, only thing is they couldn't make it to upstream during v3.4 merge window.

I believe Tony is going to push them for v3.5 now.

Hmm care to clarify which patches are you talking about here?

Quoted 6 lines

Tony,
I was referring to initial 2 baseport patches which we have dropped due dependency on mach-types.

arm:omap:am33xx: Add AM335XEVM machine support
arm:omap:am33xx: Add low level debugging support

Can you please repost these against current v3.4-rc4?

Quoted 2 lines

One patch (which was independent) from this series, made its way to upstream,
ARM: OMAP2+: id: Add am33xx SoC type detection

OK

Quoted 1 line

Can you please make sure that, it gets included into your next pull request?

As far as I remember they looked OK for minimal board changes.

Regards,

Tony

#21 lore raw

v4 cover ARM: OMAP2+: Add voltagedomain, powerdomain & PRM support for AM33XX device

Quoted 14 lines · Tony Lindgren
Quoted 13 lines · Hiremath, Vaibhav
Quoted 11 lines · Tony Lindgren
Quoted 7 lines · Hiremath, Vaibhav

On Thu, Apr 12, 2012 at 13:56:06, Paul Walmsley wrote:

Yes, we are using am3517evm file for AM33XX MACHINE_INIT definition here. These patches have been reviewed and accepted in the list, only thing is they couldn't make it to upstream during v3.4 merge window.

I believe Tony is going to push them for v3.5 now.

Hmm care to clarify which patches are you talking about here?

Quoted 9 lines
Quoted 6 lines

Tony,
I was referring to initial 2 baseport patches which we have dropped due dependency on mach-types.

arm:omap:am33xx: Add AM335XEVM machine support
arm:omap:am33xx: Add low level debugging support

Can you please repost these against current v3.4-rc4?

Ok, I will do that.

Quoted 9 lines
Quoted 2 lines

One patch (which was independent) from this series, made its way to upstream,
ARM: OMAP2+: id: Add am33xx SoC type detection

OK

Quoted 1 line

Can you please make sure that, it gets included into your next pull request?

As far as I remember they looked OK for minimal board changes.

Yes, they were accepted and were also available under linux-omap/soc2 branch for quite some time.

Thanks,
Vaibhav

maintainer
#22 lore raw

v4 cover ARM: OMAP2+: Add voltagedomain, powerdomain & PRM support for AM33XX device

Quoted 3 lines · Hiremath, Vaibhav

Yes, they were accepted and were also available under linux-omap/soc2 branch for quite some time.

Hmm sorry if I've dropped them accidentally. I tend to drop the branches after each merge window and purge my linux-omap mailbox too.

Regards,

Tony

#23 lore raw

v4 cover ARM: OMAP2+: Add voltagedomain, powerdomain & PRM support for AM33XX device

Quoted 8 lines · Tony Lindgren
Quoted 3 lines · Hiremath, Vaibhav

Yes, they were accepted and were also available under linux-omap/soc2 branch for quite some time.

Hmm sorry if I've dropped them accidentally. I tend to drop the branches after each merge window and purge my linux-omap mailbox too.

I can understand, I will submit another version for this.

I will be waiting for your comment and conformation on, which family AM33xx device should fall in? Please refer to the mail-chain -

http://www.mail-archive.com/linux-omap at vger.kernel.org/msg67275.html

Thanks,
Vaibhav

maintainer
#24 lore raw

v4 cover ARM: OMAP2+: Add voltagedomain, powerdomain & PRM support for AM33XX device

Quoted 4 lines · Vaibhav

I will be waiting for your comment and conformation on, which family AM33xx device should fall in? Please refer to the mail-chain -

http://www.mail-archive.com/linux-omap at vger.kernel.org/msg67275.html

This decision turns out to be pretty important; it certainly affects the AM33xx PRM/CM/clockdomain/powerdomain patches that I've been looking at.

Here is my suggestion, based on our previous practice. I am not so sure that it is the best way, but it seems pretty reasonable"

Using CONFIG_ARCH_OMAP3 for CONFIG_ARCH_OMAPAM33XX doesn't make sense, as far as I can tell. The main area of similarity between the other CONFIG_ARCH_OMAP3 and AM33xx is the Cortex-A8. And even that MPU subsystem is quite different between, say, the 3430/3630 and the AM33xx. Most of the AM33xx is quite different from the 3430/3630: OMAP4-style PRCM interface, OMAP4-style interconnect, etc. Plus, most of the CONFIG_ARCH_OMAP3 code in our codebase is very 3430/3630-specific, like the PM code.

This would seem to suggest that we should use CONFIG_ARCH_OMAP4. But that option currently assumes an OMAP4-style MPU subsystem: SMP Cortex-A9, PL310, etc. None of that is true for AM335x.

So first we have to decide whether the CONFIG_ARCH_OMAP* options should have a strong dependency on the MPU type, as they currently do; or whether they should focus on the way the SoC is integrated.

If we take the former option, then we should add a new CONFIG_ARCH_OMAPAM33XX Kconfig option to arch/arm/Makefile, at the same level as CONFIG_ARCH_OMAP1/2/3/4. Similarly, we should add a CONFIG_ARCH_OMAPTI81XX Kconfig option.

However, if we take the second option, then we can probably shoehorn the AM33XX and the TI81xx chips into CONFIG_ARCH_OMAP4.

Either way, it would be good to get AM33xx and TI81xx out of CONFIG_ARCH_OMAP3, since keeping them there will require lots of changes across the codebase to stop using CONFIG_ARCH_OMAP3 and use the CONFIG_SOC_* Kconfig options instead.

- Paul

#25 lore raw

v4 cover ARM: OMAP2+: Add voltagedomain, powerdomain & PRM support for AM33XX device

Hi Paul,

Quoted 22 lines · Paul Walmsley
Quoted 4 lines · Vaibhav

I will be waiting for your comment and conformation on, which family AM33xx device should fall in? Please refer to the mail-chain -

http://www.mail-archive.com/linux-omap at vger.kernel.org/msg67275.html

This decision turns out to be pretty important; it certainly affects the AM33xx PRM/CM/clockdomain/powerdomain patches that I've been looking at.

Here is my suggestion, based on our previous practice. I am not so sure that it is the best way, but it seems pretty reasonable"

Using CONFIG_ARCH_OMAP3 for CONFIG_ARCH_OMAPAM33XX doesn't make sense, as far as I can tell. The main area of similarity between the other CONFIG_ARCH_OMAP3 and AM33xx is the Cortex-A8. And even that MPU subsystem is quite different between, say, the 3430/3630 and the AM33xx. Most of the AM33xx is quite different from the 3430/3630: OMAP4-style PRCM interface, OMAP4-style interconnect, etc. Plus, most of the CONFIG_ARCH_OMAP3 code in our codebase is very 3430/3630-specific, like the PM code.

Quoted 7 lines

This would seem to suggest that we should use CONFIG_ARCH_OMAP4. But that option currently assumes an OMAP4-style MPU subsystem: SMP Cortex-A9, PL310, etc. None of that is true for AM335x.

So first we have to decide whether the CONFIG_ARCH_OMAP* options should have a strong dependency on the MPU type, as they currently do; or whether they should focus on the way the SoC is integrated.

I think as well that these devices should be considered as part of the OMAP4 family.
The CPU type should not be the parameter that decide the OMAP family, it is just an IP, that can change on some variant, whereas the whole PRCM infrastructure / interconnect is mostly the same.

Regards,
Benoit

#26 lore raw

v4 cover ARM: OMAP2+: Add voltagedomain, powerdomain & PRM support for AM33XX device

Quoted 38 lines · Benoit

Hi Paul,

Quoted 25 lines · Paul Walmsley
Quoted 5 lines · Vaibhav

I will be waiting for your comment and conformation on, which family AM33xx
device should fall in? Please refer to the mail-chain -

http://www.mail-archive.com/linux-omap at vger.kernel.org/msg67275.html

This decision turns out to be pretty important; it certainly affects the AM33xx PRM/CM/clockdomain/powerdomain patches that I've been looking at.

Here is my suggestion, based on our previous practice. ?I am not so sure that it is the best way, but it seems pretty reasonable"

Using CONFIG_ARCH_OMAP3 for CONFIG_ARCH_OMAPAM33XX doesn't make sense, as far as I can tell. ?The main area of similarity between the other CONFIG_ARCH_OMAP3 and AM33xx is the Cortex-A8. ?And even that MPU subsystem is quite different between, say, the 3430/3630 and the AM33xx. Most of the AM33xx is quite different from the 3430/3630: OMAP4-style PRCM interface, OMAP4-style interconnect, etc. ?Plus, most of the CONFIG_ARCH_OMAP3 code in our codebase is very 3430/3630-specific, like the PM code.

Quoted 7 lines

This would seem to suggest that we should use CONFIG_ARCH_OMAP4. ?But that option currently assumes an OMAP4-style MPU subsystem: SMP Cortex-A9, PL310, etc. ?None of that is true for AM335x.

So first we have to decide whether the CONFIG_ARCH_OMAP* options should have a strong dependency on the MPU type, as they currently do; or whether they should focus on the way the SoC is integrated.

Quoted 6 lines

I think as well that these devices should be considered as part of the OMAP4 family.
The CPU type should not be the parameter that decide the OMAP family, it is just an IP, that can change on some variant, whereas the whole PRCM infrastructure / interconnect is mostly the same.

I agree. In fact more and more I think of this problem, looks like we should get rid
off ARCH_OMAP* and just is SOC_* going forward.

Common ARM code already takes care of different CPU version and as Benoit mentioned it is just one of the IP in the entire SOC. I saw tony commenting in similarly on of the patch set.

Regards
Santosh

#27 lore raw

v4 cover ARM: OMAP2+: Add voltagedomain, powerdomain & PRM support for AM33XX device

Quoted 8 lines · Santosh
Quoted 7 lines · Benoit

Hi Paul,

Quoted 3 lines · Paul Walmsley

On Fri, 27 Apr 2012, Hiremath, Vaibhav wrote:

<snip>

Quoted 11 lines
Quoted 11 lines
Quoted 3 lines

So first we have to decide whether the CONFIG_ARCH_OMAP* options should have a strong dependency on the MPU type, as they currently do; or whether they should focus on the way the SoC is integrated.

I think as well that these devices should be considered as part of the OMAP4 family.
The CPU type should not be the parameter that decide the OMAP family, it is just an IP, that can change on some variant, whereas the whole PRCM infrastructure / interconnect is mostly the same.

Quoted 8 lines

I agree. In fact more and more I think of this problem, looks like we should get rid
off ARCH_OMAP* and just is SOC_* going forward.

Common ARM code already takes care of different CPU version and as Benoit mentioned it is just one of the IP in the entire SOC. I saw tony commenting in similarly on of the patch set.

I am working on creating patch-sets for am33xx device on the same direction, that means, am33xx will not fallow, neither ARCH_OMAP3 nor ARCH_OMAP4. am33xx will be separate device under ARCH_OMAP2PLUS, with "SOC_OMAPAM33XX".

This also means, neither cpu_is_omap34xx() not cpu_is_omap44xx() will be true for am33xx. We will have separate cpu_is_am33xx() class for this.

Shortly I will submit patch-series for this.
Just FYI, I have some cleanup patches, which actually tries to cleanup some of the existing ARCH_OMAPx dependency in code, making addition of devices easier under ARCH_OMAP2PLUS.

Thanks,
Vaibhav

maintainer
#28 lore raw

v4 cover ARM: OMAP2+: Add voltagedomain, powerdomain & PRM support for AM33XX device

In reply to Hiremath, Vaibhav

Hello Vaibhav,

I've reworked these patches somewhat to separate the PRM and CM changes into their own patches. Also, the omap_hwmod changes have been separated and moved into a different series, as have the clock tree changes.

So now, pending for 3.5, there are the SCM, voltagedomain, PRM, CM, powerdomain, and clockdomain changes. Under the (probably incorrect) assumption that Tony will opt to create a CONFIG_ARCH_OMAPAM33XX, you might wish to take a look at the 'am33xx_prcm_devel_3.5' branch of
git://git.pwsan.com/linux-2.6. It is based on four patches, not yet upstream, which create the appropriate board file, Kconfig options, etc.

Once we're able to reach a conclusion as to which of the CONFIG_ARCH_OMAP* options the AM33xx belongs under, this branch will be updated and reposted, and if everyone is happy with it, proposed for pulling.

- Paul

#29 lore raw

v4 cover ARM: OMAP2+: Add voltagedomain, powerdomain & PRM support for AM33XX device

Quoted 14 lines · Paul Walmsley

Hello Vaibhav,

I've reworked these patches somewhat to separate the PRM and CM changes into their own patches. Also, the omap_hwmod changes have been separated and moved into a different series, as have the clock tree changes.

So now, pending for 3.5, there are the SCM, voltagedomain, PRM, CM, powerdomain, and clockdomain changes. Under the (probably incorrect) assumption that Tony will opt to create a CONFIG_ARCH_OMAPAM33XX, you might wish to take a look at the 'am33xx_prcm_devel_3.5' branch of
git://git.pwsan.com/linux-2.6. It is based on four patches, not yet upstream, which create the appropriate board file, Kconfig options, etc.

Quoted 5 lines

Once we're able to reach a conclusion as to which of the CONFIG_ARCH_OMAP* options the AM33xx belongs under, this branch will be updated and reposted, and if everyone is happy with it, proposed for pulling.

Sounds Great and Thanks a lot Paul.

I will look at the above branch and update you if I find something wrong/missing.

Thanks,
Vaibhav

#30 lore raw

v4 cover ARM: OMAP2+: Add voltagedomain, powerdomain & PRM support for AM33XX device

In reply to Paul Walmsley
Quoted 14 lines · Paul Walmsley

Hello Vaibhav,

I've reworked these patches somewhat to separate the PRM and CM changes into their own patches. Also, the omap_hwmod changes have been separated and moved into a different series, as have the clock tree changes.

So now, pending for 3.5, there are the SCM, voltagedomain, PRM, CM, powerdomain, and clockdomain changes. Under the (probably incorrect) assumption that Tony will opt to create a CONFIG_ARCH_OMAPAM33XX, you might wish to take a look at the 'am33xx_prcm_devel_3.5' branch of
git://git.pwsan.com/linux-2.6. It is based on four patches, not yet upstream, which create the appropriate board file, Kconfig options, etc.

Quoted 4 lines

Once we're able to reach a conclusion as to which of the CONFIG_ARCH_OMAP* options the AM33xx belongs under, this branch will be updated and reposted, and if everyone is happy with it, proposed for pulling.

Hi Paul,

I have reviewed the "am33xx_prcm_devel_3.5" branch for AM33xx support, and below are few comments I have,

1) ARM: add CONFIG_ARCH_OMAP{AM33XX,TI81XX}

Description talks about TI81xx as well, but patch is created only for AM33xx. Isn't same entry should be created for TI81xx in the patch?

2) ARM: OMAP: AM335x: add Kconfig, Makefile glue for CONFIG_ARCH_OMAPAM33XX

Looks ok to me. (Acked-by: Vaibhav Hiremath <[email protected]>)

3) ARM: OMAP: AM33xx: Add AM335XEVM machine support

Looks ok to me.

4) arm:omap:am33xx: Add low level debugging support

Subject line need to change to match it with our convention.

ARM: OMAP: am33xx: Add low level debugging support

5) ARM: OMAP2+: control: Add AM33XX control reg & sec clkctrl offset

Looks ok to me.

6) ARM: OMAP3+: am33xx: Add voltage domain data

Remove multiple entries for voltagedomain-common.o for AM33xx

arch/arm/mach-omap2/Makefile +0 -1
index cc44ea9..3b953c7 100644
@@ -109,7 +109,6 @@ obj-$(CONFIG_SOC_OMAPAM33XX)                += $(voltagedomain-common) \
                                           voltagedomains33xx_data.o
 obj-$(CONFIG_ARCH_OMAP4)               += $(voltagedomain-common) \
                                           voltagedomains44xx_data.o
-obj-$(CONFIG_ARCH_OMAPAM33XX)          += $(voltagedomain-common)
 
 

7) ARM: OMAP3+: am33xx: add PRM support

Remove multiple entries for prcm.o for AM33xx

arch/arm/mach-omap2/Makefile +0 -1
index 3b953c7..ae1399b 100644
@@ -96,7 +96,6 @@ obj-$(CONFIG_ARCH_OMAP4)              += prcm.o cm2xxx_3xxx.o cminst44xx.o \
                                           cm44xx.o prcm_mpu44xx.o \
                                           prminst44xx.o vc44xx_data.o \
                                           vp44xx_data.o prm44xx.o
-obj-$(CONFIG_ARCH_OMAPAM33XX)          += prcm.o
 
 

8) ARM: OMAP3+: cm33xx: Introduce AM33xx CM API's and register level details

Looks ok to me.

9) ARM: OMAP2+: powerdomain: add AM335x support

Remove multiple entries for target powerdomain-common for AM33xx

arch/arm/mach-omap2/Makefile +0 -1
index ae1399b..1147352 100644
@@ -126,7 +126,6 @@ obj-$(CONFIG_SOC_OMAPAM33XX)                += $(powerdomain-common) \
 obj-$(CONFIG_ARCH_OMAP4)               += $(powerdomain-common) \
                                           powerdomain44xx.o \
                                           powerdomains44xx_data.o
-obj-$(CONFIG_ARCH_OMAPAM33XX)          += $(powerdomain-common)
 
 

10) ARM: OMAP3+: clockdomain33xx: Add clockdomain data and respective operations

Looks ok to me.

Paul,

I have also boot tested it on BeagleBone, since we would not catch any issues from the changes. It is highly impossible to catch just by reviewing the patch or checking for build test. So I ported merged clocktree and hwmod patches to see whether it boots up on BeagleBone, and found that, we need further changes here -

=======================diff for BeagleBone boot======================

arch/arm/mach-omap2/board-am335xevm.c +1 -0
index 324752e..69d8aae 100644
@@ -41,6 +41,7 @@ MACHINE_START(AM335XEVM, "am335xevm")
 	.map_io		= am33xx_map_io,
 	.init_early	= am33xx_init_early,
 	.init_irq	= ti81xx_init_irq,
+	.handle_irq	= omap3_intc_handle_irq,
 	.timer		= &omap3_am33xx_timer,
 	.init_machine	= am335x_evm_init,
 MACHINE_END
arch/arm/mach-omap2/common.c +3 -0
index 1549c11..77467b3 100644
@@ -134,6 +134,9 @@ void __init ti81xx_map_io(void)
 {
 	omapti81xx_map_common_io();
 }
+#endif
+
+#if defined(CONFIG_ARCH_OMAPAM33XX)
 
 #define AM33XX_TAP_BASE		(AM33XX_CTRL_BASE + \
 				TI81XX_CONTROL_DEVICE_ID - 0x204)
arch/arm/mach-omap2/io.c +1 -1
index 6712199..3c9649a 100644
@@ -185,7 +185,7 @@ static struct map_desc omapti81xx_io_desc[] __initdata = {
 };
 #endif
 
-#ifdef CONFIG_SOC_OMAPAM33XX
+#ifdef CONFIG_ARCH_OMAPAM33XX
 static struct map_desc omapam33xx_io_desc[] __initdata = {
 	{
 		.virtual	= L4_34XX_VIRT,
@@ -294,7 +294,7 @@ void __init omapti81xx_map_common_io(void)
 }
 #endif
 
arch/arm/mach-omap2/io.c +0 -0
index 6712199..3c9649a 100644
@@ -470,10 +470,12 @@ void __init ti81xx_init_early(void)
 }
 #endif /* CONFIG_ARCH_OMAP3 */
 

#ifdef CONFIG_SOC_OMAPAM33XX
void __init am33xx_init_early(void)
{
omap2_set_globals_am33xx();
+ omap3xxx_check_revision();
+ ti81xx_check_features();
omap_common_init_early();
am33xx_voltagedomains_init();
am33xx_powerdomains_init();

arch/arm/mach-omap2/irq.c +1 -1
index 80f3ced..c5f8a48 100644
@@ -280,7 +280,7 @@ int __init omap_intc_of_init(struct device_node *node,
 	return 0;
 }
 
-#ifdef CONFIG_ARCH_OMAP3
+#if defined (CONFIG_ARCH_OMAP3) || defined (CONFIG_ARCH_OMAPAM33XX)
 static struct omap3_intc_regs intc_context[ARRAY_SIZE(irq_banks)];
 
 void omap_intc_save_context(void)
arch/arm/mach-omap2/timer.c +2 -0
index 2883f5d..2a25dd9 100644
@@ -373,6 +373,8 @@ OMAP_SYS_TIMER(3)
 OMAP_SYS_TIMER_INIT(3_secure, OMAP3_SECURE_TIMER, OMAP3_CLKEV_SOURCE,
 			2, OMAP3_MPU_SOURCE)
 OMAP_SYS_TIMER(3_secure)
+#endif
+#ifdef CONFIG_ARCH_OMAPAM33XX
 OMAP_SYS_TIMER_INIT(3_am33xx, 1, OMAP4_MPU_SOURCE, 2, OMAP4_MPU_SOURCE)
 OMAP_SYS_TIMER(3_am33xx)
 #endif
arch/arm/plat-omap/include/plat/cpu.h +7 -4
index dc6a86b..0e8957b 100644
@@ -357,8 +357,6 @@ IS_OMAP_TYPE(3517, 0x3517)
 # undef cpu_is_ti81xx
 # undef cpu_is_ti816x
 # undef cpu_is_ti814x
-# undef cpu_is_am33xx
-# undef cpu_is_am335x
 # define cpu_is_omap3430()		is_omap3430()
 # define cpu_is_omap3503()		(cpu_is_omap3430() &&		\
 						(!omap3_has_iva()) &&	\
@@ -378,6 +376,11 @@ IS_OMAP_TYPE(3517, 0x3517)
 # define cpu_is_ti81xx()		is_ti81xx()
 # define cpu_is_ti816x()		is_ti816x()
 # define cpu_is_ti814x()		is_ti814x()
+#endif
+
+# if defined(CONFIG_ARCH_OMAPAM33XX)
+# undef cpu_is_am33xx
+# undef cpu_is_am335x
 # define cpu_is_am33xx()		is_am33xx()
 # define cpu_is_am335x()		is_am335x()
 #endif
@@ -397,7 +400,7 @@ IS_OMAP_TYPE(3517, 0x3517)
 #define cpu_class_is_omap1()	(cpu_is_omap7xx() || cpu_is_omap15xx() || \
 				cpu_is_omap16xx())
 #define cpu_class_is_omap2()	(cpu_is_omap24xx() || cpu_is_omap34xx() || \
-				cpu_is_omap44xx())
+				cpu_is_omap44xx() || cpu_is_am33xx())
 
 /* Various silicon revisions for omap2 */
 #define OMAP242X_CLASS		0x24200024
@@ -433,7 +436,7 @@ IS_OMAP_TYPE(3517, 0x3517)
 #define TI8148_REV_ES2_0	(TI814X_CLASS | (0x1 << 8))
 #define TI8148_REV_ES2_1	(TI814X_CLASS | (0x2 << 8))
 
-#define AM335X_CLASS		0x33500034
+#define AM335X_CLASS		0x33500033
 #define AM335X_REV_ES1_0	AM335X_CLASS
 
 #define OMAP443X_CLASS		0x44300044
#31 lore raw

v4 cover ARM: OMAP2+: Add voltagedomain, powerdomain & PRM support for AM33XX device

In reply to Vaibhav Hiremath
Quoted 58 lines · Vaibhav

After some healthy discussion, now we have come to the conclusion and decided to handle AM33XX PRM/CM part separately; as AM33XX-PRCM module is different than OMAP3 and OMAP4 architecture.

The difference becomes very interesting/weird when it comes to the consistency for register offsets in PRM address space and bit-field offsets inside PRM registers,
So along with Powerdomain data and PRM api's required for AM33XX device, this patch series adds,

- XXX_RSTST register offset to "struct omap_hwmod_omap4_prcm"
- PWRSTCTRL & PWRSTST register offsets to "struct powerdomain"
- Logicretstate and mem_on/ret/pwrst/retst mask to "struct powerdomain"

Testing: This patch series has been boot tested on AM37xEVM and AM335x
based BeagleBone community board.

Thanks to Paul here...for helping and concluding on this, shortly I will submit similar patch for CM, clockdomain and clock-tree support for AM33xx.

This patch-series is created on top of "linux-omap/cleanup" branch, and also gets applied to "linux-omap/master" branch.
The patches are also available at -
https://github.com/hvaibhav/am335x-linux/tree/am335x-prm-cm

Changes from previous versions:
===============================
From V3:
- No code change, only added Voltagedomain patch (from V2 series) to this series.

From V1 & V2:
- Rolled back to my original approach, where AM33xx device was handled separately (RFC version).
- As per Paul's comments, added Register offsets & bit-fields masks.

Vaibhav Hiremath (4):
ARM: OMAP3+: am33xx: Add voltage domain data
ARM: OMAP3/4: omap_hwmod: Add rstst_off field to struct
omap_hwmod_omap4_prcm
ARM: OMAP2+: powerdomain: Add offset & mask fields to struct
powerdomain
ARM: OMAP3+: am33xx: Add powerdomain & PRM support

 arch/arm/mach-omap2/Makefile                  |    6 +
 arch/arm/mach-omap2/io.c                      |    2 +
 arch/arm/mach-omap2/omap_hwmod.c              |   32 ++-
 arch/arm/mach-omap2/powerdomain.h             |   23 ++-
 arch/arm/mach-omap2/powerdomain33xx.c         |  230 ++++++++++++++++
 arch/arm/mach-omap2/powerdomains33xx_data.c   |  185 +++++++++++++
 arch/arm/mach-omap2/prm-regbits-33xx.h        |  357 +++++++++++++++++++++++++
 arch/arm/mach-omap2/prm33xx.c                 |  134 +++++++++
 arch/arm/mach-omap2/prm33xx.h                 |  129 +++++++++
 arch/arm/mach-omap2/voltage.h                 |    1 +
 arch/arm/mach-omap2/voltagedomains33xx_data.c |   43 +++
Quoted 10 lines
 arch/arm/plat-omap/include/plat/omap_hwmod.h  |    2 +
 12 files changed, 1139 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/mach-omap2/powerdomain33xx.c
 create mode 100644 arch/arm/mach-omap2/powerdomains33xx_data.c
 create mode 100644 arch/arm/mach-omap2/prm-regbits-33xx.h
 create mode 100644 arch/arm/mach-omap2/prm33xx.c
 create mode 100644 arch/arm/mach-omap2/prm33xx.h
 create mode 100644 arch/arm/mach-omap2/voltagedomains33xx_data.c

Tony, Paul and Kevin,

Any comments on this patch series?

Thanks,
Vaibhav