summaryrefslogtreecommitdiffstats
path: root/target/linux/omap24xx/patches-3.3/850-musb-tusb-modular-fixes.patch
blob: 55a25a4aebdc951a409a87a0c42c909012997487 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -221,6 +221,7 @@ void musb_write_fifo(struct musb_hw_ep *
 	if (len > 0)
 		tusb_fifo_write_unaligned(fifo, buf, len);
 }
+EXPORT_SYMBOL(musb_write_fifo);
 
 void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *buf)
 {
@@ -268,6 +269,7 @@ void musb_read_fifo(struct musb_hw_ep *h
 	if (len > 0)
 		tusb_fifo_read_unaligned(fifo, buf, len);
 }
+EXPORT_SYMBOL(musb_read_fifo);
 
 static struct musb *the_musb;
 
@@ -1165,7 +1167,7 @@ static const struct musb_platform_ops tu
 
 static u64 tusb_dmamask = DMA_BIT_MASK(32);
 
-static int __init tusb_probe(struct platform_device *pdev)
+static int tusb_probe(struct platform_device *pdev)
 {
 	struct musb_hdrc_platform_data	*pdata = pdev->dev.platform_data;
 	struct platform_device		*musb;
@@ -1245,18 +1247,18 @@ static struct platform_driver tusb_drive
 	},
 };
 
-MODULE_DESCRIPTION("TUSB6010 MUSB Glue Layer");
-MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
-MODULE_LICENSE("GPL v2");
+//MODULE_DESCRIPTION("TUSB6010 MUSB Glue Layer");
+//MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
+//MODULE_LICENSE("GPL v2");
 
-static int __init tusb_init(void)
+int musb_hdrc_glue_init(void)
 {
 	return platform_driver_probe(&tusb_driver, tusb_probe);
 }
-subsys_initcall(tusb_init);
+EXPORT_SYMBOL(musb_hdrc_glue_init);
 
-static void __exit tusb_exit(void)
+void musb_hdrc_glue_exit(void)
 {
 	platform_driver_unregister(&tusb_driver);
 }
-module_exit(tusb_exit);
+EXPORT_SYMBOL(musb_hdrc_glue_exit);
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -207,7 +207,7 @@ static struct otg_io_access_ops musb_ulp
 
 /*-------------------------------------------------------------------------*/
 
-#if !defined(CONFIG_USB_MUSB_TUSB6010) && !defined(CONFIG_USB_MUSB_BLACKFIN)
+#if !defined(CONFIG_USB_MUSB_TUSB6010) && !defined(CONFIG_USB_MUSB_TUSB6010_MODULE) && !defined(CONFIG_USB_MUSB_BLACKFIN)
 
 /*
  * Load an endpoint's FIFO
@@ -250,7 +250,7 @@ void musb_write_fifo(struct musb_hw_ep *
 	}
 }
 
-#if !defined(CONFIG_USB_MUSB_AM35X)
+#if !defined(CONFIG_USB_MUSB_AM35X) && !defined(CONFIG_USB_MUSB_TUSB6010) && !defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
 /*
  * Unload an endpoint's FIFO
  */
@@ -2370,8 +2370,13 @@ static struct platform_driver musb_drive
 
 /*-------------------------------------------------------------------------*/
 
+extern int musb_hdrc_glue_init(void);
+extern void musb_hdrc_glue_exit(void);
+
 static int __init musb_init(void)
 {
+	int err;
+
 	if (usb_disabled())
 		return 0;
 
@@ -2380,7 +2385,17 @@ static int __init musb_init(void)
 		", "
 		"otg (peripheral+host)",
 		musb_driver_name);
-	return platform_driver_probe(&musb_driver, musb_probe);
+
+	err = musb_hdrc_glue_init();
+	if (err)
+		return err;
+	err = platform_driver_probe(&musb_driver, musb_probe);
+	if (err) {
+		musb_hdrc_glue_exit();
+		return err;
+	}
+
+	return 0;
 }
 
 /* make us init after usbcore and i2c (transceivers, regulators, etc)
@@ -2391,5 +2406,6 @@ fs_initcall(musb_init);
 static void __exit musb_cleanup(void)
 {
 	platform_driver_unregister(&musb_driver);
+	musb_hdrc_glue_exit();
 }
 module_exit(musb_cleanup);
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -51,7 +51,7 @@ obj-$(CONFIG_EARLY_PRINTK_DBGP)	+= early
 obj-$(CONFIG_USB_ATM)		+= atm/
 obj-$(CONFIG_USB_SPEEDTOUCH)	+= atm/
 
-obj-$(CONFIG_USB_MUSB_HDRC)	+= musb/
+obj-y				+= musb/
 obj-$(CONFIG_USB_RENESAS_USBHS)	+= renesas_usbhs/
 obj-$(CONFIG_USB_GADGET)	+= gadget/
 
--- a/drivers/usb/musb/Makefile
+++ b/drivers/usb/musb/Makefile
@@ -13,7 +13,7 @@ musb_hdrc-$(CONFIG_DEBUG_FS)			+= musb_d
 # Hardware Glue Layer
 obj-$(CONFIG_USB_MUSB_OMAP2PLUS)		+= omap2430.o
 obj-$(CONFIG_USB_MUSB_AM35X)			+= am35x.o
-obj-$(CONFIG_USB_MUSB_TUSB6010)			+= tusb6010.o
+musb_hdrc-$(subst m,y,$(CONFIG_USB_MUSB_TUSB6010))	+= tusb6010.o
 obj-$(CONFIG_USB_MUSB_DAVINCI)			+= davinci.o
 obj-$(CONFIG_USB_MUSB_DA8XX)			+= da8xx.o
 obj-$(CONFIG_USB_MUSB_BLACKFIN)			+= blackfin.o