Commit 897359d5 authored by Uwe Kleine-König's avatar Uwe Kleine-König

arm/mx2: define seperate gpio port descriptions for imx21 and imx27

As the gpio ports have different addresses on imx21 and imx27 there are
two different port descriptions needed if not relying on the overloaded
cpp macro IO_ADDRESS.  So some cpp magic is added to minimize code
duplication.
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
parent 3636a145
...@@ -432,36 +432,52 @@ DEFINE_IMX_SSI_DEVICE(0, 1, MX2x_SSI1_BASE_ADDR, MX2x_INT_SSI1); ...@@ -432,36 +432,52 @@ DEFINE_IMX_SSI_DEVICE(0, 1, MX2x_SSI1_BASE_ADDR, MX2x_INT_SSI1);
DEFINE_IMX_SSI_DEVICE(1, 2, MX2x_SSI1_BASE_ADDR, MX2x_INT_SSI1); DEFINE_IMX_SSI_DEVICE(1, 2, MX2x_SSI1_BASE_ADDR, MX2x_INT_SSI1);
/* GPIO port description */ /* GPIO port description */
static struct mxc_gpio_port imx_gpio_ports[] = { #define DEFINE_MXC_GPIO_PORT_IRQ(SOC, n, _irq) \
{ { \
.chip.label = "gpio-0", .chip.label = "gpio-" #n, \
.irq = MX2x_INT_GPIO, .irq = _irq, \
.base = IO_ADDRESS(MX2x_GPIO_BASE_ADDR), .base = SOC ## _IO_ADDRESS(MX2x_GPIO_BASE_ADDR + \
.virtual_irq_start = MXC_GPIO_IRQ_START, n * 0x100), \
}, { .virtual_irq_start = MXC_GPIO_IRQ_START + n * 32, \
.chip.label = "gpio-1", }
.base = IO_ADDRESS(MX2x_GPIO_BASE_ADDR + 0x100),
.virtual_irq_start = MXC_GPIO_IRQ_START + 32, #define DEFINE_MXC_GPIO_PORT(SOC, n) \
}, { { \
.chip.label = "gpio-2", .chip.label = "gpio-" #n, \
.base = IO_ADDRESS(MX2x_GPIO_BASE_ADDR + 0x200), .base = SOC ## _IO_ADDRESS(MX2x_GPIO_BASE_ADDR + \
.virtual_irq_start = MXC_GPIO_IRQ_START + 64, n * 0x100), \
}, { .virtual_irq_start = MXC_GPIO_IRQ_START + n * 32, \
.chip.label = "gpio-3",
.base = IO_ADDRESS(MX2x_GPIO_BASE_ADDR + 0x300),
.virtual_irq_start = MXC_GPIO_IRQ_START + 96,
}, {
.chip.label = "gpio-4",
.base = IO_ADDRESS(MX2x_GPIO_BASE_ADDR + 0x400),
.virtual_irq_start = MXC_GPIO_IRQ_START + 128,
}, {
.chip.label = "gpio-5",
.base = IO_ADDRESS(MX2x_GPIO_BASE_ADDR + 0x500),
.virtual_irq_start = MXC_GPIO_IRQ_START + 160,
} }
};
#define DEFINE_MXC_GPIO_PORTS(SOC, pfx) \
static struct mxc_gpio_port pfx ## _gpio_ports[] = { \
DEFINE_MXC_GPIO_PORT_IRQ(SOC, 0, SOC ## _INT_GPIO), \
DEFINE_MXC_GPIO_PORT(SOC, 1), \
DEFINE_MXC_GPIO_PORT(SOC, 2), \
DEFINE_MXC_GPIO_PORT(SOC, 3), \
DEFINE_MXC_GPIO_PORT(SOC, 4), \
DEFINE_MXC_GPIO_PORT(SOC, 5), \
}
#ifdef CONFIG_MACH_MX21
DEFINE_MXC_GPIO_PORTS(MX21, imx21);
#endif
#ifdef CONFIG_MACH_MX27
DEFINE_MXC_GPIO_PORTS(MX27, imx27);
#endif
int __init mxc_register_gpios(void) int __init mxc_register_gpios(void)
{ {
return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports)); #ifdef CONFIG_MACH_MX21
if (cpu_is_mx21())
return mxc_gpio_init(imx21_gpio_ports, ARRAY_SIZE(imx21_gpio_ports));
else
#endif
#ifdef CONFIG_MACH_MX27
if (cpu_is_mx27())
return mxc_gpio_init(imx27_gpio_ports, ARRAY_SIZE(imx27_gpio_ports));
else
#endif
return 0;
} }
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