aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx3/mx31moboard-marxbot.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-marxbot.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-marxbot.c')
-rw-r--r--arch/arm/mach-mx3/mx31moboard-marxbot.c86
1 files changed, 86 insertions, 0 deletions
diff --git a/arch/arm/mach-mx3/mx31moboard-marxbot.c b/arch/arm/mach-mx3/mx31moboard-marxbot.c
index 7d98cb0164fa..85184a35e674 100644
--- a/arch/arm/mach-mx3/mx31moboard-marxbot.c
+++ b/arch/arm/mach-mx3/mx31moboard-marxbot.c
@@ -25,11 +25,15 @@
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/types.h> 26#include <linux/types.h>
27 27
28#include <linux/usb/otg.h>
29
28#include <mach/common.h> 30#include <mach/common.h>
29#include <mach/hardware.h> 31#include <mach/hardware.h>
30#include <mach/imx-uart.h> 32#include <mach/imx-uart.h>
31#include <mach/iomux-mx3.h> 33#include <mach/iomux-mx3.h>
32#include <mach/mmc.h> 34#include <mach/mmc.h>
35#include <mach/mxc_ehci.h>
36#include <mach/ulpi.h>
33 37
34#include <media/soc_camera.h> 38#include <media/soc_camera.h>
35 39
@@ -56,6 +60,12 @@ static unsigned int marxbot_pins[] = {
56 MX31_PIN_STXD5__GPIO1_21, MX31_PIN_SRXD5__GPIO1_22, 60 MX31_PIN_STXD5__GPIO1_21, MX31_PIN_SRXD5__GPIO1_22,
57 /*battery detection */ 61 /*battery detection */
58 MX31_PIN_LCS0__GPIO3_23, 62 MX31_PIN_LCS0__GPIO3_23,
63 /* USB H1 */
64 MX31_PIN_CSPI1_MISO__USBH1_RXDP, MX31_PIN_CSPI1_MOSI__USBH1_RXDM,
65 MX31_PIN_CSPI1_SS0__USBH1_TXDM, MX31_PIN_CSPI1_SS1__USBH1_TXDP,
66 MX31_PIN_CSPI1_SS2__USBH1_RCV, MX31_PIN_CSPI1_SCLK__USBH1_OEB,
67 MX31_PIN_CSPI1_SPI_RDY__USBH1_FS, MX31_PIN_SFS6__USBH1_SUSPEND,
68 MX31_PIN_NFRE_B__GPIO1_11, MX31_PIN_NFALE__GPIO1_12,
59}; 69};
60 70
61#define SDHC2_CD IOMUX_TO_GPIO(MX31_PIN_ATA_DIOR) 71#define SDHC2_CD IOMUX_TO_GPIO(MX31_PIN_ATA_DIOR)
@@ -213,6 +223,80 @@ static int __init marxbot_cam_init(void)
213 return 0; 223 return 0;
214} 224}
215 225
226#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
227 PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
228
229static int marxbot_usbh1_hw_init(struct platform_device *pdev)
230{
231 mxc_iomux_set_gpr(MUX_PGP_USB_SUSPEND, true);
232
233 mxc_iomux_set_pad(MX31_PIN_CSPI1_MISO, USB_PAD_CFG);
234 mxc_iomux_set_pad(MX31_PIN_CSPI1_MOSI, USB_PAD_CFG);
235 mxc_iomux_set_pad(MX31_PIN_CSPI1_SS0, USB_PAD_CFG);
236 mxc_iomux_set_pad(MX31_PIN_CSPI1_SS1, USB_PAD_CFG);
237 mxc_iomux_set_pad(MX31_PIN_CSPI1_SS2, USB_PAD_CFG);
238 mxc_iomux_set_pad(MX31_PIN_CSPI1_SCLK, USB_PAD_CFG);
239 mxc_iomux_set_pad(MX31_PIN_CSPI1_SPI_RDY, USB_PAD_CFG);
240 mxc_iomux_set_pad(MX31_PIN_SFS6, USB_PAD_CFG);
241
242 return 0;
243}
244
245#define USBH1_VBUSEN_B IOMUX_TO_GPIO(MX31_PIN_NFRE_B)
246#define USBH1_MODE IOMUX_TO_GPIO(MX31_PIN_NFALE)
247
248static int marxbot_isp1105_init(struct otg_transceiver *otg)
249{
250 int ret = gpio_request(USBH1_MODE, "usbh1-mode");
251 if (ret)
252 return ret;
253 /* single ended */
254 gpio_direction_output(USBH1_MODE, 0);
255
256 ret = gpio_request(USBH1_VBUSEN_B, "usbh1-vbusen");
257 if (ret) {
258 gpio_free(USBH1_MODE);
259 return ret;
260 }
261 gpio_direction_output(USBH1_VBUSEN_B, 1);
262
263 return 0;
264}
265
266
267static int marxbot_isp1105_set_vbus(struct otg_transceiver *otg, bool on)
268{
269 if (on)
270 gpio_set_value(USBH1_VBUSEN_B, 0);
271 else
272 gpio_set_value(USBH1_VBUSEN_B, 1);
273
274 return 0;
275}
276
277static struct mxc_usbh_platform_data usbh1_pdata = {
278 .init = marxbot_usbh1_hw_init,
279 .portsc = MXC_EHCI_MODE_UTMI | MXC_EHCI_SERIAL,
280 .flags = MXC_EHCI_POWER_PINS_ENABLED | MXC_EHCI_INTERFACE_SINGLE_UNI,
281};
282
283static int __init marxbot_usbh1_init(void)
284{
285 struct otg_transceiver *otg;
286
287 otg = kzalloc(sizeof(*otg), GFP_KERNEL);
288 if (!otg)
289 return -ENOMEM;
290
291 otg->label = "ISP1105";
292 otg->init = marxbot_isp1105_init;
293 otg->set_vbus = marxbot_isp1105_set_vbus;
294
295 usbh1_pdata.otg = otg;
296
297 return mxc_register_device(&mx31_usbh1, &usbh1_pdata);
298}
299
216/* 300/*
217 * system init for baseboard usage. Will be called by mx31moboard init. 301 * system init for baseboard usage. Will be called by mx31moboard init.
218 */ 302 */
@@ -237,4 +321,6 @@ void __init mx31moboard_marxbot_init(void)
237 gpio_request(IOMUX_TO_GPIO(MX31_PIN_LCS0), "bat-present"); 321 gpio_request(IOMUX_TO_GPIO(MX31_PIN_LCS0), "bat-present");
238 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_LCS0)); 322 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_LCS0));
239 gpio_export(IOMUX_TO_GPIO(MX31_PIN_LCS0), false); 323 gpio_export(IOMUX_TO_GPIO(MX31_PIN_LCS0), false);
324
325 marxbot_usbh1_init();
240} 326}