aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx3/mx31moboard-devboard.c
diff options
context:
space:
mode:
authorValentin Longchamp <valentin.longchamp@epfl.ch>2009-11-23 13:16:37 -0500
committerSascha Hauer <s.hauer@pengutronix.de>2009-11-24 02:37:50 -0500
commitd67d107586fa2c6fe4237292d58fb3787c75c6d1 (patch)
treef17c543ce98d77e0f0fec8e56834886302e706ca /arch/arm/mach-mx3/mx31moboard-devboard.c
parent33c4d91928bea4444b067e620496befbeb87029c (diff)
mx31moboard: support for usbh1 and usbh2
Signed-off-by: Valentin Longchamp <valentin.longchamp@epfl.ch> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mx3/mx31moboard-devboard.c')
-rw-r--r--arch/arm/mach-mx3/mx31moboard-devboard.c86
1 files changed, 86 insertions, 0 deletions
diff --git a/arch/arm/mach-mx3/mx31moboard-devboard.c b/arch/arm/mach-mx3/mx31moboard-devboard.c
index 5592cdb8d0ad..8fc624f141cb 100644
--- a/arch/arm/mach-mx3/mx31moboard-devboard.c
+++ b/arch/arm/mach-mx3/mx31moboard-devboard.c
@@ -22,11 +22,15 @@
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/types.h> 23#include <linux/types.h>
24 24
25#include <linux/usb/otg.h>
26
25#include <mach/common.h> 27#include <mach/common.h>
26#include <mach/imx-uart.h> 28#include <mach/imx-uart.h>
27#include <mach/iomux-mx3.h> 29#include <mach/iomux-mx3.h>
28#include <mach/hardware.h> 30#include <mach/hardware.h>
29#include <mach/mmc.h> 31#include <mach/mmc.h>
32#include <mach/mxc_ehci.h>
33#include <mach/ulpi.h>
30 34
31#include "devices.h" 35#include "devices.h"
32 36
@@ -39,6 +43,12 @@ static unsigned int devboard_pins[] = {
39 MX31_PIN_PC_READY__SD2_DATA1, MX31_PIN_PC_WAIT_B__SD2_DATA0, 43 MX31_PIN_PC_READY__SD2_DATA1, MX31_PIN_PC_WAIT_B__SD2_DATA0,
40 MX31_PIN_PC_CD2_B__SD2_CLK, MX31_PIN_PC_CD1_B__SD2_CMD, 44 MX31_PIN_PC_CD2_B__SD2_CLK, MX31_PIN_PC_CD1_B__SD2_CMD,
41 MX31_PIN_ATA_DIOR__GPIO3_28, MX31_PIN_ATA_DIOW__GPIO3_29, 45 MX31_PIN_ATA_DIOR__GPIO3_28, MX31_PIN_ATA_DIOW__GPIO3_29,
46 /* USB H1 */
47 MX31_PIN_CSPI1_MISO__USBH1_RXDP, MX31_PIN_CSPI1_MOSI__USBH1_RXDM,
48 MX31_PIN_CSPI1_SS0__USBH1_TXDM, MX31_PIN_CSPI1_SS1__USBH1_TXDP,
49 MX31_PIN_CSPI1_SS2__USBH1_RCV, MX31_PIN_CSPI1_SCLK__USBH1_OEB,
50 MX31_PIN_CSPI1_SPI_RDY__USBH1_FS, MX31_PIN_SFS6__USBH1_SUSPEND,
51 MX31_PIN_NFRE_B__GPIO1_11, MX31_PIN_NFALE__GPIO1_12,
42}; 52};
43 53
44static struct imxuart_platform_data uart_pdata = { 54static struct imxuart_platform_data uart_pdata = {
@@ -98,6 +108,80 @@ static struct imxmmc_platform_data sdhc2_pdata = {
98 .exit = devboard_sdhc2_exit, 108 .exit = devboard_sdhc2_exit,
99}; 109};
100 110
111#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
112 PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
113
114static int devboard_usbh1_hw_init(struct platform_device *pdev)
115{
116 mxc_iomux_set_gpr(MUX_PGP_USB_SUSPEND, true);
117
118 mxc_iomux_set_pad(MX31_PIN_CSPI1_MISO, USB_PAD_CFG);
119 mxc_iomux_set_pad(MX31_PIN_CSPI1_MOSI, USB_PAD_CFG);
120 mxc_iomux_set_pad(MX31_PIN_CSPI1_SS0, USB_PAD_CFG);
121 mxc_iomux_set_pad(MX31_PIN_CSPI1_SS1, USB_PAD_CFG);
122 mxc_iomux_set_pad(MX31_PIN_CSPI1_SS2, USB_PAD_CFG);
123 mxc_iomux_set_pad(MX31_PIN_CSPI1_SCLK, USB_PAD_CFG);
124 mxc_iomux_set_pad(MX31_PIN_CSPI1_SPI_RDY, USB_PAD_CFG);
125 mxc_iomux_set_pad(MX31_PIN_SFS6, USB_PAD_CFG);
126
127 return 0;
128}
129
130#define USBH1_VBUSEN_B IOMUX_TO_GPIO(MX31_PIN_NFRE_B)
131#define USBH1_MODE IOMUX_TO_GPIO(MX31_PIN_NFALE)
132
133static int devboard_isp1105_init(struct otg_transceiver *otg)
134{
135 int ret = gpio_request(USBH1_MODE, "usbh1-mode");
136 if (ret)
137 return ret;
138 /* single ended */
139 gpio_direction_output(USBH1_MODE, 0);
140
141 ret = gpio_request(USBH1_VBUSEN_B, "usbh1-vbusen");
142 if (ret) {
143 gpio_free(USBH1_MODE);
144 return ret;
145 }
146 gpio_direction_output(USBH1_VBUSEN_B, 1);
147
148 return 0;
149}
150
151
152static int devboard_isp1105_set_vbus(struct otg_transceiver *otg, bool on)
153{
154 if (on)
155 gpio_set_value(USBH1_VBUSEN_B, 0);
156 else
157 gpio_set_value(USBH1_VBUSEN_B, 1);
158
159 return 0;
160}
161
162static struct mxc_usbh_platform_data usbh1_pdata = {
163 .init = devboard_usbh1_hw_init,
164 .portsc = MXC_EHCI_MODE_UTMI | MXC_EHCI_SERIAL,
165 .flags = MXC_EHCI_POWER_PINS_ENABLED | MXC_EHCI_INTERFACE_SINGLE_UNI,
166};
167
168static int __init devboard_usbh1_init(void)
169{
170 struct otg_transceiver *otg;
171
172 otg = kzalloc(sizeof(*otg), GFP_KERNEL);
173 if (!otg)
174 return -ENOMEM;
175
176 otg->label = "ISP1105";
177 otg->init = devboard_isp1105_init;
178 otg->set_vbus = devboard_isp1105_set_vbus;
179
180 usbh1_pdata.otg = otg;
181
182 return mxc_register_device(&mx31_usbh1, &usbh1_pdata);
183}
184
101/* 185/*
102 * system init for baseboard usage. Will be called by mx31moboard init. 186 * system init for baseboard usage. Will be called by mx31moboard init.
103 */ 187 */
@@ -111,4 +195,6 @@ void __init mx31moboard_devboard_init(void)
111 mxc_register_device(&mxc_uart_device1, &uart_pdata); 195 mxc_register_device(&mxc_uart_device1, &uart_pdata);
112 196
113 mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata); 197 mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata);
198
199 devboard_usbh1_init();
114} 200}