blob: e48072cb9bf6d6814b407da807e291f9dc79066a [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>
37#include <linux/gpio_keys.h>
Alberto Panizzo2097abc2009-10-15 19:33:24 +020038#include <linux/i2c.h>
Alberto Panizzob3aa1112010-02-26 18:36:32 +010039#include <linux/usb/otg.h>
40#include <linux/usb/ulpi.h>
41#include <linux/delay.h>
Alberto Panizzo5e9145e2009-05-19 10:01:03 +020042
43#include <mach/hardware.h>
44#include <asm/mach-types.h>
45#include <asm/mach/arch.h>
46#include <asm/mach/time.h>
47#include <asm/memory.h>
48#include <asm/mach/map.h>
49
50#include <mach/common.h>
Alberto Panizzo5e9145e2009-05-19 10:01:03 +020051#include <mach/iomux-mx3.h>
Alberto Panizzo5e9145e2009-05-19 10:01:03 +020052#include <mach/ipu.h>
53#include <mach/mx3fb.h>
Alberto Panizzob3aa1112010-02-26 18:36:32 +010054#include <mach/mxc_ehci.h>
55#include <mach/ulpi.h>
Alberto Panizzo5e9145e2009-05-19 10:01:03 +020056
Uwe Kleine-Königa2ceeef2010-06-16 12:23:11 +020057#include "devices-imx31.h"
Alberto Panizzo5e9145e2009-05-19 10:01:03 +020058#include "devices.h"
Alberto Panizzo0c8bad62009-06-17 15:06:30 +020059#include "crm_regs.h"
Alberto Panizzo5e9145e2009-05-19 10:01:03 +020060
61static int armadillo5x0_pins[] = {
62 /* UART1 */
63 MX31_PIN_CTS1__CTS1,
64 MX31_PIN_RTS1__RTS1,
65 MX31_PIN_TXD1__TXD1,
66 MX31_PIN_RXD1__RXD1,
67 /* UART2 */
68 MX31_PIN_CTS2__CTS2,
69 MX31_PIN_RTS2__RTS2,
70 MX31_PIN_TXD2__TXD2,
71 MX31_PIN_RXD2__RXD2,
72 /* LAN9118_IRQ */
73 IOMUX_MODE(MX31_PIN_GPIO1_0, IOMUX_CONFIG_GPIO),
74 /* SDHC1 */
75 MX31_PIN_SD1_DATA3__SD1_DATA3,
76 MX31_PIN_SD1_DATA2__SD1_DATA2,
77 MX31_PIN_SD1_DATA1__SD1_DATA1,
78 MX31_PIN_SD1_DATA0__SD1_DATA0,
79 MX31_PIN_SD1_CLK__SD1_CLK,
80 MX31_PIN_SD1_CMD__SD1_CMD,
81 /* Framebuffer */
82 MX31_PIN_LD0__LD0,
83 MX31_PIN_LD1__LD1,
84 MX31_PIN_LD2__LD2,
85 MX31_PIN_LD3__LD3,
86 MX31_PIN_LD4__LD4,
87 MX31_PIN_LD5__LD5,
88 MX31_PIN_LD6__LD6,
89 MX31_PIN_LD7__LD7,
90 MX31_PIN_LD8__LD8,
91 MX31_PIN_LD9__LD9,
92 MX31_PIN_LD10__LD10,
93 MX31_PIN_LD11__LD11,
94 MX31_PIN_LD12__LD12,
95 MX31_PIN_LD13__LD13,
96 MX31_PIN_LD14__LD14,
97 MX31_PIN_LD15__LD15,
98 MX31_PIN_LD16__LD16,
99 MX31_PIN_LD17__LD17,
100 MX31_PIN_VSYNC3__VSYNC3,
101 MX31_PIN_HSYNC__HSYNC,
102 MX31_PIN_FPSHIFT__FPSHIFT,
103 MX31_PIN_DRDY0__DRDY0,
104 IOMUX_MODE(MX31_PIN_LCS1, IOMUX_CONFIG_GPIO), /*ADV7125_PSAVE*/
Alberto Panizzoe9a6c5d2009-10-15 19:31:07 +0200105 /* I2C2 */
106 MX31_PIN_CSPI2_MOSI__SCL,
107 MX31_PIN_CSPI2_MISO__SDA,
Alberto Panizzob3aa1112010-02-26 18:36:32 +0100108 /* OTG */
109 MX31_PIN_USBOTG_DATA0__USBOTG_DATA0,
110 MX31_PIN_USBOTG_DATA1__USBOTG_DATA1,
111 MX31_PIN_USBOTG_DATA2__USBOTG_DATA2,
112 MX31_PIN_USBOTG_DATA3__USBOTG_DATA3,
113 MX31_PIN_USBOTG_DATA4__USBOTG_DATA4,
114 MX31_PIN_USBOTG_DATA5__USBOTG_DATA5,
115 MX31_PIN_USBOTG_DATA6__USBOTG_DATA6,
116 MX31_PIN_USBOTG_DATA7__USBOTG_DATA7,
117 MX31_PIN_USBOTG_CLK__USBOTG_CLK,
118 MX31_PIN_USBOTG_DIR__USBOTG_DIR,
119 MX31_PIN_USBOTG_NXT__USBOTG_NXT,
120 MX31_PIN_USBOTG_STP__USBOTG_STP,
121 /* USB host 2 */
122 IOMUX_MODE(MX31_PIN_USBH2_CLK, IOMUX_CONFIG_FUNC),
123 IOMUX_MODE(MX31_PIN_USBH2_DIR, IOMUX_CONFIG_FUNC),
124 IOMUX_MODE(MX31_PIN_USBH2_NXT, IOMUX_CONFIG_FUNC),
125 IOMUX_MODE(MX31_PIN_USBH2_STP, IOMUX_CONFIG_FUNC),
126 IOMUX_MODE(MX31_PIN_USBH2_DATA0, IOMUX_CONFIG_FUNC),
127 IOMUX_MODE(MX31_PIN_USBH2_DATA1, IOMUX_CONFIG_FUNC),
128 IOMUX_MODE(MX31_PIN_STXD3, IOMUX_CONFIG_FUNC),
129 IOMUX_MODE(MX31_PIN_SRXD3, IOMUX_CONFIG_FUNC),
130 IOMUX_MODE(MX31_PIN_SCK3, IOMUX_CONFIG_FUNC),
131 IOMUX_MODE(MX31_PIN_SFS3, IOMUX_CONFIG_FUNC),
132 IOMUX_MODE(MX31_PIN_STXD6, IOMUX_CONFIG_FUNC),
133 IOMUX_MODE(MX31_PIN_SRXD6, IOMUX_CONFIG_FUNC),
Alberto Panizzo0c8bad62009-06-17 15:06:30 +0200134};
Alberto Panizzoe9a6c5d2009-10-15 19:31:07 +0200135
Alberto Panizzob3aa1112010-02-26 18:36:32 +0100136/* USB */
137#if defined(CONFIG_USB_ULPI)
138
139#define OTG_RESET IOMUX_TO_GPIO(MX31_PIN_STXD4)
140#define USBH2_RESET IOMUX_TO_GPIO(MX31_PIN_SCK6)
141#define USBH2_CS IOMUX_TO_GPIO(MX31_PIN_GPIO1_3)
142
143#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
144 PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
145
146static int usbotg_init(struct platform_device *pdev)
147{
148 int err;
149
150 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG);
151 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG);
152 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG);
153 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG);
154 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG);
155 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG);
156 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG);
157 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG);
158 mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG);
159 mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG);
160 mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG);
161 mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG);
162
163 /* Chip already enabled by hardware */
164 /* OTG phy reset*/
165 err = gpio_request(OTG_RESET, "USB-OTG-RESET");
166 if (err) {
167 pr_err("Failed to request the usb otg reset gpio\n");
168 return err;
169 }
170
171 err = gpio_direction_output(OTG_RESET, 1/*HIGH*/);
172 if (err) {
173 pr_err("Failed to reset the usb otg phy\n");
174 goto otg_free_reset;
175 }
176
177 gpio_set_value(OTG_RESET, 0/*LOW*/);
178 mdelay(5);
179 gpio_set_value(OTG_RESET, 1/*HIGH*/);
180
181 return 0;
182
183otg_free_reset:
184 gpio_free(OTG_RESET);
185 return err;
186}
187
188static int usbh2_init(struct platform_device *pdev)
189{
190 int err;
191
192 mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG);
193 mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG);
194 mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG);
195 mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG);
196 mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG);
197 mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG);
198 mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG);
199 mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG);
200 mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG);
201 mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG);
202 mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG);
203 mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG);
204
205 mxc_iomux_set_gpr(MUX_PGP_UH2, true);
206
207
208 /* Enable the chip */
209 err = gpio_request(USBH2_CS, "USB-H2-CS");
210 if (err) {
211 pr_err("Failed to request the usb host 2 CS gpio\n");
212 return err;
213 }
214
215 err = gpio_direction_output(USBH2_CS, 0/*Enabled*/);
216 if (err) {
217 pr_err("Failed to drive the usb host 2 CS gpio\n");
218 goto h2_free_cs;
219 }
220
221 /* H2 phy reset*/
222 err = gpio_request(USBH2_RESET, "USB-H2-RESET");
223 if (err) {
224 pr_err("Failed to request the usb host 2 reset gpio\n");
225 goto h2_free_cs;
226 }
227
228 err = gpio_direction_output(USBH2_RESET, 1/*HIGH*/);
229 if (err) {
230 pr_err("Failed to reset the usb host 2 phy\n");
231 goto h2_free_reset;
232 }
233
234 gpio_set_value(USBH2_RESET, 0/*LOW*/);
235 mdelay(5);
236 gpio_set_value(USBH2_RESET, 1/*HIGH*/);
237
238 return 0;
239
240h2_free_reset:
241 gpio_free(USBH2_RESET);
242h2_free_cs:
243 gpio_free(USBH2_CS);
244 return err;
245}
246
247static struct mxc_usbh_platform_data usbotg_pdata = {
248 .init = usbotg_init,
249 .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
250 .flags = MXC_EHCI_POWER_PINS_ENABLED | MXC_EHCI_INTERFACE_DIFF_UNI,
251};
252
253static struct mxc_usbh_platform_data usbh2_pdata = {
254 .init = usbh2_init,
255 .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
256 .flags = MXC_EHCI_POWER_PINS_ENABLED | MXC_EHCI_INTERFACE_DIFF_UNI,
257};
258#endif /* CONFIG_USB_ULPI */
259
Alberto Panizzo2097abc2009-10-15 19:33:24 +0200260/* RTC over I2C*/
261#define ARMADILLO5X0_RTC_GPIO IOMUX_TO_GPIO(MX31_PIN_SRXD4)
262
263static struct i2c_board_info armadillo5x0_i2c_rtc = {
264 I2C_BOARD_INFO("s35390a", 0x30),
265};
266
Alberto Panizzoe33c0492009-10-15 19:24:51 +0200267/* GPIO BUTTONS */
268static struct gpio_keys_button armadillo5x0_buttons[] = {
269 {
270 .code = KEY_ENTER, /*28*/
271 .gpio = IOMUX_TO_GPIO(MX31_PIN_SCLK0),
272 .active_low = 1,
273 .desc = "menu",
274 .wakeup = 1,
275 }, {
276 .code = KEY_BACK, /*158*/
277 .gpio = IOMUX_TO_GPIO(MX31_PIN_SRST0),
278 .active_low = 1,
279 .desc = "back",
280 .wakeup = 1,
281 }
282};
283
284static struct gpio_keys_platform_data armadillo5x0_button_data = {
285 .buttons = armadillo5x0_buttons,
286 .nbuttons = ARRAY_SIZE(armadillo5x0_buttons),
287};
288
289static struct platform_device armadillo5x0_button_device = {
290 .name = "gpio-keys",
291 .id = -1,
292 .num_resources = 0,
293 .dev = {
294 .platform_data = &armadillo5x0_button_data,
295 }
296};
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200297
Alberto Panizzo0c8bad62009-06-17 15:06:30 +0200298/*
299 * NAND Flash
300 */
Uwe Kleine-Königa2ceeef2010-06-16 12:23:11 +0200301static const struct mxc_nand_platform_data
302armadillo5x0_nand_board_info __initconst = {
Alberto Panizzo0c8bad62009-06-17 15:06:30 +0200303 .width = 1,
304 .hw_ecc = 1,
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200305};
306
307/*
Alberto Panizzoc3a9c7f2009-06-17 15:05:21 +0200308 * MTD NOR Flash
309 */
310static struct mtd_partition armadillo5x0_nor_flash_partitions[] = {
311 {
312 .name = "nor.bootloader",
313 .offset = 0x00000000,
314 .size = 4*32*1024,
315 }, {
316 .name = "nor.kernel",
317 .offset = MTDPART_OFS_APPEND,
318 .size = 16*128*1024,
319 }, {
320 .name = "nor.userland",
321 .offset = MTDPART_OFS_APPEND,
322 .size = 110*128*1024,
323 }, {
324 .name = "nor.config",
325 .offset = MTDPART_OFS_APPEND,
326 .size = 1*128*1024,
327 },
328};
329
330static struct physmap_flash_data armadillo5x0_nor_flash_pdata = {
331 .width = 2,
332 .parts = armadillo5x0_nor_flash_partitions,
333 .nr_parts = ARRAY_SIZE(armadillo5x0_nor_flash_partitions),
334};
335
336static struct resource armadillo5x0_nor_flash_resource = {
337 .flags = IORESOURCE_MEM,
Uwe Kleine-Königf568dd72009-12-09 11:57:21 +0100338 .start = MX31_CS0_BASE_ADDR,
339 .end = MX31_CS0_BASE_ADDR + SZ_64M - 1,
Alberto Panizzoc3a9c7f2009-06-17 15:05:21 +0200340};
341
342static struct platform_device armadillo5x0_nor_flash = {
343 .name = "physmap-flash",
344 .id = -1,
345 .num_resources = 1,
346 .resource = &armadillo5x0_nor_flash_resource,
347};
348
349/*
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200350 * FB support
351 */
352static const struct fb_videomode fb_modedb[] = {
353 { /* 640x480 @ 60 Hz */
354 .name = "CRT-VGA",
355 .refresh = 60,
356 .xres = 640,
357 .yres = 480,
358 .pixclock = 39721,
359 .left_margin = 35,
360 .right_margin = 115,
361 .upper_margin = 43,
362 .lower_margin = 1,
363 .hsync_len = 10,
364 .vsync_len = 1,
365 .sync = FB_SYNC_OE_ACT_HIGH,
366 .vmode = FB_VMODE_NONINTERLACED,
367 .flag = 0,
368 }, {/* 800x600 @ 56 Hz */
369 .name = "CRT-SVGA",
370 .refresh = 56,
371 .xres = 800,
372 .yres = 600,
373 .pixclock = 30000,
374 .left_margin = 30,
375 .right_margin = 108,
376 .upper_margin = 13,
377 .lower_margin = 10,
378 .hsync_len = 10,
379 .vsync_len = 1,
380 .sync = FB_SYNC_OE_ACT_HIGH | FB_SYNC_HOR_HIGH_ACT |
381 FB_SYNC_VERT_HIGH_ACT,
382 .vmode = FB_VMODE_NONINTERLACED,
383 .flag = 0,
384 },
385};
386
387static struct ipu_platform_data mx3_ipu_data = {
388 .irq_base = MXC_IPU_IRQ_START,
389};
390
391static struct mx3fb_platform_data mx3fb_pdata = {
392 .dma_dev = &mx3_ipu.dev,
393 .name = "CRT-VGA",
394 .mode = fb_modedb,
395 .num_modes = ARRAY_SIZE(fb_modedb),
396};
397
398/*
399 * SDHC 1
400 * MMC support
401 */
402static int armadillo5x0_sdhc1_get_ro(struct device *dev)
403{
404 return gpio_get_value(IOMUX_TO_GPIO(MX31_PIN_ATA_RESET_B));
405}
406
407static int armadillo5x0_sdhc1_init(struct device *dev,
408 irq_handler_t detect_irq, void *data)
409{
410 int ret;
411 int gpio_det, gpio_wp;
412
413 gpio_det = IOMUX_TO_GPIO(MX31_PIN_ATA_DMACK);
414 gpio_wp = IOMUX_TO_GPIO(MX31_PIN_ATA_RESET_B);
415
416 ret = gpio_request(gpio_det, "sdhc-card-detect");
417 if (ret)
418 return ret;
419
420 gpio_direction_input(gpio_det);
421
422 ret = gpio_request(gpio_wp, "sdhc-write-protect");
423 if (ret)
424 goto err_gpio_free;
425
426 gpio_direction_input(gpio_wp);
427
428 /* When supported the trigger type have to be BOTH */
429 ret = request_irq(IOMUX_TO_IRQ(MX31_PIN_ATA_DMACK), detect_irq,
430 IRQF_DISABLED | IRQF_TRIGGER_FALLING,
431 "sdhc-detect", data);
432
433 if (ret)
434 goto err_gpio_free_2;
435
436 return 0;
437
438err_gpio_free_2:
439 gpio_free(gpio_wp);
440
441err_gpio_free:
442 gpio_free(gpio_det);
443
444 return ret;
445
446}
447
448static void armadillo5x0_sdhc1_exit(struct device *dev, void *data)
449{
450 free_irq(IOMUX_TO_IRQ(MX31_PIN_ATA_DMACK), data);
451 gpio_free(IOMUX_TO_GPIO(MX31_PIN_ATA_DMACK));
452 gpio_free(IOMUX_TO_GPIO(MX31_PIN_ATA_RESET_B));
453}
454
Uwe Kleine-König6a697e32010-11-12 11:10:55 +0100455static const struct imxmmc_platform_data sdhc_pdata __initconst = {
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200456 .get_ro = armadillo5x0_sdhc1_get_ro,
457 .init = armadillo5x0_sdhc1_init,
458 .exit = armadillo5x0_sdhc1_exit,
459};
460
461/*
462 * SMSC 9118
463 * Network support
464 */
465static struct resource armadillo5x0_smc911x_resources[] = {
466 {
Uwe Kleine-Königf568dd72009-12-09 11:57:21 +0100467 .start = MX31_CS3_BASE_ADDR,
468 .end = MX31_CS3_BASE_ADDR + SZ_32M - 1,
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200469 .flags = IORESOURCE_MEM,
470 }, {
471 .start = IOMUX_TO_IRQ(MX31_PIN_GPIO1_0),
472 .end = IOMUX_TO_IRQ(MX31_PIN_GPIO1_0),
473 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
474 },
475};
476
477static struct smsc911x_platform_config smsc911x_info = {
Alberto Panizzo07299ca2009-10-15 19:29:05 +0200478 .flags = SMSC911X_USE_16BIT,
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200479 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
480 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
481};
482
483static struct platform_device armadillo5x0_smc911x_device = {
484 .name = "smsc911x",
485 .id = -1,
486 .num_resources = ARRAY_SIZE(armadillo5x0_smc911x_resources),
487 .resource = armadillo5x0_smc911x_resources,
488 .dev = {
489 .platform_data = &smsc911x_info,
490 },
491};
492
493/* UART device data */
Uwe Kleine-König16cf5c42010-06-23 11:46:16 +0200494static const struct imxuart_platform_data uart_pdata __initconst = {
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200495 .flags = IMXUART_HAVE_RTSCTS,
496};
497
498static struct platform_device *devices[] __initdata = {
499 &armadillo5x0_smc911x_device,
Alberto Panizzoe33c0492009-10-15 19:24:51 +0200500 &armadillo5x0_button_device,
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200501};
502
503/*
504 * Perform board specific initializations
505 */
506static void __init armadillo5x0_init(void)
507{
508 mxc_iomux_setup_multiple_pins(armadillo5x0_pins,
509 ARRAY_SIZE(armadillo5x0_pins), "armadillo5x0");
510
511 platform_add_devices(devices, ARRAY_SIZE(devices));
Uwe Kleine-König4a9b8b02010-06-16 18:03:05 +0200512 imx31_add_imx_i2c1(NULL);
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200513
514 /* Register UART */
Uwe Kleine-König16cf5c42010-06-23 11:46:16 +0200515 imx31_add_imx_uart0(&uart_pdata);
516 imx31_add_imx_uart1(&uart_pdata);
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200517
518 /* SMSC9118 IRQ pin */
519 gpio_direction_input(MX31_PIN_GPIO1_0);
520
521 /* Register SDHC */
Uwe Kleine-König6a697e32010-11-12 11:10:55 +0100522 imx31_add_mxc_mmc(0, &sdhc_pdata);
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200523
524 /* Register FB */
525 mxc_register_device(&mx3_ipu, &mx3_ipu_data);
526 mxc_register_device(&mx3_fb, &mx3fb_pdata);
Alberto Panizzoc3a9c7f2009-06-17 15:05:21 +0200527
528 /* Register NOR Flash */
529 mxc_register_device(&armadillo5x0_nor_flash,
530 &armadillo5x0_nor_flash_pdata);
Alberto Panizzo0c8bad62009-06-17 15:06:30 +0200531
532 /* Register NAND Flash */
Uwe Kleine-Königa2ceeef2010-06-16 12:23:11 +0200533 imx31_add_mxc_nand(&armadillo5x0_nand_board_info);
Alberto Panizzo0c8bad62009-06-17 15:06:30 +0200534
535 /* set NAND page size to 2k if not configured via boot mode pins */
536 __raw_writel(__raw_readl(MXC_CCM_RCSR) | (1 << 30), MXC_CCM_RCSR);
Alberto Panizzo2097abc2009-10-15 19:33:24 +0200537
538 /* RTC */
539 /* Get RTC IRQ and register the chip */
540 if (gpio_request(ARMADILLO5X0_RTC_GPIO, "rtc") == 0) {
541 if (gpio_direction_input(ARMADILLO5X0_RTC_GPIO) == 0)
542 armadillo5x0_i2c_rtc.irq = gpio_to_irq(ARMADILLO5X0_RTC_GPIO);
543 else
544 gpio_free(ARMADILLO5X0_RTC_GPIO);
545 }
546 if (armadillo5x0_i2c_rtc.irq == 0)
547 pr_warning("armadillo5x0_init: failed to get RTC IRQ\n");
548 i2c_register_board_info(1, &armadillo5x0_i2c_rtc, 1);
Alberto Panizzob3aa1112010-02-26 18:36:32 +0100549
550 /* USB */
551#if defined(CONFIG_USB_ULPI)
552 usbotg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
Igor Grinberg13dd0c92010-07-15 16:00:16 +0300553 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
Alberto Panizzob3aa1112010-02-26 18:36:32 +0100554 usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
Igor Grinberg13dd0c92010-07-15 16:00:16 +0300555 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
Alberto Panizzob3aa1112010-02-26 18:36:32 +0100556
557 mxc_register_device(&mxc_otg_host, &usbotg_pdata);
558 mxc_register_device(&mxc_usbh2, &usbh2_pdata);
559#endif
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200560}
561
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200562static void __init armadillo5x0_timer_init(void)
563{
564 mx31_clocks_init(26000000);
565}
566
567static struct sys_timer armadillo5x0_timer = {
568 .init = armadillo5x0_timer_init,
569};
570
571MACHINE_START(ARMADILLO5X0, "Armadillo-500")
572 /* Maintainer: Alberto Panizzo */
Uwe Kleine-König34101232010-01-29 17:36:05 +0100573 .boot_params = MX3x_PHYS_OFFSET + 0x100,
Alberto Panizzo4e0f08812009-05-25 22:35:38 +0200574 .map_io = mx31_map_io,
Sascha Hauerc5aa0ad2009-05-25 17:36:19 +0200575 .init_irq = mx31_init_irq,
Alberto Panizzo5e9145e2009-05-19 10:01:03 +0200576 .timer = &armadillo5x0_timer,
577 .init_machine = armadillo5x0_init,
578MACHINE_END