blob: a42f4f07051fda65843da8ae579aa4326ccfaa5e [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
wu guoxing881e09f2012-03-14 10:10:54 +080046#include <video/platform_lcd.h>
Fabio Estevamaefa1c62009-06-02 17:24:16 -070047
Alex Gershgorin25af2d92012-03-13 17:05:29 +020048#include <media/soc_camera.h>
49
Shawn Guo3ed0bcb2012-09-13 09:37:49 +080050#include "3ds_debugboard.h"
Shawn Guoe3372472012-09-13 21:01:00 +080051#include "common.h"
Uwe Kleine-König6eafde52010-06-23 11:49:34 +020052#include "devices-imx35.h"
Shawn Guo50f2de62012-09-14 14:14:45 +080053#include "hardware.h"
Shawn Guo267dd342012-09-13 13:26:00 +080054#include "iomux-mx35.h"
Fabio Estevamaefa1c62009-06-02 17:24:16 -070055
wu guoxing881e09f2012-03-14 10:10:54 +080056#define GPIO_MC9S08DZ60_GPS_ENABLE 0
57#define GPIO_MC9S08DZ60_HDD_ENABLE 4
58#define GPIO_MC9S08DZ60_WIFI_ENABLE 5
59#define GPIO_MC9S08DZ60_LCD_ENABLE 6
60#define GPIO_MC9S08DZ60_SPEAKER_ENABLE 8
61
62static const struct fb_videomode fb_modedb[] = {
63 {
64 /* 800x480 @ 55 Hz */
65 .name = "Ceramate-CLAA070VC01",
66 .refresh = 55,
67 .xres = 800,
68 .yres = 480,
69 .pixclock = 40000,
70 .left_margin = 40,
71 .right_margin = 40,
72 .upper_margin = 5,
73 .lower_margin = 5,
74 .hsync_len = 20,
75 .vsync_len = 10,
76 .sync = FB_SYNC_OE_ACT_HIGH,
77 .vmode = FB_VMODE_NONINTERLACED,
78 .flag = 0,
79 },
80};
81
wu guoxing881e09f2012-03-14 10:10:54 +080082static struct mx3fb_platform_data mx3fb_pdata __initdata = {
83 .name = "Ceramate-CLAA070VC01",
84 .mode = fb_modedb,
85 .num_modes = ARRAY_SIZE(fb_modedb),
86};
87
88static struct i2c_board_info __initdata i2c_devices_3ds[] = {
89 {
90 I2C_BOARD_INFO("mc9s08dz60", 0x69),
91 },
92};
93
94static int lcd_power_gpio = -ENXIO;
95
Grant Likely3d0f7cf2012-05-17 13:54:40 -060096static int mc9s08dz60_gpiochip_match(struct gpio_chip *chip, void *data)
wu guoxing881e09f2012-03-14 10:10:54 +080097{
98 return !strcmp(chip->label, data);
99}
100
101static void mx35_3ds_lcd_set_power(
102 struct plat_lcd_data *pd, unsigned int power)
103{
104 struct gpio_chip *chip;
105
106 if (!gpio_is_valid(lcd_power_gpio)) {
107 chip = gpiochip_find(
108 "mc9s08dz60", mc9s08dz60_gpiochip_match);
109 if (chip) {
110 lcd_power_gpio =
111 chip->base + GPIO_MC9S08DZ60_LCD_ENABLE;
112 if (gpio_request(lcd_power_gpio, "lcd_power") < 0) {
113 pr_err("error: gpio already requested!\n");
114 lcd_power_gpio = -ENXIO;
115 }
116 } else {
117 pr_err("error: didn't find mc9s08dz60 gpio chip\n");
118 }
119 }
120
121 if (gpio_is_valid(lcd_power_gpio))
122 gpio_set_value_cansleep(lcd_power_gpio, power);
123}
124
125static struct plat_lcd_data mx35_3ds_lcd_data = {
126 .set_power = mx35_3ds_lcd_set_power,
127};
128
129static struct platform_device mx35_3ds_lcd = {
130 .name = "platform-lcd",
131 .dev.platform_data = &mx35_3ds_lcd_data,
132};
133
Uwe Kleine-König6eafde52010-06-23 11:49:34 +0200134static const struct imxuart_platform_data uart_pdata __initconst = {
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700135 .flags = IMXUART_HAVE_RTSCTS,
136};
137
Marc Kleine-Budded17e1c12010-08-18 18:20:24 +0200138static struct physmap_flash_data mx35pdk_flash_data = {
139 .width = 2,
140};
141
142static struct resource mx35pdk_flash_resource = {
143 .start = MX35_CS0_BASE_ADDR,
144 .end = MX35_CS0_BASE_ADDR + SZ_64M - 1,
145 .flags = IORESOURCE_MEM,
146};
147
148static struct platform_device mx35pdk_flash = {
149 .name = "physmap-flash",
150 .id = 0,
151 .dev = {
152 .platform_data = &mx35pdk_flash_data,
153 },
154 .resource = &mx35pdk_flash_resource,
155 .num_resources = 1,
156};
157
Marc Kleine-Budde81aa1722010-08-18 18:22:59 +0200158static const struct mxc_nand_platform_data mx35pdk_nand_board_info __initconst = {
159 .width = 1,
160 .hw_ecc = 1,
161 .flash_bbt = 1,
162};
163
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700164static struct platform_device *devices[] __initdata = {
Marc Kleine-Budded17e1c12010-08-18 18:20:24 +0200165 &mx35pdk_flash,
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700166};
167
Lothar Waßmann8f5260c2010-10-26 14:28:31 +0200168static iomux_v3_cfg_t mx35pdk_pads[] = {
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700169 /* UART1 */
170 MX35_PAD_CTS1__UART1_CTS,
171 MX35_PAD_RTS1__UART1_RTS,
172 MX35_PAD_TXD1__UART1_TXD_MUX,
173 MX35_PAD_RXD1__UART1_RXD_MUX,
174 /* FEC */
175 MX35_PAD_FEC_TX_CLK__FEC_TX_CLK,
176 MX35_PAD_FEC_RX_CLK__FEC_RX_CLK,
177 MX35_PAD_FEC_RX_DV__FEC_RX_DV,
178 MX35_PAD_FEC_COL__FEC_COL,
179 MX35_PAD_FEC_RDATA0__FEC_RDATA_0,
180 MX35_PAD_FEC_TDATA0__FEC_TDATA_0,
181 MX35_PAD_FEC_TX_EN__FEC_TX_EN,
182 MX35_PAD_FEC_MDC__FEC_MDC,
183 MX35_PAD_FEC_MDIO__FEC_MDIO,
184 MX35_PAD_FEC_TX_ERR__FEC_TX_ERR,
185 MX35_PAD_FEC_RX_ERR__FEC_RX_ERR,
186 MX35_PAD_FEC_CRS__FEC_CRS,
187 MX35_PAD_FEC_RDATA1__FEC_RDATA_1,
188 MX35_PAD_FEC_TDATA1__FEC_TDATA_1,
189 MX35_PAD_FEC_RDATA2__FEC_RDATA_2,
190 MX35_PAD_FEC_TDATA2__FEC_TDATA_2,
191 MX35_PAD_FEC_RDATA3__FEC_RDATA_3,
192 MX35_PAD_FEC_TDATA3__FEC_TDATA_3,
Harro Haan9c2daf12009-11-27 11:44:36 +0100193 /* USBOTG */
194 MX35_PAD_USBOTG_PWR__USB_TOP_USBOTG_PWR,
195 MX35_PAD_USBOTG_OC__USB_TOP_USBOTG_OC,
Marc Kleine-Buddeab3d8b52010-08-18 18:26:42 +0200196 /* USBH1 */
197 MX35_PAD_I2C2_CLK__USB_TOP_USBH2_PWR,
198 MX35_PAD_I2C2_DAT__USB_TOP_USBH2_OC,
Shawn Guo6207c832010-10-22 00:23:44 +0800199 /* SDCARD */
200 MX35_PAD_SD1_CMD__ESDHC1_CMD,
201 MX35_PAD_SD1_CLK__ESDHC1_CLK,
202 MX35_PAD_SD1_DATA0__ESDHC1_DAT0,
203 MX35_PAD_SD1_DATA1__ESDHC1_DAT1,
204 MX35_PAD_SD1_DATA2__ESDHC1_DAT2,
205 MX35_PAD_SD1_DATA3__ESDHC1_DAT3,
Fabio Estevam352cd9a2011-03-01 16:59:44 -0300206 /* I2C1 */
207 MX35_PAD_I2C1_CLK__I2C1_SCL,
208 MX35_PAD_I2C1_DAT__I2C1_SDA,
wu guoxing881e09f2012-03-14 10:10:54 +0800209 /* Display */
210 MX35_PAD_LD0__IPU_DISPB_DAT_0,
211 MX35_PAD_LD1__IPU_DISPB_DAT_1,
212 MX35_PAD_LD2__IPU_DISPB_DAT_2,
213 MX35_PAD_LD3__IPU_DISPB_DAT_3,
214 MX35_PAD_LD4__IPU_DISPB_DAT_4,
215 MX35_PAD_LD5__IPU_DISPB_DAT_5,
216 MX35_PAD_LD6__IPU_DISPB_DAT_6,
217 MX35_PAD_LD7__IPU_DISPB_DAT_7,
218 MX35_PAD_LD8__IPU_DISPB_DAT_8,
219 MX35_PAD_LD9__IPU_DISPB_DAT_9,
220 MX35_PAD_LD10__IPU_DISPB_DAT_10,
221 MX35_PAD_LD11__IPU_DISPB_DAT_11,
222 MX35_PAD_LD12__IPU_DISPB_DAT_12,
223 MX35_PAD_LD13__IPU_DISPB_DAT_13,
224 MX35_PAD_LD14__IPU_DISPB_DAT_14,
225 MX35_PAD_LD15__IPU_DISPB_DAT_15,
226 MX35_PAD_LD16__IPU_DISPB_DAT_16,
227 MX35_PAD_LD17__IPU_DISPB_DAT_17,
228 MX35_PAD_D3_HSYNC__IPU_DISPB_D3_HSYNC,
229 MX35_PAD_D3_FPSHIFT__IPU_DISPB_D3_CLK,
230 MX35_PAD_D3_DRDY__IPU_DISPB_D3_DRDY,
231 MX35_PAD_CONTRAST__IPU_DISPB_CONTR,
232 MX35_PAD_D3_VSYNC__IPU_DISPB_D3_VSYNC,
233 MX35_PAD_D3_REV__IPU_DISPB_D3_REV,
234 MX35_PAD_D3_CLS__IPU_DISPB_D3_CLS,
Alex Gershgorin25af2d92012-03-13 17:05:29 +0200235 /* CSI */
236 MX35_PAD_TX1__IPU_CSI_D_6,
237 MX35_PAD_TX0__IPU_CSI_D_7,
238 MX35_PAD_CSI_D8__IPU_CSI_D_8,
239 MX35_PAD_CSI_D9__IPU_CSI_D_9,
240 MX35_PAD_CSI_D10__IPU_CSI_D_10,
241 MX35_PAD_CSI_D11__IPU_CSI_D_11,
242 MX35_PAD_CSI_D12__IPU_CSI_D_12,
243 MX35_PAD_CSI_D13__IPU_CSI_D_13,
244 MX35_PAD_CSI_D14__IPU_CSI_D_14,
245 MX35_PAD_CSI_D15__IPU_CSI_D_15,
246 MX35_PAD_CSI_HSYNC__IPU_CSI_HSYNC,
247 MX35_PAD_CSI_MCLK__IPU_CSI_MCLK,
248 MX35_PAD_CSI_PIXCLK__IPU_CSI_PIXCLK,
249 MX35_PAD_CSI_VSYNC__IPU_CSI_VSYNC,
Alex Gershgorinc8349fb2012-03-29 10:12:45 +0200250 /*PMIC IRQ*/
251 MX35_PAD_GPIO2_0__GPIO2_0,
Alex Gershgorin25af2d92012-03-13 17:05:29 +0200252};
253
254/*
255 * Camera support
256*/
257static phys_addr_t mx3_camera_base __initdata;
258#define MX35_3DS_CAMERA_BUF_SIZE SZ_8M
259
260static const struct mx3_camera_pdata mx35_3ds_camera_pdata __initconst = {
261 .flags = MX3_CAMERA_DATAWIDTH_8,
262 .mclk_10khz = 2000,
263};
264
265static int __init imx35_3ds_init_camera(void)
266{
267 int dma, ret = -ENOMEM;
268 struct platform_device *pdev =
269 imx35_alloc_mx3_camera(&mx35_3ds_camera_pdata);
270
271 if (IS_ERR(pdev))
272 return PTR_ERR(pdev);
273
274 if (!mx3_camera_base)
275 goto err;
276
277 dma = dma_declare_coherent_memory(&pdev->dev,
278 mx3_camera_base, mx3_camera_base,
279 MX35_3DS_CAMERA_BUF_SIZE,
280 DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
281
282 if (!(dma & DMA_MEMORY_MAP))
283 goto err;
284
285 ret = platform_device_add(pdev);
286 if (ret)
287err:
288 platform_device_put(pdev);
289
290 return ret;
291}
292
Alex Gershgorin25af2d92012-03-13 17:05:29 +0200293static struct i2c_board_info mx35_3ds_i2c_camera = {
294 I2C_BOARD_INFO("ov2640", 0x30),
295};
296
297static struct soc_camera_link iclink_ov2640 = {
298 .bus_id = 0,
299 .board_info = &mx35_3ds_i2c_camera,
300 .i2c_adapter_id = 0,
301 .power = NULL,
302};
303
304static struct platform_device mx35_3ds_ov2640 = {
305 .name = "soc-camera-pdrv",
306 .id = 0,
307 .dev = {
308 .platform_data = &iclink_ov2640,
309 },
Harro Haan9c2daf12009-11-27 11:44:36 +0100310};
311
Alex Gershgorinc8349fb2012-03-29 10:12:45 +0200312static struct regulator_consumer_supply sw1_consumers[] = {
313 {
314 .supply = "cpu_vcc",
315 }
316};
317
318static struct regulator_consumer_supply vcam_consumers[] = {
319 /* sgtl5000 */
320 REGULATOR_SUPPLY("VDDA", "0-000a"),
321};
322
323static struct regulator_consumer_supply vaudio_consumers[] = {
324 REGULATOR_SUPPLY("cmos_vio", "soc-camera-pdrv.0"),
325};
326
327static struct regulator_init_data sw1_init = {
328 .constraints = {
329 .name = "SW1",
330 .min_uV = 600000,
331 .max_uV = 1375000,
332 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
333 .valid_modes_mask = 0,
334 .always_on = 1,
335 .boot_on = 1,
336 },
337 .num_consumer_supplies = ARRAY_SIZE(sw1_consumers),
338 .consumer_supplies = sw1_consumers,
339};
340
341static struct regulator_init_data sw2_init = {
342 .constraints = {
343 .name = "SW2",
344 .always_on = 1,
345 .boot_on = 1,
346 }
347};
348
349static struct regulator_init_data sw3_init = {
350 .constraints = {
351 .name = "SW3",
352 .always_on = 1,
353 .boot_on = 1,
354 }
355};
356
357static struct regulator_init_data sw4_init = {
358 .constraints = {
359 .name = "SW4",
360 .always_on = 1,
361 .boot_on = 1,
362 }
363};
364
365static struct regulator_init_data viohi_init = {
366 .constraints = {
367 .name = "VIOHI",
368 .boot_on = 1,
369 }
370};
371
372static struct regulator_init_data vusb_init = {
373 .constraints = {
374 .name = "VUSB",
375 .boot_on = 1,
376 }
377};
378
379static struct regulator_init_data vdig_init = {
380 .constraints = {
381 .name = "VDIG",
382 .boot_on = 1,
383 }
384};
385
386static struct regulator_init_data vpll_init = {
387 .constraints = {
388 .name = "VPLL",
389 .boot_on = 1,
390 }
391};
392
393static struct regulator_init_data vusb2_init = {
394 .constraints = {
395 .name = "VUSB2",
396 .boot_on = 1,
397 }
398};
399
400static struct regulator_init_data vvideo_init = {
401 .constraints = {
402 .name = "VVIDEO",
403 .boot_on = 1
404 }
405};
406
407static struct regulator_init_data vaudio_init = {
408 .constraints = {
409 .name = "VAUDIO",
410 .min_uV = 2300000,
411 .max_uV = 3000000,
412 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
413 .boot_on = 1
414 },
415 .num_consumer_supplies = ARRAY_SIZE(vaudio_consumers),
416 .consumer_supplies = vaudio_consumers,
417};
418
419static struct regulator_init_data vcam_init = {
420 .constraints = {
421 .name = "VCAM",
422 .min_uV = 2500000,
423 .max_uV = 3000000,
424 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
425 REGULATOR_CHANGE_MODE,
426 .valid_modes_mask = REGULATOR_MODE_FAST | REGULATOR_MODE_NORMAL,
427 .boot_on = 1
428 },
429 .num_consumer_supplies = ARRAY_SIZE(vcam_consumers),
430 .consumer_supplies = vcam_consumers,
431};
432
433static struct regulator_init_data vgen1_init = {
434 .constraints = {
435 .name = "VGEN1",
436 }
437};
438
439static struct regulator_init_data vgen2_init = {
440 .constraints = {
441 .name = "VGEN2",
442 .boot_on = 1,
443 }
444};
445
446static struct regulator_init_data vgen3_init = {
447 .constraints = {
448 .name = "VGEN3",
449 }
450};
451
452static struct mc13xxx_regulator_init_data mx35_3ds_regulators[] = {
453 { .id = MC13892_SW1, .init_data = &sw1_init },
454 { .id = MC13892_SW2, .init_data = &sw2_init },
455 { .id = MC13892_SW3, .init_data = &sw3_init },
456 { .id = MC13892_SW4, .init_data = &sw4_init },
457 { .id = MC13892_VIOHI, .init_data = &viohi_init },
458 { .id = MC13892_VPLL, .init_data = &vpll_init },
459 { .id = MC13892_VDIG, .init_data = &vdig_init },
460 { .id = MC13892_VUSB2, .init_data = &vusb2_init },
461 { .id = MC13892_VVIDEO, .init_data = &vvideo_init },
462 { .id = MC13892_VAUDIO, .init_data = &vaudio_init },
463 { .id = MC13892_VCAM, .init_data = &vcam_init },
464 { .id = MC13892_VGEN1, .init_data = &vgen1_init },
465 { .id = MC13892_VGEN2, .init_data = &vgen2_init },
466 { .id = MC13892_VGEN3, .init_data = &vgen3_init },
467 { .id = MC13892_VUSB, .init_data = &vusb_init },
468};
469
470static struct mc13xxx_platform_data mx35_3ds_mc13892_data = {
471 .flags = MC13XXX_USE_RTC | MC13XXX_USE_TOUCHSCREEN,
472 .regulators = {
473 .num_regulators = ARRAY_SIZE(mx35_3ds_regulators),
474 .regulators = mx35_3ds_regulators,
475 },
476};
477
478#define GPIO_PMIC_INT IMX_GPIO_NR(2, 0)
479
480static struct i2c_board_info mx35_3ds_i2c_mc13892 = {
481
482 I2C_BOARD_INFO("mc13892", 0x08),
483 .platform_data = &mx35_3ds_mc13892_data,
Shawn Guo84715dd2011-12-02 15:31:11 +0800484 /* irq number is run-time assigned */
Alex Gershgorinc8349fb2012-03-29 10:12:45 +0200485};
486
487static void __init imx35_3ds_init_mc13892(void)
488{
489 int ret = gpio_request_one(GPIO_PMIC_INT, GPIOF_DIR_IN, "pmic irq");
490
491 if (ret) {
492 pr_err("failed to get pmic irq: %d\n", ret);
493 return;
494 }
495
Shawn Guo84715dd2011-12-02 15:31:11 +0800496 mx35_3ds_i2c_mc13892.irq = gpio_to_irq(GPIO_PMIC_INT);
Alex Gershgorinc8349fb2012-03-29 10:12:45 +0200497 i2c_register_board_info(0, &mx35_3ds_i2c_mc13892, 1);
498}
499
Sascha Hauer4bd597b2011-01-03 11:30:28 +0100500static int mx35_3ds_otg_init(struct platform_device *pdev)
501{
502 return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERNAL_PHY);
503}
504
Harro Haan9c2daf12009-11-27 11:44:36 +0100505/* OTG config */
Uwe Kleine-König9e1dde32010-11-12 16:40:06 +0100506static const struct fsl_usb2_platform_data usb_otg_pdata __initconst = {
Harro Haan9c2daf12009-11-27 11:44:36 +0100507 .operating_mode = FSL_USB2_DR_DEVICE,
508 .phy_mode = FSL_USB2_PHY_UTMI_WIDE,
Fabio Estevam1a46cce82011-03-02 11:26:49 -0300509 .workaround = FLS_USB2_WORKAROUND_ENGCM09152,
510/*
511 * ENGCM09152 also requires a hardware change.
512 * Please check the MX35 Chip Errata document for details.
513 */
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700514};
515
Fabio Estevam130a0dd2010-12-22 12:25:30 -0200516static struct mxc_usbh_platform_data otg_pdata __initdata = {
Sascha Hauer4bd597b2011-01-03 11:30:28 +0100517 .init = mx35_3ds_otg_init,
Fabio Estevam130a0dd2010-12-22 12:25:30 -0200518 .portsc = MXC_EHCI_MODE_UTMI,
Fabio Estevam130a0dd2010-12-22 12:25:30 -0200519};
520
Sascha Hauer4bd597b2011-01-03 11:30:28 +0100521static int mx35_3ds_usbh_init(struct platform_device *pdev)
522{
523 return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_SINGLE_UNI |
524 MXC_EHCI_INTERNAL_PHY);
525}
526
Marc Kleine-Buddeab3d8b52010-08-18 18:26:42 +0200527/* USB HOST config */
Uwe Kleine-König2d58de22010-11-15 11:57:49 +0100528static const struct mxc_usbh_platform_data usb_host_pdata __initconst = {
Sascha Hauer4bd597b2011-01-03 11:30:28 +0100529 .init = mx35_3ds_usbh_init,
Marc Kleine-Buddeab3d8b52010-08-18 18:26:42 +0200530 .portsc = MXC_EHCI_MODE_SERIAL,
Marc Kleine-Buddeab3d8b52010-08-18 18:26:42 +0200531};
532
Benoît Thébaudeau33a264d2012-06-12 19:46:43 +0200533static bool otg_mode_host __initdata;
Fabio Estevam130a0dd2010-12-22 12:25:30 -0200534
535static int __init mx35_3ds_otg_mode(char *options)
536{
537 if (!strcmp(options, "host"))
Benoît Thébaudeau33a264d2012-06-12 19:46:43 +0200538 otg_mode_host = true;
Fabio Estevam130a0dd2010-12-22 12:25:30 -0200539 else if (!strcmp(options, "device"))
Benoît Thébaudeau33a264d2012-06-12 19:46:43 +0200540 otg_mode_host = false;
Fabio Estevam130a0dd2010-12-22 12:25:30 -0200541 else
542 pr_info("otg_mode neither \"host\" nor \"device\". "
543 "Defaulting to device\n");
Benoît Thébaudeau33a264d2012-06-12 19:46:43 +0200544 return 1;
Fabio Estevam130a0dd2010-12-22 12:25:30 -0200545}
546__setup("otg_mode=", mx35_3ds_otg_mode);
547
Fabio Estevam352cd9a2011-03-01 16:59:44 -0300548static const struct imxi2c_platform_data mx35_3ds_i2c0_data __initconst = {
549 .bitrate = 100000,
550};
551
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700552/*
553 * Board specific initialization.
554 */
Uwe Kleine-Könige134fb22011-02-11 10:23:19 +0100555static void __init mx35_3ds_init(void)
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700556{
wu guoxing881e09f2012-03-14 10:10:54 +0800557 struct platform_device *imx35_fb_pdev;
558
Shawn Guob78d8e52011-06-06 00:07:55 +0800559 imx35_soc_init();
560
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700561 mxc_iomux_v3_setup_multiple_pads(mx35pdk_pads, ARRAY_SIZE(mx35pdk_pads));
562
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +0200563 imx35_add_fec(NULL);
Benoît Thébaudeaubec31a82012-07-04 16:35:54 +0200564 imx35_add_imx2_wdt();
Benoît Thébaudeauc6fd6d12012-07-04 16:36:28 +0200565 imx35_add_mxc_rtc();
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700566 platform_add_devices(devices, ARRAY_SIZE(devices));
567
Uwe Kleine-König6eafde52010-06-23 11:49:34 +0200568 imx35_add_imx_uart0(&uart_pdata);
Harro Haan9c2daf12009-11-27 11:44:36 +0100569
Fabio Estevam130a0dd2010-12-22 12:25:30 -0200570 if (otg_mode_host)
571 imx35_add_mxc_ehci_otg(&otg_pdata);
Marc Kleine-Budde81aa1722010-08-18 18:22:59 +0200572
Uwe Kleine-König2d58de22010-11-15 11:57:49 +0100573 imx35_add_mxc_ehci_hs(&usb_host_pdata);
Marc Kleine-Buddeab3d8b52010-08-18 18:26:42 +0200574
Fabio Estevam130a0dd2010-12-22 12:25:30 -0200575 if (!otg_mode_host)
576 imx35_add_fsl_usb2_udc(&usb_otg_pdata);
577
Marc Kleine-Budde81aa1722010-08-18 18:22:59 +0200578 imx35_add_mxc_nand(&mx35pdk_nand_board_info);
Uwe Kleine-König124bf942010-11-19 21:03:33 +0100579 imx35_add_sdhci_esdhc_imx(0, NULL);
Xiao Jiang2c6605d2010-10-21 16:15:50 +0800580
Shawn Guoed4a7fb2012-06-13 15:58:08 +0800581 if (mxc_expio_init(MX35_CS5_BASE_ADDR, IMX_GPIO_NR(1, 1)))
Xiao Jiang2c6605d2010-10-21 16:15:50 +0800582 pr_warn("Init of the debugboard failed, all "
583 "devices on the debugboard are unusable.\n");
Fabio Estevam352cd9a2011-03-01 16:59:44 -0300584 imx35_add_imx_i2c0(&mx35_3ds_i2c0_data);
wu guoxing881e09f2012-03-14 10:10:54 +0800585
586 i2c_register_board_info(
587 0, i2c_devices_3ds, ARRAY_SIZE(i2c_devices_3ds));
588
Shawn Guo88289c82012-06-13 14:07:31 +0800589 imx35_add_ipu_core();
Alex Gershgorin25af2d92012-03-13 17:05:29 +0200590 platform_device_register(&mx35_3ds_ov2640);
591 imx35_3ds_init_camera();
592
wu guoxing881e09f2012-03-14 10:10:54 +0800593 imx35_fb_pdev = imx35_add_mx3_sdc_fb(&mx3fb_pdata);
594 mx35_3ds_lcd.dev.parent = &imx35_fb_pdev->dev;
595 platform_device_register(&mx35_3ds_lcd);
Alex Gershgorinc8349fb2012-03-29 10:12:45 +0200596
597 imx35_3ds_init_mc13892();
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700598}
599
600static void __init mx35pdk_timer_init(void)
601{
602 mx35_clocks_init();
603}
604
Alex Gershgorin25af2d92012-03-13 17:05:29 +0200605static void __init mx35_3ds_reserve(void)
606{
607 /* reserve MX35_3DS_CAMERA_BUF_SIZE bytes for mx3-camera */
608 mx3_camera_base = arm_memblock_steal(MX35_3DS_CAMERA_BUF_SIZE,
609 MX35_3DS_CAMERA_BUF_SIZE);
610}
611
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700612MACHINE_START(MX35_3DS, "Freescale MX35PDK")
613 /* Maintainer: Freescale Semiconductor, Inc */
Nicolas Pitredc8f1902011-07-05 22:38:12 -0400614 .atag_offset = 0x100,
Uwe Kleine-König97976e22011-02-07 16:35:20 +0100615 .map_io = mx35_map_io,
616 .init_early = imx35_init_early,
617 .init_irq = mx35_init_irq,
Sascha Hauerffa2ea32011-09-20 14:31:24 +0200618 .handle_irq = imx35_handle_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700619 .init_time = mx35pdk_timer_init,
Uwe Kleine-Könige134fb22011-02-11 10:23:19 +0100620 .init_machine = mx35_3ds_init,
Alex Gershgorin25af2d92012-03-13 17:05:29 +0200621 .reserve = mx35_3ds_reserve,
Russell King65ea7882011-11-06 17:12:08 +0000622 .restart = mxc_restart,
Fabio Estevamaefa1c62009-06-02 17:24:16 -0700623MACHINE_END