aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx3/mach-mx31moboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-mx3/mach-mx31moboard.c')
-rw-r--r--arch/arm/mach-mx3/mach-mx31moboard.c104
1 files changed, 37 insertions, 67 deletions
diff --git a/arch/arm/mach-mx3/mach-mx31moboard.c b/arch/arm/mach-mx3/mach-mx31moboard.c
index fccb9207b78d..33a8d35498a7 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>
@@ -306,84 +305,56 @@ static struct imxmmc_platform_data sdhc1_pdata = {
306 * this pin is dedicated for all mx31moboard systems, so we do it here 305 * this pin is dedicated for all mx31moboard systems, so we do it here
307 */ 306 */
308#define USB_RESET_B IOMUX_TO_GPIO(MX31_PIN_GPIO1_0) 307#define USB_RESET_B IOMUX_TO_GPIO(MX31_PIN_GPIO1_0)
309
310static 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 | \ 308#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) 309 PAD_CTL_ODE_CMOS)
320 310
321#define OTG_EN_B IOMUX_TO_GPIO(MX31_PIN_USB_OC) 311#define OTG_EN_B IOMUX_TO_GPIO(MX31_PIN_USB_OC)
322
323static 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
342static 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) 312#define USBH2_EN_B IOMUX_TO_GPIO(MX31_PIN_SCK6)
350 313
351static int moboard_usbh2_hw_init(struct platform_device *pdev) 314static void usb_xcvr_reset(void)
352{ 315{
353 int ret; 316 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG | PAD_CTL_100K_PD);
317 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG | PAD_CTL_100K_PD);
318 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG | PAD_CTL_100K_PD);
319 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG | PAD_CTL_100K_PD);
320 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG | PAD_CTL_100K_PD);
321 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG | PAD_CTL_100K_PD);
322 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG | PAD_CTL_100K_PD);
323 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG | PAD_CTL_100K_PD);
324 mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG | PAD_CTL_100K_PU);
325 mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG | PAD_CTL_100K_PU);
326 mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG | PAD_CTL_100K_PU);
327 mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG | PAD_CTL_100K_PU);
354 328
355 mxc_iomux_set_gpr(MUX_PGP_UH2, true); 329 mxc_iomux_set_gpr(MUX_PGP_UH2, true);
330 mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG | PAD_CTL_100K_PU);
331 mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG | PAD_CTL_100K_PU);
332 mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG | PAD_CTL_100K_PU);
333 mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG | PAD_CTL_100K_PU);
334 mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG | PAD_CTL_100K_PD);
335 mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG | PAD_CTL_100K_PD);
336 mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG | PAD_CTL_100K_PD);
337 mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG | PAD_CTL_100K_PD);
338 mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG | PAD_CTL_100K_PD);
339 mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG | PAD_CTL_100K_PD);
340 mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG | PAD_CTL_100K_PD);
341 mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG | PAD_CTL_100K_PD);
356 342
357 mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG); 343 gpio_request(OTG_EN_B, "usb-udc-en");
358 mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG); 344 gpio_direction_output(OTG_EN_B, 0);
359 mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG); 345 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); 346 gpio_direction_output(USBH2_EN_B, 0);
374 347
375 return 0; 348 gpio_request(USB_RESET_B, "usb-reset");
349 gpio_direction_output(USB_RESET_B, 0);
350 mdelay(1);
351 gpio_set_value(USB_RESET_B, 1);
352 mdelay(1);
376} 353}
377 354
378static int moboard_usbh2_hw_exit(struct platform_device *pdev) 355#if defined(CONFIG_USB_ULPI)
379{
380 gpio_free(USBH2_EN_B);
381 return 0;
382}
383 356
384static struct mxc_usbh_platform_data usbh2_pdata = { 357static 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, 358 .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
388 .flags = MXC_EHCI_POWER_PINS_ENABLED, 359 .flags = MXC_EHCI_POWER_PINS_ENABLED,
389}; 360};
@@ -508,8 +479,6 @@ static void __init mxc_board_init(void)
508 479
509 usb_xcvr_reset(); 480 usb_xcvr_reset();
510 481
511 moboard_usbotg_init();
512 mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
513 moboard_usbh2_init(); 482 moboard_usbh2_init();
514 483
515 switch (mx31moboard_baseboard) { 484 switch (mx31moboard_baseboard) {
@@ -522,7 +491,8 @@ static void __init mxc_board_init(void)
522 mx31moboard_marxbot_init(); 491 mx31moboard_marxbot_init();
523 break; 492 break;
524 case MX31SMARTBOT: 493 case MX31SMARTBOT:
525 mx31moboard_smartbot_init(); 494 case MX31EYEBOT:
495 mx31moboard_smartbot_init(mx31moboard_baseboard);
526 break; 496 break;
527 default: 497 default:
528 printk(KERN_ERR "Illegal mx31moboard_baseboard type %d\n", 498 printk(KERN_ERR "Illegal mx31moboard_baseboard type %d\n",