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