Skip to contentSkip to conversation

Split powerdomain framework into plat specific/independent

PATCH Superseded Rajendra Nayak 2 participants 10 messages Nov 30, 2010 – Dec 3, 2010

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Split powerdomain framework into plat specific/independent

OMAP4 powerdomains have some inherent differences as compared to OMAP2/3 powerdomains, starting with register offsets being different to clubbing of multiple controls into one register and in some cases splitting of control into multiple registers.
There are also new features like lowpowerstatechange bits and features like HW SAR which are no longer present in the older form.

Supporting all these in the existing powerdomain framework would mean adding a lot of cpu_is_* checks which makes code unmaintainable going fwd.

Hence this series is an attempt to split the existing powerdomain framework into platform independent part (which does error checking, usecounting et al) which can be reused across OMAP's and hook up platform specific functions to do low level programming which varies across OMAP's.

The series is boot tested on OMAP 2430sdp/3430sdp and 4430sdp platforms. Additionally on 3430sdp, Retention and OFF support in system suspend is also validated with a minimal kernel config (omap3_pm_defconfig from Kevins tree hosted here
git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git)

regards,
Rajendra

Version History
---------------
Version v2
* powerdomain.c retained in mach-omap2 instead of moving it to plat-omap
* All common powerdomain functions now in powerdomain-common.c file instead of powerdomains.c
* OMAP2/3 common and specific functions in powerdomain2xxx_3xxx.c file.
* Other minor review comment fixes

Version v1
http://marc.info/?l=linux-omap&m=128992190426815&w=2
Fixes all issues discussed on the RFC series and also has
a few other changes
* The below patch is dropped as the dependent patches for this are still under discussion.
[RFC 6/8] OMAP: PRM: split the prm accessor api funcs for omap2/3 and omap4
http://marc.info/?l=linux-omap&m=128524531505429&w=2
* The below patch is also dropped as there are more than one context registers to be handled in some powerdomains and hence needs to be handled differently
[RFC 7/8] omap4: powerdomain: add context_offset field
http://marc.info/?l=linux-omap&m=128524531805435&w=2

The RFC series of these patches was posted here
http://marc.info/?l=linux-omap&m=128524530605407&w=2

Rajendra Nayak (4):
OMAP: powerdomain: Infrastructure to put arch specific code
OMAP: powerdomain: Arch specific funcs for state control
OMAP: powerdomain: Arch specific funcs for logic control
OMAP: powerdomain: Arch specific funcs for mem control

Santosh Shilimkar (1):
OMAP4: powerdomain: Add pwrdm_clear_all_prev_pwrst

 arch/arm/mach-omap2/Makefile                  |    8 +-
 arch/arm/mach-omap2/io.c                      |    7 +-
 arch/arm/mach-omap2/powerdomain-common.c      |  114 +++++++
 arch/arm/mach-omap2/powerdomain.c             |  396 +++++++------------------
 arch/arm/mach-omap2/powerdomain2xxx_3xxx.c    |  226 ++++++++++++++
 arch/arm/mach-omap2/powerdomain44xx.c         |  173 +++++++++++
 arch/arm/mach-omap2/powerdomains.h            |   21 ++
 arch/arm/plat-omap/include/plat/powerdomain.h |   43 +++-
 8 files changed, 698 insertions(+), 290 deletions(-)
 create mode 100644 arch/arm/mach-omap2/powerdomain-common.c
 create mode 100644 arch/arm/mach-omap2/powerdomain2xxx_3xxx.c
 create mode 100644 arch/arm/mach-omap2/powerdomain44xx.c
#1 lore raw

PATCH v2 1/5 OMAP: powerdomain: Infrastructure to put arch specific code

Put infrastructure in place, so arch specific func pointers can be hooked up to the platform-independent part of the framework.
This is in preparation of splitting the powerdomain framework into platform-independent part (for all omaps) and platform-specific parts.

Cc Paul Walmsley <[email protected]>
Cc Benoit Cousson <[email protected]>
Cc Kevin Hilman <[email protected]>
---
 arch/arm/mach-omap2/io.c                      |    2 +-
 arch/arm/mach-omap2/powerdomain.c             |   11 +++++-
 arch/arm/plat-omap/include/plat/powerdomain.h |   43 ++++++++++++++++++++++++-
 3 files changed, 52 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/io.c +1 -1
index 40562dd..76c531a 100644
@@ -316,7 +316,7 @@ void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
 {
 	u8 skip_setup_idle = 0;
 
-	pwrdm_init(powerdomains_omap);
+	pwrdm_init(powerdomains_omap, NULL);
 	clkdm_init(clockdomains_omap, clkdm_autodeps);
 	if (cpu_is_omap242x())
 		omap2420_hwmod_init();
arch/arm/mach-omap2/powerdomain.c +9 -2
index 6527ec3..3aa3eb3 100644
@@ -80,6 +80,8 @@ static u16 pwrstst_reg_offs;
 /* pwrdm_list contains all registered struct powerdomains */
 static LIST_HEAD(pwrdm_list);
 
+static struct pwrdm_ops *arch_pwrdm;
+
 /* Private functions */
 
 static struct powerdomain *_pwrdm_lookup(const char *name)
@@ -211,6 +213,7 @@ static int _pwrdm_post_transition_cb(struct powerdomain *pwrdm, void *unused)
 /**
  * pwrdm_init - set up the powerdomain layer
  * @pwrdm_list: array of struct powerdomain pointers to register
+ * @custom_funcs: func pointers for arch specfic implementations
  *
  * Loop through the array of powerdomains @pwrdm_list, registering all
  * that are available on the current CPU. If pwrdm_list is supplied
@@ -218,7 +221,7 @@ static int _pwrdm_post_transition_cb(struct powerdomain *pwrdm, void *unused)
  * registered.  No return value.  XXX pwrdm_list is not really a
  * "list"; it is an array.  Rename appropriately.
  */
-void pwrdm_init(struct powerdomain **pwrdm_list)
+void pwrdm_init(struct powerdomain **pwrdm_list, struct pwrdm_ops *custom_funcs)
 {
 	struct powerdomain **p = NULL;
 
@@ -234,6 +237,11 @@ void pwrdm_init(struct powerdomain **pwrdm_list)
 		return;
 	}
 
+	if (!custom_funcs)
+		WARN(1, "powerdomain: No custom pwrdm functions registered\n");
+	else
+		arch_pwrdm = custom_funcs;
+
 	if (pwrdm_list) {
 		for (p = pwrdm_list; *p; p++)
 			_pwrdm_register(*p);
@@ -1074,4 +1082,3 @@ int pwrdm_post_transition(void)
 	pwrdm_for_each(_pwrdm_post_transition_cb, NULL);
 	return 0;
 }
-
arch/arm/plat-omap/include/plat/powerdomain.h +42 -1

50 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#2 lore raw

PATCH v2 2/5 OMAP: powerdomain: Arch specific funcs for state control

Define the following architecture specific funtions for omap2/3/4 .pwrdm_set_next_pwrst
.pwrdm_read_next_pwrst
.pwrdm_read_pwrst
.pwrdm_read_prev_pwrst

Convert the platform-independent framework to call these functions.

Cc Paul Walmsley <[email protected]>
Cc Benoit Cousson <[email protected]>
Cc Kevin Hilman <[email protected]>
---
 arch/arm/mach-omap2/Makefile               |    5 ++
 arch/arm/mach-omap2/io.c                   |    7 +++-
 arch/arm/mach-omap2/powerdomain.c          |   33 ++++++++++-----
 arch/arm/mach-omap2/powerdomain2xxx_3xxx.c |   61 ++++++++++++++++++++++++++++
 arch/arm/mach-omap2/powerdomain44xx.c      |   53 ++++++++++++++++++++++++
 arch/arm/mach-omap2/powerdomains.h         |   17 ++++++++
 6 files changed, 165 insertions(+), 11 deletions(-)
 create mode 100644 arch/arm/mach-omap2/powerdomain2xxx_3xxx.c
 create mode 100644 arch/arm/mach-omap2/powerdomain44xx.c
arch/arm/mach-omap2/Makefile +5 -0
index 60e51bc..c982ba4 100644
@@ -94,6 +94,11 @@ obj-$(CONFIG_ARCH_OMAP2430)		+= omap_hwmod_2430_data.o
 obj-$(CONFIG_ARCH_OMAP3)		+= omap_hwmod_3xxx_data.o
 obj-$(CONFIG_ARCH_OMAP4)		+= omap_hwmod_44xx_data.o
 
+#powerdomain framework
+obj-$(CONFIG_ARCH_OMAP2)		+= powerdomain2xxx_3xxx.o
+obj-$(CONFIG_ARCH_OMAP3)		+= powerdomain2xxx_3xxx.o
+obj-$(CONFIG_ARCH_OMAP4)		+= powerdomain44xx.o
+
 # EMU peripherals
 obj-$(CONFIG_OMAP3_EMU)			+= emu.o
 
arch/arm/mach-omap2/io.c +6 -1
index 76c531a..c4dc9e8 100644
@@ -316,7 +316,12 @@ void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
 {
 	u8 skip_setup_idle = 0;
 
-	pwrdm_init(powerdomains_omap, NULL);
+	if (cpu_is_omap24xx())
+		pwrdm_init(powerdomains_omap, &omap2_pwrdm_operations);
+	else if (cpu_is_omap34xx())
+		pwrdm_init(powerdomains_omap, &omap3_pwrdm_operations);
+	else if (cpu_is_omap44xx())
+		pwrdm_init(powerdomains_omap, &omap4_pwrdm_operations);
 	clkdm_init(clockdomains_omap, clkdm_autodeps);
 	if (cpu_is_omap242x())
 		omap2420_hwmod_init();
arch/arm/mach-omap2/powerdomain.c +23 -10
index 3aa3eb3..0ae1ebf 100644
@@ -439,6 +439,8 @@ int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm)
  */
 int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
 {
+	int ret = -EINVAL;
+
 	if (!pwrdm)
 		return -EINVAL;
 
@@ -448,11 +450,10 @@ int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
 	pr_debug("powerdomain: setting next powerstate for %s to %0x\n",
 		 pwrdm->name, pwrst);
 
-	prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK,
-			     (pwrst << OMAP_POWERSTATE_SHIFT),
-			     pwrdm->prcm_offs, pwrstctrl_reg_offs);
+	if (arch_pwrdm && arch_pwrdm->pwrdm_set_next_pwrst)
+		ret = arch_pwrdm->pwrdm_set_next_pwrst(pwrdm, pwrst);
 
-	return 0;
+	return ret;
 }
 
 /**
@@ -465,11 +466,15 @@ int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
  */
 int pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
 {
+	int ret = -EINVAL;
+
 	if (!pwrdm)
 		return -EINVAL;
 
-	return prm_read_mod_bits_shift(pwrdm->prcm_offs,
-				 pwrstctrl_reg_offs, OMAP_POWERSTATE_MASK);
+	if (arch_pwrdm && arch_pwrdm->pwrdm_read_next_pwrst)
+		ret = arch_pwrdm->pwrdm_read_next_pwrst(pwrdm);
+
+	return ret;
 }
 
 /**
@@ -482,11 +487,15 @@ int pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
  */
 int pwrdm_read_pwrst(struct powerdomain *pwrdm)
 {
+	int ret = -EINVAL;
+
 	if (!pwrdm)
 		return -EINVAL;
 
-	return prm_read_mod_bits_shift(pwrdm->prcm_offs,
-				 pwrstst_reg_offs, OMAP_POWERSTATEST_MASK);
+	if (arch_pwrdm && arch_pwrdm->pwrdm_read_pwrst)
+		ret = arch_pwrdm->pwrdm_read_pwrst(pwrdm);
+
+	return ret;
 }
 
 /**
@@ -499,11 +508,15 @@ int pwrdm_read_pwrst(struct powerdomain *pwrdm)
  */
 int pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
 {
+	int ret = -EINVAL;
+
 	if (!pwrdm)
 		return -EINVAL;
 
-	return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP3430_PM_PREPWSTST,
-					OMAP3430_LASTPOWERSTATEENTERED_MASK);
+	if (arch_pwrdm && arch_pwrdm->pwrdm_read_prev_pwrst)
+		ret = arch_pwrdm->pwrdm_read_prev_pwrst(pwrdm);
+
+	return ret;
 }
 
 /**
arch/arm/mach-omap2/powerdomain2xxx_3xxx.c new file +61 -0

61 lines not on this page · raw message

arch/arm/mach-omap2/powerdomain44xx.c new file +53 -0

53 lines not on this page · raw message

arch/arm/mach-omap2/powerdomains.h +17 -0
index 105cbca..5e7356d 100644
@@ -87,7 +87,24 @@ static struct powerdomain wkup_omap2_pwrdm = {
 	.prcm_offs	= WKUP_MOD,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP24XX | CHIP_IS_OMAP3430),
 };
+#endif
+
+#ifdef CONFIG_ARCH_OMAP2
+extern struct pwrdm_ops omap2_pwrdm_operations;
+#else
+static struct pwrdm_ops omap2_pwrdm_operations;
+#endif
 
+#ifdef CONFIG_ARCH_OMAP3
+extern struct pwrdm_ops omap3_pwrdm_operations;
+#else
+static struct pwrdm_ops omap3_pwrdm_operations;
+#endif
+
+#ifdef CONFIG_ARCH_OMAP4
+extern struct pwrdm_ops omap4_pwrdm_operations;
+#else
+static struct pwrdm_ops omap4_pwrdm_operations;
 #endif
 
 
Signature · 1 line
1.7.0.4
#3 lore raw

PATCH v2 3/5 OMAP: powerdomain: Arch specific funcs for logic control

Define the following architecture specific funtions for omap2/3/4 .pwrdm_set_logic_retst
.pwrdm_read_logic_pwrst
.pwrdm_read_prev_logic_pwrst
.pwrdm_read_logic_retst

Convert the platform-independent framework to call these functions.

Cc Paul Walmsley <[email protected]>
Cc Benoit Cousson <[email protected]>
Cc Kevin Hilman <[email protected]>
---
 arch/arm/mach-omap2/powerdomain.c          |   51 ++++++++++++----------------
 arch/arm/mach-omap2/powerdomain2xxx_3xxx.c |   34 ++++++++++++++++++
 arch/arm/mach-omap2/powerdomain44xx.c      |   26 ++++++++++++++
 3 files changed, 82 insertions(+), 29 deletions(-)
arch/arm/mach-omap2/powerdomain.c +22 -29
index 0ae1ebf..562a3fe 100644
@@ -532,7 +532,7 @@ int pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
  */
 int pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
 {
-	u32 v;
+	int ret = -EINVAL;
 
 	if (!pwrdm)
 		return -EINVAL;
@@ -543,17 +543,10 @@ int pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
 	pr_debug("powerdomain: setting next logic powerstate for %s to %0x\n",
 		 pwrdm->name, pwrst);
 
-	/*
-	 * The register bit names below may not correspond to the
-	 * actual names of the bits in each powerdomain's register,
-	 * but the type of value returned is the same for each
-	 * powerdomain.
-	 */
-	v = pwrst << __ffs(OMAP3430_LOGICL1CACHERETSTATE_MASK);
-	prm_rmw_mod_reg_bits(OMAP3430_LOGICL1CACHERETSTATE_MASK, v,
-			     pwrdm->prcm_offs, pwrstctrl_reg_offs);
+	if (arch_pwrdm && arch_pwrdm->pwrdm_set_logic_retst)
+		ret = arch_pwrdm->pwrdm_set_logic_retst(pwrdm, pwrst);
 
-	return 0;
+	return ret;
 }
 
 /**
@@ -696,11 +689,15 @@ int pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, u8 pwrst)
  */
 int pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
 {
+	int ret = -EINVAL;
+
 	if (!pwrdm)
 		return -EINVAL;
 
-	return prm_read_mod_bits_shift(pwrdm->prcm_offs, pwrstst_reg_offs,
-				       OMAP3430_LOGICSTATEST_MASK);
+	if (arch_pwrdm && arch_pwrdm->pwrdm_read_logic_pwrst)
+		ret = arch_pwrdm->pwrdm_read_logic_pwrst(pwrdm);
+
+	return ret;
 }
 
 /**
@@ -713,17 +710,15 @@ int pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
  */
 int pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
 {
+	int ret = -EINVAL;
+
 	if (!pwrdm)
 		return -EINVAL;
 
-	/*
-	 * The register bit names below may not correspond to the
-	 * actual names of the bits in each powerdomain's register,
-	 * but the type of value returned is the same for each
-	 * powerdomain.
-	 */
-	return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP3430_PM_PREPWSTST,
-					OMAP3430_LASTLOGICSTATEENTERED_MASK);
+	if (arch_pwrdm && arch_pwrdm->pwrdm_read_prev_logic_pwrst)
+		ret = arch_pwrdm->pwrdm_read_prev_logic_pwrst(pwrdm);
+
+	return ret;
 }
 
 /**
@@ -736,17 +731,15 @@ int pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
  */
 int pwrdm_read_logic_retst(struct powerdomain *pwrdm)
 {
+	int ret = -EINVAL;
+
 	if (!pwrdm)
 		return -EINVAL;
 
-	/*
-	 * The register bit names below may not correspond to the
-	 * actual names of the bits in each powerdomain's register,
-	 * but the type of value returned is the same for each
-	 * powerdomain.
-	 */
-	return prm_read_mod_bits_shift(pwrdm->prcm_offs, pwrstctrl_reg_offs,
-				       OMAP3430_LOGICSTATEST_MASK);
+	if (arch_pwrdm && arch_pwrdm->pwrdm_read_logic_retst)
+		ret = arch_pwrdm->pwrdm_read_logic_retst(pwrdm);
+
+	return ret;
 }
 
 /**
arch/arm/mach-omap2/powerdomain2xxx_3xxx.c +34 -0
index 02e457f..26f6e98 100644
@@ -40,6 +40,17 @@ static int omap2_pwrdm_read_pwrst(struct powerdomain *pwrdm)
 				OMAP2_PM_PWSTST, OMAP_POWERSTATEST_MASK);
 }
 
+static int omap2_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
+{
+	u32 v;
+
+	v = pwrst << __ffs(OMAP3430_LOGICL1CACHERETSTATE_MASK);
+	prm_rmw_mod_reg_bits(OMAP3430_LOGICL1CACHERETSTATE_MASK, v,
+				pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
+
+	return 0;
+}
+
 /* Applicable only for OMAP3. Not supported on OMAP2 */
 static int omap3_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
 {
@@ -47,10 +58,29 @@ static int omap3_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
 				OMAP3430_LASTPOWERSTATEENTERED_MASK);
 }
 
+static int omap3_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
+{
+	return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP2_PM_PWSTST,
+				OMAP3430_LOGICSTATEST_MASK);
+}
+
+static int omap3_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
+{
+	return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL,
+				OMAP3430_LOGICSTATEST_MASK);
+}
+
+static int omap3_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
+{
+	return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP3430_PM_PREPWSTST,
+				OMAP3430_LASTLOGICSTATEENTERED_MASK);
+}
+
 struct pwrdm_ops omap2_pwrdm_operations = {
 	.pwrdm_set_next_pwrst	= omap2_pwrdm_set_next_pwrst,
 	.pwrdm_read_next_pwrst	= omap2_pwrdm_read_next_pwrst,
 	.pwrdm_read_pwrst	= omap2_pwrdm_read_pwrst,
+	.pwrdm_set_logic_retst	= omap2_pwrdm_set_logic_retst,
 };
 
 struct pwrdm_ops omap3_pwrdm_operations = {
@@ -58,4 +88,8 @@ struct pwrdm_ops omap3_pwrdm_operations = {
 	.pwrdm_read_next_pwrst	= omap2_pwrdm_read_next_pwrst,
 	.pwrdm_read_pwrst	= omap2_pwrdm_read_pwrst,
 	.pwrdm_read_prev_pwrst	= omap3_pwrdm_read_prev_pwrst,
+	.pwrdm_set_logic_retst	= omap2_pwrdm_set_logic_retst,
+	.pwrdm_read_logic_pwrst	= omap3_pwrdm_read_logic_pwrst,
+	.pwrdm_read_logic_retst	= omap3_pwrdm_read_logic_retst,
+	.pwrdm_read_prev_logic_pwrst	= omap3_pwrdm_read_prev_logic_pwrst,
 };
arch/arm/mach-omap2/powerdomain44xx.c +26 -0
index 5f5db0a..e72ab47 100644
@@ -45,9 +45,35 @@ static int omap4_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
 				OMAP4430_LASTPOWERSTATEENTERED_MASK);
 }
 
+static int omap4_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
+{
+	u32 v;
+
+	v = pwrst << __ffs(OMAP4430_LOGICRETSTATE_MASK);
+	prm_rmw_mod_reg_bits(OMAP4430_LOGICRETSTATE_MASK, v,
+				pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL);
+
+	return 0;
+}
+
+static int omap4_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
+{
+	return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP4_PM_PWSTST,
+				OMAP4430_LOGICSTATEST_MASK);
+}
+
+static int omap4_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
+{
+	return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL,
+				OMAP4430_LOGICRETSTATE_MASK);
+}
+
 struct pwrdm_ops omap4_pwrdm_operations = {
 	.pwrdm_set_next_pwrst	= omap4_pwrdm_set_next_pwrst,
 	.pwrdm_read_next_pwrst	= omap4_pwrdm_read_next_pwrst,
 	.pwrdm_read_pwrst	= omap4_pwrdm_read_pwrst,
 	.pwrdm_read_prev_pwrst	= omap4_pwrdm_read_prev_pwrst,
+	.pwrdm_set_logic_retst	= omap4_pwrdm_set_logic_retst,
+	.pwrdm_read_logic_pwrst	= omap4_pwrdm_read_logic_pwrst,
+	.pwrdm_read_logic_retst	= omap4_pwrdm_read_logic_retst,
 };
Signature · 1 line
1.7.0.4
#4 lore raw

PATCH v2 4/5 OMAP: powerdomain: Arch specific funcs for mem control

Define the following architecture specific funtions for omap2/3/4 .pwrdm_set_mem_onst
.pwrdm_set_mem_retst
.pwrdm_read_mem_pwrst
.pwrdm_read_prev_mem_pwrst
.pwrdm_read_mem_retst
.pwrdm_clear_all_prev_pwrst
.pwrdm_enable_hdwr_sar
.pwrdm_disable_hdwr_sar
.pwrdm_wait_transition
.pwrdm_set_lowpwrstchange

Convert the platform-independent framework to call these functions.

Cc Paul Walmsley <[email protected]>
Cc Benoit Cousson <[email protected]>
Cc Kevin Hilman <[email protected]>
---
 arch/arm/mach-omap2/Makefile               |    9 +-
 arch/arm/mach-omap2/powerdomain-common.c   |  114 +++++++++++
 arch/arm/mach-omap2/powerdomain.c          |  303 +++++----------------------
 arch/arm/mach-omap2/powerdomain2xxx_3xxx.c |  131 ++++++++++++
 arch/arm/mach-omap2/powerdomain44xx.c      |   85 ++++++++
 arch/arm/mach-omap2/powerdomains.h         |    4 +
 6 files changed, 395 insertions(+), 251 deletions(-)
 create mode 100644 arch/arm/mach-omap2/powerdomain-common.c
arch/arm/mach-omap2/Makefile +5 -4
index c982ba4..a86d7b7 100644
@@ -9,7 +9,7 @@ obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o \
 omap-2-3-common				= irq.o sdrc.o prm2xxx_3xxx.o
 hwmod-common				= omap_hwmod.o \
 					  omap_hwmod_common_data.o
-prcm-common				= prcm.o powerdomain.o
+prcm-common				= prcm.o
 clock-common				= clock.o clock_common_data.o \
 					  clockdomain.o clkt_dpll.o \
 					  clkt_clksel.o
@@ -95,9 +95,10 @@ obj-$(CONFIG_ARCH_OMAP3)		+= omap_hwmod_3xxx_data.o
 obj-$(CONFIG_ARCH_OMAP4)		+= omap_hwmod_44xx_data.o
 
 #powerdomain framework
-obj-$(CONFIG_ARCH_OMAP2)		+= powerdomain2xxx_3xxx.o
-obj-$(CONFIG_ARCH_OMAP3)		+= powerdomain2xxx_3xxx.o
-obj-$(CONFIG_ARCH_OMAP4)		+= powerdomain44xx.o
+powerdomain-common			+= powerdomain.o powerdomain-common.o
+obj-$(CONFIG_ARCH_OMAP2)		+= $(powerdomain-common) powerdomain2xxx_3xxx.o
+obj-$(CONFIG_ARCH_OMAP3)		+= $(powerdomain-common) powerdomain2xxx_3xxx.o
+obj-$(CONFIG_ARCH_OMAP4)		+= $(powerdomain-common) powerdomain44xx.o
 
 # EMU peripherals
 obj-$(CONFIG_OMAP3_EMU)			+= emu.o
arch/arm/mach-omap2/powerdomain-common.c new file +114 -0

114 lines not on this page · raw message

arch/arm/mach-omap2/powerdomain.c +56 -247

458 lines not on this page · raw message

arch/arm/mach-omap2/powerdomain2xxx_3xxx.c +131 -0

158 lines not on this page · raw message

arch/arm/mach-omap2/powerdomain44xx.c +85 -0

109 lines not on this page · raw message

arch/arm/mach-omap2/powerdomains.h +4 -0
index 5e7356d..e288189 100644
@@ -108,6 +108,10 @@ static struct pwrdm_ops omap4_pwrdm_operations;
 #endif
 
 
+int _get_mem_bank_onstate_mask(u8 bank);
+int _get_mem_bank_retst_mask(u8 bank);
+int _get_mem_bank_stst_mask(u8 bank);
+
 /* As powerdomains are added or removed above, this list must also be changed */
 static struct powerdomain *powerdomains_omap[] __initdata = {
 
Signature · 1 line
1.7.0.4
#5 lore raw

PATCH v2 5/5 OMAP4: powerdomain: Add pwrdm_clear_all_prev_pwrst

From: Santosh Shilimkar <[email protected]>

OMAP4430 ES2 has additional bitfields in PWRSTST register which help identify the previous power state entered by the powerdomain. Add pwrdm_clear_all_prev_pwrst api to support this.

Cc Paul Walmsley <[email protected]>
Cc Benoit Cousson <[email protected]>
Cc Kevin Hilman <[email protected]>
---
 arch/arm/mach-omap2/powerdomain44xx.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/powerdomain44xx.c +9 -0
index d9d4f88..10d7e8a 100644
@@ -53,6 +53,14 @@ static int omap4_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm)
 	return 0;
 }
 
+static int omap4_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
+{
+	prm_rmw_mod_reg_bits(OMAP4430_LASTPOWERSTATEENTERED_MASK,
+				OMAP4430_LASTPOWERSTATEENTERED_MASK,
+				pwrdm->prcm_offs, OMAP4_PM_PWSTST);
+	return 0;
+}
+
 static int omap4_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
 {
 	u32 v;
@@ -153,6 +161,7 @@ struct pwrdm_ops omap4_pwrdm_operations = {
 	.pwrdm_read_pwrst	= omap4_pwrdm_read_pwrst,
 	.pwrdm_read_prev_pwrst	= omap4_pwrdm_read_prev_pwrst,
 	.pwrdm_set_lowpwrstchange	= omap4_pwrdm_set_lowpwrstchange,
+	.pwrdm_clear_all_prev_pwrst	= omap4_pwrdm_clear_all_prev_pwrst,
 	.pwrdm_set_logic_retst	= omap4_pwrdm_set_logic_retst,
 	.pwrdm_read_logic_pwrst	= omap4_pwrdm_read_logic_pwrst,
 	.pwrdm_read_logic_retst	= omap4_pwrdm_read_logic_retst,
Signature · 1 line
1.7.0.4
maintainer
#6 lore raw
In reply to Rajendra Nayak

Hi,

thanks for making the requested changes. However, this series results in compilation warnings:

CC arch/arm/mach-omap2/powerdomain2xxx_3xxx.o
arch/arm/mach-omap2/powerdomains.h:116: warning: 'powerdomains_omap' defined but not used
CC arch/arm/mach-omap2/powerdomain44xx.o
arch/arm/mach-omap2/powerdomains.h:116: warning: 'powerdomains_omap' defined but not used

and sparse warnings:

WARNING: externs should be avoided in .c files #115: FILE: arch/arm/mach-omap2/powerdomain-common.c:50:
+int _get_mem_bank_onstate_mask(u8 bank);

WARNING: externs should be avoided in .c files #116: FILE: arch/arm/mach-omap2/powerdomain-common.c:51:
+int _get_mem_bank_retst_mask(u8 bank);

WARNING: externs should be avoided in .c files #117: FILE: arch/arm/mach-omap2/powerdomain-common.c:52:
+int _get_mem_bank_stst_mask(u8 bank);

Please fix these and re-send.

regards

- Paul

#7 lore raw

Hi Paul,

Quoted 5 lines

-----Original Message-----
From: Paul Walmsley [mailto:[email protected]]
Sent: Thursday, December 02, 2010 1:39 AM
To: Rajendra Nayak
Cc: [email protected]; [email protected];

[email protected]

Quoted 1 line

Subject: Re: [PATCH v2 0/5] Split powerdomain framework into plat

specific/independent

Quoted 5 lines

Hi,

thanks for making the requested changes. However, this series results

in

Quoted 1 line

compilation warnings:

Sorry about that, my bad. Should have caught those before posting the series :(

Quoted 7 lines

CC arch/arm/mach-omap2/powerdomain2xxx_3xxx.o
arch/arm/mach-omap2/powerdomains.h:116: warning: 'powerdomains_omap' defined but not used
CC arch/arm/mach-omap2/powerdomain44xx.o
arch/arm/mach-omap2/powerdomains.h:116: warning: 'powerdomains_omap' defined but not used

This seems to be popping up with powerdomains.h file (which now has func declarations) being included in multiple source files. It earlier had only static structs and was included in one source file.

I thought the right way to fix this was to probably move the static structs from the header into a source file.
See if the below patch makes sense. Also attached as I don't trust my mailer.

Quoted 1 line

From 130363d172d6c6821f48b1a4fa93c512eb18e0ef Mon Sep 17 00:00:00 2001

From: Rajendra Nayak <[email protected]>
Date: Thu, 2 Dec 2010 17:26:13 +0530
Subject: [PATCH] OMAP: powerdomain: Move static structs out of powerdomains.h header

powerdomains.h header today has only static struct definitions. Adding any function declarations into it and including it in multiple source file is expected to cause issues.
Hence move the powerdomains.h file into powerdomains_data.c file.

---
 arch/arm/mach-omap2/Makefile                       |    2 +-
 arch/arm/mach-omap2/clockdomains.h                 |    5 +++++
 arch/arm/mach-omap2/io.c                           |    3 +--
 .../{powerdomains.h => powerdomains_data.c}        |   10 +++++-----
 arch/arm/plat-omap/include/plat/powerdomain.h      |    1 +
 5 files changed, 13 insertions(+), 8 deletions(-)
 rename arch/arm/mach-omap2/{powerdomains.h => powerdomains_data.c} (97%)
arch/arm/mach-omap2/Makefile +0 -0
index 60e51bc..5e20bc5 100644
@@ -9,7 +9,7 @@ obj-y := id.o io.o control.o mux.o devices.o serial.o

gpmc.o timer-gp.o pm.o \
omap-2-3-common = irq.o sdrc.o
prm2xxx_3xxx.o
hwmod-common = omap_hwmod.o \
omap_hwmod_common_data.o
-prcm-common = prcm.o powerdomain.o
+prcm-common = prcm.o powerdomain.o
powerdomains_data.o
clock-common = clock.o clock_common_data.o \
clockdomain.o clkt_dpll.o \
clkt_clksel.o

(quoted diff) +0 -0

b/arch/arm/mach-omap2/clockdomains.h
index 8fc19ff..2a3b10a 100644

arch/arm/mach-omap2/clockdomains.h +5 -0
@@ -38,6 +38,11 @@
 #include <plat/clockdomain.h>
 #include "cm.h"
 #include "prm.h"
+#include "cm-regbits-24xx.h"
+#include "cm-regbits-34xx.h"
+#include "cm-regbits-44xx.h"
+#include "prm-regbits-24xx.h"
+#include "prm-regbits-34xx.h"
 
 /*
  * Clockdomain dependencies for wkdeps/sleepdeps
arch/arm/mach-omap2/io.c +0 -1
index 40562dd..889999d 100644
@@ -40,7 +40,6 @@
 
 #include <plat/omap-pm.h>
 #include <plat/powerdomain.h>
-#include "powerdomains.h"
 
 #include <plat/clockdomain.h>
 #include "clockdomains.h"
@@ -316,7 +315,7 @@ void __init omap2_init_common_hw(struct

omap_sdrc_params *sdrc_cs0,
{
u8 skip_setup_idle = 0;

- pwrdm_init(powerdomains_omap);
+ pwrdm_initialise();
clkdm_init(clockdomains_omap, clkdm_autodeps); if (cpu_is_omap242x())
omap2420_hwmod_init();

(quoted diff) +0 -0

b/arch/arm/mach-omap2/powerdomains_data.c
similarity index 97%
rename from arch/arm/mach-omap2/powerdomains.h
rename to arch/arm/mach-omap2/powerdomains_data.c
index 105cbca..dc6b7f8 100644

arch/arm/mach-omap2/powerdomains_data.c renamed from arch/arm/mach-omap2/powerdomains.h +1 -3
@@ -18,9 +18,6 @@
  *    Clock Domain Framework
  */
 
-#ifndef ARCH_ARM_MACH_OMAP2_POWERDOMAINS
-#define ARCH_ARM_MACH_OMAP2_POWERDOMAINS
-
 /*
  * This file contains all of the powerdomains that have some element
  * of software control for the OMAP24xx and OMAP34xx chips.
@@ -49,6 +46,7 @@
  * address offset is different between the C55 and C64 DSPs.
  */
 
+#include <linux/init.h>
 #include <plat/powerdomain.h>
 
 #include "prcm-common.h"
@@ -149,5 +147,7 @@ static struct powerdomain *powerdomains_omap[]

__initdata = {
NULL
};

-
-#endif
+void pwrdm_initialise(void)
+{
+ pwrdm_init(powerdomains_omap);
+}

(quoted diff) +0 -0

b/arch/arm/plat-omap/include/plat/powerdomain.h
index 9ca420d..5e96793 100644

arch/arm/plat-omap/include/plat/powerdomain.h +1 -0
@@ -118,6 +118,7 @@ struct powerdomain {
 };
 
 
+void pwrdm_initialise(void);
 void pwrdm_init(struct powerdomain **pwrdm_list);
 
 struct powerdomain *pwrdm_lookup(const char *name);
Signature · 1 line
1.7.0.4

From 130363d172d6c6821f48b1a4fa93c512eb18e0ef Mon Sep 17 00:00:00 2001
From: Rajendra Nayak <[email protected]>
Date: Thu, 2 Dec 2010 17:26:13 +0530
Subject: [PATCH] OMAP: powerdomain: Move static structs out of powerdomains.h header

powerdomains.h header today has only static struct definitions. Adding any function declarations into it and including it in multiple source file is expected to cause issues.
Hence move the powerdomains.h file into powerdomains_data.c file.

---
 arch/arm/mach-omap2/Makefile                       |    2 +-
 arch/arm/mach-omap2/clockdomains.h                 |    5 +++++
 arch/arm/mach-omap2/io.c                           |    3 +--
 .../{powerdomains.h => powerdomains_data.c}        |   10 +++++-----
 arch/arm/plat-omap/include/plat/powerdomain.h      |    1 +
 5 files changed, 13 insertions(+), 8 deletions(-)
 rename arch/arm/mach-omap2/{powerdomains.h => powerdomains_data.c} (97%)
arch/arm/mach-omap2/Makefile +1 -1
index 60e51bc..5e20bc5 100644
@@ -9,7 +9,7 @@ obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o \
 omap-2-3-common				= irq.o sdrc.o prm2xxx_3xxx.o
 hwmod-common				= omap_hwmod.o \
 					  omap_hwmod_common_data.o
-prcm-common				= prcm.o powerdomain.o
+prcm-common				= prcm.o powerdomain.o powerdomains_data.o
 clock-common				= clock.o clock_common_data.o \
 					  clockdomain.o clkt_dpll.o \
 					  clkt_clksel.o
arch/arm/mach-omap2/clockdomains.h +5 -0
index 8fc19ff..2a3b10a 100644
@@ -38,6 +38,11 @@
 #include <plat/clockdomain.h>
 #include "cm.h"
 #include "prm.h"
+#include "cm-regbits-24xx.h"
+#include "cm-regbits-34xx.h"
+#include "cm-regbits-44xx.h"
+#include "prm-regbits-24xx.h"
+#include "prm-regbits-34xx.h"
 
 /*
  * Clockdomain dependencies for wkdeps/sleepdeps
arch/arm/mach-omap2/io.c +1 -2
index 40562dd..889999d 100644
@@ -40,7 +40,6 @@
 
 #include <plat/omap-pm.h>
 #include <plat/powerdomain.h>
-#include "powerdomains.h"
 
 #include <plat/clockdomain.h>
 #include "clockdomains.h"
@@ -316,7 +315,7 @@ void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
 {
 	u8 skip_setup_idle = 0;
 
-	pwrdm_init(powerdomains_omap);
+	pwrdm_initialise();
 	clkdm_init(clockdomains_omap, clkdm_autodeps);
 	if (cpu_is_omap242x())
 		omap2420_hwmod_init();
arch/arm/mach-omap2/powerdomains_data.c renamed from arch/arm/mach-omap2/powerdomains.h +5 -5
similarity index 97%
rename from arch/arm/mach-omap2/powerdomains.h
rename to arch/arm/mach-omap2/powerdomains_data.c
index 105cbca..dc6b7f8 100644
@@ -18,9 +18,6 @@
  *    Clock Domain Framework
  */
 
-#ifndef ARCH_ARM_MACH_OMAP2_POWERDOMAINS
-#define ARCH_ARM_MACH_OMAP2_POWERDOMAINS
-
 /*
  * This file contains all of the powerdomains that have some element
  * of software control for the OMAP24xx and OMAP34xx chips.
@@ -49,6 +46,7 @@
  * address offset is different between the C55 and C64 DSPs.
  */
 
+#include <linux/init.h>
 #include <plat/powerdomain.h>
 
 #include "prcm-common.h"
@@ -149,5 +147,7 @@ static struct powerdomain *powerdomains_omap[] __initdata = {
 	NULL
 };
 
-
-#endif
+void pwrdm_initialise(void)
+{
+	pwrdm_init(powerdomains_omap);
+}
arch/arm/plat-omap/include/plat/powerdomain.h +1 -0
index 9ca420d..5e96793 100644
@@ -118,6 +118,7 @@ struct powerdomain {
 };
 
 
+void pwrdm_initialise(void);
 void pwrdm_init(struct powerdomain **pwrdm_list);
 
 struct powerdomain *pwrdm_lookup(const char *name);
Signature · 1 line
1.7.0.4
maintainer
#8 lore raw

Hi Rajendra,

Quoted 8 lines · Rajendra Nayak

This seems to be popping up with powerdomains.h file (which now has func declarations) being included in multiple source files. It earlier had only static structs and was included in one source file.

I thought the right way to fix this was to probably move the static structs from the header into a source file.
See if the below patch makes sense. Also attached as I don't trust my mailer.

Yes, that general approach looks fine to me. I've got some patches here that will be posted once this powerdomain series is done to convert all the remaining static allocations in .h files into .c files.

- Paul

#9 lore raw
Quoted 5 lines

-----Original Message-----
From: Paul Walmsley [mailto:[email protected]]
Sent: Friday, December 03, 2010 2:11 PM
To: Rajendra Nayak
Cc: [email protected]; [email protected]; Benoit

Cousson

Quoted 1 line

Subject: RE: [PATCH v2 0/5] Split powerdomain framework into plat

specific/independent

Quoted 7 lines

Hi Rajendra,

Quoted 2 lines · Rajendra Nayak

This seems to be popping up with powerdomains.h file (which now has func declarations) being included in multiple source files. It

earlier

Quoted 10 lines
Quoted 6 lines

had only static structs and was included in one source file.

I thought the right way to fix this was to probably move the static structs from the header into a source file.
See if the below patch makes sense. Also attached as I don't trust my mailer.

Yes, that general approach looks fine to me. I've got some patches here that will be posted once this powerdomain series is done to convert all the remaining static allocations in .h files into .c files.

Ok, so I'll repost the series with this patch included as well so that the warnings are'nt thrown anymore.

Quoted 3 lines

- Paul