From: Marek Vasut Date: Wed, 10 Mar 2010 04:24:27 +0000 (+0100) Subject: [ARM] pxa/vpac270: UDC and UHC support X-Git-Tag: v2.6.35-rc1~503^2~1^2~2^2~20 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=3d98f8816adafce2933599902fd9a5c0ccedd822;p=~shefty%2Frdma-dev.git [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 Reviewed-by: Robert Jarzmik Signed-off-by: Eric Miao --- diff --git a/arch/arm/mach-pxa/include/mach/vpac270.h b/arch/arm/mach-pxa/include/mach/vpac270.h index a77e310bcca..9f7b460d99c 100644 --- a/arch/arm/mach-pxa/include/mach/vpac270.h +++ b/arch/arm/mach-pxa/include/mach/vpac270.h @@ -31,4 +31,5 @@ #define GPIO12_VPAC270_CF_RDY 12 #define GPIO16_VPAC270_CF_RESET 16 +#define GPIO41_VPAC270_UDC_DETECT 41 #endif diff --git a/arch/arm/mach-pxa/vpac270.c b/arch/arm/mach-pxa/vpac270.c index f1b073707f0..b2bef615b39 100644 --- a/arch/arm/mach-pxa/vpac270.c +++ b/arch/arm/mach-pxa/vpac270.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -28,6 +29,9 @@ #include #include #include +#include +#include +#include #include "generic.h" #include "devices.h" @@ -105,6 +109,14 @@ static unsigned long vpac270_pin_config[] __initdata = { GPIO12_GPIO, /* CF RDY */ GPIO16_GPIO, /* CF RESET */ + /* UHC */ + GPIO88_USBH1_PWR, + GPIO89_USBH1_PEN, + GPIO119_USBH2_PWR, + GPIO120_USBH2_PEN, + + /* UDC */ + GPIO41_GPIO, }; /****************************************************************************** @@ -232,6 +244,70 @@ static void __init vpac270_leds_init(void) static inline void vpac270_leds_init(void) {} #endif +/****************************************************************************** + * USB Host + ******************************************************************************/ +#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) +static int vpac270_ohci_init(struct device *dev) +{ + UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE; + return 0; +} + +static struct pxaohci_platform_data vpac270_ohci_info = { + .port_mode = PMM_PERPORT_MODE, + .flags = ENABLE_PORT1 | ENABLE_PORT2 | + POWER_CONTROL_LOW | POWER_SENSE_LOW, + .init = vpac270_ohci_init, +}; + +static void __init vpac270_uhc_init(void) +{ + pxa_set_ohci_info(&vpac270_ohci_info); +} +#else +static inline void vpac270_uhc_init(void) {} +#endif + +/****************************************************************************** + * USB Gadget + ******************************************************************************/ +#if defined(CONFIG_USB_GADGET_PXA27X)||defined(CONFIG_USB_GADGET_PXA27X_MODULE) +static struct gpio_vbus_mach_info vpac270_gpio_vbus_info = { + .gpio_vbus = GPIO41_VPAC270_UDC_DETECT, + .gpio_pullup = -1, +}; + +static struct platform_device vpac270_gpio_vbus = { + .name = "gpio-vbus", + .id = -1, + .dev = { + .platform_data = &vpac270_gpio_vbus_info, + }, +}; + +static void vpac270_udc_command(int cmd) +{ + if (cmd == PXA2XX_UDC_CMD_CONNECT) + UP2OCR |= UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE; + else if (cmd == PXA2XX_UDC_CMD_DISCONNECT) + UP2OCR &= ~(UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE); +} + +static struct pxa2xx_udc_mach_info vpac270_udc_info __initdata = { + .udc_command = vpac270_udc_command, + .gpio_pullup = -1, +}; + +static void __init vpac270_udc_init(void) +{ + pxa_set_udc_info(&vpac270_udc_info); + platform_device_register(&vpac270_gpio_vbus); +} +#else +static inline void vpac270_udc_init(void) {} +#endif + /****************************************************************************** * Framebuffer ******************************************************************************/ @@ -312,6 +388,8 @@ static void __init vpac270_init(void) vpac270_nor_init(); vpac270_leds_init(); vpac270_keys_init(); + vpac270_uhc_init(); + vpac270_udc_init(); } MACHINE_START(VPAC270, "Voipac PXA270")