2977c5b5221818e4efc525aeedb98cf97c2765d6
[openwrt.git] / target / linux / omap24xx / patches-3.1 / 850-musb-tusb-modular-fixes.patch
1 Index: linux-3.1/drivers/usb/musb/tusb6010.c
2 ===================================================================
3 --- linux-3.1.orig/drivers/usb/musb/tusb6010.c  2011-10-30 00:48:24.637060127 +0200
4 +++ linux-3.1/drivers/usb/musb/tusb6010.c       2011-10-30 00:48:58.045037045 +0200
5 @@ -56,6 +56,7 @@ u8 tusb_get_revision(struct musb *musb)
6  
7         return rev;
8  }
9 +EXPORT_SYMBOL(tusb_get_revision);
10  
11  static int tusb_print_revision(struct musb *musb)
12  {
13 @@ -220,6 +221,7 @@ void musb_write_fifo(struct musb_hw_ep *
14         if (len > 0)
15                 tusb_fifo_write_unaligned(fifo, buf, len);
16  }
17 +EXPORT_SYMBOL(musb_write_fifo);
18  
19  void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *buf)
20  {
21 @@ -267,6 +269,7 @@ void musb_read_fifo(struct musb_hw_ep *h
22         if (len > 0)
23                 tusb_fifo_read_unaligned(fifo, buf, len);
24  }
25 +EXPORT_SYMBOL(musb_read_fifo);
26  
27  static struct musb *the_musb;
28  
29 @@ -1244,18 +1247,18 @@ static struct platform_driver tusb_drive
30         },
31  };
32  
33 -MODULE_DESCRIPTION("TUSB6010 MUSB Glue Layer");
34 -MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
35 -MODULE_LICENSE("GPL v2");
36 +//MODULE_DESCRIPTION("TUSB6010 MUSB Glue Layer");
37 +//MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
38 +//MODULE_LICENSE("GPL v2");
39  
40 -static int __init tusb_init(void)
41 +int musb_hdrc_glue_init(void)
42  {
43         return platform_driver_probe(&tusb_driver, tusb_probe);
44  }
45 -subsys_initcall(tusb_init);
46 +EXPORT_SYMBOL(musb_hdrc_glue_init);
47  
48 -static void __exit tusb_exit(void)
49 +void musb_hdrc_glue_exit(void)
50  {
51         platform_driver_unregister(&tusb_driver);
52  }
53 -module_exit(tusb_exit);
54 +EXPORT_SYMBOL(musb_hdrc_glue_exit);
55 Index: linux-3.1/drivers/usb/musb/musb_core.c
56 ===================================================================
57 --- linux-3.1.orig/drivers/usb/musb/musb_core.c 2011-10-30 00:48:24.629060132 +0200
58 +++ linux-3.1/drivers/usb/musb/musb_core.c      2011-10-30 00:48:58.045037045 +0200
59 @@ -207,7 +207,7 @@ static struct otg_io_access_ops musb_ulp
60  
61  /*-------------------------------------------------------------------------*/
62  
63 -#if !defined(CONFIG_USB_MUSB_TUSB6010) && !defined(CONFIG_USB_MUSB_BLACKFIN)
64 +#if !defined(CONFIG_USB_MUSB_TUSB6010) && !defined(CONFIG_USB_MUSB_TUSB6010_MODULE) && !defined(CONFIG_USB_MUSB_BLACKFIN)
65  
66  /*
67   * Load an endpoint's FIFO
68 @@ -250,7 +250,7 @@ void musb_write_fifo(struct musb_hw_ep *
69         }
70  }
71  
72 -#if !defined(CONFIG_USB_MUSB_AM35X)
73 +#if !defined(CONFIG_USB_MUSB_AM35X) && !defined(CONFIG_USB_MUSB_TUSB6010) && !defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
74  /*
75   * Unload an endpoint's FIFO
76   */
77 @@ -1432,7 +1432,7 @@ static int __init musb_core_init(u16 mus
78                 struct musb_hw_ep       *hw_ep = musb->endpoints + i;
79  
80                 hw_ep->fifo = MUSB_FIFO_OFFSET(i) + mbase;
81 -#ifdef CONFIG_USB_MUSB_TUSB6010
82 +#if defined(CONFIG_USB_MUSB_TUSB6010) || defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
83                 hw_ep->fifo_async = musb->async + 0x400 + MUSB_FIFO_OFFSET(i);
84                 hw_ep->fifo_sync = musb->sync + 0x400 + MUSB_FIFO_OFFSET(i);
85                 hw_ep->fifo_sync_va =
86 @@ -2376,8 +2376,13 @@ static struct platform_driver musb_drive
87  
88  /*-------------------------------------------------------------------------*/
89  
90 +extern int musb_hdrc_glue_init(void);
91 +extern void musb_hdrc_glue_exit(void);
92 +
93  static int __init musb_init(void)
94  {
95 +       int err;
96 +
97         if (usb_disabled())
98                 return 0;
99  
100 @@ -2386,7 +2391,17 @@ static int __init musb_init(void)
101                 ", "
102                 "otg (peripheral+host)",
103                 musb_driver_name);
104 -       return platform_driver_probe(&musb_driver, musb_probe);
105 +
106 +       err = musb_hdrc_glue_init();
107 +       if (err)
108 +               return err;
109 +       err = platform_driver_probe(&musb_driver, musb_probe);
110 +       if (err) {
111 +               musb_hdrc_glue_exit();
112 +               return err;
113 +       }
114 +
115 +       return 0;
116  }
117  
118  /* make us init after usbcore and i2c (transceivers, regulators, etc)
119 @@ -2397,5 +2412,6 @@ fs_initcall(musb_init);
120  static void __exit musb_cleanup(void)
121  {
122         platform_driver_unregister(&musb_driver);
123 +       musb_hdrc_glue_exit();
124  }
125  module_exit(musb_cleanup);
126 Index: linux-3.1/drivers/usb/Makefile
127 ===================================================================
128 --- linux-3.1.orig/drivers/usb/Makefile 2011-10-30 00:48:24.625060136 +0200
129 +++ linux-3.1/drivers/usb/Makefile      2011-10-30 00:48:58.045037045 +0200
130 @@ -47,7 +47,7 @@ obj-$(CONFIG_EARLY_PRINTK_DBGP)       += early
131  obj-$(CONFIG_USB_ATM)          += atm/
132  obj-$(CONFIG_USB_SPEEDTOUCH)   += atm/
133  
134 -obj-$(CONFIG_USB_MUSB_HDRC)    += musb/
135 +obj-y                          += musb/
136  obj-$(CONFIG_USB_RENESAS_USBHS)        += renesas_usbhs/
137  obj-$(CONFIG_USB_OTG_UTILS)    += otg/
138  obj-$(CONFIG_USB_GADGET)       += gadget/
139 Index: linux-3.1/drivers/usb/musb/Makefile
140 ===================================================================
141 --- linux-3.1.orig/drivers/usb/musb/Makefile    2011-10-30 00:48:24.645060124 +0200
142 +++ linux-3.1/drivers/usb/musb/Makefile 2011-10-30 00:48:58.045037045 +0200
143 @@ -13,7 +13,7 @@ musb_hdrc-$(CONFIG_DEBUG_FS)                  += musb_d
144  # Hardware Glue Layer
145  obj-$(CONFIG_USB_MUSB_OMAP2PLUS)               += omap2430.o
146  obj-$(CONFIG_USB_MUSB_AM35X)                   += am35x.o
147 -obj-$(CONFIG_USB_MUSB_TUSB6010)                        += tusb6010.o
148 +musb_hdrc-$(subst m,y,$(CONFIG_USB_MUSB_TUSB6010))     += tusb6010.o
149  obj-$(CONFIG_USB_MUSB_DAVINCI)                 += davinci.o
150  obj-$(CONFIG_USB_MUSB_DA8XX)                   += da8xx.o
151  obj-$(CONFIG_USB_MUSB_BLACKFIN)                        += blackfin.o