sync hh.org
[hh.org.git] / arch / arm / mach-pxa / htcbeetles / htcbeetles_udc.c
blob4e2704dd71a0fb2d8812c536509bb1d682e2a684
1 /*
2 * htcbeetles_udc.c:
3 * htcbeetles specific code for the pxa27x usb device controller.
4 *
5 *
6 */
8 #include <linux/module.h>
9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <asm/arch/hardware.h>
12 #include <asm/arch/pxa-regs.h>
13 #include <asm/arch/udc.h>
14 #include <linux/soc/asic3_base.h>
15 #include <asm/arch/htcbeetles-gpio.h>
16 #include <asm/arch/htcbeetles-asic.h>
18 extern struct platform_device htcbeetles_asic3;
20 static void htcbeetles_udc_command(int cmd)
22 switch (cmd) {
23 case PXA2XX_UDC_CMD_DISCONNECT:
24 asic3_set_gpio_out_a(&htcbeetles_asic3.dev,
25 1<<GPIOA_USB_PUEN, 0);
26 break;
27 case PXA2XX_UDC_CMD_CONNECT:
28 asic3_set_gpio_out_a(&htcbeetles_asic3.dev,
29 1<<GPIOA_USB_PUEN, 1<<GPIOA_USB_PUEN);
30 break;
31 default:
32 printk("_udc_control: unknown command!\n");
33 break;
37 static int htcbeetles_udc_is_connected(void)
39 return ((asic3_get_gpio_status_a(&htcbeetles_asic3.dev) & (1<<GPIOB_USB_DETECT)) != 0);
42 static struct pxa2xx_udc_mach_info htcbeetles_udc_info __initdata = {
43 .udc_is_connected = htcbeetles_udc_is_connected,
44 .udc_command = htcbeetles_udc_command,
47 static int htcbeetles_udc_probe(struct device * dev)
49 pxa_set_udc_info(&htcbeetles_udc_info);
50 return 0;
53 static struct device_driver htcbeetles_udc_driver = {
54 .name = "htcbeetles_udc",
55 .bus = &platform_bus_type,
56 .probe = htcbeetles_udc_probe,
59 static int __init htcbeetles_udc_init(void)
61 return driver_register(&htcbeetles_udc_driver);
64 module_init(htcbeetles_udc_init);
65 MODULE_LICENSE("GPL");