Skip to contentSkip to conversation

pxa: extend gpio pins from 128 to 256

PATCH New Haojian Zhuang 2 participants 3 messages Nov 5, 2009

lore
Share & tools
lore
#1 lore raw

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

Quoted 9 lines · Haojian Zhuang

From 859055136e56e4342ab1869f0050633ab52607e0 Mon Sep 17 00:00:00 2001
From: Haojian Zhuang <[email protected]>
Date: Thu, 5 Nov 2009 05:37:26 -0500
Subject: [PATCH] [ARM] pxa: extend gpio pins from 128 to 256

GPIO pins exceeds 128 pins on PXA935. Extend IRQ GPIO to support it. Add new macro mfp256_to_gpio() and PXA935_NR_BUILTIN_GPIO.

Original mfp_to_gpio() and NR_BUILTIN_GPIO isn't changed.

Will this impact the possibility of pxa935 being not able to build with other pxa?

Quoted 43 lines

---

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

?4 files changed, 6 insertions(+), 4 deletions(-)

arch/arm/mach-pxa/include/mach/gpio.h +2 -1
index b024a8b..d08227d 100644
@@ -99,7 +99,8 @@
 ?#define GAFR(x) ? ? ? ? ? ? ? ?GPIO_REG(0x54 + (((x) & 0x70) >> 2))
 
 
-#define NR_BUILTIN_GPIO 128
+#define NR_BUILTIN_GPIO ? ? ? ? ? ? ? ?128
+#define PXA935_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/pxa3xx.c +0 -0
index 09b7b1a..7783ac9 100644

arch/arm/mach-pxa/pxa3xx.c void __init pxa3xx_init_irq(void) · line 542

Quoted 5 lines
arch/arm/mach-pxa/pxa3xx.c +1 -1
@@ -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);

This isn't ideal, provided on most pxa3xx there are less than 127 GPIOs. I'd suggest we invent pxa935_init_irq() to support IRQs more than 56, and more GPIOs, possibly in pxa930.c (and renaming that to pxa93x.c sounds reasonable then).

Quoted 12 lines
arch/arm/mach-pxa/pxa3xx.c +0 -0
 ?}
 

?/*

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

?#ifndef __ASM_PLAT_MFP_H
?#define __ASM_PLAT_MFP_H

arch/arm/plat-pxa/include/plat/mfp.h

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

Giving that the MFP_PIN_GPIO* has been extended beyond 128, this macro is already wrong. (e.g. mfp_to_gpio(MFP_PIN_GPIO130) == 2??)

Quoted 7 lines

+#define mfp256_to_gpio(m) ? ? ?((m) % 256) ? ? /* GPIO is more than 128 */

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

#2 lore raw

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

Quoted 60 lines · Eric Miao
Quoted 9 lines · Haojian Zhuang

From 859055136e56e4342ab1869f0050633ab52607e0 Mon Sep 17 00:00:00 2001
From: Haojian Zhuang <[email protected]>
Date: Thu, 5 Nov 2009 05:37:26 -0500
Subject: [PATCH] [ARM] pxa: extend gpio pins from 128 to 256

GPIO pins exceeds 128 pins on PXA935. Extend IRQ GPIO to support it. Add new macro mfp256_to_gpio() and PXA935_NR_BUILTIN_GPIO.

Original mfp_to_gpio() and NR_BUILTIN_GPIO isn't changed.

Will this impact the possibility of pxa935 being not able to build with other pxa?

Quoted 45 lines

---

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

?4 files changed, 6 insertions(+), 4 deletions(-)

arch/arm/mach-pxa/include/mach/gpio.h +2 -1
index b024a8b..d08227d 100644
@@ -99,7 +99,8 @@
 ?#define GAFR(x) ? ? ? ? ? ? ? ?GPIO_REG(0x54 + (((x) & 0x70) >> 2))
 
 
-#define NR_BUILTIN_GPIO 128
+#define NR_BUILTIN_GPIO ? ? ? ? ? ? ? ?128
+#define PXA935_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/pxa3xx.c +0 -0
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));
 
Quoted 8 lines

arch/arm/mach-pxa/pxa3xx.c void __init pxa3xx_init_irq(void) · line 542

Quoted 3 lines
arch/arm/mach-pxa/pxa3xx.c +1 -1
 ? ? ? ?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);

This isn't ideal, provided on most pxa3xx there are less than 127 GPIOs. I'd suggest we invent pxa935_init_irq() to support IRQs more than 56, and more GPIOs, possibly in pxa930.c (and renaming that to pxa93x.c sounds reasonable then).

OK. I'll create the new pxa935_init_irq().

Quoted 13 lines
Quoted 13 lines
arch/arm/mach-pxa/pxa3xx.c +0 -0
 ?}
 

?/*

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

?#ifndef __ASM_PLAT_MFP_H
?#define __ASM_PLAT_MFP_H

Quoted 5 lines

arch/arm/plat-pxa/include/plat/mfp.h

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

Giving that the MFP_PIN_GPIO* has been extended beyond 128, this macro is already wrong. (e.g. mfp_to_gpio(MFP_PIN_GPIO130) == 2??)

I'd prefer that platform driver use mfp256_to_gpio() macro when chip is pxa935. mfp_to_gpio() is left for pxa27x and most pxa3xx. Otherwise, mfp_to_gpio() has to support 256 pins. pxa27x mfp driver have to be updated.

Quoted 9 lines
Quoted 8 lines

+#define mfp256_to_gpio(m) ? ? ?((m) % 256) ? ? /* GPIO is more than 128 */

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