34279b4280ad62c6dde88e81aae0310d6903b9bc
[openwrt.git] / target / linux / omap24xx / patches-2.6.38 / 596-cbus-tahvo-usb-clk.patch
1 Index: linux-2.6.38-rc7/drivers/cbus/tahvo-usb.c
2 ===================================================================
3 --- linux-2.6.38-rc7.orig/drivers/cbus/tahvo-usb.c 2011-03-09 18:55:47.177917578 +0100
4 +++ linux-2.6.38-rc7/drivers/cbus/tahvo-usb.c 2011-03-09 18:58:35.869996276 +0100
5 @@ -98,6 +98,7 @@ struct tahvo_usb {
6 #ifdef CONFIG_USB_OTG
7 int tahvo_mode;
8 #endif
9 + struct clk *ick;
10 };
11 static struct tahvo_usb *tahvo_usb_device;
12
13 @@ -673,6 +674,14 @@ static int __init tahvo_usb_probe(struct
14 INIT_WORK(&tu->irq_work, tahvo_usb_irq_work);
15 mutex_init(&tu->serialize);
16
17 + tu->ick = clk_get(NULL, "usb_l4_ick");
18 + if (IS_ERR(tu->ick)) {
19 + dev_err(dev, "Failed to get usb_l4_ick\n");
20 + ret = PTR_ERR(tu->ick);
21 + goto err_free_tu;
22 + }
23 + clk_enable(tu->ick);
24 +
25 /* Set initial state, so that we generate kevents only on
26 * state changes */
27 tu->vbus_state = tahvo_read_reg(TAHVO_REG_IDSR) & 0x01;
28 @@ -681,10 +690,8 @@ static int __init tahvo_usb_probe(struct
29 ret = tahvo_request_irq(TAHVO_INT_VBUSON, tahvo_usb_vbus_interrupt,
30 (unsigned long) tu, "vbus_interrupt");
31 if (ret != 0) {
32 - kfree(tu);
33 - tahvo_usb_device = NULL;
34 printk(KERN_ERR "Could not register Tahvo interrupt for VBUS\n");
35 - return ret;
36 + goto err_release_clk;
37 }
38
39 /* Attributes */
40 @@ -709,10 +716,7 @@ static int __init tahvo_usb_probe(struct
41 ret = otg_set_transceiver(&tu->otg);
42 if (ret < 0) {
43 printk(KERN_ERR "Cannot register USB transceiver\n");
44 - tahvo_usb_device = NULL;
45 - kfree(tu);
46 - tahvo_free_irq(TAHVO_INT_VBUSON);
47 - return ret;
48 + goto err_free_irq;
49 }
50
51 dev_set_drvdata(dev, tu);
52 @@ -721,6 +725,17 @@ static int __init tahvo_usb_probe(struct
53 * may not be generated in addition to this. */
54 schedule_work(&tu->irq_work);
55 return 0;
56 +
57 +err_free_irq:
58 + tahvo_free_irq(TAHVO_INT_VBUSON);
59 +err_release_clk:
60 + clk_disable(tu->ick);
61 + clk_put(tu->ick);
62 +err_free_tu:
63 + kfree(tu);
64 + tahvo_usb_device = NULL;
65 +
66 + return ret;
67 }
68
69 static int __exit tahvo_usb_remove(struct platform_device *pdev)
70 @@ -736,6 +751,8 @@ static int __exit tahvo_usb_remove(struc
71 #ifdef CONFIG_USB_OTG
72 device_remove_file(&pdev->dev, &dev_attr_otg_mode);
73 #endif
74 + clk_disable(tu->ick);
75 + clk_put(tu->ick);
76
77 kfree(tu);
78 tahvo_usb_device = NULL;
This page took 0.0474 seconds and 3 git commands to generate.