Skip to contentSkip to conversation

OMAP3: PM: Fix for MPU power domain MEM BANK position

PATCH Superseded Thara Gopinath 4 participants 9 messages Aug 27, 2009 – Nov 23, 2009

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OMAP3: PM: Fix for MPU power domain MEM BANK position

MPU power domain bank 0 bits are displayed in position of bank 1 in PWRSTS and PREPWRSTS registers. So read them from correct position

---
 arch/arm/mach-omap2/powerdomain.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/powerdomain.c +19 -0
index 2594cbf..6c5fee9 100644
@@ -971,6 +971,16 @@ int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
 		return -EEXIST;
 
 	/*
+	 * In 3430, for MPU domain bank 0 status bits
+	 * are displayed in the position of bank1 status bits
+	 * in PWST  . So the hack. Think of a cleaner
+	 * way of doing this
+	 */
+	if (cpu_is_omap34xx)
+		if (!strcmp("mpu_pwrdm", pwrdm->name))
+			bank = 1;
+
+	/*
 	 * 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
@@ -1018,6 +1028,15 @@ int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
 		return -EEXIST;
 
 	/*
+	 * In 3430, for MPU domain bank 0 status bits
+	 * are displayed in the position of bank1 status bits
+	 * in PREPWST  . So the hack. Think of a cleaner
+	 * way of doing this
+	 */
+	if (cpu_is_omap34xx)
+		if (!strcmp("mpu_pwrdm", pwrdm->name))
+			bank = 1;
+	/*
 	 * 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
Signature · 1 line
1.5.4.7
#1 lore raw

Thara,

Quoted 23 lines

-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Thara Gopinath
Sent: Thursday, August 27, 2009 11:48 AM
To: [email protected]
Cc: Gopinath, Thara
Subject: [PATCH] OMAP3: PM: Fix for MPU power domain MEM BANK position

MPU power domain bank 0 bits are displayed in position of bank 1 in PWRSTS and PREPWRSTS registers. So read them from correct position

---
 arch/arm/mach-omap2/powerdomain.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-omap2/powerdomain.c +0 -0

omap2/powerdomain.c
index 2594cbf..6c5fee9 100644

arch/arm/mach-omap2/powerdomain.c int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, · line 980

Quoted 10 lines
arch/arm/mach-omap2/powerdomain.c +6 -0
@@ -971,6 +971,16 @@ int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm,
 u8 bank)
 		return -EEXIST;
 
 	/*
+	 * In 3430, for MPU domain bank 0 status bits
+	 * are displayed in the position of bank1 status bits
+	 * in PWST  . So the hack. Think of a cleaner
+	 * way of doing this
+	 */
+	if (cpu_is_omap34xx)

AFAIK, above should be:

	if (cpu_is_omap34xx())

Instead, which is how it's being used everywhere else in the kernel.

Quoted 8 lines
arch/arm/mach-omap2/powerdomain.c +4 -0
+		if (!strcmp("mpu_pwrdm", pwrdm->name))
+			bank = 1;
+
+	/*
 	 * The register bit names below may not correspond to the
 	 * actual names of the bits in each powerdomain's register,
arch/arm/mach-omap2/powerdomain.c +0 -0
 	 * but the type of value returned is the same for each

arch/arm/mach-omap2/powerdomain.c int pwrdm_read_prev_mem_pwrst(struct powerdomain · line 1037

Quoted 10 lines
arch/arm/mach-omap2/powerdomain.c +6 -0
@@ -1018,6 +1028,15 @@ int pwrdm_read_prev_mem_pwrst(struct powerdomain
 *pwrdm, u8 bank)
 		return -EEXIST;
 
 	/*
+	 * In 3430, for MPU domain bank 0 status bits
+	 * are displayed in the position of bank1 status bits
+	 * in PREPWST  . So the hack. Think of a cleaner
+	 * way of doing this
+	 */
+	if (cpu_is_omap34xx)

Same here.

Regards,
Sergio

Quoted 13 lines
arch/arm/mach-omap2/powerdomain.c +3 -0
+		if (!strcmp("mpu_pwrdm", pwrdm->name))
+			bank = 1;
+	/*
 	 * 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
--
1.5.4.7

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

PATCH v2 1/1 OMAP3: PM: Fix for MPU power domain MEM BANK position

MPU power domain bank 0 bits are displayed in position of bank 1 in PWRSTS and PREPWRSTS registers. So read them from correct position

---
Patch refresh issue.

 arch/arm/mach-omap2/powerdomain.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/powerdomain.c +19 -0
index 2594cbf..6c5fee9 100644
@@ -971,6 +971,16 @@ int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
 		return -EEXIST;
 
 	/*
+	 * In 3430, for MPU domain bank 0 status bits
+	 * are displayed in the position of bank1 status bits
+	 * in PWST  . So the hack. Think of a cleaner
+	 * way of doing this
+	 */
+	if (cpu_is_omap34xx())
+		if (!strcmp("mpu_pwrdm", pwrdm->name))
+			bank = 1;
+
+	/*
 	 * 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
@@ -1018,6 +1028,15 @@ int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
 		return -EEXIST;
 
 	/*
+	 * In 3430, for MPU domain bank 0 status bits
+	 * are displayed in the position of bank1 status bits
+	 * in PREPWST  . So the hack. Think of a cleaner
+	 * way of doing this
+	 */
+	if (cpu_is_omap34xx())
+		if (!strcmp("mpu_pwrdm", pwrdm->name))
+			bank = 1;
+	/*
 	 * 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
Signature · 1 line
1.5.4.7
#3 lore raw
Quoted 16 lines · Thara Gopinath

MPU power domain bank 0 bits are displayed in position of bank 1 in PWRSTS and PREPWRSTS registers. So read them from correct position

---
Patch refresh issue.

 arch/arm/mach-omap2/powerdomain.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/powerdomain.c +0 -0
index 2594cbf..6c5fee9 100644

arch/arm/mach-omap2/powerdomain.c int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank) · line 980

Quoted 10 lines
arch/arm/mach-omap2/powerdomain.c +7 -0
@@ -971,6 +971,16 @@ int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
 		return -EEXIST;
 
 	/*
+	 * In 3430, for MPU domain bank 0 status bits
+	 * are displayed in the position of bank1 status bits
+	 * in PWST  . So the hack. Think of a cleaner
+	 * way of doing this
+	 */
+	if (cpu_is_omap34xx())
+		if (!strcmp("mpu_pwrdm", pwrdm->name))

Rather than a string compare, you chould check

               if (pwrdm->prcm_offs == MPU_MOD)

arch/arm/mach-omap2/powerdomain.c int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank) · line 986

Quoted 6 lines
arch/arm/mach-omap2/powerdomain.c +3 -0
+			bank = 1;
+
+	/*
 	 * 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

This comment should also be changed because based on this patch, it doesn't seem to be true.

Paul, are you OK with Thara's proposed change?

Otherwise, seems like the right fix is to have the shift value for each bank encoded into the struct powerdomain. Looks like the would all be identical except MPU.

The patch below is a proposal/hack for how this could look, but it was only done for the MPU powerdomain. The others would need to be completed.

Kevin

commit 7b4c705dc524b7c002284b2bf644ffc664d30b04

Author: Kevin Hilman <[email protected]>
Date:   Tue Sep 15 09:16:14 2009 -0700

OMAP3: powerdomain: encode per-bank shift values for memory state

The current and previous state of a powerdomains memory state are encoded in the PM_PWSTST and PM_PREPWSTST registers. For most powerdomains, the shift values are the same for each bank, but for some they may be different.

This patch adds the per-bank shift values for each powerdomain to the struct powerdomain so the code to read the values can be the same across all powerdomains.

arch/arm/mach-omap2/powerdomain.c +4 -46
index 2594cbf..5181adc 100644
@@ -970,29 +970,8 @@ int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
 	if (pwrdm->banks < (bank + 1))
 		return -EEXIST;
 
-	/*
-	 * 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.
-	 */
-	switch (bank) {
-	case 0:
-		m = OMAP3430_SHAREDL1CACHEFLATSTATEST_MASK;
-		break;
-	case 1:
-		m = OMAP3430_L1FLATMEMSTATEST_MASK;
-		break;
-	case 2:
-		m = OMAP3430_SHAREDL2CACHEFLATSTATEST_MASK;
-		break;
-	case 3:
-		m = OMAP3430_L2FLATMEMSTATEST_MASK;
-		break;
-	default:
-		WARN_ON(1); /* should never happen */
-		return -EEXIST;
-	}
+	m = pwrdm->pwrsts_mem_shift[bank];
+	WARN_ON(!m);
 
 	return prm_read_mod_bits_shift(pwrdm->prcm_offs, PM_PWSTST, m);
 }
@@ -1017,29 +996,8 @@ int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
 	if (pwrdm->banks < (bank + 1))
 		return -EEXIST;
 
-	/*
-	 * 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.
-	 */
-	switch (bank) {
-	case 0:
-		m = OMAP3430_LASTMEM1STATEENTERED_MASK;
-		break;
-	case 1:
-		m = OMAP3430_LASTMEM2STATEENTERED_MASK;
-		break;
-	case 2:
-		m = OMAP3430_LASTSHAREDL2CACHEFLATSTATEENTERED_MASK;
-		break;
-	case 3:
-		m = OMAP3430_LASTL2FLATMEMSTATEENTERED_MASK;
-		break;
-	default:
-		WARN_ON(1); /* should never happen */
-		return -EEXIST;
-	}
+	m = pwrdm->pwrsts_mem_shift[bank];
+	WARN_ON(!m);
 
 	return prm_read_mod_bits_shift(pwrdm->prcm_offs,
 					OMAP3430_PM_PREPWSTST, m);
arch/arm/mach-omap2/powerdomains34xx.h +3 -0
index aa557b2..960cc84 100644
@@ -191,6 +191,9 @@ static struct powerdomain mpu_34xx_pwrdm = {
 	.pwrsts		  = PWRSTS_OFF_RET_ON,
 	.pwrsts_logic_ret = PWRSTS_OFF_RET,
 	.banks		  = 1,
+	.pwrsts_mem_shift = {
+		[0] = OMAP3430_L2CACHESTATEST_SHIFT,
+	},
 	.pwrsts_mem_ret	  = {
 		[0] = PWRSTS_OFF_RET,
 	},
arch/arm/plat-omap/include/mach/powerdomain.h +3 -0
index 6271d85..8a0c41d 100644
@@ -106,6 +106,9 @@ struct powerdomain {
 	/* Number of software-controllable memory banks in this powerdomain */
 	const u8 banks;
 
+	/* Memory state shift value for each bank */
+	const u8 pwrsts_mem_shift[PWRDM_MAX_MEM_BANKS];
+
 	/* Possible memory bank pwrstates when pwrdm in RETENTION */
 	const u8 pwrsts_mem_ret[PWRDM_MAX_MEM_BANKS];
 
#4 lore raw
In reply to Thara Gopinath

Hi Thara,

I regret the delay. A comment:

Quoted 3 lines · Thara Gopinath

MPU power domain bank 0 bits are displayed in position of bank 1 in PWRSTS and PREPWRSTS registers. So read them from correct position

Indeed. What do you think about a slightly different approach: changing powerdomains34xx.h to be correct? In other words, instead of

	.pwrsts_mem_ret	  = {
		[0] = PWRSTS_OFF_RET,
	},
	.pwrsts_mem_on	  = {
		[0] = PWRSTS_OFF_ON,
	},

we would use:

	.pwrsts_mem_ret	  = {
		[1] = PWRSTS_OFF_RET,
	},
	.pwrsts_mem_on	  = {
		[1] = PWRSTS_OFF_ON,
	},

We have to deal with the bank count field in struct powerdomain - we could just convert it into a bitmap representing available banks. So instead of:

        .banks = 1,

use maybe:

	.banks = PWRDM_BANK_1,  /* | PWRDM_BANK_0, etc */

Can you foresee any problems with the above approach?

- Paul

Quoted 50 lines

Patch refresh issue.

 arch/arm/mach-omap2/powerdomain.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/powerdomain.c +19 -0
index 2594cbf..6c5fee9 100644
@@ -971,6 +971,16 @@ int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
 		return -EEXIST;
 
 	/*
+	 * In 3430, for MPU domain bank 0 status bits
+	 * are displayed in the position of bank1 status bits
+	 * in PWST  . So the hack. Think of a cleaner
+	 * way of doing this
+	 */
+	if (cpu_is_omap34xx())
+		if (!strcmp("mpu_pwrdm", pwrdm->name))
+			bank = 1;
+
+	/*
 	 * 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
@@ -1018,6 +1028,15 @@ int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
 		return -EEXIST;
 
 	/*
+	 * In 3430, for MPU domain bank 0 status bits
+	 * are displayed in the position of bank1 status bits
+	 * in PREPWST  . So the hack. Think of a cleaner
+	 * way of doing this
+	 */
+	if (cpu_is_omap34xx())
+		if (!strcmp("mpu_pwrdm", pwrdm->name))
+			bank = 1;
+	/*
 	 * 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
Signature · 6 lines
1.5.4.7

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

- Paul

#5 lore raw

Thanks Paul. The bit positions are goofed up only in PWRSTS and PREPWRSTS not in PWSTCTRL register. As per the approach you have suggested below, if we change the mem bank number from 0 to 1 , we will have to change the logic for read/write into PWSTCTRL for mpu pwr domain.

Regards
Thara

Quoted 104 lines
Quoted 104 lines

-----Original Message-----
From: Paul Walmsley [mailto:[email protected]]
Sent: Thursday, October 15, 2009 4:51 AM
To: Gopinath, Thara
Cc: [email protected]; [email protected]
Subject: Re: [PATCH V2] OMAP3: PM: Fix for MPU power domain MEM BANK position

Hi Thara,

I regret the delay. A comment:

Quoted 3 lines · Thara Gopinath

MPU power domain bank 0 bits are displayed in position of bank 1 in PWRSTS and PREPWRSTS registers. So read them from correct position

Indeed. What do you think about a slightly different approach: changing powerdomains34xx.h to be correct? In other words, instead of

	.pwrsts_mem_ret	  = {
		[0] = PWRSTS_OFF_RET,
	},
	.pwrsts_mem_on	  = {
		[0] = PWRSTS_OFF_ON,
	},

we would use:

	.pwrsts_mem_ret	  = {
		[1] = PWRSTS_OFF_RET,
	},
	.pwrsts_mem_on	  = {
		[1] = PWRSTS_OFF_ON,
	},

We have to deal with the bank count field in struct powerdomain - we could just convert it into a bitmap representing available banks. So instead of:

       .banks = 1,

use maybe:

	.banks = PWRDM_BANK_1,  /* | PWRDM_BANK_0, etc */

Can you foresee any problems with the above approach?

- Paul

Quoted 45 lines

Patch refresh issue.

 arch/arm/mach-omap2/powerdomain.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/powerdomain.c +19 -1
index 2594cbf..6c5fee9 100644
@@ -971,6 +971,16 @@ int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
 		return -EEXIST;
 
 	/*
+	 * In 3430, for MPU domain bank 0 status bits
+	 * are displayed in the position of bank1 status bits
+	 * in PWST  . So the hack. Think of a cleaner
+	 * way of doing this
+	 */
+	if (cpu_is_omap34xx())
+		if (!strcmp("mpu_pwrdm", pwrdm->name))
+			bank = 1;
+
+	/*
 	 * 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
@@ -1018,6 +1028,15 @@ int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
 		return -EEXIST;
 
 	/*
+	 * In 3430, for MPU domain bank 0 status bits
+	 * are displayed in the position of bank1 status bits
+	 * in PREPWST  . So the hack. Think of a cleaner
+	 * way of doing this
+	 */
+	if (cpu_is_omap34xx())
+		if (!strcmp("mpu_pwrdm", pwrdm->name))
+			bank = 1;
+	/*
 	 * 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
--

1.5.4.7

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

- Paul

#6 lore raw

Hi Thara,

Quoted 5 lines · Thara

Thanks Paul. The bit positions are goofed up only in PWRSTS and PREPWRSTS not in PWSTCTRL register. As per the approach you have suggested below, if we change the mem bank number from 0 to 1 , we will have to change the logic for read/write into PWSTCTRL for mpu pwr domain.

Okay. Here's what I'd propose: rather than testing for the powerdomain name in the function, or testing for the MPU PRCM module offset, let's add a new powerdomain flag into powerdomain.h,

#define PWRDM_OMAP3_MPU_QUIRK (1 << 1) /* MPU bit pos quirk */

or something similar. Then let's set that for the mpu_pwrdm in powerdomains34xx.h and test for that flag in powerdomain.c.

I prefer this since RMK has previously NAK'ed strcmp()s for this sort of thing, for good reason, and testing the PRCM internal module offset has many of the same problems.

Sound reasonable?

- Paul

Quoted 109 lines

Regards
Thara

Quoted 104 lines
Quoted 104 lines

-----Original Message-----
From: Paul Walmsley [mailto:[email protected]]
Sent: Thursday, October 15, 2009 4:51 AM
To: Gopinath, Thara
Cc: [email protected]; [email protected]
Subject: Re: [PATCH V2] OMAP3: PM: Fix for MPU power domain MEM BANK position

Hi Thara,

I regret the delay. A comment:

Quoted 3 lines · Thara Gopinath

MPU power domain bank 0 bits are displayed in position of bank 1 in PWRSTS and PREPWRSTS registers. So read them from correct position

Indeed. What do you think about a slightly different approach: changing powerdomains34xx.h to be correct? In other words, instead of

	.pwrsts_mem_ret	  = {
		[0] = PWRSTS_OFF_RET,
	},
	.pwrsts_mem_on	  = {
		[0] = PWRSTS_OFF_ON,
	},

we would use:

	.pwrsts_mem_ret	  = {
		[1] = PWRSTS_OFF_RET,
	},
	.pwrsts_mem_on	  = {
		[1] = PWRSTS_OFF_ON,
	},

We have to deal with the bank count field in struct powerdomain - we could just convert it into a bitmap representing available banks. So instead of:

       .banks = 1,

use maybe:

	.banks = PWRDM_BANK_1,  /* | PWRDM_BANK_0, etc */

Can you foresee any problems with the above approach?

- Paul

Quoted 45 lines

Patch refresh issue.

 arch/arm/mach-omap2/powerdomain.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/powerdomain.c +19 -1
index 2594cbf..6c5fee9 100644
@@ -971,6 +971,16 @@ int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
 		return -EEXIST;
 
 	/*
+	 * In 3430, for MPU domain bank 0 status bits
+	 * are displayed in the position of bank1 status bits
+	 * in PWST  . So the hack. Think of a cleaner
+	 * way of doing this
+	 */
+	if (cpu_is_omap34xx())
+		if (!strcmp("mpu_pwrdm", pwrdm->name))
+			bank = 1;
+
+	/*
 	 * 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
@@ -1018,6 +1028,15 @@ int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
 		return -EEXIST;
 
 	/*
+	 * In 3430, for MPU domain bank 0 status bits
+	 * are displayed in the position of bank1 status bits
+	 * in PREPWST  . So the hack. Think of a cleaner
+	 * way of doing this
+	 */
+	if (cpu_is_omap34xx())
+		if (!strcmp("mpu_pwrdm", pwrdm->name))
+			bank = 1;
+	/*
 	 * 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
--

1.5.4.7

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

- Paul

- Paul

#7 lore raw

Yes sounds definitely reasonable :-). I agree,we should try to do away with the strcmp if possible. I will implement the same and repost this fix.

Regards
Thara

Quoted 148 lines
Quoted 148 lines

-----Original Message-----
From: Paul Walmsley [mailto:[email protected]]
Sent: Friday, October 16, 2009 1:51 PM
To: Gopinath, Thara
Cc: [email protected]; [email protected]
Subject: RE: [PATCH V2] OMAP3: PM: Fix for MPU power domain MEM BANK position

Hi Thara,

Quoted 5 lines · Thara

Thanks Paul. The bit positions are goofed up only in PWRSTS and PREPWRSTS not in PWSTCTRL register. As per the approach you have suggested below, if we change the mem bank number from 0 to 1 , we will have to change the logic for read/write into PWSTCTRL for mpu pwr domain.

Okay. Here's what I'd propose: rather than testing for the powerdomain name in the function, or testing for the MPU PRCM module offset, let's add a new powerdomain flag into powerdomain.h,

#define PWRDM_OMAP3_MPU_QUIRK (1 << 1) /* MPU bit pos quirk */

or something similar. Then let's set that for the mpu_pwrdm in powerdomains34xx.h and test for that flag in powerdomain.c.

I prefer this since RMK has previously NAK'ed strcmp()s for this sort of thing, for good reason, and testing the PRCM internal module offset has many of the same problems.

Sound reasonable?

- Paul

Quoted 109 lines

Regards
Thara

Quoted 104 lines
Quoted 104 lines

-----Original Message-----
From: Paul Walmsley [mailto:[email protected]]
Sent: Thursday, October 15, 2009 4:51 AM
To: Gopinath, Thara
Cc: [email protected]; [email protected]
Subject: Re: [PATCH V2] OMAP3: PM: Fix for MPU power domain MEM BANK position

Hi Thara,

I regret the delay. A comment:

Quoted 3 lines · Thara Gopinath

MPU power domain bank 0 bits are displayed in position of bank 1 in PWRSTS and PREPWRSTS registers. So read them from correct position

Indeed. What do you think about a slightly different approach: changing powerdomains34xx.h to be correct? In other words, instead of

	.pwrsts_mem_ret	  = {
		[0] = PWRSTS_OFF_RET,
	},
	.pwrsts_mem_on	  = {
		[0] = PWRSTS_OFF_ON,
	},

we would use:

	.pwrsts_mem_ret	  = {
		[1] = PWRSTS_OFF_RET,
	},
	.pwrsts_mem_on	  = {
		[1] = PWRSTS_OFF_ON,
	},

We have to deal with the bank count field in struct powerdomain - we could just convert it into a bitmap representing available banks. So instead of:

       .banks = 1,

use maybe:

	.banks = PWRDM_BANK_1,  /* | PWRDM_BANK_0, etc */

Can you foresee any problems with the above approach?

- Paul

Quoted 45 lines

Patch refresh issue.

 arch/arm/mach-omap2/powerdomain.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/powerdomain.c +19 -1
index 2594cbf..6c5fee9 100644
@@ -971,6 +971,16 @@ int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
 		return -EEXIST;
 
 	/*
+	 * In 3430, for MPU domain bank 0 status bits
+	 * are displayed in the position of bank1 status bits
+	 * in PWST  . So the hack. Think of a cleaner
+	 * way of doing this
+	 */
+	if (cpu_is_omap34xx())
+		if (!strcmp("mpu_pwrdm", pwrdm->name))
+			bank = 1;
+
+	/*
 	 * 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
@@ -1018,6 +1028,15 @@ int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
 		return -EEXIST;
 
 	/*
+	 * In 3430, for MPU domain bank 0 status bits
+	 * are displayed in the position of bank1 status bits
+	 * in PREPWST  . So the hack. Think of a cleaner
+	 * way of doing this
+	 */
+	if (cpu_is_omap34xx())
+		if (!strcmp("mpu_pwrdm", pwrdm->name))
+			bank = 1;
+	/*
 	 * 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
--

1.5.4.7

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

- Paul

- Paul

#8 lore raw

Hello Thara,

Quoted 2 lines · Thara

Yes sounds definitely reasonable :-). I agree,we should try to do away with the strcmp if possible. I will implement the same and repost this fix.

Had a chance to work on this yet? It would be good to get this fix in at some point.
.

- Paul

Quoted 153 lines

Regards
Thara

Quoted 148 lines
Quoted 148 lines

-----Original Message-----
From: Paul Walmsley [mailto:[email protected]]
Sent: Friday, October 16, 2009 1:51 PM
To: Gopinath, Thara
Cc: [email protected]; [email protected]
Subject: RE: [PATCH V2] OMAP3: PM: Fix for MPU power domain MEM BANK position

Hi Thara,

Quoted 5 lines · Thara

Thanks Paul. The bit positions are goofed up only in PWRSTS and PREPWRSTS not in PWSTCTRL register. As per the approach you have suggested below, if we change the mem bank number from 0 to 1 , we will have to change the logic for read/write into PWSTCTRL for mpu pwr domain.

Okay. Here's what I'd propose: rather than testing for the powerdomain name in the function, or testing for the MPU PRCM module offset, let's add a new powerdomain flag into powerdomain.h,

#define PWRDM_OMAP3_MPU_QUIRK (1 << 1) /* MPU bit pos quirk */

or something similar. Then let's set that for the mpu_pwrdm in powerdomains34xx.h and test for that flag in powerdomain.c.

I prefer this since RMK has previously NAK'ed strcmp()s for this sort of thing, for good reason, and testing the PRCM internal module offset has many of the same problems.

Sound reasonable?

- Paul

Quoted 109 lines

Regards
Thara

Quoted 104 lines
Quoted 104 lines

-----Original Message-----
From: Paul Walmsley [mailto:[email protected]]
Sent: Thursday, October 15, 2009 4:51 AM
To: Gopinath, Thara
Cc: [email protected]; [email protected]
Subject: Re: [PATCH V2] OMAP3: PM: Fix for MPU power domain MEM BANK position

Hi Thara,

I regret the delay. A comment:

Quoted 3 lines · Thara Gopinath

MPU power domain bank 0 bits are displayed in position of bank 1 in PWRSTS and PREPWRSTS registers. So read them from correct position

Indeed. What do you think about a slightly different approach: changing powerdomains34xx.h to be correct? In other words, instead of

	.pwrsts_mem_ret	  = {
		[0] = PWRSTS_OFF_RET,
	},
	.pwrsts_mem_on	  = {
		[0] = PWRSTS_OFF_ON,
	},

we would use:

	.pwrsts_mem_ret	  = {
		[1] = PWRSTS_OFF_RET,
	},
	.pwrsts_mem_on	  = {
		[1] = PWRSTS_OFF_ON,
	},

We have to deal with the bank count field in struct powerdomain - we could just convert it into a bitmap representing available banks. So instead of:

       .banks = 1,

use maybe:

	.banks = PWRDM_BANK_1,  /* | PWRDM_BANK_0, etc */

Can you foresee any problems with the above approach?

- Paul

Quoted 45 lines

Patch refresh issue.

 arch/arm/mach-omap2/powerdomain.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/powerdomain.c +19 -1
index 2594cbf..6c5fee9 100644
@@ -971,6 +971,16 @@ int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
 		return -EEXIST;
 
 	/*
+	 * In 3430, for MPU domain bank 0 status bits
+	 * are displayed in the position of bank1 status bits
+	 * in PWST  . So the hack. Think of a cleaner
+	 * way of doing this
+	 */
+	if (cpu_is_omap34xx())
+		if (!strcmp("mpu_pwrdm", pwrdm->name))
+			bank = 1;
+
+	/*
 	 * 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
@@ -1018,6 +1028,15 @@ int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
 		return -EEXIST;
 
 	/*
+	 * In 3430, for MPU domain bank 0 status bits
+	 * are displayed in the position of bank1 status bits
+	 * in PREPWST  . So the hack. Think of a cleaner
+	 * way of doing this
+	 */
+	if (cpu_is_omap34xx())
+		if (!strcmp("mpu_pwrdm", pwrdm->name))
+			bank = 1;
+	/*
 	 * 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
--

1.5.4.7

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

- Paul

- Paul

- Paul