aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-mx2/Kconfig1
-rw-r--r--arch/arm/mach-mx2/mach-pca100.c103
2 files changed, 104 insertions, 0 deletions
diff --git a/arch/arm/mach-mx2/Kconfig b/arch/arm/mach-mx2/Kconfig
index 7bc797c1c3a2..ca1278d5c845 100644
--- a/arch/arm/mach-mx2/Kconfig
+++ b/arch/arm/mach-mx2/Kconfig
@@ -100,6 +100,7 @@ config MACH_IMX27LITE
100config MACH_PCA100 100config MACH_PCA100
101 bool "Phytec phyCARD-s (pca100)" 101 bool "Phytec phyCARD-s (pca100)"
102 depends on MACH_MX27 102 depends on MACH_MX27
103 select MXC_ULPI if USB_ULPI
103 help 104 help
104 Include support for phyCARD-s (aka pca100) platform. This 105 Include support for phyCARD-s (aka pca100) platform. This
105 includes specific configurations for the module and its peripherals. 106 includes specific configurations for the module and its peripherals.
diff --git a/arch/arm/mach-mx2/mach-pca100.c b/arch/arm/mach-mx2/mach-pca100.c
index 9279b42b24b5..cda52a6a3290 100644
--- a/arch/arm/mach-mx2/mach-pca100.c
+++ b/arch/arm/mach-mx2/mach-pca100.c
@@ -26,6 +26,9 @@
26#include <linux/spi/eeprom.h> 26#include <linux/spi/eeprom.h>
27#include <linux/irq.h> 27#include <linux/irq.h>
28#include <linux/gpio.h> 28#include <linux/gpio.h>
29#include <linux/usb/otg.h>
30#include <linux/usb/ulpi.h>
31#include <linux/fsl_devices.h>
29 32
30#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
31#include <asm/mach-types.h> 34#include <asm/mach-types.h>
@@ -41,9 +44,14 @@
41#include <mach/mxc_nand.h> 44#include <mach/mxc_nand.h>
42#include <mach/irqs.h> 45#include <mach/irqs.h>
43#include <mach/mmc.h> 46#include <mach/mmc.h>
47#include <mach/mxc_ehci.h>
48#include <mach/ulpi.h>
44 49
45#include "devices.h" 50#include "devices.h"
46 51
52#define OTG_PHY_CS_GPIO (GPIO_PORTB + 23)
53#define USBH2_PHY_CS_GPIO (GPIO_PORTB + 24)
54
47static int pca100_pins[] = { 55static int pca100_pins[] = {
48 /* UART1 */ 56 /* UART1 */
49 PE12_PF_UART1_TXD, 57 PE12_PF_UART1_TXD,
@@ -92,6 +100,34 @@ static int pca100_pins[] = {
92 PD29_PF_CSPI1_SCLK, 100 PD29_PF_CSPI1_SCLK,
93 PD30_PF_CSPI1_MISO, 101 PD30_PF_CSPI1_MISO,
94 PD31_PF_CSPI1_MOSI, 102 PD31_PF_CSPI1_MOSI,
103 /* OTG */
104 OTG_PHY_CS_GPIO | GPIO_GPIO | GPIO_OUT,
105 PC7_PF_USBOTG_DATA5,
106 PC8_PF_USBOTG_DATA6,
107 PC9_PF_USBOTG_DATA0,
108 PC10_PF_USBOTG_DATA2,
109 PC11_PF_USBOTG_DATA1,
110 PC12_PF_USBOTG_DATA4,
111 PC13_PF_USBOTG_DATA3,
112 PE0_PF_USBOTG_NXT,
113 PE1_PF_USBOTG_STP,
114 PE2_PF_USBOTG_DIR,
115 PE24_PF_USBOTG_CLK,
116 PE25_PF_USBOTG_DATA7,
117 /* USBH2 */
118 USBH2_PHY_CS_GPIO | GPIO_GPIO | GPIO_OUT,
119 PA0_PF_USBH2_CLK,
120 PA1_PF_USBH2_DIR,
121 PA2_PF_USBH2_DATA7,
122 PA3_PF_USBH2_NXT,
123 PA4_PF_USBH2_STP,
124 PD19_AF_USBH2_DATA4,
125 PD20_AF_USBH2_DATA3,
126 PD21_AF_USBH2_DATA6,
127 PD22_AF_USBH2_DATA0,
128 PD23_AF_USBH2_DATA2,
129 PD24_AF_USBH2_DATA1,
130 PD26_AF_USBH2_DATA5,
95}; 131};
96 132
97static struct imxuart_platform_data uart_pdata = { 133static struct imxuart_platform_data uart_pdata = {
@@ -182,6 +218,50 @@ static struct imxmmc_platform_data sdhc_pdata = {
182 .exit = pca100_sdhc2_exit, 218 .exit = pca100_sdhc2_exit,
183}; 219};
184 220
221static int otg_phy_init(struct platform_device *pdev)
222{
223 gpio_set_value(OTG_PHY_CS_GPIO, 0);
224 return 0;
225}
226
227static struct mxc_usbh_platform_data otg_pdata = {
228 .init = otg_phy_init,
229 .portsc = MXC_EHCI_MODE_ULPI,
230 .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
231};
232
233static int usbh2_phy_init(struct platform_device *pdev)
234{
235 gpio_set_value(USBH2_PHY_CS_GPIO, 0);
236 return 0;
237}
238
239static struct mxc_usbh_platform_data usbh2_pdata = {
240 .init = usbh2_phy_init,
241 .portsc = MXC_EHCI_MODE_ULPI,
242 .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
243};
244
245static struct fsl_usb2_platform_data otg_device_pdata = {
246 .operating_mode = FSL_USB2_DR_DEVICE,
247 .phy_mode = FSL_USB2_PHY_ULPI,
248};
249
250static int otg_mode_host;
251
252static int __init pca100_otg_mode(char *options)
253{
254 if (!strcmp(options, "host"))
255 otg_mode_host = 1;
256 else if (!strcmp(options, "device"))
257 otg_mode_host = 0;
258 else
259 pr_info("otg_mode neither \"host\" nor \"device\". "
260 "Defaulting to device\n");
261 return 0;
262}
263__setup("otg_mode=", pca100_otg_mode);
264
185static void __init pca100_init(void) 265static void __init pca100_init(void)
186{ 266{
187 int ret; 267 int ret;
@@ -220,6 +300,29 @@ static void __init pca100_init(void)
220 mxc_register_device(&mxc_spi_device0, &pca100_spi_0_data); 300 mxc_register_device(&mxc_spi_device0, &pca100_spi_0_data);
221#endif 301#endif
222 302
303 gpio_request(OTG_PHY_CS_GPIO, "usb-otg-cs");
304 gpio_direction_output(OTG_PHY_CS_GPIO, 1);
305 gpio_request(USBH2_PHY_CS_GPIO, "usb-host2-cs");
306 gpio_direction_output(USBH2_PHY_CS_GPIO, 1);
307
308#if defined(CONFIG_USB_ULPI)
309 if (otg_mode_host) {
310 otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
311 USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
312
313 mxc_register_device(&mxc_otg_host, &otg_pdata);
314 }
315
316 usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
317 USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
318
319 mxc_register_device(&mxc_usbh2, &usbh2_pdata);
320#endif
321 if (!otg_mode_host) {
322 gpio_set_value(OTG_PHY_CS_GPIO, 0);
323 mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata);
324 }
325
223 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 326 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
224} 327}
225 328