hh.org updates
[hh.org.git] / arch / arm / mach-pxa / htcuniversal / htcuniversal_udc.c
blob54e45c57ef8b4ed6893acf1fcfb8ebf03ec634b8
2 /*
4 * htcuniversal_udc.c:
5 * htcuniversal specific code for the pxa27x usb device controller.
6 *
7 * Use consistent with the GNU GPL is permitted.
8 *
9 */
11 #include <linux/module.h>
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <asm/arch/hardware.h>
15 #include <asm/arch/pxa-regs.h>
16 #include <asm/arch/udc.h>
17 #include <linux/soc/asic3_base.h>
18 #include <asm/arch/htcuniversal-gpio.h>
19 #include <asm/arch/htcuniversal-asic.h>
21 static void htcuniversal_udc_command(int cmd)
23 switch (cmd) {
24 case PXA2XX_UDC_CMD_DISCONNECT:
25 asic3_set_gpio_out_b(&htcuniversal_asic3.dev,
26 1<<GPIOB_USB_PUEN, 0);
27 // SET_HTCUNIVERSAL_GPIO(USB_PUEN,0);
28 break;
29 case PXA2XX_UDC_CMD_CONNECT:
30 asic3_set_gpio_out_b(&htcuniversal_asic3.dev,
31 1<<GPIOB_USB_PUEN, 1<<GPIOB_USB_PUEN);
32 // SET_HTCUNIVERSAL_GPIO(USB_PUEN,1);
33 break;
34 default:
35 printk("_udc_control: unknown command!\n");
36 break;
40 static int htcuniversal_udc_is_connected(void)
42 return (GET_HTCUNIVERSAL_GPIO(USB_DET) != 0);
45 static struct pxa2xx_udc_mach_info htcuniversal_udc_info __initdata = {
46 .udc_is_connected = htcuniversal_udc_is_connected,
47 .udc_command = htcuniversal_udc_command,
50 static int htcuniversal_udc_probe(struct platform_device * dev)
52 pxa_set_udc_info(&htcuniversal_udc_info);
53 return 0;
56 static struct platform_driver htcuniversal_udc_driver = {
57 .driver = {
58 .name = "htcuniversal_udc",
60 .probe = htcuniversal_udc_probe,
63 static int __init htcuniversal_udc_init(void)
65 return platform_driver_register(&htcuniversal_udc_driver);
68 module_init(htcuniversal_udc_init);
69 MODULE_LICENSE("GPL");