aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx3
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
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')
-rw-r--r--arch/arm/mach-mx3/Kconfig1
-rw-r--r--arch/arm/mach-mx3/mx31moboard-devboard.c86
-rw-r--r--arch/arm/mach-mx3/mx31moboard-marxbot.c86
-rw-r--r--arch/arm/mach-mx3/mx31moboard.c65
4 files changed, 238 insertions, 0 deletions
diff --git a/arch/arm/mach-mx3/Kconfig b/arch/arm/mach-mx3/Kconfig
index ffdd211e3535..0177b8a5fe3a 100644
--- a/arch/arm/mach-mx3/Kconfig
+++ b/arch/arm/mach-mx3/Kconfig
@@ -63,6 +63,7 @@ config MACH_MX31_3DS
63config MACH_MX31MOBOARD 63config MACH_MX31MOBOARD
64 bool "Support mx31moboard platforms (EPFL Mobots group)" 64 bool "Support mx31moboard platforms (EPFL Mobots group)"
65 select ARCH_MX31 65 select ARCH_MX31
66 select MXC_ULPI
66 help 67 help
67 Include support for mx31moboard platform. This includes specific 68 Include support for mx31moboard platform. This includes specific
68 configurations for the board and its peripherals. 69 configurations for the board and its peripherals.
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}
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}
diff --git a/arch/arm/mach-mx3/mx31moboard.c b/arch/arm/mach-mx3/mx31moboard.c
index 2c9ea5f61816..1ec679a3c72f 100644
--- a/arch/arm/mach-mx3/mx31moboard.c
+++ b/arch/arm/mach-mx3/mx31moboard.c
@@ -32,6 +32,9 @@
32#include <linux/spi/spi.h> 32#include <linux/spi/spi.h>
33#include <linux/types.h> 33#include <linux/types.h>
34 34
35#include <linux/usb/otg.h>
36#include <linux/usb/ulpi.h>
37
35#include <asm/mach-types.h> 38#include <asm/mach-types.h>
36#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
37#include <asm/mach/time.h> 40#include <asm/mach/time.h>
@@ -44,8 +47,10 @@
44#include <mach/ipu.h> 47#include <mach/ipu.h>
45#include <mach/i2c.h> 48#include <mach/i2c.h>
46#include <mach/mmc.h> 49#include <mach/mmc.h>
50#include <mach/mxc_ehci.h>
47#include <mach/mx3_camera.h> 51#include <mach/mx3_camera.h>
48#include <mach/spi.h> 52#include <mach/spi.h>
53#include <mach/ulpi.h>
49 54
50#include "devices.h" 55#include "devices.h"
51 56
@@ -79,6 +84,15 @@ static unsigned int moboard_pins[] = {
79 MX31_PIN_USBOTG_CLK__USBOTG_CLK, MX31_PIN_USBOTG_DIR__USBOTG_DIR, 84 MX31_PIN_USBOTG_CLK__USBOTG_CLK, MX31_PIN_USBOTG_DIR__USBOTG_DIR,
80 MX31_PIN_USBOTG_NXT__USBOTG_NXT, MX31_PIN_USBOTG_STP__USBOTG_STP, 85 MX31_PIN_USBOTG_NXT__USBOTG_NXT, MX31_PIN_USBOTG_STP__USBOTG_STP,
81 MX31_PIN_USB_OC__GPIO1_30, 86 MX31_PIN_USB_OC__GPIO1_30,
87 /* USB H2 */
88 MX31_PIN_USBH2_DATA0__USBH2_DATA0,
89 MX31_PIN_USBH2_DATA1__USBH2_DATA1,
90 MX31_PIN_STXD3__USBH2_DATA2, MX31_PIN_SRXD3__USBH2_DATA3,
91 MX31_PIN_SCK3__USBH2_DATA4, MX31_PIN_SFS3__USBH2_DATA5,
92 MX31_PIN_STXD6__USBH2_DATA6, MX31_PIN_SRXD6__USBH2_DATA7,
93 MX31_PIN_USBH2_CLK__USBH2_CLK, MX31_PIN_USBH2_DIR__USBH2_DIR,
94 MX31_PIN_USBH2_NXT__USBH2_NXT, MX31_PIN_USBH2_STP__USBH2_STP,
95 MX31_PIN_SCK6__GPIO1_25,
82 /* LEDs */ 96 /* LEDs */
83 MX31_PIN_SVEN0__GPIO2_0, MX31_PIN_STX0__GPIO2_1, 97 MX31_PIN_SVEN0__GPIO2_0, MX31_PIN_STX0__GPIO2_1,
84 MX31_PIN_SRX0__GPIO2_2, MX31_PIN_SIMPD0__GPIO2_3, 98 MX31_PIN_SRX0__GPIO2_2, MX31_PIN_SIMPD0__GPIO2_3,
@@ -332,6 +346,56 @@ static struct fsl_usb2_platform_data usb_pdata = {
332 .phy_mode = FSL_USB2_PHY_ULPI, 346 .phy_mode = FSL_USB2_PHY_ULPI,
333}; 347};
334 348
349#define USBH2_EN_B IOMUX_TO_GPIO(MX31_PIN_SCK6)
350
351static int moboard_usbh2_hw_init(struct platform_device *pdev)
352{
353 int ret = gpio_request(USBH2_EN_B, "usbh2-en");
354 if (ret)
355 return ret;
356
357 mxc_iomux_set_gpr(MUX_PGP_UH2, true);
358
359 mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG);
360 mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG);
361 mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG);
362 mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG);
363 mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG);
364 mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG);
365 mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG);
366 mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG);
367 mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG);
368 mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG);
369 mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG);
370 mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG);
371
372 gpio_direction_output(USBH2_EN_B, 0);
373
374 return 0;
375}
376
377static int moboard_usbh2_hw_exit(struct platform_device *pdev)
378{
379 gpio_free(USBH2_EN_B);
380 return 0;
381}
382
383static struct mxc_usbh_platform_data usbh2_pdata = {
384 .init = moboard_usbh2_hw_init,
385 .exit = moboard_usbh2_hw_exit,
386 .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
387 .flags = MXC_EHCI_POWER_PINS_ENABLED,
388};
389
390static int __init moboard_usbh2_init(void)
391{
392 usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
393 USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
394
395 return mxc_register_device(&mx31_usbh2, &usbh2_pdata);
396}
397
398
335static struct gpio_led mx31moboard_leds[] = { 399static struct gpio_led mx31moboard_leds[] = {
336 { 400 {
337 .name = "coreboard-led-0:red:running", 401 .name = "coreboard-led-0:red:running",
@@ -472,6 +536,7 @@ static void __init mxc_board_init(void)
472 536
473 moboard_usbotg_init(); 537 moboard_usbotg_init();
474 mxc_register_device(&mxc_otg_udc_device, &usb_pdata); 538 mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
539 moboard_usbh2_init();
475 540
476 switch (mx31moboard_baseboard) { 541 switch (mx31moboard_baseboard) {
477 case MX31NOBOARD: 542 case MX31NOBOARD: