Commit | Line | Data |
---|---|---|
cfca8b53 PZ |
1 | /* |
2 | * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved. | |
3 | * Copyright 2008 Sascha Hauer, kernel@pengutronix.de | |
4 | * Copyright (c) 2008 Paulius Zaleckas <paulius.zaleckas@teltonika.lt> | |
219fed75 | 5 | * Copyright (c) 2008 Darius Augulis <darius.augulis@teltonika.lt> |
cfca8b53 PZ |
6 | * |
7 | * This program is free software; you can redistribute it and/or | |
8 | * modify it under the terms of the GNU General Public License | |
9 | * as published by the Free Software Foundation; either version 2 | |
10 | * of the License, or (at your option) any later version. | |
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
19 | * Boston, MA 02110-1301, USA. | |
20 | */ | |
21 | ||
22 | #include <linux/kernel.h> | |
23 | #include <linux/init.h> | |
24 | #include <linux/platform_device.h> | |
25 | #include <linux/gpio.h> | |
26 | #include <mach/hardware.h> | |
27 | ||
219fed75 DA |
28 | static struct resource imx_csi_resources[] = { |
29 | [0] = { | |
30 | .start = 0x00224000, | |
31 | .end = 0x00224010, | |
32 | .flags = IORESOURCE_MEM, | |
33 | }, | |
34 | [1] = { | |
35 | .start = CSI_INT, | |
36 | .end = CSI_INT, | |
37 | .flags = IORESOURCE_IRQ, | |
38 | }, | |
39 | }; | |
40 | ||
41 | static u64 imx_csi_dmamask = 0xffffffffUL; | |
42 | ||
43 | struct platform_device imx_csi_device = { | |
44 | .name = "imx-csi", | |
45 | .id = 0, /* This is used to put cameras on this interface */ | |
46 | .dev = { | |
47 | .dma_mask = &imx_csi_dmamask, | |
48 | .coherent_dma_mask = 0xffffffff, | |
49 | }, | |
50 | .resource = imx_csi_resources, | |
51 | .num_resources = ARRAY_SIZE(imx_csi_resources), | |
52 | }; | |
53 | ||
54 | static struct resource imx_i2c_resources[] = { | |
55 | [0] = { | |
56 | .start = 0x00217000, | |
57 | .end = 0x00217010, | |
58 | .flags = IORESOURCE_MEM, | |
59 | }, | |
60 | [1] = { | |
61 | .start = I2C_INT, | |
62 | .end = I2C_INT, | |
63 | .flags = IORESOURCE_IRQ, | |
64 | }, | |
65 | }; | |
66 | ||
67 | struct platform_device imx_i2c_device = { | |
68 | .name = "imx-i2c", | |
69 | .id = 0, | |
70 | .resource = imx_i2c_resources, | |
71 | .num_resources = ARRAY_SIZE(imx_i2c_resources), | |
72 | }; | |
73 | ||
cfca8b53 PZ |
74 | static struct resource imx_uart1_resources[] = { |
75 | [0] = { | |
76 | .start = UART1_BASE_ADDR, | |
77 | .end = UART1_BASE_ADDR + 0xD0, | |
78 | .flags = IORESOURCE_MEM, | |
79 | }, | |
80 | [1] = { | |
81 | .start = UART1_MINT_RX, | |
82 | .end = UART1_MINT_RX, | |
83 | .flags = IORESOURCE_IRQ, | |
84 | }, | |
85 | [2] = { | |
86 | .start = UART1_MINT_TX, | |
87 | .end = UART1_MINT_TX, | |
88 | .flags = IORESOURCE_IRQ, | |
89 | }, | |
90 | [3] = { | |
91 | .start = UART1_MINT_RTS, | |
92 | .end = UART1_MINT_RTS, | |
93 | .flags = IORESOURCE_IRQ, | |
94 | }, | |
95 | }; | |
96 | ||
97 | struct platform_device imx_uart1_device = { | |
98 | .name = "imx-uart", | |
99 | .id = 0, | |
100 | .num_resources = ARRAY_SIZE(imx_uart1_resources), | |
101 | .resource = imx_uart1_resources, | |
102 | }; | |
103 | ||
104 | static struct resource imx_uart2_resources[] = { | |
105 | [0] = { | |
106 | .start = UART2_BASE_ADDR, | |
107 | .end = UART2_BASE_ADDR + 0xD0, | |
108 | .flags = IORESOURCE_MEM, | |
109 | }, | |
110 | [1] = { | |
111 | .start = UART2_MINT_RX, | |
112 | .end = UART2_MINT_RX, | |
113 | .flags = IORESOURCE_IRQ, | |
114 | }, | |
115 | [2] = { | |
116 | .start = UART2_MINT_TX, | |
117 | .end = UART2_MINT_TX, | |
118 | .flags = IORESOURCE_IRQ, | |
119 | }, | |
120 | [3] = { | |
121 | .start = UART2_MINT_RTS, | |
122 | .end = UART2_MINT_RTS, | |
123 | .flags = IORESOURCE_IRQ, | |
124 | }, | |
125 | }; | |
126 | ||
127 | struct platform_device imx_uart2_device = { | |
128 | .name = "imx-uart", | |
129 | .id = 1, | |
130 | .num_resources = ARRAY_SIZE(imx_uart2_resources), | |
131 | .resource = imx_uart2_resources, | |
132 | }; | |
133 | ||
219fed75 DA |
134 | static struct resource imx_rtc_resources[] = { |
135 | [0] = { | |
136 | .start = 0x00204000, | |
137 | .end = 0x00204024, | |
138 | .flags = IORESOURCE_MEM, | |
139 | }, | |
140 | [1] = { | |
141 | .start = RTC_INT, | |
142 | .end = RTC_INT, | |
143 | .flags = IORESOURCE_IRQ, | |
144 | }, | |
145 | [2] = { | |
146 | .start = RTC_SAMINT, | |
147 | .end = RTC_SAMINT, | |
148 | .flags = IORESOURCE_IRQ, | |
149 | }, | |
150 | }; | |
151 | ||
152 | struct platform_device imx_rtc_device = { | |
153 | .name = "rtc-imx", | |
154 | .id = 0, | |
155 | .resource = imx_rtc_resources, | |
156 | .num_resources = ARRAY_SIZE(imx_rtc_resources), | |
157 | }; | |
158 | ||
159 | static struct resource imx_wdt_resources[] = { | |
160 | [0] = { | |
161 | .start = 0x00201000, | |
162 | .end = 0x00201008, | |
163 | .flags = IORESOURCE_MEM, | |
164 | }, | |
165 | [1] = { | |
166 | .start = WDT_INT, | |
167 | .end = WDT_INT, | |
168 | .flags = IORESOURCE_IRQ, | |
169 | }, | |
170 | }; | |
171 | ||
172 | struct platform_device imx_wdt_device = { | |
173 | .name = "imx-wdt", | |
174 | .id = 0, | |
175 | .resource = imx_wdt_resources, | |
176 | .num_resources = ARRAY_SIZE(imx_wdt_resources), | |
177 | }; | |
178 | ||
179 | static struct resource imx_usb_resources[] = { | |
180 | [0] = { | |
181 | .start = 0x00212000, | |
182 | .end = 0x00212148, | |
183 | .flags = IORESOURCE_MEM, | |
184 | }, | |
185 | [1] = { | |
186 | .start = USBD_INT0, | |
187 | .end = USBD_INT0, | |
188 | .flags = IORESOURCE_IRQ, | |
189 | }, | |
190 | [2] = { | |
191 | .start = USBD_INT1, | |
192 | .end = USBD_INT1, | |
193 | .flags = IORESOURCE_IRQ, | |
194 | }, | |
195 | [3] = { | |
196 | .start = USBD_INT2, | |
197 | .end = USBD_INT2, | |
198 | .flags = IORESOURCE_IRQ, | |
199 | }, | |
200 | [4] = { | |
201 | .start = USBD_INT3, | |
202 | .end = USBD_INT3, | |
203 | .flags = IORESOURCE_IRQ, | |
204 | }, | |
205 | [5] = { | |
206 | .start = USBD_INT4, | |
207 | .end = USBD_INT4, | |
208 | .flags = IORESOURCE_IRQ, | |
209 | }, | |
210 | [6] = { | |
211 | .start = USBD_INT5, | |
212 | .end = USBD_INT5, | |
213 | .flags = IORESOURCE_IRQ, | |
214 | }, | |
215 | [7] = { | |
216 | .start = USBD_INT6, | |
217 | .end = USBD_INT6, | |
218 | .flags = IORESOURCE_IRQ, | |
219 | }, | |
220 | }; | |
221 | ||
222 | struct platform_device imx_usb_device = { | |
223 | .name = "imx_udc", | |
224 | .id = 0, | |
225 | .num_resources = ARRAY_SIZE(imx_usb_resources), | |
226 | .resource = imx_usb_resources, | |
227 | }; | |
228 | ||
cfca8b53 PZ |
229 | /* GPIO port description */ |
230 | static struct mxc_gpio_port imx_gpio_ports[] = { | |
231 | [0] = { | |
232 | .chip.label = "gpio-0", | |
233 | .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR), | |
234 | .irq = GPIO_INT_PORTA, | |
9d631b83 | 235 | .virtual_irq_start = MXC_GPIO_IRQ_START |
cfca8b53 PZ |
236 | }, |
237 | [1] = { | |
238 | .chip.label = "gpio-1", | |
239 | .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x100), | |
240 | .irq = GPIO_INT_PORTB, | |
9d631b83 | 241 | .virtual_irq_start = MXC_GPIO_IRQ_START + 32 |
cfca8b53 PZ |
242 | }, |
243 | [2] = { | |
244 | .chip.label = "gpio-2", | |
245 | .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x200), | |
246 | .irq = GPIO_INT_PORTC, | |
9d631b83 | 247 | .virtual_irq_start = MXC_GPIO_IRQ_START + 64 |
cfca8b53 PZ |
248 | }, |
249 | [3] = { | |
250 | .chip.label = "gpio-3", | |
251 | .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x300), | |
252 | .irq = GPIO_INT_PORTD, | |
9d631b83 | 253 | .virtual_irq_start = MXC_GPIO_IRQ_START + 96 |
cfca8b53 PZ |
254 | } |
255 | }; | |
256 | ||
257 | int __init mxc_register_gpios(void) | |
258 | { | |
259 | return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports)); | |
260 | } |