omap24xx: Fix modular compilation of MUSB
[openwrt.git] / target / linux / omap24xx / patches-2.6.38 / 850-musb-tusb-modular-fixes.patch
1 Index: linux-2.6.38-rc7/drivers/Makefile
2 ===================================================================
3 --- linux-2.6.38-rc7.orig/drivers/Makefile      2011-03-06 18:50:23.464476877 +0100
4 +++ linux-2.6.38-rc7/drivers/Makefile   2011-03-06 18:51:09.485478381 +0100
5 @@ -66,7 +66,7 @@ obj-$(CONFIG_TC)              += tc/
6  obj-$(CONFIG_UWB)              += uwb/
7  obj-$(CONFIG_USB_OTG_UTILS)    += usb/otg/
8  obj-$(CONFIG_USB)              += usb/
9 -obj-$(CONFIG_USB_MUSB_HDRC)    += usb/musb/
10 +obj-y                          += usb/musb/
11  obj-$(CONFIG_PCI)              += usb/
12  obj-$(CONFIG_USB_GADGET)       += usb/gadget/
13  obj-$(CONFIG_SERIO)            += input/serio/
14 Index: linux-2.6.38-rc7/drivers/usb/musb/Kconfig
15 ===================================================================
16 --- linux-2.6.38-rc7.orig/drivers/usb/musb/Kconfig      2011-03-06 18:50:23.514483397 +0100
17 +++ linux-2.6.38-rc7/drivers/usb/musb/Kconfig   2011-03-06 18:51:09.486478512 +0100
18 @@ -46,7 +46,7 @@ config USB_MUSB_DA8XX
19         depends on ARCH_DAVINCI_DA8XX
20  
21  config USB_MUSB_TUSB6010
22 -       bool "TUSB6010"
23 +       tristate "TUSB6010"
24         depends on ARCH_OMAP
25  
26  config USB_MUSB_OMAP2PLUS
27 Index: linux-2.6.38-rc7/drivers/usb/musb/tusb6010.c
28 ===================================================================
29 --- linux-2.6.38-rc7.orig/drivers/usb/musb/tusb6010.c   2011-03-06 18:50:23.497481181 +0100
30 +++ linux-2.6.38-rc7/drivers/usb/musb/tusb6010.c        2011-03-06 18:51:09.487478643 +0100
31 @@ -55,6 +55,7 @@ u8 tusb_get_revision(struct musb *musb)
32  
33         return rev;
34  }
35 +EXPORT_SYMBOL(tusb_get_revision);
36  
37  static int tusb_print_revision(struct musb *musb)
38  {
39 @@ -218,6 +219,7 @@ void musb_write_fifo(struct musb_hw_ep *
40         if (len > 0)
41                 tusb_fifo_write_unaligned(fifo, buf, len);
42  }
43 +EXPORT_SYMBOL(musb_write_fifo);
44  
45  void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *buf)
46  {
47 @@ -264,6 +266,7 @@ void musb_read_fifo(struct musb_hw_ep *h
48         if (len > 0)
49                 tusb_fifo_read_unaligned(fifo, buf, len);
50  }
51 +EXPORT_SYMBOL(musb_read_fifo);
52  
53  static struct musb *the_musb;
54  
55 @@ -1259,18 +1262,16 @@ static struct platform_driver tusb_drive
56         },
57  };
58  
59 -MODULE_DESCRIPTION("TUSB6010 MUSB Glue Layer");
60 -MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
61 -MODULE_LICENSE("GPL v2");
62 +//MODULE_DESCRIPTION("TUSB6010 MUSB Glue Layer");
63 +//MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
64 +//MODULE_LICENSE("GPL v2");
65  
66 -static int __init tusb_init(void)
67 +int musb_hdrc_glue_init(void)
68  {
69         return platform_driver_probe(&tusb_driver, tusb_probe);
70  }
71 -subsys_initcall(tusb_init);
72  
73 -static void __exit tusb_exit(void)
74 +void musb_hdrc_glue_exit(void)
75  {
76         platform_driver_unregister(&tusb_driver);
77  }
78 -module_exit(tusb_exit);
79 Index: linux-2.6.38-rc7/drivers/usb/musb/Makefile
80 ===================================================================
81 --- linux-2.6.38-rc7.orig/drivers/usb/musb/Makefile     2011-03-06 18:50:23.481479093 +0100
82 +++ linux-2.6.38-rc7/drivers/usb/musb/Makefile  2011-03-06 18:51:09.487478643 +0100
83 @@ -13,13 +13,13 @@ musb_hdrc-$(CONFIG_USB_MUSB_HDRC_HCD)               +
84  musb_hdrc-$(CONFIG_DEBUG_FS)                   += musb_debugfs.o
85  
86  # Hardware Glue Layer
87 -obj-$(CONFIG_USB_MUSB_OMAP2PLUS)               += omap2430.o
88 -obj-$(CONFIG_USB_MUSB_AM35X)                   += am35x.o
89 -obj-$(CONFIG_USB_MUSB_TUSB6010)                        += tusb6010.o
90 -obj-$(CONFIG_USB_MUSB_DAVINCI)                 += davinci.o
91 -obj-$(CONFIG_USB_MUSB_DA8XX)                   += da8xx.o
92 -obj-$(CONFIG_USB_MUSB_BLACKFIN)                        += blackfin.o
93 -obj-$(CONFIG_USB_MUSB_UX500)                   += ux500.o
94 +musb_hdrc-$(CONFIG_USB_MUSB_OMAP2PLUS)         += omap2430.o
95 +musb_hdrc-$(CONFIG_USB_MUSB_AM35X)             += am35x.o
96 +musb_hdrc-$(CONFIG_USB_MUSB_TUSB6010)          += tusb6010.o
97 +musb_hdrc-$(CONFIG_USB_MUSB_DAVINCI)           += davinci.o
98 +musb_hdrc-$(CONFIG_USB_MUSB_DA8XX)             += da8xx.o
99 +musb_hdrc-$(CONFIG_USB_MUSB_BLACKFIN)          += blackfin.o
100 +musb_hdrc-$(CONFIG_USB_MUSB_UX500)             += ux500.o
101  
102  # the kconfig must guarantee that only one of the
103  # possible I/O schemes will be enabled at a time ...
104 Index: linux-2.6.38-rc7/drivers/usb/musb/musb_core.c
105 ===================================================================
106 --- linux-2.6.38-rc7.orig/drivers/usb/musb/musb_core.c  2011-03-06 18:50:23.538486528 +0100
107 +++ linux-2.6.38-rc7/drivers/usb/musb/musb_core.c       2011-03-06 18:51:09.489478904 +0100
108 @@ -2427,8 +2427,13 @@ static struct platform_driver musb_drive
109  
110  /*-------------------------------------------------------------------------*/
111  
112 +extern int musb_hdrc_glue_init(void);
113 +extern void musb_hdrc_glue_exit(void);
114 +
115  static int __init musb_init(void)
116  {
117 +       int err;
118 +
119  #ifdef CONFIG_USB_MUSB_HDRC_HCD
120         if (usb_disabled())
121                 return 0;
122 @@ -2456,7 +2461,17 @@ static int __init musb_init(void)
123  #endif
124                 ", debug=%d\n",
125                 musb_driver_name, musb_debug);
126 -       return platform_driver_probe(&musb_driver, musb_probe);
127 +
128 +       err = musb_hdrc_glue_init();
129 +       if (err)
130 +               return err;
131 +       err = platform_driver_probe(&musb_driver, musb_probe);
132 +       if (err) {
133 +               musb_hdrc_glue_exit();
134 +               return err;
135 +       }
136 +
137 +       return 0;
138  }
139  
140  /* make us init after usbcore and i2c (transceivers, regulators, etc)
141 @@ -2467,5 +2482,6 @@ fs_initcall(musb_init);
142  static void __exit musb_cleanup(void)
143  {
144         platform_driver_unregister(&musb_driver);
145 +       musb_hdrc_glue_exit();
146  }
147  module_exit(musb_cleanup);