blob: ace0c4c3b66200961b3ba379f634c244ed7b9a82 [file] [log] [blame]
Alberto Panizzo5e9145e2009-05-19 10:01:03 +02001/*
2 * armadillo5x0.c
3 *
4 * Copyright 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com>
5 * updates in http://alberdroid.blogspot.com/
6 *
7 * Based on Atmark Techno, Inc. armadillo 500 BSP 2008
8 * Based on mx31ads.c and pcm037.c Great Work!
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23 * MA 02110-1301, USA.
24 */
25
26#include <linux/types.h>
27#include <linux/init.h>
28#include <linux/clk.h>
29#include <linux/platform_device.h>
30#include <linux/gpio.h>
31#include <linux/smsc911x.h>
32#include <linux/interrupt.h>
33#include <linux/irq.h>
Alberto Panizzoc3a9c7f2009-06-17 15:05:21 +020034#include <linux/mtd/physmap.h>
Alberto Panizzo0c8bad62009-06-17 15:06:30 +020035#include <linux/io.h>
Alberto Panizzoe33c0492009-10-15 19:24:51 +020036#include <linux/input.h>
Alberto Panizzo2097abc2009-10-15 19:33:24 +020037#include <linux/i2c.h>
Alberto Panizzob3aa1112010-02-26 18:36:32 +010038#include <linux/usb/otg.h>
39#include <linux/usb/ulpi.h>
40#include <linux/delay.h>
Alberto Panizzo5e9145e2009-05-19 10:01:03 +020041
42#include <mach/hardware.h>
43#include <asm/mach-types.h>
44#include <asm/mach/arch.h>
45#include <asm/mach/time.h>
46#include <asm/memory.h>
47#include <asm/mach/map.h>
48
49#include <mach/common.h>
Alberto Panizzo5e9145e2009-05-19 10:01:03 +020050#include <mach/iomux-mx3.h>
Alberto Panizzo5e9145e2009-05-19 10:01:03 +020051#include <mach/ipu.h>
52#include <mach/mx3fb.h>
Alberto Panizzob3aa1112010-02-26 18:36:32 +010053#include <mach/ulpi.h>
Alberto Panizzo5e9145e2009-05-19 10:01:03 +020054
Uwe Kleine-Königa2ceeef2010-06-16 12:23:11 +020055#include "devices-imx31.h"
Alberto Panizzo5e9145e2009-05-19 10:01:03 +020056#include "devices.h"
Alberto Panizzo0c8bad62009-06-17 15:06:30 +020057#include "crm_regs.h"
Alberto Panizzo5e9145e2009-05-19 10:01:03 +020058
59static int armadillo5x0_pins[] = {
60 /* UART1 */
61 MX31_PIN_CTS1__CTS1,
62 MX31_PIN_RTS1__RTS1,
63 MX31_PIN_TXD1__TXD1,
64 MX31_PIN_RXD1__RXD1,
65 /* UART2 */
66 MX31_PIN_CTS2__CTS2,
67 MX31_PIN_RTS2__RTS2,
68 MX31_PIN_TXD2__TXD2,
69 MX31_PIN_RXD2__RXD2,
70 /* LAN9118_IRQ */
71 IOMUX_MODE(MX31_PIN_GPIO1_0, IOMUX_CONFIG_GPIO),
72 /* SDHC1 */
73 MX31_PIN_SD1_DATA3__SD1_DATA3,
74 MX31_PIN_SD1_DATA2__SD1_DATA2,
75 MX31_PIN_SD1_DATA1__SD1_DATA1,
76 MX31_PIN_SD1_DATA0__SD1_DATA0,
77 MX31_PIN_SD1_CLK__SD1_CLK,
78 MX31_PIN_SD1_CMD__SD1_CMD,
79 /* Framebuffer */
80 MX31_PIN_LD0__LD0,
81 MX31_PIN_LD1__LD1,
82 MX31_PIN_LD2__LD2,
83 MX31_PIN_LD3__LD3,
84 MX31_PIN_LD4__LD4,
85 MX31_PIN_LD5__LD5,
86 MX31_PIN_LD6__LD6,
87 MX31_PIN_LD7__LD7,
88 MX31_PIN_LD8__LD8,
89 MX31_PIN_LD9__LD9,
90 MX31_PIN_LD10__LD10,
91 MX31_PIN_LD11__LD11,
92 MX31_PIN_LD12__LD12,
93 MX31_PIN_LD13__LD13,
94 MX31_PIN_LD14__LD14,
95 MX31_PIN_LD15__LD15,
96 MX31_PIN_LD16__LD16,
97 MX31_PIN_LD17__LD17,
98 MX31_PIN_VSYNC3__VSYNC3,
99 MX31_PIN_HSYNC__HSYNC,
100 MX31_PIN_FPSHIFT__FPSHIFT,
101 MX31_PIN_DRDY0__DRDY0,
102 IOMUX_MODE(MX31_PIN_LCS1, IOMUX_CONFIG_GPIO), /*ADV7125_PSAVE*/
Alberto Panizzoe9a6c5d2009-10-15 19:31:07 +0200103 /* I2C2 */
104 MX31_PIN_CSPI2_MOSI__SCL,
105 MX31_PIN_CSPI2_MISO__SDA,
Alberto Panizzob3aa1112010-02-26 18:36:32 +0100106 /* OTG */
107 MX31_PIN_USBOTG_DATA0__USBOTG_DATA0,
108 MX31_PIN_USBOTG_DATA1__USBOTG_DATA1,
109 MX31_PIN_USBOTG_DATA2__USBOTG_DATA2,
110 MX31_PIN_USBOTG_DATA3__USBOTG_DATA3,
111 MX31_PIN_USBOTG_DATA4__USBOTG_DATA4,
112 MX31_PIN_USBOTG_DATA5__USBOTG_DATA5,
113 MX31_PIN_USBOTG_DATA6__USBOTG_DATA6,
114 MX31_PIN_USBOTG_DATA7__USBOTG_DATA7,
115 MX31_PIN_USBOTG_CLK__USBOTG_CLK,
116 MX31_PIN_USBOTG_DIR__USBOTG_DIR,
117 MX31_PIN_USBOTG_NXT__USBOTG_NXT,
118 MX31_PIN_USBOTG_STP__USBOTG_STP,
119 /* USB host 2 */
120 IOMUX_MODE(MX31_PIN_USBH2_CLK, IOMUX_CONFIG_FUNC),
121 IOMUX_MODE(MX31_PIN_USBH2_DIR, IOMUX_CONFIG_FUNC),
122 IOMUX_MODE(MX31_PIN_USBH2_NXT, IOMUX_CONFIG_FUNC),
123 IOMUX_MODE(MX31_PIN_USBH2_STP, IOMUX_CONFIG_FUNC),
124 IOMUX_MODE(MX31_PIN_USBH2_DATA0, IOMUX_CONFIG_FUNC),
125 IOMUX_MODE(MX31_PIN_USBH2_DATA1, IOMUX_CONFIG_FUNC),
126 IOMUX_MODE(MX31_PIN_STXD3, IOMUX_CONFIG_FUNC),
127 IOMUX_MODE(MX31_PIN_SRXD3, IOMUX_CONFIG_FUNC),
128 IOMUX_MODE(MX31_PIN_SCK3, IOMUX_CONFIG_FUNC),
129 IOMUX_MODE(MX31_PIN_SFS3, IOMUX_CONFIG_FUNC),
130 IOMUX_MODE(MX31_PIN_STXD6, IOMUX_CONFIG_FUNC),
131 IOMUX_MODE(MX31_PIN_SRXD6, IOMUX_CONFIG_FUNC),
Alberto Panizzo0c8bad62009-06-17 15:06:30 +0200132};
Alberto Panizzoe9a6c5d2009-10-15 19:31:07 +0200133
Alberto Panizzob3aa1112010-02-26 18:36:32 +0100134/* USB */
Alberto Panizzob3aa1112010-02-26 18:36:32 +0100135
136#define OTG_RESET IOMUX_TO_GPIO(MX31_PIN_STXD4)
137#define USBH2_RESET IOMUX_TO_GPIO(MX31_PIN_SCK6)
138#define USBH2_CS IOMUX_TO_GPIO(MX31_PIN_GPIO1_3)
139
140#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
141 PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
142
143static int usbotg_init(struct platform_device *pdev)
144{
145 int err;
146
147 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG);
148 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG);
149 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG);
150 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG);
151 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG);
152 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG);
153 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG);
154 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG);
155 mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG);
156 mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG);
157 mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG);
158 mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG);
159
160 /* Chip already enabled by hardware */
161 /* OTG phy reset*/
162 err = gpio_request(OTG_RESET, "USB-OTG-RESET");
163 if (err) {
164 pr_err("Failed to request the usb otg reset gpio\n");
165 return err;
166 }
167
168 err = gpio_direction_output(OTG_RESET, 1/*HIGH*/);
169 if (err) {
170 pr_err("Failed to reset the usb otg phy\n");
171 goto otg_free_reset;
172 }
173
174 gpio_set_value(OTG_RESET, 0/*LOW*/);
175 mdelay(5);
176 gpio_set_value(OTG_RESET, 1/*HIGH*/);
Sascha Hauer4bd597b2011-01-03 11:30:28 +0100177 mdelay(10);
Alberto Panizzob3aa1112010-02-26 18:36:32 +0100178
Sascha Hauer4bd597b2011-01-03 11:30:28 +0100179 return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED |
180 MXC_EHCI_INTERFACE_DIFF_UNI);
Alberto Panizzob3aa1112010-02-26 18:36:32 +0100181
182otg_free_reset:
183 gpio_free(OTG_RESET);
184 return err;
185}
186
187static int usbh2_init(struct platform_device *pdev)
188{
189 int err;
190
191 mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG);
192 mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG);
193 mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG);
194 mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG);
195 mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG);
196 mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG);
197 mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG);
198 mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG);
199 mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG);
200 mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG);
201 mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG);
202 mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG);
203
204 mxc_iomux_set_gpr(MUX_PGP_UH2, true);
205
206
207 /* Enable the chip */
208 err = gpio_request(USBH2_CS, "USB-H2-CS");
209 if (err) {
210 pr_err("Failed to request the usb host 2 CS gpio\n");
211 return err;
212 }
213
214 err = gpio_direction_output(USBH2_CS, 0/*Enabled*/);
215 if (err) {
216 pr_err("Failed to drive the usb host 2 CS gpio\n");
217 goto h2_free_cs;
218 }
219
220 /* H2 phy reset*/
221 err = gpio_request(USBH2_RESET, "USB-H2-RESET");
222 if (err) {
223 pr_err("Failed to request the usb host 2 reset gpio\n");
224 goto h2_free_cs;
225 }
226
227 err = gpio_direction_output(USBH2_RESET, 1/*HIGH*/);
228 if (err) {
229 pr_err("Failed to reset the usb host 2 phy\n");
230 goto h2_free_reset;
231 }
232
233 gpio_set_value(USBH2_RESET, 0/*LOW*/);
234 mdelay(5);
235 gpio_set_value(USBH2_RESET, 1/*HIGH*/);
Sascha Hauer4bd597b2011-01-03 11:30:28 +0100236 mdelay(10);
Alberto Panizzob3aa1112010-02-26 18:36:32 +0100237
Sascha Hauer4bd597b2011-01-03 11:30:28 +0100238 return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED |
239 MXC_EHCI_INTERFACE_DIFF_UNI);
Alberto Panizzob3aa1112010-02-26 18:36:32 +0100240
241h2_free_reset:
242 gpio_free(USBH2_RESET);
243h2_free_cs:
244 gpio_free(USBH2_CS);
245 return err;
246}
247
Uwe Kleine-König2d58de22010-11-15 11:57:49 +0100248static struct mxc_usbh_platform_data usbotg_pdata __initdata = {
Alberto Panizzob3aa1112010-02-26 18:36:32 +0100249 .init = usbotg_init,
250 .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
Alberto Panizzob3aa1112010-02-26 18:36:32 +0100251};
252
Uwe Kleine-König2d58de22010-11-15 11:57:49 +0100253static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
Alberto Panizzob3aa1112010-02-26 18:36:32 +0100254 .init = usbh2_init,
255 .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
Alberto Panizzob3aa1112010-02-26 18:36:32 +0100256};
Alberto Panizzob3aa1112010-02-26 18:36:32 +0100257
Alberto Panizzo2097abc2009-10-15 19:33:24 +0200258/* RTC over I2C*/
259#define ARMADILLO5X0_RTC_GPIO IOMUX_TO_GPIO(MX31_PIN_SRXD4)
260
261static struct i2c_board_info armadillo5x0_i2c_rtc = {
262 I2C_BOARD_INFO("s35390a", 0x30),
263};
264
Alberto Panizzoe33c0492009-10-15 19:24:51 +0200265/* GPIO BUTTONS */
266static struct gpio_keys_button armadillo5x0_buttons[] = {
267 {
268 .code = KEY_ENTER, /*28*/
269 .gpio = IOMUX_TO_GPIO(MX31_PIN_SCLK0),
270 .active_low = 1,
271 .desc = "menu",
272 .wakeup = 1,
273 }, {
274 .code = KEY_BACK, /*158*/
275 .gpio = IOMUX_TO_GPIO(MX31_PIN_SRST0),
276 .active_low = 1,
277 .desc = "back",
278 .wakeup = 1,
279 }
280};
281
Uwe Kleine-König53094982011-02-28 18:04:33 +0100282static const struct gpio_keys_platform_data
283 armadillo5x0_button_data __initconst = {
Alberto Panizzoe33c0492009-10-15 19:24:51 +0200284 .buttons = armadillo5x0_buttons,
285 .nbuttons = ARRAY_SIZE(armadillo5x0_buttons),
286};
287
Alberto Panizzo0c8bad62009-06-17 15:06:30 +0200288/*
289 * NAND Flash
290 */
Uwe Kleine-Königa2ceeef2010-06-16 12:23:11 +0200291static const struct mxc_nand_platform_data
292armadillo5x0_nand_board_info __initconst = {
Alberto Panizzo0c8bad62009-06-17 15:06:30 +0200293 .width = 1,
294 .hw_ecc = 1,
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200295};
296
297/*
Alberto Panizzoc3a9c7f2009-06-17 15:05:21 +0200298 * MTD NOR Flash
299 */
300static struct mtd_partition armadillo5x0_nor_flash_partitions[] = {
301 {
302 .name = "nor.bootloader",
303 .offset = 0x00000000,
304 .size = 4*32*1024,
305 }, {
306 .name = "nor.kernel",
307 .offset = MTDPART_OFS_APPEND,
308 .size = 16*128*1024,
309 }, {
310 .name = "nor.userland",
311 .offset = MTDPART_OFS_APPEND,
312 .size = 110*128*1024,
313 }, {
314 .name = "nor.config",
315 .offset = MTDPART_OFS_APPEND,
316 .size = 1*128*1024,
317 },
318};
319
320static struct physmap_flash_data armadillo5x0_nor_flash_pdata = {
321 .width = 2,
322 .parts = armadillo5x0_nor_flash_partitions,
323 .nr_parts = ARRAY_SIZE(armadillo5x0_nor_flash_partitions),
324};
325
326static struct resource armadillo5x0_nor_flash_resource = {
327 .flags = IORESOURCE_MEM,
Uwe Kleine-Königf568dd72009-12-09 11:57:21 +0100328 .start = MX31_CS0_BASE_ADDR,
329 .end = MX31_CS0_BASE_ADDR + SZ_64M - 1,
Alberto Panizzoc3a9c7f2009-06-17 15:05:21 +0200330};
331
332static struct platform_device armadillo5x0_nor_flash = {
333 .name = "physmap-flash",
334 .id = -1,
335 .num_resources = 1,
336 .resource = &armadillo5x0_nor_flash_resource,
337};
338
339/*
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200340 * FB support
341 */
342static const struct fb_videomode fb_modedb[] = {
343 { /* 640x480 @ 60 Hz */
344 .name = "CRT-VGA",
345 .refresh = 60,
346 .xres = 640,
347 .yres = 480,
348 .pixclock = 39721,
349 .left_margin = 35,
350 .right_margin = 115,
351 .upper_margin = 43,
352 .lower_margin = 1,
353 .hsync_len = 10,
354 .vsync_len = 1,
355 .sync = FB_SYNC_OE_ACT_HIGH,
356 .vmode = FB_VMODE_NONINTERLACED,
357 .flag = 0,
358 }, {/* 800x600 @ 56 Hz */
359 .name = "CRT-SVGA",
360 .refresh = 56,
361 .xres = 800,
362 .yres = 600,
363 .pixclock = 30000,
364 .left_margin = 30,
365 .right_margin = 108,
366 .upper_margin = 13,
367 .lower_margin = 10,
368 .hsync_len = 10,
369 .vsync_len = 1,
370 .sync = FB_SYNC_OE_ACT_HIGH | FB_SYNC_HOR_HIGH_ACT |
371 FB_SYNC_VERT_HIGH_ACT,
372 .vmode = FB_VMODE_NONINTERLACED,
373 .flag = 0,
374 },
375};
376
377static struct ipu_platform_data mx3_ipu_data = {
378 .irq_base = MXC_IPU_IRQ_START,
379};
380
381static struct mx3fb_platform_data mx3fb_pdata = {
382 .dma_dev = &mx3_ipu.dev,
383 .name = "CRT-VGA",
384 .mode = fb_modedb,
385 .num_modes = ARRAY_SIZE(fb_modedb),
386};
387
388/*
389 * SDHC 1
390 * MMC support
391 */
392static int armadillo5x0_sdhc1_get_ro(struct device *dev)
393{
394 return gpio_get_value(IOMUX_TO_GPIO(MX31_PIN_ATA_RESET_B));
395}
396
397static int armadillo5x0_sdhc1_init(struct device *dev,
398 irq_handler_t detect_irq, void *data)
399{
400 int ret;
401 int gpio_det, gpio_wp;
402
403 gpio_det = IOMUX_TO_GPIO(MX31_PIN_ATA_DMACK);
404 gpio_wp = IOMUX_TO_GPIO(MX31_PIN_ATA_RESET_B);
405
406 ret = gpio_request(gpio_det, "sdhc-card-detect");
407 if (ret)
408 return ret;
409
410 gpio_direction_input(gpio_det);
411
412 ret = gpio_request(gpio_wp, "sdhc-write-protect");
413 if (ret)
414 goto err_gpio_free;
415
416 gpio_direction_input(gpio_wp);
417
418 /* When supported the trigger type have to be BOTH */
419 ret = request_irq(IOMUX_TO_IRQ(MX31_PIN_ATA_DMACK), detect_irq,
420 IRQF_DISABLED | IRQF_TRIGGER_FALLING,
421 "sdhc-detect", data);
422
423 if (ret)
424 goto err_gpio_free_2;
425
426 return 0;
427
428err_gpio_free_2:
429 gpio_free(gpio_wp);
430
431err_gpio_free:
432 gpio_free(gpio_det);
433
434 return ret;
435
436}
437
438static void armadillo5x0_sdhc1_exit(struct device *dev, void *data)
439{
440 free_irq(IOMUX_TO_IRQ(MX31_PIN_ATA_DMACK), data);
441 gpio_free(IOMUX_TO_GPIO(MX31_PIN_ATA_DMACK));
442 gpio_free(IOMUX_TO_GPIO(MX31_PIN_ATA_RESET_B));
443}
444
Uwe Kleine-König6a697e32010-11-12 11:10:55 +0100445static const struct imxmmc_platform_data sdhc_pdata __initconst = {
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200446 .get_ro = armadillo5x0_sdhc1_get_ro,
447 .init = armadillo5x0_sdhc1_init,
448 .exit = armadillo5x0_sdhc1_exit,
449};
450
451/*
452 * SMSC 9118
453 * Network support
454 */
455static struct resource armadillo5x0_smc911x_resources[] = {
456 {
Uwe Kleine-Königf568dd72009-12-09 11:57:21 +0100457 .start = MX31_CS3_BASE_ADDR,
458 .end = MX31_CS3_BASE_ADDR + SZ_32M - 1,
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200459 .flags = IORESOURCE_MEM,
460 }, {
461 .start = IOMUX_TO_IRQ(MX31_PIN_GPIO1_0),
462 .end = IOMUX_TO_IRQ(MX31_PIN_GPIO1_0),
463 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
464 },
465};
466
467static struct smsc911x_platform_config smsc911x_info = {
Alberto Panizzo07299ca2009-10-15 19:29:05 +0200468 .flags = SMSC911X_USE_16BIT,
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200469 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
470 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
471};
472
473static struct platform_device armadillo5x0_smc911x_device = {
474 .name = "smsc911x",
475 .id = -1,
476 .num_resources = ARRAY_SIZE(armadillo5x0_smc911x_resources),
477 .resource = armadillo5x0_smc911x_resources,
478 .dev = {
479 .platform_data = &smsc911x_info,
480 },
481};
482
483/* UART device data */
Uwe Kleine-König16cf5c42010-06-23 11:46:16 +0200484static const struct imxuart_platform_data uart_pdata __initconst = {
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200485 .flags = IMXUART_HAVE_RTSCTS,
486};
487
488static struct platform_device *devices[] __initdata = {
489 &armadillo5x0_smc911x_device,
490};
491
492/*
493 * Perform board specific initializations
494 */
495static void __init armadillo5x0_init(void)
496{
497 mxc_iomux_setup_multiple_pins(armadillo5x0_pins,
498 ARRAY_SIZE(armadillo5x0_pins), "armadillo5x0");
499
500 platform_add_devices(devices, ARRAY_SIZE(devices));
Uwe Kleine-König53094982011-02-28 18:04:33 +0100501 imx_add_gpio_keys(&armadillo5x0_button_data);
Uwe Kleine-König4a9b8b02010-06-16 18:03:05 +0200502 imx31_add_imx_i2c1(NULL);
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200503
504 /* Register UART */
Uwe Kleine-König16cf5c42010-06-23 11:46:16 +0200505 imx31_add_imx_uart0(&uart_pdata);
506 imx31_add_imx_uart1(&uart_pdata);
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200507
508 /* SMSC9118 IRQ pin */
509 gpio_direction_input(MX31_PIN_GPIO1_0);
510
511 /* Register SDHC */
Uwe Kleine-König6a697e32010-11-12 11:10:55 +0100512 imx31_add_mxc_mmc(0, &sdhc_pdata);
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200513
514 /* Register FB */
515 mxc_register_device(&mx3_ipu, &mx3_ipu_data);
516 mxc_register_device(&mx3_fb, &mx3fb_pdata);
Alberto Panizzoc3a9c7f2009-06-17 15:05:21 +0200517
518 /* Register NOR Flash */
519 mxc_register_device(&armadillo5x0_nor_flash,
520 &armadillo5x0_nor_flash_pdata);
Alberto Panizzo0c8bad62009-06-17 15:06:30 +0200521
522 /* Register NAND Flash */
Uwe Kleine-Königa2ceeef2010-06-16 12:23:11 +0200523 imx31_add_mxc_nand(&armadillo5x0_nand_board_info);
Alberto Panizzo0c8bad62009-06-17 15:06:30 +0200524
525 /* set NAND page size to 2k if not configured via boot mode pins */
526 __raw_writel(__raw_readl(MXC_CCM_RCSR) | (1 << 30), MXC_CCM_RCSR);
Alberto Panizzo2097abc2009-10-15 19:33:24 +0200527
528 /* RTC */
529 /* Get RTC IRQ and register the chip */
530 if (gpio_request(ARMADILLO5X0_RTC_GPIO, "rtc") == 0) {
531 if (gpio_direction_input(ARMADILLO5X0_RTC_GPIO) == 0)
532 armadillo5x0_i2c_rtc.irq = gpio_to_irq(ARMADILLO5X0_RTC_GPIO);
533 else
534 gpio_free(ARMADILLO5X0_RTC_GPIO);
535 }
536 if (armadillo5x0_i2c_rtc.irq == 0)
537 pr_warning("armadillo5x0_init: failed to get RTC IRQ\n");
538 i2c_register_board_info(1, &armadillo5x0_i2c_rtc, 1);
Alberto Panizzob3aa1112010-02-26 18:36:32 +0100539
540 /* USB */
Alberto Panizzob3aa1112010-02-26 18:36:32 +0100541
Sascha Hauer48f6b092011-03-02 09:27:42 +0100542 usbotg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
543 ULPI_OTG_DRVVBUS_EXT);
544 if (usbotg_pdata.otg)
545 imx31_add_mxc_ehci_otg(&usbotg_pdata);
546 usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
547 ULPI_OTG_DRVVBUS_EXT);
548 if (usbh2_pdata.otg)
549 imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200550}
551
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200552static void __init armadillo5x0_timer_init(void)
553{
554 mx31_clocks_init(26000000);
555}
556
557static struct sys_timer armadillo5x0_timer = {
558 .init = armadillo5x0_timer_init,
559};
560
561MACHINE_START(ARMADILLO5X0, "Armadillo-500")
562 /* Maintainer: Alberto Panizzo */
Uwe Kleine-König97976e22011-02-07 16:35:20 +0100563 .boot_params = MX3x_PHYS_OFFSET + 0x100,
564 .map_io = mx31_map_io,
565 .init_early = imx31_init_early,
566 .init_irq = mx31_init_irq,
567 .timer = &armadillo5x0_timer,
568 .init_machine = armadillo5x0_init,
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200569MACHINE_END