]> Git Repo - linux.git/blob - arch/arm/mach-imx/mach-mx31_3ds.c
enetc: Migrate to PHYLINK and PCS_LYNX
[linux.git] / arch / arm / mach-imx / mach-mx31_3ds.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  *  Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved.
4  */
5
6 #include <linux/delay.h>
7 #include <linux/dma-mapping.h>
8 #include <linux/types.h>
9 #include <linux/init.h>
10 #include <linux/clk.h>
11 #include <linux/irq.h>
12 #include <linux/gpio.h>
13 #include <linux/gpio/machine.h>
14 #include <linux/platform_device.h>
15 #include <linux/mfd/mc13783.h>
16 #include <linux/spi/spi.h>
17 #include <linux/regulator/machine.h>
18 #include <linux/usb/otg.h>
19 #include <linux/usb/ulpi.h>
20
21 #include <asm/mach-types.h>
22 #include <asm/mach/arch.h>
23 #include <asm/mach/time.h>
24 #include <asm/memory.h>
25 #include <asm/mach/map.h>
26
27 #include "3ds_debugboard.h"
28 #include "common.h"
29 #include "devices-imx31.h"
30 #include "ehci.h"
31 #include "hardware.h"
32 #include "iomux-mx3.h"
33 #include "ulpi.h"
34
35 static int mx31_3ds_pins[] = {
36         /* UART1 */
37         MX31_PIN_CTS1__CTS1,
38         MX31_PIN_RTS1__RTS1,
39         MX31_PIN_TXD1__TXD1,
40         MX31_PIN_RXD1__RXD1,
41         IOMUX_MODE(MX31_PIN_GPIO1_1, IOMUX_CONFIG_GPIO),
42         /*SPI0*/
43         IOMUX_MODE(MX31_PIN_DSR_DCE1, IOMUX_CONFIG_ALT1),
44         IOMUX_MODE(MX31_PIN_RI_DCE1, IOMUX_CONFIG_ALT1),
45         /* SPI 1 */
46         MX31_PIN_CSPI2_SCLK__SCLK,
47         MX31_PIN_CSPI2_MOSI__MOSI,
48         MX31_PIN_CSPI2_MISO__MISO,
49         MX31_PIN_CSPI2_SPI_RDY__SPI_RDY,
50         MX31_PIN_CSPI2_SS0__SS0,
51         MX31_PIN_CSPI2_SS2__SS2, /*CS for MC13783 */
52         /* MC13783 IRQ */
53         IOMUX_MODE(MX31_PIN_GPIO1_3, IOMUX_CONFIG_GPIO),
54         /* USB OTG reset */
55         IOMUX_MODE(MX31_PIN_USB_PWR, IOMUX_CONFIG_GPIO),
56         /* USB OTG */
57         MX31_PIN_USBOTG_DATA0__USBOTG_DATA0,
58         MX31_PIN_USBOTG_DATA1__USBOTG_DATA1,
59         MX31_PIN_USBOTG_DATA2__USBOTG_DATA2,
60         MX31_PIN_USBOTG_DATA3__USBOTG_DATA3,
61         MX31_PIN_USBOTG_DATA4__USBOTG_DATA4,
62         MX31_PIN_USBOTG_DATA5__USBOTG_DATA5,
63         MX31_PIN_USBOTG_DATA6__USBOTG_DATA6,
64         MX31_PIN_USBOTG_DATA7__USBOTG_DATA7,
65         MX31_PIN_USBOTG_CLK__USBOTG_CLK,
66         MX31_PIN_USBOTG_DIR__USBOTG_DIR,
67         MX31_PIN_USBOTG_NXT__USBOTG_NXT,
68         MX31_PIN_USBOTG_STP__USBOTG_STP,
69         /*Keyboard*/
70         MX31_PIN_KEY_ROW0_KEY_ROW0,
71         MX31_PIN_KEY_ROW1_KEY_ROW1,
72         MX31_PIN_KEY_ROW2_KEY_ROW2,
73         MX31_PIN_KEY_COL0_KEY_COL0,
74         MX31_PIN_KEY_COL1_KEY_COL1,
75         MX31_PIN_KEY_COL2_KEY_COL2,
76         MX31_PIN_KEY_COL3_KEY_COL3,
77         /* USB Host 2 */
78         IOMUX_MODE(MX31_PIN_USBH2_CLK, IOMUX_CONFIG_FUNC),
79         IOMUX_MODE(MX31_PIN_USBH2_DIR, IOMUX_CONFIG_FUNC),
80         IOMUX_MODE(MX31_PIN_USBH2_NXT, IOMUX_CONFIG_FUNC),
81         IOMUX_MODE(MX31_PIN_USBH2_STP, IOMUX_CONFIG_FUNC),
82         IOMUX_MODE(MX31_PIN_USBH2_DATA0, IOMUX_CONFIG_FUNC),
83         IOMUX_MODE(MX31_PIN_USBH2_DATA1, IOMUX_CONFIG_FUNC),
84         IOMUX_MODE(MX31_PIN_PC_VS2, IOMUX_CONFIG_ALT1),
85         IOMUX_MODE(MX31_PIN_PC_BVD1, IOMUX_CONFIG_ALT1),
86         IOMUX_MODE(MX31_PIN_PC_BVD2, IOMUX_CONFIG_ALT1),
87         IOMUX_MODE(MX31_PIN_PC_RST, IOMUX_CONFIG_ALT1),
88         IOMUX_MODE(MX31_PIN_IOIS16, IOMUX_CONFIG_ALT1),
89         IOMUX_MODE(MX31_PIN_PC_RW_B, IOMUX_CONFIG_ALT1),
90         /* USB Host2 reset */
91         IOMUX_MODE(MX31_PIN_USB_BYP, IOMUX_CONFIG_GPIO),
92         /* I2C1 */
93         MX31_PIN_I2C_CLK__I2C1_SCL,
94         MX31_PIN_I2C_DAT__I2C1_SDA,
95         /* SDHC1 */
96         MX31_PIN_SD1_DATA3__SD1_DATA3,
97         MX31_PIN_SD1_DATA2__SD1_DATA2,
98         MX31_PIN_SD1_DATA1__SD1_DATA1,
99         MX31_PIN_SD1_DATA0__SD1_DATA0,
100         MX31_PIN_SD1_CLK__SD1_CLK,
101         MX31_PIN_SD1_CMD__SD1_CMD,
102         MX31_PIN_GPIO3_1__GPIO3_1, /* Card detect */
103         MX31_PIN_GPIO3_0__GPIO3_0, /* OE */
104         /* Framebuffer */
105         MX31_PIN_LD0__LD0,
106         MX31_PIN_LD1__LD1,
107         MX31_PIN_LD2__LD2,
108         MX31_PIN_LD3__LD3,
109         MX31_PIN_LD4__LD4,
110         MX31_PIN_LD5__LD5,
111         MX31_PIN_LD6__LD6,
112         MX31_PIN_LD7__LD7,
113         MX31_PIN_LD8__LD8,
114         MX31_PIN_LD9__LD9,
115         MX31_PIN_LD10__LD10,
116         MX31_PIN_LD11__LD11,
117         MX31_PIN_LD12__LD12,
118         MX31_PIN_LD13__LD13,
119         MX31_PIN_LD14__LD14,
120         MX31_PIN_LD15__LD15,
121         MX31_PIN_LD16__LD16,
122         MX31_PIN_LD17__LD17,
123         MX31_PIN_VSYNC3__VSYNC3,
124         MX31_PIN_HSYNC__HSYNC,
125         MX31_PIN_FPSHIFT__FPSHIFT,
126         MX31_PIN_CONTRAST__CONTRAST,
127         /* SSI */
128         MX31_PIN_STXD4__STXD4,
129         MX31_PIN_SRXD4__SRXD4,
130         MX31_PIN_SCK4__SCK4,
131         MX31_PIN_SFS4__SFS4,
132 };
133
134 /*
135  * FB support
136  */
137 static const struct fb_videomode fb_modedb[] = {
138         {       /* 480x640 @ 60 Hz */
139                 .name           = "Epson-VGA",
140                 .refresh        = 60,
141                 .xres           = 480,
142                 .yres           = 640,
143                 .pixclock       = 41701,
144                 .left_margin    = 20,
145                 .right_margin   = 41,
146                 .upper_margin   = 10,
147                 .lower_margin   = 5,
148                 .hsync_len      = 20,
149                 .vsync_len      = 10,
150                 .sync           = FB_SYNC_OE_ACT_HIGH | FB_SYNC_CLK_INVERT,
151                 .vmode          = FB_VMODE_NONINTERLACED,
152                 .flag           = 0,
153         },
154 };
155
156 static struct mx3fb_platform_data mx3fb_pdata __initdata = {
157         .name           = "Epson-VGA",
158         .mode           = fb_modedb,
159         .num_modes      = ARRAY_SIZE(fb_modedb),
160 };
161
162 /* LCD */
163 static struct gpiod_lookup_table mx31_3ds_lcd_gpiod_table = {
164         .dev_id = "spi0.2", /* Bus 0 chipselect 2 */
165         .table = {
166                 /*
167                  * "reset" has IOMUX_TO_GPIO(IOMUX_PIN(88, 28)).
168                  * The macro only shifts 88 to bits 9..16 and then
169                  * mask it and shift it back. The GPIO number is 88.
170                  * 88 is 2*32+24
171                  */
172                 GPIO_LOOKUP("imx31-gpio.2", 24, "reset", GPIO_ACTIVE_HIGH),
173                 /*
174                  * Same reasoning as above for
175                  * IOMUX_TO_GPIO(IOMUX_PIN(89, 27), pin 89 is 2*32+25.
176                  */
177                 GPIO_LOOKUP("imx31-gpio.2", 25, "enable", GPIO_ACTIVE_HIGH),
178                 { },
179         },
180 };
181
182 /*
183  * Support for SD card slot in personality board
184  */
185 #define MX31_3DS_GPIO_SDHC1_CD IOMUX_TO_GPIO(MX31_PIN_GPIO3_1)
186 #define MX31_3DS_GPIO_SDHC1_BE IOMUX_TO_GPIO(MX31_PIN_GPIO3_0)
187
188 static struct gpio mx31_3ds_sdhc1_gpios[] = {
189         { MX31_3DS_GPIO_SDHC1_CD, GPIOF_IN, "sdhc1-card-detect" },
190         { MX31_3DS_GPIO_SDHC1_BE, GPIOF_OUT_INIT_LOW, "sdhc1-bus-en" },
191 };
192
193 static int mx31_3ds_sdhc1_init(struct device *dev,
194                                irq_handler_t detect_irq,
195                                void *data)
196 {
197         int ret;
198
199         ret = gpio_request_array(mx31_3ds_sdhc1_gpios,
200                                  ARRAY_SIZE(mx31_3ds_sdhc1_gpios));
201         if (ret) {
202                 pr_warn("Unable to request the SD/MMC GPIOs.\n");
203                 return ret;
204         }
205
206         ret = request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1)),
207                           detect_irq,
208                           IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
209                           "sdhc1-detect", data);
210         if (ret) {
211                 pr_warn("Unable to request the SD/MMC card-detect IRQ.\n");
212                 goto gpio_free;
213         }
214
215         return 0;
216
217 gpio_free:
218         gpio_free_array(mx31_3ds_sdhc1_gpios,
219                         ARRAY_SIZE(mx31_3ds_sdhc1_gpios));
220         return ret;
221 }
222
223 static void mx31_3ds_sdhc1_exit(struct device *dev, void *data)
224 {
225         free_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1)), data);
226         gpio_free_array(mx31_3ds_sdhc1_gpios,
227                          ARRAY_SIZE(mx31_3ds_sdhc1_gpios));
228 }
229
230 static void mx31_3ds_sdhc1_setpower(struct device *dev, unsigned int vdd)
231 {
232         /*
233          * While the voltage stuff is done by the driver, activate the
234          * Buffer Enable Pin only if there is a card in slot to fix the card
235          * voltage issue caused by bi-directional chip TXB0108 on 3Stack.
236          * Done here because at this stage we have for sure a debounced value
237          * of the presence of the card, showed by the value of vdd.
238          * 7 == ilog2(MMC_VDD_165_195)
239          */
240         if (vdd > 7)
241                 gpio_set_value(MX31_3DS_GPIO_SDHC1_BE, 1);
242         else
243                 gpio_set_value(MX31_3DS_GPIO_SDHC1_BE, 0);
244 }
245
246 static struct imxmmc_platform_data sdhc1_pdata = {
247         .init           = mx31_3ds_sdhc1_init,
248         .exit           = mx31_3ds_sdhc1_exit,
249         .setpower       = mx31_3ds_sdhc1_setpower,
250 };
251
252 /*
253  * Matrix keyboard
254  */
255
256 static const uint32_t mx31_3ds_keymap[] = {
257         KEY(0, 0, KEY_UP),
258         KEY(0, 1, KEY_DOWN),
259         KEY(1, 0, KEY_RIGHT),
260         KEY(1, 1, KEY_LEFT),
261         KEY(1, 2, KEY_ENTER),
262         KEY(2, 0, KEY_F6),
263         KEY(2, 1, KEY_F8),
264         KEY(2, 2, KEY_F9),
265         KEY(2, 3, KEY_F10),
266 };
267
268 static const struct matrix_keymap_data mx31_3ds_keymap_data __initconst = {
269         .keymap         = mx31_3ds_keymap,
270         .keymap_size    = ARRAY_SIZE(mx31_3ds_keymap),
271 };
272
273 /* Regulators */
274 static struct regulator_init_data pwgtx_init = {
275         .constraints = {
276                 .boot_on        = 1,
277                 .always_on      = 1,
278         },
279 };
280
281 static struct regulator_init_data gpo_init = {
282         .constraints = {
283                 .boot_on = 1,
284                 .always_on = 1,
285         }
286 };
287
288 static struct regulator_consumer_supply vmmc2_consumers[] = {
289         REGULATOR_SUPPLY("vmmc", "imx31-mmc.0"),
290 };
291
292 static struct regulator_init_data vmmc2_init = {
293         .constraints = {
294                 .min_uV = 3000000,
295                 .max_uV = 3000000,
296                 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
297                                   REGULATOR_CHANGE_STATUS,
298         },
299         .num_consumer_supplies = ARRAY_SIZE(vmmc2_consumers),
300         .consumer_supplies = vmmc2_consumers,
301 };
302
303 static struct regulator_consumer_supply vmmc1_consumers[] = {
304         REGULATOR_SUPPLY("vcore", "spi0.0"),
305 };
306
307 static struct regulator_init_data vmmc1_init = {
308         .constraints = {
309                 .min_uV = 2800000,
310                 .max_uV = 2800000,
311                 .apply_uV = 1,
312                 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
313                                   REGULATOR_CHANGE_STATUS,
314         },
315         .num_consumer_supplies = ARRAY_SIZE(vmmc1_consumers),
316         .consumer_supplies = vmmc1_consumers,
317 };
318
319 static struct regulator_consumer_supply vgen_consumers[] = {
320         REGULATOR_SUPPLY("vdd", "spi0.0"),
321 };
322
323 static struct regulator_init_data vgen_init = {
324         .constraints = {
325                 .min_uV = 1800000,
326                 .max_uV = 1800000,
327                 .apply_uV = 1,
328                 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
329                                   REGULATOR_CHANGE_STATUS,
330         },
331         .num_consumer_supplies = ARRAY_SIZE(vgen_consumers),
332         .consumer_supplies = vgen_consumers,
333 };
334
335 static struct mc13xxx_regulator_init_data mx31_3ds_regulators[] = {
336         {
337                 .id = MC13783_REG_PWGT1SPI, /* Power Gate for ARM core. */
338                 .init_data = &pwgtx_init,
339         }, {
340                 .id = MC13783_REG_PWGT2SPI, /* Power Gate for L2 Cache. */
341                 .init_data = &pwgtx_init,
342         }, {
343
344                 .id = MC13783_REG_GPO1, /* Turn on 1.8V */
345                 .init_data = &gpo_init,
346         }, {
347                 .id = MC13783_REG_GPO3, /* Turn on 3.3V */
348                 .init_data = &gpo_init,
349         }, {
350                 .id = MC13783_REG_VMMC2, /* Power MMC/SD, WiFi/Bluetooth. */
351                 .init_data = &vmmc2_init,
352         }, {
353                 .id = MC13783_REG_VMMC1, /* Power LCD, CMOS, FM, GPS, Accel. */
354                 .init_data = &vmmc1_init,
355         }, {
356                 .id = MC13783_REG_VGEN,  /* Power LCD */
357                 .init_data = &vgen_init,
358         },
359 };
360
361 /* MC13783 */
362 static struct mc13xxx_codec_platform_data mx31_3ds_codec = {
363         .dac_ssi_port = MC13783_SSI1_PORT,
364         .adc_ssi_port = MC13783_SSI1_PORT,
365 };
366
367 static struct mc13xxx_platform_data mc13783_pdata = {
368         .regulators = {
369                 .regulators = mx31_3ds_regulators,
370                 .num_regulators = ARRAY_SIZE(mx31_3ds_regulators),
371         },
372         .codec = &mx31_3ds_codec,
373         .flags  = MC13XXX_USE_TOUCHSCREEN | MC13XXX_USE_RTC | MC13XXX_USE_CODEC,
374
375 };
376
377 static struct imx_ssi_platform_data mx31_3ds_ssi_pdata = {
378         .flags = IMX_SSI_DMA | IMX_SSI_NET,
379 };
380
381 static struct spi_board_info mx31_3ds_spi_devs[] __initdata = {
382         {
383                 .modalias       = "mc13783",
384                 .max_speed_hz   = 1000000,
385                 .bus_num        = 1,
386                 .chip_select    = 2, /* SS2 */
387                 .platform_data  = &mc13783_pdata,
388                 /* irq number is run-time assigned */
389                 .mode = SPI_CS_HIGH,
390         }, {
391                 .modalias       = "l4f00242t03",
392                 .max_speed_hz   = 5000000,
393                 .bus_num        = 0,
394                 .chip_select    = 2, /* SS2 */
395         },
396 };
397
398 /*
399  * NAND Flash
400  */
401 static const struct mxc_nand_platform_data
402 mx31_3ds_nand_board_info __initconst = {
403         .width          = 1,
404         .hw_ecc         = 1,
405 #ifdef CONFIG_MACH_MX31_3DS_MXC_NAND_USE_BBT
406         .flash_bbt      = 1,
407 #endif
408 };
409
410 /*
411  * USB OTG
412  */
413
414 #define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
415                      PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
416
417 #define USBOTG_RST_B IOMUX_TO_GPIO(MX31_PIN_USB_PWR)
418 #define USBH2_RST_B IOMUX_TO_GPIO(MX31_PIN_USB_BYP)
419
420 static int mx31_3ds_usbotg_init(void)
421 {
422         int err;
423
424         mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG);
425         mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG);
426         mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG);
427         mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG);
428         mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG);
429         mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG);
430         mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG);
431         mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG);
432         mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG);
433         mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG);
434         mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG);
435         mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG);
436
437         err = gpio_request(USBOTG_RST_B, "otgusb-reset");
438         if (err) {
439                 pr_err("Failed to request the USB OTG reset gpio\n");
440                 return err;
441         }
442
443         err = gpio_direction_output(USBOTG_RST_B, 0);
444         if (err) {
445                 pr_err("Failed to drive the USB OTG reset gpio\n");
446                 goto usbotg_free_reset;
447         }
448
449         mdelay(1);
450         gpio_set_value(USBOTG_RST_B, 1);
451         return 0;
452
453 usbotg_free_reset:
454         gpio_free(USBOTG_RST_B);
455         return err;
456 }
457
458 static int mx31_3ds_otg_init(struct platform_device *pdev)
459 {
460         return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED);
461 }
462
463 static int mx31_3ds_host2_init(struct platform_device *pdev)
464 {
465         int err;
466
467         mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG);
468         mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG);
469         mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG);
470         mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG);
471         mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG);
472         mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG);
473         mxc_iomux_set_pad(MX31_PIN_PC_VS2, USB_PAD_CFG);
474         mxc_iomux_set_pad(MX31_PIN_PC_BVD1, USB_PAD_CFG);
475         mxc_iomux_set_pad(MX31_PIN_PC_BVD2, USB_PAD_CFG);
476         mxc_iomux_set_pad(MX31_PIN_PC_RST, USB_PAD_CFG);
477         mxc_iomux_set_pad(MX31_PIN_IOIS16, USB_PAD_CFG);
478         mxc_iomux_set_pad(MX31_PIN_PC_RW_B, USB_PAD_CFG);
479
480         err = gpio_request(USBH2_RST_B, "usbh2-reset");
481         if (err) {
482                 pr_err("Failed to request the USB Host 2 reset gpio\n");
483                 return err;
484         }
485
486         err = gpio_direction_output(USBH2_RST_B, 0);
487         if (err) {
488                 pr_err("Failed to drive the USB Host 2 reset gpio\n");
489                 goto usbotg_free_reset;
490         }
491
492         mdelay(1);
493         gpio_set_value(USBH2_RST_B, 1);
494
495         mdelay(10);
496
497         return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED);
498
499 usbotg_free_reset:
500         gpio_free(USBH2_RST_B);
501         return err;
502 }
503
504 static struct mxc_usbh_platform_data otg_pdata __initdata = {
505         .init   = mx31_3ds_otg_init,
506         .portsc = MXC_EHCI_MODE_ULPI,
507 };
508
509 static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
510         .init = mx31_3ds_host2_init,
511         .portsc = MXC_EHCI_MODE_ULPI,
512 };
513
514 static const struct fsl_usb2_platform_data usbotg_pdata __initconst = {
515         .operating_mode = FSL_USB2_DR_DEVICE,
516         .phy_mode       = FSL_USB2_PHY_ULPI,
517 };
518
519 static bool otg_mode_host __initdata;
520
521 static int __init mx31_3ds_otg_mode(char *options)
522 {
523         if (!strcmp(options, "host"))
524                 otg_mode_host = true;
525         else if (!strcmp(options, "device"))
526                 otg_mode_host = false;
527         else
528                 pr_info("otg_mode neither \"host\" nor \"device\". "
529                         "Defaulting to device\n");
530         return 1;
531 }
532 __setup("otg_mode=", mx31_3ds_otg_mode);
533
534 static const struct imxuart_platform_data uart_pdata __initconst = {
535         .flags = IMXUART_HAVE_RTSCTS,
536 };
537
538 static const struct imxi2c_platform_data mx31_3ds_i2c0_data __initconst = {
539         .bitrate = 100000,
540 };
541
542 static void __init mx31_3ds_init(void)
543 {
544         imx31_soc_init();
545
546         /* Configure SPI1 IOMUX */
547         mxc_iomux_set_gpr(MUX_PGP_CSPI_BB, true);
548
549         mxc_iomux_setup_multiple_pins(mx31_3ds_pins, ARRAY_SIZE(mx31_3ds_pins),
550                                       "mx31_3ds");
551
552         imx31_add_imx_uart0(&uart_pdata);
553         imx31_add_mxc_nand(&mx31_3ds_nand_board_info);
554
555         imx31_add_spi_imx1(NULL);
556
557         imx31_add_imx_keypad(&mx31_3ds_keymap_data);
558
559         imx31_add_imx2_wdt();
560         imx31_add_imx_i2c0(&mx31_3ds_i2c0_data);
561
562         imx31_add_spi_imx0(NULL);
563         imx31_add_ipu_core();
564         imx31_add_mx3_sdc_fb(&mx3fb_pdata);
565
566         imx31_add_imx_ssi(0, &mx31_3ds_ssi_pdata);
567
568         imx_add_platform_device("imx_mc13783", 0, NULL, 0, NULL, 0);
569 }
570
571 static void __init mx31_3ds_late(void)
572 {
573         gpiod_add_lookup_table(&mx31_3ds_lcd_gpiod_table);
574         mx31_3ds_spi_devs[0].irq = gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3));
575         spi_register_board_info(mx31_3ds_spi_devs,
576                                 ARRAY_SIZE(mx31_3ds_spi_devs));
577
578         mx31_3ds_usbotg_init();
579         if (otg_mode_host) {
580                 otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
581                                 ULPI_OTG_DRVVBUS_EXT);
582                 if (otg_pdata.otg)
583                         imx31_add_mxc_ehci_otg(&otg_pdata);
584         }
585         usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
586                         ULPI_OTG_DRVVBUS_EXT);
587         if (usbh2_pdata.otg)
588                 imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
589
590         if (!otg_mode_host)
591                 imx31_add_fsl_usb2_udc(&usbotg_pdata);
592
593         if (mxc_expio_init(MX31_CS5_BASE_ADDR, IOMUX_TO_GPIO(MX31_PIN_GPIO1_1)))
594                 printk(KERN_WARNING "Init of the debug board failed, all "
595                        "devices on the debug board are unusable.\n");
596
597         imx31_add_mxc_mmc(0, &sdhc1_pdata);
598 }
599
600 static void __init mx31_3ds_timer_init(void)
601 {
602         mx31_clocks_init(26000000);
603 }
604
605 MACHINE_START(MX31_3DS, "Freescale MX31PDK (3DS)")
606         /* Maintainer: Freescale Semiconductor, Inc. */
607         .atag_offset = 0x100,
608         .map_io = mx31_map_io,
609         .init_early = imx31_init_early,
610         .init_irq = mx31_init_irq,
611         .init_time      = mx31_3ds_timer_init,
612         .init_machine = mx31_3ds_init,
613         .init_late      = mx31_3ds_late,
614         .restart        = mxc_restart,
615 MACHINE_END
This page took 0.064511 seconds and 4 git commands to generate.