Skip to contentSkip to conversation

mpc85xx: Fix the offset of register address error

PATCH Superseded Tang Yuantian 3 participants 6 messages Sep 22, 2013 – Oct 9, 2013 PowerPC

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mpc85xx: Fix the offset of register address error

From: Tang Yuantian <[email protected]>

The offset of register address within GPIO module is just CONFIG_SYS_MPC85xx_GPIO_ADDR, no reason to add 0xc00.

---
 arch/powerpc/include/asm/mpc85xx_gpio.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/mpc85xx_gpio.h +2 -2
index 3d11884..87bb4a0 100644
@@ -20,7 +20,7 @@
 static inline void mpc85xx_gpio_set(unsigned int mask,
 		unsigned int dir, unsigned int val)
 {
-	ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR + 0xc00);
+	ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR);
 
 	/* First mask off the unwanted parts of "dir" and "val" */
 	dir &= mask;
@@ -56,7 +56,7 @@ static inline void mpc85xx_gpio_set_high(unsigned int gpios)
 
 static inline unsigned int mpc85xx_gpio_get(unsigned int mask)
 {
-	ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR + 0xc00);
+	ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR);
 
 	/* Read the requested values */
 	return in_be32(&gpio->gpdat) & mask;
Signature · 1 line
1.8.0
#1 lore raw

PATCH 1/1 mpc85xx: Fix the offset of register address error

Quoted 25 lines · Tang Yuantian

From: Tang Yuantian <[email protected]>

The offset of register address within GPIO module is just CONFIG_SYS_MPC85xx_GPIO_ADDR, no reason to add 0xc00.

---
 arch/powerpc/include/asm/mpc85xx_gpio.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/mpc85xx_gpio.h +1 -1
index 3d11884..87bb4a0 100644
@@ -20,7 +20,7 @@
 static inline void mpc85xx_gpio_set(unsigned int mask,
 		unsigned int dir, unsigned int val)
 {
-	ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR + 0xc00);
+	ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR);
 
 	/* First mask off the unwanted parts of "dir" and "val" */
 	dir &= mask;

arch/powerpc/include/asm/mpc85xx_gpio.h static inline void mpc85xx_gpio_set_high(unsigned int gpios) · line 62

Quoted 8 lines
arch/powerpc/include/asm/mpc85xx_gpio.h +1 -1
@@ -56,7 +56,7 @@ static inline void mpc85xx_gpio_set_high(unsigned int gpios)
 
 static inline unsigned int mpc85xx_gpio_get(unsigned int mask)
 {
-	ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR + 0xc00);
+	ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR);
 
 	/* Read the requested values */
 	return in_be32(&gpio->gpdat) & mask;

Yuantian,

Please go through the base address again. I think some SoCs do use 0xc00 offset from 0xF000, for eample P1020, P1023, MPC8572. I only spot checked several.

York

#2 lore raw

PATCH 1/1 mpc85xx: Fix the offset of register address error

Quoted 26 lines
Quoted 15 lines
arch/powerpc/include/asm/mpc85xx_gpio.h +1 -1
index 3d11884..87bb4a0 100644
@@ -20,7 +20,7 @@
 static inline void mpc85xx_gpio_set(unsigned int mask,
 		unsigned int dir, unsigned int val)  {
-	ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR + 0xc00);
+	ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR);
 
 	/* First mask off the unwanted parts of "dir" and "val" */
 	dir &= mask;

arch/powerpc/include/asm/mpc85xx_gpio.h static inline void mpc85xx_gpio_set_high(unsigned · line 62

Quoted 8 lines
arch/powerpc/include/asm/mpc85xx_gpio.h +1 -1
@@ -56,7 +56,7 @@ static inline void mpc85xx_gpio_set_high(unsigned
 int gpios)
 
 static inline unsigned int mpc85xx_gpio_get(unsigned int mask)  {
-	ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR + 0xc00);
+	ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR);
 
 	/* Read the requested values */
 	return in_be32(&gpio->gpdat) & mask;

Yuantian,

Quoted 4 lines

Please go through the base address again. I think some SoCs do use 0xc00 offset from 0xF000, for eample P1020, P1023, MPC8572. I only spot checked several.

Hi York,
I double checked the offset address of GPIO, I found that the offset addresses of
GPIO on the boards you mentioned above are all changed to 0x0, not 0xc00 according
to the newest RM.
I do found that the offset address is 0xc00 in some old RMs.
You can find the newest RM here:
For MPC8572: http://compass.freescale.net/livelink/livelink/fetch/2001/3448/223475/200815/108253488/223469393/223503931/226628079/226445024/MPC8572ERM_Rev3_DRAFT1.pdf?nodeid=226438746&vernum=-2
For p1023:
http://compass.freescale.net/livelink/livelink/fetch/2001/3448/223475/200815/108253488/223469393/223506436/223521755/223743960/P1023RM_Mark-up.pdf?nodeid=229647544&vernum=-2
for 1020:
http://compass.freescale.net/livelink/livelink/fetch/2001/3448/223475/200815/108253488/223469393/223506436/223522385/224515312/P1020RM_Rev6_Mark-up.pdf?nodeid=228476444&vernum=-2

If the offset addresses on these boards were 0xc00, the driver is still wrong, because in that case The GPIO address should be: CONFIG_SYS_IMMR + 0xc00, not CONFIG_SYS_MPC85xx_GPIO_ADDR + 0xc00. (CONFIG_SYS_MPC85xx_GPIO_ADDR == CONFIG_SYS_IMMR + CONFIG_SYS_MPC85xx_GPIO_OFFSET).

So, please apply this patch, I need the GPIO driver to operate GPIO.

Regards,
Yuantian

Quoted 1 line

York

#3 lore raw

PATCH 1/1 mpc85xx: Fix the offset of register address error

Quoted 43 lines · On 10/07/2013 08:28 PM, Tang Yuantian-B29983 wrote:
Quoted 26 lines
Quoted 15 lines
arch/powerpc/include/asm/mpc85xx_gpio.h +1 -1
index 3d11884..87bb4a0 100644
@@ -20,7 +20,7 @@
 static inline void mpc85xx_gpio_set(unsigned int mask,
 		unsigned int dir, unsigned int val)  {
-	ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR + 0xc00);
+	ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR);
 
 	/* First mask off the unwanted parts of "dir" and "val" */
 	dir &= mask;

arch/powerpc/include/asm/mpc85xx_gpio.h static inline void mpc85xx_gpio_set_high(unsigned · line 62

Quoted 8 lines
arch/powerpc/include/asm/mpc85xx_gpio.h +1 -1
@@ -56,7 +56,7 @@ static inline void mpc85xx_gpio_set_high(unsigned
 int gpios)
 
 static inline unsigned int mpc85xx_gpio_get(unsigned int mask)  {
-	ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR + 0xc00);
+	ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR);
 
 	/* Read the requested values */
 	return in_be32(&gpio->gpdat) & mask;

Yuantian,

Quoted 4 lines

Please go through the base address again. I think some SoCs do use 0xc00 offset from 0xF000, for eample P1020, P1023, MPC8572. I only spot checked several.

Hi York,
I double checked the offset address of GPIO, I found that the offset addresses of
GPIO on the boards you mentioned above are all changed to 0x0, not 0xc00 according
to the newest RM.
I do found that the offset address is 0xc00 in some old RMs.
You can find the newest RM here:
For MPC8572: http://compass.freescale.net/livelink/livelink/fetch/2001/3448/223475/200815/108253488/223469393/223503931/226628079/226445024/MPC8572ERM_Rev3_DRAFT1.pdf?nodeid=226438746&vernum=-2
For p1023:
http://compass.freescale.net/livelink/livelink/fetch/2001/3448/223475/200815/108253488/223469393/223506436/223521755/223743960/P1023RM_Mark-up.pdf?nodeid=229647544&vernum=-2
for 1020:
http://compass.freescale.net/livelink/livelink/fetch/2001/3448/223475/200815/108253488/223469393/223506436/223522385/224515312/P1020RM_Rev6_Mark-up.pdf?nodeid=228476444&vernum=-2

Quoted 6 lines

If the offset addresses on these boards were 0xc00, the driver is still wrong, because in that case The GPIO address should be: CONFIG_SYS_IMMR + 0xc00, not CONFIG_SYS_MPC85xx_GPIO_ADDR + 0xc00. (CONFIG_SYS_MPC85xx_GPIO_ADDR == CONFIG_SYS_IMMR + CONFIG_SYS_MPC85xx_GPIO_OFFSET).

So, please apply this patch, I need the GPIO driver to operate GPIO.

Looks you are correct. I find the changed offset on some published documents as well (please use public link for discussion in the future).

York

#4 lore raw

PATCH 1/1 mpc85xx: Fix the offset of register address error

In reply to Tang Yuantian-B29983
Quoted 43 lines · On 10/07/2013 08:28 PM, Tang Yuantian-B29983 wrote:
Quoted 26 lines
Quoted 15 lines
arch/powerpc/include/asm/mpc85xx_gpio.h +1 -1
index 3d11884..87bb4a0 100644
@@ -20,7 +20,7 @@
 static inline void mpc85xx_gpio_set(unsigned int mask,
 		unsigned int dir, unsigned int val)  {
-	ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR + 0xc00);
+	ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR);
 
 	/* First mask off the unwanted parts of "dir" and "val" */
 	dir &= mask;

arch/powerpc/include/asm/mpc85xx_gpio.h static inline void mpc85xx_gpio_set_high(unsigned · line 62

Quoted 8 lines
arch/powerpc/include/asm/mpc85xx_gpio.h +1 -1
@@ -56,7 +56,7 @@ static inline void mpc85xx_gpio_set_high(unsigned
 int gpios)
 
 static inline unsigned int mpc85xx_gpio_get(unsigned int mask)  {
-	ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR + 0xc00);
+	ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR);
 
 	/* Read the requested values */
 	return in_be32(&gpio->gpdat) & mask;

Yuantian,

Quoted 4 lines

Please go through the base address again. I think some SoCs do use 0xc00 offset from 0xF000, for eample P1020, P1023, MPC8572. I only spot checked several.

Hi York,
I double checked the offset address of GPIO, I found that the offset addresses of
GPIO on the boards you mentioned above are all changed to 0x0, not 0xc00 according
to the newest RM.
I do found that the offset address is 0xc00 in some old RMs.
You can find the newest RM here:
For MPC8572: http://compass.freescale.net/livelink/livelink/fetch/2001/3448/223475/200815/108253488/223469393/223503931/226628079/226445024/MPC8572ERM_Rev3_DRAFT1.pdf?nodeid=226438746&vernum=-2
For p1023:
http://compass.freescale.net/livelink/livelink/fetch/2001/3448/223475/200815/108253488/223469393/223506436/223521755/223743960/P1023RM_Mark-up.pdf?nodeid=229647544&vernum=-2
for 1020:
http://compass.freescale.net/livelink/livelink/fetch/2001/3448/223475/200815/108253488/223469393/223506436/223522385/224515312/P1020RM_Rev6_Mark-up.pdf?nodeid=228476444&vernum=-2

Quoted 7 lines

If the offset addresses on these boards were 0xc00, the driver is still wrong, because in that case The GPIO address should be: CONFIG_SYS_IMMR + 0xc00, not CONFIG_SYS_MPC85xx_GPIO_ADDR + 0xc00. (CONFIG_SYS_MPC85xx_GPIO_ADDR == CONFIG_SYS_IMMR + CONFIG_SYS_MPC85xx_GPIO_OFFSET).

So, please apply this patch, I need the GPIO driver to operate GPIO.

Please update the commit message to list all SoCs you have confirmed the offset. And don't say "no reason to add 0xc00". The reason was clear when the code was written. Reference manuals said so.

York

#5 lore raw

PATCH 1/1 mpc85xx: Fix the offset of register address error

Quoted 31 lines
Quoted 20 lines

Hi York,
I double checked the offset address of GPIO, I found that the offset addresses of GPIO on the boards you mentioned above are all changed to 0x0, not 0xc00 according to the newest RM.
I do found that the offset address is 0xc00 in some old RMs. You can find the newest RM here:
For MPC8572:
http://compass.freescale.net/livelink/livelink/fetch/2001/3448/223475/
200815/108253488/223469393/223503931/226628079/226445024/MPC8572ERM_Re v3_DRAFT1.pdf?nodeid=226438746&vernum=-2
For p1023:
http://compass.freescale.net/livelink/livelink/fetch/2001/3448/223475/
200815/108253488/223469393/223506436/223521755/223743960/P1023RM_Mark- up.pdf?nodeid=229647544&vernum=-2
for 1020:
http://compass.freescale.net/livelink/livelink/fetch/2001/3448/223475/
200815/108253488/223469393/223506436/223522385/224515312/P1020RM_Rev6_ Mark-up.pdf?nodeid=228476444&vernum=-2

Quoted 2 lines

If the offset addresses on these boards were 0xc00, the driver is still wrong, because in that case The GPIO address should be:

CONFIG_SYS_IMMR + 0xc00, not CONFIG_SYS_MPC85xx_GPIO_ADDR + 0xc00.

Quoted 1 line

(CONFIG_SYS_MPC85xx_GPIO_ADDR == CONFIG_SYS_IMMR +

CONFIG_SYS_MPC85xx_GPIO_OFFSET).

Quoted 4 lines

So, please apply this patch, I need the GPIO driver to operate GPIO.

Quoted 5 lines

Please update the commit message to list all SoCs you have confirmed the offset. And don't say "no reason to add 0xc00". The reason was clear when the code was written. Reference manuals said so.

York

OK, I will resend this patch once the offset is confirmed by the RM owner.

Thanks,
Yuantian