linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/8] Clean up MXC and MXS mach/gpio.h
@ 2011-08-13 16:13 Shawn Guo
  2011-08-13 16:14 ` [PATCH v2 1/8] ARM: mx5: board-cpuimx51.c fixup irq_to_gpio() usage Shawn Guo
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Shawn Guo @ 2011-08-13 16:13 UTC (permalink / raw)
  To: linux-arm-kernel

As one step to single image for multiple platforms, mach/gpio.h needs
to be removed from asm/gpio.h.  The patch set cleans up MXC and MXS
mach/gpio.h to an empty header.

It's based on v3.1-rc1 plus rmk's patch series below.

  [PATCH 00/13] Clean up mach/gpio.h headers

The Ben's fix is on the way to -rc2 through arm-soc tree.

Grant, Sascha,

Can you please review the series and give comments or your ack tag?

Regards,
Shawn

Changes since v1:
 * Add patches #7 and #8 to clean up mxs mach/gpio.h
 * Leave run-time gpio_to_irq() calls there and only convert these
   in static initializers to IMX_GPIO_TO_IRQ()
 * Mark the empty headers with /* empty */

Ben Dooks (1):
      ARM: mx5: board-cpuimx51.c fixup irq_to_gpio() usage

Shawn Guo (7):
      arm/mxc: do not use gpio_to_irq() for static initializers
      gpio/mxc: add .to_irq for gpio chip
      arm/mxc: remove gpio_to_irq() from mach/gpio.h
      gpio/mxc: move irq_to_gpio() into gpio-mxc driver
      arm/mxc: move IMX_GPIO_NR into mach/hardware.h
      gpio/mxs: move irq_to_gpio() into gpio-mxs driver
      arm/mxs: move MXS_GPIO_NR into mach/mxs.h

 arch/arm/mach-imx/mach-cpuimx35.c            |    2 +-
 arch/arm/mach-imx/mach-mx27_3ds.c            |    2 +-
 arch/arm/mach-imx/mach-vpr200.c              |    2 +-
 arch/arm/mach-mx5/board-cpuimx51.c           |    8 +++---
 arch/arm/mach-mx5/board-cpuimx51sd.c         |    4 +-
 arch/arm/mach-mx5/board-mx53_ard.c           |    4 +-
 arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c |    2 +-
 arch/arm/mach-mx5/mx51_efika.c               |    2 +-
 arch/arm/mach-mxs/include/mach/gpio.h        |   28 +--------------------
 arch/arm/mach-mxs/include/mach/mxs.h         |    2 +
 arch/arm/plat-mxc/include/mach/gpio.h        |   34 +-------------------------
 arch/arm/plat-mxc/include/mach/hardware.h    |    6 ++++
 drivers/gpio/gpio-mxc.c                      |   12 +++++++++
 drivers/gpio/gpio-mxs.c                      |    2 +
 14 files changed, 37 insertions(+), 73 deletions(-)

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

* [PATCH v2 1/8] ARM: mx5: board-cpuimx51.c fixup irq_to_gpio() usage
  2011-08-13 16:13 [PATCH v2 0/8] Clean up MXC and MXS mach/gpio.h Shawn Guo
@ 2011-08-13 16:14 ` Shawn Guo
  2011-08-13 16:14 ` [PATCH v2 2/8] arm/mxc: do not use gpio_to_irq() for static initializers Shawn Guo
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Shawn Guo @ 2011-08-13 16:14 UTC (permalink / raw)
  To: linux-arm-kernel

From: Ben Dooks <ben-linux@fluff.org>

irq_to_gpio() is being called on a GPIO so change to using
gpio_to_irq() instead.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-mx5/board-cpuimx51.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-mx5/board-cpuimx51.c b/arch/arm/mach-mx5/board-cpuimx51.c
index 7c893fa..68934ea 100644
--- a/arch/arm/mach-mx5/board-cpuimx51.c
+++ b/arch/arm/mach-mx5/board-cpuimx51.c
@@ -81,7 +81,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
 		.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
 	}, {
 		.mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x2000000),
-		.irq = irq_to_gpio(CPUIMX51_QUARTD_GPIO),
+		.irq = gpio_to_irq(CPUIMX51_QUARTD_GPIO),
 		.irqflags = IRQF_TRIGGER_HIGH,
 		.uartclk = CPUIMX51_QUART_XTAL,
 		.regshift = CPUIMX51_QUART_REGSHIFT,
-- 
1.7.4.1

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

* [PATCH v2 2/8] arm/mxc: do not use gpio_to_irq() for static initializers
  2011-08-13 16:13 [PATCH v2 0/8] Clean up MXC and MXS mach/gpio.h Shawn Guo
  2011-08-13 16:14 ` [PATCH v2 1/8] ARM: mx5: board-cpuimx51.c fixup irq_to_gpio() usage Shawn Guo
@ 2011-08-13 16:14 ` Shawn Guo
  2011-08-13 16:14 ` [PATCH v2 3/8] gpio/mxc: add .to_irq for gpio chip Shawn Guo
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Shawn Guo @ 2011-08-13 16:14 UTC (permalink / raw)
  To: linux-arm-kernel

The patch defines IMX_GPIO_TO_IRQ() in mach/hardware.h and replaces
all the uses of gpio_to_irq() in static initializers with
IMX_GPIO_TO_IRQ().

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 arch/arm/mach-imx/mach-cpuimx35.c            |    2 +-
 arch/arm/mach-imx/mach-mx27_3ds.c            |    2 +-
 arch/arm/mach-imx/mach-vpr200.c              |    2 +-
 arch/arm/mach-mx5/board-cpuimx51.c           |    8 ++++----
 arch/arm/mach-mx5/board-cpuimx51sd.c         |    4 ++--
 arch/arm/mach-mx5/board-mx53_ard.c           |    4 ++--
 arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c |    2 +-
 arch/arm/mach-mx5/mx51_efika.c               |    2 +-
 arch/arm/plat-mxc/include/mach/hardware.h    |    2 ++
 9 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/arch/arm/mach-imx/mach-cpuimx35.c b/arch/arm/mach-imx/mach-cpuimx35.c
index f39a478b..13b7041 100644
--- a/arch/arm/mach-imx/mach-cpuimx35.c
+++ b/arch/arm/mach-imx/mach-cpuimx35.c
@@ -66,7 +66,7 @@ static struct i2c_board_info eukrea_cpuimx35_i2c_devices[] = {
 		I2C_BOARD_INFO("tsc2007", 0x48),
 		.type		= "tsc2007",
 		.platform_data	= &tsc2007_info,
-		.irq		= gpio_to_irq(TSC2007_IRQGPIO),
+		.irq		= IMX_GPIO_TO_IRQ(TSC2007_IRQGPIO),
 	},
 };
 
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c
index 6fa6934..097ff42 100644
--- a/arch/arm/mach-imx/mach-mx27_3ds.c
+++ b/arch/arm/mach-imx/mach-mx27_3ds.c
@@ -359,7 +359,7 @@ static struct spi_board_info mx27_3ds_spi_devs[] __initdata = {
 		.bus_num	= 1,
 		.chip_select	= 0, /* SS0 */
 		.platform_data	= &mc13783_pdata,
-		.irq = gpio_to_irq(PMIC_INT),
+		.irq = IMX_GPIO_TO_IRQ(PMIC_INT),
 		.mode = SPI_CS_HIGH,
 	}, {
 		.modalias	= "l4f00242t03",
diff --git a/arch/arm/mach-imx/mach-vpr200.c b/arch/arm/mach-imx/mach-vpr200.c
index 7d8e012..5250283 100644
--- a/arch/arm/mach-imx/mach-vpr200.c
+++ b/arch/arm/mach-imx/mach-vpr200.c
@@ -162,7 +162,7 @@ static struct i2c_board_info vpr200_i2c_devices[] = {
 	}, {
 		I2C_BOARD_INFO("mc13892", 0x08),
 		.platform_data = &vpr200_pmic,
-		.irq = gpio_to_irq(GPIO_PMIC_INT),
+		.irq = IMX_GPIO_TO_IRQ(GPIO_PMIC_INT),
 	}
 };
 
diff --git a/arch/arm/mach-mx5/board-cpuimx51.c b/arch/arm/mach-mx5/board-cpuimx51.c
index 68934ea..49ec98e 100644
--- a/arch/arm/mach-mx5/board-cpuimx51.c
+++ b/arch/arm/mach-mx5/board-cpuimx51.c
@@ -57,7 +57,7 @@
 static struct plat_serial8250_port serial_platform_data[] = {
 	{
 		.mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x400000),
-		.irq = gpio_to_irq(CPUIMX51_QUARTA_GPIO),
+		.irq = IMX_GPIO_TO_IRQ(CPUIMX51_QUARTA_GPIO),
 		.irqflags = IRQF_TRIGGER_HIGH,
 		.uartclk = CPUIMX51_QUART_XTAL,
 		.regshift = CPUIMX51_QUART_REGSHIFT,
@@ -65,7 +65,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
 		.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
 	}, {
 		.mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x800000),
-		.irq = gpio_to_irq(CPUIMX51_QUARTB_GPIO),
+		.irq = IMX_GPIO_TO_IRQ(CPUIMX51_QUARTB_GPIO),
 		.irqflags = IRQF_TRIGGER_HIGH,
 		.uartclk = CPUIMX51_QUART_XTAL,
 		.regshift = CPUIMX51_QUART_REGSHIFT,
@@ -73,7 +73,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
 		.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
 	}, {
 		.mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x1000000),
-		.irq = gpio_to_irq(CPUIMX51_QUARTC_GPIO),
+		.irq = IMX_GPIO_TO_IRQ(CPUIMX51_QUARTC_GPIO),
 		.irqflags = IRQF_TRIGGER_HIGH,
 		.uartclk = CPUIMX51_QUART_XTAL,
 		.regshift = CPUIMX51_QUART_REGSHIFT,
@@ -81,7 +81,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
 		.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
 	}, {
 		.mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x2000000),
-		.irq = gpio_to_irq(CPUIMX51_QUARTD_GPIO),
+		.irq = IMX_GPIO_TO_IRQ(CPUIMX51_QUARTD_GPIO),
 		.irqflags = IRQF_TRIGGER_HIGH,
 		.uartclk = CPUIMX51_QUART_XTAL,
 		.regshift = CPUIMX51_QUART_REGSHIFT,
diff --git a/arch/arm/mach-mx5/board-cpuimx51sd.c b/arch/arm/mach-mx5/board-cpuimx51sd.c
index ff096d5..8badbdb 100644
--- a/arch/arm/mach-mx5/board-cpuimx51sd.c
+++ b/arch/arm/mach-mx5/board-cpuimx51sd.c
@@ -129,7 +129,7 @@ static struct i2c_board_info eukrea_cpuimx51sd_i2c_devices[] = {
 		I2C_BOARD_INFO("tsc2007", 0x49),
 		.type		= "tsc2007",
 		.platform_data	= &tsc2007_info,
-		.irq		= gpio_to_irq(TSC2007_IRQGPIO),
+		.irq		= IMX_GPIO_TO_IRQ(TSC2007_IRQGPIO),
 	},
 };
 
@@ -245,7 +245,7 @@ static struct spi_board_info cpuimx51sd_spi_device[] = {
 		.mode		= SPI_MODE_0,
 		.chip_select     = 0,
 		.platform_data   = &mcp251x_info,
-		.irq             = gpio_to_irq(CAN_IRQGPIO)
+		.irq             = IMX_GPIO_TO_IRQ(CAN_IRQGPIO)
 	},
 };
 
diff --git a/arch/arm/mach-mx5/board-mx53_ard.c b/arch/arm/mach-mx5/board-mx53_ard.c
index 76a67c4..ddc3015 100644
--- a/arch/arm/mach-mx5/board-mx53_ard.c
+++ b/arch/arm/mach-mx5/board-mx53_ard.c
@@ -134,8 +134,8 @@ static struct resource ard_smsc911x_resources[] = {
 		.flags = IORESOURCE_MEM,
 	},
 	{
-		.start =  gpio_to_irq(ARD_ETHERNET_INT_B),
-		.end =  gpio_to_irq(ARD_ETHERNET_INT_B),
+		.start =  IMX_GPIO_TO_IRQ(ARD_ETHERNET_INT_B),
+		.end =  IMX_GPIO_TO_IRQ(ARD_ETHERNET_INT_B),
 		.flags = IORESOURCE_IRQ,
 	},
 };
diff --git a/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c b/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c
index bbf4564..ab0b1b2 100644
--- a/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c
+++ b/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c
@@ -160,7 +160,7 @@ struct tsc2007_platform_data tsc2007_data = {
 static struct i2c_board_info mbimx51_i2c_devices[] = {
 	{
 		I2C_BOARD_INFO("tsc2007", 0x49),
-		.irq  = gpio_to_irq(MBIMX51_TSC2007_GPIO),
+		.irq  = IMX_GPIO_TO_IRQ(MBIMX51_TSC2007_GPIO),
 		.platform_data = &tsc2007_data,
 	}, {
 		I2C_BOARD_INFO("tlv320aic23", 0x1a),
diff --git a/arch/arm/mach-mx5/mx51_efika.c b/arch/arm/mach-mx5/mx51_efika.c
index 4435e03..2a3015a 100644
--- a/arch/arm/mach-mx5/mx51_efika.c
+++ b/arch/arm/mach-mx5/mx51_efika.c
@@ -589,7 +589,7 @@ static struct spi_board_info mx51_efika_spi_board_info[] __initdata = {
 		.bus_num = 0,
 		.chip_select = 0,
 		.platform_data = &mx51_efika_mc13892_data,
-		.irq = gpio_to_irq(EFIKAMX_PMIC),
+		.irq = IMX_GPIO_TO_IRQ(EFIKAMX_PMIC),
 	},
 };
 
diff --git a/arch/arm/plat-mxc/include/mach/hardware.h b/arch/arm/plat-mxc/include/mach/hardware.h
index a8bfd56..77f6556 100644
--- a/arch/arm/plat-mxc/include/mach/hardware.h
+++ b/arch/arm/plat-mxc/include/mach/hardware.h
@@ -116,4 +116,6 @@
 	.type = _type,							\
 }
 
+#define IMX_GPIO_TO_IRQ(gpio)	(MXC_GPIO_IRQ_START + (gpio))
+
 #endif /* __ASM_ARCH_MXC_HARDWARE_H__ */
-- 
1.7.4.1

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

* [PATCH v2 3/8] gpio/mxc: add .to_irq for gpio chip
  2011-08-13 16:13 [PATCH v2 0/8] Clean up MXC and MXS mach/gpio.h Shawn Guo
  2011-08-13 16:14 ` [PATCH v2 1/8] ARM: mx5: board-cpuimx51.c fixup irq_to_gpio() usage Shawn Guo
  2011-08-13 16:14 ` [PATCH v2 2/8] arm/mxc: do not use gpio_to_irq() for static initializers Shawn Guo
@ 2011-08-13 16:14 ` Shawn Guo
  2011-08-13 16:14 ` [PATCH v2 4/8] arm/mxc: remove gpio_to_irq() from mach/gpio.h Shawn Guo
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Shawn Guo @ 2011-08-13 16:14 UTC (permalink / raw)
  To: linux-arm-kernel

It adds .to_irq support for gpio chip, so that __gpio_to_irq in
gpiolib becomes usable.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 drivers/gpio/gpio-mxc.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index 4340aca..64aff20 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -337,6 +337,15 @@ static void __devinit mxc_gpio_get_hw(struct platform_device *pdev)
 	mxc_gpio_hwtype = hwtype;
 }
 
+static int mxc_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
+{
+	struct bgpio_chip *bgc = to_bgpio_chip(gc);
+	struct mxc_gpio_port *port =
+		container_of(bgc, struct mxc_gpio_port, bgc);
+
+	return port->virtual_irq_start + offset;
+}
+
 static int __devinit mxc_gpio_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
@@ -403,6 +412,7 @@ static int __devinit mxc_gpio_probe(struct platform_device *pdev)
 	if (err)
 		goto out_iounmap;
 
+	port->bgc.gc.to_irq = mxc_gpio_to_irq;
 	port->bgc.gc.base = pdev->id * 32;
 	port->bgc.dir = port->bgc.read_reg(port->bgc.reg_dir);
 	port->bgc.data = port->bgc.read_reg(port->bgc.reg_set);
-- 
1.7.4.1

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

* [PATCH v2 4/8] arm/mxc: remove gpio_to_irq() from mach/gpio.h
  2011-08-13 16:13 [PATCH v2 0/8] Clean up MXC and MXS mach/gpio.h Shawn Guo
                   ` (2 preceding siblings ...)
  2011-08-13 16:14 ` [PATCH v2 3/8] gpio/mxc: add .to_irq for gpio chip Shawn Guo
@ 2011-08-13 16:14 ` Shawn Guo
  2011-08-13 16:14 ` [PATCH v2 5/8] gpio/mxc: move irq_to_gpio() into gpio-mxc driver Shawn Guo
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Shawn Guo @ 2011-08-13 16:14 UTC (permalink / raw)
  To: linux-arm-kernel

As all the users of gpio_to_irq() in static initializers have been
migrated to IMX_GPIO_TO_IRQ, gpio_to_irq() can be removed from
mach/gpio.h now.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 arch/arm/plat-mxc/include/mach/gpio.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-mxc/include/mach/gpio.h b/arch/arm/plat-mxc/include/mach/gpio.h
index 3e1ffc8..9a7c750 100644
--- a/arch/arm/plat-mxc/include/mach/gpio.h
+++ b/arch/arm/plat-mxc/include/mach/gpio.h
@@ -27,7 +27,6 @@
 /* range e.g. GPIO_1_5 is gpio 5 under linux */
 #define IMX_GPIO_NR(bank, nr)		(((bank) - 1) * 32 + (nr))
 
-#define gpio_to_irq(gpio)	(MXC_GPIO_IRQ_START + (gpio))
 #define irq_to_gpio(irq)	((irq) - MXC_GPIO_IRQ_START)
 
 #endif
-- 
1.7.4.1

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

* [PATCH v2 5/8] gpio/mxc: move irq_to_gpio() into gpio-mxc driver
  2011-08-13 16:13 [PATCH v2 0/8] Clean up MXC and MXS mach/gpio.h Shawn Guo
                   ` (3 preceding siblings ...)
  2011-08-13 16:14 ` [PATCH v2 4/8] arm/mxc: remove gpio_to_irq() from mach/gpio.h Shawn Guo
@ 2011-08-13 16:14 ` Shawn Guo
  2011-08-13 16:14 ` [PATCH v2 6/8] arm/mxc: move IMX_GPIO_NR into mach/hardware.h Shawn Guo
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Shawn Guo @ 2011-08-13 16:14 UTC (permalink / raw)
  To: linux-arm-kernel

As irq_to_gpio() is only being used by gpio-mxc driver, it should be
moved from mach/gpio.h into gpio-mxc.c.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 arch/arm/plat-mxc/include/mach/gpio.h |    2 --
 drivers/gpio/gpio-mxc.c               |    2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/plat-mxc/include/mach/gpio.h b/arch/arm/plat-mxc/include/mach/gpio.h
index 9a7c750..8e5276c 100644
--- a/arch/arm/plat-mxc/include/mach/gpio.h
+++ b/arch/arm/plat-mxc/include/mach/gpio.h
@@ -27,6 +27,4 @@
 /* range e.g. GPIO_1_5 is gpio 5 under linux */
 #define IMX_GPIO_NR(bank, nr)		(((bank) - 1) * 32 + (nr))
 
-#define irq_to_gpio(irq)	((irq) - MXC_GPIO_IRQ_START)
-
 #endif
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index 64aff20..b588f8a 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -31,6 +31,8 @@
 #include <linux/of_device.h>
 #include <asm-generic/bug.h>
 
+#define irq_to_gpio(irq)	((irq) - MXC_GPIO_IRQ_START)
+
 enum mxc_gpio_hwtype {
 	IMX1_GPIO,	/* runs on i.mx1 */
 	IMX21_GPIO,	/* runs on i.mx21 and i.mx27 */
-- 
1.7.4.1

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

* [PATCH v2 6/8] arm/mxc: move IMX_GPIO_NR into mach/hardware.h
  2011-08-13 16:13 [PATCH v2 0/8] Clean up MXC and MXS mach/gpio.h Shawn Guo
                   ` (4 preceding siblings ...)
  2011-08-13 16:14 ` [PATCH v2 5/8] gpio/mxc: move irq_to_gpio() into gpio-mxc driver Shawn Guo
@ 2011-08-13 16:14 ` Shawn Guo
  2011-08-13 16:14 ` [PATCH v2 7/8] gpio/mxs: move irq_to_gpio() into gpio-mxs driver Shawn Guo
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Shawn Guo @ 2011-08-13 16:14 UTC (permalink / raw)
  To: linux-arm-kernel

The patch moves IMX_GPIO_NR into mach/hardware.h, so that mach/gpio.h
becomes an empty header and can wait for a global removal from
asm/gpio.h.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 arch/arm/plat-mxc/include/mach/gpio.h     |   31 +----------------------------
 arch/arm/plat-mxc/include/mach/hardware.h |    4 +++
 2 files changed, 5 insertions(+), 30 deletions(-)

diff --git a/arch/arm/plat-mxc/include/mach/gpio.h b/arch/arm/plat-mxc/include/mach/gpio.h
index 8e5276c..40a8c17 100644
--- a/arch/arm/plat-mxc/include/mach/gpio.h
+++ b/arch/arm/plat-mxc/include/mach/gpio.h
@@ -1,30 +1 @@
-/*
- * Copyright 2007 Freescale Semiconductor, Inc. All Rights Reserved.
- * Copyright 2008 Juergen Beisert, kernel at pengutronix.de
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-#ifndef __ASM_ARCH_MXC_GPIO_H__
-#define __ASM_ARCH_MXC_GPIO_H__
-
-#include <linux/spinlock.h>
-#include <mach/hardware.h>
-
-
-/* There's a off-by-one betweem the gpio bank number and the gpiochip */
-/* range e.g. GPIO_1_5 is gpio 5 under linux */
-#define IMX_GPIO_NR(bank, nr)		(((bank) - 1) * 32 + (nr))
-
-#endif
+/* empty */
diff --git a/arch/arm/plat-mxc/include/mach/hardware.h b/arch/arm/plat-mxc/include/mach/hardware.h
index 77f6556..f57ec47 100644
--- a/arch/arm/plat-mxc/include/mach/hardware.h
+++ b/arch/arm/plat-mxc/include/mach/hardware.h
@@ -116,6 +116,10 @@
 	.type = _type,							\
 }
 
+/* There's a off-by-one betweem the gpio bank number and the gpiochip */
+/* range e.g. GPIO_1_5 is gpio 5 under linux */
+#define IMX_GPIO_NR(bank, nr)		(((bank) - 1) * 32 + (nr))
+
 #define IMX_GPIO_TO_IRQ(gpio)	(MXC_GPIO_IRQ_START + (gpio))
 
 #endif /* __ASM_ARCH_MXC_HARDWARE_H__ */
-- 
1.7.4.1

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

* [PATCH v2 7/8] gpio/mxs: move irq_to_gpio() into gpio-mxs driver
  2011-08-13 16:13 [PATCH v2 0/8] Clean up MXC and MXS mach/gpio.h Shawn Guo
                   ` (5 preceding siblings ...)
  2011-08-13 16:14 ` [PATCH v2 6/8] arm/mxc: move IMX_GPIO_NR into mach/hardware.h Shawn Guo
@ 2011-08-13 16:14 ` Shawn Guo
  2011-08-13 16:14 ` [PATCH v2 8/8] arm/mxs: move MXS_GPIO_NR into mach/mxs.h Shawn Guo
  2011-08-16  7:19 ` [PATCH v2 0/8] Clean up MXC and MXS mach/gpio.h Sascha Hauer
  8 siblings, 0 replies; 13+ messages in thread
From: Shawn Guo @ 2011-08-13 16:14 UTC (permalink / raw)
  To: linux-arm-kernel

As irq_to_gpio() is only being used by gpio-mxs driver, it should be
moved from mach/gpio.h into gpio-mxs.c.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 arch/arm/mach-mxs/include/mach/gpio.h |    2 --
 drivers/gpio/gpio-mxs.c               |    2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-mxs/include/mach/gpio.h b/arch/arm/mach-mxs/include/mach/gpio.h
index bb11e63..8aea2ec 100644
--- a/arch/arm/mach-mxs/include/mach/gpio.h
+++ b/arch/arm/mach-mxs/include/mach/gpio.h
@@ -22,6 +22,4 @@
 
 #define MXS_GPIO_NR(bank, nr)	((bank) * 32 + (nr))
 
-#define irq_to_gpio(irq)	((irq) - MXS_GPIO_IRQ_START)
-
 #endif /* __MACH_MXS_GPIO_H__ */
diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c
index af55a85..292b504 100644
--- a/drivers/gpio/gpio-mxs.c
+++ b/drivers/gpio/gpio-mxs.c
@@ -49,6 +49,8 @@
 #define GPIO_INT_LEV_MASK	(1 << 0)
 #define GPIO_INT_POL_MASK	(1 << 1)
 
+#define irq_to_gpio(irq)	((irq) - MXS_GPIO_IRQ_START)
+
 struct mxs_gpio_port {
 	void __iomem *base;
 	int id;
-- 
1.7.4.1

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

* [PATCH v2 8/8] arm/mxs: move MXS_GPIO_NR into mach/mxs.h
  2011-08-13 16:13 [PATCH v2 0/8] Clean up MXC and MXS mach/gpio.h Shawn Guo
                   ` (6 preceding siblings ...)
  2011-08-13 16:14 ` [PATCH v2 7/8] gpio/mxs: move irq_to_gpio() into gpio-mxs driver Shawn Guo
@ 2011-08-13 16:14 ` Shawn Guo
  2011-08-16  7:19 ` [PATCH v2 0/8] Clean up MXC and MXS mach/gpio.h Sascha Hauer
  8 siblings, 0 replies; 13+ messages in thread
From: Shawn Guo @ 2011-08-13 16:14 UTC (permalink / raw)
  To: linux-arm-kernel

The patch moves MXS_GPIO_NR into mach/mxs.h, so that mach/gpio.h
becomes an empty header and can wait for a global removal from
asm/gpio.h.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 arch/arm/mach-mxs/include/mach/gpio.h |   26 +-------------------------
 arch/arm/mach-mxs/include/mach/mxs.h  |    2 ++
 2 files changed, 3 insertions(+), 25 deletions(-)

diff --git a/arch/arm/mach-mxs/include/mach/gpio.h b/arch/arm/mach-mxs/include/mach/gpio.h
index 8aea2ec..40a8c17 100644
--- a/arch/arm/mach-mxs/include/mach/gpio.h
+++ b/arch/arm/mach-mxs/include/mach/gpio.h
@@ -1,25 +1 @@
-/*
- * Copyright 2007 Freescale Semiconductor, Inc. All Rights Reserved.
- * Copyright 2008 Juergen Beisert, kernel at pengutronix.de
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-
-#ifndef __MACH_MXS_GPIO_H__
-#define __MACH_MXS_GPIO_H__
-
-#define MXS_GPIO_NR(bank, nr)	((bank) * 32 + (nr))
-
-#endif /* __MACH_MXS_GPIO_H__ */
+/* empty */
diff --git a/arch/arm/mach-mxs/include/mach/mxs.h b/arch/arm/mach-mxs/include/mach/mxs.h
index 35a89dd..5aa5f75 100644
--- a/arch/arm/mach-mxs/include/mach/mxs.h
+++ b/arch/arm/mach-mxs/include/mach/mxs.h
@@ -86,6 +86,8 @@
 	.type = _type,							\
 }
 
+#define MXS_GPIO_NR(bank, nr)	((bank) * 32 + (nr))
+
 #define MXS_SET_ADDR		0x4
 #define MXS_CLR_ADDR		0x8
 #define MXS_TOG_ADDR		0xc
-- 
1.7.4.1

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

* [PATCH v2 0/8] Clean up MXC and MXS mach/gpio.h
  2011-08-13 16:13 [PATCH v2 0/8] Clean up MXC and MXS mach/gpio.h Shawn Guo
                   ` (7 preceding siblings ...)
  2011-08-13 16:14 ` [PATCH v2 8/8] arm/mxs: move MXS_GPIO_NR into mach/mxs.h Shawn Guo
@ 2011-08-16  7:19 ` Sascha Hauer
  2011-08-17  6:25   ` Shawn Guo
  8 siblings, 1 reply; 13+ messages in thread
From: Sascha Hauer @ 2011-08-16  7:19 UTC (permalink / raw)
  To: linux-arm-kernel

Shawn,

On Sun, Aug 14, 2011 at 12:13:59AM +0800, Shawn Guo wrote:
> As one step to single image for multiple platforms, mach/gpio.h needs
> to be removed from asm/gpio.h.  The patch set cleans up MXC and MXS
> mach/gpio.h to an empty header.
> 
> It's based on v3.1-rc1 plus rmk's patch series below.
> 
>   [PATCH 00/13] Clean up mach/gpio.h headers
> 
> The Ben's fix is on the way to -rc2 through arm-soc tree.
> 
> Grant, Sascha,
> 
> Can you please review the series and give comments or your ack tag?

I'm fine with this series. I removed the dependency on rmks patches
(can be easily merged later) and checked it into my cleanup branch.
Please check if you are fine with the result.

Sascha

> 
> Regards,
> Shawn
> 
> Changes since v1:
>  * Add patches #7 and #8 to clean up mxs mach/gpio.h
>  * Leave run-time gpio_to_irq() calls there and only convert these
>    in static initializers to IMX_GPIO_TO_IRQ()
>  * Mark the empty headers with /* empty */
> 
> Ben Dooks (1):
>       ARM: mx5: board-cpuimx51.c fixup irq_to_gpio() usage
> 
> Shawn Guo (7):
>       arm/mxc: do not use gpio_to_irq() for static initializers
>       gpio/mxc: add .to_irq for gpio chip
>       arm/mxc: remove gpio_to_irq() from mach/gpio.h
>       gpio/mxc: move irq_to_gpio() into gpio-mxc driver
>       arm/mxc: move IMX_GPIO_NR into mach/hardware.h
>       gpio/mxs: move irq_to_gpio() into gpio-mxs driver
>       arm/mxs: move MXS_GPIO_NR into mach/mxs.h
> 
>  arch/arm/mach-imx/mach-cpuimx35.c            |    2 +-
>  arch/arm/mach-imx/mach-mx27_3ds.c            |    2 +-
>  arch/arm/mach-imx/mach-vpr200.c              |    2 +-
>  arch/arm/mach-mx5/board-cpuimx51.c           |    8 +++---
>  arch/arm/mach-mx5/board-cpuimx51sd.c         |    4 +-
>  arch/arm/mach-mx5/board-mx53_ard.c           |    4 +-
>  arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c |    2 +-
>  arch/arm/mach-mx5/mx51_efika.c               |    2 +-
>  arch/arm/mach-mxs/include/mach/gpio.h        |   28 +--------------------
>  arch/arm/mach-mxs/include/mach/mxs.h         |    2 +
>  arch/arm/plat-mxc/include/mach/gpio.h        |   34 +-------------------------
>  arch/arm/plat-mxc/include/mach/hardware.h    |    6 ++++
>  drivers/gpio/gpio-mxc.c                      |   12 +++++++++
>  drivers/gpio/gpio-mxs.c                      |    2 +
>  14 files changed, 37 insertions(+), 73 deletions(-)
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* [PATCH v2 0/8] Clean up MXC and MXS mach/gpio.h
  2011-08-16  7:19 ` [PATCH v2 0/8] Clean up MXC and MXS mach/gpio.h Sascha Hauer
@ 2011-08-17  6:25   ` Shawn Guo
  2011-08-17  6:47     ` Sascha Hauer
  0 siblings, 1 reply; 13+ messages in thread
From: Shawn Guo @ 2011-08-17  6:25 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Aug 16, 2011 at 09:19:50AM +0200, Sascha Hauer wrote:
> Shawn,
> 
> On Sun, Aug 14, 2011 at 12:13:59AM +0800, Shawn Guo wrote:
> > As one step to single image for multiple platforms, mach/gpio.h needs
> > to be removed from asm/gpio.h.  The patch set cleans up MXC and MXS
> > mach/gpio.h to an empty header.
> > 
> > It's based on v3.1-rc1 plus rmk's patch series below.
> > 
> >   [PATCH 00/13] Clean up mach/gpio.h headers
> > 
> > The Ben's fix is on the way to -rc2 through arm-soc tree.
> > 
> > Grant, Sascha,
> > 
> > Can you please review the series and give comments or your ack tag?
> 
> I'm fine with this series. I removed the dependency on rmks patches
> (can be easily merged later) and checked it into my cleanup branch.
> Please check if you are fine with the result.
> 
It looks all good in terms of code.  But the commit messages of the
following patches do not fit the context any more.

  arm/mxc: remove gpio_to_irq() from mach/gpio.h
  arm/mxc: move IMX_GPIO_NR into mach/hardware.h
  arm/mxs: move MXS_GPIO_NR into mach/mxs.h

-- 
Regards,
Shawn

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

* [PATCH v2 0/8] Clean up MXC and MXS mach/gpio.h
  2011-08-17  6:25   ` Shawn Guo
@ 2011-08-17  6:47     ` Sascha Hauer
  2011-08-17  7:10       ` Shawn Guo
  0 siblings, 1 reply; 13+ messages in thread
From: Sascha Hauer @ 2011-08-17  6:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 17, 2011 at 02:25:40PM +0800, Shawn Guo wrote:
> On Tue, Aug 16, 2011 at 09:19:50AM +0200, Sascha Hauer wrote:
> > Shawn,
> > 
> > On Sun, Aug 14, 2011 at 12:13:59AM +0800, Shawn Guo wrote:
> > > As one step to single image for multiple platforms, mach/gpio.h needs
> > > to be removed from asm/gpio.h.  The patch set cleans up MXC and MXS
> > > mach/gpio.h to an empty header.
> > > 
> > > It's based on v3.1-rc1 plus rmk's patch series below.
> > > 
> > >   [PATCH 00/13] Clean up mach/gpio.h headers
> > > 
> > > The Ben's fix is on the way to -rc2 through arm-soc tree.
> > > 
> > > Grant, Sascha,
> > > 
> > > Can you please review the series and give comments or your ack tag?
> > 
> > I'm fine with this series. I removed the dependency on rmks patches
> > (can be easily merged later) and checked it into my cleanup branch.
> > Please check if you are fine with the result.
> > 
> It looks all good in terms of code.  But the commit messages of the
> following patches do not fit the context any more.

Yes, you are right. Changed it to the following

> 
>   arm/mxc: remove gpio_to_irq() from mach/gpio.h

    arm/mxc: use gpiolib helper for gpio_to_irq
    
    As all the users of gpio_to_irq() in static initializers have been
    migrated to IMX_GPIO_TO_IRQ, we can start using the standard gpiolib
    helper for gpio_to_irq().

>   arm/mxc: move IMX_GPIO_NR into mach/hardware.h

    arm/mxc: move IMX_GPIO_NR into mach/hardware.h
    
    The patch moves IMX_GPIO_NR into mach/hardware.h, so that we only
    use standard gpiolib helpers in mach/gpio.h.

>   arm/mxs: move MXS_GPIO_NR into mach/mxs.h

    arm/mxs: move MXS_GPIO_NR into mach/mxs.h
    
    The patch moves MXS_GPIO_NR into mach/mxs.h, so that we only use
    standard gpiolib helpers in mach/gpio.h.


Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* [PATCH v2 0/8] Clean up MXC and MXS mach/gpio.h
  2011-08-17  6:47     ` Sascha Hauer
@ 2011-08-17  7:10       ` Shawn Guo
  0 siblings, 0 replies; 13+ messages in thread
From: Shawn Guo @ 2011-08-17  7:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 17, 2011 at 08:47:37AM +0200, Sascha Hauer wrote:
> On Wed, Aug 17, 2011 at 02:25:40PM +0800, Shawn Guo wrote:
> > On Tue, Aug 16, 2011 at 09:19:50AM +0200, Sascha Hauer wrote:
> > > Shawn,
> > > 
> > > On Sun, Aug 14, 2011 at 12:13:59AM +0800, Shawn Guo wrote:
> > > > As one step to single image for multiple platforms, mach/gpio.h needs
> > > > to be removed from asm/gpio.h.  The patch set cleans up MXC and MXS
> > > > mach/gpio.h to an empty header.
> > > > 
> > > > It's based on v3.1-rc1 plus rmk's patch series below.
> > > > 
> > > >   [PATCH 00/13] Clean up mach/gpio.h headers
> > > > 
> > > > The Ben's fix is on the way to -rc2 through arm-soc tree.
> > > > 
> > > > Grant, Sascha,
> > > > 
> > > > Can you please review the series and give comments or your ack tag?
> > > 
> > > I'm fine with this series. I removed the dependency on rmks patches
> > > (can be easily merged later) and checked it into my cleanup branch.
> > > Please check if you are fine with the result.
> > > 
> > It looks all good in terms of code.  But the commit messages of the
> > following patches do not fit the context any more.
> 
> Yes, you are right. Changed it to the following
> 
> > 
> >   arm/mxc: remove gpio_to_irq() from mach/gpio.h
> 
>     arm/mxc: use gpiolib helper for gpio_to_irq
>     
>     As all the users of gpio_to_irq() in static initializers have been
>     migrated to IMX_GPIO_TO_IRQ, we can start using the standard gpiolib
>     helper for gpio_to_irq().
> 
> >   arm/mxc: move IMX_GPIO_NR into mach/hardware.h
> 
>     arm/mxc: move IMX_GPIO_NR into mach/hardware.h
>     
>     The patch moves IMX_GPIO_NR into mach/hardware.h, so that we only
>     use standard gpiolib helpers in mach/gpio.h.
> 
> >   arm/mxs: move MXS_GPIO_NR into mach/mxs.h
> 
>     arm/mxs: move MXS_GPIO_NR into mach/mxs.h
>     
>     The patch moves MXS_GPIO_NR into mach/mxs.h, so that we only use
>     standard gpiolib helpers in mach/gpio.h.
> 
Looks all good now.

-- 
Regards,
Shawn

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

end of thread, other threads:[~2011-08-17  7:10 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-13 16:13 [PATCH v2 0/8] Clean up MXC and MXS mach/gpio.h Shawn Guo
2011-08-13 16:14 ` [PATCH v2 1/8] ARM: mx5: board-cpuimx51.c fixup irq_to_gpio() usage Shawn Guo
2011-08-13 16:14 ` [PATCH v2 2/8] arm/mxc: do not use gpio_to_irq() for static initializers Shawn Guo
2011-08-13 16:14 ` [PATCH v2 3/8] gpio/mxc: add .to_irq for gpio chip Shawn Guo
2011-08-13 16:14 ` [PATCH v2 4/8] arm/mxc: remove gpio_to_irq() from mach/gpio.h Shawn Guo
2011-08-13 16:14 ` [PATCH v2 5/8] gpio/mxc: move irq_to_gpio() into gpio-mxc driver Shawn Guo
2011-08-13 16:14 ` [PATCH v2 6/8] arm/mxc: move IMX_GPIO_NR into mach/hardware.h Shawn Guo
2011-08-13 16:14 ` [PATCH v2 7/8] gpio/mxs: move irq_to_gpio() into gpio-mxs driver Shawn Guo
2011-08-13 16:14 ` [PATCH v2 8/8] arm/mxs: move MXS_GPIO_NR into mach/mxs.h Shawn Guo
2011-08-16  7:19 ` [PATCH v2 0/8] Clean up MXC and MXS mach/gpio.h Sascha Hauer
2011-08-17  6:25   ` Shawn Guo
2011-08-17  6:47     ` Sascha Hauer
2011-08-17  7:10       ` Shawn Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).