e0017934fc857d1ce39577daf282983e585db078
[openwrt.git] / target / linux / pxa / patches-2.6.21 / 019-modular-init-usb-gadget.patch
1 --- a/drivers/usb/gadget/Kconfig
2 +++ b/drivers/usb/gadget/Kconfig
3 @@ -56,6 +56,14 @@ config USB_GADGET_DEBUG_FILES
4  config USB_GADGET_SELECTED
5         boolean
6  
7 +config USB_GADGET_GUMSTIX
8 +       tristate
9 +       default m if USB_GADGET=m
10 +       default y if USB_GADGET=y
11 +       depends on USB_GADGET && ARCH_GUMSTIX
12 +       help
13 +         USB Gadget support for the Gumstix platform
14 +
15  #
16  # USB Peripheral Controller Support
17  #
18 --- a/drivers/usb/gadget/Makefile
19 +++ b/drivers/usb/gadget/Makefile
20 @@ -8,6 +8,7 @@ obj-$(CONFIG_USB_GOKU)          += goku_udc.o
21  obj-$(CONFIG_USB_OMAP)         += omap_udc.o
22  obj-$(CONFIG_USB_LH7A40X)      += lh7a40x_udc.o
23  obj-$(CONFIG_USB_AT91)         += at91_udc.o
24 +obj-$(CONFIG_USB_GADGET_GUMSTIX)       += gumstix_gadget.o
25  
26  #
27  # USB gadget drivers
28 --- a/drivers/usb/gadget/pxa2xx_udc.c
29 +++ b/drivers/usb/gadget/pxa2xx_udc.c
30 @@ -2752,8 +2752,16 @@ static struct platform_driver udc_driver
31         },
32  };
33  
34 +#ifdef CONFIG_ARCH_GUMSTIX
35 +extern void gumstix_usb_gadget_load(void);
36 +#endif
37 +
38  static int __init udc_init(void)
39  {
40 +#ifdef CONFIG_ARCH_GUMSTIX
41 +       gumstix_usb_gadget_load();
42 +#endif
43 +
44         printk(KERN_INFO "%s: version %s\n", driver_name, DRIVER_VERSION);
45         return platform_driver_register(&udc_driver);
46  }
47 --- /dev/null
48 +++ b/drivers/usb/gadget/gumstix_gadget.c
49 @@ -0,0 +1,49 @@
50 +/*
51 + *  Gumstix USB gadget intialization driver
52 + *
53 + *  Author:     Craig Hughes
54 + *  Created:    December 9, 2004
55 + *  Copyright:  (C) 2004 Craig Hughes
56 + *
57 + * This program is free software; you can redistribute it and/or modify
58 + * it under the terms of the GNU General Public License as published by
59 + * the Free Software Foundation; either version 2 of the License, or
60 + * (at your option) any later version.
61 + *
62 + */
63 +
64 +#include <linux/module.h>
65 +
66 +#include <asm/hardware.h>
67 +#include <asm/arch/pxa-regs.h>
68 +#include <asm/delay.h>
69 +#include <asm/irq.h>
70 +#include <asm/mach/irq.h>
71 +
72 +#include <asm/arch/gumstix.h>
73 +#include <asm/arch/udc.h>
74 +
75 +int __init gumstix_usb_gadget_init(void)
76 +{
77 +       pxa_gpio_mode(GPIO_GUMSTIX_USB_GPIOx_DIS_MD);
78 +       pxa_gpio_mode(GPIO_GUMSTIX_USB_GPIOn_MD);
79 +
80 +       set_irq_type(GUMSTIX_USB_INTR_IRQ, IRQT_BOTHEDGE);
81 +       
82 +       return 0;
83 +}
84 +
85 +void __exit gumstix_usb_gadget_exit(void)
86 +{
87 +}
88 +
89 +void gumstix_usb_gadget_load(void) {}
90 +EXPORT_SYMBOL(gumstix_usb_gadget_load);
91 +
92 +module_init(gumstix_usb_gadget_init);
93 +module_exit(gumstix_usb_gadget_exit);
94 +
95 +MODULE_LICENSE("GPL");
96 +MODULE_AUTHOR("Craig Hughes <craig@gumstix.com>");
97 +MODULE_DESCRIPTION("Gumstix board USB gadget initialization driver");
98 +MODULE_VERSION("1:0.1");