aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-11-11 04:52:33 -0500
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-11-17 04:01:38 -0500
commitd485c7e71675abdd6133128e596b41284c2ee7b5 (patch)
treeafa70c3ace0be126f27db3ef0a08d51d07a8fbb8
parent5f3d1092a949b33d01c95b7f5e5a83672629f131 (diff)
ARM: mx25: move registration of gpios to plat-mxc/gpio.c
To use common macros to define the gpio ports for imx{1,21,25,27} the existing ones had to made more general and a few more base address defines were necessary. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-rw-r--r--arch/arm/mach-mx25/devices.c29
-rw-r--r--arch/arm/plat-mxc/gpio.c58
-rw-r--r--arch/arm/plat-mxc/include/mach/mx1.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/mx21.h6
-rw-r--r--arch/arm/plat-mxc/include/mach/mx25.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/mx27.h6
6 files changed, 55 insertions, 52 deletions
diff --git a/arch/arm/mach-mx25/devices.c b/arch/arm/mach-mx25/devices.c
index 13a3c280a834..1798be90a382 100644
--- a/arch/arm/mach-mx25/devices.c
+++ b/arch/arm/mach-mx25/devices.c
@@ -41,35 +41,6 @@ struct platform_device mxc_keypad_device = {
41 .resource = mxc_keypad_resources, 41 .resource = mxc_keypad_resources,
42}; 42};
43 43
44static struct mxc_gpio_port imx_gpio_ports[] = {
45 {
46 .chip.label = "gpio-0",
47 .base = MX25_IO_ADDRESS(MX25_GPIO1_BASE_ADDR),
48 .irq = 52,
49 .virtual_irq_start = MXC_GPIO_IRQ_START,
50 }, {
51 .chip.label = "gpio-1",
52 .base = MX25_IO_ADDRESS(MX25_GPIO2_BASE_ADDR),
53 .irq = 51,
54 .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
55 }, {
56 .chip.label = "gpio-2",
57 .base = MX25_IO_ADDRESS(MX25_GPIO3_BASE_ADDR),
58 .irq = 16,
59 .virtual_irq_start = MXC_GPIO_IRQ_START + 64,
60 }, {
61 .chip.label = "gpio-3",
62 .base = MX25_IO_ADDRESS(MX25_GPIO4_BASE_ADDR),
63 .irq = 23,
64 .virtual_irq_start = MXC_GPIO_IRQ_START + 96,
65 }
66};
67
68int __init imx25_register_gpios(void)
69{
70 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
71}
72
73static struct resource mx25_rtc_resources[] = { 44static struct resource mx25_rtc_resources[] = {
74 { 45 {
75 .start = MX25_DRYICE_BASE_ADDR, 46 .start = MX25_DRYICE_BASE_ADDR,
diff --git a/arch/arm/plat-mxc/gpio.c b/arch/arm/plat-mxc/gpio.c
index 2c00d9bf0a66..e59fb973a771 100644
--- a/arch/arm/plat-mxc/gpio.c
+++ b/arch/arm/plat-mxc/gpio.c
@@ -350,17 +350,17 @@ int __init mxc_gpio_init(struct mxc_gpio_port *port, int cnt)
350 return 0; 350 return 0;
351} 351}
352 352
353#define DEFINE_IMX_GPIO_PORT_IRQ(soc, n, _irq) \ 353#define DEFINE_IMX_GPIO_PORT_IRQ(soc, _id, _hwid, _irq) \
354 { \ 354 { \
355 .chip.label = "gpio-" #n, \ 355 .chip.label = "gpio-" #_id, \
356 .irq = _irq, \ 356 .irq = _irq, \
357 .base = soc ## _IO_ADDRESS(soc ## _GPIO_BASE_ADDR + \ 357 .base = soc ## _IO_ADDRESS( \
358 (n) * SZ_256), \ 358 soc ## _GPIO ## _hwid ## _BASE_ADDR), \
359 .virtual_irq_start = MXC_GPIO_IRQ_START + (n) * 32, \ 359 .virtual_irq_start = MXC_GPIO_IRQ_START + (_id) * 32, \
360 } 360 }
361 361
362#define DEFINE_IMX_GPIO_PORT(soc, n) \ 362#define DEFINE_IMX_GPIO_PORT(soc, _id, _hwid) \
363 DEFINE_IMX_GPIO_PORT_IRQ(soc, n, 0) 363 DEFINE_IMX_GPIO_PORT_IRQ(soc, _id, _hwid, 0)
364 364
365#define DEFINE_REGISTER_FUNCTION(prefix) \ 365#define DEFINE_REGISTER_FUNCTION(prefix) \
366int __init prefix ## _register_gpios(void) \ 366int __init prefix ## _register_gpios(void) \
@@ -371,10 +371,10 @@ int __init prefix ## _register_gpios(void) \
371 371
372#if defined(CONFIG_SOC_IMX1) 372#if defined(CONFIG_SOC_IMX1)
373static struct mxc_gpio_port imx1_gpio_ports[] = { 373static struct mxc_gpio_port imx1_gpio_ports[] = {
374 DEFINE_IMX_GPIO_PORT_IRQ(MX1, 0, MX1_GPIO_INT_PORTA), 374 DEFINE_IMX_GPIO_PORT_IRQ(MX1, 0, 1, MX1_GPIO_INT_PORTA),
375 DEFINE_IMX_GPIO_PORT_IRQ(MX1, 1, MX1_GPIO_INT_PORTB), 375 DEFINE_IMX_GPIO_PORT_IRQ(MX1, 1, 2, MX1_GPIO_INT_PORTB),
376 DEFINE_IMX_GPIO_PORT_IRQ(MX1, 2, MX1_GPIO_INT_PORTC), 376 DEFINE_IMX_GPIO_PORT_IRQ(MX1, 2, 3, MX1_GPIO_INT_PORTC),
377 DEFINE_IMX_GPIO_PORT_IRQ(MX1, 3, MX1_GPIO_INT_PORTD), 377 DEFINE_IMX_GPIO_PORT_IRQ(MX1, 3, 4, MX1_GPIO_INT_PORTD),
378}; 378};
379 379
380DEFINE_REGISTER_FUNCTION(imx1) 380DEFINE_REGISTER_FUNCTION(imx1)
@@ -383,26 +383,38 @@ DEFINE_REGISTER_FUNCTION(imx1)
383 383
384#if defined(CONFIG_SOC_IMX21) 384#if defined(CONFIG_SOC_IMX21)
385static struct mxc_gpio_port imx21_gpio_ports[] = { 385static struct mxc_gpio_port imx21_gpio_ports[] = {
386 DEFINE_IMX_GPIO_PORT_IRQ(MX21, 0, MX21_INT_GPIO), 386 DEFINE_IMX_GPIO_PORT_IRQ(MX21, 0, 1, MX21_INT_GPIO),
387 DEFINE_IMX_GPIO_PORT(MX21, 1), 387 DEFINE_IMX_GPIO_PORT(MX21, 1, 2),
388 DEFINE_IMX_GPIO_PORT(MX21, 2), 388 DEFINE_IMX_GPIO_PORT(MX21, 2, 3),
389 DEFINE_IMX_GPIO_PORT(MX21, 3), 389 DEFINE_IMX_GPIO_PORT(MX21, 3, 4),
390 DEFINE_IMX_GPIO_PORT(MX21, 4), 390 DEFINE_IMX_GPIO_PORT(MX21, 4, 5),
391 DEFINE_IMX_GPIO_PORT(MX21, 5), 391 DEFINE_IMX_GPIO_PORT(MX21, 5, 6),
392}; 392};
393 393
394DEFINE_REGISTER_FUNCTION(imx21) 394DEFINE_REGISTER_FUNCTION(imx21)
395 395
396#endif /* if defined(CONFIG_SOC_IMX21) */ 396#endif /* if defined(CONFIG_SOC_IMX21) */
397 397
398#if defined(CONFIG_ARCH_MX25)
399static struct mxc_gpio_port imx25_gpio_ports[] = {
400 DEFINE_IMX_GPIO_PORT_IRQ(MX25, 0, 1, MX25_INT_GPIO1),
401 DEFINE_IMX_GPIO_PORT_IRQ(MX25, 1, 2, MX25_INT_GPIO2),
402 DEFINE_IMX_GPIO_PORT_IRQ(MX25, 2, 3, MX25_INT_GPIO3),
403 DEFINE_IMX_GPIO_PORT_IRQ(MX25, 3, 4, MX25_INT_GPIO4),
404};
405
406DEFINE_REGISTER_FUNCTION(imx25)
407
408#endif /* if defined(CONFIG_ARCH_MX25) */
409
398#if defined(CONFIG_SOC_IMX27) 410#if defined(CONFIG_SOC_IMX27)
399static struct mxc_gpio_port imx27_gpio_ports[] = { 411static struct mxc_gpio_port imx27_gpio_ports[] = {
400 DEFINE_IMX_GPIO_PORT_IRQ(MX27, 0, MX27_INT_GPIO), 412 DEFINE_IMX_GPIO_PORT_IRQ(MX27, 0, 1, MX27_INT_GPIO),
401 DEFINE_IMX_GPIO_PORT(MX27, 1), 413 DEFINE_IMX_GPIO_PORT(MX27, 1, 2),
402 DEFINE_IMX_GPIO_PORT(MX27, 2), 414 DEFINE_IMX_GPIO_PORT(MX27, 2, 3),
403 DEFINE_IMX_GPIO_PORT(MX27, 3), 415 DEFINE_IMX_GPIO_PORT(MX27, 3, 4),
404 DEFINE_IMX_GPIO_PORT(MX27, 4), 416 DEFINE_IMX_GPIO_PORT(MX27, 4, 5),
405 DEFINE_IMX_GPIO_PORT(MX27, 5), 417 DEFINE_IMX_GPIO_PORT(MX27, 5, 6),
406}; 418};
407 419
408DEFINE_REGISTER_FUNCTION(imx27) 420DEFINE_REGISTER_FUNCTION(imx27)
diff --git a/arch/arm/plat-mxc/include/mach/mx1.h b/arch/arm/plat-mxc/include/mach/mx1.h
index f1e336ebcb2e..75d96214b831 100644
--- a/arch/arm/plat-mxc/include/mach/mx1.h
+++ b/arch/arm/plat-mxc/include/mach/mx1.h
@@ -65,6 +65,10 @@
65#define MX1_CCM_BASE_ADDR (0x1B000 + MX1_IO_BASE_ADDR) 65#define MX1_CCM_BASE_ADDR (0x1B000 + MX1_IO_BASE_ADDR)
66#define MX1_SCM_BASE_ADDR (0x1B804 + MX1_IO_BASE_ADDR) 66#define MX1_SCM_BASE_ADDR (0x1B804 + MX1_IO_BASE_ADDR)
67#define MX1_GPIO_BASE_ADDR (0x1C000 + MX1_IO_BASE_ADDR) 67#define MX1_GPIO_BASE_ADDR (0x1C000 + MX1_IO_BASE_ADDR)
68#define MX1_GPIO1_BASE_ADDR (0x1C000 + MX1_IO_BASE_ADDR)
69#define MX1_GPIO2_BASE_ADDR (0x1C100 + MX1_IO_BASE_ADDR)
70#define MX1_GPIO3_BASE_ADDR (0x1C200 + MX1_IO_BASE_ADDR)
71#define MX1_GPIO4_BASE_ADDR (0x1C300 + MX1_IO_BASE_ADDR)
68#define MX1_EIM_BASE_ADDR (0x20000 + MX1_IO_BASE_ADDR) 72#define MX1_EIM_BASE_ADDR (0x20000 + MX1_IO_BASE_ADDR)
69#define MX1_SDRAMC_BASE_ADDR (0x21000 + MX1_IO_BASE_ADDR) 73#define MX1_SDRAMC_BASE_ADDR (0x21000 + MX1_IO_BASE_ADDR)
70#define MX1_MMA_BASE_ADDR (0x22000 + MX1_IO_BASE_ADDR) 74#define MX1_MMA_BASE_ADDR (0x22000 + MX1_IO_BASE_ADDR)
diff --git a/arch/arm/plat-mxc/include/mach/mx21.h b/arch/arm/plat-mxc/include/mach/mx21.h
index a82f59063318..6cd049ebbd8d 100644
--- a/arch/arm/plat-mxc/include/mach/mx21.h
+++ b/arch/arm/plat-mxc/include/mach/mx21.h
@@ -48,6 +48,12 @@
48#define MX21_SDHC1_BASE_ADDR (MX21_AIPI_BASE_ADDR + 0x13000) 48#define MX21_SDHC1_BASE_ADDR (MX21_AIPI_BASE_ADDR + 0x13000)
49#define MX21_SDHC2_BASE_ADDR (MX21_AIPI_BASE_ADDR + 0x14000) 49#define MX21_SDHC2_BASE_ADDR (MX21_AIPI_BASE_ADDR + 0x14000)
50#define MX21_GPIO_BASE_ADDR (MX21_AIPI_BASE_ADDR + 0x15000) 50#define MX21_GPIO_BASE_ADDR (MX21_AIPI_BASE_ADDR + 0x15000)
51#define MX21_GPIO1_BASE_ADDR (MX21_GPIO_BASE_ADDR + 0x000)
52#define MX21_GPIO2_BASE_ADDR (MX21_GPIO_BASE_ADDR + 0x100)
53#define MX21_GPIO3_BASE_ADDR (MX21_GPIO_BASE_ADDR + 0x200)
54#define MX21_GPIO4_BASE_ADDR (MX21_GPIO_BASE_ADDR + 0x300)
55#define MX21_GPIO5_BASE_ADDR (MX21_GPIO_BASE_ADDR + 0x400)
56#define MX21_GPIO6_BASE_ADDR (MX21_GPIO_BASE_ADDR + 0x500)
51#define MX21_AUDMUX_BASE_ADDR (MX21_AIPI_BASE_ADDR + 0x16000) 57#define MX21_AUDMUX_BASE_ADDR (MX21_AIPI_BASE_ADDR + 0x16000)
52#define MX21_CSPI3_BASE_ADDR (MX21_AIPI_BASE_ADDR + 0x17000) 58#define MX21_CSPI3_BASE_ADDR (MX21_AIPI_BASE_ADDR + 0x17000)
53#define MX21_LCDC_BASE_ADDR (MX21_AIPI_BASE_ADDR + 0x21000) 59#define MX21_LCDC_BASE_ADDR (MX21_AIPI_BASE_ADDR + 0x21000)
diff --git a/arch/arm/plat-mxc/include/mach/mx25.h b/arch/arm/plat-mxc/include/mach/mx25.h
index cea851f09ca7..024bebe4da11 100644
--- a/arch/arm/plat-mxc/include/mach/mx25.h
+++ b/arch/arm/plat-mxc/include/mach/mx25.h
@@ -66,8 +66,10 @@
66#define MX25_INT_SSI1 12 66#define MX25_INT_SSI1 12
67#define MX25_INT_CSPI2 13 67#define MX25_INT_CSPI2 13
68#define MX25_INT_CSPI1 14 68#define MX25_INT_CSPI1 14
69#define MX25_INT_GPIO3 16
69#define MX25_INT_CSI 17 70#define MX25_INT_CSI 17
70#define MX25_INT_UART3 18 71#define MX25_INT_UART3 18
72#define MX25_INT_GPIO4 23
71#define MX25_INT_KPP 24 73#define MX25_INT_KPP 24
72#define MX25_INT_DRYICE 25 74#define MX25_INT_DRYICE 25
73#define MX25_INT_PWM1 26 75#define MX25_INT_PWM1 26
@@ -84,6 +86,8 @@
84#define MX25_INT_CAN1 43 86#define MX25_INT_CAN1 43
85#define MX25_INT_CAN2 44 87#define MX25_INT_CAN2 44
86#define MX25_INT_UART1 45 88#define MX25_INT_UART1 45
89#define MX25_INT_GPIO2 51
90#define MX25_INT_GPIO1 52
87#define MX25_INT_FEC 57 91#define MX25_INT_FEC 57
88 92
89#define MX25_DMA_REQ_SSI2_RX1 22 93#define MX25_DMA_REQ_SSI2_RX1 22
diff --git a/arch/arm/plat-mxc/include/mach/mx27.h b/arch/arm/plat-mxc/include/mach/mx27.h
index 45419b3a2d1e..eb09ec09dbe5 100644
--- a/arch/arm/plat-mxc/include/mach/mx27.h
+++ b/arch/arm/plat-mxc/include/mach/mx27.h
@@ -51,6 +51,12 @@
51#define MX27_SDHC1_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x13000) 51#define MX27_SDHC1_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x13000)
52#define MX27_SDHC2_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x14000) 52#define MX27_SDHC2_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x14000)
53#define MX27_GPIO_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x15000) 53#define MX27_GPIO_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x15000)
54#define MX27_GPIO1_BASE_ADDR (MX27_GPIO_BASE_ADDR + 0x000)
55#define MX27_GPIO2_BASE_ADDR (MX27_GPIO_BASE_ADDR + 0x100)
56#define MX27_GPIO3_BASE_ADDR (MX27_GPIO_BASE_ADDR + 0x200)
57#define MX27_GPIO4_BASE_ADDR (MX27_GPIO_BASE_ADDR + 0x300)
58#define MX27_GPIO5_BASE_ADDR (MX27_GPIO_BASE_ADDR + 0x400)
59#define MX27_GPIO6_BASE_ADDR (MX27_GPIO_BASE_ADDR + 0x500)
54#define MX27_AUDMUX_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x16000) 60#define MX27_AUDMUX_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x16000)
55#define MX27_CSPI3_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x17000) 61#define MX27_CSPI3_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x17000)
56#define MX27_MSHC_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x18000) 62#define MX27_MSHC_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x18000)