diff options
Diffstat (limited to 'drivers/usb/host/ohci-exynos.c')
-rw-r--r-- | drivers/usb/host/ohci-exynos.c | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index 20a50081f922..aa3b8844bb9f 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c | |||
@@ -23,6 +23,11 @@ struct exynos_ohci_hcd { | |||
23 | struct clk *clk; | 23 | struct clk *clk; |
24 | }; | 24 | }; |
25 | 25 | ||
26 | static int ohci_exynos_reset(struct usb_hcd *hcd) | ||
27 | { | ||
28 | return ohci_init(hcd_to_ohci(hcd)); | ||
29 | } | ||
30 | |||
26 | static int ohci_exynos_start(struct usb_hcd *hcd) | 31 | static int ohci_exynos_start(struct usb_hcd *hcd) |
27 | { | 32 | { |
28 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); | 33 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); |
@@ -30,10 +35,6 @@ static int ohci_exynos_start(struct usb_hcd *hcd) | |||
30 | 35 | ||
31 | ohci_dbg(ohci, "ohci_exynos_start, ohci:%p", ohci); | 36 | ohci_dbg(ohci, "ohci_exynos_start, ohci:%p", ohci); |
32 | 37 | ||
33 | ret = ohci_init(ohci); | ||
34 | if (ret < 0) | ||
35 | return ret; | ||
36 | |||
37 | ret = ohci_run(ohci); | 38 | ret = ohci_run(ohci); |
38 | if (ret < 0) { | 39 | if (ret < 0) { |
39 | dev_err(hcd->self.controller, "can't start %s\n", | 40 | dev_err(hcd->self.controller, "can't start %s\n", |
@@ -53,6 +54,7 @@ static const struct hc_driver exynos_ohci_hc_driver = { | |||
53 | .irq = ohci_irq, | 54 | .irq = ohci_irq, |
54 | .flags = HCD_MEMORY|HCD_USB11, | 55 | .flags = HCD_MEMORY|HCD_USB11, |
55 | 56 | ||
57 | .reset = ohci_exynos_reset, | ||
56 | .start = ohci_exynos_start, | 58 | .start = ohci_exynos_start, |
57 | .stop = ohci_stop, | 59 | .stop = ohci_stop, |
58 | .shutdown = ohci_shutdown, | 60 | .shutdown = ohci_shutdown, |
@@ -74,7 +76,7 @@ static const struct hc_driver exynos_ohci_hc_driver = { | |||
74 | 76 | ||
75 | static u64 ohci_exynos_dma_mask = DMA_BIT_MASK(32); | 77 | static u64 ohci_exynos_dma_mask = DMA_BIT_MASK(32); |
76 | 78 | ||
77 | static int __devinit exynos_ohci_probe(struct platform_device *pdev) | 79 | static int exynos_ohci_probe(struct platform_device *pdev) |
78 | { | 80 | { |
79 | struct exynos4_ohci_platdata *pdata; | 81 | struct exynos4_ohci_platdata *pdata; |
80 | struct exynos_ohci_hcd *exynos_ohci; | 82 | struct exynos_ohci_hcd *exynos_ohci; |
@@ -115,7 +117,7 @@ static int __devinit exynos_ohci_probe(struct platform_device *pdev) | |||
115 | } | 117 | } |
116 | 118 | ||
117 | exynos_ohci->hcd = hcd; | 119 | exynos_ohci->hcd = hcd; |
118 | exynos_ohci->clk = clk_get(&pdev->dev, "usbhost"); | 120 | exynos_ohci->clk = devm_clk_get(&pdev->dev, "usbhost"); |
119 | 121 | ||
120 | if (IS_ERR(exynos_ohci->clk)) { | 122 | if (IS_ERR(exynos_ohci->clk)) { |
121 | dev_err(&pdev->dev, "Failed to get usbhost clock\n"); | 123 | dev_err(&pdev->dev, "Failed to get usbhost clock\n"); |
@@ -123,9 +125,9 @@ static int __devinit exynos_ohci_probe(struct platform_device *pdev) | |||
123 | goto fail_clk; | 125 | goto fail_clk; |
124 | } | 126 | } |
125 | 127 | ||
126 | err = clk_enable(exynos_ohci->clk); | 128 | err = clk_prepare_enable(exynos_ohci->clk); |
127 | if (err) | 129 | if (err) |
128 | goto fail_clken; | 130 | goto fail_clk; |
129 | 131 | ||
130 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 132 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
131 | if (!res) { | 133 | if (!res) { |
@@ -167,15 +169,13 @@ static int __devinit exynos_ohci_probe(struct platform_device *pdev) | |||
167 | return 0; | 169 | return 0; |
168 | 170 | ||
169 | fail_io: | 171 | fail_io: |
170 | clk_disable(exynos_ohci->clk); | 172 | clk_disable_unprepare(exynos_ohci->clk); |
171 | fail_clken: | ||
172 | clk_put(exynos_ohci->clk); | ||
173 | fail_clk: | 173 | fail_clk: |
174 | usb_put_hcd(hcd); | 174 | usb_put_hcd(hcd); |
175 | return err; | 175 | return err; |
176 | } | 176 | } |
177 | 177 | ||
178 | static int __devexit exynos_ohci_remove(struct platform_device *pdev) | 178 | static int exynos_ohci_remove(struct platform_device *pdev) |
179 | { | 179 | { |
180 | struct exynos4_ohci_platdata *pdata = pdev->dev.platform_data; | 180 | struct exynos4_ohci_platdata *pdata = pdev->dev.platform_data; |
181 | struct exynos_ohci_hcd *exynos_ohci = platform_get_drvdata(pdev); | 181 | struct exynos_ohci_hcd *exynos_ohci = platform_get_drvdata(pdev); |
@@ -186,8 +186,7 @@ static int __devexit exynos_ohci_remove(struct platform_device *pdev) | |||
186 | if (pdata && pdata->phy_exit) | 186 | if (pdata && pdata->phy_exit) |
187 | pdata->phy_exit(pdev, S5P_USB_PHY_HOST); | 187 | pdata->phy_exit(pdev, S5P_USB_PHY_HOST); |
188 | 188 | ||
189 | clk_disable(exynos_ohci->clk); | 189 | clk_disable_unprepare(exynos_ohci->clk); |
190 | clk_put(exynos_ohci->clk); | ||
191 | 190 | ||
192 | usb_put_hcd(hcd); | 191 | usb_put_hcd(hcd); |
193 | 192 | ||
@@ -232,7 +231,7 @@ static int exynos_ohci_suspend(struct device *dev) | |||
232 | if (pdata && pdata->phy_exit) | 231 | if (pdata && pdata->phy_exit) |
233 | pdata->phy_exit(pdev, S5P_USB_PHY_HOST); | 232 | pdata->phy_exit(pdev, S5P_USB_PHY_HOST); |
234 | 233 | ||
235 | clk_disable(exynos_ohci->clk); | 234 | clk_disable_unprepare(exynos_ohci->clk); |
236 | 235 | ||
237 | fail: | 236 | fail: |
238 | spin_unlock_irqrestore(&ohci->lock, flags); | 237 | spin_unlock_irqrestore(&ohci->lock, flags); |
@@ -247,15 +246,12 @@ static int exynos_ohci_resume(struct device *dev) | |||
247 | struct platform_device *pdev = to_platform_device(dev); | 246 | struct platform_device *pdev = to_platform_device(dev); |
248 | struct exynos4_ohci_platdata *pdata = pdev->dev.platform_data; | 247 | struct exynos4_ohci_platdata *pdata = pdev->dev.platform_data; |
249 | 248 | ||
250 | clk_enable(exynos_ohci->clk); | 249 | clk_prepare_enable(exynos_ohci->clk); |
251 | 250 | ||
252 | if (pdata && pdata->phy_init) | 251 | if (pdata && pdata->phy_init) |
253 | pdata->phy_init(pdev, S5P_USB_PHY_HOST); | 252 | pdata->phy_init(pdev, S5P_USB_PHY_HOST); |
254 | 253 | ||
255 | /* Mark hardware accessible again as we are out of D3 state by now */ | 254 | ohci_resume(hcd, false); |
256 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
257 | |||
258 | ohci_finish_controller_resume(hcd); | ||
259 | 255 | ||
260 | return 0; | 256 | return 0; |
261 | } | 257 | } |
@@ -279,7 +275,7 @@ MODULE_DEVICE_TABLE(of, exynos_ohci_match); | |||
279 | 275 | ||
280 | static struct platform_driver exynos_ohci_driver = { | 276 | static struct platform_driver exynos_ohci_driver = { |
281 | .probe = exynos_ohci_probe, | 277 | .probe = exynos_ohci_probe, |
282 | .remove = __devexit_p(exynos_ohci_remove), | 278 | .remove = exynos_ohci_remove, |
283 | .shutdown = exynos_ohci_shutdown, | 279 | .shutdown = exynos_ohci_shutdown, |
284 | .driver = { | 280 | .driver = { |
285 | .name = "exynos-ohci", | 281 | .name = "exynos-ohci", |