aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx3/mach-mx31_3ds.c
diff options
context:
space:
mode:
authorMagnus Lilja <lilja.magnus@gmail.com>2010-05-14 11:08:29 -0400
committerSascha Hauer <s.hauer@pengutronix.de>2010-05-17 04:08:32 -0400
commita2ef4562c25317f3d0731e79eb432db8ed9eb1ca (patch)
tree0522c4efec2fa9306831347765b059f8815a8706 /arch/arm/mach-mx3/mach-mx31_3ds.c
parent3a47b1a4f16285bc1b96941782a896afc4711e97 (diff)
MXC: Add USB OTG (device) for i.MX31 PDK (3DS) board.
Tested on actual hardware using the g_ether and g_serial gadget drivers. Signed-off-by: Magnus Lilja <lilja.magnus@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mx3/mach-mx31_3ds.c')
-rw-r--r--arch/arm/mach-mx3/mach-mx31_3ds.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/arch/arm/mach-mx3/mach-mx31_3ds.c b/arch/arm/mach-mx3/mach-mx31_3ds.c
index f54af1e29ca4..55d6117fbae9 100644
--- a/arch/arm/mach-mx3/mach-mx31_3ds.c
+++ b/arch/arm/mach-mx3/mach-mx31_3ds.c
@@ -16,6 +16,7 @@
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */ 17 */
18 18
19#include <linux/delay.h>
19#include <linux/types.h> 20#include <linux/types.h>
20#include <linux/init.h> 21#include <linux/init.h>
21#include <linux/clk.h> 22#include <linux/clk.h>
@@ -26,6 +27,7 @@
26#include <linux/mfd/mc13783.h> 27#include <linux/mfd/mc13783.h>
27#include <linux/spi/spi.h> 28#include <linux/spi/spi.h>
28#include <linux/regulator/machine.h> 29#include <linux/regulator/machine.h>
30#include <linux/fsl_devices.h>
29 31
30#include <mach/hardware.h> 32#include <mach/hardware.h>
31#include <asm/mach-types.h> 33#include <asm/mach-types.h>
@@ -65,6 +67,21 @@ static int mx31_3ds_pins[] = {
65 MX31_PIN_CSPI2_SS2__SS2, /*CS for MC13783 */ 67 MX31_PIN_CSPI2_SS2__SS2, /*CS for MC13783 */
66 /* MC13783 IRQ */ 68 /* MC13783 IRQ */
67 IOMUX_MODE(MX31_PIN_GPIO1_3, IOMUX_CONFIG_GPIO), 69 IOMUX_MODE(MX31_PIN_GPIO1_3, IOMUX_CONFIG_GPIO),
70 /* USB OTG reset */
71 IOMUX_MODE(MX31_PIN_USB_PWR, IOMUX_CONFIG_GPIO),
72 /* USB OTG */
73 MX31_PIN_USBOTG_DATA0__USBOTG_DATA0,
74 MX31_PIN_USBOTG_DATA1__USBOTG_DATA1,
75 MX31_PIN_USBOTG_DATA2__USBOTG_DATA2,
76 MX31_PIN_USBOTG_DATA3__USBOTG_DATA3,
77 MX31_PIN_USBOTG_DATA4__USBOTG_DATA4,
78 MX31_PIN_USBOTG_DATA5__USBOTG_DATA5,
79 MX31_PIN_USBOTG_DATA6__USBOTG_DATA6,
80 MX31_PIN_USBOTG_DATA7__USBOTG_DATA7,
81 MX31_PIN_USBOTG_CLK__USBOTG_CLK,
82 MX31_PIN_USBOTG_DIR__USBOTG_DIR,
83 MX31_PIN_USBOTG_NXT__USBOTG_NXT,
84 MX31_PIN_USBOTG_STP__USBOTG_STP,
68}; 85};
69 86
70/* Regulators */ 87/* Regulators */
@@ -126,6 +143,41 @@ static struct mxc_nand_platform_data imx31_3ds_nand_flash_pdata = {
126#endif 143#endif
127}; 144};
128 145
146/*
147 * USB OTG
148 */
149
150#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
151 PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
152
153#define USBOTG_RST_B IOMUX_TO_GPIO(MX31_PIN_USB_PWR)
154
155static void mx31_3ds_usbotg_init(void)
156{
157 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG);
158 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG);
159 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG);
160 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG);
161 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG);
162 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG);
163 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG);
164 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG);
165 mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG);
166 mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG);
167 mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG);
168 mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG);
169
170 gpio_request(USBOTG_RST_B, "otgusb-reset");
171 gpio_direction_output(USBOTG_RST_B, 0);
172 mdelay(1);
173 gpio_set_value(USBOTG_RST_B, 1);
174}
175
176static struct fsl_usb2_platform_data usbotg_pdata = {
177 .operating_mode = FSL_USB2_DR_DEVICE,
178 .phy_mode = FSL_USB2_PHY_ULPI,
179};
180
129static struct imxuart_platform_data uart_pdata = { 181static struct imxuart_platform_data uart_pdata = {
130 .flags = IMXUART_HAVE_RTSCTS, 182 .flags = IMXUART_HAVE_RTSCTS,
131}; 183};
@@ -315,6 +367,9 @@ static void __init mxc_board_init(void)
315 spi_register_board_info(mx31_3ds_spi_devs, 367 spi_register_board_info(mx31_3ds_spi_devs,
316 ARRAY_SIZE(mx31_3ds_spi_devs)); 368 ARRAY_SIZE(mx31_3ds_spi_devs));
317 369
370 mx31_3ds_usbotg_init();
371 mxc_register_device(&mxc_otg_udc_device, &usbotg_pdata);
372
318 if (!mx31_3ds_init_expio()) 373 if (!mx31_3ds_init_expio())
319 platform_device_register(&smsc911x_device); 374 platform_device_register(&smsc911x_device);
320} 375}