aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@freescale.com>2010-12-22 09:25:31 -0500
committerSascha Hauer <s.hauer@pengutronix.de>2011-01-03 04:17:12 -0500
commit96cf4239c72af1fa099affc720731bad2f86927b (patch)
tree0d2a8ef6440e59d96ce62091d41b062ee39f5a39 /arch/arm/mach-imx
parent130a0ddad9e8f48250dd0e4a5f35aa8afa9d1c5f (diff)
ARM: imx/mx27_3ds: Add USB OTG support
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-imx')
-rw-r--r--arch/arm/mach-imx/Kconfig3
-rw-r--r--arch/arm/mach-imx/mach-mx27_3ds.c71
2 files changed, 74 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index fed3ee526a05..9a715ce7c7b2 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -235,10 +235,13 @@ endchoice
235config MACH_MX27_3DS 235config MACH_MX27_3DS
236 bool "MX27PDK platform" 236 bool "MX27PDK platform"
237 select SOC_IMX27 237 select SOC_IMX27
238 select IMX_HAVE_PLATFORM_FSL_USB2_UDC
238 select IMX_HAVE_PLATFORM_IMX2_WDT 239 select IMX_HAVE_PLATFORM_IMX2_WDT
239 select IMX_HAVE_PLATFORM_IMX_KEYPAD 240 select IMX_HAVE_PLATFORM_IMX_KEYPAD
240 select IMX_HAVE_PLATFORM_IMX_UART 241 select IMX_HAVE_PLATFORM_IMX_UART
242 select IMX_HAVE_PLATFORM_MXC_EHCI
241 select IMX_HAVE_PLATFORM_MXC_MMC 243 select IMX_HAVE_PLATFORM_MXC_MMC
244 select MXC_ULPI if USB_ULPI
242 help 245 help
243 Include support for MX27PDK platform. This includes specific 246 Include support for MX27PDK platform. This includes specific
244 configurations for the board and its peripherals. 247 configurations for the board and its peripherals.
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c
index 1a7e879a4543..0ee7a734832e 100644
--- a/arch/arm/mach-imx/mach-mx27_3ds.c
+++ b/arch/arm/mach-imx/mach-mx27_3ds.c
@@ -23,16 +23,22 @@
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/gpio.h> 24#include <linux/gpio.h>
25#include <linux/irq.h> 25#include <linux/irq.h>
26#include <linux/usb/otg.h>
27#include <linux/usb/ulpi.h>
28#include <linux/delay.h>
29
26#include <asm/mach-types.h> 30#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
28#include <asm/mach/time.h> 32#include <asm/mach/time.h>
29#include <mach/hardware.h> 33#include <mach/hardware.h>
30#include <mach/common.h> 34#include <mach/common.h>
31#include <mach/iomux-mx27.h> 35#include <mach/iomux-mx27.h>
36#include <mach/ulpi.h>
32 37
33#include "devices-imx27.h" 38#include "devices-imx27.h"
34 39
35#define SD1_EN_GPIO (GPIO_PORTB + 25) 40#define SD1_EN_GPIO (GPIO_PORTB + 25)
41#define OTG_PHY_RESET_GPIO (GPIO_PORTB + 23)
36 42
37static const int mx27pdk_pins[] __initconst = { 43static const int mx27pdk_pins[] __initconst = {
38 /* UART1 */ 44 /* UART1 */
@@ -67,6 +73,20 @@ static const int mx27pdk_pins[] __initconst = {
67 PE22_PF_SD1_CMD, 73 PE22_PF_SD1_CMD,
68 PE23_PF_SD1_CLK, 74 PE23_PF_SD1_CLK,
69 SD1_EN_GPIO | GPIO_GPIO | GPIO_OUT, 75 SD1_EN_GPIO | GPIO_GPIO | GPIO_OUT,
76 /* OTG */
77 OTG_PHY_RESET_GPIO | GPIO_GPIO | GPIO_OUT,
78 PC7_PF_USBOTG_DATA5,
79 PC8_PF_USBOTG_DATA6,
80 PC9_PF_USBOTG_DATA0,
81 PC10_PF_USBOTG_DATA2,
82 PC11_PF_USBOTG_DATA1,
83 PC12_PF_USBOTG_DATA4,
84 PC13_PF_USBOTG_DATA3,
85 PE0_PF_USBOTG_NXT,
86 PE1_PF_USBOTG_STP,
87 PE2_PF_USBOTG_DIR,
88 PE24_PF_USBOTG_CLK,
89 PE25_PF_USBOTG_DATA7,
70}; 90};
71 91
72static const struct imxuart_platform_data uart_pdata __initconst = { 92static const struct imxuart_platform_data uart_pdata __initconst = {
@@ -118,6 +138,45 @@ static void mx27_3ds_sdhc1_enable_level_translator(void)
118 gpio_direction_output(SD1_EN_GPIO, 1); 138 gpio_direction_output(SD1_EN_GPIO, 1);
119} 139}
120 140
141
142static int otg_phy_init(void)
143{
144 gpio_request(OTG_PHY_RESET_GPIO, "usb-otg-reset");
145 gpio_direction_output(OTG_PHY_RESET_GPIO, 0);
146 mdelay(1);
147 gpio_set_value(OTG_PHY_RESET_GPIO, 1);
148 return 0;
149}
150
151#if defined(CONFIG_USB_ULPI)
152
153static struct mxc_usbh_platform_data otg_pdata __initdata = {
154 .portsc = MXC_EHCI_MODE_ULPI,
155 .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
156};
157#endif
158
159static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
160 .operating_mode = FSL_USB2_DR_DEVICE,
161 .phy_mode = FSL_USB2_PHY_ULPI,
162};
163
164static int otg_mode_host;
165
166static int __init mx27_3ds_otg_mode(char *options)
167{
168 if (!strcmp(options, "host"))
169 otg_mode_host = 1;
170 else if (!strcmp(options, "device"))
171 otg_mode_host = 0;
172 else
173 pr_info("otg_mode neither \"host\" nor \"device\". "
174 "Defaulting to device\n");
175 return 0;
176}
177__setup("otg_mode=", mx27_3ds_otg_mode);
178
179
121static void __init mx27pdk_init(void) 180static void __init mx27pdk_init(void)
122{ 181{
123 mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins), 182 mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins),
@@ -128,6 +187,18 @@ static void __init mx27pdk_init(void)
128 imx27_add_imx_keypad(&mx27_3ds_keymap_data); 187 imx27_add_imx_keypad(&mx27_3ds_keymap_data);
129 imx27_add_mxc_mmc(0, &sdhc1_pdata); 188 imx27_add_mxc_mmc(0, &sdhc1_pdata);
130 imx27_add_imx2_wdt(NULL); 189 imx27_add_imx2_wdt(NULL);
190 otg_phy_init();
191#if defined(CONFIG_USB_ULPI)
192 if (otg_mode_host) {
193 otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
194 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
195
196 imx27_add_mxc_ehci_otg(&otg_pdata);
197 }
198#endif
199 if (!otg_mode_host)
200 imx27_add_fsl_usb2_udc(&otg_device_pdata);
201
131} 202}
132 203
133static void __init mx27pdk_timer_init(void) 204static void __init mx27pdk_timer_init(void)