hh.org updates
[hh.org.git] / arch / arm / mach-pxa / h4000 / h4000_udc.c
bloba99a559b3df34d4047af9074b64807605955b36d
1 /*
2 * h4000_udc.c:
3 * h4000 specific code for the pxa255 usb device controller.
4 *
5 * */
7 #include <linux/module.h>
8 #include <linux/init.h>
9 #include <linux/platform_device.h>
10 #include <asm/arch/hardware.h>
11 #include <asm/arch/pxa-regs.h>
12 #include <asm/arch/udc.h>
13 #include <linux/soc/asic3_base.h>
14 #include <asm/arch/h4000-gpio.h>
15 #include <asm/arch/h4000-asic.h>
17 extern struct platform_device h4000_asic3;
19 static void h4000_udc_command(int cmd)
21 switch (cmd) {
22 case PXA2XX_UDC_CMD_DISCONNECT:
23 asic3_set_gpio_out_d(&h4000_asic3.dev,
24 GPIOD_USB_PULLUP, 0);
25 break;
26 case PXA2XX_UDC_CMD_CONNECT:
27 asic3_set_gpio_out_d(&h4000_asic3.dev,
28 GPIOD_USB_PULLUP, GPIOD_USB_PULLUP);
29 break;
30 default:
31 printk("_udc_control: unknown command!\n");
32 break;
36 static int h4000_udc_is_connected(void)
38 return (!(GET_H4000_GPIO(USB_DETECT_N)));
41 static struct pxa2xx_udc_mach_info h4000_udc_info __initdata = {
42 .udc_is_connected = h4000_udc_is_connected,
43 .udc_command = h4000_udc_command,
46 static int h4000_udc_probe(struct platform_device * dev)
48 pxa_set_udc_info(&h4000_udc_info);
49 return 0;
52 static struct platform_driver h4000_udc_driver = {
53 .driver = {
54 .name = "h4000_udc",
56 .probe = h4000_udc_probe,
59 static int __init h4000_udc_init(void)
61 return platform_driver_register(&h4000_udc_driver);
64 module_init(h4000_udc_init);
65 MODULE_LICENSE("GPL");