Skip to contentSkip to conversation

ARM: shmobile: INTC External IRQ pin driver on sh73a0

PATCH In review Magnus Damm 1 participant 1 message Feb 26, 2013

Subsystems (5)
lore
Share & tools
lore

Magnus Damm

author maintainer
#0 lore raw

PATCH 2/3 ARM: shmobile: INTC External IRQ pin driver on sh73a0

From: Magnus Damm <[email protected]>

Adjust the sh73a0 IRQ code to make use of the INTC External IRQ pin driver for external interrupt pins IRQ0 -> IRQ31.

This removes quite a bit of special-case code in intc-sh73a0.c but the number of lines get replaced with platform device information in setup-sh73a0.c. The PFC code is also adjusted to make gpio_to_irq() return the correct interrupt number.

At this point the DT reference implementations are not covered. In the future such code shall tie in the INTC External IRQ pin driver via DT, so this kind of verbose code is not needed for the long term DT case.

---

Tested on sh73a0 KZM9G.

Depends on:
[PATCH] irqchip: Renesas INTC External IRQ pin driver [PATCH 01/03] ARM: shmobile: irq_pin() for static IRQ pin assignment

 arch/arm/mach-shmobile/Kconfig        |    1 
 arch/arm/mach-shmobile/board-kzm9g.c  |   14 +--
 arch/arm/mach-shmobile/intc-sh73a0.c  |  117 ------------------------------
 arch/arm/mach-shmobile/setup-sh73a0.c |  126 +++++++++++++++++++++++++++++++++
 drivers/pinctrl/sh-pfc/pfc-sh73a0.c   |    6 -
 5 files changed, 137 insertions(+), 127 deletions(-)
arch/arm/mach-shmobile/Kconfig +1 -0
@@ -16,6 +16,7 @@ config ARCH_SH73A0
 	select CPU_V7
 	select I2C
 	select SH_CLK_CPG
+	select RENESAS_INTC_IRQPIN
 
 config ARCH_R8A7740
 	bool "R-Mobile A1 (R8A77400)"
arch/arm/mach-shmobile/board-kzm9g.c +7 -7
@@ -81,7 +81,7 @@ static struct resource smsc9221_resource
 		.flags	= IORESOURCE_MEM,
 	},
 	[1] = {
-		.start	= intcs_evt2irq(0x260), /* IRQ3 */
+		.start	= irq_pin(3), /* IRQ3 */
 		.flags	= IORESOURCE_IRQ,
 	},
 };
@@ -115,7 +115,7 @@ static struct resource usb_resources[]  		.flags	= IORESOURCE_MEM,
 	},
 	[1] = {
-		.start	= intcs_evt2irq(0x220), /* IRQ1 */
+		.start	= irq_pin(1), /* IRQ1 */
 		.flags	= IORESOURCE_IRQ,
 	},
 };
@@ -138,7 +138,7 @@ struct usbhs_private {
 	struct renesas_usbhs_platform_info info;
 };
 
-#define IRQ15			intcs_evt2irq(0x03e0)
+#define IRQ15			irq_pin(15)
 #define USB_PHY_MODE		(1 << 4)
 #define USB_PHY_INT_EN		((1 << 3) | (1 << 2))
 #define USB_PHY_ON		(1 << 1)
@@ -563,25 +563,25 @@ static struct i2c_board_info i2c0_device
 	},
 	{
 		I2C_BOARD_INFO("ak8975", 0x0c),
-		.irq = intcs_evt2irq(0x3380), /* IRQ28 */
+		.irq = irq_pin(28), /* IRQ28 */
 	},
 	{
 		I2C_BOARD_INFO("adxl34x", 0x1d),
-		.irq = intcs_evt2irq(0x3340), /* IRQ26 */
+		.irq = irq_pin(26), /* IRQ26 */
 	},
 };
 
 static struct i2c_board_info i2c1_devices[] = {
 	{
 		I2C_BOARD_INFO("st1232-ts", 0x55),
-		.irq = intcs_evt2irq(0x300), /* IRQ8 */
+		.irq = irq_pin(8), /* IRQ8 */
 	},
 };
 
 static struct i2c_board_info i2c3_devices[] = {
 	{
 		I2C_BOARD_INFO("pcf8575", 0x20),
-		.irq		= intcs_evt2irq(0x3260), /* IRQ19 */
+		.irq = irq_pin(19), /* IRQ19 */
 		.platform_data = &pcf8575_pdata,
 	},
 };
arch/arm/mach-shmobile/intc-sh73a0.c +0 -117

140 lines not on this page · raw message

arch/arm/mach-shmobile/setup-sh73a0.c +126 -0

144 lines not on this page · raw message

drivers/pinctrl/sh-pfc/pfc-sh73a0.c +3 -3
@@ -2733,9 +2733,9 @@ static struct pinmux_data_reg pinmux_dat
 	{ },
 };
 
-/* IRQ pins through INTCS with IRQ0->15 from 0x200 and IRQ16-31 from 0x3200 */
-#define EXT_IRQ16L(n) intcs_evt2irq(0x200 + ((n) << 5))
-#define EXT_IRQ16H(n) intcs_evt2irq(0x3200 + ((n - 16) << 5))
+/* External IRQ pins mapped at IRQPIN_BASE */
+#define EXT_IRQ16L(n) irq_pin(n)
+#define EXT_IRQ16H(n) irq_pin(n)
 
 static struct pinmux_irq pinmux_irqs[] = {
 	PINMUX_IRQ(EXT_IRQ16H(19), PORT9_FN0),