Skip to contentSkip to conversation

pxa: extend gpio pins from 128 to 256

PATCH New Haojian Zhuang 2 participants 6 messages Sep 25, 2009 – Oct 18, 2009

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 pxa: extend gpio pins from 128 to 256

Haojian,

Sorry for late reply. See my comments below:

Quoted 50 lines · Haojian Zhuang

From 341628d9c44d120284cd45e8fa5ac9bd4acfe464 Mon Sep 17 00:00:00 2001
From: Haojian Zhuang <[email protected]>
Date: Fri, 25 Sep 2009 14:28:11 -0400
Subject: [PATCH] pxa: extend gpio pins from 128 to 256

GPIO pins exceeds 128 pins. So extend the maximum GPIO pins to 256. And extend MFP pins also.

---

?arch/arm/mach-pxa/include/mach/gpio.h |??? 2 +-
?arch/arm/mach-pxa/include/mach/irqs.h |??? 2 +-
?arch/arm/mach-pxa/mfp-pxa2xx.c??????? |??? 6 +++---
?arch/arm/mach-pxa/pxa3xx.c??????????? |??? 2 +-
?arch/arm/plat-pxa/include/plat/mfp.h? |??? 2 +-

?5 files changed, 7 insertions(+), 7 deletions(-)

arch/arm/mach-pxa/include/mach/gpio.h +1 -1
index b024a8b..0cd683c 100644
@@ -99,7 +99,7 @@
 ?#define GAFR(x)??? ??? GPIO_REG(0x54 + (((x) & 0x70) >> 2))
 
 
-#define NR_BUILTIN_GPIO 128
+#define NR_BUILTIN_GPIO 256
 
 ?#define gpio_to_bank(gpio)??? ((gpio) >> 5)
 ?#define gpio_to_irq(gpio)??? IRQ_GPIO(gpio)
arch/arm/mach-pxa/include/mach/irqs.h +0 -0
index 3677a9a..9565b0f 100644
@@ -106,7 +106,7 @@

?#endif

?#define PXA_GPIO_IRQ_BASE??? PXA_IRQ(96)

arch/arm/mach-pxa/include/mach/irqs.h +1 -1
-#define PXA_GPIO_IRQ_NUM??? (192)
+#define PXA_GPIO_IRQ_NUM??? (256)

?#define GPIO_2_x_TO_IRQ(x)??? (PXA_GPIO_IRQ_BASE + (x)) ?#define IRQ_GPIO(x)??? (((x) < 2) ? (IRQ_GPIO0 + (x)) : GPIO_2_x_TO_IRQ(x))

arch/arm/mach-pxa/mfp-pxa2xx.c +0 -0
index cf6b720..767db92 100644

arch/arm/mach-pxa/mfp-pxa2xx.c struct gpio_desc { · line 45

Quoted 6 lines
arch/arm/mach-pxa/mfp-pxa2xx.c +1 -1
@@ -41,7 +41,7 @@ struct gpio_desc {
 ???? unsigned long??? config;
 ?};
 
-static struct gpio_desc gpio_desc[MFP_PIN_GPIO127 + 1];
+static struct gpio_desc gpio_desc[MFP_PIN_GPIO255 + 1];
 

I'm not sure if this is really necessary since mfp-pxa2xx.c is pxa2xx specific, and extending the array by double means wasting of space?

arch/arm/mach-pxa/mfp-pxa2xx.c static inline int __mfp_validate(int mfp) · line 123

Quoted 11 lines
arch/arm/mach-pxa/mfp-pxa2xx.c +1 -1
 ?static unsigned long gpdr_lpm[4];
 
@@ -117,7 +117,7 @@ static inline int __mfp_validate(int mfp)
 ?{
 ???? int gpio = mfp_to_gpio(mfp);
 
-??? if ((mfp > MFP_PIN_GPIO127) || !gpio_desc[gpio].valid) {
+??? if ((mfp > MFP_PIN_GPIO255) || !gpio_desc[gpio].valid) {
 ???? ??? pr_warning("%s: GPIO%d is invalid pin\n", __func__, gpio);
 ???? ??? return -1;
 ???? }

Same here, pxa2xx specific.

Quoted 40 lines
arch/arm/mach-pxa/mfp-pxa2xx.c +1 -1
@@ -169,7 +169,7 @@ int gpio_set_wake(unsigned int gpio, unsigned int on)
 ???? struct gpio_desc *d;
 ???? unsigned long c, mux_taken;
 
-??? if (gpio > mfp_to_gpio(MFP_PIN_GPIO127))
+??? if (gpio > mfp_to_gpio(MFP_PIN_GPIO255))
 ???? ??? return -EINVAL;
 
 ???? d = &gpio_desc[gpio];
arch/arm/mach-pxa/pxa3xx.c +1 -1
index 09b7b1a..7783ac9 100644
@@ -539,7 +539,7 @@ void __init pxa3xx_init_irq(void)
 ???? __asm__ __volatile__("mcr p15, 0, %0, c15, c1, 0\n": :"r"(value));
 
 ???? pxa_init_irq(56, pxa3xx_set_wake);
-??? pxa_init_gpio(IRQ_GPIO_2_x, 2, 127, NULL);
+??? pxa_init_gpio(IRQ_GPIO_2_x, 2, 255, NULL);
 ?}
 

?/*

arch/arm/plat-pxa/include/plat/mfp.h +0 -0
index 22086e6..857a683 100644
@@ -16,7 +16,7 @@

?#ifndef __ASM_PLAT_MFP_H
?#define __ASM_PLAT_MFP_H

arch/arm/plat-pxa/include/plat/mfp.h +1 -1
-#define mfp_to_gpio(m)??? ((m) % 128)
+#define mfp_to_gpio(m)??? ((m) % 256)

?/* list of all the configurable MFP pins */
?enum {
--
1.5.6.5

#2 lore raw

PATCH 1/1 pxa: extend gpio pins from 128 to 256

Quoted 32 lines · Eric Miao

Haojian,

Sorry for late reply. See my comments below:

Quoted 12 lines

Subject: [PATCH] pxa: extend gpio pins from 128 to 256

GPIO pins exceeds 128 pins. So extend the maximum GPIO pins to 256. And extend MFP pins also.

---

arch/arm/mach-pxa/mfp-pxa2xx.c +0 -0
index cf6b720..767db92 100644

arch/arm/mach-pxa/mfp-pxa2xx.c struct gpio_desc { · line 45

Quoted 6 lines
arch/arm/mach-pxa/mfp-pxa2xx.c +1 -1
@@ -41,7 +41,7 @@ struct gpio_desc {
 ???? unsigned long??? config;
 ?};
 
-static struct gpio_desc gpio_desc[MFP_PIN_GPIO127 + 1];
+static struct gpio_desc gpio_desc[MFP_PIN_GPIO255 + 1];
 

I'm not sure if this is really necessary since mfp-pxa2xx.c is pxa2xx specific, and extending the array by double means wasting of space?

Quoted 6 lines
arch/arm/mach-pxa/mfp-pxa2xx.c +0 -0
 ?static unsigned long gpdr_lpm[4];
 
@@ -117,7 +117,7 @@ static inline int __mfp_validate(int mfp)
 ?{
 ???? int gpio = mfp_to_gpio(mfp);
 
Quoted 8 lines

arch/arm/mach-pxa/mfp-pxa2xx.c static inline int __mfp_validate(int mfp) · line 123

Quoted 5 lines
arch/arm/mach-pxa/mfp-pxa2xx.c +1 -1
-??? if ((mfp > MFP_PIN_GPIO127) || !gpio_desc[gpio].valid) {
+??? if ((mfp > MFP_PIN_GPIO255) || !gpio_desc[gpio].valid) {
 ???? ??? pr_warning("%s: GPIO%d is invalid pin\n", __func__, gpio);
 ???? ??? return -1;
 ???? }

Same here, pxa2xx specific.

Up to now, mfp driver is shared between pxa2xx, pxa3xx and so on. It seems that extending mfp io is easier.

Otherwise, we may need to create new mfp driver on pxa935 and new chips.

Thanks
Haojian

#3 lore raw

PATCH 1/1 pxa: extend gpio pins from 128 to 256

Quoted 42 lines · Haojian Zhuang
Quoted 32 lines · Eric Miao

Haojian,

Sorry for late reply. See my comments below:

Quoted 12 lines

Subject: [PATCH] pxa: extend gpio pins from 128 to 256

GPIO pins exceeds 128 pins. So extend the maximum GPIO pins to 256. And extend MFP pins also.

---

arch/arm/mach-pxa/mfp-pxa2xx.c +0 -0
index cf6b720..767db92 100644

arch/arm/mach-pxa/mfp-pxa2xx.c struct gpio_desc { · line 45

Quoted 6 lines
arch/arm/mach-pxa/mfp-pxa2xx.c +1 -1
@@ -41,7 +41,7 @@ struct gpio_desc {
 ???? unsigned long??? config;
 ?};
 
-static struct gpio_desc gpio_desc[MFP_PIN_GPIO127 + 1];
+static struct gpio_desc gpio_desc[MFP_PIN_GPIO255 + 1];
 

I'm not sure if this is really necessary since mfp-pxa2xx.c is pxa2xx specific, and extending the array by double means wasting of space?

Quoted 6 lines
arch/arm/mach-pxa/mfp-pxa2xx.c +0 -0
 ?static unsigned long gpdr_lpm[4];
 
@@ -117,7 +117,7 @@ static inline int __mfp_validate(int mfp)
 ?{
 ???? int gpio = mfp_to_gpio(mfp);
 
Quoted 8 lines

arch/arm/mach-pxa/mfp-pxa2xx.c static inline int __mfp_validate(int mfp) · line 123

Quoted 5 lines
arch/arm/mach-pxa/mfp-pxa2xx.c +1 -1
-??? if ((mfp > MFP_PIN_GPIO127) || !gpio_desc[gpio].valid) {
+??? if ((mfp > MFP_PIN_GPIO255) || !gpio_desc[gpio].valid) {
 ???? ??? pr_warning("%s: GPIO%d is invalid pin\n", __func__, gpio);
 ???? ??? return -1;
 ???? }

Same here, pxa2xx specific.

Quoted 3 lines

Up to now, mfp driver is shared between pxa2xx, pxa3xx and so on. It seems that extending mfp io is easier.

Actually, they are not. There are two separate mfp drivers for pxa2xx and pxa3xx if you look closely. And mfp-pxa2xx.c is used by pxa2xx solely, and the special binding of gpio_desc[] with pxa2xx MFP is very specific to pxa2xx only. Please help double check.

Quoted 5 lines

Otherwise, we may need to create new mfp driver on pxa935 and new chips.

Thanks
Haojian

#4 lore raw

PATCH 1/1 pxa: extend gpio pins from 128 to 256

Quoted 44 lines · Eric Miao
Quoted 42 lines · Haojian Zhuang
Quoted 40 lines · Eric Miao

Haojian,

Sorry for late reply. See my comments below:

Quoted 12 lines

Subject: [PATCH] pxa: extend gpio pins from 128 to 256

GPIO pins exceeds 128 pins. So extend the maximum GPIO pins to 256. And extend MFP pins also.

---

arch/arm/mach-pxa/mfp-pxa2xx.c +0 -0
index cf6b720..767db92 100644

arch/arm/mach-pxa/mfp-pxa2xx.c struct gpio_desc { · line 45

Quoted 6 lines
arch/arm/mach-pxa/mfp-pxa2xx.c +1 -1
@@ -41,7 +41,7 @@ struct gpio_desc {
 ???? unsigned long??? config;
 ?};
 
-static struct gpio_desc gpio_desc[MFP_PIN_GPIO127 + 1];
+static struct gpio_desc gpio_desc[MFP_PIN_GPIO255 + 1];
 

I'm not sure if this is really necessary since mfp-pxa2xx.c is pxa2xx specific, and extending the array by double means wasting of space?

arch/arm/mach-pxa/mfp-pxa2xx.c static inline int __mfp_validate(int mfp) · line 123

Quoted 11 lines
arch/arm/mach-pxa/mfp-pxa2xx.c +1 -1
 ?static unsigned long gpdr_lpm[4];
 
@@ -117,7 +117,7 @@ static inline int __mfp_validate(int mfp)
 ?{
 ???? int gpio = mfp_to_gpio(mfp);
 
-??? if ((mfp > MFP_PIN_GPIO127) || !gpio_desc[gpio].valid) {
+??? if ((mfp > MFP_PIN_GPIO255) || !gpio_desc[gpio].valid) {
 ???? ??? pr_warning("%s: GPIO%d is invalid pin\n", __func__, gpio);
 ???? ??? return -1;
 ???? }

Same here, pxa2xx specific.

Quoted 9 lines
Quoted 3 lines

Up to now, mfp driver is shared between pxa2xx, pxa3xx and so on. It seems that extending mfp io is easier.

Actually, they are not. There are two separate mfp drivers for pxa2xx and pxa3xx if you look closely. And mfp-pxa2xx.c is used by pxa2xx solely, and the special binding of gpio_desc[] with pxa2xx MFP is very specific to pxa2xx only. Please help double check.

I think that mfp_to_gpio() macro is also a part of mfp driver. This macro is used widely
in platform driver in order to allocate platform irq resource. NR_BUILTIN_GPIO is similar
to this macro.

Because they're used in structure initialization, we can't use detecting CPU method to
distinguish how much mfp/gpio pins can be applied on current CPU. Since we couldn't
import variable or function into structure intialization code. Current patch is the easiest
modification.

If there's a better solution, I'm glad to adopt it. :)

Thanks
Haojian

#5 lore raw

PATCH 1/1 pxa: extend gpio pins from 128 to 256

Mmm... as long as the platforms call pxa2xx_mfp_config(), I was thinking the pxa2xx part can remain intact, saving some bits.

Soon will be on the flight, will reply two days later. Thanks.

On Oct 18, 2009 2:43 PM, "Haojian Zhuang" <[email protected]> wrote:

On Sun, Oct 18, 2009 at 2:03 AM, Eric Miao <[email protected]> wrote: > On Sun, Oct 18, 2009 at ...
I think that mfp_to_gpio() macro is also a part of mfp driver. This macro is used widely
in platform driver in order to allocate platform irq resource. NR_BUILTIN_GPIO is similar
to this macro.

Because they're used in structure initialization, we can't use detecting CPU method to
distinguish how much mfp/gpio pins can be applied on current CPU. Since we couldn't
import variable or function into structure intialization code. Current patch is the easiest
modification.

If there's a better solution, I'm glad to adopt it. :)

Thanks
Haojian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20091018/a1d31678/attachment-0001.htm>