Skip to contentSkip to conversation

OMAP: GPIO: cleanup, consolidation, etc. (v2)

PATCH In review Kevin Hilman 3 participants 15 messages Apr 21, 2011 – May 4, 2011

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover OMAP: GPIO: cleanup, consolidation, etc. (v2)

Here's an updated version of my work-in-progress GPIO cleanups.

I now understand that others have some similar work in progress, so these are posted (to linux-omap only, for now) so that we can begin collaboration on the GPIO cleanups.

This series applies on top of v2.6.39-rc4 plus the generic irq_chip series from Thomas Gleixner since in addition to the cleanups, I started moving the GPIO IRQ handling over to use generic irq_chip (last patch in series.)

This work in progress is available in my wip/gpio-cleanup branch.

Kevin Hilman (9):
OMAP: GPIO: _clear_gpio_irqbank: fix flushing of posted write
OMAP: GPIO: remove MPUIO handling from _clear_gpio_irqbank()
OMAP: GPIO: move bank width into struct gpio_bank
OMAP: GPIO: _get_gpio_irqbank_mask: replace hard-coded mask with

    bank->width

OMAP: GPIO: move register offset defines into gpio.h
OMAP: GPIO: consolidate direction, input, output, remove #ifdefs
OMAP: GPIO: consolidate IRQ status handling, remove #ifdefs
OMAP: GPIO: conslidate enable/disable of GPIO IRQs, remove ifdefs
OMAP: GPIO: convert MPUIO IRQ over to generic irq_chip

 arch/arm/mach-omap1/gpio15xx.c         |   13 +
 arch/arm/mach-omap1/gpio16xx.c         |   22 ++
 arch/arm/mach-omap1/gpio7xx.c          |   21 +
 arch/arm/mach-omap2/gpio.c             |   20 +
 arch/arm/plat-omap/gpio.c              |  641 ++++++--------------------------
 arch/arm/plat-omap/include/plat/gpio.h |  120 ++++++
 6 files changed, 318 insertions(+), 519 deletions(-)
Signature · 1 line
1.7.4
#1 lore raw

PATCH 1/9 OMAP: GPIO: _clear_gpio_irqbank: fix flushing of posted write

In commit 78a1a6d3411de1a8b0dc1cb92754b5f12f251912 (ARM: OMAP4: Update the GPIO support) braces were mistakenly added to included the register read-back inside the cpu_is_* checking.

Remove the braces, ensuring that a register read-back is done, even when the IRQSTATUS2 register is not written.

Note that the register read-back might be IRQSTATUS1 or IRQSTATUS2 depending on the CPU, but a read-back of any register in that region will cause a flush of the posted writes.

---
 arch/arm/plat-omap/gpio.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
arch/arm/plat-omap/gpio.c +1 -2
index d2adcdd..fe6971a 100644
@@ -813,12 +813,11 @@ static void _clear_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
 	else if (cpu_is_omap44xx())
 		reg = bank->base + OMAP4_GPIO_IRQSTATUS1;
 
-	if (cpu_is_omap24xx() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
+	if (cpu_is_omap24xx() || cpu_is_omap34xx() || cpu_is_omap44xx())
 		__raw_writel(gpio_mask, reg);
 
 	/* Flush posted write for the irq status to avoid spurious interrupts */
 	__raw_readl(reg);
-	}
 }
 
 static inline void _clear_gpio_irqstatus(struct gpio_bank *bank, int gpio)
Signature · 1 line
1.7.4
#2 lore raw

PATCH 2/9 OMAP: GPIO: remove MPUIO handling from _clear_gpio_irqbank()

In reply to Kevin Hilman

Remove the OMAP1 #ifdef and MPUIO special case for _clear_gpio_irqbank()

The MPUIOs do not need a register access to ack/clear the IRQ status, since reading the IRQ status clears it. In addition, the MPUIO irq_chip has an empty ack method, so _clear_gpio_irqbank() is never used for MPUIOs.

---
 arch/arm/plat-omap/gpio.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)
arch/arm/plat-omap/gpio.c +0 -6
index fe6971a..8b5ca6e 100644
@@ -770,12 +770,6 @@ static void _clear_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
 	void __iomem *reg = bank->base;
 
 	switch (bank->method) {
-#ifdef CONFIG_ARCH_OMAP1
-	case METHOD_MPUIO:
-		/* MPUIO irqstatus is reset by reading the status register,
-		 * so do nothing here */
-		return;
-#endif
 #ifdef CONFIG_ARCH_OMAP15XX
 	case METHOD_GPIO_1510:
 		reg += OMAP1510_GPIO_INT_STATUS;
Signature · 1 line
1.7.4
#3 lore raw

PATCH 3/9 OMAP: GPIO: move bank width into struct gpio_bank

In reply to Kevin Hilman

Rather than having a file-global bank_width variable, move it into
struct gpio_bank so it can be bank-specific. Note the bank width
is already passed per-bank via platform_data, so current code would be incorrect if any banks had different width.

---
 arch/arm/plat-omap/gpio.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
arch/arm/plat-omap/gpio.c +5 -6
index 8b5ca6e..d1d3397 100644
@@ -159,6 +159,7 @@ struct gpio_bank {
 	struct device *dev;
 	bool dbck_flag;
 	int stride;
+	u32 width;
 };
 
 #ifdef CONFIG_ARCH_OMAP3
@@ -184,8 +185,6 @@ static struct omap3_gpio_regs gpio_context[OMAP34XX_NR_GPIOS];
  */
 static struct gpio_bank *gpio_bank;
 
-static int bank_width;
-
 /* TODO: Analyze removing gpio_bank_count usage from driver code */
 int gpio_bank_count;
 
@@ -1650,14 +1649,14 @@ static void __init omap_gpio_chip_init(struct gpio_bank *bank)
 	} else {
 		bank->chip.label = "gpio";
 		bank->chip.base = gpio;
-		gpio += bank_width;
+		gpio += bank->width;
 	}
-	bank->chip.ngpio = bank_width;
+	bank->chip.ngpio = bank->width;
 
 	gpiochip_add(&bank->chip);
 
 	for (j = bank->virtual_irq_start;
-		     j < bank->virtual_irq_start + bank_width; j++) {
+		     j < bank->virtual_irq_start + bank->width; j++) {
 		irq_set_lockdep_class(j, &gpio_lock_class);
 		irq_set_chip_data(j, bank);
 		if (bank_is_mpuio(bank))
@@ -1707,7 +1706,7 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)
 	bank->dev = &pdev->dev;
 	bank->dbck_flag = pdata->dbck_flag;
 	bank->stride = pdata->bank_stride;
-	bank_width = pdata->bank_width;
+	bank->width = pdata->bank_width;
 
 	spin_lock_init(&bank->lock);
 
Signature · 1 line
1.7.4
#4 lore raw

PATCH 4/9 OMAP: GPIO: _get_gpio_irqbank_mask: replace hard-coded mask with bank->width

In reply to Kevin Hilman

Replace hard-coded mask values with bank->width which is already coming from platform_data.

---
 arch/arm/plat-omap/gpio.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)
arch/arm/plat-omap/gpio.c +1 -7
index d1d3397..b66f374 100644
@@ -823,46 +823,40 @@ static u32 _get_gpio_irqbank_mask(struct gpio_bank *bank)
 	void __iomem *reg = bank->base;
 	int inv = 0;
 	u32 l;
-	u32 mask;
+	u32 mask = (1 << bank->width) - 1;
 
 	switch (bank->method) {
 #ifdef CONFIG_ARCH_OMAP1
 	case METHOD_MPUIO:
 		reg += OMAP_MPUIO_GPIO_MASKIT / bank->stride;
-		mask = 0xffff;
 		inv = 1;
 		break;
 #endif
 #ifdef CONFIG_ARCH_OMAP15XX
 	case METHOD_GPIO_1510:
 		reg += OMAP1510_GPIO_INT_MASK;
-		mask = 0xffff;
 		inv = 1;
 		break;
 #endif
 #ifdef CONFIG_ARCH_OMAP16XX
 	case METHOD_GPIO_1610:
 		reg += OMAP1610_GPIO_IRQENABLE1;
-		mask = 0xffff;
 		break;
 #endif
 #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
 	case METHOD_GPIO_7XX:
 		reg += OMAP7XX_GPIO_INT_MASK;
-		mask = 0xffffffff;
 		inv = 1;
 		break;
 #endif
 #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 	case METHOD_GPIO_24XX:
 		reg += OMAP24XX_GPIO_IRQENABLE1;
-		mask = 0xffffffff;
 		break;
 #endif
 #if defined(CONFIG_ARCH_OMAP4)
 	case METHOD_GPIO_44XX:
 		reg += OMAP4_GPIO_IRQSTATUSSET0;
-		mask = 0xffffffff;
 		break;
 #endif
 	default:
Signature · 1 line
1.7.4
#5 lore raw

PATCH 5/9 OMAP: GPIO: move register offset defines into gpio.h

In reply to Kevin Hilman

Register offset defines are moved to <plat/gpio.h> so they can be used by SoC-specific device init code to fill out platform_data register offsets.

---
 arch/arm/plat-omap/gpio.c              |  103 --------------------------------
 arch/arm/plat-omap/include/plat/gpio.h |  103 ++++++++++++++++++++++++++++++++
 2 files changed, 103 insertions(+), 103 deletions(-)
arch/arm/plat-omap/gpio.c +0 -103
index b66f374..274e4a5 100644
@@ -30,109 +30,6 @@
 #include <mach/gpio.h>
 #include <asm/mach/irq.h>
 
-/*
- * OMAP1510 GPIO registers
- */
-#define OMAP1510_GPIO_DATA_INPUT	0x00
-#define OMAP1510_GPIO_DATA_OUTPUT	0x04
-#define OMAP1510_GPIO_DIR_CONTROL	0x08
-#define OMAP1510_GPIO_INT_CONTROL	0x0c
-#define OMAP1510_GPIO_INT_MASK		0x10
-#define OMAP1510_GPIO_INT_STATUS	0x14
-#define OMAP1510_GPIO_PIN_CONTROL	0x18
-
-#define OMAP1510_IH_GPIO_BASE		64
-
-/*
- * OMAP1610 specific GPIO registers
- */
-#define OMAP1610_GPIO_REVISION		0x0000
-#define OMAP1610_GPIO_SYSCONFIG		0x0010
-#define OMAP1610_GPIO_SYSSTATUS		0x0014
-#define OMAP1610_GPIO_IRQSTATUS1	0x0018
-#define OMAP1610_GPIO_IRQENABLE1	0x001c
-#define OMAP1610_GPIO_WAKEUPENABLE	0x0028
-#define OMAP1610_GPIO_DATAIN		0x002c
-#define OMAP1610_GPIO_DATAOUT		0x0030
-#define OMAP1610_GPIO_DIRECTION		0x0034
-#define OMAP1610_GPIO_EDGE_CTRL1	0x0038
-#define OMAP1610_GPIO_EDGE_CTRL2	0x003c
-#define OMAP1610_GPIO_CLEAR_IRQENABLE1	0x009c
-#define OMAP1610_GPIO_CLEAR_WAKEUPENA	0x00a8
-#define OMAP1610_GPIO_CLEAR_DATAOUT	0x00b0
-#define OMAP1610_GPIO_SET_IRQENABLE1	0x00dc
-#define OMAP1610_GPIO_SET_WAKEUPENA	0x00e8
-#define OMAP1610_GPIO_SET_DATAOUT	0x00f0
-
-/*
- * OMAP7XX specific GPIO registers
- */
-#define OMAP7XX_GPIO_DATA_INPUT		0x00
-#define OMAP7XX_GPIO_DATA_OUTPUT	0x04
-#define OMAP7XX_GPIO_DIR_CONTROL	0x08
-#define OMAP7XX_GPIO_INT_CONTROL	0x0c
-#define OMAP7XX_GPIO_INT_MASK		0x10
-#define OMAP7XX_GPIO_INT_STATUS		0x14
-
-/*
- * omap2+ specific GPIO registers
- */
-#define OMAP24XX_GPIO_REVISION		0x0000
-#define OMAP24XX_GPIO_IRQSTATUS1	0x0018
-#define OMAP24XX_GPIO_IRQSTATUS2	0x0028
-#define OMAP24XX_GPIO_IRQENABLE2	0x002c
-#define OMAP24XX_GPIO_IRQENABLE1	0x001c
-#define OMAP24XX_GPIO_WAKE_EN		0x0020
-#define OMAP24XX_GPIO_CTRL		0x0030
-#define OMAP24XX_GPIO_OE		0x0034
-#define OMAP24XX_GPIO_DATAIN		0x0038
-#define OMAP24XX_GPIO_DATAOUT		0x003c
-#define OMAP24XX_GPIO_LEVELDETECT0	0x0040
-#define OMAP24XX_GPIO_LEVELDETECT1	0x0044
-#define OMAP24XX_GPIO_RISINGDETECT	0x0048
-#define OMAP24XX_GPIO_FALLINGDETECT	0x004c
-#define OMAP24XX_GPIO_DEBOUNCE_EN	0x0050
-#define OMAP24XX_GPIO_DEBOUNCE_VAL	0x0054
-#define OMAP24XX_GPIO_CLEARIRQENABLE1	0x0060
-#define OMAP24XX_GPIO_SETIRQENABLE1	0x0064
-#define OMAP24XX_GPIO_CLEARWKUENA	0x0080
-#define OMAP24XX_GPIO_SETWKUENA		0x0084
-#define OMAP24XX_GPIO_CLEARDATAOUT	0x0090
-#define OMAP24XX_GPIO_SETDATAOUT	0x0094
-
-#define OMAP4_GPIO_REVISION		0x0000
-#define OMAP4_GPIO_EOI			0x0020
-#define OMAP4_GPIO_IRQSTATUSRAW0	0x0024
-#define OMAP4_GPIO_IRQSTATUSRAW1	0x0028
-#define OMAP4_GPIO_IRQSTATUS0		0x002c
-#define OMAP4_GPIO_IRQSTATUS1		0x0030
-#define OMAP4_GPIO_IRQSTATUSSET0	0x0034
-#define OMAP4_GPIO_IRQSTATUSSET1	0x0038
-#define OMAP4_GPIO_IRQSTATUSCLR0	0x003c
-#define OMAP4_GPIO_IRQSTATUSCLR1	0x0040
-#define OMAP4_GPIO_IRQWAKEN0		0x0044
-#define OMAP4_GPIO_IRQWAKEN1		0x0048
-#define OMAP4_GPIO_IRQENABLE1		0x011c
-#define OMAP4_GPIO_WAKE_EN		0x0120
-#define OMAP4_GPIO_IRQSTATUS2		0x0128
-#define OMAP4_GPIO_IRQENABLE2		0x012c
-#define OMAP4_GPIO_CTRL			0x0130
-#define OMAP4_GPIO_OE			0x0134
-#define OMAP4_GPIO_DATAIN		0x0138
-#define OMAP4_GPIO_DATAOUT		0x013c
-#define OMAP4_GPIO_LEVELDETECT0		0x0140
-#define OMAP4_GPIO_LEVELDETECT1		0x0144
-#define OMAP4_GPIO_RISINGDETECT		0x0148
-#define OMAP4_GPIO_FALLINGDETECT	0x014c
-#define OMAP4_GPIO_DEBOUNCENABLE	0x0150
-#define OMAP4_GPIO_DEBOUNCINGTIME	0x0154
-#define OMAP4_GPIO_CLEARIRQENABLE1	0x0160
-#define OMAP4_GPIO_SETIRQENABLE1	0x0164
-#define OMAP4_GPIO_CLEARWKUENA		0x0180
-#define OMAP4_GPIO_SETWKUENA		0x0184
-#define OMAP4_GPIO_CLEARDATAOUT		0x0190
-#define OMAP4_GPIO_SETDATAOUT		0x0194
-
 struct gpio_bank {
 	unsigned long pbase;
 	void __iomem *base;
arch/arm/plat-omap/include/plat/gpio.h +103 -0

109 lines not on this page · raw message

Signature · 1 line
1.7.4
#6 lore raw

PATCH 6/9 OMAP: GPIO: consolidate direction, input, output, remove #ifdefs

In reply to Kevin Hilman

Add register offset fields to GPIO platform_data for registers that control direction, input and output data. Using these register offsets in the common driver allows removal of #ifdefs and greatly improves readability.

---
 arch/arm/mach-omap1/gpio15xx.c         |    7 +
 arch/arm/mach-omap1/gpio16xx.c         |   15 ++
 arch/arm/mach-omap1/gpio7xx.c          |   15 ++
 arch/arm/mach-omap2/gpio.c             |   10 ++
 arch/arm/plat-omap/gpio.c              |  228 +++++---------------------------
 arch/arm/plat-omap/include/plat/gpio.h |    9 ++
 6 files changed, 92 insertions(+), 192 deletions(-)
arch/arm/mach-omap1/gpio15xx.c +7 -0
index 04c4b04..706015b 100644
@@ -39,6 +39,10 @@ static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = {
 	.bank_type		= METHOD_MPUIO,
 	.bank_width		= 16,
 	.bank_stride		= 1,
+	.direction_reg		= OMAP_MPUIO_IO_CNTL,
+	.set_dataout_reg	= OMAP_MPUIO_OUTPUT,
+	.datain_reg		= OMAP_MPUIO_INPUT_LATCH,
+	.dataout_reg		= OMAP_MPUIO_OUTPUT,
 };
 
 static struct __initdata platform_device omap15xx_mpu_gpio = {
@@ -68,6 +72,9 @@ static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = {
 	.virtual_irq_start	= IH_GPIO_BASE,
 	.bank_type		= METHOD_GPIO_1510,
 	.bank_width		= 16,
+	.direction_reg		= OMAP1510_GPIO_DIR_CONTROL,
+	.datain_reg		= OMAP1510_GPIO_DATA_INPUT,
+	.dataout_reg		= OMAP1510_GPIO_DATA_OUTPUT,
 };
 
 static struct __initdata platform_device omap15xx_gpio = {
arch/arm/mach-omap1/gpio16xx.c +15 -0
index 5dd0d4c..9573b5e 100644
@@ -42,6 +42,10 @@ static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = {
 	.bank_type		= METHOD_MPUIO,
 	.bank_width		= 16,
 	.bank_stride		= 1,
+	.direction_reg		= OMAP_MPUIO_IO_CNTL,
+	.set_dataout_reg	= OMAP_MPUIO_OUTPUT,
+	.datain_reg		= OMAP_MPUIO_INPUT_LATCH,
+	.dataout_reg		= OMAP_MPUIO_OUTPUT,
 };
 
 static struct __initdata platform_device omap16xx_mpu_gpio = {
@@ -67,10 +71,18 @@ static struct __initdata resource omap16xx_gpio1_resources[] = {
 	},
 };
 
+#define OMAP16XX_GPIO_REG_OFFSETS \
+	.direction_reg		= OMAP1610_GPIO_DIRECTION, \
+	.set_dataout_reg	= OMAP1610_GPIO_SET_DATAOUT, \
+	.clr_dataout_reg	= OMAP1610_GPIO_CLEAR_DATAOUT, \
+	.datain_reg		= OMAP1610_GPIO_DATAIN, \
+	.dataout_reg		= OMAP1610_GPIO_DATAOUT
+
 static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = {
 	.virtual_irq_start	= IH_GPIO_BASE,
 	.bank_type		= METHOD_GPIO_1610,
 	.bank_width		= 16,
+	OMAP16XX_GPIO_REG_OFFSETS,
 };
 
 static struct __initdata platform_device omap16xx_gpio1 = {
@@ -100,6 +112,7 @@ static struct __initdata omap_gpio_platform_data omap16xx_gpio2_config = {
 	.virtual_irq_start	= IH_GPIO_BASE + 16,
 	.bank_type		= METHOD_GPIO_1610,
 	.bank_width		= 16,
+	OMAP16XX_GPIO_REG_OFFSETS,
 };
 
 static struct __initdata platform_device omap16xx_gpio2 = {
@@ -129,6 +142,7 @@ static struct __initdata omap_gpio_platform_data omap16xx_gpio3_config = {
 	.virtual_irq_start	= IH_GPIO_BASE + 32,
 	.bank_type		= METHOD_GPIO_1610,
 	.bank_width		= 16,
+	OMAP16XX_GPIO_REG_OFFSETS,
 };
 
 static struct __initdata platform_device omap16xx_gpio3 = {
@@ -158,6 +172,7 @@ static struct __initdata omap_gpio_platform_data omap16xx_gpio4_config = {
 	.virtual_irq_start	= IH_GPIO_BASE + 48,
 	.bank_type		= METHOD_GPIO_1610,
 	.bank_width		= 16,
+	OMAP16XX_GPIO_REG_OFFSETS,
 };
 
 static struct __initdata platform_device omap16xx_gpio4 = {
arch/arm/mach-omap1/gpio7xx.c +15 -0
index 1204c8b..59c6e3dbf 100644
@@ -44,6 +44,10 @@ static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = {
 	.bank_type		= METHOD_MPUIO,
 	.bank_width		= 32,
 	.bank_stride		= 2,
+	.direction_reg		= OMAP_MPUIO_IO_CNTL / 2,
+	.set_dataout_reg	= OMAP_MPUIO_OUTPUT / 2,
+	.datain_reg		= OMAP_MPUIO_INPUT_LATCH / 2,
+	.dataout_reg		= OMAP_MPUIO_OUTPUT / 2,
 };
 
 static struct __initdata platform_device omap7xx_mpu_gpio = {
@@ -69,10 +73,16 @@ static struct __initdata resource omap7xx_gpio1_resources[] = {
 	},
 };
 
+#define OMAP7XX_GPIO_REG_OFFSETS \
+	.direction_reg		= OMAP7XX_GPIO_DIR_CONTROL, \
+	.datain_reg             = OMAP7XX_GPIO_DATA_INPUT, \
+	.dataout_reg            = OMAP7XX_GPIO_DATA_OUTPUT
+
 static struct __initdata omap_gpio_platform_data omap7xx_gpio1_config = {
 	.virtual_irq_start	= IH_GPIO_BASE,
 	.bank_type		= METHOD_GPIO_7XX,
 	.bank_width		= 32,
+	OMAP7XX_GPIO_REG_OFFSETS,
 };
 
 static struct __initdata platform_device omap7xx_gpio1 = {
@@ -102,6 +112,7 @@ static struct __initdata omap_gpio_platform_data omap7xx_gpio2_config = {
 	.virtual_irq_start	= IH_GPIO_BASE + 32,
 	.bank_type		= METHOD_GPIO_7XX,
 	.bank_width		= 32,
+	OMAP7XX_GPIO_REG_OFFSETS,
 };
 
 static struct __initdata platform_device omap7xx_gpio2 = {
@@ -131,6 +142,7 @@ static struct __initdata omap_gpio_platform_data omap7xx_gpio3_config = {
 	.virtual_irq_start	= IH_GPIO_BASE + 64,
 	.bank_type		= METHOD_GPIO_7XX,
 	.bank_width		= 32,
+	OMAP7XX_GPIO_REG_OFFSETS,
 };
 
 static struct __initdata platform_device omap7xx_gpio3 = {
@@ -160,6 +172,7 @@ static struct __initdata omap_gpio_platform_data omap7xx_gpio4_config = {
 	.virtual_irq_start	= IH_GPIO_BASE + 96,
 	.bank_type		= METHOD_GPIO_7XX,
 	.bank_width		= 32,
+	OMAP7XX_GPIO_REG_OFFSETS,
 };
 
 static struct __initdata platform_device omap7xx_gpio4 = {
@@ -189,6 +202,7 @@ static struct __initdata omap_gpio_platform_data omap7xx_gpio5_config = {
 	.virtual_irq_start	= IH_GPIO_BASE + 128,
 	.bank_type		= METHOD_GPIO_7XX,
 	.bank_width		= 32,
+	OMAP7XX_GPIO_REG_OFFSETS,
 };
 
 static struct __initdata platform_device omap7xx_gpio5 = {
@@ -218,6 +232,7 @@ static struct __initdata omap_gpio_platform_data omap7xx_gpio6_config = {
 	.virtual_irq_start	= IH_GPIO_BASE + 160,
 	.bank_type		= METHOD_GPIO_7XX,
 	.bank_width		= 32,
+	OMAP7XX_GPIO_REG_OFFSETS,
 };
 
 static struct __initdata platform_device omap7xx_gpio6 = {
arch/arm/mach-omap2/gpio.c +10 -0
index 9529842..cc63188 100644
@@ -65,9 +65,19 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 	case 0:
 	case 1:
 		pdata->bank_type = METHOD_GPIO_24XX;
+		pdata->direction_reg = OMAP24XX_GPIO_OE;
+		pdata->datain_reg = OMAP24XX_GPIO_DATAIN;
+		pdata->dataout_reg = OMAP24XX_GPIO_DATAOUT;
+		pdata->set_dataout_reg = OMAP24XX_GPIO_SETDATAOUT;
+		pdata->clr_dataout_reg = OMAP24XX_GPIO_CLEARDATAOUT;
 		break;
 	case 2:
 		pdata->bank_type = METHOD_GPIO_44XX;
+		pdata->direction_reg = OMAP4_GPIO_OE;
+		pdata->datain_reg = OMAP4_GPIO_DATAIN;
+		pdata->dataout_reg = OMAP4_GPIO_DATAOUT;
+		pdata->set_dataout_reg = OMAP4_GPIO_SETDATAOUT;
+		pdata->clr_dataout_reg = OMAP4_GPIO_CLEARDATAOUT;
 		break;
 	default:
 		WARN(1, "Invalid gpio bank_type\n");
arch/arm/plat-omap/gpio.c +36 -192

275 lines not on this page · raw message

arch/arm/plat-omap/include/plat/gpio.h +9 -0
index ec97e00..bbf9a5f 100644
@@ -180,6 +180,15 @@ struct omap_gpio_platform_data {
 	int bank_width;		/* GPIO bank width */
 	int bank_stride;	/* Only needed for omap1 MPUIO */
 	bool dbck_flag;		/* dbck required or not - True for OMAP3&4 */
+
+	/* SoC-specific register offsets (required) */
+	u16 direction_reg;
+	u16 datain_reg;
+	u16 dataout_reg;
+
+	/* SoC-specific register offsets (optional) */
+	u16 set_dataout_reg;
+	u16 clr_dataout_reg;
 };
 
 /* TODO: Analyze removing gpio_bank_count usage from driver code */
Signature · 1 line
1.7.4
#7 lore raw

PATCH 7/9 OMAP: GPIO: consolidate IRQ status handling, remove #ifdefs

In reply to Kevin Hilman

Cleanup IRQ status handling by by passing IRQ status register offsets via platform data.

Cleans up clearing of GPIO IRQ status and GPIO ISR handler.

---
 arch/arm/mach-omap1/gpio15xx.c         |    2 +
 arch/arm/mach-omap1/gpio16xx.c         |    4 +-
 arch/arm/mach-omap1/gpio7xx.c          |    4 +-
 arch/arm/mach-omap2/gpio.c             |    4 ++
 arch/arm/plat-omap/gpio.c              |   70 ++++---------------------------
 arch/arm/plat-omap/include/plat/gpio.h |    2 +
 6 files changed, 23 insertions(+), 63 deletions(-)
arch/arm/mach-omap1/gpio15xx.c +2 -0
index 706015b..16e5890 100644
@@ -43,6 +43,7 @@ static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = {
 	.set_dataout_reg	= OMAP_MPUIO_OUTPUT,
 	.datain_reg		= OMAP_MPUIO_INPUT_LATCH,
 	.dataout_reg		= OMAP_MPUIO_OUTPUT,
+	.irqstatus_reg		= OMAP_MPUIO_GPIO_INT,
 };
 
 static struct __initdata platform_device omap15xx_mpu_gpio = {
@@ -75,6 +76,7 @@ static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = {
 	.direction_reg		= OMAP1510_GPIO_DIR_CONTROL,
 	.datain_reg		= OMAP1510_GPIO_DATA_INPUT,
 	.dataout_reg		= OMAP1510_GPIO_DATA_OUTPUT,
+	.irqstatus_reg          = OMAP1510_GPIO_INT_STATUS,
 };
 
 static struct __initdata platform_device omap15xx_gpio = {
arch/arm/mach-omap1/gpio16xx.c +3 -1
index 9573b5e..700687c 100644
@@ -46,6 +46,7 @@ static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = {
 	.set_dataout_reg	= OMAP_MPUIO_OUTPUT,
 	.datain_reg		= OMAP_MPUIO_INPUT_LATCH,
 	.dataout_reg		= OMAP_MPUIO_OUTPUT,
+	.irqstatus_reg		= OMAP_MPUIO_GPIO_INT,
 };
 
 static struct __initdata platform_device omap16xx_mpu_gpio = {
@@ -76,7 +77,8 @@ static struct __initdata resource omap16xx_gpio1_resources[] = {
 	.set_dataout_reg	= OMAP1610_GPIO_SET_DATAOUT, \
 	.clr_dataout_reg	= OMAP1610_GPIO_CLEAR_DATAOUT, \
 	.datain_reg		= OMAP1610_GPIO_DATAIN, \
-	.dataout_reg		= OMAP1610_GPIO_DATAOUT
+	.dataout_reg		= OMAP1610_GPIO_DATAOUT, \
+        .irqstatus_reg          = OMAP1610_GPIO_IRQSTATUS1
 
 static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = {
 	.virtual_irq_start	= IH_GPIO_BASE,
arch/arm/mach-omap1/gpio7xx.c +3 -1
index 59c6e3dbf..61c1580 100644
@@ -48,6 +48,7 @@ static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = {
 	.set_dataout_reg	= OMAP_MPUIO_OUTPUT / 2,
 	.datain_reg		= OMAP_MPUIO_INPUT_LATCH / 2,
 	.dataout_reg		= OMAP_MPUIO_OUTPUT / 2,
+	.irqstatus_reg		= OMAP_MPUIO_GPIO_INT / 2,
 };
 
 static struct __initdata platform_device omap7xx_mpu_gpio = {
@@ -76,7 +77,8 @@ static struct __initdata resource omap7xx_gpio1_resources[] = {
 #define OMAP7XX_GPIO_REG_OFFSETS \
 	.direction_reg		= OMAP7XX_GPIO_DIR_CONTROL, \
 	.datain_reg             = OMAP7XX_GPIO_DATA_INPUT, \
-	.dataout_reg            = OMAP7XX_GPIO_DATA_OUTPUT
+	.dataout_reg            = OMAP7XX_GPIO_DATA_OUTPUT, \
+        .irqstatus_reg          = OMAP7XX_GPIO_INT_STATUS
 
 static struct __initdata omap_gpio_platform_data omap7xx_gpio1_config = {
 	.virtual_irq_start	= IH_GPIO_BASE,
arch/arm/mach-omap2/gpio.c +4 -0
index cc63188..712b858 100644
@@ -70,6 +70,8 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 		pdata->dataout_reg = OMAP24XX_GPIO_DATAOUT;
 		pdata->set_dataout_reg = OMAP24XX_GPIO_SETDATAOUT;
 		pdata->clr_dataout_reg = OMAP24XX_GPIO_CLEARDATAOUT;
+		pdata->irqstatus_reg = OMAP24XX_GPIO_IRQSTATUS1;
+		pdata->irqstatus2_reg = OMAP24XX_GPIO_IRQSTATUS2;
 		break;
 	case 2:
 		pdata->bank_type = METHOD_GPIO_44XX;
@@ -78,6 +80,8 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 		pdata->dataout_reg = OMAP4_GPIO_DATAOUT;
 		pdata->set_dataout_reg = OMAP4_GPIO_SETDATAOUT;
 		pdata->clr_dataout_reg = OMAP4_GPIO_CLEARDATAOUT;
+		pdata->irqstatus_reg = OMAP4_GPIO_IRQSTATUS0;
+		pdata->irqstatus2_reg = OMAP4_GPIO_IRQSTATUS1;
 		break;
 	default:
 		WARN(1, "Invalid gpio bank_type\n");
arch/arm/plat-omap/gpio.c +9 -61

98 lines not on this page · raw message

arch/arm/plat-omap/include/plat/gpio.h +2 -0
index bbf9a5f..6113183 100644
@@ -185,6 +185,8 @@ struct omap_gpio_platform_data {
 	u16 direction_reg;
 	u16 datain_reg;
 	u16 dataout_reg;
+	u16 irqstatus_reg;
+	u16 irqstatus2_reg;
 
 	/* SoC-specific register offsets (optional) */
 	u16 set_dataout_reg;
Signature · 1 line
1.7.4
#8 lore raw

PATCH 8/9 OMAP: GPIO: conslidate enable/disable of GPIO IRQs, remove ifdefs

In reply to Kevin Hilman

Cleanup GPIO IRQ enable/disable handling by removing SoC-specific

Also split enable/disable IRQ into separate functions for better readability and also facilitate potentially moving to generic irq_chip in the future.

---
 arch/arm/mach-omap1/gpio15xx.c         |    4 +
 arch/arm/mach-omap1/gpio16xx.c         |    7 ++-
 arch/arm/mach-omap1/gpio7xx.c          |    6 +-
 arch/arm/mach-omap2/gpio.c             |    6 ++
 arch/arm/plat-omap/gpio.c              |  140 +++++++++----------------------
 arch/arm/plat-omap/include/plat/gpio.h |    6 ++
 6 files changed, 68 insertions(+), 101 deletions(-)
arch/arm/mach-omap1/gpio15xx.c +4 -0
index 16e5890..64a5d53 100644
@@ -44,6 +44,8 @@ static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = {
 	.datain_reg		= OMAP_MPUIO_INPUT_LATCH,
 	.dataout_reg		= OMAP_MPUIO_OUTPUT,
 	.irqstatus_reg		= OMAP_MPUIO_GPIO_INT,
+	.irqenable_reg		= OMAP_MPUIO_GPIO_MASKIT,
+	.irqenable_inv		= true,
 };
 
 static struct __initdata platform_device omap15xx_mpu_gpio = {
@@ -77,6 +79,8 @@ static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = {
 	.datain_reg		= OMAP1510_GPIO_DATA_INPUT,
 	.dataout_reg		= OMAP1510_GPIO_DATA_OUTPUT,
 	.irqstatus_reg          = OMAP1510_GPIO_INT_STATUS,
+	.irqenable_reg		= OMAP1510_GPIO_INT_MASK,
+	.irqenable_inv		= true,
 };
 
 static struct __initdata platform_device omap15xx_gpio = {
arch/arm/mach-omap1/gpio16xx.c +6 -1
index 700687c..864ddd1 100644
@@ -47,6 +47,8 @@ static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = {
 	.datain_reg		= OMAP_MPUIO_INPUT_LATCH,
 	.dataout_reg		= OMAP_MPUIO_OUTPUT,
 	.irqstatus_reg		= OMAP_MPUIO_GPIO_INT,
+	.irqenable_reg		= OMAP_MPUIO_GPIO_MASKIT,
+	.irqenable_inv		= true,
 };
 
 static struct __initdata platform_device omap16xx_mpu_gpio = {
@@ -78,7 +80,10 @@ static struct __initdata resource omap16xx_gpio1_resources[] = {
 	.clr_dataout_reg	= OMAP1610_GPIO_CLEAR_DATAOUT, \
 	.datain_reg		= OMAP1610_GPIO_DATAIN, \
 	.dataout_reg		= OMAP1610_GPIO_DATAOUT, \
-        .irqstatus_reg          = OMAP1610_GPIO_IRQSTATUS1
+	.irqstatus_reg          = OMAP1610_GPIO_IRQSTATUS1, \
+	.irqenable_reg          = OMAP1610_GPIO_IRQENABLE1, \
+	.set_irqenable_reg      = OMAP1610_GPIO_SET_IRQENABLE1, \
+	.clr_irqenable_reg      = OMAP1610_GPIO_CLEAR_IRQENABLE1
 
 static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = {
 	.virtual_irq_start	= IH_GPIO_BASE,
arch/arm/mach-omap1/gpio7xx.c +5 -1
index 61c1580..cff4ab8 100644
@@ -49,6 +49,8 @@ static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = {
 	.datain_reg		= OMAP_MPUIO_INPUT_LATCH / 2,
 	.dataout_reg		= OMAP_MPUIO_OUTPUT / 2,
 	.irqstatus_reg		= OMAP_MPUIO_GPIO_INT / 2,
+	.irqenable_reg		= OMAP_MPUIO_GPIO_MASKIT / 2,
+	.irqenable_inv		= true,
 };
 
 static struct __initdata platform_device omap7xx_mpu_gpio = {
@@ -78,7 +80,9 @@ static struct __initdata resource omap7xx_gpio1_resources[] = {
 	.direction_reg		= OMAP7XX_GPIO_DIR_CONTROL, \
 	.datain_reg             = OMAP7XX_GPIO_DATA_INPUT, \
 	.dataout_reg            = OMAP7XX_GPIO_DATA_OUTPUT, \
-        .irqstatus_reg          = OMAP7XX_GPIO_INT_STATUS
+	.irqstatus_reg          = OMAP7XX_GPIO_INT_STATUS, \
+	.irqenable_reg          = OMAP7XX_GPIO_INT_MASK, \
+	.irqenable_inv          = true
 
 static struct __initdata omap_gpio_platform_data omap7xx_gpio1_config = {
 	.virtual_irq_start	= IH_GPIO_BASE,
arch/arm/mach-omap2/gpio.c +6 -0
index 712b858..538ed92 100644
@@ -72,6 +72,9 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 		pdata->clr_dataout_reg = OMAP24XX_GPIO_CLEARDATAOUT;
 		pdata->irqstatus_reg = OMAP24XX_GPIO_IRQSTATUS1;
 		pdata->irqstatus2_reg = OMAP24XX_GPIO_IRQSTATUS2;
+		pdata->irqenable_reg = OMAP24XX_GPIO_IRQENABLE1;
+		pdata->set_irqenable_reg = OMAP24XX_GPIO_SETIRQENABLE1;
+		pdata->clr_irqenable_reg = OMAP24XX_GPIO_CLEARIRQENABLE1;
 		break;
 	case 2:
 		pdata->bank_type = METHOD_GPIO_44XX;
@@ -82,6 +85,9 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 		pdata->clr_dataout_reg = OMAP4_GPIO_CLEARDATAOUT;
 		pdata->irqstatus_reg = OMAP4_GPIO_IRQSTATUS0;
 		pdata->irqstatus2_reg = OMAP4_GPIO_IRQSTATUS1;
+		pdata->irqenable_reg = OMAP4_GPIO_IRQSTATUSSET0;
+		pdata->set_irqenable_reg = OMAP4_GPIO_IRQSTATUSSET0;
+		pdata->clr_irqenable_reg = OMAP4_GPIO_IRQSTATUSCLR0;
 		break;
 	default:
 		WARN(1, "Invalid gpio bank_type\n");
arch/arm/plat-omap/gpio.c +41 -99

195 lines not on this page · raw message

arch/arm/plat-omap/include/plat/gpio.h +6 -0
index 6113183..184a853 100644
@@ -187,10 +187,16 @@ struct omap_gpio_platform_data {
 	u16 dataout_reg;
 	u16 irqstatus_reg;
 	u16 irqstatus2_reg;
+	u16 irqenable_reg;
 
 	/* SoC-specific register offsets (optional) */
 	u16 set_dataout_reg;
 	u16 clr_dataout_reg;
+	u16 set_irqenable_reg;
+	u16 clr_irqenable_reg;
+
+	/* SoC-specific register options */
+	bool irqenable_inv;
 };
 
 /* TODO: Analyze removing gpio_bank_count usage from driver code */
Signature · 1 line
1.7.4
#9 lore raw

PATCH 9/9 OMAP: GPIO: convert MPUIO IRQ over to generic irq_chip

In reply to Kevin Hilman
---
 arch/arm/plat-omap/gpio.c |   74 ++++++++++++++++++--------------------------
 1 files changed, 30 insertions(+), 44 deletions(-)
arch/arm/plat-omap/gpio.c +30 -44
index 8d80bf0..57530c0 100644
@@ -922,45 +922,8 @@ static struct irq_chip gpio_irq_chip = {
 
 #ifdef CONFIG_ARCH_OMAP1
 
-/* MPUIO uses the always-on 32k clock */
-
-static void mpuio_ack_irq(struct irq_data *d)
-{
-	/* The ISR is reset automatically, so do nothing here. */
-}
-
-static void mpuio_mask_irq(struct irq_data *d)
-{
-	unsigned int gpio = OMAP_MPUIO(d->irq - IH_MPUIO_BASE);
-	struct gpio_bank *bank = irq_data_get_irq_chip_data(d);
-
-	_set_gpio_irqenable(bank, gpio, 0);
-}
-
-static void mpuio_unmask_irq(struct irq_data *d)
-{
-	unsigned int gpio = OMAP_MPUIO(d->irq - IH_MPUIO_BASE);
-	struct gpio_bank *bank = irq_data_get_irq_chip_data(d);
-
-	_set_gpio_irqenable(bank, gpio, 1);
-}
-
-static struct irq_chip mpuio_irq_chip = {
-	.name		= "MPUIO",
-	.irq_ack	= mpuio_ack_irq,
-	.irq_mask	= mpuio_mask_irq,
-	.irq_unmask	= mpuio_unmask_irq,
-	.irq_set_type	= gpio_irq_type,
-#ifdef CONFIG_ARCH_OMAP16XX
-	/* REVISIT: assuming only 16xx supports MPUIO wake events */
-	.irq_set_wake	= gpio_wake_enable,
-#endif
-};
-
-
 #define bank_is_mpuio(bank)	((bank)->method == METHOD_MPUIO)
 
-
 #ifdef CONFIG_ARCH_OMAP16XX
 
 #include <linux/platform_device.h>
@@ -1035,8 +998,6 @@ static inline void mpuio_init(void) {}
 
 #else
 
-extern struct irq_chip mpuio_irq_chip;
-
 #define bank_is_mpuio(bank)	0
 static inline void mpuio_init(void) {}
 
@@ -1236,6 +1197,30 @@ static void omap_gpio_mod_init(struct gpio_bank *bank, int id)
 	}
 }
 
+static __init void
+omap_mpuio_alloc_gc(struct gpio_bank *bank, unsigned int irq_start,
+		    unsigned int num)
+{
+	struct irq_chip_generic *gc;
+	struct irq_chip_type *ct;
+
+	gc = irq_alloc_generic_chip("MPUIO", 1, irq_start, bank->base,
+				    handle_simple_irq);
+	ct = gc->chip_types;
+
+	/* NOTE: No ack required, reading IRQ status clears it. */
+	ct->chip.irq_mask = irq_gc_mask_set_bit;
+	ct->chip.irq_unmask = irq_gc_mask_clr_bit;
+	ct->chip.irq_set_type = gpio_irq_type;
+	/* REVISIT: assuming only 16xx supports MPUIO wake events */
+	if (cpu_is_omap16xx())
+		ct->chip.irq_set_wake = gpio_wake_enable,
+
+	ct->regs.mask = OMAP_MPUIO_GPIO_INT / bank->stride;
+	irq_setup_generic_chip(gc, IRQ_MSK(num),
+				IRQ_NOREQUEST | IRQ_NOPROBE, 0);
+}
+
 static void __init omap_gpio_chip_init(struct gpio_bank *bank)
 {
 	int j;
@@ -1273,12 +1258,13 @@ static void __init omap_gpio_chip_init(struct gpio_bank *bank)
 		     j < bank->virtual_irq_start + bank->width; j++) {
 		irq_set_lockdep_class(j, &gpio_lock_class);
 		irq_set_chip_data(j, bank);
-		if (bank_is_mpuio(bank))
-			irq_set_chip(j, &mpuio_irq_chip);
-		else
+		if (bank_is_mpuio(bank)) {
+			omap_mpuio_alloc_gc(bank->base, j, bank->width);
+		} else {
 			irq_set_chip(j, &gpio_irq_chip);
-		irq_set_handler(j, handle_simple_irq);
-		set_irq_flags(j, IRQF_VALID);
+			irq_set_handler(j, handle_simple_irq);
+			set_irq_flags(j, IRQF_VALID);
+		}
 	}
 	irq_set_chained_handler(bank->irq, gpio_irq_handler);
 	irq_set_handler_data(bank->irq, bank);
Signature · 1 line
1.7.4
#10 lore raw
In reply to Kevin Hilman

Kevin,

Quoted 14 lines

-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Hilman, Kevin
Sent: Friday, April 22, 2011 2:05 AM
To: [email protected]
Cc: Varadarajan, Charulatha
Subject: [PATCH 0/9] OMAP: GPIO: cleanup, consolidation, etc. (v2)

Here's an updated version of my work-in-progress GPIO cleanups.

I now understand that others have some similar work in progress, so these are posted (to linux-omap only, for now) so that we can begin collaboration on the GPIO cleanups.

Quoted 6 lines

This series applies on top of v2.6.39-rc4 plus the generic irq_chip series from Thomas Gleixner since in addition to the cleanups, I started moving the GPIO IRQ handling over to use generic irq_chip (last patch in series.)

This work in progress is available in my wip/gpio-cleanup branch.

There are two observations in this series:
(1) omap1_defconfig build generates following compilation errors
CHK include/generated/compile.h
CC arch/arm/plat-omap/gpio.o
arch/arm/plat-omap/gpio.c: In function 'omap_mpuio_alloc_gc':
arch/arm/plat-omap/gpio.c:1207: error: implicit declaration of function 'irq_alloc_generic_chip' arch/arm/plat-omap/gpio.c:1208: warning: assignment makes pointer from integer without a cast arch/arm/plat-omap/gpio.c:1209: error: dereferencing pointer to incomplete type arch/arm/plat-omap/gpio.c:1212: error: dereferencing pointer to incomplete type arch/arm/plat-omap/gpio.c:1212: error: 'irq_gc_mask_set_bit' undeclared (first use in this function) arch/arm/plat-omap/gpio.c:1212: error: (Each undeclared identifier is reported only once arch/arm/plat-omap/gpio.c:1212: error: for each function it appears in.) arch/arm/plat-omap/gpio.c:1213: error: dereferencing pointer to incomplete type arch/arm/plat-omap/gpio.c:1213: error: 'irq_gc_mask_clr_bit' undeclared (first use in this function) arch/arm/plat-omap/gpio.c:1214: error: dereferencing pointer to incomplete type arch/arm/plat-omap/gpio.c:1217: error: dereferencing pointer to incomplete type arch/arm/plat-omap/gpio.c:1219: error: dereferencing pointer to incomplete type arch/arm/plat-omap/gpio.c:1219: warning: left-hand operand of comma expression has no effect arch/arm/plat-omap/gpio.c:1220: error: implicit declaration of function 'irq_setup_generic_chip' arch/arm/plat-omap/gpio.c:1220: error: implicit declaration of function 'IRQ_MSK' make[1]: *** [arch/arm/plat-omap/gpio.o] Error 1
make: *** [arch/arm/plat-omap] Error 2

(2) Warning in the 8th patch. Also, note the typo (consolidate).
Applying: OMAP: GPIO: conslidate enable/disable of GPIO IRQs, /home/a0876346/working/tony3/linux-omap-2.6/.git/rebase-apply/patch:272: trailing whitespace.

warning: 1 line adds whitespace errors.
Applying: OMAP: GPIO: convert MPUIO IRQ over to generic

--
Tarun

Quoted 29 lines

Kevin Hilman (9):
OMAP: GPIO: _clear_gpio_irqbank: fix flushing of posted write
OMAP: GPIO: remove MPUIO handling from _clear_gpio_irqbank()
OMAP: GPIO: move bank width into struct gpio_bank
OMAP: GPIO: _get_gpio_irqbank_mask: replace hard-coded mask with

    bank->width

OMAP: GPIO: move register offset defines into gpio.h
OMAP: GPIO: consolidate direction, input, output, remove #ifdefs
OMAP: GPIO: consolidate IRQ status handling, remove #ifdefs
OMAP: GPIO: conslidate enable/disable of GPIO IRQs, remove ifdefs
OMAP: GPIO: convert MPUIO IRQ over to generic irq_chip

 arch/arm/mach-omap1/gpio15xx.c         |   13 +
 arch/arm/mach-omap1/gpio16xx.c         |   22 ++
 arch/arm/mach-omap1/gpio7xx.c          |   21 +
 arch/arm/mach-omap2/gpio.c             |   20 +
 arch/arm/plat-omap/gpio.c              |  641 ++++++---------------------
-----
 arch/arm/plat-omap/include/plat/gpio.h |  120 ++++++
 6 files changed, 318 insertions(+), 519 deletions(-)

--
1.7.4

--
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

#11 lore raw

Kevin,
[...]

Quoted 7 lines
Quoted 7 lines

Here's an updated version of my work-in-progress GPIO cleanups.

I now understand that others have some similar work in progress, so these are posted (to linux-omap only, for now) so that we can begin collaboration on the GPIO cleanups.

Quoted 8 lines
Quoted 6 lines

This series applies on top of v2.6.39-rc4 plus the generic irq_chip series from Thomas Gleixner since in addition to the cleanups, I started moving the GPIO IRQ handling over to use generic irq_chip (last patch in series.)

This work in progress is available in my wip/gpio-cleanup branch.

There are two observations in this series:
(1) omap1_defconfig build generates following compilation errors:

I realized that I missed the patch series from Thomas Gleixner. BTW, there are multiple series related to irq_chip cleanup. Do we need to apply all the series?
--
Tarun

Quoted 79 lines

CHK include/generated/compile.h
CC arch/arm/plat-omap/gpio.o
arch/arm/plat-omap/gpio.c: In function 'omap_mpuio_alloc_gc':
arch/arm/plat-omap/gpio.c:1207: error: implicit declaration of function 'irq_alloc_generic_chip'
arch/arm/plat-omap/gpio.c:1208: warning: assignment makes pointer from integer without a cast
arch/arm/plat-omap/gpio.c:1209: error: dereferencing pointer to incomplete type
arch/arm/plat-omap/gpio.c:1212: error: dereferencing pointer to incomplete type
arch/arm/plat-omap/gpio.c:1212: error: 'irq_gc_mask_set_bit' undeclared (first use in this function)
arch/arm/plat-omap/gpio.c:1212: error: (Each undeclared identifier is reported only once
arch/arm/plat-omap/gpio.c:1212: error: for each function it appears in.) arch/arm/plat-omap/gpio.c:1213: error: dereferencing pointer to incomplete type
arch/arm/plat-omap/gpio.c:1213: error: 'irq_gc_mask_clr_bit' undeclared (first use in this function)
arch/arm/plat-omap/gpio.c:1214: error: dereferencing pointer to incomplete type
arch/arm/plat-omap/gpio.c:1217: error: dereferencing pointer to incomplete type
arch/arm/plat-omap/gpio.c:1219: error: dereferencing pointer to incomplete type
arch/arm/plat-omap/gpio.c:1219: warning: left-hand operand of comma expression has no effect
arch/arm/plat-omap/gpio.c:1220: error: implicit declaration of function 'irq_setup_generic_chip'
arch/arm/plat-omap/gpio.c:1220: error: implicit declaration of function 'IRQ_MSK'
make[1]: *** [arch/arm/plat-omap/gpio.o] Error 1
make: *** [arch/arm/plat-omap] Error 2

(2) Warning in the 8th patch. Also, note the typo (consolidate).
Applying: OMAP: GPIO: conslidate enable/disable of GPIO IRQs, /home/a0876346/working/tony3/linux-omap-2.6/.git/rebase-apply/patch:272:
trailing whitespace.

warning: 1 line adds whitespace errors.
Applying: OMAP: GPIO: convert MPUIO IRQ over to generic

--
Tarun

Quoted 13 lines

Kevin Hilman (9):
OMAP: GPIO: _clear_gpio_irqbank: fix flushing of posted write
OMAP: GPIO: remove MPUIO handling from _clear_gpio_irqbank()
OMAP: GPIO: move bank width into struct gpio_bank
OMAP: GPIO: _get_gpio_irqbank_mask: replace hard-coded mask with

    bank->width

OMAP: GPIO: move register offset defines into gpio.h
OMAP: GPIO: consolidate direction, input, output, remove #ifdefs
OMAP: GPIO: consolidate IRQ status handling, remove #ifdefs
OMAP: GPIO: conslidate enable/disable of GPIO IRQs, remove ifdefs
OMAP: GPIO: convert MPUIO IRQ over to generic irq_chip

Quoted 5 lines
 arch/arm/mach-omap1/gpio15xx.c         |   13 +
 arch/arm/mach-omap1/gpio16xx.c         |   22 ++
 arch/arm/mach-omap1/gpio7xx.c          |   21 +
 arch/arm/mach-omap2/gpio.c             |   20 +
 arch/arm/plat-omap/gpio.c              |  641 ++++++-------------------

--

Quoted 11 lines

-----

 arch/arm/plat-omap/include/plat/gpio.h |  120 ++++++
 6 files changed, 318 insertions(+), 519 deletions(-)

--
1.7.4

--
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

--
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

#12 lore raw
Quoted 14 lines · Tarun Kanti

Kevin,
[...]

Quoted 12 lines
Quoted 12 lines

Here's an updated version of my work-in-progress GPIO cleanups.

I now understand that others have some similar work in progress, so these are posted (to linux-omap only, for now) so that we can begin collaboration on the GPIO cleanups.

This series applies on top of v2.6.39-rc4 plus the generic irq_chip series from Thomas Gleixner since in addition to the cleanups, I started moving the GPIO IRQ handling over to use generic irq_chip (last patch in series.)

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

This work in progress is available in my wip/gpio-cleanup branch.

There are two observations in this series:
(1) omap1_defconfig build generates following compilation errors:

I realized that I missed the patch series from Thomas Gleixner. BTW, there are multiple series related to irq_chip cleanup. Do we need to apply all the series?

My wip/gpio-cleanup branch also includes Thomas' series, please use that for testing.

Kevin

#13 lore raw
In reply to Kevin Hilman

Kevin,

Quoted 6 lines · Kevin Hilman

Here's an updated version of my work-in-progress GPIO cleanups.

I now understand that others have some similar work in progress, so these are posted (to linux-omap only, for now) so that we can begin collaboration on the GPIO cleanups.

Quoted 6 lines

This series applies on top of v2.6.39-rc4 plus the generic irq_chip series from Thomas Gleixner since in addition to the cleanups, I started moving the GPIO IRQ handling over to use generic irq_chip (last patch in series.)

This work in progress is available in my wip/gpio-cleanup branch.

I tested the patch series in wip/gpio-cleanup branch.

Here are the results:

Compile tested for:
- omap1_defconfig
- omap2plus_defconfig

Boot test (Failed on the following board):
- OMAP1710-H3

Boot test (Success on the following boards):
- OMAP2420-H4
- OMAP3430-SDP
- OMAP3430-Zoom2
- OMAP3630-Zoom3
- OMAP4430-SDP
- OMAP4430-Blaze

GPIO module functionality testing (success on the following boards):
- OMAP2420-H4
- OMAP3430-SDP
- OMAP3430-Zoom2
- OMAP3630-Zoom3
- OMAP4430-SDP
- OMAP4430-Blaze

PM Testing (success as given below):
OMAP3430-SDP: retention, off_mode, system_wide suspend, gpio wakeup
OMAP3630-Zoom3: retention, system_wide suspend
using the following:
echo 5 > /sys/devices/platform/omap/omap_uart.0/sleep_timeout echo 5 > /sys/devices/platform/omap/omap_uart.1/sleep_timeout echo 5 > /sys/devices/platform/omap/omap_uart.2/sleep_timeout echo 5 > /sys/devices/platform/omap/omap_uart.3/sleep_timeout echo '5' > /debug/pm_debug/wakeup_timer_seconds echo 1 > /debug/pm_debug/sleep_while_idle
echo 1 > /debug/pm_debug/enable_off_mode

-V Charulatha

#14 lore raw

Hi Charu,

Quoted 1 line · Charulatha

I tested the patch series in wip/gpio-cleanup branch.

Thanks so much for testing. It's a great help.

I've updated the branch based on some of your comments, and in particular it should now boot on OMAP1.

Kevin

Quoted 38 lines

Here are the results:

Compile tested for:
- omap1_defconfig
- omap2plus_defconfig

Boot test (Failed on the following board):
- OMAP1710-H3

Boot test (Success on the following boards):
- OMAP2420-H4
- OMAP3430-SDP
- OMAP3430-Zoom2
- OMAP3630-Zoom3
- OMAP4430-SDP
- OMAP4430-Blaze

GPIO module functionality testing (success on the following boards):
- OMAP2420-H4
- OMAP3430-SDP
- OMAP3430-Zoom2
- OMAP3630-Zoom3
- OMAP4430-SDP
- OMAP4430-Blaze

PM Testing (success as given below):
OMAP3430-SDP: retention, off_mode, system_wide suspend, gpio wakeup
OMAP3630-Zoom3: retention, system_wide suspend
using the following:
echo 5 > /sys/devices/platform/omap/omap_uart.0/sleep_timeout echo 5 > /sys/devices/platform/omap/omap_uart.1/sleep_timeout echo 5 > /sys/devices/platform/omap/omap_uart.2/sleep_timeout echo 5 > /sys/devices/platform/omap/omap_uart.3/sleep_timeout echo '5' > /debug/pm_debug/wakeup_timer_seconds echo 1 > /debug/pm_debug/sleep_while_idle
echo 1 > /debug/pm_debug/enable_off_mode

-V Charulatha