aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx2
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-02-04 08:11:02 -0500
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-02-08 05:47:00 -0500
commit2b84a3640ffdebbbea3ec004eae963e920c16e1a (patch)
tree87a5732425f7f3d92ad6099f85c4e462dfed5c10 /arch/arm/mach-mx2
parent68c94b40b31926f627573a7f656b903f6644744e (diff)
arm/mx2: use cpp magic to create imx_gpt devices
This makes the source shorter and easier to verify. While at it switch to use the SoC-prefixed constants. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mx2')
-rw-r--r--arch/arm/mach-mx2/devices.c118
-rw-r--r--arch/arm/mach-mx2/devices.h2
2 files changed, 26 insertions, 94 deletions
diff --git a/arch/arm/mach-mx2/devices.c b/arch/arm/mach-mx2/devices.c
index ce164a315ee7..6efd86242630 100644
--- a/arch/arm/mach-mx2/devices.c
+++ b/arch/arm/mach-mx2/devices.c
@@ -78,104 +78,34 @@ DEFINE_IMX_SPI_DEVICE(2, MX27_CSPI3_BASE_ADDR, MX27_INT_CSPI3);
78 * - i.MX21: 3 timers 78 * - i.MX21: 3 timers
79 * - i.MX27: 6 timers 79 * - i.MX27: 6 timers
80 */ 80 */
81 81#define DEFINE_IMX_GPT_DEVICE(n, baseaddr, irq) \
82/* We use gpt0 as system timer, so do not add a device for this one */ 82 static struct resource timer ## n ##_resources[] = { \
83 83 { \
84static struct resource timer1_resources[] = { 84 .start = baseaddr, \
85 { 85 .end = baseaddr + SZ_4K - 1, \
86 .start = GPT2_BASE_ADDR, 86 .flags = IORESOURCE_MEM, \
87 .end = GPT2_BASE_ADDR + 0x17, 87 }, { \
88 .flags = IORESOURCE_MEM, 88 .start = irq, \
89 }, { 89 .end = irq, \
90 .start = MXC_INT_GPT2, 90 .flags = IORESOURCE_IRQ, \
91 .end = MXC_INT_GPT2, 91 } \
92 .flags = IORESOURCE_IRQ, 92 }; \
93 \
94 struct platform_device mxc_gpt ## n = { \
95 .name = "imx_gpt", \
96 .id = n, \
97 .num_resources = ARRAY_SIZE(timer ## n ## _resources), \
98 .resource = timer ## n ## _resources, \
93 } 99 }
94};
95 100
96struct platform_device mxc_gpt1 = { 101/* We use gpt1 as system timer, so do not add a device for this one */
97 .name = "imx_gpt", 102DEFINE_IMX_GPT_DEVICE(1, MX2x_GPT2_BASE_ADDR, MX2x_INT_GPT2);
98 .id = 1, 103DEFINE_IMX_GPT_DEVICE(2, MX2x_GPT3_BASE_ADDR, MX2x_INT_GPT3);
99 .num_resources = ARRAY_SIZE(timer1_resources),
100 .resource = timer1_resources,
101};
102
103static struct resource timer2_resources[] = {
104 {
105 .start = GPT3_BASE_ADDR,
106 .end = GPT3_BASE_ADDR + 0x17,
107 .flags = IORESOURCE_MEM,
108 }, {
109 .start = MXC_INT_GPT3,
110 .end = MXC_INT_GPT3,
111 .flags = IORESOURCE_IRQ,
112 }
113};
114
115struct platform_device mxc_gpt2 = {
116 .name = "imx_gpt",
117 .id = 2,
118 .num_resources = ARRAY_SIZE(timer2_resources),
119 .resource = timer2_resources,
120};
121 104
122#ifdef CONFIG_MACH_MX27 105#ifdef CONFIG_MACH_MX27
123static struct resource timer3_resources[] = { 106DEFINE_IMX_GPT_DEVICE(3, MX27_GPT4_BASE_ADDR, MX27_INT_GPT4);
124 { 107DEFINE_IMX_GPT_DEVICE(4, MX27_GPT5_BASE_ADDR, MX27_INT_GPT5);
125 .start = GPT4_BASE_ADDR, 108DEFINE_IMX_GPT_DEVICE(5, MX27_GPT6_BASE_ADDR, MX27_INT_GPT6);
126 .end = GPT4_BASE_ADDR + 0x17,
127 .flags = IORESOURCE_MEM,
128 }, {
129 .start = MXC_INT_GPT4,
130 .end = MXC_INT_GPT4,
131 .flags = IORESOURCE_IRQ,
132 }
133};
134
135struct platform_device mxc_gpt3 = {
136 .name = "imx_gpt",
137 .id = 3,
138 .num_resources = ARRAY_SIZE(timer3_resources),
139 .resource = timer3_resources,
140};
141
142static struct resource timer4_resources[] = {
143 {
144 .start = GPT5_BASE_ADDR,
145 .end = GPT5_BASE_ADDR + 0x17,
146 .flags = IORESOURCE_MEM,
147 }, {
148 .start = MXC_INT_GPT5,
149 .end = MXC_INT_GPT5,
150 .flags = IORESOURCE_IRQ,
151 }
152};
153
154struct platform_device mxc_gpt4 = {
155 .name = "imx_gpt",
156 .id = 4,
157 .num_resources = ARRAY_SIZE(timer4_resources),
158 .resource = timer4_resources,
159};
160
161static struct resource timer5_resources[] = {
162 {
163 .start = GPT6_BASE_ADDR,
164 .end = GPT6_BASE_ADDR + 0x17,
165 .flags = IORESOURCE_MEM,
166 }, {
167 .start = MXC_INT_GPT6,
168 .end = MXC_INT_GPT6,
169 .flags = IORESOURCE_IRQ,
170 }
171};
172
173struct platform_device mxc_gpt5 = {
174 .name = "imx_gpt",
175 .id = 5,
176 .num_resources = ARRAY_SIZE(timer5_resources),
177 .resource = timer5_resources,
178};
179#endif 109#endif
180 110
181/* 111/*
diff --git a/arch/arm/mach-mx2/devices.h b/arch/arm/mach-mx2/devices.h
index e13a352f0b8a..a0c6e1ad22d2 100644
--- a/arch/arm/mach-mx2/devices.h
+++ b/arch/arm/mach-mx2/devices.h
@@ -1,8 +1,10 @@
1extern struct platform_device mxc_gpt1; 1extern struct platform_device mxc_gpt1;
2extern struct platform_device mxc_gpt2; 2extern struct platform_device mxc_gpt2;
3#ifdef CONFIG_MACH_MX27
3extern struct platform_device mxc_gpt3; 4extern struct platform_device mxc_gpt3;
4extern struct platform_device mxc_gpt4; 5extern struct platform_device mxc_gpt4;
5extern struct platform_device mxc_gpt5; 6extern struct platform_device mxc_gpt5;
7#endif
6extern struct platform_device mxc_wdt; 8extern struct platform_device mxc_wdt;
7extern struct platform_device mxc_uart_device0; 9extern struct platform_device mxc_uart_device0;
8extern struct platform_device mxc_uart_device1; 10extern struct platform_device mxc_uart_device1;