diff options
Diffstat (limited to 'arch/arm/mach-mx3/mach-mx31moboard.c')
-rw-r--r-- | arch/arm/mach-mx3/mach-mx31moboard.c | 149 |
1 files changed, 81 insertions, 68 deletions
diff --git a/arch/arm/mach-mx3/mach-mx31moboard.c b/arch/arm/mach-mx3/mach-mx31moboard.c index fccb9207b78d..62b5e40165df 100644 --- a/arch/arm/mach-mx3/mach-mx31moboard.c +++ b/arch/arm/mach-mx3/mach-mx31moboard.c | |||
@@ -18,7 +18,6 @@ | |||
18 | 18 | ||
19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
20 | #include <linux/dma-mapping.h> | 20 | #include <linux/dma-mapping.h> |
21 | #include <linux/fsl_devices.h> | ||
22 | #include <linux/gfp.h> | 21 | #include <linux/gfp.h> |
23 | #include <linux/gpio.h> | 22 | #include <linux/gpio.h> |
24 | #include <linux/init.h> | 23 | #include <linux/init.h> |
@@ -221,11 +220,54 @@ static struct mc13783_regulator_init_data moboard_regulators[] = { | |||
221 | }, | 220 | }, |
222 | }; | 221 | }; |
223 | 222 | ||
223 | static struct mc13783_led_platform_data moboard_led[] = { | ||
224 | { | ||
225 | .id = MC13783_LED_R1, | ||
226 | .name = "coreboard-led-4:red", | ||
227 | .max_current = 2, | ||
228 | }, | ||
229 | { | ||
230 | .id = MC13783_LED_G1, | ||
231 | .name = "coreboard-led-4:green", | ||
232 | .max_current = 2, | ||
233 | }, | ||
234 | { | ||
235 | .id = MC13783_LED_B1, | ||
236 | .name = "coreboard-led-4:blue", | ||
237 | .max_current = 2, | ||
238 | }, | ||
239 | { | ||
240 | .id = MC13783_LED_R2, | ||
241 | .name = "coreboard-led-5:red", | ||
242 | .max_current = 3, | ||
243 | }, | ||
244 | { | ||
245 | .id = MC13783_LED_G2, | ||
246 | .name = "coreboard-led-5:green", | ||
247 | .max_current = 3, | ||
248 | }, | ||
249 | { | ||
250 | .id = MC13783_LED_B2, | ||
251 | .name = "coreboard-led-5:blue", | ||
252 | .max_current = 3, | ||
253 | }, | ||
254 | }; | ||
255 | |||
256 | static struct mc13783_leds_platform_data moboard_leds = { | ||
257 | .num_leds = ARRAY_SIZE(moboard_led), | ||
258 | .led = moboard_led, | ||
259 | .flags = MC13783_LED_SLEWLIMTC, | ||
260 | .abmode = MC13783_LED_AB_DISABLED, | ||
261 | .tc1_period = MC13783_LED_PERIOD_10MS, | ||
262 | .tc2_period = MC13783_LED_PERIOD_10MS, | ||
263 | }; | ||
264 | |||
224 | static struct mc13783_platform_data moboard_pmic = { | 265 | static struct mc13783_platform_data moboard_pmic = { |
225 | .regulators = moboard_regulators, | 266 | .regulators = moboard_regulators, |
226 | .num_regulators = ARRAY_SIZE(moboard_regulators), | 267 | .num_regulators = ARRAY_SIZE(moboard_regulators), |
268 | .leds = &moboard_leds, | ||
227 | .flags = MC13783_USE_REGULATOR | MC13783_USE_RTC | | 269 | .flags = MC13783_USE_REGULATOR | MC13783_USE_RTC | |
228 | MC13783_USE_ADC, | 270 | MC13783_USE_ADC | MC13783_USE_LED, |
229 | }; | 271 | }; |
230 | 272 | ||
231 | static struct spi_board_info moboard_spi_board_info[] __initdata = { | 273 | static struct spi_board_info moboard_spi_board_info[] __initdata = { |
@@ -306,84 +348,56 @@ static struct imxmmc_platform_data sdhc1_pdata = { | |||
306 | * this pin is dedicated for all mx31moboard systems, so we do it here | 348 | * this pin is dedicated for all mx31moboard systems, so we do it here |
307 | */ | 349 | */ |
308 | #define USB_RESET_B IOMUX_TO_GPIO(MX31_PIN_GPIO1_0) | 350 | #define USB_RESET_B IOMUX_TO_GPIO(MX31_PIN_GPIO1_0) |
309 | |||
310 | static void usb_xcvr_reset(void) | ||
311 | { | ||
312 | gpio_request(USB_RESET_B, "usb-reset"); | ||
313 | gpio_direction_output(USB_RESET_B, 0); | ||
314 | mdelay(1); | ||
315 | gpio_set_value(USB_RESET_B, 1); | ||
316 | } | ||
317 | |||
318 | #define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \ | 351 | #define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \ |
319 | PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU) | 352 | PAD_CTL_ODE_CMOS) |
320 | 353 | ||
321 | #define OTG_EN_B IOMUX_TO_GPIO(MX31_PIN_USB_OC) | 354 | #define OTG_EN_B IOMUX_TO_GPIO(MX31_PIN_USB_OC) |
322 | |||
323 | static void moboard_usbotg_init(void) | ||
324 | { | ||
325 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG); | ||
326 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG); | ||
327 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG); | ||
328 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG); | ||
329 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG); | ||
330 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG); | ||
331 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG); | ||
332 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG); | ||
333 | mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG); | ||
334 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG); | ||
335 | mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG); | ||
336 | mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG); | ||
337 | |||
338 | gpio_request(OTG_EN_B, "usb-udc-en"); | ||
339 | gpio_direction_output(OTG_EN_B, 0); | ||
340 | } | ||
341 | |||
342 | static struct fsl_usb2_platform_data usb_pdata = { | ||
343 | .operating_mode = FSL_USB2_DR_DEVICE, | ||
344 | .phy_mode = FSL_USB2_PHY_ULPI, | ||
345 | }; | ||
346 | |||
347 | #if defined(CONFIG_USB_ULPI) | ||
348 | |||
349 | #define USBH2_EN_B IOMUX_TO_GPIO(MX31_PIN_SCK6) | 355 | #define USBH2_EN_B IOMUX_TO_GPIO(MX31_PIN_SCK6) |
350 | 356 | ||
351 | static int moboard_usbh2_hw_init(struct platform_device *pdev) | 357 | static void usb_xcvr_reset(void) |
352 | { | 358 | { |
353 | int ret; | 359 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG | PAD_CTL_100K_PD); |
360 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG | PAD_CTL_100K_PD); | ||
361 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG | PAD_CTL_100K_PD); | ||
362 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG | PAD_CTL_100K_PD); | ||
363 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG | PAD_CTL_100K_PD); | ||
364 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG | PAD_CTL_100K_PD); | ||
365 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG | PAD_CTL_100K_PD); | ||
366 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG | PAD_CTL_100K_PD); | ||
367 | mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG | PAD_CTL_100K_PU); | ||
368 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG | PAD_CTL_100K_PU); | ||
369 | mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG | PAD_CTL_100K_PU); | ||
370 | mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG | PAD_CTL_100K_PU); | ||
354 | 371 | ||
355 | mxc_iomux_set_gpr(MUX_PGP_UH2, true); | 372 | mxc_iomux_set_gpr(MUX_PGP_UH2, true); |
373 | mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG | PAD_CTL_100K_PU); | ||
374 | mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG | PAD_CTL_100K_PU); | ||
375 | mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG | PAD_CTL_100K_PU); | ||
376 | mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG | PAD_CTL_100K_PU); | ||
377 | mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG | PAD_CTL_100K_PD); | ||
378 | mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG | PAD_CTL_100K_PD); | ||
379 | mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG | PAD_CTL_100K_PD); | ||
380 | mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG | PAD_CTL_100K_PD); | ||
381 | mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG | PAD_CTL_100K_PD); | ||
382 | mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG | PAD_CTL_100K_PD); | ||
383 | mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG | PAD_CTL_100K_PD); | ||
384 | mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG | PAD_CTL_100K_PD); | ||
356 | 385 | ||
357 | mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG); | 386 | gpio_request(OTG_EN_B, "usb-udc-en"); |
358 | mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG); | 387 | gpio_direction_output(OTG_EN_B, 0); |
359 | mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG); | 388 | gpio_request(USBH2_EN_B, "usbh2-en"); |
360 | mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG); | ||
361 | mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG); | ||
362 | mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG); | ||
363 | mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG); | ||
364 | mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG); | ||
365 | mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG); | ||
366 | mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG); | ||
367 | mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG); | ||
368 | mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG); | ||
369 | |||
370 | ret = gpio_request(USBH2_EN_B, "usbh2-en"); | ||
371 | if (ret) | ||
372 | return ret; | ||
373 | gpio_direction_output(USBH2_EN_B, 0); | 389 | gpio_direction_output(USBH2_EN_B, 0); |
374 | 390 | ||
375 | return 0; | 391 | gpio_request(USB_RESET_B, "usb-reset"); |
392 | gpio_direction_output(USB_RESET_B, 0); | ||
393 | mdelay(1); | ||
394 | gpio_set_value(USB_RESET_B, 1); | ||
395 | mdelay(1); | ||
376 | } | 396 | } |
377 | 397 | ||
378 | static int moboard_usbh2_hw_exit(struct platform_device *pdev) | 398 | #if defined(CONFIG_USB_ULPI) |
379 | { | ||
380 | gpio_free(USBH2_EN_B); | ||
381 | return 0; | ||
382 | } | ||
383 | 399 | ||
384 | static struct mxc_usbh_platform_data usbh2_pdata = { | 400 | static struct mxc_usbh_platform_data usbh2_pdata = { |
385 | .init = moboard_usbh2_hw_init, | ||
386 | .exit = moboard_usbh2_hw_exit, | ||
387 | .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT, | 401 | .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT, |
388 | .flags = MXC_EHCI_POWER_PINS_ENABLED, | 402 | .flags = MXC_EHCI_POWER_PINS_ENABLED, |
389 | }; | 403 | }; |
@@ -508,8 +522,6 @@ static void __init mxc_board_init(void) | |||
508 | 522 | ||
509 | usb_xcvr_reset(); | 523 | usb_xcvr_reset(); |
510 | 524 | ||
511 | moboard_usbotg_init(); | ||
512 | mxc_register_device(&mxc_otg_udc_device, &usb_pdata); | ||
513 | moboard_usbh2_init(); | 525 | moboard_usbh2_init(); |
514 | 526 | ||
515 | switch (mx31moboard_baseboard) { | 527 | switch (mx31moboard_baseboard) { |
@@ -522,7 +534,8 @@ static void __init mxc_board_init(void) | |||
522 | mx31moboard_marxbot_init(); | 534 | mx31moboard_marxbot_init(); |
523 | break; | 535 | break; |
524 | case MX31SMARTBOT: | 536 | case MX31SMARTBOT: |
525 | mx31moboard_smartbot_init(); | 537 | case MX31EYEBOT: |
538 | mx31moboard_smartbot_init(mx31moboard_baseboard); | ||
526 | break; | 539 | break; |
527 | default: | 540 | default: |
528 | printk(KERN_ERR "Illegal mx31moboard_baseboard type %d\n", | 541 | printk(KERN_ERR "Illegal mx31moboard_baseboard type %d\n", |