All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 00/10] OMAP: GPIO: cleanup GPIO driver
@ 2011-05-16 11:41 Tarun Kanti DebBarma
  2011-05-16 11:41 ` [RFC PATCH 01/10] OMAP: GPIO: Avoid cpu_is checks during module ena/disable Tarun Kanti DebBarma
                   ` (9 more replies)
  0 siblings, 10 replies; 26+ messages in thread
From: Tarun Kanti DebBarma @ 2011-05-16 11:41 UTC (permalink / raw)
  To: linux-omap; +Cc: Charulatha V

From: Charulatha V <charu@ti.com>

Do some more cleanup of OMAP GPIO driver and avoid usage of gpio_bank_count
and gpio_bank pointer array by means of maintaining a list.

Patch series is on following commit of linux-omap-pm (branch: wip/gpio-cleanup):
73ec20e00b9c02d5588dc83babb567527ed4394d
OMAP: GPIO: cleanup show revision, remove cpu_is checks, display only once

Compile tested for:
 - omap1_defconfig
 - omap2plus_defconfig

Boot test (success on the following boards):
 - OMAP1710-H3
 - 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

Charulatha V (6):
  OMAP: GPIO: Avoid cpu_is checks during module ena/disable
  ZOOM: QUART: Request reset GPIO
  OMAP2PLUS: GPIO: Fix non-wakeup GPIO and rev_ids
  OMAP: GPIO: Remove dependency on gpio_bank_count
  OMAP2PLUS: GPIO: Use flag to identify wkup dmn GPIO
  OMAP: GPIO: Use USHRT_MAX for rev offset instead of -1

Tarun Kanti DebBarma (4):
  OMAP: GPIO: cleanup suspend and resume functions
  OMAP: GPIO: cleanup prepare-for and resume-after idle functions
  OMAP: GPIO: cleanup omap_gpio_free and triggering functions
  OMAP: GPIO: remove harcoded offsets in context save and restore

 arch/arm/mach-omap1/gpio15xx.c              |    5 +-
 arch/arm/mach-omap1/gpio16xx.c              |    9 +-
 arch/arm/mach-omap1/gpio7xx.c               |    4 +-
 arch/arm/mach-omap2/board-zoom-debugboard.c |    9 +
 arch/arm/mach-omap2/gpio.c                  |   50 +++-
 arch/arm/mach-omap2/omap_hwmod_2430_data.c  |    2 +-
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c  |    2 +-
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c  |    2 +-
 arch/arm/plat-omap/gpio.c                   |  467 ++++++++++-----------------
 arch/arm/plat-omap/include/plat/gpio.h      |   14 +-
 10 files changed, 257 insertions(+), 307 deletions(-)

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [RFC PATCH 01/10] OMAP: GPIO: Avoid cpu_is checks during module ena/disable
  2011-05-16 11:41 [RFC PATCH 00/10] OMAP: GPIO: cleanup GPIO driver Tarun Kanti DebBarma
@ 2011-05-16 11:41 ` Tarun Kanti DebBarma
  2011-05-16 11:41 ` [RFC PATCH 02/10] ZOOM: QUART: Request reset GPIO Tarun Kanti DebBarma
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 26+ messages in thread
From: Tarun Kanti DebBarma @ 2011-05-16 11:41 UTC (permalink / raw)
  To: linux-omap; +Cc: Charulatha V, Santosh Shilimkar, Kevin Hilman, Tony Lindgren

From: Charulatha V <charu@ti.com>

Remove cpu-is checks while enabling/disabling OMAP GPIO module
during a gpio request/free.

Signed-off-by: Charulatha V <charu@ti.com>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap1/gpio15xx.c         |    2 +
 arch/arm/mach-omap1/gpio16xx.c         |    2 +
 arch/arm/mach-omap1/gpio7xx.c          |    2 +
 arch/arm/mach-omap2/gpio.c             |    2 +
 arch/arm/plat-omap/gpio.c              |   53 ++++++++++++++------------------
 arch/arm/plat-omap/include/plat/gpio.h |    1 +
 6 files changed, 32 insertions(+), 30 deletions(-)

diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c
index 96a24bf..c3caf25 100644
--- a/arch/arm/mach-omap1/gpio15xx.c
+++ b/arch/arm/mach-omap1/gpio15xx.c
@@ -42,6 +42,7 @@ static struct omap_gpio_reg_offs omap15xx_mpuio_regs = {
 	.irqstatus	= OMAP_MPUIO_GPIO_INT,
 	.irqenable	= OMAP_MPUIO_GPIO_MASKIT,
 	.irqenable_inv	= true,
+	.ctrl		= USHRT_MAX,
 };
 
 static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = {
@@ -83,6 +84,7 @@ static struct omap_gpio_reg_offs omap15xx_gpio_regs = {
 	.irqstatus	= OMAP1510_GPIO_INT_STATUS,
 	.irqenable	= OMAP1510_GPIO_INT_MASK,
 	.irqenable_inv	= true,
+	.ctrl		= USHRT_MAX,
 };
 
 static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = {
diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c
index 6cbfc70..f62eaf3 100644
--- a/arch/arm/mach-omap1/gpio16xx.c
+++ b/arch/arm/mach-omap1/gpio16xx.c
@@ -45,6 +45,7 @@ static struct omap_gpio_reg_offs omap16xx_mpuio_regs = {
 	.irqstatus	= OMAP_MPUIO_GPIO_INT,
 	.irqenable	= OMAP_MPUIO_GPIO_MASKIT,
 	.irqenable_inv	= true,
+	.ctrl		= USHRT_MAX,
 };
 
 static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = {
@@ -89,6 +90,7 @@ static struct omap_gpio_reg_offs omap16xx_gpio_regs = {
 	.irqenable	= OMAP1610_GPIO_IRQENABLE1,
 	.set_irqenable	= OMAP1610_GPIO_SET_IRQENABLE1,
 	.clr_irqenable	= OMAP1610_GPIO_CLEAR_IRQENABLE1,
+	.ctrl		= USHRT_MAX,
 };
 
 static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = {
diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c
index d7f2ad3..0fc2557 100644
--- a/arch/arm/mach-omap1/gpio7xx.c
+++ b/arch/arm/mach-omap1/gpio7xx.c
@@ -47,6 +47,7 @@ static struct omap_gpio_reg_offs omap7xx_mpuio_regs = {
 	.irqstatus	= OMAP_MPUIO_GPIO_INT / 2,
 	.irqenable	= OMAP_MPUIO_GPIO_MASKIT / 2,
 	.irqenable_inv	= true,
+	.ctrl		= USHRT_MAX,
 };
 
 static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = {
@@ -88,6 +89,7 @@ static struct omap_gpio_reg_offs omap7xx_gpio_regs = {
 	.irqstatus	= OMAP7XX_GPIO_INT_STATUS,
 	.irqenable	= OMAP7XX_GPIO_INT_MASK,
 	.irqenable_inv	= true,
+	.ctrl		= USHRT_MAX,
 };
 
 static struct __initdata omap_gpio_platform_data omap7xx_gpio1_config = {
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
index 9a46d77..0446bd1 100644
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -84,6 +84,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 		pdata->regs->clr_irqenable = OMAP24XX_GPIO_CLEARIRQENABLE1;
 		pdata->regs->debounce = OMAP24XX_GPIO_DEBOUNCE_VAL;
 		pdata->regs->debounce_en = OMAP24XX_GPIO_DEBOUNCE_EN;
+		pdata->regs->ctrl = OMAP24XX_GPIO_CTRL;
 		break;
 	case 2:
 		pdata->bank_type = METHOD_GPIO_44XX;
@@ -100,6 +101,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 		pdata->regs->clr_irqenable = OMAP4_GPIO_IRQSTATUSCLR0;
 		pdata->regs->debounce = OMAP4_GPIO_DEBOUNCINGTIME;
 		pdata->regs->debounce_en = OMAP4_GPIO_DEBOUNCENABLE;
+		pdata->regs->ctrl = OMAP4_GPIO_CTRL;
 		break;
 	default:
 		WARN(1, "Invalid gpio bank_type\n");
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 16980bb..65f9cbc 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -91,6 +91,7 @@ int gpio_bank_count;
 
 #define GPIO_INDEX(bank, gpio) (gpio % bank->width)
 #define GPIO_BIT(bank, gpio) (1 << GPIO_INDEX(bank, gpio))
+#define GPIO_MOD_CTRL_BIT	BIT(0)
 
 static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input)
 {
@@ -588,22 +589,18 @@ static int omap_gpio_request(struct gpio_chip *chip, unsigned offset)
 		__raw_writel(__raw_readl(reg) | (1 << offset), reg);
 	}
 #endif
-	if (!cpu_class_is_omap1()) {
-		if (!bank->mod_usage) {
-			void __iomem *reg = bank->base;
-			u32 ctrl;
-
-			if (cpu_is_omap24xx() || cpu_is_omap34xx())
-				reg += OMAP24XX_GPIO_CTRL;
-			else if (cpu_is_omap44xx())
-				reg += OMAP4_GPIO_CTRL;
-			ctrl = __raw_readl(reg);
-			/* Module is enabled, clocks are not gated */
-			ctrl &= 0xFFFFFFFE;
-			__raw_writel(ctrl, reg);
-		}
-		bank->mod_usage |= 1 << offset;
+	if ((bank->regs->ctrl != USHRT_MAX) && (!bank->mod_usage)) {
+		void __iomem *reg = bank->base + bank->regs->ctrl;
+		u32 ctrl;
+
+		ctrl = __raw_readl(reg);
+		/* Module is enabled, clocks are not gated */
+		ctrl &= ~GPIO_MOD_CTRL_BIT;
+		__raw_writel(ctrl, reg);
 	}
+
+	bank->mod_usage |= 1 << offset;
+
 	spin_unlock_irqrestore(&bank->lock, flags);
 
 	return 0;
@@ -636,22 +633,18 @@ static void omap_gpio_free(struct gpio_chip *chip, unsigned offset)
 		__raw_writel(1 << offset, reg);
 	}
 #endif
-	if (!cpu_class_is_omap1()) {
-		bank->mod_usage &= ~(1 << offset);
-		if (!bank->mod_usage) {
-			void __iomem *reg = bank->base;
-			u32 ctrl;
-
-			if (cpu_is_omap24xx() || cpu_is_omap34xx())
-				reg += OMAP24XX_GPIO_CTRL;
-			else if (cpu_is_omap44xx())
-				reg += OMAP4_GPIO_CTRL;
-			ctrl = __raw_readl(reg);
-			/* Module is disabled, clocks are gated */
-			ctrl |= 1;
-			__raw_writel(ctrl, reg);
-		}
+	bank->mod_usage &= ~(1 << offset);
+
+	if ((bank->regs->ctrl != USHRT_MAX) && (!bank->mod_usage)) {
+		void __iomem *reg = bank->base + bank->regs->ctrl;
+		u32 ctrl;
+
+		ctrl = __raw_readl(reg);
+		/* Module is disabled, clocks are gated */
+		ctrl |= GPIO_MOD_CTRL_BIT;
+		__raw_writel(ctrl, reg);
 	}
+
 	_reset_gpio(bank, bank->chip.base + offset);
 	spin_unlock_irqrestore(&bank->lock, flags);
 }
diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h
index 91e8de3..caf432c 100644
--- a/arch/arm/plat-omap/include/plat/gpio.h
+++ b/arch/arm/plat-omap/include/plat/gpio.h
@@ -188,6 +188,7 @@ struct omap_gpio_reg_offs {
 	u16 clr_irqenable;
 	u16 debounce;
 	u16 debounce_en;
+	u16 ctrl;
 
 	bool irqenable_inv;
 };
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [RFC PATCH 02/10] ZOOM: QUART: Request reset GPIO
  2011-05-16 11:41 [RFC PATCH 00/10] OMAP: GPIO: cleanup GPIO driver Tarun Kanti DebBarma
  2011-05-16 11:41 ` [RFC PATCH 01/10] OMAP: GPIO: Avoid cpu_is checks during module ena/disable Tarun Kanti DebBarma
@ 2011-05-16 11:41 ` Tarun Kanti DebBarma
  2011-05-19 16:11   ` Kevin Hilman
  2011-05-16 11:41 ` [RFC PATCH 03/10] OMAP2PLUS: GPIO: Fix non-wakeup GPIO and rev_ids Tarun Kanti DebBarma
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 26+ messages in thread
From: Tarun Kanti DebBarma @ 2011-05-16 11:41 UTC (permalink / raw)
  To: linux-omap; +Cc: Charulatha V, Santosh Shilimkar, Kevin Hilman, Tony Lindgren

From: Charulatha V <charu@ti.com>

Reset GPIO (OMAP_GPIO_152) for QUART in zoom2/zoom3 debug-board is
not requested at all. This would lead to problems if this GPIO is
wrongly requested. Hence request OMAP GPIO 152 for QUART RESET but
do not apply a reset pulse as it would reset QUART and
disturb the QUART settings.

Signed-off-by: Charulatha V <charu@ti.com>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/board-zoom-debugboard.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-zoom-debugboard.c b/arch/arm/mach-omap2/board-zoom-debugboard.c
index 007ebdc..a5f62f8 100644
--- a/arch/arm/mach-omap2/board-zoom-debugboard.c
+++ b/arch/arm/mach-omap2/board-zoom-debugboard.c
@@ -22,6 +22,7 @@
 #define ZOOM_SMSC911X_GPIO	158
 #define ZOOM_QUADUART_CS	3
 #define ZOOM_QUADUART_GPIO	102
+#define ZOOM_QUADUART_RST_GPIO	152
 #define QUART_CLK		1843200
 #define DEBUG_BASE		0x08000000
 #define ZOOM_ETHR_START	DEBUG_BASE
@@ -110,6 +111,14 @@ static inline void __init zoom_init_quaduart(void)
 	unsigned long cs_mem_base;
 	int quart_gpio = 0;
 
+	if (gpio_request_one(ZOOM_QUADUART_RST_GPIO,
+				GPIOF_OUT_INIT_LOW,
+				"TL16CP754C GPIO") < 0) {
+		pr_err("Failed to request GPIO%d for TL16CP754C\n",
+			ZOOM_QUADUART_RST_GPIO);
+		return;
+	}
+
 	quart_cs = ZOOM_QUADUART_CS;
 
 	if (gpmc_cs_request(quart_cs, SZ_1M, &cs_mem_base) < 0) {
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [RFC PATCH 03/10] OMAP2PLUS: GPIO: Fix non-wakeup GPIO and rev_ids
  2011-05-16 11:41 [RFC PATCH 00/10] OMAP: GPIO: cleanup GPIO driver Tarun Kanti DebBarma
  2011-05-16 11:41 ` [RFC PATCH 01/10] OMAP: GPIO: Avoid cpu_is checks during module ena/disable Tarun Kanti DebBarma
  2011-05-16 11:41 ` [RFC PATCH 02/10] ZOOM: QUART: Request reset GPIO Tarun Kanti DebBarma
@ 2011-05-16 11:41 ` Tarun Kanti DebBarma
  2011-05-16 11:41 ` [RFC PATCH 04/10] OMAP: GPIO: Remove dependency on gpio_bank_count Tarun Kanti DebBarma
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 26+ messages in thread
From: Tarun Kanti DebBarma @ 2011-05-16 11:41 UTC (permalink / raw)
  To: linux-omap; +Cc: Charulatha V, Santosh Shilimkar, Kevin Hilman, Tony Lindgren

From: Charulatha V <charu@ti.com>

Non-wakeup GPIOs are available only in OMAP2420 and OMAP3430. But
the GPIO driver initializes the non-wakeup GPIO bits for OMAP24xx
(bothe OMAP 2420 and 2430) & not for OMAP3 which is incorrect.

Fix the above by providing non-wakeup GPIO information through pdata
specific to the SoC.

The GPIO rev id provided in the hwmod database is the same for OMAP2420
and OMAP2430. Change the GPIO rev ids in hwmod database as given below
so that it can be used to identify OMAP2420 and OMAP2430.
OMAP2420 - 0
OMAP2430 - 1
OMAP3    - 2
OMAP4    - 3

Signed-off-by: Charulatha V <charu@ti.com>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/gpio.c                 |   26 ++++++++++++++++++++++++--
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |    2 +-
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |    2 +-
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |    2 +-
 arch/arm/plat-omap/gpio.c                  |   11 +++--------
 arch/arm/plat-omap/include/plat/gpio.h     |    1 +
 6 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
index 0446bd1..6cd26b4 100644
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -56,6 +56,28 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 		return -ENOMEM;
 	}
 
+	switch (oh->class->rev) {
+	case 0:
+		if (id == 1)
+			/* non-wakeup GPIO pins for OMAP2420 Bank1 */
+			pdata->non_wakeup_gpios = 0xe203ffc0;
+		else if (id == 2)
+			/* non-wakeup GPIO pins for OMAP2420 Bank2 */
+			pdata->non_wakeup_gpios = 0x08700040;
+		break;
+	case 2:
+		if (id == 2)
+			/* non-wakeup GPIO pins for OMAP3 Bank2 */
+			pdata->non_wakeup_gpios = 0x00000001;
+		else if (id == 6)
+			/* non-wakeup GPIO pins for OMAP3 Bank6 */
+			pdata->non_wakeup_gpios = 0x08000000;
+		break;
+	default:
+		/* No non-wakeup GPIO pins for other SoCs */
+		break;
+	}
+
 	dev_attr = (struct omap_gpio_dev_attr *)oh->dev_attr;
 	pdata->bank_width = dev_attr->bank_width;
 	pdata->dbck_flag = dev_attr->dbck_flag;
@@ -70,6 +92,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 	switch (oh->class->rev) {
 	case 0:
 	case 1:
+	case 2:
 		pdata->bank_type = METHOD_GPIO_24XX;
 		pdata->regs->revision = OMAP24XX_GPIO_REVISION;
 		pdata->regs->direction = OMAP24XX_GPIO_OE;
@@ -86,7 +109,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 		pdata->regs->debounce_en = OMAP24XX_GPIO_DEBOUNCE_EN;
 		pdata->regs->ctrl = OMAP24XX_GPIO_CTRL;
 		break;
-	case 2:
+	case 3:
 		pdata->bank_type = METHOD_GPIO_44XX;
 		pdata->regs->revision = OMAP4_GPIO_REVISION;
 		pdata->regs->direction = OMAP4_GPIO_OE;
@@ -108,7 +131,6 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 		kfree(pdata);
 		return -EINVAL;
 	}
-
 	od = omap_device_build(name, id - 1, oh, pdata,
 				sizeof(*pdata),	omap_gpio_latency,
 				ARRAY_SIZE(omap_gpio_latency),
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index e6e3810..dc819aa 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -1728,7 +1728,7 @@ static struct omap_hwmod_class_sysconfig omap243x_gpio_sysc = {
 static struct omap_hwmod_class omap243x_gpio_hwmod_class = {
 	.name = "gpio",
 	.sysc = &omap243x_gpio_sysc,
-	.rev = 0,
+	.rev = 1,
 };
 
 /* gpio1 */
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index b98e2df..010e3c4 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -2117,7 +2117,7 @@ static struct omap_hwmod_class_sysconfig omap3xxx_gpio_sysc = {
 static struct omap_hwmod_class omap3xxx_gpio_hwmod_class = {
 	.name = "gpio",
 	.sysc = &omap3xxx_gpio_sysc,
-	.rev = 1,
+	.rev = 2,
 };
 
 /* gpio_dev_attr*/
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 3e88dd3..df8e629 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -1703,7 +1703,7 @@ static struct omap_hwmod_class_sysconfig omap44xx_gpio_sysc = {
 static struct omap_hwmod_class omap44xx_gpio_hwmod_class = {
 	.name	= "gpio",
 	.sysc	= &omap44xx_gpio_sysc,
-	.rev	= 2,
+	.rev	= 3,
 };
 
 /* gpio dev_attr */
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 65f9cbc..12deb1c 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -1010,7 +1010,7 @@ static inline int init_gpio_info(struct platform_device *pdev)
 }
 
 /* TODO: Cleanup cpu_is_* checks */
-static void omap_gpio_mod_init(struct gpio_bank *bank, int id)
+static void omap_gpio_mod_init(struct gpio_bank *bank)
 {
 	if (cpu_class_is_omap2()) {
 		if (cpu_is_omap44xx()) {
@@ -1030,12 +1030,6 @@ static void omap_gpio_mod_init(struct gpio_bank *bank, int id)
 
 			/* Initialize interface clk ungated, module enabled */
 			__raw_writel(0, bank->base + OMAP24XX_GPIO_CTRL);
-		} else if (cpu_is_omap24xx()) {
-			static const u32 non_wakeup_gpios[] = {
-				0xe203ffc0, 0x08700040
-			};
-			if (id < ARRAY_SIZE(non_wakeup_gpios))
-				bank->non_wakeup_gpios = non_wakeup_gpios[id];
 		}
 	} else if (cpu_class_is_omap1()) {
 		if (bank_is_mpuio(bank))
@@ -1181,6 +1175,7 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)
 	bank->dbck_flag = pdata->dbck_flag;
 	bank->stride = pdata->bank_stride;
 	bank->width = pdata->bank_width;
+	bank->non_wakeup_gpios = pdata->non_wakeup_gpios;
 
 	bank->regs = pdata->regs;
 
@@ -1207,7 +1202,7 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)
 	pm_runtime_enable(bank->dev);
 	pm_runtime_get_sync(bank->dev);
 
-	omap_gpio_mod_init(bank, id);
+	omap_gpio_mod_init(bank);
 	omap_gpio_chip_init(bank);
 	omap_gpio_show_rev(bank);
 
diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h
index caf432c..8014a8a 100644
--- a/arch/arm/plat-omap/include/plat/gpio.h
+++ b/arch/arm/plat-omap/include/plat/gpio.h
@@ -199,6 +199,7 @@ 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 */
+	u32 non_wakeup_gpios;
 
 	struct omap_gpio_reg_offs *regs;
 };
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [RFC PATCH 04/10] OMAP: GPIO: Remove dependency on gpio_bank_count
  2011-05-16 11:41 [RFC PATCH 00/10] OMAP: GPIO: cleanup GPIO driver Tarun Kanti DebBarma
                   ` (2 preceding siblings ...)
  2011-05-16 11:41 ` [RFC PATCH 03/10] OMAP2PLUS: GPIO: Fix non-wakeup GPIO and rev_ids Tarun Kanti DebBarma
@ 2011-05-16 11:41 ` Tarun Kanti DebBarma
  2011-05-19 15:42   ` Kevin Hilman
  2011-05-19 16:39   ` Kevin Hilman
  2011-05-16 11:41 ` [RFC PATCH 05/10] OMAP2PLUS: GPIO: Use flag to identify wkup dmn GPIO Tarun Kanti DebBarma
                   ` (5 subsequent siblings)
  9 siblings, 2 replies; 26+ messages in thread
From: Tarun Kanti DebBarma @ 2011-05-16 11:41 UTC (permalink / raw)
  To: linux-omap; +Cc: Charulatha V, Santosh Shilimkar, Kevin Hilman, Tony Lindgren

From: Charulatha V <charu@ti.com>

gpio_bank_count is the count of number of GPIO devices
in a SoC. Remove this dependency from the driver. Also remove
the dependency on array of pointers to gpio_bank struct of
all GPIO devices.

The cpu_is*() checks used in omap2_gpio_prepare_for_idle() and
omap2_gpio_resume_after_idle() would be removed in one of the
patches in this series

Signed-off-by: Charulatha V <charu@ti.com>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap1/gpio15xx.c         |    1 -
 arch/arm/mach-omap1/gpio16xx.c         |    2 -
 arch/arm/mach-omap1/gpio7xx.c          |    2 -
 arch/arm/mach-omap2/gpio.c             |    1 -
 arch/arm/plat-omap/gpio.c              |  157 ++++++++++++++++---------------
 arch/arm/plat-omap/include/plat/gpio.h |    3 -
 6 files changed, 81 insertions(+), 85 deletions(-)

diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c
index c3caf25..7a15f69 100644
--- a/arch/arm/mach-omap1/gpio15xx.c
+++ b/arch/arm/mach-omap1/gpio15xx.c
@@ -117,7 +117,6 @@ static int __init omap15xx_gpio_init(void)
 	platform_device_register(&omap15xx_mpu_gpio);
 	platform_device_register(&omap15xx_gpio);
 
-	gpio_bank_count = 2;
 	return 0;
 }
 postcore_initcall(omap15xx_gpio_init);
diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c
index f62eaf3..43718ec 100644
--- a/arch/arm/mach-omap1/gpio16xx.c
+++ b/arch/arm/mach-omap1/gpio16xx.c
@@ -223,8 +223,6 @@ static int __init omap16xx_gpio_init(void)
 	for (i = 0; i < ARRAY_SIZE(omap16xx_gpio_dev); i++)
 		platform_device_register(omap16xx_gpio_dev[i]);
 
-	gpio_bank_count = ARRAY_SIZE(omap16xx_gpio_dev);
-
 	return 0;
 }
 postcore_initcall(omap16xx_gpio_init);
diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c
index 0fc2557..c7684ce 100644
--- a/arch/arm/mach-omap1/gpio7xx.c
+++ b/arch/arm/mach-omap1/gpio7xx.c
@@ -284,8 +284,6 @@ static int __init omap7xx_gpio_init(void)
 	for (i = 0; i < ARRAY_SIZE(omap7xx_gpio_dev); i++)
 		platform_device_register(omap7xx_gpio_dev[i]);
 
-	gpio_bank_count = ARRAY_SIZE(omap7xx_gpio_dev);
-
 	return 0;
 }
 postcore_initcall(omap7xx_gpio_init);
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
index 6cd26b4..487b49a 100644
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -143,7 +143,6 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 		return PTR_ERR(od);
 	}
 
-	gpio_bank_count++;
 	return 0;
 }
 
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 12deb1c..0b76475 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -30,7 +30,10 @@
 #include <mach/gpio.h>
 #include <asm/mach/irq.h>
 
+static LIST_HEAD(omap_gpio_list);
+
 struct gpio_bank {
+	struct list_head node;
 	unsigned long pbase;
 	void __iomem *base;
 	u16 irq;
@@ -57,6 +60,7 @@ struct gpio_bank {
 	bool dbck_flag;
 	int stride;
 	u32 width;
+	u16 id;
 
 	void (*set_dataout)(struct gpio_bank *bank, int gpio, int enable);
 
@@ -80,15 +84,6 @@ struct omap3_gpio_regs {
 static struct omap3_gpio_regs gpio_context[OMAP34XX_NR_GPIOS];
 #endif
 
-/*
- * TODO: Cleanup gpio_bank usage as it is having information
- * related to all instances of the device
- */
-static struct gpio_bank *gpio_bank;
-
-/* TODO: Analyze removing gpio_bank_count usage from driver code */
-int gpio_bank_count;
-
 #define GPIO_INDEX(bank, gpio) (gpio % bank->width)
 #define GPIO_BIT(bank, gpio) (1 << GPIO_INDEX(bank, gpio))
 #define GPIO_MOD_CTRL_BIT	BIT(0)
@@ -859,23 +854,29 @@ static struct platform_device omap_mpuio_device = {
 	/* could list the /proc/iomem resources */
 };
 
-static inline void mpuio_init(void)
+static inline void mpuio_init(struct gpio_bank *bank)
 {
-	struct gpio_bank *bank = &gpio_bank[0];
+	static int mpuio_init_done;
+
+	if (mpuio_init_done || (bank->method != METHOD_MPUIO))
+		return;
+
 	platform_set_drvdata(&omap_mpuio_device, bank);
 
 	if (platform_driver_register(&omap_mpuio_driver) == 0)
 		(void) platform_device_register(&omap_mpuio_device);
+
+	mpuio_init_done = 1;
 }
 
 #else
-static inline void mpuio_init(void) {}
+static inline void mpuio_init(struct gpio_bank *bank) {}
 #endif	/* 16xx */
 
 #else
 
 #define bank_is_mpuio(bank)	0
-static inline void mpuio_init(void) {}
+static inline void mpuio_init(struct gpio_bank *bank) {}
 
 #endif
 
@@ -997,18 +998,6 @@ static void __init omap_gpio_show_rev(struct gpio_bank *bank)
  */
 static struct lock_class_key gpio_lock_class;
 
-static inline int init_gpio_info(struct platform_device *pdev)
-{
-	/* TODO: Analyze removing gpio_bank_count usage from driver code */
-	gpio_bank = kzalloc(gpio_bank_count * sizeof(struct gpio_bank),
-				GFP_KERNEL);
-	if (!gpio_bank) {
-		dev_err(&pdev->dev, "Memory alloc failed for gpio_bank\n");
-		return -ENOMEM;
-	}
-	return 0;
-}
-
 /* TODO: Cleanup cpu_is_* checks */
 static void omap_gpio_mod_init(struct gpio_bank *bank)
 {
@@ -1140,36 +1129,37 @@ static void __init omap_gpio_chip_init(struct gpio_bank *bank)
 
 static int __devinit omap_gpio_probe(struct platform_device *pdev)
 {
-	static int gpio_init_done;
 	struct omap_gpio_platform_data *pdata;
 	struct resource *res;
-	int id;
 	struct gpio_bank *bank;
+	int ret = 0;
 
-	if (!pdev->dev.platform_data)
-		return -EINVAL;
-
-	pdata = pdev->dev.platform_data;
-
-	if (!gpio_init_done) {
-		int ret;
-
-		ret = init_gpio_info(pdev);
-		if (ret)
-			return ret;
+	if (!pdev->dev.platform_data) {
+		ret = -EINVAL;
+		goto err_exit;
 	}
 
-	id = pdev->id;
-	bank = &gpio_bank[id];
+	bank = kzalloc(sizeof(struct gpio_bank), GFP_KERNEL);
+	if (!bank) {
+		dev_err(&pdev->dev, "Memory alloc failed for gpio_bank\n");
+		ret = -ENOMEM;
+		goto err_exit;
+	}
 
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (unlikely(!res)) {
-		dev_err(&pdev->dev, "GPIO Bank %i Invalid IRQ resource\n", id);
-		return -ENODEV;
+		dev_err(&pdev->dev, "GPIO Bank %i Invalid IRQ resource\n",
+				pdev->id);
+		ret = -ENODEV;
+		goto err_free;
 	}
 
 	bank->irq = res->start;
+	bank->id = pdev->id;
+
+	pdata = pdev->dev.platform_data;
 	bank->virtual_irq_start = pdata->virtual_irq_start;
+
 	bank->method = pdata->bank_type;
 	bank->dev = &pdev->dev;
 	bank->dbck_flag = pdata->dbck_flag;
@@ -1189,39 +1179,47 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)
 	/* Static mapping, never released */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (unlikely(!res)) {
-		dev_err(&pdev->dev, "GPIO Bank %i Invalid mem resource\n", id);
-		return -ENODEV;
+		dev_err(&pdev->dev, "GPIO Bank %i Invalid mem resource\n",
+				pdev->id);
+		ret = -ENODEV;
+		goto err_free;
 	}
 
 	bank->base = ioremap(res->start, resource_size(res));
 	if (!bank->base) {
-		dev_err(&pdev->dev, "Could not ioremap gpio bank%i\n", id);
-		return -ENOMEM;
+		dev_err(&pdev->dev, "Could not ioremap gpio bank%i\n",
+				pdev->id);
+		ret = -ENOMEM;
+		goto err_free;
 	}
 
 	pm_runtime_enable(bank->dev);
 	pm_runtime_get_sync(bank->dev);
 
+	mpuio_init(bank);
 	omap_gpio_mod_init(bank);
 	omap_gpio_chip_init(bank);
 	omap_gpio_show_rev(bank);
 
-	if (!gpio_init_done)
-		gpio_init_done = 1;
+	list_add_tail(&bank->node, &omap_gpio_list);
 
-	return 0;
+	return ret;
+
+err_free:
+	kfree(bank);
+err_exit:
+	return ret;
 }
 
 #if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2PLUS)
 static int omap_gpio_suspend(struct sys_device *dev, pm_message_t mesg)
 {
-	int i;
+	struct gpio_bank *bank;
 
 	if (!cpu_class_is_omap2() && !cpu_is_omap16xx())
 		return 0;
 
-	for (i = 0; i < gpio_bank_count; i++) {
-		struct gpio_bank *bank = &gpio_bank[i];
+	list_for_each_entry(bank, &omap_gpio_list, node) {
 		void __iomem *wake_status;
 		void __iomem *wake_clear;
 		void __iomem *wake_set;
@@ -1265,13 +1263,12 @@ static int omap_gpio_suspend(struct sys_device *dev, pm_message_t mesg)
 
 static int omap_gpio_resume(struct sys_device *dev)
 {
-	int i;
+	struct gpio_bank *bank;
 
 	if (!cpu_class_is_omap2() && !cpu_is_omap16xx())
 		return 0;
 
-	for (i = 0; i < gpio_bank_count; i++) {
-		struct gpio_bank *bank = &gpio_bank[i];
+	list_for_each_entry(bank, &omap_gpio_list, node) {
 		void __iomem *wake_clear;
 		void __iomem *wake_set;
 		unsigned long flags;
@@ -1327,17 +1324,17 @@ static int workaround_enabled;
 
 void omap2_gpio_prepare_for_idle(int off_mode)
 {
-	int i, c = 0;
-	int min = 0;
-
-	if (cpu_is_omap34xx())
-		min = 1;
+	int c = 0;
+	struct gpio_bank *bank;
 
-	for (i = min; i < gpio_bank_count; i++) {
-		struct gpio_bank *bank = &gpio_bank[i];
+	list_for_each_entry(bank, &omap_gpio_list, node) {
 		u32 l1 = 0, l2 = 0;
 		int j;
 
+		/* TODO: Do not use cpu_is_omap34xx */
+		if ((cpu_is_omap34xx()) && (bank->id == 0))
+			continue;
+
 		for (j = 0; j < hweight_long(bank->dbck_enable_mask); j++)
 			clk_disable(bank->dbck);
 
@@ -1396,16 +1393,16 @@ void omap2_gpio_prepare_for_idle(int off_mode)
 
 void omap2_gpio_resume_after_idle(void)
 {
-	int i;
-	int min = 0;
+	struct gpio_bank *bank;
 
-	if (cpu_is_omap34xx())
-		min = 1;
-	for (i = min; i < gpio_bank_count; i++) {
-		struct gpio_bank *bank = &gpio_bank[i];
+	list_for_each_entry(bank, &omap_gpio_list, node) {
 		u32 l = 0, gen, gen0, gen1;
 		int j;
 
+		/* TODO: Do not use cpu_is_omap34xx */
+		if ((cpu_is_omap34xx()) && (bank->id == 0))
+			continue;
+
 		for (j = 0; j < hweight_long(bank->dbck_enable_mask); j++)
 			clk_enable(bank->dbck);
 
@@ -1497,11 +1494,16 @@ void omap2_gpio_resume_after_idle(void)
 /* save the registers of bank 2-6 */
 void omap_gpio_save_context(void)
 {
-	int i;
+	struct gpio_bank *bank;
+	int i = 0;
 
 	/* saving banks from 2-6 only since GPIO1 is in WKUP */
-	for (i = 1; i < gpio_bank_count; i++) {
-		struct gpio_bank *bank = &gpio_bank[i];
+	list_for_each_entry(bank, &omap_gpio_list, node) {
+		i++;
+
+		if (bank->id == 0)
+			continue;
+
 		gpio_context[i].irqenable1 =
 			__raw_readl(bank->base + OMAP24XX_GPIO_IRQENABLE1);
 		gpio_context[i].irqenable2 =
@@ -1528,10 +1530,15 @@ void omap_gpio_save_context(void)
 /* restore the required registers of bank 2-6 */
 void omap_gpio_restore_context(void)
 {
-	int i;
+	struct gpio_bank *bank;
+	int i = 0;
+
+	list_for_each_entry(bank, &omap_gpio_list, node) {
+		i++;
+
+		if (bank->id == 0)
+			continue;
 
-	for (i = 1; i < gpio_bank_count; i++) {
-		struct gpio_bank *bank = &gpio_bank[i];
 		__raw_writel(gpio_context[i].irqenable1,
 				bank->base + OMAP24XX_GPIO_IRQENABLE1);
 		__raw_writel(gpio_context[i].irqenable2,
@@ -1578,8 +1585,6 @@ static int __init omap_gpio_sysinit(void)
 {
 	int ret = 0;
 
-	mpuio_init();
-
 #if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2PLUS)
 	if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
 		if (ret == 0) {
diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h
index 8014a8a..ad9e668 100644
--- a/arch/arm/plat-omap/include/plat/gpio.h
+++ b/arch/arm/plat-omap/include/plat/gpio.h
@@ -204,9 +204,6 @@ struct omap_gpio_platform_data {
 	struct omap_gpio_reg_offs *regs;
 };
 
-/* TODO: Analyze removing gpio_bank_count usage from driver code */
-extern int gpio_bank_count;
-
 extern void omap2_gpio_prepare_for_idle(int off_mode);
 extern void omap2_gpio_resume_after_idle(void);
 extern void omap_set_gpio_debounce(int gpio, int enable);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [RFC PATCH 05/10] OMAP2PLUS: GPIO: Use flag to identify wkup dmn GPIO
  2011-05-16 11:41 [RFC PATCH 00/10] OMAP: GPIO: cleanup GPIO driver Tarun Kanti DebBarma
                   ` (3 preceding siblings ...)
  2011-05-16 11:41 ` [RFC PATCH 04/10] OMAP: GPIO: Remove dependency on gpio_bank_count Tarun Kanti DebBarma
@ 2011-05-16 11:41 ` Tarun Kanti DebBarma
  2011-05-19 16:34   ` Kevin Hilman
  2011-05-16 11:41 ` [RFC PATCH 06/10] OMAP: GPIO: Use USHRT_MAX for rev offset instead of -1 Tarun Kanti DebBarma
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 26+ messages in thread
From: Tarun Kanti DebBarma @ 2011-05-16 11:41 UTC (permalink / raw)
  To: linux-omap; +Cc: Charulatha V, Santosh Shilimkar, Kevin Hilman, Tony Lindgren

From: Charulatha V <charu@ti.com>

In omap3, save/restore context is implemented for GPIO
banks 2-6 as GPIO bank1 is in wakeup domain. Instead
of identifying bank's power domain by bank id, make use
of a flag "loses_context" which is filled by
pwrdm_can_ever_lose_context() during dev_init.

For getting the powerdomain pointer, omap_hwmod_get_pwrdm()
is used. omap_device_get_pwrdm() could not be used as the
pwrdm information needs to be filled in pdata, whereas
omap_device_get_pwrdm() could be used only after
omap_device_build() call.

Signed-off-by: Charulatha V <charu@ti.com>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/gpio.c             |    7 +++++++
 arch/arm/plat-omap/gpio.c              |   12 ++++++------
 arch/arm/plat-omap/include/plat/gpio.h |    1 +
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
index 487b49a..0782e06 100644
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -24,6 +24,8 @@
 #include <plat/omap_hwmod.h>
 #include <plat/omap_device.h>
 
+#include "powerdomain.h"
+
 static struct omap_device_pm_latency omap_gpio_latency[] = {
 	[0] = {
 		.deactivate_func = omap_device_idle_hwmods,
@@ -39,6 +41,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 	struct omap_gpio_dev_attr *dev_attr;
 	char *name = "omap_gpio";
 	int id;
+	struct powerdomain *pwrdm;
 
 	/*
 	 * extract the device id from name field available in the
@@ -131,6 +134,10 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 		kfree(pdata);
 		return -EINVAL;
 	}
+
+	pwrdm = omap_hwmod_get_pwrdm(oh);
+	pdata->loses_context = pwrdm_can_ever_lose_context(pwrdm);
+
 	od = omap_device_build(name, id - 1, oh, pdata,
 				sizeof(*pdata),	omap_gpio_latency,
 				ARRAY_SIZE(omap_gpio_latency),
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 0b76475..0ebeaaa 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -58,6 +58,7 @@ struct gpio_bank {
 	u32 dbck_enable_mask;
 	struct device *dev;
 	bool dbck_flag;
+	bool loses_context;
 	int stride;
 	u32 width;
 	u16 id;
@@ -1166,6 +1167,7 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)
 	bank->stride = pdata->bank_stride;
 	bank->width = pdata->bank_width;
 	bank->non_wakeup_gpios = pdata->non_wakeup_gpios;
+	bank->loses_context = pdata->loses_context;
 
 	bank->regs = pdata->regs;
 
@@ -1331,8 +1333,7 @@ void omap2_gpio_prepare_for_idle(int off_mode)
 		u32 l1 = 0, l2 = 0;
 		int j;
 
-		/* TODO: Do not use cpu_is_omap34xx */
-		if ((cpu_is_omap34xx()) && (bank->id == 0))
+		if (!bank->loses_context)
 			continue;
 
 		for (j = 0; j < hweight_long(bank->dbck_enable_mask); j++)
@@ -1399,8 +1400,7 @@ void omap2_gpio_resume_after_idle(void)
 		u32 l = 0, gen, gen0, gen1;
 		int j;
 
-		/* TODO: Do not use cpu_is_omap34xx */
-		if ((cpu_is_omap34xx()) && (bank->id == 0))
+		if (!bank->loses_context)
 			continue;
 
 		for (j = 0; j < hweight_long(bank->dbck_enable_mask); j++)
@@ -1501,7 +1501,7 @@ void omap_gpio_save_context(void)
 	list_for_each_entry(bank, &omap_gpio_list, node) {
 		i++;
 
-		if (bank->id == 0)
+		if (!bank->loses_context)
 			continue;
 
 		gpio_context[i].irqenable1 =
@@ -1536,7 +1536,7 @@ void omap_gpio_restore_context(void)
 	list_for_each_entry(bank, &omap_gpio_list, node) {
 		i++;
 
-		if (bank->id == 0)
+		if (!bank->loses_context)
 			continue;
 
 		__raw_writel(gpio_context[i].irqenable1,
diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h
index ad9e668..64b1ee7 100644
--- a/arch/arm/plat-omap/include/plat/gpio.h
+++ b/arch/arm/plat-omap/include/plat/gpio.h
@@ -199,6 +199,7 @@ 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 */
+	bool loses_context;	/* whether the bank would ever lose context */
 	u32 non_wakeup_gpios;
 
 	struct omap_gpio_reg_offs *regs;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [RFC PATCH 06/10] OMAP: GPIO: Use USHRT_MAX for rev offset instead of -1
  2011-05-16 11:41 [RFC PATCH 00/10] OMAP: GPIO: cleanup GPIO driver Tarun Kanti DebBarma
                   ` (4 preceding siblings ...)
  2011-05-16 11:41 ` [RFC PATCH 05/10] OMAP2PLUS: GPIO: Use flag to identify wkup dmn GPIO Tarun Kanti DebBarma
@ 2011-05-16 11:41 ` Tarun Kanti DebBarma
  2011-05-19 15:59   ` Kevin Hilman
  2011-05-16 11:41 ` [RFC PATCH 07/10] OMAP: GPIO: cleanup suspend and resume functions Tarun Kanti DebBarma
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 26+ messages in thread
From: Tarun Kanti DebBarma @ 2011-05-16 11:41 UTC (permalink / raw)
  To: linux-omap; +Cc: Charulatha V, Santosh Shilimkar, Kevin Hilman, Tony Lindgren

From: Charulatha V <charu@ti.com>

Use USHRT_MAX for revision offset instead of -1 if revision register
is not available for a given SoC since rev offset is a u16 value.

Signed-off-by: Charulatha V <charu@ti.com>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap1/gpio15xx.c |    2 +-
 arch/arm/mach-omap1/gpio16xx.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c
index 7a15f69..f18a4a9 100644
--- a/arch/arm/mach-omap1/gpio15xx.c
+++ b/arch/arm/mach-omap1/gpio15xx.c
@@ -77,7 +77,7 @@ static struct __initdata resource omap15xx_gpio_resources[] = {
 };
 
 static struct omap_gpio_reg_offs omap15xx_gpio_regs = {
-	.revision	= -1,
+	.revision	= USHRT_MAX,
 	.direction	= OMAP1510_GPIO_DIR_CONTROL,
 	.datain		= OMAP1510_GPIO_DATA_INPUT,
 	.dataout	= OMAP1510_GPIO_DATA_OUTPUT,
diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c
index 43718ec..d886b88 100644
--- a/arch/arm/mach-omap1/gpio16xx.c
+++ b/arch/arm/mach-omap1/gpio16xx.c
@@ -38,7 +38,7 @@ static struct __initdata resource omap16xx_mpu_gpio_resources[] = {
 };
 
 static struct omap_gpio_reg_offs omap16xx_mpuio_regs = {
-	.revision       = -1,
+	.revision       = USHRT_MAX,
 	.direction	= OMAP_MPUIO_IO_CNTL,
 	.datain		= OMAP_MPUIO_INPUT_LATCH,
 	.dataout	= OMAP_MPUIO_OUTPUT,
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [RFC PATCH 07/10] OMAP: GPIO: cleanup suspend and resume functions
  2011-05-16 11:41 [RFC PATCH 00/10] OMAP: GPIO: cleanup GPIO driver Tarun Kanti DebBarma
                   ` (5 preceding siblings ...)
  2011-05-16 11:41 ` [RFC PATCH 06/10] OMAP: GPIO: Use USHRT_MAX for rev offset instead of -1 Tarun Kanti DebBarma
@ 2011-05-16 11:41 ` Tarun Kanti DebBarma
  2011-05-19 16:08   ` Kevin Hilman
  2011-05-20  9:20   ` Varadarajan, Charulatha
  2011-05-16 11:41 ` [RFC PATCH 08/10] OMAP: GPIO: cleanup prepare-for and resume-after idle functions Tarun Kanti DebBarma
                   ` (2 subsequent siblings)
  9 siblings, 2 replies; 26+ messages in thread
From: Tarun Kanti DebBarma @ 2011-05-16 11:41 UTC (permalink / raw)
  To: linux-omap
  Cc: Tarun Kanti DebBarma, Charulatha V, Santosh Shilimkar,
	Kevin Hilman, Tony Lindgren

Since wake_status, wake_clear, wake_set is common for all banks on a given
OMAP version it is enough to get their values once during probe().
Also, register offsets are already initialzed according to OMAP versions
during device registration. We no longer need these explicit checks.

Signed-off-by: Tarun Kanti DebBarma <tarun.kanti@ti.com>
Cc: Charulatha V <charu@ti.com>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap1/gpio16xx.c         |    3 +
 arch/arm/mach-omap2/gpio.c             |    6 +++
 arch/arm/plat-omap/gpio.c              |   78 +++++++------------------------
 arch/arm/plat-omap/include/plat/gpio.h |    3 +
 4 files changed, 30 insertions(+), 60 deletions(-)

diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c
index d886b88..bc4cc8f 100644
--- a/arch/arm/mach-omap1/gpio16xx.c
+++ b/arch/arm/mach-omap1/gpio16xx.c
@@ -46,6 +46,9 @@ static struct omap_gpio_reg_offs omap16xx_mpuio_regs = {
 	.irqenable	= OMAP_MPUIO_GPIO_MASKIT,
 	.irqenable_inv	= true,
 	.ctrl		= USHRT_MAX,
+	.wkupstatus	= OMAP1610_GPIO_WAKEUPENABLE,
+	.wkupclear	= OMAP1610_GPIO_CLEAR_WAKEUPENA,
+	.wkupset	= OMAP1610_GPIO_SET_WAKEUPENA,
 };
 
 static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = {
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
index 0782e06..7e79999 100644
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -111,6 +111,9 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 		pdata->regs->debounce = OMAP24XX_GPIO_DEBOUNCE_VAL;
 		pdata->regs->debounce_en = OMAP24XX_GPIO_DEBOUNCE_EN;
 		pdata->regs->ctrl = OMAP24XX_GPIO_CTRL;
+		pdata->regs->wkupstatus = OMAP24XX_GPIO_WAKE_EN;
+		pdata->regs->wkupclear = OMAP24XX_GPIO_CLEARWKUENA;
+		pdata->regs->wkupset = OMAP24XX_GPIO_SETWKUENA;
 		break;
 	case 3:
 		pdata->bank_type = METHOD_GPIO_44XX;
@@ -128,6 +131,9 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 		pdata->regs->debounce = OMAP4_GPIO_DEBOUNCINGTIME;
 		pdata->regs->debounce_en = OMAP4_GPIO_DEBOUNCENABLE;
 		pdata->regs->ctrl = OMAP4_GPIO_CTRL;
+		pdata->regs->wkupstatus = OMAP4_GPIO_IRQWAKEN0;
+		pdata->regs->wkupclear = OMAP4_GPIO_IRQWAKEN0;
+		pdata->regs->wkupset = OMAP4_GPIO_IRQWAKEN0;
 		break;
 	default:
 		WARN(1, "Invalid gpio bank_type\n");
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 0ebeaaa..b04688d 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -62,6 +62,9 @@ struct gpio_bank {
 	int stride;
 	u32 width;
 	u16 id;
+	void __iomem *wake_status;
+	void __iomem *wake_clear;
+	void __iomem *wake_set;
 
 	void (*set_dataout)(struct gpio_bank *bank, int gpio, int enable);
 
@@ -1195,6 +1198,15 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)
 		goto err_free;
 	}
 
+	/*
+	 * Storing these addresses avoids redundant computation of these
+	 * values every time in suspend/resume functions and for all the
+	 * gpio banks.
+	 */
+	bank->wake_status = bank->base + bank->regs->wkupstatus;
+	bank->wake_clear = bank->base + bank->regs->wkupclear;
+	bank->wake_set = bank->base + bank->regs->wkupset;
+
 	pm_runtime_enable(bank->dev);
 	pm_runtime_get_sync(bank->dev);
 
@@ -1214,7 +1226,7 @@ err_exit:
 }
 
 #if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2PLUS)
-static int omap_gpio_suspend(struct sys_device *dev, pm_message_t mesg)
+static int omap_gpio_suspend(struct sys_device *dev, pm_message_t unused)
 {
 	struct gpio_bank *bank;
 
@@ -1222,41 +1234,12 @@ static int omap_gpio_suspend(struct sys_device *dev, pm_message_t mesg)
 		return 0;
 
 	list_for_each_entry(bank, &omap_gpio_list, node) {
-		void __iomem *wake_status;
-		void __iomem *wake_clear;
-		void __iomem *wake_set;
 		unsigned long flags;
 
-		switch (bank->method) {
-#ifdef CONFIG_ARCH_OMAP16XX
-		case METHOD_GPIO_1610:
-			wake_status = bank->base + OMAP1610_GPIO_WAKEUPENABLE;
-			wake_clear = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA;
-			wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA;
-			break;
-#endif
-#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
-		case METHOD_GPIO_24XX:
-			wake_status = bank->base + OMAP24XX_GPIO_WAKE_EN;
-			wake_clear = bank->base + OMAP24XX_GPIO_CLEARWKUENA;
-			wake_set = bank->base + OMAP24XX_GPIO_SETWKUENA;
-			break;
-#endif
-#ifdef CONFIG_ARCH_OMAP4
-		case METHOD_GPIO_44XX:
-			wake_status = bank->base + OMAP4_GPIO_IRQWAKEN0;
-			wake_clear = bank->base + OMAP4_GPIO_IRQWAKEN0;
-			wake_set = bank->base + OMAP4_GPIO_IRQWAKEN0;
-			break;
-#endif
-		default:
-			continue;
-		}
-
 		spin_lock_irqsave(&bank->lock, flags);
-		bank->saved_wakeup = __raw_readl(wake_status);
-		__raw_writel(0xffffffff, wake_clear);
-		__raw_writel(bank->suspend_wakeup, wake_set);
+		bank->saved_wakeup = __raw_readl(bank->wake_status);
+		__raw_writel(0xffffffff, bank->wake_clear);
+		__raw_writel(bank->suspend_wakeup, bank->wake_set);
 		spin_unlock_irqrestore(&bank->lock, flags);
 	}
 
@@ -1271,36 +1254,11 @@ static int omap_gpio_resume(struct sys_device *dev)
 		return 0;
 
 	list_for_each_entry(bank, &omap_gpio_list, node) {
-		void __iomem *wake_clear;
-		void __iomem *wake_set;
 		unsigned long flags;
 
-		switch (bank->method) {
-#ifdef CONFIG_ARCH_OMAP16XX
-		case METHOD_GPIO_1610:
-			wake_clear = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA;
-			wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA;
-			break;
-#endif
-#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
-		case METHOD_GPIO_24XX:
-			wake_clear = bank->base + OMAP24XX_GPIO_CLEARWKUENA;
-			wake_set = bank->base + OMAP24XX_GPIO_SETWKUENA;
-			break;
-#endif
-#ifdef CONFIG_ARCH_OMAP4
-		case METHOD_GPIO_44XX:
-			wake_clear = bank->base + OMAP4_GPIO_IRQWAKEN0;
-			wake_set = bank->base + OMAP4_GPIO_IRQWAKEN0;
-			break;
-#endif
-		default:
-			continue;
-		}
-
 		spin_lock_irqsave(&bank->lock, flags);
-		__raw_writel(0xffffffff, wake_clear);
-		__raw_writel(bank->saved_wakeup, wake_set);
+		__raw_writel(0xffffffff, bank->wake_clear);
+		__raw_writel(bank->saved_wakeup, bank->wake_set);
 		spin_unlock_irqrestore(&bank->lock, flags);
 	}
 
diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h
index 64b1ee7..81ba1f0 100644
--- a/arch/arm/plat-omap/include/plat/gpio.h
+++ b/arch/arm/plat-omap/include/plat/gpio.h
@@ -189,6 +189,9 @@ struct omap_gpio_reg_offs {
 	u16 debounce;
 	u16 debounce_en;
 	u16 ctrl;
+	u16 wkupstatus;
+	u16 wkupclear;
+	u16 wkupset;
 
 	bool irqenable_inv;
 };
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [RFC PATCH 08/10] OMAP: GPIO: cleanup prepare-for and resume-after idle functions
  2011-05-16 11:41 [RFC PATCH 00/10] OMAP: GPIO: cleanup GPIO driver Tarun Kanti DebBarma
                   ` (6 preceding siblings ...)
  2011-05-16 11:41 ` [RFC PATCH 07/10] OMAP: GPIO: cleanup suspend and resume functions Tarun Kanti DebBarma
@ 2011-05-16 11:41 ` Tarun Kanti DebBarma
  2011-05-19 16:10   ` Kevin Hilman
  2011-05-16 11:41 ` [RFC PATCH 09/10] OMAP: GPIO: cleanup omap_gpio_free and triggering functions Tarun Kanti DebBarma
  2011-05-16 11:41 ` [RFC PATCH 10/10] OMAP: GPIO: remove harcoded offsets in context save and restore Tarun Kanti DebBarma
  9 siblings, 1 reply; 26+ messages in thread
From: Tarun Kanti DebBarma @ 2011-05-16 11:41 UTC (permalink / raw)
  To: linux-omap
  Cc: Tarun Kanti DebBarma, Charulatha V, Santosh Shilimkar,
	Kevin Hilman, Tony Lindgren

By adding level and edge detection register offsets and then initializing them
correctly according to OMAP versions during device registrations we can now remove
lot of revision checks in these functions.

Signed-off-by: Tarun Kanti DebBarma <tarun.kanti@ti.com>
Cc: Charulatha V <charu@ti.com>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/gpio.c             |    8 +++
 arch/arm/plat-omap/gpio.c              |   91 ++++++++------------------------
 arch/arm/plat-omap/include/plat/gpio.h |    4 ++
 3 files changed, 35 insertions(+), 68 deletions(-)

diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
index 7e79999..0f8782f 100644
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -111,6 +111,10 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 		pdata->regs->debounce = OMAP24XX_GPIO_DEBOUNCE_VAL;
 		pdata->regs->debounce_en = OMAP24XX_GPIO_DEBOUNCE_EN;
 		pdata->regs->ctrl = OMAP24XX_GPIO_CTRL;
+		pdata->regs->leveldetect0 = OMAP24XX_GPIO_LEVELDETECT0;
+		pdata->regs->leveldetect1 = OMAP24XX_GPIO_LEVELDETECT1;
+		pdata->regs->risingdetect = OMAP24XX_GPIO_RISINGDETECT;
+		pdata->regs->fallingdetect = OMAP24XX_GPIO_FALLINGDETECT;
 		pdata->regs->wkupstatus = OMAP24XX_GPIO_WAKE_EN;
 		pdata->regs->wkupclear = OMAP24XX_GPIO_CLEARWKUENA;
 		pdata->regs->wkupset = OMAP24XX_GPIO_SETWKUENA;
@@ -131,6 +135,10 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 		pdata->regs->debounce = OMAP4_GPIO_DEBOUNCINGTIME;
 		pdata->regs->debounce_en = OMAP4_GPIO_DEBOUNCENABLE;
 		pdata->regs->ctrl = OMAP4_GPIO_CTRL;
+		pdata->regs->leveldetect0 = OMAP4_GPIO_LEVELDETECT0;
+		pdata->regs->leveldetect1 = OMAP4_GPIO_LEVELDETECT1;
+		pdata->regs->risingdetect = OMAP4_GPIO_RISINGDETECT;
+		pdata->regs->fallingdetect = OMAP4_GPIO_FALLINGDETECT;
 		pdata->regs->wkupstatus = OMAP4_GPIO_IRQWAKEN0;
 		pdata->regs->wkupclear = OMAP4_GPIO_IRQWAKEN0;
 		pdata->regs->wkupset = OMAP4_GPIO_IRQWAKEN0;
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 1a6789d..da72856 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -1291,6 +1291,7 @@ void omap2_gpio_prepare_for_idle(int off_mode)
 	list_for_each_entry(bank, &omap_gpio_list, node) {
 		u32 l1 = 0, l2 = 0;
 		int j;
+		struct omap_gpio_reg_offs *offset = bank->regs;
 
 		if (!bank->loses_context)
 			continue;
@@ -1307,40 +1308,17 @@ void omap2_gpio_prepare_for_idle(int off_mode)
 		if (!(bank->enabled_non_wakeup_gpios))
 			continue;
 
-		if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
-			bank->saved_datain = __raw_readl(bank->base +
-					OMAP24XX_GPIO_DATAIN);
-			l1 = __raw_readl(bank->base +
-					OMAP24XX_GPIO_FALLINGDETECT);
-			l2 = __raw_readl(bank->base +
-					OMAP24XX_GPIO_RISINGDETECT);
-		}
-
-		if (cpu_is_omap44xx()) {
-			bank->saved_datain = __raw_readl(bank->base +
-						OMAP4_GPIO_DATAIN);
-			l1 = __raw_readl(bank->base +
-						OMAP4_GPIO_FALLINGDETECT);
-			l2 = __raw_readl(bank->base +
-						OMAP4_GPIO_RISINGDETECT);
-		}
+		bank->saved_datain = __raw_readl(bank->base + offset->datain);
+		l1 = __raw_readl(bank->base + offset->fallingdetect);
+		l2 = __raw_readl(bank->base + offset->risingdetect);
 
 		bank->saved_fallingdetect = l1;
 		bank->saved_risingdetect = l2;
 		l1 &= ~bank->enabled_non_wakeup_gpios;
 		l2 &= ~bank->enabled_non_wakeup_gpios;
 
-		if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
-			__raw_writel(l1, bank->base +
-					OMAP24XX_GPIO_FALLINGDETECT);
-			__raw_writel(l2, bank->base +
-					OMAP24XX_GPIO_RISINGDETECT);
-		}
-
-		if (cpu_is_omap44xx()) {
-			__raw_writel(l1, bank->base + OMAP4_GPIO_FALLINGDETECT);
-			__raw_writel(l2, bank->base + OMAP4_GPIO_RISINGDETECT);
-		}
+		__raw_writel(l1, bank->base + offset->fallingdetect);
+		__raw_writel(l2, bank->base + offset->risingdetect);
 
 		c++;
 	}
@@ -1358,6 +1336,7 @@ void omap2_gpio_resume_after_idle(void)
 	list_for_each_entry(bank, &omap_gpio_list, node) {
 		u32 l = 0, gen, gen0, gen1;
 		int j;
+		struct omap_gpio_reg_offs *offset = bank->regs;
 
 		if (!bank->loses_context)
 			continue;
@@ -1371,21 +1350,11 @@ void omap2_gpio_resume_after_idle(void)
 		if (!(bank->enabled_non_wakeup_gpios))
 			continue;
 
-		if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
-			__raw_writel(bank->saved_fallingdetect,
-				 bank->base + OMAP24XX_GPIO_FALLINGDETECT);
-			__raw_writel(bank->saved_risingdetect,
-				 bank->base + OMAP24XX_GPIO_RISINGDETECT);
-			l = __raw_readl(bank->base + OMAP24XX_GPIO_DATAIN);
-		}
-
-		if (cpu_is_omap44xx()) {
-			__raw_writel(bank->saved_fallingdetect,
-				 bank->base + OMAP4_GPIO_FALLINGDETECT);
-			__raw_writel(bank->saved_risingdetect,
-				 bank->base + OMAP4_GPIO_RISINGDETECT);
-			l = __raw_readl(bank->base + OMAP4_GPIO_DATAIN);
-		}
+		__raw_writel(bank->saved_fallingdetect,
+				bank->base + offset->fallingdetect);
+		__raw_writel(bank->saved_risingdetect,
+				bank->base + offset->risingdetect);
+		l = __raw_readl(bank->base + offset->datain);
 
 		/* Check if any of the non-wakeup interrupt GPIOs have changed
 		 * state.  If so, generate an IRQ by software.  This is
@@ -1413,38 +1382,24 @@ void omap2_gpio_resume_after_idle(void)
 		if (gen) {
 			u32 old0, old1;
 
+			old0 = __raw_readl(bank->base + offset->leveldetect0);
+			old1 = __raw_readl(bank->base + offset->leveldetect1);
+
+			__raw_writel(old0, bank->base + offset->leveldetect0);
+			__raw_writel(old1, bank->base + offset->leveldetect1);
 			if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
-				old0 = __raw_readl(bank->base +
-					OMAP24XX_GPIO_LEVELDETECT0);
-				old1 = __raw_readl(bank->base +
-					OMAP24XX_GPIO_LEVELDETECT1);
-				__raw_writel(old0 | gen, bank->base +
-					OMAP24XX_GPIO_LEVELDETECT0);
-				__raw_writel(old1 | gen, bank->base +
-					OMAP24XX_GPIO_LEVELDETECT1);
-				__raw_writel(old0, bank->base +
-					OMAP24XX_GPIO_LEVELDETECT0);
-				__raw_writel(old1, bank->base +
-					OMAP24XX_GPIO_LEVELDETECT1);
+				old0 |= gen;
+				old1 |= gen;
 			}
 
 			if (cpu_is_omap44xx()) {
-				old0 = __raw_readl(bank->base +
-						OMAP4_GPIO_LEVELDETECT0);
-				old1 = __raw_readl(bank->base +
-						OMAP4_GPIO_LEVELDETECT1);
-				__raw_writel(old0 | l, bank->base +
-						OMAP4_GPIO_LEVELDETECT0);
-				__raw_writel(old1 | l, bank->base +
-						OMAP4_GPIO_LEVELDETECT1);
-				__raw_writel(old0, bank->base +
-						OMAP4_GPIO_LEVELDETECT0);
-				__raw_writel(old1, bank->base +
-						OMAP4_GPIO_LEVELDETECT1);
+				old0 |= l;
+				old1 |= l;
 			}
+			__raw_writel(old0, bank->base + offset->leveldetect0);
+			__raw_writel(old1, bank->base + offset->leveldetect1);
 		}
 	}
-
 }
 
 #endif
diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h
index 81ba1f0..d4e9f3c 100644
--- a/arch/arm/plat-omap/include/plat/gpio.h
+++ b/arch/arm/plat-omap/include/plat/gpio.h
@@ -189,6 +189,10 @@ struct omap_gpio_reg_offs {
 	u16 debounce;
 	u16 debounce_en;
 	u16 ctrl;
+	u16 leveldetect0;
+	u16 leveldetect1;
+	u16 risingdetect;
+	u16 fallingdetect;
 	u16 wkupstatus;
 	u16 wkupclear;
 	u16 wkupset;
-- 
1.6.0.4

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [RFC PATCH 09/10] OMAP: GPIO: cleanup omap_gpio_free and triggering functions
  2011-05-16 11:41 [RFC PATCH 00/10] OMAP: GPIO: cleanup GPIO driver Tarun Kanti DebBarma
                   ` (7 preceding siblings ...)
  2011-05-16 11:41 ` [RFC PATCH 08/10] OMAP: GPIO: cleanup prepare-for and resume-after idle functions Tarun Kanti DebBarma
@ 2011-05-16 11:41 ` Tarun Kanti DebBarma
  2011-05-18 11:03   ` Varadarajan, Charulatha
  2011-05-19 16:06   ` Kevin Hilman
  2011-05-16 11:41 ` [RFC PATCH 10/10] OMAP: GPIO: remove harcoded offsets in context save and restore Tarun Kanti DebBarma
  9 siblings, 2 replies; 26+ messages in thread
From: Tarun Kanti DebBarma @ 2011-05-16 11:41 UTC (permalink / raw)
  To: linux-omap
  Cc: Tarun Kanti DebBarma, Charulatha V, Santosh Shilimkar,
	Kevin Hilman, Tony Lindgren

We can get rid of ifdef / if checks of OMAP revision in set_24xx_gpio_triggering()
and omap_gpio_free().

Signed-off-by: Tarun Kanti DebBarma <tarun.kanti@ti.com>
Cc: Charulatha V <charu@ti.com>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
---
 arch/arm/plat-omap/gpio.c |   38 ++++++++------------------------------
 1 files changed, 8 insertions(+), 30 deletions(-)

diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 714626a..bc07559 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -269,15 +269,9 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio,
 			bank->enabled_non_wakeup_gpios &= ~gpio_bit;
 	}
 
-	if (cpu_is_omap44xx()) {
-		bank->level_mask =
-			__raw_readl(bank->base + OMAP4_GPIO_LEVELDETECT0) |
-			__raw_readl(bank->base + OMAP4_GPIO_LEVELDETECT1);
-	} else {
-		bank->level_mask =
-			__raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT0) |
-			__raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT1);
-	}
+	bank->level_mask =
+		__raw_readl(bank->base + bank->regs->leveldetect0) |
+		__raw_readl(bank->base + bank->regs->leveldetect1);
 }
 #endif
 
@@ -609,29 +603,13 @@ static void omap_gpio_free(struct gpio_chip *chip, unsigned offset)
 {
 	struct gpio_bank *bank = container_of(chip, struct gpio_bank, chip);
 	unsigned long flags;
+	void __iomem *reg;
 
 	spin_lock_irqsave(&bank->lock, flags);
-#ifdef CONFIG_ARCH_OMAP16XX
-	if (bank->method == METHOD_GPIO_1610) {
-		/* Disable wake-up during idle for dynamic tick */
-		void __iomem *reg = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA;
-		__raw_writel(1 << offset, reg);
-	}
-#endif
-#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
-	if (bank->method == METHOD_GPIO_24XX) {
-		/* Disable wake-up during idle for dynamic tick */
-		void __iomem *reg = bank->base + OMAP24XX_GPIO_CLEARWKUENA;
-		__raw_writel(1 << offset, reg);
-	}
-#endif
-#ifdef CONFIG_ARCH_OMAP4
-	if (bank->method == METHOD_GPIO_44XX) {
-		/* Disable wake-up during idle for dynamic tick */
-		void __iomem *reg = bank->base + OMAP4_GPIO_IRQWAKEN0;
-		__raw_writel(1 << offset, reg);
-	}
-#endif
+	/* Disable wake-up during idle for dynamic tick */
+	reg = bank->base + bank->regs->wkupclear;
+
+	__raw_writel(1 << offset, reg);
 	bank->mod_usage &= ~(1 << offset);
 
 	if ((bank->regs->ctrl != USHRT_MAX) && (!bank->mod_usage)) {
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [RFC PATCH 10/10] OMAP: GPIO: remove harcoded offsets in context save and restore
  2011-05-16 11:41 [RFC PATCH 00/10] OMAP: GPIO: cleanup GPIO driver Tarun Kanti DebBarma
                   ` (8 preceding siblings ...)
  2011-05-16 11:41 ` [RFC PATCH 09/10] OMAP: GPIO: cleanup omap_gpio_free and triggering functions Tarun Kanti DebBarma
@ 2011-05-16 11:41 ` Tarun Kanti DebBarma
  9 siblings, 0 replies; 26+ messages in thread
From: Tarun Kanti DebBarma @ 2011-05-16 11:41 UTC (permalink / raw)
  To: linux-omap
  Cc: Tarun Kanti DebBarma, Charulatha V, Santosh Shilimkar,
	Kevin Hilman, Tony Lindgren

We don't have to use hard-coded offsets any more in context save and
restore functions and instead use the generic offsets whcih have been
correctly initialized during device registration.

Signed-off-by: Tarun Kanti DebBarma <tarun.kanti@ti.com>
Cc: Charulatha V <charu@ti.com>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/gpio.c             |    2 +
 arch/arm/plat-omap/gpio.c              |   40 ++++++++++++++++----------------
 arch/arm/plat-omap/include/plat/gpio.h |    1 +
 3 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
index 0f8782f..5c888dd 100644
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -106,6 +106,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 		pdata->regs->irqstatus = OMAP24XX_GPIO_IRQSTATUS1;
 		pdata->regs->irqstatus2 = OMAP24XX_GPIO_IRQSTATUS2;
 		pdata->regs->irqenable = OMAP24XX_GPIO_IRQENABLE1;
+		pdata->regs->irqenable2 = OMAP24XX_GPIO_IRQENABLE2;
 		pdata->regs->set_irqenable = OMAP24XX_GPIO_SETIRQENABLE1;
 		pdata->regs->clr_irqenable = OMAP24XX_GPIO_CLEARIRQENABLE1;
 		pdata->regs->debounce = OMAP24XX_GPIO_DEBOUNCE_VAL;
@@ -130,6 +131,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 		pdata->regs->irqstatus = OMAP4_GPIO_IRQSTATUS0;
 		pdata->regs->irqstatus2 = OMAP4_GPIO_IRQSTATUS1;
 		pdata->regs->irqenable = OMAP4_GPIO_IRQSTATUSSET0;
+		pdata->regs->irqenable2 = OMAP4_GPIO_IRQSTATUSSET1;
 		pdata->regs->set_irqenable = OMAP4_GPIO_IRQSTATUSSET0;
 		pdata->regs->clr_irqenable = OMAP4_GPIO_IRQSTATUSCLR0;
 		pdata->regs->debounce = OMAP4_GPIO_DEBOUNCINGTIME;
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 3d34461..171a1ce 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -1400,25 +1400,25 @@ void omap_gpio_save_context(void)
 			continue;
 
 		gpio_context[i].irqenable1 =
-			__raw_readl(bank->base + OMAP24XX_GPIO_IRQENABLE1);
+			__raw_readl(bank->base + bank->regs->irqenable);
 		gpio_context[i].irqenable2 =
-			__raw_readl(bank->base + OMAP24XX_GPIO_IRQENABLE2);
+			__raw_readl(bank->base + bank->regs->irqenable2);
 		gpio_context[i].wake_en =
-			__raw_readl(bank->base + OMAP24XX_GPIO_WAKE_EN);
+			__raw_readl(bank->base + bank->regs->wkupstatus);
 		gpio_context[i].ctrl =
-			__raw_readl(bank->base + OMAP24XX_GPIO_CTRL);
+			__raw_readl(bank->base + bank->regs->ctrl);
 		gpio_context[i].oe =
-			__raw_readl(bank->base + OMAP24XX_GPIO_OE);
+			__raw_readl(bank->base + bank->regs->direction);
 		gpio_context[i].leveldetect0 =
-			__raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT0);
+			__raw_readl(bank->base + bank->regs->leveldetect0);
 		gpio_context[i].leveldetect1 =
-			__raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT1);
+			__raw_readl(bank->base + bank->regs->leveldetect1);
 		gpio_context[i].risingdetect =
-			__raw_readl(bank->base + OMAP24XX_GPIO_RISINGDETECT);
+			__raw_readl(bank->base + bank->regs->risingdetect);
 		gpio_context[i].fallingdetect =
-			__raw_readl(bank->base + OMAP24XX_GPIO_FALLINGDETECT);
+			__raw_readl(bank->base + bank->regs->fallingdetect);
 		gpio_context[i].dataout =
-			__raw_readl(bank->base + OMAP24XX_GPIO_DATAOUT);
+			__raw_readl(bank->base + bank->regs->dataout);
 	}
 }
 
@@ -1435,25 +1435,25 @@ void omap_gpio_restore_context(void)
 			continue;
 
 		__raw_writel(gpio_context[i].irqenable1,
-				bank->base + OMAP24XX_GPIO_IRQENABLE1);
+				bank->base + bank->regs->irqenable);
 		__raw_writel(gpio_context[i].irqenable2,
-				bank->base + OMAP24XX_GPIO_IRQENABLE2);
+				bank->base + bank->regs->irqenable2);
 		__raw_writel(gpio_context[i].wake_en,
-				bank->base + OMAP24XX_GPIO_WAKE_EN);
+				bank->base + bank->regs->wkupstatus);
 		__raw_writel(gpio_context[i].ctrl,
-				bank->base + OMAP24XX_GPIO_CTRL);
+				bank->base + bank->regs->ctrl);
 		__raw_writel(gpio_context[i].oe,
-				bank->base + OMAP24XX_GPIO_OE);
+				bank->base + bank->regs->direction);
 		__raw_writel(gpio_context[i].leveldetect0,
-				bank->base + OMAP24XX_GPIO_LEVELDETECT0);
+				bank->base + bank->regs->leveldetect0);
 		__raw_writel(gpio_context[i].leveldetect1,
-				bank->base + OMAP24XX_GPIO_LEVELDETECT1);
+				bank->base + bank->regs->leveldetect1);
 		__raw_writel(gpio_context[i].risingdetect,
-				bank->base + OMAP24XX_GPIO_RISINGDETECT);
+				bank->base + bank->regs->risingdetect);
 		__raw_writel(gpio_context[i].fallingdetect,
-				bank->base + OMAP24XX_GPIO_FALLINGDETECT);
+				bank->base + bank->regs->fallingdetect);
 		__raw_writel(gpio_context[i].dataout,
-				bank->base + OMAP24XX_GPIO_DATAOUT);
+				bank->base + bank->regs->dataout);
 	}
 }
 #endif
diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h
index d4e9f3c..964c7e6 100644
--- a/arch/arm/plat-omap/include/plat/gpio.h
+++ b/arch/arm/plat-omap/include/plat/gpio.h
@@ -184,6 +184,7 @@ struct omap_gpio_reg_offs {
 	u16 irqstatus;
 	u16 irqstatus2;
 	u16 irqenable;
+	u16 irqenable2;
 	u16 set_irqenable;
 	u16 clr_irqenable;
 	u16 debounce;
-- 
1.6.0.4

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [RFC PATCH 09/10] OMAP: GPIO: cleanup omap_gpio_free and triggering functions
  2011-05-16 11:41 ` [RFC PATCH 09/10] OMAP: GPIO: cleanup omap_gpio_free and triggering functions Tarun Kanti DebBarma
@ 2011-05-18 11:03   ` Varadarajan, Charulatha
  2011-05-19 16:06   ` Kevin Hilman
  1 sibling, 0 replies; 26+ messages in thread
From: Varadarajan, Charulatha @ 2011-05-18 11:03 UTC (permalink / raw)
  To: Tarun Kanti DebBarma
  Cc: linux-omap, Santosh Shilimkar, Kevin Hilman, Tony Lindgren

Tarun,

On Mon, May 16, 2011 at 17:11, Tarun Kanti DebBarma <tarun.kanti@ti.com> wrote:
> We can get rid of ifdef / if checks of OMAP revision in set_24xx_gpio_triggering()
> and omap_gpio_free().
>
> Signed-off-by: Tarun Kanti DebBarma <tarun.kanti@ti.com>
> Cc: Charulatha V <charu@ti.com>
> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: Kevin Hilman <khilman@ti.com>
> Cc: Tony Lindgren <tony@atomide.com>
> ---
>  arch/arm/plat-omap/gpio.c |   38 ++++++++------------------------------
>  1 files changed, 8 insertions(+), 30 deletions(-)
>
> diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
> index 714626a..bc07559 100644
> --- a/arch/arm/plat-omap/gpio.c
> +++ b/arch/arm/plat-omap/gpio.c
> @@ -269,15 +269,9 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio,
>                        bank->enabled_non_wakeup_gpios &= ~gpio_bit;
>        }
>
> -       if (cpu_is_omap44xx()) {
> -               bank->level_mask =
> -                       __raw_readl(bank->base + OMAP4_GPIO_LEVELDETECT0) |
> -                       __raw_readl(bank->base + OMAP4_GPIO_LEVELDETECT1);
> -       } else {
> -               bank->level_mask =
> -                       __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT0) |
> -                       __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT1);
> -       }
> +       bank->level_mask =
> +               __raw_readl(bank->base + bank->regs->leveldetect0) |
> +               __raw_readl(bank->base + bank->regs->leveldetect1);
>  }
>  #endif
>
> @@ -609,29 +603,13 @@ static void omap_gpio_free(struct gpio_chip *chip, unsigned offset)
>  {
>        struct gpio_bank *bank = container_of(chip, struct gpio_bank, chip);
>        unsigned long flags;
> +       void __iomem *reg;
>
>        spin_lock_irqsave(&bank->lock, flags);
> -#ifdef CONFIG_ARCH_OMAP16XX
> -       if (bank->method == METHOD_GPIO_1610) {
> -               /* Disable wake-up during idle for dynamic tick */
> -               void __iomem *reg = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA;
> -               __raw_writel(1 << offset, reg);
> -       }
> -#endif
> -#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
> -       if (bank->method == METHOD_GPIO_24XX) {
> -               /* Disable wake-up during idle for dynamic tick */
> -               void __iomem *reg = bank->base + OMAP24XX_GPIO_CLEARWKUENA;
> -               __raw_writel(1 << offset, reg);
> -       }
> -#endif
> -#ifdef CONFIG_ARCH_OMAP4
> -       if (bank->method == METHOD_GPIO_44XX) {
> -               /* Disable wake-up during idle for dynamic tick */
> -               void __iomem *reg = bank->base + OMAP4_GPIO_IRQWAKEN0;
> -               __raw_writel(1 << offset, reg);
> -       }
> -#endif
> +       /* Disable wake-up during idle for dynamic tick */
> +       reg = bank->base + bank->regs->wkupclear;

Consider using bank->wake_clear instead of extracting reg here.

> +
> +       __raw_writel(1 << offset, reg);

This is wrong on OMAP15xx & OMAP7xx as wkupclear is NULL.

-V Charulatha

>        bank->mod_usage &= ~(1 << offset);
>
>        if ((bank->regs->ctrl != USHRT_MAX) && (!bank->mod_usage)) {
> --
> 1.6.0.4
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC PATCH 04/10] OMAP: GPIO: Remove dependency on gpio_bank_count
  2011-05-16 11:41 ` [RFC PATCH 04/10] OMAP: GPIO: Remove dependency on gpio_bank_count Tarun Kanti DebBarma
@ 2011-05-19 15:42   ` Kevin Hilman
  2011-05-20  8:27     ` Varadarajan, Charulatha
  2011-05-19 16:39   ` Kevin Hilman
  1 sibling, 1 reply; 26+ messages in thread
From: Kevin Hilman @ 2011-05-19 15:42 UTC (permalink / raw)
  To: Tarun Kanti DebBarma
  Cc: linux-omap, Charulatha V, Santosh Shilimkar, Tony Lindgren

Tarun Kanti DebBarma <tarun.kanti@ti.com> writes:

> From: Charulatha V <charu@ti.com>
>
> gpio_bank_count is the count of number of GPIO devices
> in a SoC. Remove this dependency from the driver. Also remove
> the dependency on array of pointers to gpio_bank struct of
> all GPIO devices.
>
> The cpu_is*() checks used in omap2_gpio_prepare_for_idle() and
> omap2_gpio_resume_after_idle() would be removed in one of the
> patches in this series
>
> Signed-off-by: Charulatha V <charu@ti.com>
> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: Kevin Hilman <khilman@ti.com>
> Cc: Tony Lindgren <tony@atomide.com>


Nice.  I like this direction.... Some minor comments below...

> ---
>  arch/arm/mach-omap1/gpio15xx.c         |    1 -
>  arch/arm/mach-omap1/gpio16xx.c         |    2 -
>  arch/arm/mach-omap1/gpio7xx.c          |    2 -
>  arch/arm/mach-omap2/gpio.c             |    1 -
>  arch/arm/plat-omap/gpio.c              |  157 ++++++++++++++++---------------
>  arch/arm/plat-omap/include/plat/gpio.h |    3 -
>  6 files changed, 81 insertions(+), 85 deletions(-)
>
> diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c
> index c3caf25..7a15f69 100644
> --- a/arch/arm/mach-omap1/gpio15xx.c
> +++ b/arch/arm/mach-omap1/gpio15xx.c
> @@ -117,7 +117,6 @@ static int __init omap15xx_gpio_init(void)
>  	platform_device_register(&omap15xx_mpu_gpio);
>  	platform_device_register(&omap15xx_gpio);
>  
> -	gpio_bank_count = 2;
>  	return 0;
>  }
>  postcore_initcall(omap15xx_gpio_init);
> diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c
> index f62eaf3..43718ec 100644
> --- a/arch/arm/mach-omap1/gpio16xx.c
> +++ b/arch/arm/mach-omap1/gpio16xx.c
> @@ -223,8 +223,6 @@ static int __init omap16xx_gpio_init(void)
>  	for (i = 0; i < ARRAY_SIZE(omap16xx_gpio_dev); i++)
>  		platform_device_register(omap16xx_gpio_dev[i]);
>  
> -	gpio_bank_count = ARRAY_SIZE(omap16xx_gpio_dev);
> -
>  	return 0;
>  }
>  postcore_initcall(omap16xx_gpio_init);
> diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c
> index 0fc2557..c7684ce 100644
> --- a/arch/arm/mach-omap1/gpio7xx.c
> +++ b/arch/arm/mach-omap1/gpio7xx.c
> @@ -284,8 +284,6 @@ static int __init omap7xx_gpio_init(void)
>  	for (i = 0; i < ARRAY_SIZE(omap7xx_gpio_dev); i++)
>  		platform_device_register(omap7xx_gpio_dev[i]);
>  
> -	gpio_bank_count = ARRAY_SIZE(omap7xx_gpio_dev);
> -
>  	return 0;
>  }
>  postcore_initcall(omap7xx_gpio_init);
> diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
> index 6cd26b4..487b49a 100644
> --- a/arch/arm/mach-omap2/gpio.c
> +++ b/arch/arm/mach-omap2/gpio.c
> @@ -143,7 +143,6 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
>  		return PTR_ERR(od);
>  	}
>  
> -	gpio_bank_count++;
>  	return 0;
>  }
>  
> diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
> index 12deb1c..0b76475 100644
> --- a/arch/arm/plat-omap/gpio.c
> +++ b/arch/arm/plat-omap/gpio.c
> @@ -30,7 +30,10 @@
>  #include <mach/gpio.h>
>  #include <asm/mach/irq.h>
>  
> +static LIST_HEAD(omap_gpio_list);
> +
>  struct gpio_bank {
> +	struct list_head node;
>  	unsigned long pbase;
>  	void __iomem *base;
>  	u16 irq;
> @@ -57,6 +60,7 @@ struct gpio_bank {
>  	bool dbck_flag;
>  	int stride;
>  	u32 width;
> +	u16 id;
>  
>  	void (*set_dataout)(struct gpio_bank *bank, int gpio, int enable);
>  
> @@ -80,15 +84,6 @@ struct omap3_gpio_regs {
>  static struct omap3_gpio_regs gpio_context[OMAP34XX_NR_GPIOS];
>  #endif
>  
> -/*
> - * TODO: Cleanup gpio_bank usage as it is having information
> - * related to all instances of the device
> - */
> -static struct gpio_bank *gpio_bank;
> -
> -/* TODO: Analyze removing gpio_bank_count usage from driver code */
> -int gpio_bank_count;
> -
>  #define GPIO_INDEX(bank, gpio) (gpio % bank->width)
>  #define GPIO_BIT(bank, gpio) (1 << GPIO_INDEX(bank, gpio))
>  #define GPIO_MOD_CTRL_BIT	BIT(0)
> @@ -859,23 +854,29 @@ static struct platform_device omap_mpuio_device = {
>  	/* could list the /proc/iomem resources */
>  };
>  
> -static inline void mpuio_init(void)
> +static inline void mpuio_init(struct gpio_bank *bank)
>  {
> -	struct gpio_bank *bank = &gpio_bank[0];
> +	static int mpuio_init_done;

Why is this flag needed?   isn't the bank->method check enough?

> +	if (mpuio_init_done || (bank->method != METHOD_MPUIO))
> +		return;
> +
>  	platform_set_drvdata(&omap_mpuio_device, bank);
>  
>  	if (platform_driver_register(&omap_mpuio_driver) == 0)
>  		(void) platform_device_register(&omap_mpuio_device);
> +
> +	mpuio_init_done = 1;
>  }
>  
>  #else
> -static inline void mpuio_init(void) {}
> +static inline void mpuio_init(struct gpio_bank *bank) {}
>  #endif	/* 16xx */
>  
>  #else
>  
>  #define bank_is_mpuio(bank)	0
> -static inline void mpuio_init(void) {}
> +static inline void mpuio_init(struct gpio_bank *bank) {}
>  
>  #endif
>  
> @@ -997,18 +998,6 @@ static void __init omap_gpio_show_rev(struct gpio_bank *bank)
>   */
>  static struct lock_class_key gpio_lock_class;
>  
> -static inline int init_gpio_info(struct platform_device *pdev)
> -{
> -	/* TODO: Analyze removing gpio_bank_count usage from driver code */
> -	gpio_bank = kzalloc(gpio_bank_count * sizeof(struct gpio_bank),
> -				GFP_KERNEL);
> -	if (!gpio_bank) {
> -		dev_err(&pdev->dev, "Memory alloc failed for gpio_bank\n");
> -		return -ENOMEM;
> -	}
> -	return 0;
> -}
> -
>  /* TODO: Cleanup cpu_is_* checks */
>  static void omap_gpio_mod_init(struct gpio_bank *bank)
>  {
> @@ -1140,36 +1129,37 @@ static void __init omap_gpio_chip_init(struct gpio_bank *bank)
>  
>  static int __devinit omap_gpio_probe(struct platform_device *pdev)
>  {
> -	static int gpio_init_done;
>  	struct omap_gpio_platform_data *pdata;
>  	struct resource *res;
> -	int id;
>  	struct gpio_bank *bank;
> +	int ret = 0;
>  
> -	if (!pdev->dev.platform_data)
> -		return -EINVAL;
> -
> -	pdata = pdev->dev.platform_data;
> -
> -	if (!gpio_init_done) {
> -		int ret;
> -
> -		ret = init_gpio_info(pdev);
> -		if (ret)
> -			return ret;
> +	if (!pdev->dev.platform_data) {
> +		ret = -EINVAL;
> +		goto err_exit;
>  	}
>  
> -	id = pdev->id;
> -	bank = &gpio_bank[id];
> +	bank = kzalloc(sizeof(struct gpio_bank), GFP_KERNEL);
> +	if (!bank) {
> +		dev_err(&pdev->dev, "Memory alloc failed for gpio_bank\n");
> +		ret = -ENOMEM;
> +		goto err_exit;
> +	}
>  
>  	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
>  	if (unlikely(!res)) {
> -		dev_err(&pdev->dev, "GPIO Bank %i Invalid IRQ resource\n", id);
> -		return -ENODEV;
> +		dev_err(&pdev->dev, "GPIO Bank %i Invalid IRQ resource\n",
> +				pdev->id);
> +		ret = -ENODEV;
> +		goto err_free;
>  	}
>  
>  	bank->irq = res->start;
> +	bank->id = pdev->id;
> +
> +	pdata = pdev->dev.platform_data;
>  	bank->virtual_irq_start = pdata->virtual_irq_start;
> +
>  	bank->method = pdata->bank_type;
>  	bank->dev = &pdev->dev;
>  	bank->dbck_flag = pdata->dbck_flag;
> @@ -1189,39 +1179,47 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)
>  	/* Static mapping, never released */
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	if (unlikely(!res)) {
> -		dev_err(&pdev->dev, "GPIO Bank %i Invalid mem resource\n", id);
> -		return -ENODEV;
> +		dev_err(&pdev->dev, "GPIO Bank %i Invalid mem resource\n",
> +				pdev->id);
> +		ret = -ENODEV;
> +		goto err_free;
>  	}
>  
>  	bank->base = ioremap(res->start, resource_size(res));
>  	if (!bank->base) {
> -		dev_err(&pdev->dev, "Could not ioremap gpio bank%i\n", id);
> -		return -ENOMEM;
> +		dev_err(&pdev->dev, "Could not ioremap gpio bank%i\n",
> +				pdev->id);
> +		ret = -ENOMEM;
> +		goto err_free;
>  	}
>  
>  	pm_runtime_enable(bank->dev);
>  	pm_runtime_get_sync(bank->dev);
>  
> +	mpuio_init(bank);

How about moving this call into _mod_init(), and call it only when
->method = MPUIO.

>  	omap_gpio_mod_init(bank);
>  	omap_gpio_chip_init(bank);
>  	omap_gpio_show_rev(bank);

[...]

Kevin

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC PATCH 06/10] OMAP: GPIO: Use USHRT_MAX for rev offset instead of -1
  2011-05-16 11:41 ` [RFC PATCH 06/10] OMAP: GPIO: Use USHRT_MAX for rev offset instead of -1 Tarun Kanti DebBarma
@ 2011-05-19 15:59   ` Kevin Hilman
  2011-05-20  8:31     ` Varadarajan, Charulatha
  0 siblings, 1 reply; 26+ messages in thread
From: Kevin Hilman @ 2011-05-19 15:59 UTC (permalink / raw)
  To: Tarun Kanti DebBarma
  Cc: linux-omap, Charulatha V, Santosh Shilimkar, Tony Lindgren

Tarun Kanti DebBarma <tarun.kanti@ti.com> writes:

> From: Charulatha V <charu@ti.com>
>
> Use USHRT_MAX for revision offset instead of -1 if revision register
> is not available for a given SoC since rev offset is a u16 value.
>
> Signed-off-by: Charulatha V <charu@ti.com>
> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: Kevin Hilman <khilman@ti.com>
> Cc: Tony Lindgren <tony@atomide.com>

Thanks, folded this into the original.

Kevin

> ---
>  arch/arm/mach-omap1/gpio15xx.c |    2 +-
>  arch/arm/mach-omap1/gpio16xx.c |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c
> index 7a15f69..f18a4a9 100644
> --- a/arch/arm/mach-omap1/gpio15xx.c
> +++ b/arch/arm/mach-omap1/gpio15xx.c
> @@ -77,7 +77,7 @@ static struct __initdata resource omap15xx_gpio_resources[] = {
>  };
>  
>  static struct omap_gpio_reg_offs omap15xx_gpio_regs = {
> -	.revision	= -1,
> +	.revision	= USHRT_MAX,
>  	.direction	= OMAP1510_GPIO_DIR_CONTROL,
>  	.datain		= OMAP1510_GPIO_DATA_INPUT,
>  	.dataout	= OMAP1510_GPIO_DATA_OUTPUT,
> diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c
> index 43718ec..d886b88 100644
> --- a/arch/arm/mach-omap1/gpio16xx.c
> +++ b/arch/arm/mach-omap1/gpio16xx.c
> @@ -38,7 +38,7 @@ static struct __initdata resource omap16xx_mpu_gpio_resources[] = {
>  };
>  
>  static struct omap_gpio_reg_offs omap16xx_mpuio_regs = {
> -	.revision       = -1,
> +	.revision       = USHRT_MAX,
>  	.direction	= OMAP_MPUIO_IO_CNTL,
>  	.datain		= OMAP_MPUIO_INPUT_LATCH,
>  	.dataout	= OMAP_MPUIO_OUTPUT,

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC PATCH 09/10] OMAP: GPIO: cleanup omap_gpio_free and triggering functions
  2011-05-16 11:41 ` [RFC PATCH 09/10] OMAP: GPIO: cleanup omap_gpio_free and triggering functions Tarun Kanti DebBarma
  2011-05-18 11:03   ` Varadarajan, Charulatha
@ 2011-05-19 16:06   ` Kevin Hilman
  1 sibling, 0 replies; 26+ messages in thread
From: Kevin Hilman @ 2011-05-19 16:06 UTC (permalink / raw)
  To: Tarun Kanti DebBarma
  Cc: linux-omap, Charulatha V, Santosh Shilimkar, Tony Lindgren

Tarun Kanti DebBarma <tarun.kanti@ti.com> writes:

> We can get rid of ifdef / if checks of OMAP revision in set_24xx_gpio_triggering()
> and omap_gpio_free().
>
> Signed-off-by: Tarun Kanti DebBarma <tarun.kanti@ti.com>
> Cc: Charulatha V <charu@ti.com>
> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: Kevin Hilman <khilman@ti.com>
> Cc: Tony Lindgren <tony@atomide.com>
> ---
>  arch/arm/plat-omap/gpio.c |   38 ++++++++------------------------------
>  1 files changed, 8 insertions(+), 30 deletions(-)
>
> diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
> index 714626a..bc07559 100644
> --- a/arch/arm/plat-omap/gpio.c
> +++ b/arch/arm/plat-omap/gpio.c
> @@ -269,15 +269,9 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio,
>  			bank->enabled_non_wakeup_gpios &= ~gpio_bit;
>  	}
>  
> -	if (cpu_is_omap44xx()) {
> -		bank->level_mask =
> -			__raw_readl(bank->base + OMAP4_GPIO_LEVELDETECT0) |
> -			__raw_readl(bank->base + OMAP4_GPIO_LEVELDETECT1);
> -	} else {
> -		bank->level_mask =
> -			__raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT0) |
> -			__raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT1);
> -	}
> +	bank->level_mask =
> +		__raw_readl(bank->base + bank->regs->leveldetect0) |
> +		__raw_readl(bank->base + bank->regs->leveldetect1);

Please fold this part into patch 8/10 where the leveldetect* is
initially added.

>  }
>  #endif
>  
> @@ -609,29 +603,13 @@ static void omap_gpio_free(struct gpio_chip *chip, unsigned offset)
>  {
>  	struct gpio_bank *bank = container_of(chip, struct gpio_bank, chip);
>  	unsigned long flags;
> +	void __iomem *reg;
>  
>  	spin_lock_irqsave(&bank->lock, flags);
> -#ifdef CONFIG_ARCH_OMAP16XX
> -	if (bank->method == METHOD_GPIO_1610) {
> -		/* Disable wake-up during idle for dynamic tick */
> -		void __iomem *reg = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA;
> -		__raw_writel(1 << offset, reg);
> -	}
> -#endif
> -#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
> -	if (bank->method == METHOD_GPIO_24XX) {
> -		/* Disable wake-up during idle for dynamic tick */
> -		void __iomem *reg = bank->base + OMAP24XX_GPIO_CLEARWKUENA;
> -		__raw_writel(1 << offset, reg);
> -	}
> -#endif
> -#ifdef CONFIG_ARCH_OMAP4
> -	if (bank->method == METHOD_GPIO_44XX) {
> -		/* Disable wake-up during idle for dynamic tick */
> -		void __iomem *reg = bank->base + OMAP4_GPIO_IRQWAKEN0;
> -		__raw_writel(1 << offset, reg);
> -	}
> -#endif
> +	/* Disable wake-up during idle for dynamic tick */
> +	reg = bank->base + bank->regs->wkupclear;
> +
> +	__raw_writel(1 << offset, reg);


In addition to Charu's comments, please fold this into the patch where
wake_clear etc. are added.

Kevin


>  	bank->mod_usage &= ~(1 << offset);
>  
>  	if ((bank->regs->ctrl != USHRT_MAX) && (!bank->mod_usage)) {

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC PATCH 07/10] OMAP: GPIO: cleanup suspend and resume functions
  2011-05-16 11:41 ` [RFC PATCH 07/10] OMAP: GPIO: cleanup suspend and resume functions Tarun Kanti DebBarma
@ 2011-05-19 16:08   ` Kevin Hilman
  2011-05-20  9:20   ` Varadarajan, Charulatha
  1 sibling, 0 replies; 26+ messages in thread
From: Kevin Hilman @ 2011-05-19 16:08 UTC (permalink / raw)
  To: Tarun Kanti DebBarma
  Cc: linux-omap, Charulatha V, Santosh Shilimkar, Tony Lindgren

Tarun Kanti DebBarma <tarun.kanti@ti.com> writes:

> Since wake_status, wake_clear, wake_set is common for all banks on a given
> OMAP version it is enough to get their values once during probe().
> Also, register offsets are already initialzed according to OMAP versions
> during device registration. We no longer need these explicit checks.
>
> Signed-off-by: Tarun Kanti DebBarma <tarun.kanti@ti.com>

Great!

Kevin 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC PATCH 08/10] OMAP: GPIO: cleanup prepare-for and resume-after idle functions
  2011-05-16 11:41 ` [RFC PATCH 08/10] OMAP: GPIO: cleanup prepare-for and resume-after idle functions Tarun Kanti DebBarma
@ 2011-05-19 16:10   ` Kevin Hilman
  0 siblings, 0 replies; 26+ messages in thread
From: Kevin Hilman @ 2011-05-19 16:10 UTC (permalink / raw)
  To: Tarun Kanti DebBarma
  Cc: linux-omap, Charulatha V, Santosh Shilimkar, Tony Lindgren

Tarun Kanti DebBarma <tarun.kanti@ti.com> writes:

> By adding level and edge detection register offsets and then initializing them
> correctly according to OMAP versions during device registrations we can now remove
> lot of revision checks in these functions.
>
> Signed-off-by: Tarun Kanti DebBarma <tarun.kanti@ti.com>
> Cc: Charulatha V <charu@ti.com>
> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: Kevin Hilman <khilman@ti.com>
> Cc: Tony Lindgren <tony@atomide.com>

Looks great... a couple very minor comments below...

> ---
>  arch/arm/mach-omap2/gpio.c             |    8 +++
>  arch/arm/plat-omap/gpio.c              |   91 ++++++++------------------------
>  arch/arm/plat-omap/include/plat/gpio.h |    4 ++
>  3 files changed, 35 insertions(+), 68 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
> index 7e79999..0f8782f 100644
> --- a/arch/arm/mach-omap2/gpio.c
> +++ b/arch/arm/mach-omap2/gpio.c
> @@ -111,6 +111,10 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
>  		pdata->regs->debounce = OMAP24XX_GPIO_DEBOUNCE_VAL;
>  		pdata->regs->debounce_en = OMAP24XX_GPIO_DEBOUNCE_EN;
>  		pdata->regs->ctrl = OMAP24XX_GPIO_CTRL;
> +		pdata->regs->leveldetect0 = OMAP24XX_GPIO_LEVELDETECT0;
> +		pdata->regs->leveldetect1 = OMAP24XX_GPIO_LEVELDETECT1;
> +		pdata->regs->risingdetect = OMAP24XX_GPIO_RISINGDETECT;
> +		pdata->regs->fallingdetect = OMAP24XX_GPIO_FALLINGDETECT;
>  		pdata->regs->wkupstatus = OMAP24XX_GPIO_WAKE_EN;
>  		pdata->regs->wkupclear = OMAP24XX_GPIO_CLEARWKUENA;
>  		pdata->regs->wkupset = OMAP24XX_GPIO_SETWKUENA;
> @@ -131,6 +135,10 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
>  		pdata->regs->debounce = OMAP4_GPIO_DEBOUNCINGTIME;
>  		pdata->regs->debounce_en = OMAP4_GPIO_DEBOUNCENABLE;
>  		pdata->regs->ctrl = OMAP4_GPIO_CTRL;
> +		pdata->regs->leveldetect0 = OMAP4_GPIO_LEVELDETECT0;
> +		pdata->regs->leveldetect1 = OMAP4_GPIO_LEVELDETECT1;
> +		pdata->regs->risingdetect = OMAP4_GPIO_RISINGDETECT;
> +		pdata->regs->fallingdetect = OMAP4_GPIO_FALLINGDETECT;
>  		pdata->regs->wkupstatus = OMAP4_GPIO_IRQWAKEN0;
>  		pdata->regs->wkupclear = OMAP4_GPIO_IRQWAKEN0;
>  		pdata->regs->wkupset = OMAP4_GPIO_IRQWAKEN0;
> diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
> index 1a6789d..da72856 100644
> --- a/arch/arm/plat-omap/gpio.c
> +++ b/arch/arm/plat-omap/gpio.c
> @@ -1291,6 +1291,7 @@ void omap2_gpio_prepare_for_idle(int off_mode)
>  	list_for_each_entry(bank, &omap_gpio_list, node) {
>  		u32 l1 = 0, l2 = 0;
>  		int j;
> +		struct omap_gpio_reg_offs *offset = bank->regs;

Please just use bank->regs directly below.

>  		if (!bank->loses_context)
>  			continue;
> @@ -1307,40 +1308,17 @@ void omap2_gpio_prepare_for_idle(int off_mode)
>  		if (!(bank->enabled_non_wakeup_gpios))
>  			continue;
>  
> -		if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
> -			bank->saved_datain = __raw_readl(bank->base +
> -					OMAP24XX_GPIO_DATAIN);
> -			l1 = __raw_readl(bank->base +
> -					OMAP24XX_GPIO_FALLINGDETECT);
> -			l2 = __raw_readl(bank->base +
> -					OMAP24XX_GPIO_RISINGDETECT);
> -		}
> -
> -		if (cpu_is_omap44xx()) {
> -			bank->saved_datain = __raw_readl(bank->base +
> -						OMAP4_GPIO_DATAIN);
> -			l1 = __raw_readl(bank->base +
> -						OMAP4_GPIO_FALLINGDETECT);
> -			l2 = __raw_readl(bank->base +
> -						OMAP4_GPIO_RISINGDETECT);
> -		}
> +		bank->saved_datain = __raw_readl(bank->base + offset->datain);
> +		l1 = __raw_readl(bank->base + offset->fallingdetect);
> +		l2 = __raw_readl(bank->base + offset->risingdetect);
>  
>  		bank->saved_fallingdetect = l1;
>  		bank->saved_risingdetect = l2;
>  		l1 &= ~bank->enabled_non_wakeup_gpios;
>  		l2 &= ~bank->enabled_non_wakeup_gpios;
>  
> -		if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
> -			__raw_writel(l1, bank->base +
> -					OMAP24XX_GPIO_FALLINGDETECT);
> -			__raw_writel(l2, bank->base +
> -					OMAP24XX_GPIO_RISINGDETECT);
> -		}
> -
> -		if (cpu_is_omap44xx()) {
> -			__raw_writel(l1, bank->base + OMAP4_GPIO_FALLINGDETECT);
> -			__raw_writel(l2, bank->base + OMAP4_GPIO_RISINGDETECT);
> -		}
> +		__raw_writel(l1, bank->base + offset->fallingdetect);
> +		__raw_writel(l2, bank->base + offset->risingdetect);
>  
>  		c++;
>  	}
> @@ -1358,6 +1336,7 @@ void omap2_gpio_resume_after_idle(void)
>  	list_for_each_entry(bank, &omap_gpio_list, node) {
>  		u32 l = 0, gen, gen0, gen1;
>  		int j;
> +		struct omap_gpio_reg_offs *offset = bank->regs;

ditto

>  		if (!bank->loses_context)
>  			continue;
> @@ -1371,21 +1350,11 @@ void omap2_gpio_resume_after_idle(void)
>  		if (!(bank->enabled_non_wakeup_gpios))
>  			continue;
>  
> -		if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
> -			__raw_writel(bank->saved_fallingdetect,
> -				 bank->base + OMAP24XX_GPIO_FALLINGDETECT);
> -			__raw_writel(bank->saved_risingdetect,
> -				 bank->base + OMAP24XX_GPIO_RISINGDETECT);
> -			l = __raw_readl(bank->base + OMAP24XX_GPIO_DATAIN);
> -		}
> -
> -		if (cpu_is_omap44xx()) {
> -			__raw_writel(bank->saved_fallingdetect,
> -				 bank->base + OMAP4_GPIO_FALLINGDETECT);
> -			__raw_writel(bank->saved_risingdetect,
> -				 bank->base + OMAP4_GPIO_RISINGDETECT);
> -			l = __raw_readl(bank->base + OMAP4_GPIO_DATAIN);
> -		}
> +		__raw_writel(bank->saved_fallingdetect,
> +				bank->base + offset->fallingdetect);
> +		__raw_writel(bank->saved_risingdetect,
> +				bank->base + offset->risingdetect);
> +		l = __raw_readl(bank->base + offset->datain);
>  
>  		/* Check if any of the non-wakeup interrupt GPIOs have changed
>  		 * state.  If so, generate an IRQ by software.  This is
> @@ -1413,38 +1382,24 @@ void omap2_gpio_resume_after_idle(void)
>  		if (gen) {
>  			u32 old0, old1;
>  
> +			old0 = __raw_readl(bank->base + offset->leveldetect0);
> +			old1 = __raw_readl(bank->base + offset->leveldetect1);
> +
> +			__raw_writel(old0, bank->base + offset->leveldetect0);
> +			__raw_writel(old1, bank->base + offset->leveldetect1);
>  			if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
> -				old0 = __raw_readl(bank->base +
> -					OMAP24XX_GPIO_LEVELDETECT0);
> -				old1 = __raw_readl(bank->base +
> -					OMAP24XX_GPIO_LEVELDETECT1);
> -				__raw_writel(old0 | gen, bank->base +
> -					OMAP24XX_GPIO_LEVELDETECT0);
> -				__raw_writel(old1 | gen, bank->base +
> -					OMAP24XX_GPIO_LEVELDETECT1);
> -				__raw_writel(old0, bank->base +
> -					OMAP24XX_GPIO_LEVELDETECT0);
> -				__raw_writel(old1, bank->base +
> -					OMAP24XX_GPIO_LEVELDETECT1);
> +				old0 |= gen;
> +				old1 |= gen;
>  			}
>  
>  			if (cpu_is_omap44xx()) {
> -				old0 = __raw_readl(bank->base +
> -						OMAP4_GPIO_LEVELDETECT0);
> -				old1 = __raw_readl(bank->base +
> -						OMAP4_GPIO_LEVELDETECT1);
> -				__raw_writel(old0 | l, bank->base +
> -						OMAP4_GPIO_LEVELDETECT0);
> -				__raw_writel(old1 | l, bank->base +
> -						OMAP4_GPIO_LEVELDETECT1);
> -				__raw_writel(old0, bank->base +
> -						OMAP4_GPIO_LEVELDETECT0);
> -				__raw_writel(old1, bank->base +
> -						OMAP4_GPIO_LEVELDETECT1);
> +				old0 |= l;
> +				old1 |= l;
>  			}
> +			__raw_writel(old0, bank->base + offset->leveldetect0);
> +			__raw_writel(old1, bank->base + offset->leveldetect1);
>  		}
>  	}
> -
>  }
>  
>  #endif
> diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h
> index 81ba1f0..d4e9f3c 100644
> --- a/arch/arm/plat-omap/include/plat/gpio.h
> +++ b/arch/arm/plat-omap/include/plat/gpio.h
> @@ -189,6 +189,10 @@ struct omap_gpio_reg_offs {
>  	u16 debounce;
>  	u16 debounce_en;
>  	u16 ctrl;
> +	u16 leveldetect0;
> +	u16 leveldetect1;
> +	u16 risingdetect;
> +	u16 fallingdetect;
>  	u16 wkupstatus;
>  	u16 wkupclear;
>  	u16 wkupset;

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC PATCH 02/10] ZOOM: QUART: Request reset GPIO
  2011-05-16 11:41 ` [RFC PATCH 02/10] ZOOM: QUART: Request reset GPIO Tarun Kanti DebBarma
@ 2011-05-19 16:11   ` Kevin Hilman
  2011-05-20  8:23     ` Varadarajan, Charulatha
  0 siblings, 1 reply; 26+ messages in thread
From: Kevin Hilman @ 2011-05-19 16:11 UTC (permalink / raw)
  To: Tarun Kanti DebBarma
  Cc: linux-omap, Charulatha V, Santosh Shilimkar, Tony Lindgren

Tarun Kanti DebBarma <tarun.kanti@ti.com> writes:

> From: Charulatha V <charu@ti.com>
>
> Reset GPIO (OMAP_GPIO_152) for QUART in zoom2/zoom3 debug-board is
> not requested at all. This would lead to problems if this GPIO is
> wrongly requested. Hence request OMAP GPIO 152 for QUART RESET but
> do not apply a reset pulse as it would reset QUART and
> disturb the QUART settings.
>
> Signed-off-by: Charulatha V <charu@ti.com>
> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: Kevin Hilman <khilman@ti.com>
> Cc: Tony Lindgren <tony@atomide.com>

This is a bug fix that should be separated from this series, and sent to
l-o as a fix.  Also, please Cc linux-arm-kernel.

Feel free to add

Acked-by: Kevin Hilman <khilman@ti.com>

Thanks,

Kevin 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC PATCH 05/10] OMAP2PLUS: GPIO: Use flag to identify wkup dmn GPIO
  2011-05-16 11:41 ` [RFC PATCH 05/10] OMAP2PLUS: GPIO: Use flag to identify wkup dmn GPIO Tarun Kanti DebBarma
@ 2011-05-19 16:34   ` Kevin Hilman
  0 siblings, 0 replies; 26+ messages in thread
From: Kevin Hilman @ 2011-05-19 16:34 UTC (permalink / raw)
  To: Tarun Kanti DebBarma
  Cc: linux-omap, Charulatha V, Santosh Shilimkar, Tony Lindgren

Tarun Kanti DebBarma <tarun.kanti@ti.com> writes:

> From: Charulatha V <charu@ti.com>
>
> In omap3, save/restore context is implemented for GPIO
> banks 2-6 as GPIO bank1 is in wakeup domain. Instead
> of identifying bank's power domain by bank id, make use
> of a flag "loses_context" which is filled by
> pwrdm_can_ever_lose_context() during dev_init.
>
> For getting the powerdomain pointer, omap_hwmod_get_pwrdm()
> is used. omap_device_get_pwrdm() could not be used as the
> pwrdm information needs to be filled in pdata, whereas
> omap_device_get_pwrdm() could be used only after
> omap_device_build() call.
>
> Signed-off-by: Charulatha V <charu@ti.com>
> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: Kevin Hilman <khilman@ti.com>
> Cc: Tony Lindgren <tony@atomide.com>

Looks good.

Kevin

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC PATCH 04/10] OMAP: GPIO: Remove dependency on gpio_bank_count
  2011-05-16 11:41 ` [RFC PATCH 04/10] OMAP: GPIO: Remove dependency on gpio_bank_count Tarun Kanti DebBarma
  2011-05-19 15:42   ` Kevin Hilman
@ 2011-05-19 16:39   ` Kevin Hilman
  2011-05-20  8:30     ` Varadarajan, Charulatha
  1 sibling, 1 reply; 26+ messages in thread
From: Kevin Hilman @ 2011-05-19 16:39 UTC (permalink / raw)
  To: Tarun Kanti DebBarma
  Cc: linux-omap, Charulatha V, Santosh Shilimkar, Tony Lindgren

Tarun Kanti DebBarma <tarun.kanti@ti.com> writes:

> From: Charulatha V <charu@ti.com>
>
> gpio_bank_count is the count of number of GPIO devices
> in a SoC. Remove this dependency from the driver. Also remove
> the dependency on array of pointers to gpio_bank struct of
> all GPIO devices.
>
> The cpu_is*() checks used in omap2_gpio_prepare_for_idle() and
> omap2_gpio_resume_after_idle() would be removed in one of the
> patches in this series
>
> Signed-off-by: Charulatha V <charu@ti.com>

This is all in the right direction, but some comments about the
save/restore context...

[...]

> @@ -1497,11 +1494,16 @@ void omap2_gpio_resume_after_idle(void)
>  /* save the registers of bank 2-6 */
>  void omap_gpio_save_context(void)
>  {
> -	int i;
> +	struct gpio_bank *bank;
> +	int i = 0;
>  
>  	/* saving banks from 2-6 only since GPIO1 is in WKUP */
> -	for (i = 1; i < gpio_bank_count; i++) {
> -		struct gpio_bank *bank = &gpio_bank[i];
> +	list_for_each_entry(bank, &omap_gpio_list, node) {
> +		i++;
> +
> +		if (bank->id == 0)
> +			continue;
> +

Rather than add a list iterator here, I'd rather see the save_context
called from the prepare_for_idle, only for the specific banks needed
(and then gpio_save_context can be removed from pm34xx.c.)

Similar for restore.

If you prefer, you can do that in an additional patch on top of this
one.

Kevin

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC PATCH 02/10] ZOOM: QUART: Request reset GPIO
  2011-05-19 16:11   ` Kevin Hilman
@ 2011-05-20  8:23     ` Varadarajan, Charulatha
  0 siblings, 0 replies; 26+ messages in thread
From: Varadarajan, Charulatha @ 2011-05-20  8:23 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: Tarun Kanti DebBarma, linux-omap, Santosh Shilimkar, Tony Lindgren

On Thu, May 19, 2011 at 21:41, Kevin Hilman <khilman@ti.com> wrote:
> Tarun Kanti DebBarma <tarun.kanti@ti.com> writes:
>
>> From: Charulatha V <charu@ti.com>
>>
>> Reset GPIO (OMAP_GPIO_152) for QUART in zoom2/zoom3 debug-board is
>> not requested at all. This would lead to problems if this GPIO is
>> wrongly requested. Hence request OMAP GPIO 152 for QUART RESET but
>> do not apply a reset pulse as it would reset QUART and
>> disturb the QUART settings.
>>
>> Signed-off-by: Charulatha V <charu@ti.com>
>> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
>> Cc: Kevin Hilman <khilman@ti.com>
>> Cc: Tony Lindgren <tony@atomide.com>
>
> This is a bug fix that should be separated from this series, and sent to
> l-o as a fix.  Also, please Cc linux-arm-kernel.

ok.

>
> Feel free to add
>
> Acked-by: Kevin Hilman <khilman@ti.com>

Thanks

-V Charulatha

>
> Thanks,
>
> Kevin
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC PATCH 04/10] OMAP: GPIO: Remove dependency on gpio_bank_count
  2011-05-19 15:42   ` Kevin Hilman
@ 2011-05-20  8:27     ` Varadarajan, Charulatha
  0 siblings, 0 replies; 26+ messages in thread
From: Varadarajan, Charulatha @ 2011-05-20  8:27 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: Tarun Kanti DebBarma, linux-omap, Santosh Shilimkar, Tony Lindgren

Kevin,

On Thu, May 19, 2011 at 21:12, Kevin Hilman <khilman@ti.com> wrote:
> Tarun Kanti DebBarma <tarun.kanti@ti.com> writes:
>
>> From: Charulatha V <charu@ti.com>
>>
>> gpio_bank_count is the count of number of GPIO devices
>> in a SoC. Remove this dependency from the driver. Also remove
>> the dependency on array of pointers to gpio_bank struct of
>> all GPIO devices.
>>
>> The cpu_is*() checks used in omap2_gpio_prepare_for_idle() and
>> omap2_gpio_resume_after_idle() would be removed in one of the
>> patches in this series
>>
>> Signed-off-by: Charulatha V <charu@ti.com>
>> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
>> Cc: Kevin Hilman <khilman@ti.com>
>> Cc: Tony Lindgren <tony@atomide.com>
>
>
> Nice.  I like this direction.... Some minor comments below...
>
>> ---
>>  arch/arm/mach-omap1/gpio15xx.c         |    1 -
>>  arch/arm/mach-omap1/gpio16xx.c         |    2 -
>>  arch/arm/mach-omap1/gpio7xx.c          |    2 -
>>  arch/arm/mach-omap2/gpio.c             |    1 -
>>  arch/arm/plat-omap/gpio.c              |  157 ++++++++++++++++---------------
>>  arch/arm/plat-omap/include/plat/gpio.h |    3 -
>>  6 files changed, 81 insertions(+), 85 deletions(-)
>>

[...]

>>
>> diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
>> index 12deb1c..0b76475 100644
>> --- a/arch/arm/plat-omap/gpio.c
>> +++ b/arch/arm/plat-omap/gpio.c
>> @@ -30,7 +30,10 @@
>>  #include <mach/gpio.h>
>>  #include <asm/mach/irq.h>
>>
>> +static LIST_HEAD(omap_gpio_list);
>> +
>>  struct gpio_bank {
>> +     struct list_head node;
>>       unsigned long pbase;
>>       void __iomem *base;
>>       u16 irq;
>> @@ -57,6 +60,7 @@ struct gpio_bank {
>>       bool dbck_flag;
>>       int stride;
>>       u32 width;
>> +     u16 id;
>>
>>       void (*set_dataout)(struct gpio_bank *bank, int gpio, int enable);
>>
>> @@ -80,15 +84,6 @@ struct omap3_gpio_regs {
>>  static struct omap3_gpio_regs gpio_context[OMAP34XX_NR_GPIOS];
>>  #endif
>>
>> -/*
>> - * TODO: Cleanup gpio_bank usage as it is having information
>> - * related to all instances of the device
>> - */
>> -static struct gpio_bank *gpio_bank;
>> -
>> -/* TODO: Analyze removing gpio_bank_count usage from driver code */
>> -int gpio_bank_count;
>> -
>>  #define GPIO_INDEX(bank, gpio) (gpio % bank->width)
>>  #define GPIO_BIT(bank, gpio) (1 << GPIO_INDEX(bank, gpio))
>>  #define GPIO_MOD_CTRL_BIT    BIT(0)
>> @@ -859,23 +854,29 @@ static struct platform_device omap_mpuio_device = {
>>       /* could list the /proc/iomem resources */
>>  };
>>
>> -static inline void mpuio_init(void)
>> +static inline void mpuio_init(struct gpio_bank *bank)
>>  {
>> -     struct gpio_bank *bank = &gpio_bank[0];
>> +     static int mpuio_init_done;
>
> Why is this flag needed?   isn't the bank->method check enough?

Correct. This flag is not required.

>
>> +     if (mpuio_init_done || (bank->method != METHOD_MPUIO))
>> +             return;
>> +
>>       platform_set_drvdata(&omap_mpuio_device, bank);
>>
>>       if (platform_driver_register(&omap_mpuio_driver) == 0)
>>               (void) platform_device_register(&omap_mpuio_device);
>> +
>> +     mpuio_init_done = 1;
>>  }
>>

[...]

>>
>>       bank->base = ioremap(res->start, resource_size(res));
>>       if (!bank->base) {
>> -             dev_err(&pdev->dev, "Could not ioremap gpio bank%i\n", id);
>> -             return -ENOMEM;
>> +             dev_err(&pdev->dev, "Could not ioremap gpio bank%i\n",
>> +                             pdev->id);
>> +             ret = -ENOMEM;
>> +             goto err_free;
>>       }
>>
>>       pm_runtime_enable(bank->dev);
>>       pm_runtime_get_sync(bank->dev);
>>
>> +     mpuio_init(bank);
>
> How about moving this call into _mod_init(), and call it only when
> ->method = MPUIO.

Sure. Will do that.

-V Charulatha

>
>>       omap_gpio_mod_init(bank);
>>       omap_gpio_chip_init(bank);
>>       omap_gpio_show_rev(bank);
>
> [...]
>
> Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC PATCH 04/10] OMAP: GPIO: Remove dependency on gpio_bank_count
  2011-05-19 16:39   ` Kevin Hilman
@ 2011-05-20  8:30     ` Varadarajan, Charulatha
  0 siblings, 0 replies; 26+ messages in thread
From: Varadarajan, Charulatha @ 2011-05-20  8:30 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: Tarun Kanti DebBarma, linux-omap, Santosh Shilimkar, Tony Lindgren

Kevin,

Thanks for the comments.

On Thu, May 19, 2011 at 22:09, Kevin Hilman <khilman@ti.com> wrote:
> Tarun Kanti DebBarma <tarun.kanti@ti.com> writes:
>
>> From: Charulatha V <charu@ti.com>
>>
>> gpio_bank_count is the count of number of GPIO devices
>> in a SoC. Remove this dependency from the driver. Also remove
>> the dependency on array of pointers to gpio_bank struct of
>> all GPIO devices.
>>
>> The cpu_is*() checks used in omap2_gpio_prepare_for_idle() and
>> omap2_gpio_resume_after_idle() would be removed in one of the
>> patches in this series
>>
>> Signed-off-by: Charulatha V <charu@ti.com>
>
> This is all in the right direction, but some comments about the
> save/restore context...
>
> [...]
>
>> @@ -1497,11 +1494,16 @@ void omap2_gpio_resume_after_idle(void)
>>  /* save the registers of bank 2-6 */
>>  void omap_gpio_save_context(void)
>>  {
>> -     int i;
>> +     struct gpio_bank *bank;
>> +     int i = 0;
>>
>>       /* saving banks from 2-6 only since GPIO1 is in WKUP */
>> -     for (i = 1; i < gpio_bank_count; i++) {
>> -             struct gpio_bank *bank = &gpio_bank[i];
>> +     list_for_each_entry(bank, &omap_gpio_list, node) {
>> +             i++;
>> +
>> +             if (bank->id == 0)
>> +                     continue;
>> +
>
> Rather than add a list iterator here, I'd rather see the save_context
> called from the prepare_for_idle, only for the specific banks needed
> (and then gpio_save_context can be removed from pm34xx.c.)
>
> Similar for restore.

Okay.

>
> If you prefer, you can do that in an additional patch on top of this
> one.

Yes. I am adding a couple of more patches to this series.

-V Charulatha

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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC PATCH 06/10] OMAP: GPIO: Use USHRT_MAX for rev offset instead of -1
  2011-05-19 15:59   ` Kevin Hilman
@ 2011-05-20  8:31     ` Varadarajan, Charulatha
  2011-05-20  9:30       ` Kevin Hilman
  0 siblings, 1 reply; 26+ messages in thread
From: Varadarajan, Charulatha @ 2011-05-20  8:31 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: Tarun Kanti DebBarma, linux-omap, Santosh Shilimkar, Tony Lindgren

Kevin,

On Thu, May 19, 2011 at 21:29, Kevin Hilman <khilman@ti.com> wrote:
> Tarun Kanti DebBarma <tarun.kanti@ti.com> writes:
>
>> From: Charulatha V <charu@ti.com>
>>
>> Use USHRT_MAX for revision offset instead of -1 if revision register
>> is not available for a given SoC since rev offset is a u16 value.
>>
>> Signed-off-by: Charulatha V <charu@ti.com>
>> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
>> Cc: Kevin Hilman <khilman@ti.com>
>> Cc: Tony Lindgren <tony@atomide.com>
>
> Thanks, folded this into the original.

I could not figure out this change in the repo. Please update.

-V Charulatha

>
> Kevin
>
>> ---

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC PATCH 07/10] OMAP: GPIO: cleanup suspend and resume functions
  2011-05-16 11:41 ` [RFC PATCH 07/10] OMAP: GPIO: cleanup suspend and resume functions Tarun Kanti DebBarma
  2011-05-19 16:08   ` Kevin Hilman
@ 2011-05-20  9:20   ` Varadarajan, Charulatha
  1 sibling, 0 replies; 26+ messages in thread
From: Varadarajan, Charulatha @ 2011-05-20  9:20 UTC (permalink / raw)
  To: Tarun Kanti DebBarma
  Cc: linux-omap, Santosh Shilimkar, Kevin Hilman, Tony Lindgren

Tarun,

On Mon, May 16, 2011 at 17:11, Tarun Kanti DebBarma <tarun.kanti@ti.com> wrote:
> Since wake_status, wake_clear, wake_set is common for all banks on a given
> OMAP version it is enough to get their values once during probe().
> Also, register offsets are already initialzed according to OMAP versions
> during device registration. We no longer need these explicit checks.
>
> Signed-off-by: Tarun Kanti DebBarma <tarun.kanti@ti.com>
> Cc: Charulatha V <charu@ti.com>
> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: Kevin Hilman <khilman@ti.com>
> Cc: Tony Lindgren <tony@atomide.com>
> ---
>  arch/arm/mach-omap1/gpio16xx.c         |    3 +
>  arch/arm/mach-omap2/gpio.c             |    6 +++
>  arch/arm/plat-omap/gpio.c              |   78 +++++++------------------------
>  arch/arm/plat-omap/include/plat/gpio.h |    3 +
>  4 files changed, 30 insertions(+), 60 deletions(-)
>
> diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c
> index d886b88..bc4cc8f 100644
> --- a/arch/arm/mach-omap1/gpio16xx.c
> +++ b/arch/arm/mach-omap1/gpio16xx.c
> @@ -46,6 +46,9 @@ static struct omap_gpio_reg_offs omap16xx_mpuio_regs = {
>        .irqenable      = OMAP_MPUIO_GPIO_MASKIT,
>        .irqenable_inv  = true,
>        .ctrl           = USHRT_MAX,
> +       .wkupstatus     = OMAP1610_GPIO_WAKEUPENABLE,
> +       .wkupclear      = OMAP1610_GPIO_CLEAR_WAKEUPENA,
> +       .wkupset        = OMAP1610_GPIO_SET_WAKEUPENA,

This should have been added for omap16xx_gpio_regs and not for
omap16xx_mpuio_regs.

-V Charulatha

>  };
>
>  static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = {

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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC PATCH 06/10] OMAP: GPIO: Use USHRT_MAX for rev offset instead of -1
  2011-05-20  8:31     ` Varadarajan, Charulatha
@ 2011-05-20  9:30       ` Kevin Hilman
  0 siblings, 0 replies; 26+ messages in thread
From: Kevin Hilman @ 2011-05-20  9:30 UTC (permalink / raw)
  To: Varadarajan, Charulatha
  Cc: Tarun Kanti DebBarma, linux-omap, Santosh Shilimkar, Tony Lindgren

"Varadarajan, Charulatha" <charu@ti.com> writes:

> Kevin,
>
> On Thu, May 19, 2011 at 21:29, Kevin Hilman <khilman@ti.com> wrote:
>> Tarun Kanti DebBarma <tarun.kanti@ti.com> writes:
>>
>>> From: Charulatha V <charu@ti.com>
>>>
>>> Use USHRT_MAX for revision offset instead of -1 if revision register
>>> is not available for a given SoC since rev offset is a u16 value.
>>>
>>> Signed-off-by: Charulatha V <charu@ti.com>
>>> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
>>> Cc: Kevin Hilman <khilman@ti.com>
>>> Cc: Tony Lindgren <tony@atomide.com>
>>
>> Thanks, folded this into the original.
>
> I could not figure out this change in the repo. Please update.

You're right, I didn't push the update.

Just pushed now (may take some time to get out to kernel.org mirrors.)

Kevin

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2011-05-20  9:30 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-16 11:41 [RFC PATCH 00/10] OMAP: GPIO: cleanup GPIO driver Tarun Kanti DebBarma
2011-05-16 11:41 ` [RFC PATCH 01/10] OMAP: GPIO: Avoid cpu_is checks during module ena/disable Tarun Kanti DebBarma
2011-05-16 11:41 ` [RFC PATCH 02/10] ZOOM: QUART: Request reset GPIO Tarun Kanti DebBarma
2011-05-19 16:11   ` Kevin Hilman
2011-05-20  8:23     ` Varadarajan, Charulatha
2011-05-16 11:41 ` [RFC PATCH 03/10] OMAP2PLUS: GPIO: Fix non-wakeup GPIO and rev_ids Tarun Kanti DebBarma
2011-05-16 11:41 ` [RFC PATCH 04/10] OMAP: GPIO: Remove dependency on gpio_bank_count Tarun Kanti DebBarma
2011-05-19 15:42   ` Kevin Hilman
2011-05-20  8:27     ` Varadarajan, Charulatha
2011-05-19 16:39   ` Kevin Hilman
2011-05-20  8:30     ` Varadarajan, Charulatha
2011-05-16 11:41 ` [RFC PATCH 05/10] OMAP2PLUS: GPIO: Use flag to identify wkup dmn GPIO Tarun Kanti DebBarma
2011-05-19 16:34   ` Kevin Hilman
2011-05-16 11:41 ` [RFC PATCH 06/10] OMAP: GPIO: Use USHRT_MAX for rev offset instead of -1 Tarun Kanti DebBarma
2011-05-19 15:59   ` Kevin Hilman
2011-05-20  8:31     ` Varadarajan, Charulatha
2011-05-20  9:30       ` Kevin Hilman
2011-05-16 11:41 ` [RFC PATCH 07/10] OMAP: GPIO: cleanup suspend and resume functions Tarun Kanti DebBarma
2011-05-19 16:08   ` Kevin Hilman
2011-05-20  9:20   ` Varadarajan, Charulatha
2011-05-16 11:41 ` [RFC PATCH 08/10] OMAP: GPIO: cleanup prepare-for and resume-after idle functions Tarun Kanti DebBarma
2011-05-19 16:10   ` Kevin Hilman
2011-05-16 11:41 ` [RFC PATCH 09/10] OMAP: GPIO: cleanup omap_gpio_free and triggering functions Tarun Kanti DebBarma
2011-05-18 11:03   ` Varadarajan, Charulatha
2011-05-19 16:06   ` Kevin Hilman
2011-05-16 11:41 ` [RFC PATCH 10/10] OMAP: GPIO: remove harcoded offsets in context save and restore Tarun Kanti DebBarma

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.