diff options
author | Marek Vasut <marek.vasut@gmail.com> | 2010-03-09 23:24:27 -0500 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2010-05-11 11:25:03 -0400 |
commit | 3d98f8816adafce2933599902fd9a5c0ccedd822 (patch) | |
tree | 3652211e024eec86cabed8d52e1b3a6256da1b73 /arch/arm/mach-pxa/vpac270.c | |
parent | addff0faecfc5e73e8a742687255cef847e260db (diff) |
[ARM] pxa/vpac270: UDC and UHC support
NOTE:
I wasn't able to get it running without reseting the HXOE (so it's there based
on my tests with the hardware). I'll have to investigate it properly when I have
more time.
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Reviewed-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'arch/arm/mach-pxa/vpac270.c')
-rw-r--r-- | arch/arm/mach-pxa/vpac270.c | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/vpac270.c b/arch/arm/mach-pxa/vpac270.c index f1b073707f03..b2bef615b390 100644 --- a/arch/arm/mach-pxa/vpac270.c +++ b/arch/arm/mach-pxa/vpac270.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/input.h> | 17 | #include <linux/input.h> |
18 | #include <linux/gpio.h> | 18 | #include <linux/gpio.h> |
19 | #include <linux/sysdev.h> | 19 | #include <linux/sysdev.h> |
20 | #include <linux/usb/gpio_vbus.h> | ||
20 | #include <linux/mtd/mtd.h> | 21 | #include <linux/mtd/mtd.h> |
21 | #include <linux/mtd/partitions.h> | 22 | #include <linux/mtd/partitions.h> |
22 | #include <linux/mtd/physmap.h> | 23 | #include <linux/mtd/physmap.h> |
@@ -28,6 +29,9 @@ | |||
28 | #include <mach/vpac270.h> | 29 | #include <mach/vpac270.h> |
29 | #include <mach/mmc.h> | 30 | #include <mach/mmc.h> |
30 | #include <mach/pxafb.h> | 31 | #include <mach/pxafb.h> |
32 | #include <mach/ohci.h> | ||
33 | #include <mach/pxa27x-udc.h> | ||
34 | #include <mach/udc.h> | ||
31 | 35 | ||
32 | #include "generic.h" | 36 | #include "generic.h" |
33 | #include "devices.h" | 37 | #include "devices.h" |
@@ -105,6 +109,14 @@ static unsigned long vpac270_pin_config[] __initdata = { | |||
105 | GPIO12_GPIO, /* CF RDY */ | 109 | GPIO12_GPIO, /* CF RDY */ |
106 | GPIO16_GPIO, /* CF RESET */ | 110 | GPIO16_GPIO, /* CF RESET */ |
107 | 111 | ||
112 | /* UHC */ | ||
113 | GPIO88_USBH1_PWR, | ||
114 | GPIO89_USBH1_PEN, | ||
115 | GPIO119_USBH2_PWR, | ||
116 | GPIO120_USBH2_PEN, | ||
117 | |||
118 | /* UDC */ | ||
119 | GPIO41_GPIO, | ||
108 | }; | 120 | }; |
109 | 121 | ||
110 | /****************************************************************************** | 122 | /****************************************************************************** |
@@ -233,6 +245,70 @@ static inline void vpac270_leds_init(void) {} | |||
233 | #endif | 245 | #endif |
234 | 246 | ||
235 | /****************************************************************************** | 247 | /****************************************************************************** |
248 | * USB Host | ||
249 | ******************************************************************************/ | ||
250 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | ||
251 | static int vpac270_ohci_init(struct device *dev) | ||
252 | { | ||
253 | UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE; | ||
254 | return 0; | ||
255 | } | ||
256 | |||
257 | static struct pxaohci_platform_data vpac270_ohci_info = { | ||
258 | .port_mode = PMM_PERPORT_MODE, | ||
259 | .flags = ENABLE_PORT1 | ENABLE_PORT2 | | ||
260 | POWER_CONTROL_LOW | POWER_SENSE_LOW, | ||
261 | .init = vpac270_ohci_init, | ||
262 | }; | ||
263 | |||
264 | static void __init vpac270_uhc_init(void) | ||
265 | { | ||
266 | pxa_set_ohci_info(&vpac270_ohci_info); | ||
267 | } | ||
268 | #else | ||
269 | static inline void vpac270_uhc_init(void) {} | ||
270 | #endif | ||
271 | |||
272 | /****************************************************************************** | ||
273 | * USB Gadget | ||
274 | ******************************************************************************/ | ||
275 | #if defined(CONFIG_USB_GADGET_PXA27X)||defined(CONFIG_USB_GADGET_PXA27X_MODULE) | ||
276 | static struct gpio_vbus_mach_info vpac270_gpio_vbus_info = { | ||
277 | .gpio_vbus = GPIO41_VPAC270_UDC_DETECT, | ||
278 | .gpio_pullup = -1, | ||
279 | }; | ||
280 | |||
281 | static struct platform_device vpac270_gpio_vbus = { | ||
282 | .name = "gpio-vbus", | ||
283 | .id = -1, | ||
284 | .dev = { | ||
285 | .platform_data = &vpac270_gpio_vbus_info, | ||
286 | }, | ||
287 | }; | ||
288 | |||
289 | static void vpac270_udc_command(int cmd) | ||
290 | { | ||
291 | if (cmd == PXA2XX_UDC_CMD_CONNECT) | ||
292 | UP2OCR |= UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE; | ||
293 | else if (cmd == PXA2XX_UDC_CMD_DISCONNECT) | ||
294 | UP2OCR &= ~(UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE); | ||
295 | } | ||
296 | |||
297 | static struct pxa2xx_udc_mach_info vpac270_udc_info __initdata = { | ||
298 | .udc_command = vpac270_udc_command, | ||
299 | .gpio_pullup = -1, | ||
300 | }; | ||
301 | |||
302 | static void __init vpac270_udc_init(void) | ||
303 | { | ||
304 | pxa_set_udc_info(&vpac270_udc_info); | ||
305 | platform_device_register(&vpac270_gpio_vbus); | ||
306 | } | ||
307 | #else | ||
308 | static inline void vpac270_udc_init(void) {} | ||
309 | #endif | ||
310 | |||
311 | /****************************************************************************** | ||
236 | * Framebuffer | 312 | * Framebuffer |
237 | ******************************************************************************/ | 313 | ******************************************************************************/ |
238 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) | 314 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) |
@@ -312,6 +388,8 @@ static void __init vpac270_init(void) | |||
312 | vpac270_nor_init(); | 388 | vpac270_nor_init(); |
313 | vpac270_leds_init(); | 389 | vpac270_leds_init(); |
314 | vpac270_keys_init(); | 390 | vpac270_keys_init(); |
391 | vpac270_uhc_init(); | ||
392 | vpac270_udc_init(); | ||
315 | } | 393 | } |
316 | 394 | ||
317 | MACHINE_START(VPAC270, "Voipac PXA270") | 395 | MACHINE_START(VPAC270, "Voipac PXA270") |