aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx3/mach-pcm037.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-mx3/mach-pcm037.c')
-rw-r--r--arch/arm/mach-mx3/mach-pcm037.c137
1 files changed, 92 insertions, 45 deletions
diff --git a/arch/arm/mach-mx3/mach-pcm037.c b/arch/arm/mach-mx3/mach-pcm037.c
index 21f54811a630..11f531559169 100644
--- a/arch/arm/mach-mx3/mach-pcm037.c
+++ b/arch/arm/mach-mx3/mach-pcm037.c
@@ -33,6 +33,9 @@
33#include <linux/irq.h> 33#include <linux/irq.h>
34#include <linux/fsl_devices.h> 34#include <linux/fsl_devices.h>
35#include <linux/can/platform/sja1000.h> 35#include <linux/can/platform/sja1000.h>
36#include <linux/usb/otg.h>
37#include <linux/usb/ulpi.h>
38#include <linux/fsl_devices.h>
36 39
37#include <media/soc_camera.h> 40#include <media/soc_camera.h>
38 41
@@ -51,6 +54,8 @@
51#include <mach/mx3_camera.h> 54#include <mach/mx3_camera.h>
52#include <mach/mx3fb.h> 55#include <mach/mx3fb.h>
53#include <mach/mxc_nand.h> 56#include <mach/mxc_nand.h>
57#include <mach/mxc_ehci.h>
58#include <mach/ulpi.h>
54 59
55#include "devices.h" 60#include "devices.h"
56#include "pcm037.h" 61#include "pcm037.h"
@@ -172,19 +177,7 @@ static unsigned int pcm037_pins[] = {
172 MX31_PIN_CSI_VSYNC__CSI_VSYNC, 177 MX31_PIN_CSI_VSYNC__CSI_VSYNC,
173 /* GPIO */ 178 /* GPIO */
174 IOMUX_MODE(MX31_PIN_ATA_DMACK, IOMUX_CONFIG_GPIO), 179 IOMUX_MODE(MX31_PIN_ATA_DMACK, IOMUX_CONFIG_GPIO),
175}; 180 /* OTG */
176
177static struct physmap_flash_data pcm037_flash_data = {
178 .width = 2,
179};
180
181static struct resource pcm037_flash_resource = {
182 .start = 0xa0000000,
183 .end = 0xa1ffffff,
184 .flags = IORESOURCE_MEM,
185};
186
187static int usbotg_pins[] = {
188 MX31_PIN_USBOTG_DATA0__USBOTG_DATA0, 181 MX31_PIN_USBOTG_DATA0__USBOTG_DATA0,
189 MX31_PIN_USBOTG_DATA1__USBOTG_DATA1, 182 MX31_PIN_USBOTG_DATA1__USBOTG_DATA1,
190 MX31_PIN_USBOTG_DATA2__USBOTG_DATA2, 183 MX31_PIN_USBOTG_DATA2__USBOTG_DATA2,
@@ -197,39 +190,29 @@ static int usbotg_pins[] = {
197 MX31_PIN_USBOTG_DIR__USBOTG_DIR, 190 MX31_PIN_USBOTG_DIR__USBOTG_DIR,
198 MX31_PIN_USBOTG_NXT__USBOTG_NXT, 191 MX31_PIN_USBOTG_NXT__USBOTG_NXT,
199 MX31_PIN_USBOTG_STP__USBOTG_STP, 192 MX31_PIN_USBOTG_STP__USBOTG_STP,
193 /* USB host 2 */
194 IOMUX_MODE(MX31_PIN_USBH2_CLK, IOMUX_CONFIG_FUNC),
195 IOMUX_MODE(MX31_PIN_USBH2_DIR, IOMUX_CONFIG_FUNC),
196 IOMUX_MODE(MX31_PIN_USBH2_NXT, IOMUX_CONFIG_FUNC),
197 IOMUX_MODE(MX31_PIN_USBH2_STP, IOMUX_CONFIG_FUNC),
198 IOMUX_MODE(MX31_PIN_USBH2_DATA0, IOMUX_CONFIG_FUNC),
199 IOMUX_MODE(MX31_PIN_USBH2_DATA1, IOMUX_CONFIG_FUNC),
200 IOMUX_MODE(MX31_PIN_STXD3, IOMUX_CONFIG_FUNC),
201 IOMUX_MODE(MX31_PIN_SRXD3, IOMUX_CONFIG_FUNC),
202 IOMUX_MODE(MX31_PIN_SCK3, IOMUX_CONFIG_FUNC),
203 IOMUX_MODE(MX31_PIN_SFS3, IOMUX_CONFIG_FUNC),
204 IOMUX_MODE(MX31_PIN_STXD6, IOMUX_CONFIG_FUNC),
205 IOMUX_MODE(MX31_PIN_SRXD6, IOMUX_CONFIG_FUNC),
200}; 206};
201 207
202/* USB OTG HS port */ 208static struct physmap_flash_data pcm037_flash_data = {
203static int __init gpio_usbotg_hs_activate(void) 209 .width = 2,
204{ 210};
205 int ret = mxc_iomux_setup_multiple_pins(usbotg_pins,
206 ARRAY_SIZE(usbotg_pins), "usbotg");
207
208 if (ret < 0) {
209 printk(KERN_ERR "Cannot set up OTG pins\n");
210 return ret;
211 }
212
213 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
214 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
215 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
216 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
217 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
218 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
219 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
220 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
221 mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
222 mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
223 mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
224 mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
225
226 return 0;
227}
228 211
229/* OTG config */ 212static struct resource pcm037_flash_resource = {
230static struct fsl_usb2_platform_data usb_pdata = { 213 .start = 0xa0000000,
231 .operating_mode = FSL_USB2_DR_DEVICE, 214 .end = 0xa1ffffff,
232 .phy_mode = FSL_USB2_PHY_ULPI, 215 .flags = IORESOURCE_MEM,
233}; 216};
234 217
235static struct platform_device pcm037_flash = { 218static struct platform_device pcm037_flash = {
@@ -561,16 +544,65 @@ static struct platform_device pcm970_sja1000 = {
561 .num_resources = ARRAY_SIZE(pcm970_sja1000_resources), 544 .num_resources = ARRAY_SIZE(pcm970_sja1000_resources),
562}; 545};
563 546
547static struct mxc_usbh_platform_data otg_pdata = {
548 .portsc = MXC_EHCI_MODE_ULPI,
549 .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
550};
551
552static struct mxc_usbh_platform_data usbh2_pdata = {
553 .portsc = MXC_EHCI_MODE_ULPI,
554 .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
555};
556
557static struct fsl_usb2_platform_data otg_device_pdata = {
558 .operating_mode = FSL_USB2_DR_DEVICE,
559 .phy_mode = FSL_USB2_PHY_ULPI,
560};
561
562static int otg_mode_host;
563
564static int __init pcm037_otg_mode(char *options)
565{
566 if (!strcmp(options, "host"))
567 otg_mode_host = 1;
568 else if (!strcmp(options, "device"))
569 otg_mode_host = 0;
570 else
571 pr_info("otg_mode neither \"host\" nor \"device\". "
572 "Defaulting to device\n");
573 return 0;
574}
575__setup("otg_mode=", pcm037_otg_mode);
576
564/* 577/*
565 * Board specific initialization. 578 * Board specific initialization.
566 */ 579 */
567static void __init mxc_board_init(void) 580static void __init mxc_board_init(void)
568{ 581{
569 int ret; 582 int ret;
583 u32 tmp;
584
585 mxc_iomux_set_gpr(MUX_PGP_UH2, 1);
570 586
571 mxc_iomux_setup_multiple_pins(pcm037_pins, ARRAY_SIZE(pcm037_pins), 587 mxc_iomux_setup_multiple_pins(pcm037_pins, ARRAY_SIZE(pcm037_pins),
572 "pcm037"); 588 "pcm037");
573 589
590#define H2_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS \
591 | PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
592
593 mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, H2_PAD_CFG);
594 mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, H2_PAD_CFG);
595 mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, H2_PAD_CFG);
596 mxc_iomux_set_pad(MX31_PIN_USBH2_STP, H2_PAD_CFG);
597 mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, H2_PAD_CFG); /* USBH2_DATA0 */
598 mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, H2_PAD_CFG); /* USBH2_DATA1 */
599 mxc_iomux_set_pad(MX31_PIN_SRXD6, H2_PAD_CFG); /* USBH2_DATA2 */
600 mxc_iomux_set_pad(MX31_PIN_STXD6, H2_PAD_CFG); /* USBH2_DATA3 */
601 mxc_iomux_set_pad(MX31_PIN_SFS3, H2_PAD_CFG); /* USBH2_DATA4 */
602 mxc_iomux_set_pad(MX31_PIN_SCK3, H2_PAD_CFG); /* USBH2_DATA5 */
603 mxc_iomux_set_pad(MX31_PIN_SRXD3, H2_PAD_CFG); /* USBH2_DATA6 */
604 mxc_iomux_set_pad(MX31_PIN_STXD3, H2_PAD_CFG); /* USBH2_DATA7 */
605
574 if (pcm037_variant() == PCM037_EET) 606 if (pcm037_variant() == PCM037_EET)
575 mxc_iomux_setup_multiple_pins(pcm037_uart1_pins, 607 mxc_iomux_setup_multiple_pins(pcm037_uart1_pins,
576 ARRAY_SIZE(pcm037_uart1_pins), "pcm037_uart1"); 608 ARRAY_SIZE(pcm037_uart1_pins), "pcm037_uart1");
@@ -608,8 +640,6 @@ static void __init mxc_board_init(void)
608 mxc_register_device(&mxcsdhc_device0, &sdhc_pdata); 640 mxc_register_device(&mxcsdhc_device0, &sdhc_pdata);
609 mxc_register_device(&mx3_ipu, &mx3_ipu_data); 641 mxc_register_device(&mx3_ipu, &mx3_ipu_data);
610 mxc_register_device(&mx3_fb, &mx3fb_pdata); 642 mxc_register_device(&mx3_fb, &mx3fb_pdata);
611 if (!gpio_usbotg_hs_activate())
612 mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
613 643
614 /* CSI */ 644 /* CSI */
615 /* Camera power: default - off */ 645 /* Camera power: default - off */
@@ -623,6 +653,23 @@ static void __init mxc_board_init(void)
623 mxc_register_device(&mx3_camera, &camera_pdata); 653 mxc_register_device(&mx3_camera, &camera_pdata);
624 654
625 platform_device_register(&pcm970_sja1000); 655 platform_device_register(&pcm970_sja1000);
656
657#if defined(CONFIG_USB_ULPI)
658 if (otg_mode_host) {
659 otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
660 USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
661
662 mxc_register_device(&mxc_otg_host, &otg_pdata);
663 }
664
665 usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
666 USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
667
668 mxc_register_device(&mxc_usbh2, &usbh2_pdata);
669#endif
670 if (!otg_mode_host)
671 mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata);
672
626} 673}
627 674
628static void __init pcm037_timer_init(void) 675static void __init pcm037_timer_init(void)