Commit 4929f5a8 authored by Haojian Zhuang's avatar Haojian Zhuang

ARM: pxa: rename gpio_to_irq and irq_to_gpio

Avoid to define gpio_to_irq() and irq_to_gpio() for potential name
confliction since multiple architecture will be built together.
Signed-off-by: default avatarHaojian Zhuang <haojian.zhuang@marvell.com>
parent 87c49e20
...@@ -120,8 +120,8 @@ static struct resource smc91x_resources[] = { ...@@ -120,8 +120,8 @@ static struct resource smc91x_resources[] = {
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}, },
[1] = { [1] = {
.start = gpio_to_irq(27), .start = MMP_GPIO_TO_IRQ(27),
.end = gpio_to_irq(27), .end = MMP_GPIO_TO_IRQ(27),
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
} }
}; };
......
...@@ -87,8 +87,8 @@ static struct resource smc91x_resources[] = { ...@@ -87,8 +87,8 @@ static struct resource smc91x_resources[] = {
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}, },
[1] = { [1] = {
.start = gpio_to_irq(155), .start = MMP_GPIO_TO_IRQ(155),
.end = gpio_to_irq(155), .end = MMP_GPIO_TO_IRQ(155),
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
} }
}; };
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define __ASM_MACH_GPIO_PXA_H #define __ASM_MACH_GPIO_PXA_H
#include <mach/addr-map.h> #include <mach/addr-map.h>
#include <mach/cputype.h>
#include <mach/irqs.h> #include <mach/irqs.h>
#define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000) #define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000)
......
...@@ -3,9 +3,6 @@ ...@@ -3,9 +3,6 @@
#include <asm-generic/gpio.h> #include <asm-generic/gpio.h>
#define gpio_to_irq(gpio) (IRQ_GPIO_START + (gpio))
#define irq_to_gpio(irq) ((irq) - IRQ_GPIO_START)
#define __gpio_is_inverted(gpio) (0) #define __gpio_is_inverted(gpio) (0)
#define __gpio_is_occupied(gpio) (0) #define __gpio_is_occupied(gpio) (0)
......
...@@ -221,6 +221,7 @@ ...@@ -221,6 +221,7 @@
#define IRQ_GPIO_START 128 #define IRQ_GPIO_START 128
#define IRQ_GPIO_NUM 192 #define IRQ_GPIO_NUM 192
#define IRQ_GPIO(x) (IRQ_GPIO_START + (x)) #define IRQ_GPIO(x) (IRQ_GPIO_START + (x))
#define MMP_GPIO_TO_IRQ(gpio) (IRQ_GPIO_START + (gpio))
#define IRQ_BOARD_START (IRQ_GPIO_START + IRQ_GPIO_NUM) #define IRQ_BOARD_START (IRQ_GPIO_START + IRQ_GPIO_NUM)
......
...@@ -71,8 +71,8 @@ static struct resource smc91x_resources[] = { ...@@ -71,8 +71,8 @@ static struct resource smc91x_resources[] = {
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}, },
[1] = { [1] = {
.start = gpio_to_irq(80), .start = MMP_GPIO_TO_IRQ(80),
.end = gpio_to_irq(80), .end = MMP_GPIO_TO_IRQ(80),
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
} }
}; };
......
...@@ -66,7 +66,7 @@ static struct pxa27x_keypad_platform_data teton_bga_keypad_info __initdata = { ...@@ -66,7 +66,7 @@ static struct pxa27x_keypad_platform_data teton_bga_keypad_info __initdata = {
static struct i2c_board_info teton_bga_i2c_info[] __initdata = { static struct i2c_board_info teton_bga_i2c_info[] __initdata = {
{ {
I2C_BOARD_INFO("ds1337", 0x68), I2C_BOARD_INFO("ds1337", 0x68),
.irq = gpio_to_irq(RTC_INT_GPIO) .irq = MMP_GPIO_TO_IRQ(RTC_INT_GPIO)
}, },
}; };
......
...@@ -50,8 +50,8 @@ static struct resource capc7117_ide_resources[] = { ...@@ -50,8 +50,8 @@ static struct resource capc7117_ide_resources[] = {
.flags = IORESOURCE_MEM .flags = IORESOURCE_MEM
}, },
[2] = { [2] = {
.start = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO76)), .start = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO76)),
.end = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO76)), .end = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO76)),
.flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING
} }
}; };
...@@ -80,7 +80,7 @@ static void __init capc7117_ide_init(void) ...@@ -80,7 +80,7 @@ static void __init capc7117_ide_init(void)
static struct plat_serial8250_port ti16c752_platform_data[] = { static struct plat_serial8250_port ti16c752_platform_data[] = {
[0] = { [0] = {
.mapbase = 0x14000000, .mapbase = 0x14000000,
.irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO78)), .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO78)),
.irqflags = IRQF_TRIGGER_RISING, .irqflags = IRQF_TRIGGER_RISING,
.flags = TI16C752_FLAGS, .flags = TI16C752_FLAGS,
.iotype = UPIO_MEM, .iotype = UPIO_MEM,
...@@ -89,7 +89,7 @@ static struct plat_serial8250_port ti16c752_platform_data[] = { ...@@ -89,7 +89,7 @@ static struct plat_serial8250_port ti16c752_platform_data[] = {
}, },
[1] = { [1] = {
.mapbase = 0x14000040, .mapbase = 0x14000040,
.irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO79)), .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO79)),
.irqflags = IRQF_TRIGGER_RISING, .irqflags = IRQF_TRIGGER_RISING,
.flags = TI16C752_FLAGS, .flags = TI16C752_FLAGS,
.iotype = UPIO_MEM, .iotype = UPIO_MEM,
...@@ -98,7 +98,7 @@ static struct plat_serial8250_port ti16c752_platform_data[] = { ...@@ -98,7 +98,7 @@ static struct plat_serial8250_port ti16c752_platform_data[] = {
}, },
[2] = { [2] = {
.mapbase = 0x14000080, .mapbase = 0x14000080,
.irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO80)), .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO80)),
.irqflags = IRQF_TRIGGER_RISING, .irqflags = IRQF_TRIGGER_RISING,
.flags = TI16C752_FLAGS, .flags = TI16C752_FLAGS,
.iotype = UPIO_MEM, .iotype = UPIO_MEM,
...@@ -107,7 +107,7 @@ static struct plat_serial8250_port ti16c752_platform_data[] = { ...@@ -107,7 +107,7 @@ static struct plat_serial8250_port ti16c752_platform_data[] = {
}, },
[3] = { [3] = {
.mapbase = 0x140000c0, .mapbase = 0x140000c0,
.irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO81)), .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO81)),
.irqflags = IRQF_TRIGGER_RISING, .irqflags = IRQF_TRIGGER_RISING,
.flags = TI16C752_FLAGS, .flags = TI16C752_FLAGS,
.iotype = UPIO_MEM, .iotype = UPIO_MEM,
......
...@@ -380,7 +380,7 @@ static struct spi_board_info cm_x270_spi_devices[] __initdata = { ...@@ -380,7 +380,7 @@ static struct spi_board_info cm_x270_spi_devices[] __initdata = {
.modalias = "libertas_spi", .modalias = "libertas_spi",
.max_speed_hz = 13000000, .max_speed_hz = 13000000,
.bus_num = 2, .bus_num = 2,
.irq = gpio_to_irq(95), .irq = PXA_GPIO_TO_IRQ(95),
.chip_select = 0, .chip_select = 0,
.controller_data = &cm_x270_libertas_chip, .controller_data = &cm_x270_libertas_chip,
.platform_data = &cm_x270_libertas_pdata, .platform_data = &cm_x270_libertas_pdata,
......
...@@ -218,8 +218,8 @@ static struct resource colibri_pxa270_dm9000_resources[] = { ...@@ -218,8 +218,8 @@ static struct resource colibri_pxa270_dm9000_resources[] = {
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}, },
{ {
.start = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ), .start = PXA_GPIO_TO_IRQ(GPIO114_COLIBRI_PXA270_ETH_IRQ),
.end = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ), .end = PXA_GPIO_TO_IRQ(GPIO114_COLIBRI_PXA270_ETH_IRQ),
.flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING, .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
}, },
}; };
...@@ -249,7 +249,7 @@ static pxa2xx_audio_ops_t colibri_pxa270_ac97_pdata = { ...@@ -249,7 +249,7 @@ static pxa2xx_audio_ops_t colibri_pxa270_ac97_pdata = {
}; };
static struct ucb1400_pdata colibri_pxa270_ucb1400_pdata = { static struct ucb1400_pdata colibri_pxa270_ucb1400_pdata = {
.irq = gpio_to_irq(GPIO113_COLIBRI_PXA270_TS_IRQ), .irq = PXA_GPIO_TO_IRQ(GPIO113_COLIBRI_PXA270_TS_IRQ),
}; };
static struct platform_device colibri_pxa270_ucb1400_device = { static struct platform_device colibri_pxa270_ucb1400_device = {
......
...@@ -78,8 +78,8 @@ static struct resource colibri_asix_resource[] = { ...@@ -78,8 +78,8 @@ static struct resource colibri_asix_resource[] = {
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}, },
[1] = { [1] = {
.start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), .start = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
.end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), .end = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
.flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING, .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
} }
}; };
......
...@@ -115,8 +115,8 @@ static struct resource colibri_asix_resource[] = { ...@@ -115,8 +115,8 @@ static struct resource colibri_asix_resource[] = {
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}, },
[1] = { [1] = {
.start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), .start = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
.end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), .end = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
.flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING, .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
} }
}; };
......
...@@ -531,7 +531,7 @@ static struct spi_board_info corgi_spi_devices[] = { ...@@ -531,7 +531,7 @@ static struct spi_board_info corgi_spi_devices[] = {
.chip_select = 0, .chip_select = 0,
.platform_data = &corgi_ads7846_info, .platform_data = &corgi_ads7846_info,
.controller_data= &corgi_ads7846_chip, .controller_data= &corgi_ads7846_chip,
.irq = gpio_to_irq(CORGI_GPIO_TP_INT), .irq = PXA_GPIO_TO_IRQ(CORGI_GPIO_TP_INT),
}, { }, {
.modalias = "corgi-lcd", .modalias = "corgi-lcd",
.max_speed_hz = 50000, .max_speed_hz = 50000,
......
...@@ -252,8 +252,8 @@ static struct resource asic3_resources[] = { ...@@ -252,8 +252,8 @@ static struct resource asic3_resources[] = {
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}, },
[1] = { [1] = {
.start = gpio_to_irq(GPIO12_HX4700_ASIC3_IRQ), .start = PXA_GPIO_TO_IRQ(GPIO12_HX4700_ASIC3_IRQ),
.end = gpio_to_irq(GPIO12_HX4700_ASIC3_IRQ), .end = PXA_GPIO_TO_IRQ(GPIO12_HX4700_ASIC3_IRQ),
.flags = IORESOURCE_IRQ, .flags = IORESOURCE_IRQ,
}, },
/* SD part */ /* SD part */
...@@ -263,8 +263,8 @@ static struct resource asic3_resources[] = { ...@@ -263,8 +263,8 @@ static struct resource asic3_resources[] = {
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}, },
[3] = { [3] = {
.start = gpio_to_irq(GPIO66_HX4700_ASIC3_nSDIO_IRQ), .start = PXA_GPIO_TO_IRQ(GPIO66_HX4700_ASIC3_nSDIO_IRQ),
.end = gpio_to_irq(GPIO66_HX4700_ASIC3_nSDIO_IRQ), .end = PXA_GPIO_TO_IRQ(GPIO66_HX4700_ASIC3_nSDIO_IRQ),
.flags = IORESOURCE_IRQ, .flags = IORESOURCE_IRQ,
}, },
}; };
...@@ -587,7 +587,7 @@ static struct spi_board_info tsc2046_board_info[] __initdata = { ...@@ -587,7 +587,7 @@ static struct spi_board_info tsc2046_board_info[] __initdata = {
.modalias = "ads7846", .modalias = "ads7846",
.bus_num = 2, .bus_num = 2,
.max_speed_hz = 2600000, /* 100 kHz sample rate */ .max_speed_hz = 2600000, /* 100 kHz sample rate */
.irq = gpio_to_irq(GPIO58_HX4700_TSC2046_nPENIRQ), .irq = PXA_GPIO_TO_IRQ(GPIO58_HX4700_TSC2046_nPENIRQ),
.platform_data = &tsc2046_info, .platform_data = &tsc2046_info,
.controller_data = &tsc2046_chip, .controller_data = &tsc2046_chip,
}, },
...@@ -635,15 +635,15 @@ static struct resource power_supply_resources[] = { ...@@ -635,15 +635,15 @@ static struct resource power_supply_resources[] = {
.name = "ac", .name = "ac",
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
IORESOURCE_IRQ_LOWEDGE, IORESOURCE_IRQ_LOWEDGE,
.start = gpio_to_irq(GPIOD9_nAC_IN), .start = PXA_GPIO_TO_IRQ(GPIOD9_nAC_IN),
.end = gpio_to_irq(GPIOD9_nAC_IN), .end = PXA_GPIO_TO_IRQ(GPIOD9_nAC_IN),
}, },
[1] = { [1] = {
.name = "usb", .name = "usb",
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
IORESOURCE_IRQ_LOWEDGE, IORESOURCE_IRQ_LOWEDGE,
.start = gpio_to_irq(GPIOD14_nUSBC_DETECT), .start = PXA_GPIO_TO_IRQ(GPIOD14_nUSBC_DETECT),
.end = gpio_to_irq(GPIOD14_nUSBC_DETECT), .end = PXA_GPIO_TO_IRQ(GPIOD14_nUSBC_DETECT),
}, },
}; };
......
...@@ -86,7 +86,7 @@ static struct spi_board_info mcp251x_board_info[] = { ...@@ -86,7 +86,7 @@ static struct spi_board_info mcp251x_board_info[] = {
.chip_select = 0, .chip_select = 0,
.platform_data = &mcp251x_info, .platform_data = &mcp251x_info,
.controller_data = &mcp251x_chip_info1, .controller_data = &mcp251x_chip_info1,
.irq = gpio_to_irq(ICONTROL_MCP251x_nIRQ1) .irq = PXA_GPIO_TO_IRQ(ICONTROL_MCP251x_nIRQ1)
}, },
{ {
.modalias = "mcp2515", .modalias = "mcp2515",
...@@ -95,7 +95,7 @@ static struct spi_board_info mcp251x_board_info[] = { ...@@ -95,7 +95,7 @@ static struct spi_board_info mcp251x_board_info[] = {
.chip_select = 1, .chip_select = 1,
.platform_data = &mcp251x_info, .platform_data = &mcp251x_info,
.controller_data = &mcp251x_chip_info2, .controller_data = &mcp251x_chip_info2,
.irq = gpio_to_irq(ICONTROL_MCP251x_nIRQ2) .irq = PXA_GPIO_TO_IRQ(ICONTROL_MCP251x_nIRQ2)
}, },
{ {
.modalias = "mcp2515", .modalias = "mcp2515",
...@@ -104,7 +104,7 @@ static struct spi_board_info mcp251x_board_info[] = { ...@@ -104,7 +104,7 @@ static struct spi_board_info mcp251x_board_info[] = {
.chip_select = 0, .chip_select = 0,
.platform_data = &mcp251x_info, .platform_data = &mcp251x_info,
.controller_data = &mcp251x_chip_info3, .controller_data = &mcp251x_chip_info3,
.irq = gpio_to_irq(ICONTROL_MCP251x_nIRQ3) .irq = PXA_GPIO_TO_IRQ(ICONTROL_MCP251x_nIRQ3)
}, },
{ {
.modalias = "mcp2515", .modalias = "mcp2515",
...@@ -113,7 +113,7 @@ static struct spi_board_info mcp251x_board_info[] = { ...@@ -113,7 +113,7 @@ static struct spi_board_info mcp251x_board_info[] = {
.chip_select = 1, .chip_select = 1,
.platform_data = &mcp251x_info, .platform_data = &mcp251x_info,
.controller_data = &mcp251x_chip_info4, .controller_data = &mcp251x_chip_info4,
.irq = gpio_to_irq(ICONTROL_MCP251x_nIRQ4) .irq = PXA_GPIO_TO_IRQ(ICONTROL_MCP251x_nIRQ4)
} }
}; };
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
#define CSB726_FLASH_SIZE (64 * 1024 * 1024) #define CSB726_FLASH_SIZE (64 * 1024 * 1024)
#define CSB726_FLASH_uMON (8 * 1024 * 1024) #define CSB726_FLASH_uMON (8 * 1024 * 1024)
#define CSB726_IRQ_LAN gpio_to_irq(CSB726_GPIO_IRQ_LAN) #define CSB726_IRQ_LAN PXA_GPIO_TO_IRQ(CSB726_GPIO_IRQ_LAN)
#define CSB726_IRQ_SM501 gpio_to_irq(CSB726_GPIO_IRQ_SM501) #define CSB726_IRQ_SM501 PXA_GPIO_TO_IRQ(CSB726_GPIO_IRQ_SM501)
#endif #endif
...@@ -28,8 +28,5 @@ ...@@ -28,8 +28,5 @@
/* The defines for the driver are needed for the accelerated accessors */ /* The defines for the driver are needed for the accelerated accessors */
#include "gpio-pxa.h" #include "gpio-pxa.h"
#define gpio_to_irq(gpio) PXA_GPIO_TO_IRQ(gpio)
#define irq_to_gpio(irq) (irq - PXA_GPIO_TO_IRQ(0))
#include <plat/gpio.h> #include <plat/gpio.h>
#endif #endif
...@@ -395,7 +395,7 @@ static struct i2c_board_info littleton_i2c_info[] = { ...@@ -395,7 +395,7 @@ static struct i2c_board_info littleton_i2c_info[] = {
.type = "da9034", .type = "da9034",
.addr = 0x34, .addr = 0x34,
.platform_data = &littleton_da9034_info, .platform_data = &littleton_da9034_info,
.irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO18)), .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO18)),
}, },
[1] = { [1] = {
.type = "max7320", .type = "max7320",
......
...@@ -184,8 +184,8 @@ static struct resource egpio_resources[] = { ...@@ -184,8 +184,8 @@ static struct resource egpio_resources[] = {
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}, },
[1] = { [1] = {
.start = gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ), .start = PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ),
.end = gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ), .end = PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ),
.flags = IORESOURCE_IRQ, .flags = IORESOURCE_IRQ,
}, },
}; };
...@@ -468,8 +468,8 @@ static struct resource pasic3_resources[] = { ...@@ -468,8 +468,8 @@ static struct resource pasic3_resources[] = {
}, },
/* No IRQ handler in the PASIC3, DS1WM needs an external IRQ */ /* No IRQ handler in the PASIC3, DS1WM needs an external IRQ */
[1] = { [1] = {
.start = gpio_to_irq(GPIO107_MAGICIAN_DS1WM_IRQ), .start = PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ),
.end = gpio_to_irq(GPIO107_MAGICIAN_DS1WM_IRQ), .end = PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ),
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
} }
}; };
......
...@@ -541,15 +541,15 @@ static struct pda_power_pdata power_pdata = { ...@@ -541,15 +541,15 @@ static struct pda_power_pdata power_pdata = {
static struct resource power_resources[] = { static struct resource power_resources[] = {
[0] = { [0] = {
.name = "ac", .name = "ac",
.start = gpio_to_irq(GPIO96_AC_DETECT), .start = PXA_GPIO_TO_IRQ(GPIO96_AC_DETECT),
.end = gpio_to_irq(GPIO96_AC_DETECT), .end = PXA_GPIO_TO_IRQ(GPIO96_AC_DETECT),
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
IORESOURCE_IRQ_LOWEDGE, IORESOURCE_IRQ_LOWEDGE,
}, },
[1] = { [1] = {
.name = "usb", .name = "usb",
.start = gpio_to_irq(GPIO13_nUSB_DETECT), .start = PXA_GPIO_TO_IRQ(GPIO13_nUSB_DETECT),
.end = gpio_to_irq(GPIO13_nUSB_DETECT), .end = PXA_GPIO_TO_IRQ(GPIO13_nUSB_DETECT),
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
IORESOURCE_IRQ_LOWEDGE, IORESOURCE_IRQ_LOWEDGE,
}, },
......
...@@ -416,8 +416,8 @@ static struct resource dm9k_resources[] = { ...@@ -416,8 +416,8 @@ static struct resource dm9k_resources[] = {
.flags = IORESOURCE_MEM .flags = IORESOURCE_MEM
}, },
[2] = { [2] = {
.start = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO9)), .start = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO9)),
.end = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO9)), .end = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO9)),
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE
} }
}; };
......
...@@ -212,7 +212,7 @@ static struct spi_board_info poodle_spi_devices[] = { ...@@ -212,7 +212,7 @@ static struct spi_board_info poodle_spi_devices[] = {
.bus_num = 1, .bus_num = 1,
.platform_data = &poodle_ads7846_info, .platform_data = &poodle_ads7846_info,
.controller_data= &poodle_ads7846_chip, .controller_data= &poodle_ads7846_chip,
.irq = gpio_to_irq(POODLE_GPIO_TP_INT), .irq = PXA_GPIO_TO_IRQ(POODLE_GPIO_TP_INT),
}, },
}; };
......
...@@ -287,7 +287,7 @@ static inline void pxa25x_init_pm(void) {} ...@@ -287,7 +287,7 @@ static inline void pxa25x_init_pm(void) {}
static int pxa25x_set_wake(struct irq_data *d, unsigned int on) static int pxa25x_set_wake(struct irq_data *d, unsigned int on)
{ {
int gpio = irq_to_gpio(d->irq); int gpio = pxa_irq_to_gpio(d->irq);
uint32_t mask = 0; uint32_t mask = 0;
if (gpio >= 0 && gpio < 85) if (gpio >= 0 && gpio < 85)
......
...@@ -355,7 +355,7 @@ static inline void pxa27x_init_pm(void) {} ...@@ -355,7 +355,7 @@ static inline void pxa27x_init_pm(void) {}
*/ */
static int pxa27x_set_wake(struct irq_data *d, unsigned int on) static int pxa27x_set_wake(struct irq_data *d, unsigned int on)
{ {
int gpio = irq_to_gpio(d->irq); int gpio = pxa_irq_to_gpio(d->irq);
uint32_t mask; uint32_t mask;
if (gpio >= 0 && gpio < 128) if (gpio >= 0 && gpio < 128)
......
...@@ -292,8 +292,8 @@ static struct resource smc91x_resources[] = { ...@@ -292,8 +292,8 @@ static struct resource smc91x_resources[] = {
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}, },
{ {
.start = gpio_to_irq(GPIO_ETH_IRQ), .start = PXA_GPIO_TO_IRQ(GPIO_ETH_IRQ),
.end = gpio_to_irq(GPIO_ETH_IRQ), .end = PXA_GPIO_TO_IRQ(GPIO_ETH_IRQ),
.flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING, .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
} }
}; };
...@@ -671,7 +671,7 @@ static struct lis3lv02d_platform_data lis3_pdata = { ...@@ -671,7 +671,7 @@ static struct lis3lv02d_platform_data lis3_pdata = {
.chip_select = 1, \ .chip_select = 1, \
.controller_data = (void *) GPIO_ACCEL_CS, \ .controller_data = (void *) GPIO_ACCEL_CS, \
.platform_data = &lis3_pdata, \ .platform_data = &lis3_pdata, \
.irq = gpio_to_irq(GPIO_ACCEL_IRQ), \ .irq = PXA_GPIO_TO_IRQ(GPIO_ACCEL_IRQ), \
} }
#define SPI_DAC7512 \ #define SPI_DAC7512 \
...@@ -955,7 +955,7 @@ static struct eeti_ts_platform_data eeti_ts_pdata = { ...@@ -955,7 +955,7 @@ static struct eeti_ts_platform_data eeti_ts_pdata = {
static struct i2c_board_info raumfeld_controller_i2c_board_info __initdata = { static struct i2c_board_info raumfeld_controller_i2c_board_info __initdata = {
.type = "eeti_ts", .type = "eeti_ts",
.addr = 0x0a, .addr = 0x0a,
.irq = gpio_to_irq(GPIO_TOUCH_IRQ), .irq = PXA_GPIO_TO_IRQ(GPIO_TOUCH_IRQ),
.platform_data = &eeti_ts_pdata, .platform_data = &eeti_ts_pdata,
}; };
......
...@@ -96,8 +96,8 @@ static struct resource smc91x_resources[] = { ...@@ -96,8 +96,8 @@ static struct resource smc91x_resources[] = {
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}, },
[1] = { [1] = {
.start = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO97)), .start = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO97)),
.end = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO97)), .end = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO97)),
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
} }
}; };
...@@ -502,7 +502,7 @@ static struct i2c_board_info saar_i2c_info[] = { ...@@ -502,7 +502,7 @@ static struct i2c_board_info saar_i2c_info[] = {
.type = "da9034", .type = "da9034",
.addr = 0x34, .addr = 0x34,
.platform_data = &saar_da9034_info, .platform_data = &saar_da9034_info,
.irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO83)), .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO83)),
}, },
}; };
......
...@@ -92,7 +92,7 @@ static struct i2c_board_info saarb_i2c_info[] = { ...@@ -92,7 +92,7 @@ static struct i2c_board_info saarb_i2c_info[] = {
.type = "88PM860x", .type = "88PM860x",
.addr = 0x34, .addr = 0x34,
.platform_data = &saarb_pm8607_info, .platform_data = &saarb_pm8607_info,
.irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO83)), .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO83)),
}, },
}; };
......
...@@ -552,7 +552,7 @@ static struct spi_board_info spitz_spi_devices[] = { ...@@ -552,7 +552,7 @@ static struct spi_board_info spitz_spi_devices[] = {
.chip_select = 0, .chip_select = 0,
.platform_data = &spitz_ads7846_info, .platform_data = &spitz_ads7846_info,
.controller_data = &spitz_ads7846_chip, .controller_data = &spitz_ads7846_chip,
.irq = gpio_to_irq(SPITZ_GPIO_TP_INT), .irq = PXA_GPIO_TO_IRQ(SPITZ_GPIO_TP_INT),
}, { }, {
.modalias = "corgi-lcd", .modalias = "corgi-lcd",
.max_speed_hz = 50000, .max_speed_hz = 50000,
......
...@@ -546,7 +546,7 @@ static struct i2c_board_info __initdata imote2_pwr_i2c_board_info[] = { ...@@ -546,7 +546,7 @@ static struct i2c_board_info __initdata imote2_pwr_i2c_board_info[] = {
.type = "da9030", .type = "da9030",
.addr = 0x49, .addr = 0x49,
.platform_data = &imote2_da9030_pdata, .platform_data = &imote2_da9030_pdata,
.irq = gpio_to_irq(1), .irq = PXA_GPIO_TO_IRQ(1),
}, },
}; };
...@@ -913,7 +913,7 @@ static struct i2c_board_info __initdata stargate2_pwr_i2c_board_info[] = { ...@@ -913,7 +913,7 @@ static struct i2c_board_info __initdata stargate2_pwr_i2c_board_info[] = {
.type = "da9030", .type = "da9030",
.addr = 0x49, .addr = 0x49,
.platform_data = &stargate2_da9030_pdata, .platform_data = &stargate2_da9030_pdata,
.irq = gpio_to_irq(1), .irq = PXA_GPIO_TO_IRQ(1),
}, },
}; };
......
...@@ -85,8 +85,8 @@ static struct resource smc91x_resources[] = { ...@@ -85,8 +85,8 @@ static struct resource smc91x_resources[] = {
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}, },
[1] = { [1] = {
.start = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO47)), .start = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO47)),
.end = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO47)), .end = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO47)),
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
} }
}; };
......
...@@ -101,7 +101,7 @@ static struct i2c_board_info evb3_i2c_info[] = { ...@@ -101,7 +101,7 @@ static struct i2c_board_info evb3_i2c_info[] = {
.type = "88PM860x", .type = "88PM860x",
.addr = 0x34, .addr = 0x34,
.platform_data = &evb3_pm8607_info, .platform_data = &evb3_pm8607_info,
.irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO83)), .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO83)),
}, },
}; };
......
...@@ -404,8 +404,8 @@ static struct pda_power_pdata tosa_power_data = { ...@@ -404,8 +404,8 @@ static struct pda_power_pdata tosa_power_data = {
static struct resource tosa_power_resource[] = { static struct resource tosa_power_resource[] = {
{ {
.name = "ac", .name = "ac",
.start = gpio_to_irq(TOSA_GPIO_AC_IN), .start = PXA_GPIO_TO_IRQ(TOSA_GPIO_AC_IN),
.end = gpio_to_irq(TOSA_GPIO_AC_IN), .end = PXA_GPIO_TO_IRQ(TOSA_GPIO_AC_IN),
.flags = IORESOURCE_IRQ | .flags = IORESOURCE_IRQ |
IORESOURCE_IRQ_HIGHEDGE | IORESOURCE_IRQ_HIGHEDGE |
IORESOURCE_IRQ_LOWEDGE, IORESOURCE_IRQ_LOWEDGE,
......
...@@ -422,8 +422,8 @@ static struct resource smc91x_resources[] = { ...@@ -422,8 +422,8 @@ static struct resource smc91x_resources[] = {
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}, },
[1] = { [1] = {
.start = gpio_to_irq(VIPER_ETH_GPIO), .start = PXA_GPIO_TO_IRQ(VIPER_ETH_GPIO),
.end = gpio_to_irq(VIPER_ETH_GPIO), .end = PXA_GPIO_TO_IRQ(VIPER_ETH_GPIO),
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
}, },
[2] = { [2] = {
...@@ -546,7 +546,7 @@ static struct plat_serial8250_port serial_platform_data[] = { ...@@ -546,7 +546,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
/* External UARTs */ /* External UARTs */
{ {
.mapbase = VIPER_UARTA_PHYS, .mapbase = VIPER_UARTA_PHYS,
.irq = gpio_to_irq(VIPER_UARTA_GPIO), .irq = PXA_GPIO_TO_IRQ(VIPER_UARTA_GPIO),
.irqflags = IRQF_TRIGGER_RISING, .irqflags = IRQF_TRIGGER_RISING,
.uartclk = 1843200, .uartclk = 1843200,
.regshift = 1, .regshift = 1,
...@@ -556,7 +556,7 @@ static struct plat_serial8250_port serial_platform_data[] = { ...@@ -556,7 +556,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
}, },
{ {
.mapbase = VIPER_UARTB_PHYS, .mapbase = VIPER_UARTB_PHYS,
.irq = gpio_to_irq(VIPER_UARTB_GPIO), .irq = PXA_GPIO_TO_IRQ(VIPER_UARTB_GPIO),
.irqflags = IRQF_TRIGGER_RISING, .irqflags = IRQF_TRIGGER_RISING,
.uartclk = 1843200, .uartclk = 1843200,
.regshift = 1, .regshift = 1,
...@@ -596,8 +596,8 @@ static struct resource isp116x_resources[] = { ...@@ -596,8 +596,8 @@ static struct resource isp116x_resources[] = {
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}, },
[2] = { [2] = {
.start = gpio_to_irq(VIPER_USB_GPIO), .start = PXA_GPIO_TO_IRQ(VIPER_USB_GPIO),
.end = gpio_to_irq(VIPER_USB_GPIO), .end = PXA_GPIO_TO_IRQ(VIPER_USB_GPIO),
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
}, },
}; };
......
...@@ -610,8 +610,8 @@ static struct resource vpac270_ide_resources[] = { ...@@ -610,8 +610,8 @@ static struct resource vpac270_ide_resources[] = {
.flags = IORESOURCE_DMA .flags = IORESOURCE_DMA
}, },
[3] = { /* IDE IRQ pin */ [3] = { /* IDE IRQ pin */
.start = gpio_to_irq(GPIO36_VPAC270_IDE_IRQ), .start = PXA_GPIO_TO_IRQ(GPIO36_VPAC270_IDE_IRQ),
.end = gpio_to_irq(GPIO36_VPAC270_IDE_IRQ), .end = PXA_GPIO_TO_IRQ(GPIO36_VPAC270_IDE_IRQ),
.flags = IORESOURCE_IRQ .flags = IORESOURCE_IRQ
} }
}; };
......
...@@ -573,7 +573,7 @@ static struct spi_board_info spi_board_info[] __initdata = { ...@@ -573,7 +573,7 @@ static struct spi_board_info spi_board_info[] __initdata = {
.modalias = "libertas_spi", .modalias = "libertas_spi",
.platform_data = &z2_lbs_pdata, .platform_data = &z2_lbs_pdata,
.controller_data = &z2_lbs_chip_info, .controller_data = &z2_lbs_chip_info,
.irq = gpio_to_irq(GPIO36_ZIPITZ2_WIFI_IRQ), .irq = PXA_GPIO_TO_IRQ(GPIO36_ZIPITZ2_WIFI_IRQ),
.max_speed_hz = 13000000, .max_speed_hz = 13000000,
.bus_num = 1, .bus_num = 1,
.chip_select = 0, .chip_select = 0,
......
...@@ -233,7 +233,7 @@ static struct plat_serial8250_port serial_platform_data[] = { ...@@ -233,7 +233,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
/* FIXME: Shared IRQs on COM1-COM4 will not work properly on v1i1 hardware. */ /* FIXME: Shared IRQs on COM1-COM4 will not work properly on v1i1 hardware. */
{ /* COM1 */ { /* COM1 */
.mapbase = 0x10000000, .mapbase = 0x10000000,
.irq = gpio_to_irq(ZEUS_UARTA_GPIO), .irq = PXA_GPIO_TO_IRQ(ZEUS_UARTA_GPIO),
.irqflags = IRQF_TRIGGER_RISING, .irqflags = IRQF_TRIGGER_RISING,
.uartclk = 14745600, .uartclk = 14745600,
.regshift = 1, .regshift = 1,
...@@ -242,7 +242,7 @@ static struct plat_serial8250_port serial_platform_data[] = { ...@@ -242,7 +242,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
}, },
{ /* COM2 */ { /* COM2 */
.mapbase = 0x10800000, .mapbase = 0x10800000,
.irq = gpio_to_irq(ZEUS_UARTB_GPIO), .irq = PXA_GPIO_TO_IRQ(ZEUS_UARTB_GPIO),
.irqflags = IRQF_TRIGGER_RISING, .irqflags = IRQF_TRIGGER_RISING,
.uartclk = 14745600, .uartclk = 14745600,
.regshift = 1, .regshift = 1,
...@@ -251,7 +251,7 @@ static struct plat_serial8250_port serial_platform_data[] = { ...@@ -251,7 +251,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
}, },
{ /* COM3 */ { /* COM3 */
.mapbase = 0x11000000, .mapbase = 0x11000000,
.irq = gpio_to_irq(ZEUS_UARTC_GPIO), .irq = PXA_GPIO_TO_IRQ(ZEUS_UARTC_GPIO),
.irqflags = IRQF_TRIGGER_RISING, .irqflags = IRQF_TRIGGER_RISING,
.uartclk = 14745600, .uartclk = 14745600,
.regshift = 1, .regshift = 1,
...@@ -260,7 +260,7 @@ static struct plat_serial8250_port serial_platform_data[] = { ...@@ -260,7 +260,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
}, },
{ /* COM4 */ { /* COM4 */
.mapbase = 0x11800000, .mapbase = 0x11800000,
.irq = gpio_to_irq(ZEUS_UARTD_GPIO), .irq = PXA_GPIO_TO_IRQ(ZEUS_UARTD_GPIO),
.irqflags = IRQF_TRIGGER_RISING, .irqflags = IRQF_TRIGGER_RISING,
.uartclk = 14745600, .uartclk = 14745600,
.regshift = 1, .regshift = 1,
...@@ -321,8 +321,8 @@ static struct resource zeus_dm9k0_resource[] = { ...@@ -321,8 +321,8 @@ static struct resource zeus_dm9k0_resource[] = {
.flags = IORESOURCE_MEM .flags = IORESOURCE_MEM
}, },
[2] = { [2] = {
.start = gpio_to_irq(ZEUS_ETH0_GPIO), .start = PXA_GPIO_TO_IRQ(ZEUS_ETH0_GPIO),
.end = gpio_to_irq(ZEUS_ETH0_GPIO), .end = PXA_GPIO_TO_IRQ(ZEUS_ETH0_GPIO),
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE, .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
}, },
}; };
...@@ -339,8 +339,8 @@ static struct resource zeus_dm9k1_resource[] = { ...@@ -339,8 +339,8 @@ static struct resource zeus_dm9k1_resource[] = {
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}, },
[2] = { [2] = {
.start = gpio_to_irq(ZEUS_ETH1_GPIO), .start = PXA_GPIO_TO_IRQ(ZEUS_ETH1_GPIO),
.end = gpio_to_irq(ZEUS_ETH1_GPIO), .end = PXA_GPIO_TO_IRQ(ZEUS_ETH1_GPIO),
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE, .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
}, },
}; };
...@@ -423,7 +423,7 @@ static struct spi_board_info zeus_spi_board_info[] = { ...@@ -423,7 +423,7 @@ static struct spi_board_info zeus_spi_board_info[] = {
[0] = { [0] = {
.modalias = "mcp2515", .modalias = "mcp2515",
.platform_data = &zeus_mcp2515_pdata, .platform_data = &zeus_mcp2515_pdata,
.irq = gpio_to_irq(ZEUS_CAN_GPIO), .irq = PXA_GPIO_TO_IRQ(ZEUS_CAN_GPIO),
.max_speed_hz = 1*1000*1000, .max_speed_hz = 1*1000*1000,
.bus_num = 3, .bus_num = 3,
.mode = SPI_MODE_0, .mode = SPI_MODE_0,
...@@ -753,7 +753,7 @@ static struct i2c_board_info __initdata zeus_i2c_devices[] = { ...@@ -753,7 +753,7 @@ static struct i2c_board_info __initdata zeus_i2c_devices[] = {
{ {
I2C_BOARD_INFO("pca9535", 0x20), I2C_BOARD_INFO("pca9535", 0x20),
.platform_data = &zeus_pca953x_pdata[2], .platform_data = &zeus_pca953x_pdata[2],
.irq = gpio_to_irq(ZEUS_EXTGPIO_GPIO), .irq = PXA_GPIO_TO_IRQ(ZEUS_EXTGPIO_GPIO),
}, },
{ I2C_BOARD_INFO("lm75a", 0x48) }, { I2C_BOARD_INFO("lm75a", 0x48) },
{ I2C_BOARD_INFO("24c01", 0x50) }, { I2C_BOARD_INFO("24c01", 0x50) },
......
...@@ -407,8 +407,8 @@ static void __init zylonite_init(void) ...@@ -407,8 +407,8 @@ static void __init zylonite_init(void)
* Note: We depend that the bootloader set * Note: We depend that the bootloader set
* the correct value to MSC register for SMC91x. * the correct value to MSC register for SMC91x.
*/ */
smc91x_resources[1].start = gpio_to_irq(gpio_eth_irq); smc91x_resources[1].start = PXA_GPIO_TO_IRQ(gpio_eth_irq);
smc91x_resources[1].end = gpio_to_irq(gpio_eth_irq); smc91x_resources[1].end = PXA_GPIO_TO_IRQ(gpio_eth_irq);
platform_device_register(&smc91x_device); platform_device_register(&smc91x_device);
pxa_set_ac97_info(NULL); pxa_set_ac97_info(NULL);
......
...@@ -40,5 +40,6 @@ extern int pxa_last_gpio; ...@@ -40,5 +40,6 @@ extern int pxa_last_gpio;
typedef int (*set_wake_t)(struct irq_data *d, unsigned int on); typedef int (*set_wake_t)(struct irq_data *d, unsigned int on);
extern void pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn); extern void pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn);
extern int pxa_irq_to_gpio(int irq);
#endif /* __PLAT_PXA_GPIO_H */ #endif /* __PLAT_PXA_GPIO_H */
...@@ -39,8 +39,19 @@ struct pxa_gpio_chip { ...@@ -39,8 +39,19 @@ struct pxa_gpio_chip {
#endif #endif
}; };
enum {
PXA25X_GPIO = 0,
PXA26X_GPIO,
PXA27X_GPIO,
PXA3XX_GPIO,
PXA93X_GPIO,
MMP_GPIO = 0x10,
MMP2_GPIO,
};
static DEFINE_SPINLOCK(gpio_lock); static DEFINE_SPINLOCK(gpio_lock);
static struct pxa_gpio_chip *pxa_gpio_chips; static struct pxa_gpio_chip *pxa_gpio_chips;
static int gpio_type;
#define for_each_gpio_chip(i, c) \ #define for_each_gpio_chip(i, c) \
for (i = 0, c = &pxa_gpio_chips[0]; i <= pxa_last_gpio; i += 32, c++) for (i = 0, c = &pxa_gpio_chips[0]; i <= pxa_last_gpio; i += 32, c++)
...@@ -55,6 +66,75 @@ static inline struct pxa_gpio_chip *gpio_to_pxachip(unsigned gpio) ...@@ -55,6 +66,75 @@ static inline struct pxa_gpio_chip *gpio_to_pxachip(unsigned gpio)
return &pxa_gpio_chips[gpio_to_bank(gpio)]; return &pxa_gpio_chips[gpio_to_bank(gpio)];
} }
static inline int gpio_is_pxa_type(int type)
{
return (type & MMP_GPIO) == 0;
}
static inline int gpio_is_mmp_type(int type)
{
return (type & MMP_GPIO) != 0;
}
#ifdef CONFIG_ARCH_PXA
static inline int __pxa_gpio_to_irq(int gpio)
{
if (gpio_is_pxa_type(gpio_type))
return PXA_GPIO_TO_IRQ(gpio);
return -1;
}
static inline int __pxa_irq_to_gpio(int irq)
{
if (gpio_is_pxa_type(gpio_type))
return irq - PXA_GPIO_TO_IRQ(0);
return -1;
}
#else
static inline int __pxa_gpio_to_irq(int gpio) { return -1; }
static inline int __pxa_irq_to_gpio(int irq) { return -1; }
#endif
#ifdef CONFIG_ARCH_MMP
static inline int __mmp_gpio_to_irq(int gpio)
{
if (gpio_is_mmp_type(gpio_type))
return MMP_GPIO_TO_IRQ(gpio);
return -1;
}
static inline int __mmp_irq_to_gpio(int irq)
{
if (gpio_is_mmp_type(gpio_type))
return irq - MMP_GPIO_TO_IRQ(0);
return -1;
}
#else
static inline int __mmp_gpio_to_irq(int gpio) { return -1; }
static inline int __mmp_irq_to_gpio(int irq) { return -1; }
#endif
static int pxa_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
{
int gpio, ret;
gpio = chip->base + offset;
ret = __pxa_gpio_to_irq(gpio);
if (ret >= 0)
return ret;
return __mmp_gpio_to_irq(gpio);
}
int pxa_irq_to_gpio(int irq)
{
int ret;
ret = __pxa_irq_to_gpio(irq);
if (ret >= 0)
return ret;
return __mmp_irq_to_gpio(irq);
}
static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset) static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
{ {
void __iomem *base = gpio_chip_base(chip); void __iomem *base = gpio_chip_base(chip);
...@@ -131,6 +211,7 @@ static int __init pxa_init_gpio_chip(int gpio_end) ...@@ -131,6 +211,7 @@ static int __init pxa_init_gpio_chip(int gpio_end)
c->direction_output = pxa_gpio_direction_output; c->direction_output = pxa_gpio_direction_output;
c->get = pxa_gpio_get; c->get = pxa_gpio_get;
c->set = pxa_gpio_set; c->set = pxa_gpio_set;
c->to_irq = pxa_gpio_to_irq;
/* number of GPIOs on last bank may be less than 32 */ /* number of GPIOs on last bank may be less than 32 */
c->ngpio = (gpio + 31 > gpio_end) ? (gpio_end - gpio + 1) : 32; c->ngpio = (gpio + 31 > gpio_end) ? (gpio_end - gpio + 1) : 32;
...@@ -158,7 +239,7 @@ static inline void update_edge_detect(struct pxa_gpio_chip *c) ...@@ -158,7 +239,7 @@ static inline void update_edge_detect(struct pxa_gpio_chip *c)
static int pxa_gpio_irq_type(struct irq_data *d, unsigned int type) static int pxa_gpio_irq_type(struct irq_data *d, unsigned int type)
{ {
struct pxa_gpio_chip *c; struct pxa_gpio_chip *c;
int gpio = irq_to_gpio(d->irq); int gpio = pxa_irq_to_gpio(d->irq);
unsigned long gpdr, mask = GPIO_bit(gpio); unsigned long gpdr, mask = GPIO_bit(gpio);
c = gpio_to_pxachip(gpio); c = gpio_to_pxachip(gpio);
...@@ -229,7 +310,7 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc) ...@@ -229,7 +310,7 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc)
static void pxa_ack_muxed_gpio(struct irq_data *d) static void pxa_ack_muxed_gpio(struct irq_data *d)
{ {
int gpio = irq_to_gpio(d->irq); int gpio = pxa_irq_to_gpio(d->irq);
struct pxa_gpio_chip *c = gpio_to_pxachip(gpio); struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
__raw_writel(GPIO_bit(gpio), c->regbase + GEDR_OFFSET); __raw_writel(GPIO_bit(gpio), c->regbase + GEDR_OFFSET);
...@@ -237,7 +318,7 @@ static void pxa_ack_muxed_gpio(struct irq_data *d) ...@@ -237,7 +318,7 @@ static void pxa_ack_muxed_gpio(struct irq_data *d)
static void pxa_mask_muxed_gpio(struct irq_data *d) static void pxa_mask_muxed_gpio(struct irq_data *d)
{ {
int gpio = irq_to_gpio(d->irq); int gpio = pxa_irq_to_gpio(d->irq);
struct pxa_gpio_chip *c = gpio_to_pxachip(gpio); struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
uint32_t grer, gfer; uint32_t grer, gfer;
...@@ -251,7 +332,7 @@ static void pxa_mask_muxed_gpio(struct irq_data *d) ...@@ -251,7 +332,7 @@ static void pxa_mask_muxed_gpio(struct irq_data *d)
static void pxa_unmask_muxed_gpio(struct irq_data *d) static void pxa_unmask_muxed_gpio(struct irq_data *d)
{ {
int gpio = irq_to_gpio(d->irq); int gpio = pxa_irq_to_gpio(d->irq);
struct pxa_gpio_chip *c = gpio_to_pxachip(gpio); struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
c->irq_mask |= GPIO_bit(gpio); c->irq_mask |= GPIO_bit(gpio);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment