blob: fa1ea74dfdd3ec1d0714153b39bfbd2a9e8191bd [file] [log] [blame]
Fabio Estevamaefa1c62009-06-02 17:24:16 -07001/*
2 * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved.
Marc Kleine-Budded17e1c12010-08-18 18:20:24 +02003 * Copyright (C) 2009 Marc Kleine-Budde, Pengutronix
Fabio Estevamaefa1c62009-06-02 17:24:16 -07004 *
5 * Author: Fabio Estevam <fabio.estevam@freescale.com>
6 *
Alex Gershgorin25af2d92012-03-13 17:05:29 +02007 * Copyright (C) 2011 Meprolight, Ltd.
8 * Alex Gershgorin <alexg@meprolight.com>
9 *
10 * Modified from i.MX31 3-Stack Development System
11 *
Fabio Estevamaefa1c62009-06-02 17:24:16 -070012 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
Fabio Estevamaefa1c62009-06-02 17:24:16 -070021 */
22
Uwe Kleine-König767c38b2010-03-04 16:39:53 +010023/*
24 * This machine is known as:
25 * - i.MX35 3-Stack Development System
26 * - i.MX35 Platform Development Kit (i.MX35 PDK)
27 */
28
Fabio Estevamaefa1c62009-06-02 17:24:16 -070029#include <linux/types.h>
30#include <linux/init.h>
31#include <linux/platform_device.h>
32#include <linux/memory.h>
33#include <linux/gpio.h>
Fabio Estevam130a0dd2010-12-22 12:25:30 -020034#include <linux/usb/otg.h>
Fabio Estevamaefa1c62009-06-02 17:24:16 -070035
Marc Kleine-Budded17e1c12010-08-18 18:20:24 +020036#include <linux/mtd/physmap.h>
Alex Gershgorinc8349fb2012-03-29 10:12:45 +020037#include <linux/mfd/mc13892.h>
38#include <linux/regulator/machine.h>
Marc Kleine-Budded17e1c12010-08-18 18:20:24 +020039
Fabio Estevamaefa1c62009-06-02 17:24:16 -070040#include <asm/mach-types.h>
41#include <asm/mach/arch.h>
42#include <asm/mach/time.h>
43#include <asm/mach/map.h>
Alex Gershgorin25af2d92012-03-13 17:05:29 +020044#include <asm/memblock.h>
Fabio Estevamaefa1c62009-06-02 17:24:16 -070045
46#include <mach/hardware.h>
47#include <mach/common.h>
Fabio Estevamaefa1c62009-06-02 17:24:16 -070048#include <mach/iomux-mx35.h>
Xiao Jiang2c6605d2010-10-21 16:15:50 +080049#include <mach/irqs.h>
50#include <mach/3ds_debugboard.h>
wu guoxing881e09f2012-03-14 10:10:54 +080051#include <video/platform_lcd.h>
Fabio Estevamaefa1c62009-06-02 17:24:16 -070052
Alex Gershgorin25af2d92012-03-13 17:05:29 +020053#include <media/soc_camera.h>
54
Uwe Kleine-König6eafde52010-06-23 11:49:34 +020055#include "devices-imx35.h"
Fabio Estevamaefa1c62009-06-02 17:24:16 -070056
wu guoxing881e09f2012-03-14 10:10:54 +080057#define GPIO_MC9S08DZ60_GPS_ENABLE 0
58#define GPIO_MC9S08DZ60_HDD_ENABLE 4
59#define GPIO_MC9S08DZ60_WIFI_ENABLE 5
60#define GPIO_MC9S08DZ60_LCD_ENABLE 6
61#define GPIO_MC9S08DZ60_SPEAKER_ENABLE 8
62
63static const struct fb_videomode fb_modedb[] = {
64 {
65 /* 800x480 @ 55 Hz */
66 .name = "Ceramate-CLAA070VC01",
67 .refresh = 55,
68 .xres = 800,
69 .yres = 480,
70 .pixclock = 40000,
71 .left_margin = 40,
72 .right_margin = 40,
73 .upper_margin = 5,
74 .lower_margin = 5,
75 .hsync_len = 20,
76 .vsync_len = 10,
77 .sync = FB_SYNC_OE_ACT_HIGH,
78 .vmode = FB_VMODE_NONINTERLACED,
79 .flag = 0,
80 },
81};
82
83static const struct ipu_platform_data mx3_ipu_data __initconst = {
84 .irq_base = MXC_IPU_IRQ_START,
85};
86
87static struct mx3fb_platform_data mx3fb_pdata __initdata = {
88 .name = "Ceramate-CLAA070VC01",
89 .mode = fb_modedb,
90 .num_modes = ARRAY_SIZE(fb_modedb),
91};
92
93static struct i2c_board_info __initdata i2c_devices_3ds[] = {
94 {
95 I2C_BOARD_INFO("mc9s08dz60", 0x69),
96 },
97};
98
99static int lcd_power_gpio = -ENXIO;
100
Grant Likely3d0f7cf2012-05-17 13:54:40 -0600101static int mc9s08dz60_gpiochip_match(struct gpio_chip *chip, void *data)
wu guoxing881e09f2012-03-14 10:10:54 +0800102{
103 return !strcmp(chip->label, data);
104}
105
106static void mx35_3ds_lcd_set_power(
107 struct plat_lcd_data *pd, unsigned int power)
108{
109 struct gpio_chip *chip;
110
111 if (!gpio_is_valid(lcd_power_gpio)) {
112 chip = gpiochip_find(
113 "mc9s08dz60", mc9s08dz60_gpiochip_match);
114 if (chip) {
115 lcd_power_gpio =
116 chip->base + GPIO_MC9S08DZ60_LCD_ENABLE;
117 if (gpio_request(lcd_power_gpio, "lcd_power") < 0) {
118 pr_err("error: gpio already requested!\n");
119 lcd_power_gpio = -ENXIO;
120 }
121 } else {
122 pr_err("error: didn't find mc9s08dz60 gpio chip\n");
123 }
124 }
125
126 if (gpio_is_valid(lcd_power_gpio))
127 gpio_set_value_cansleep(lcd_power_gpio, power);
128}
129
130static struct plat_lcd_data mx35_3ds_lcd_data = {
131 .set_power = mx35_3ds_lcd_set_power,
132};
133
134static struct platform_device mx35_3ds_lcd = {
135 .name = "platform-lcd",
136 .dev.platform_data = &mx35_3ds_lcd_data,
137};
138
Sascha Hauer7cf73812011-05-11 11:31:54 +0200139#define EXPIO_PARENT_INT gpio_to_irq(IMX_GPIO_NR(1, 1))
Xiao Jiang2c6605d2010-10-21 16:15:50 +0800140
Uwe Kleine-König6eafde52010-06-23 11:49:34 +0200141static const struct imxuart_platform_data uart_pdata __initconst = {
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700142 .flags = IMXUART_HAVE_RTSCTS,
143};
144
Marc Kleine-Budded17e1c12010-08-18 18:20:24 +0200145static struct physmap_flash_data mx35pdk_flash_data = {
146 .width = 2,
147};
148
149static struct resource mx35pdk_flash_resource = {
150 .start = MX35_CS0_BASE_ADDR,
151 .end = MX35_CS0_BASE_ADDR + SZ_64M - 1,
152 .flags = IORESOURCE_MEM,
153};
154
155static struct platform_device mx35pdk_flash = {
156 .name = "physmap-flash",
157 .id = 0,
158 .dev = {
159 .platform_data = &mx35pdk_flash_data,
160 },
161 .resource = &mx35pdk_flash_resource,
162 .num_resources = 1,
163};
164
Marc Kleine-Budde81aa1722010-08-18 18:22:59 +0200165static const struct mxc_nand_platform_data mx35pdk_nand_board_info __initconst = {
166 .width = 1,
167 .hw_ecc = 1,
168 .flash_bbt = 1,
169};
170
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700171static struct platform_device *devices[] __initdata = {
Marc Kleine-Budded17e1c12010-08-18 18:20:24 +0200172 &mx35pdk_flash,
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700173};
174
Lothar Waßmann8f5260c2010-10-26 14:28:31 +0200175static iomux_v3_cfg_t mx35pdk_pads[] = {
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700176 /* UART1 */
177 MX35_PAD_CTS1__UART1_CTS,
178 MX35_PAD_RTS1__UART1_RTS,
179 MX35_PAD_TXD1__UART1_TXD_MUX,
180 MX35_PAD_RXD1__UART1_RXD_MUX,
181 /* FEC */
182 MX35_PAD_FEC_TX_CLK__FEC_TX_CLK,
183 MX35_PAD_FEC_RX_CLK__FEC_RX_CLK,
184 MX35_PAD_FEC_RX_DV__FEC_RX_DV,
185 MX35_PAD_FEC_COL__FEC_COL,
186 MX35_PAD_FEC_RDATA0__FEC_RDATA_0,
187 MX35_PAD_FEC_TDATA0__FEC_TDATA_0,
188 MX35_PAD_FEC_TX_EN__FEC_TX_EN,
189 MX35_PAD_FEC_MDC__FEC_MDC,
190 MX35_PAD_FEC_MDIO__FEC_MDIO,
191 MX35_PAD_FEC_TX_ERR__FEC_TX_ERR,
192 MX35_PAD_FEC_RX_ERR__FEC_RX_ERR,
193 MX35_PAD_FEC_CRS__FEC_CRS,
194 MX35_PAD_FEC_RDATA1__FEC_RDATA_1,
195 MX35_PAD_FEC_TDATA1__FEC_TDATA_1,
196 MX35_PAD_FEC_RDATA2__FEC_RDATA_2,
197 MX35_PAD_FEC_TDATA2__FEC_TDATA_2,
198 MX35_PAD_FEC_RDATA3__FEC_RDATA_3,
199 MX35_PAD_FEC_TDATA3__FEC_TDATA_3,
Harro Haan9c2daf12009-11-27 11:44:36 +0100200 /* USBOTG */
201 MX35_PAD_USBOTG_PWR__USB_TOP_USBOTG_PWR,
202 MX35_PAD_USBOTG_OC__USB_TOP_USBOTG_OC,
Marc Kleine-Buddeab3d8b52010-08-18 18:26:42 +0200203 /* USBH1 */
204 MX35_PAD_I2C2_CLK__USB_TOP_USBH2_PWR,
205 MX35_PAD_I2C2_DAT__USB_TOP_USBH2_OC,
Shawn Guo6207c832010-10-22 00:23:44 +0800206 /* SDCARD */
207 MX35_PAD_SD1_CMD__ESDHC1_CMD,
208 MX35_PAD_SD1_CLK__ESDHC1_CLK,
209 MX35_PAD_SD1_DATA0__ESDHC1_DAT0,
210 MX35_PAD_SD1_DATA1__ESDHC1_DAT1,
211 MX35_PAD_SD1_DATA2__ESDHC1_DAT2,
212 MX35_PAD_SD1_DATA3__ESDHC1_DAT3,
Fabio Estevam352cd9a2011-03-01 16:59:44 -0300213 /* I2C1 */
214 MX35_PAD_I2C1_CLK__I2C1_SCL,
215 MX35_PAD_I2C1_DAT__I2C1_SDA,
wu guoxing881e09f2012-03-14 10:10:54 +0800216 /* Display */
217 MX35_PAD_LD0__IPU_DISPB_DAT_0,
218 MX35_PAD_LD1__IPU_DISPB_DAT_1,
219 MX35_PAD_LD2__IPU_DISPB_DAT_2,
220 MX35_PAD_LD3__IPU_DISPB_DAT_3,
221 MX35_PAD_LD4__IPU_DISPB_DAT_4,
222 MX35_PAD_LD5__IPU_DISPB_DAT_5,
223 MX35_PAD_LD6__IPU_DISPB_DAT_6,
224 MX35_PAD_LD7__IPU_DISPB_DAT_7,
225 MX35_PAD_LD8__IPU_DISPB_DAT_8,
226 MX35_PAD_LD9__IPU_DISPB_DAT_9,
227 MX35_PAD_LD10__IPU_DISPB_DAT_10,
228 MX35_PAD_LD11__IPU_DISPB_DAT_11,
229 MX35_PAD_LD12__IPU_DISPB_DAT_12,
230 MX35_PAD_LD13__IPU_DISPB_DAT_13,
231 MX35_PAD_LD14__IPU_DISPB_DAT_14,
232 MX35_PAD_LD15__IPU_DISPB_DAT_15,
233 MX35_PAD_LD16__IPU_DISPB_DAT_16,
234 MX35_PAD_LD17__IPU_DISPB_DAT_17,
235 MX35_PAD_D3_HSYNC__IPU_DISPB_D3_HSYNC,
236 MX35_PAD_D3_FPSHIFT__IPU_DISPB_D3_CLK,
237 MX35_PAD_D3_DRDY__IPU_DISPB_D3_DRDY,
238 MX35_PAD_CONTRAST__IPU_DISPB_CONTR,
239 MX35_PAD_D3_VSYNC__IPU_DISPB_D3_VSYNC,
240 MX35_PAD_D3_REV__IPU_DISPB_D3_REV,
241 MX35_PAD_D3_CLS__IPU_DISPB_D3_CLS,
Alex Gershgorin25af2d92012-03-13 17:05:29 +0200242 /* CSI */
243 MX35_PAD_TX1__IPU_CSI_D_6,
244 MX35_PAD_TX0__IPU_CSI_D_7,
245 MX35_PAD_CSI_D8__IPU_CSI_D_8,
246 MX35_PAD_CSI_D9__IPU_CSI_D_9,
247 MX35_PAD_CSI_D10__IPU_CSI_D_10,
248 MX35_PAD_CSI_D11__IPU_CSI_D_11,
249 MX35_PAD_CSI_D12__IPU_CSI_D_12,
250 MX35_PAD_CSI_D13__IPU_CSI_D_13,
251 MX35_PAD_CSI_D14__IPU_CSI_D_14,
252 MX35_PAD_CSI_D15__IPU_CSI_D_15,
253 MX35_PAD_CSI_HSYNC__IPU_CSI_HSYNC,
254 MX35_PAD_CSI_MCLK__IPU_CSI_MCLK,
255 MX35_PAD_CSI_PIXCLK__IPU_CSI_PIXCLK,
256 MX35_PAD_CSI_VSYNC__IPU_CSI_VSYNC,
Alex Gershgorinc8349fb2012-03-29 10:12:45 +0200257 /*PMIC IRQ*/
258 MX35_PAD_GPIO2_0__GPIO2_0,
Alex Gershgorin25af2d92012-03-13 17:05:29 +0200259};
260
261/*
262 * Camera support
263*/
264static phys_addr_t mx3_camera_base __initdata;
265#define MX35_3DS_CAMERA_BUF_SIZE SZ_8M
266
267static const struct mx3_camera_pdata mx35_3ds_camera_pdata __initconst = {
268 .flags = MX3_CAMERA_DATAWIDTH_8,
269 .mclk_10khz = 2000,
270};
271
272static int __init imx35_3ds_init_camera(void)
273{
274 int dma, ret = -ENOMEM;
275 struct platform_device *pdev =
276 imx35_alloc_mx3_camera(&mx35_3ds_camera_pdata);
277
278 if (IS_ERR(pdev))
279 return PTR_ERR(pdev);
280
281 if (!mx3_camera_base)
282 goto err;
283
284 dma = dma_declare_coherent_memory(&pdev->dev,
285 mx3_camera_base, mx3_camera_base,
286 MX35_3DS_CAMERA_BUF_SIZE,
287 DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
288
289 if (!(dma & DMA_MEMORY_MAP))
290 goto err;
291
292 ret = platform_device_add(pdev);
293 if (ret)
294err:
295 platform_device_put(pdev);
296
297 return ret;
298}
299
300static const struct ipu_platform_data mx35_3ds_ipu_data __initconst = {
301 .irq_base = MXC_IPU_IRQ_START,
302};
303
304static struct i2c_board_info mx35_3ds_i2c_camera = {
305 I2C_BOARD_INFO("ov2640", 0x30),
306};
307
308static struct soc_camera_link iclink_ov2640 = {
309 .bus_id = 0,
310 .board_info = &mx35_3ds_i2c_camera,
311 .i2c_adapter_id = 0,
312 .power = NULL,
313};
314
315static struct platform_device mx35_3ds_ov2640 = {
316 .name = "soc-camera-pdrv",
317 .id = 0,
318 .dev = {
319 .platform_data = &iclink_ov2640,
320 },
Harro Haan9c2daf12009-11-27 11:44:36 +0100321};
322
Alex Gershgorinc8349fb2012-03-29 10:12:45 +0200323static struct regulator_consumer_supply sw1_consumers[] = {
324 {
325 .supply = "cpu_vcc",
326 }
327};
328
329static struct regulator_consumer_supply vcam_consumers[] = {
330 /* sgtl5000 */
331 REGULATOR_SUPPLY("VDDA", "0-000a"),
332};
333
334static struct regulator_consumer_supply vaudio_consumers[] = {
335 REGULATOR_SUPPLY("cmos_vio", "soc-camera-pdrv.0"),
336};
337
338static struct regulator_init_data sw1_init = {
339 .constraints = {
340 .name = "SW1",
341 .min_uV = 600000,
342 .max_uV = 1375000,
343 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
344 .valid_modes_mask = 0,
345 .always_on = 1,
346 .boot_on = 1,
347 },
348 .num_consumer_supplies = ARRAY_SIZE(sw1_consumers),
349 .consumer_supplies = sw1_consumers,
350};
351
352static struct regulator_init_data sw2_init = {
353 .constraints = {
354 .name = "SW2",
355 .always_on = 1,
356 .boot_on = 1,
357 }
358};
359
360static struct regulator_init_data sw3_init = {
361 .constraints = {
362 .name = "SW3",
363 .always_on = 1,
364 .boot_on = 1,
365 }
366};
367
368static struct regulator_init_data sw4_init = {
369 .constraints = {
370 .name = "SW4",
371 .always_on = 1,
372 .boot_on = 1,
373 }
374};
375
376static struct regulator_init_data viohi_init = {
377 .constraints = {
378 .name = "VIOHI",
379 .boot_on = 1,
380 }
381};
382
383static struct regulator_init_data vusb_init = {
384 .constraints = {
385 .name = "VUSB",
386 .boot_on = 1,
387 }
388};
389
390static struct regulator_init_data vdig_init = {
391 .constraints = {
392 .name = "VDIG",
393 .boot_on = 1,
394 }
395};
396
397static struct regulator_init_data vpll_init = {
398 .constraints = {
399 .name = "VPLL",
400 .boot_on = 1,
401 }
402};
403
404static struct regulator_init_data vusb2_init = {
405 .constraints = {
406 .name = "VUSB2",
407 .boot_on = 1,
408 }
409};
410
411static struct regulator_init_data vvideo_init = {
412 .constraints = {
413 .name = "VVIDEO",
414 .boot_on = 1
415 }
416};
417
418static struct regulator_init_data vaudio_init = {
419 .constraints = {
420 .name = "VAUDIO",
421 .min_uV = 2300000,
422 .max_uV = 3000000,
423 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
424 .boot_on = 1
425 },
426 .num_consumer_supplies = ARRAY_SIZE(vaudio_consumers),
427 .consumer_supplies = vaudio_consumers,
428};
429
430static struct regulator_init_data vcam_init = {
431 .constraints = {
432 .name = "VCAM",
433 .min_uV = 2500000,
434 .max_uV = 3000000,
435 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
436 REGULATOR_CHANGE_MODE,
437 .valid_modes_mask = REGULATOR_MODE_FAST | REGULATOR_MODE_NORMAL,
438 .boot_on = 1
439 },
440 .num_consumer_supplies = ARRAY_SIZE(vcam_consumers),
441 .consumer_supplies = vcam_consumers,
442};
443
444static struct regulator_init_data vgen1_init = {
445 .constraints = {
446 .name = "VGEN1",
447 }
448};
449
450static struct regulator_init_data vgen2_init = {
451 .constraints = {
452 .name = "VGEN2",
453 .boot_on = 1,
454 }
455};
456
457static struct regulator_init_data vgen3_init = {
458 .constraints = {
459 .name = "VGEN3",
460 }
461};
462
463static struct mc13xxx_regulator_init_data mx35_3ds_regulators[] = {
464 { .id = MC13892_SW1, .init_data = &sw1_init },
465 { .id = MC13892_SW2, .init_data = &sw2_init },
466 { .id = MC13892_SW3, .init_data = &sw3_init },
467 { .id = MC13892_SW4, .init_data = &sw4_init },
468 { .id = MC13892_VIOHI, .init_data = &viohi_init },
469 { .id = MC13892_VPLL, .init_data = &vpll_init },
470 { .id = MC13892_VDIG, .init_data = &vdig_init },
471 { .id = MC13892_VUSB2, .init_data = &vusb2_init },
472 { .id = MC13892_VVIDEO, .init_data = &vvideo_init },
473 { .id = MC13892_VAUDIO, .init_data = &vaudio_init },
474 { .id = MC13892_VCAM, .init_data = &vcam_init },
475 { .id = MC13892_VGEN1, .init_data = &vgen1_init },
476 { .id = MC13892_VGEN2, .init_data = &vgen2_init },
477 { .id = MC13892_VGEN3, .init_data = &vgen3_init },
478 { .id = MC13892_VUSB, .init_data = &vusb_init },
479};
480
481static struct mc13xxx_platform_data mx35_3ds_mc13892_data = {
482 .flags = MC13XXX_USE_RTC | MC13XXX_USE_TOUCHSCREEN,
483 .regulators = {
484 .num_regulators = ARRAY_SIZE(mx35_3ds_regulators),
485 .regulators = mx35_3ds_regulators,
486 },
487};
488
489#define GPIO_PMIC_INT IMX_GPIO_NR(2, 0)
490
491static struct i2c_board_info mx35_3ds_i2c_mc13892 = {
492
493 I2C_BOARD_INFO("mc13892", 0x08),
494 .platform_data = &mx35_3ds_mc13892_data,
Shawn Guo84715dd2011-12-02 15:31:11 +0800495 /* irq number is run-time assigned */
Alex Gershgorinc8349fb2012-03-29 10:12:45 +0200496};
497
498static void __init imx35_3ds_init_mc13892(void)
499{
500 int ret = gpio_request_one(GPIO_PMIC_INT, GPIOF_DIR_IN, "pmic irq");
501
502 if (ret) {
503 pr_err("failed to get pmic irq: %d\n", ret);
504 return;
505 }
506
Shawn Guo84715dd2011-12-02 15:31:11 +0800507 mx35_3ds_i2c_mc13892.irq = gpio_to_irq(GPIO_PMIC_INT);
Alex Gershgorinc8349fb2012-03-29 10:12:45 +0200508 i2c_register_board_info(0, &mx35_3ds_i2c_mc13892, 1);
509}
510
Sascha Hauer4bd597b2011-01-03 11:30:28 +0100511static int mx35_3ds_otg_init(struct platform_device *pdev)
512{
513 return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERNAL_PHY);
514}
515
Harro Haan9c2daf12009-11-27 11:44:36 +0100516/* OTG config */
Uwe Kleine-König9e1dde32010-11-12 16:40:06 +0100517static const struct fsl_usb2_platform_data usb_otg_pdata __initconst = {
Harro Haan9c2daf12009-11-27 11:44:36 +0100518 .operating_mode = FSL_USB2_DR_DEVICE,
519 .phy_mode = FSL_USB2_PHY_UTMI_WIDE,
Fabio Estevam1a46cce82011-03-02 11:26:49 -0300520 .workaround = FLS_USB2_WORKAROUND_ENGCM09152,
521/*
522 * ENGCM09152 also requires a hardware change.
523 * Please check the MX35 Chip Errata document for details.
524 */
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700525};
526
Fabio Estevam130a0dd2010-12-22 12:25:30 -0200527static struct mxc_usbh_platform_data otg_pdata __initdata = {
Sascha Hauer4bd597b2011-01-03 11:30:28 +0100528 .init = mx35_3ds_otg_init,
Fabio Estevam130a0dd2010-12-22 12:25:30 -0200529 .portsc = MXC_EHCI_MODE_UTMI,
Fabio Estevam130a0dd2010-12-22 12:25:30 -0200530};
531
Sascha Hauer4bd597b2011-01-03 11:30:28 +0100532static int mx35_3ds_usbh_init(struct platform_device *pdev)
533{
534 return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_SINGLE_UNI |
535 MXC_EHCI_INTERNAL_PHY);
536}
537
Marc Kleine-Buddeab3d8b52010-08-18 18:26:42 +0200538/* USB HOST config */
Uwe Kleine-König2d58de22010-11-15 11:57:49 +0100539static const struct mxc_usbh_platform_data usb_host_pdata __initconst = {
Sascha Hauer4bd597b2011-01-03 11:30:28 +0100540 .init = mx35_3ds_usbh_init,
Marc Kleine-Buddeab3d8b52010-08-18 18:26:42 +0200541 .portsc = MXC_EHCI_MODE_SERIAL,
Marc Kleine-Buddeab3d8b52010-08-18 18:26:42 +0200542};
543
Fabio Estevam130a0dd2010-12-22 12:25:30 -0200544static int otg_mode_host;
545
546static int __init mx35_3ds_otg_mode(char *options)
547{
548 if (!strcmp(options, "host"))
549 otg_mode_host = 1;
550 else if (!strcmp(options, "device"))
551 otg_mode_host = 0;
552 else
553 pr_info("otg_mode neither \"host\" nor \"device\". "
554 "Defaulting to device\n");
555 return 0;
556}
557__setup("otg_mode=", mx35_3ds_otg_mode);
558
Fabio Estevam352cd9a2011-03-01 16:59:44 -0300559static const struct imxi2c_platform_data mx35_3ds_i2c0_data __initconst = {
560 .bitrate = 100000,
561};
562
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700563/*
564 * Board specific initialization.
565 */
Uwe Kleine-Könige134fb22011-02-11 10:23:19 +0100566static void __init mx35_3ds_init(void)
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700567{
wu guoxing881e09f2012-03-14 10:10:54 +0800568 struct platform_device *imx35_fb_pdev;
569
Shawn Guob78d8e52011-06-06 00:07:55 +0800570 imx35_soc_init();
571
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700572 mxc_iomux_v3_setup_multiple_pads(mx35pdk_pads, ARRAY_SIZE(mx35pdk_pads));
573
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +0200574 imx35_add_fec(NULL);
Uwe Kleine-Königc496fa62010-11-16 23:24:21 +0100575 imx35_add_imx2_wdt(NULL);
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700576 platform_add_devices(devices, ARRAY_SIZE(devices));
577
Uwe Kleine-König6eafde52010-06-23 11:49:34 +0200578 imx35_add_imx_uart0(&uart_pdata);
Harro Haan9c2daf12009-11-27 11:44:36 +0100579
Fabio Estevam130a0dd2010-12-22 12:25:30 -0200580 if (otg_mode_host)
581 imx35_add_mxc_ehci_otg(&otg_pdata);
Marc Kleine-Budde81aa1722010-08-18 18:22:59 +0200582
Uwe Kleine-König2d58de22010-11-15 11:57:49 +0100583 imx35_add_mxc_ehci_hs(&usb_host_pdata);
Marc Kleine-Buddeab3d8b52010-08-18 18:26:42 +0200584
Fabio Estevam130a0dd2010-12-22 12:25:30 -0200585 if (!otg_mode_host)
586 imx35_add_fsl_usb2_udc(&usb_otg_pdata);
587
Marc Kleine-Budde81aa1722010-08-18 18:22:59 +0200588 imx35_add_mxc_nand(&mx35pdk_nand_board_info);
Uwe Kleine-König124bf942010-11-19 21:03:33 +0100589 imx35_add_sdhci_esdhc_imx(0, NULL);
Xiao Jiang2c6605d2010-10-21 16:15:50 +0800590
591 if (mxc_expio_init(MX35_CS5_BASE_ADDR, EXPIO_PARENT_INT))
592 pr_warn("Init of the debugboard failed, all "
593 "devices on the debugboard are unusable.\n");
Fabio Estevam352cd9a2011-03-01 16:59:44 -0300594 imx35_add_imx_i2c0(&mx35_3ds_i2c0_data);
wu guoxing881e09f2012-03-14 10:10:54 +0800595
596 i2c_register_board_info(
597 0, i2c_devices_3ds, ARRAY_SIZE(i2c_devices_3ds));
598
Alex Gershgorin25af2d92012-03-13 17:05:29 +0200599 imx35_add_ipu_core(&mx35_3ds_ipu_data);
600 platform_device_register(&mx35_3ds_ov2640);
601 imx35_3ds_init_camera();
602
wu guoxing881e09f2012-03-14 10:10:54 +0800603 imx35_fb_pdev = imx35_add_mx3_sdc_fb(&mx3fb_pdata);
604 mx35_3ds_lcd.dev.parent = &imx35_fb_pdev->dev;
605 platform_device_register(&mx35_3ds_lcd);
Alex Gershgorinc8349fb2012-03-29 10:12:45 +0200606
607 imx35_3ds_init_mc13892();
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700608}
609
610static void __init mx35pdk_timer_init(void)
611{
612 mx35_clocks_init();
613}
614
Marc Kleine-Budde7bf1c872012-04-24 17:48:17 +0200615static struct sys_timer mx35pdk_timer = {
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700616 .init = mx35pdk_timer_init,
617};
618
Alex Gershgorin25af2d92012-03-13 17:05:29 +0200619static void __init mx35_3ds_reserve(void)
620{
621 /* reserve MX35_3DS_CAMERA_BUF_SIZE bytes for mx3-camera */
622 mx3_camera_base = arm_memblock_steal(MX35_3DS_CAMERA_BUF_SIZE,
623 MX35_3DS_CAMERA_BUF_SIZE);
624}
625
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700626MACHINE_START(MX35_3DS, "Freescale MX35PDK")
627 /* Maintainer: Freescale Semiconductor, Inc */
Nicolas Pitredc8f1902011-07-05 22:38:12 -0400628 .atag_offset = 0x100,
Uwe Kleine-König97976e22011-02-07 16:35:20 +0100629 .map_io = mx35_map_io,
630 .init_early = imx35_init_early,
631 .init_irq = mx35_init_irq,
Sascha Hauerffa2ea32011-09-20 14:31:24 +0200632 .handle_irq = imx35_handle_irq,
Uwe Kleine-König97976e22011-02-07 16:35:20 +0100633 .timer = &mx35pdk_timer,
Uwe Kleine-Könige134fb22011-02-11 10:23:19 +0100634 .init_machine = mx35_3ds_init,
Alex Gershgorin25af2d92012-03-13 17:05:29 +0200635 .reserve = mx35_3ds_reserve,
Russell King65ea7882011-11-06 17:12:08 +0000636 .restart = mxc_restart,
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700637MACHINE_END