summaryrefslogtreecommitdiff
path: root/target/linux/omap24xx/patches-2.6.38/590-cbus-tahvo-usb-fixes.patch
blob: 963b09c2244328d0fa5d6219a96456c6bae34a69 (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
Index: linux-2.6.38-rc7/drivers/cbus/tahvo-usb.c
===================================================================
--- linux-2.6.38-rc7.orig/drivers/cbus/tahvo-usb.c	2011-03-06 23:00:14.411191087 +0100
+++ linux-2.6.38-rc7/drivers/cbus/tahvo-usb.c	2011-03-06 23:00:16.571473834 +0100
@@ -98,6 +98,7 @@ struct tahvo_usb {
 #ifdef CONFIG_USB_OTG
 	int tahvo_mode;
 #endif
+	struct clk *ick;
 };
 static struct platform_device tahvo_usb_device;
 
@@ -673,6 +674,14 @@ static int __init tahvo_usb_probe(struct
 	INIT_WORK(&tu->irq_work, tahvo_usb_irq_work);
 	mutex_init(&tu->serialize);
 
+	tu->ick = clk_get(NULL, "usb_l4_ick");
+	if (IS_ERR(tu->ick)) {
+		printk(KERN_ERR "Failed to get usb_l4_ick\n");
+		ret = PTR_ERR(tu->ick);
+		goto err_free_tu;
+	}
+	clk_enable(tu->ick);
+
 	/* Set initial state, so that we generate kevents only on
 	 * state changes */
 	tu->vbus_state = tahvo_read_reg(TAHVO_REG_IDSR) & 0x01;
@@ -680,10 +689,9 @@ static int __init tahvo_usb_probe(struct
 	/* We cannot enable interrupt until omap_udc is initialized */
 	ret = tahvo_request_irq(TAHVO_INT_VBUSON, tahvo_usb_vbus_interrupt,
 				(unsigned long) tu, "vbus_interrupt");
-	if (ret != 0) {
-		kfree(tu);
+	if (ret) {
 		printk(KERN_ERR "Could not register Tahvo interrupt for VBUS\n");
-		return ret;
+		goto err_release_clk;
 	}
 
 	/* Attributes */
@@ -708,9 +716,7 @@ static int __init tahvo_usb_probe(struct
 	ret = otg_set_transceiver(&tu->otg);
 	if (ret < 0) {
 		printk(KERN_ERR "Cannot register USB transceiver\n");
-		kfree(tu);
-		tahvo_free_irq(TAHVO_INT_VBUSON);
-		return ret;
+		goto err_free_irq;
 	}
 
 	dev_set_drvdata(dev, tu);
@@ -719,10 +725,22 @@ static int __init tahvo_usb_probe(struct
 	 * may not be generated in addition to this. */
 	schedule_work(&tu->irq_work);
 	return 0;
+
+err_free_irq:
+	tahvo_free_irq(TAHVO_INT_VBUSON);
+err_release_clk:
+	clk_disable(tu->ick);
+	clk_put(tu->ick);
+err_free_tu:
+	kfree(tu);
+
+	return ret;
 }
 
 static int __exit tahvo_usb_remove(struct platform_device *pdev)
 {
+	struct tahvo_usb *tu = platform_get_drvdata(pdev);
+
 	dev_dbg(&pdev->dev, "remove\n");
 
 	tahvo_free_irq(TAHVO_INT_VBUSON);
@@ -732,6 +750,11 @@ static int __exit tahvo_usb_remove(struc
 #ifdef CONFIG_USB_OTG
 	device_remove_file(&pdev->dev, &dev_attr_otg_mode);
 #endif
+	clk_disable(tu->ick);
+	clk_put(tu->ick);
+
+	kfree(tu);
+
 	return 0;
 }
 
Index: linux-2.6.38-rc7/arch/arm/mach-omap2/board-n8x0.c
===================================================================
--- linux-2.6.38-rc7.orig/arch/arm/mach-omap2/board-n8x0.c	2011-03-06 23:00:14.388188076 +0100
+++ linux-2.6.38-rc7/arch/arm/mach-omap2/board-n8x0.c	2011-03-06 23:06:50.508033149 +0100
@@ -40,6 +40,7 @@
 #include <plat/serial.h>
 #include <plat/cbus.h>
 #include <plat/gpio-switch.h>
+#include <plat/usb.h>
 
 #include "mux.h"
 
@@ -395,6 +396,14 @@ static struct musb_hdrc_platform_data tu
 	.config		= &musb_config,
 };
 
+static struct omap_usb_config n8x0_omap_usb_config __initdata = {
+	.otg		= 1,
+	.register_host	= 1,
+	.register_dev	= 1,
+	.hmc_mode	= 16,
+	.pins[0]	= 6,
+};
+
 static void __init n8x0_usb_init(void)
 {
 	int ret = 0;
@@ -417,6 +426,8 @@ static void __init n8x0_usb_init(void)
 	if (ret != 0)
 		goto err;
 
+	omap2_usbfs_init(&n8x0_omap_usb_config);
+
 	printk(announce);
 
 	return;