Re: [PATCH v8 00/11] OMAP: GPIO: Implement GPIO as platform device

2010-12-07 Thread Tony Lindgren
* Varadarajan, Charulatha  [101125 04:39]:
> Implement OMAP GPIO module in platform device model. OMAP2+ specific GPIO
> module uses hwmod FW.

I'll add the following patch underneath this series as otherwise some
gpio_request calls will fail after this series.

Regards,

Tony


From: Tony Lindgren 
Date: Tue, 7 Dec 2010 16:26:55 -0800
Subject: [PATCH] omap: Fix gpio_request calls to happen as arch_initcall

Looks like some boards are calling gpio_request from init_irq.
This will make the request_irq fail, as GPIO will be initialized
as postcore_initcall.

Reported-by: Paul Walmsley 
Signed-off-by: Tony Lindgren 

diff --git a/arch/arm/mach-omap1/board-fsample.c 
b/arch/arm/mach-omap1/board-fsample.c
index 149fdd3..295ab67 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -120,6 +120,15 @@ static struct resource smc91x_resources[] = {
},
 };
 
+static void __init fsample_init_smc91x(void)
+{
+   fpga_write(1, H2P2_DBG_FPGA_LAN_RESET);
+   mdelay(50);
+   fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1,
+  H2P2_DBG_FPGA_LAN_RESET);
+   mdelay(50);
+}
+
 static struct mtd_partition nor_partitions[] = {
/* bootloader (U-Boot, etc) in first sector */
{
@@ -285,6 +294,8 @@ static struct omap_board_config_kernel fsample_config[] = {
 
 static void __init omap_fsample_init(void)
 {
+   fsample_init_smc91x();
+
if (gpio_request(FSAMPLE_NAND_RB_GPIO_PIN, "NAND ready") < 0)
BUG();
gpio_direction_input(FSAMPLE_NAND_RB_GPIO_PIN);
@@ -312,21 +323,11 @@ static void __init omap_fsample_init(void)
omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
-static void __init fsample_init_smc91x(void)
-{
-   fpga_write(1, H2P2_DBG_FPGA_LAN_RESET);
-   mdelay(50);
-   fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1,
-  H2P2_DBG_FPGA_LAN_RESET);
-   mdelay(50);
-}
-
 static void __init omap_fsample_init_irq(void)
 {
omap1_init_common_hw();
omap_init_irq();
omap_gpio_init();
-   fsample_init_smc91x();
 }
 
 /* Only FPGA needs to be mapped here. All others are done with ioremap */
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 197adb4..dd35efd 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -375,7 +375,6 @@ static void __init h2_init_irq(void)
omap1_init_common_hw();
omap_init_irq();
omap_gpio_init();
-   h2_init_smc91x();
 }
 
 static struct omap_usb_config h2_usb_config __initdata = {
@@ -403,6 +402,8 @@ static struct omap_board_config_kernel h2_config[] 
__initdata = {
 
 static void __init h2_init(void)
 {
+   h2_init_smc91x();
+
/* Here we assume the NOR boot config:  NOR on CS3 (possibly swapped
 * to address 0 by a dip switch), NAND on CS2B.  The NAND driver will
 * notice whether a NAND chip is enabled at probe time.
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 9126e3e..7871919 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -264,6 +264,15 @@ static struct platform_device smc91x_device = {
.resource   = smc91x_resources,
 };
 
+static void __init h3_init_smc91x(void)
+{
+   omap_cfg_reg(W15_1710_GPIO40);
+   if (gpio_request(40, "SMC91x irq") < 0) {
+   printk("Error requesting gpio 40 for smc91x irq\n");
+   return;
+   }
+}
+
 #define GPTIMER_BASE   0xFFFB1400
 #define GPTIMER_REGS(x)(0xFFFB1400 + (x * 0x800))
 #define GPTIMER_REGS_SIZE  0x46
@@ -376,6 +385,8 @@ static struct i2c_board_info __initdata h3_i2c_board_info[] 
= {
 
 static void __init h3_init(void)
 {
+   h3_init_smc91x();
+
/* Here we assume the NOR boot config:  NOR on CS3 (possibly swapped
 * to address 0 by a dip switch), NAND on CS2B.  The NAND driver will
 * notice whether a NAND chip is enabled at probe time.
@@ -422,21 +433,11 @@ static void __init h3_init(void)
h3_mmc_init();
 }
 
-static void __init h3_init_smc91x(void)
-{
-   omap_cfg_reg(W15_1710_GPIO40);
-   if (gpio_request(40, "SMC91x irq") < 0) {
-   printk("Error requesting gpio 40 for smc91x irq\n");
-   return;
-   }
-}
-
 static void __init h3_init_irq(void)
 {
omap1_init_common_hw();
omap_init_irq();
omap_gpio_init();
-   h3_init_smc91x();
 }
 
 static void __init h3_map_io(void)
diff --git a/arch/arm/mach-omap1/board-innovator.c 
b/arch/arm/mach-omap1/board-innovator.c
index dc2b86f..0feaa67 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -296,7 +296,6 @@ static void __init innovator_init_irq(void)
omap1510_fpga_init_irq();
}
 #endif
-   innovator_init_smc91x();
 }
 
 #ifdef CONFIG_ARCH_OMAP15XX
@@ -387,6 +386,8 @@ static struct omap_board_config_kern

Re: [PATCH v8 00/11] OMAP: GPIO: Implement GPIO as platform device

2010-12-04 Thread Tony Lindgren
* Varadarajan, Charulatha  [101202 06:08]:
> On Thu, Dec 2, 2010 at 15:28, Kevin Hilman  
> wrote:
> 
> >
> > Tony, you can also add
> >
> > Acked-by: Kevin Hilman 

OK, updated. Also made one more GPIO patch to allow us to deal
with the 7xx vs 15xx/16xx MPUIO registers.

Regards,

Tony
From: Tony Lindgren 
Date: Sat, 4 Dec 2010 12:39:43 -0800
Subject: [PATCH] omap1: Fix gpio mpuio bank to work for multi-omap for 7xx/15xx/16xx

We need to multiply the 7xx offset by 2 for 15xx/16xx. Use bank->stride
for that. This allows us to get rid of the duplicate defines for the
MPUIO registers.

Signed-off-by: Tony Lindgren 

--- a/arch/arm/mach-omap1/gpio15xx.c
+++ b/arch/arm/mach-omap1/gpio15xx.c
@@ -38,6 +38,7 @@ static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = {
 	.virtual_irq_start	= IH_MPUIO_BASE,
 	.bank_type		= METHOD_MPUIO,
 	.bank_width		= 16,
+	.bank_stride		= 2,
 };
 
 static struct __initdata platform_device omap15xx_mpu_gpio = {
--- a/arch/arm/mach-omap1/gpio16xx.c
+++ b/arch/arm/mach-omap1/gpio16xx.c
@@ -41,6 +41,7 @@ static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = {
 	.virtual_irq_start	= IH_MPUIO_BASE,
 	.bank_type		= METHOD_MPUIO,
 	.bank_width		= 16,
+	.bank_stride		= 2,
 };
 
 static struct __initdata platform_device omap16xx_mpu_gpio = {
--- a/arch/arm/mach-omap1/gpio7xx.c
+++ b/arch/arm/mach-omap1/gpio7xx.c
@@ -43,6 +43,7 @@ static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = {
 	.virtual_irq_start	= IH_MPUIO_BASE,
 	.bank_type		= METHOD_MPUIO,
 	.bank_width		= 32,
+	.bank_stride		= 1,
 };
 
 static struct __initdata platform_device omap7xx_mpu_gpio = {
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -159,6 +159,7 @@ struct gpio_bank {
 	u32 dbck_enable_mask;
 	struct device *dev;
 	bool dbck_flag;
+	int stride;
 };
 
 #ifdef CONFIG_ARCH_OMAP3
@@ -267,7 +268,7 @@ static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input)
 	switch (bank->method) {
 #ifdef CONFIG_ARCH_OMAP1
 	case METHOD_MPUIO:
-		reg += OMAP_MPUIO_IO_CNTL;
+		reg += OMAP_MPUIO_IO_CNTL * bank->stride;
 		break;
 #endif
 #ifdef CONFIG_ARCH_OMAP15XX
@@ -315,7 +316,7 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
 	switch (bank->method) {
 #ifdef CONFIG_ARCH_OMAP1
 	case METHOD_MPUIO:
-		reg += OMAP_MPUIO_OUTPUT;
+		reg += OMAP_MPUIO_OUTPUT * bank->stride;
 		l = __raw_readl(reg);
 		if (enable)
 			l |= 1 << gpio;
@@ -387,7 +388,7 @@ static int _get_gpio_datain(struct gpio_bank *bank, int gpio)
 	switch (bank->method) {
 #ifdef CONFIG_ARCH_OMAP1
 	case METHOD_MPUIO:
-		reg += OMAP_MPUIO_INPUT_LATCH;
+		reg += OMAP_MPUIO_INPUT_LATCH * bank->stride;
 		break;
 #endif
 #ifdef CONFIG_ARCH_OMAP15XX
@@ -433,7 +434,7 @@ static int _get_gpio_dataout(struct gpio_bank *bank, int gpio)
 	switch (bank->method) {
 #ifdef CONFIG_ARCH_OMAP1
 	case METHOD_MPUIO:
-		reg += OMAP_MPUIO_OUTPUT;
+		reg += OMAP_MPUIO_OUTPUT * bank->stride;
 		break;
 #endif
 #ifdef CONFIG_ARCH_OMAP15XX
@@ -620,7 +621,7 @@ static void _toggle_gpio_edge_triggering(struct gpio_bank *bank, int gpio)
 
 	switch (bank->method) {
 	case METHOD_MPUIO:
-		reg += OMAP_MPUIO_GPIO_INT_EDGE;
+		reg += OMAP_MPUIO_GPIO_INT_EDGE * bank->stride;
 		break;
 #ifdef CONFIG_ARCH_OMAP15XX
 	case METHOD_GPIO_1510:
@@ -654,7 +655,7 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger)
 	switch (bank->method) {
 #ifdef CONFIG_ARCH_OMAP1
 	case METHOD_MPUIO:
-		reg += OMAP_MPUIO_GPIO_INT_EDGE;
+		reg += OMAP_MPUIO_GPIO_INT_EDGE * bank->stride;
 		l = __raw_readl(reg);
 		if ((trigger & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH)
 			bank->toggle_mask |= 1 << gpio;
@@ -840,7 +841,7 @@ static u32 _get_gpio_irqbank_mask(struct gpio_bank *bank)
 	switch (bank->method) {
 #ifdef CONFIG_ARCH_OMAP1
 	case METHOD_MPUIO:
-		reg += OMAP_MPUIO_GPIO_MASKIT;
+		reg += OMAP_MPUIO_GPIO_MASKIT * bank->stride;
 		mask = 0x;
 		inv = 1;
 		break;
@@ -897,7 +898,7 @@ static void _enable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask, int enab
 	switch (bank->method) {
 #ifdef CONFIG_ARCH_OMAP1
 	case METHOD_MPUIO:
-		reg += OMAP_MPUIO_GPIO_MASKIT;
+		reg += OMAP_MPUIO_GPIO_MASKIT * bank->stride;
 		l = __raw_readl(reg);
 		if (enable)
 			l &= ~(gpio_mask);
@@ -1147,7 +1148,8 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
 	bank = get_irq_data(irq);
 #ifdef CONFIG_ARCH_OMAP1
 	if (bank->method == METHOD_MPUIO)
-		isr_reg = bank->base + OMAP_MPUIO_GPIO_INT;
+		isr_reg = bank->base +
+OMAP_MPUIO_GPIO_INT * bank->stride;
 #endif
 #ifdef CONFIG_ARCH_OMAP15XX
 	if (bank->method == METHOD_GPIO_1510)
@@ -1340,7 +1342,8 @@ static int omap_mpuio_suspend_noirq(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct gpio_bank	*bank = platform_get_drvdata(pdev);
-	void __iomem		*mask_reg = bank->base + OMAP_MPUIO_GPIO_MASKIT;
+	void __iomem		*mask_reg = bank->base +
+	OMAP_MPUIO

Re: [PATCH v8 00/11] OMAP: GPIO: Implement GPIO as platform device

2010-12-02 Thread Varadarajan, Charulatha
On Thu, Dec 2, 2010 at 15:28, Kevin Hilman  wrote:
> Tony Lindgren  writes:
>
>> * Varadarajan, Charulatha  [101125 04:39]:
>>> Implement OMAP GPIO module in platform device model. OMAP2+ specific GPIO
>>> module uses hwmod FW.
>>>
>>> Tested on OMAP2430, OMAP4430, OMAP3430 SDP boards, OMAP4430 Blaze board
>>> and zoom3 board. Verified that this patch series does not break the OMAP1
>>> build.
>>
>> I've boot tested this on N800 + 5912OSK.
>>
>> I'll apply these patches into devel-gpio branch and start merging these
>> into linux-omap master branch and into for-next for the next merge window.
>>
>> I've also added one minor fix for 16xx, will post that separately.

Tony, thanks for the patch.

>
> Tony, you can also add
>
> Acked-by: Kevin Hilman 

Thanks Kevin.

>
> for this series, as v8 now looks good for me.
>
> Thanks Charu,
>
> Kevin
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v8 00/11] OMAP: GPIO: Implement GPIO as platform device

2010-12-02 Thread Kevin Hilman
Tony Lindgren  writes:

> * Varadarajan, Charulatha  [101125 04:39]:
>> Implement OMAP GPIO module in platform device model. OMAP2+ specific GPIO
>> module uses hwmod FW.
>> 
>> Tested on OMAP2430, OMAP4430, OMAP3430 SDP boards, OMAP4430 Blaze board
>> and zoom3 board. Verified that this patch series does not break the OMAP1
>> build.
>
> I've boot tested this on N800 + 5912OSK.
>
> I'll apply these patches into devel-gpio branch and start merging these
> into linux-omap master branch and into for-next for the next merge window.
>
> I've also added one minor fix for 16xx, will post that separately.

Tony, you can also add 

Acked-by: Kevin Hilman 

for this series, as v8 now looks good for me.

Thanks Charu,

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


Re: [PATCH v8 00/11] OMAP: GPIO: Implement GPIO as platform device

2010-12-01 Thread Tony Lindgren
* Varadarajan, Charulatha  [101125 04:39]:
> Implement OMAP GPIO module in platform device model. OMAP2+ specific GPIO
> module uses hwmod FW.
> 
> Tested on OMAP2430, OMAP4430, OMAP3430 SDP boards, OMAP4430 Blaze board
> and zoom3 board. Verified that this patch series does not break the OMAP1
> build.

I've boot tested this on N800 + 5912OSK.

I'll apply these patches into devel-gpio branch and start merging these
into linux-omap master branch and into for-next for the next merge window.

I've also added one minor fix for 16xx, will post that separately.

Regards,

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