diff options
-rw-r--r-- | drivers/usb/host/ehci-mxc.c | 56 |
1 files changed, 24 insertions, 32 deletions
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c index ae16c346389c..c778ffe4e4e5 100644 --- a/drivers/usb/host/ehci-mxc.c +++ b/drivers/usb/host/ehci-mxc.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #define ULPI_VIEWPORT_OFFSET 0x170 | 32 | #define ULPI_VIEWPORT_OFFSET 0x170 |
33 | 33 | ||
34 | struct ehci_mxc_priv { | 34 | struct ehci_mxc_priv { |
35 | struct clk *usbclk, *ahbclk, *phy1clk; | 35 | struct clk *usbclk, *ahbclk, *phyclk; |
36 | struct usb_hcd *hcd; | 36 | struct usb_hcd *hcd; |
37 | }; | 37 | }; |
38 | 38 | ||
@@ -166,31 +166,26 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) | |||
166 | } | 166 | } |
167 | 167 | ||
168 | /* enable clocks */ | 168 | /* enable clocks */ |
169 | priv->usbclk = clk_get(dev, "usb"); | 169 | priv->usbclk = clk_get(dev, "ipg"); |
170 | if (IS_ERR(priv->usbclk)) { | 170 | if (IS_ERR(priv->usbclk)) { |
171 | ret = PTR_ERR(priv->usbclk); | 171 | ret = PTR_ERR(priv->usbclk); |
172 | goto err_clk; | 172 | goto err_clk; |
173 | } | 173 | } |
174 | clk_prepare_enable(priv->usbclk); | 174 | clk_prepare_enable(priv->usbclk); |
175 | 175 | ||
176 | if (!cpu_is_mx35() && !cpu_is_mx25()) { | 176 | priv->ahbclk = clk_get(dev, "ahb"); |
177 | priv->ahbclk = clk_get(dev, "usb_ahb"); | 177 | if (IS_ERR(priv->ahbclk)) { |
178 | if (IS_ERR(priv->ahbclk)) { | 178 | ret = PTR_ERR(priv->ahbclk); |
179 | ret = PTR_ERR(priv->ahbclk); | 179 | goto err_clk_ahb; |
180 | goto err_clk_ahb; | ||
181 | } | ||
182 | clk_prepare_enable(priv->ahbclk); | ||
183 | } | 180 | } |
181 | clk_prepare_enable(priv->ahbclk); | ||
184 | 182 | ||
185 | /* "dr" device has its own clock on i.MX51 */ | 183 | /* "dr" device has its own clock on i.MX51 */ |
186 | if (cpu_is_mx51() && (pdev->id == 0)) { | 184 | priv->phyclk = clk_get(dev, "phy"); |
187 | priv->phy1clk = clk_get(dev, "usb_phy1"); | 185 | if (IS_ERR(priv->phyclk)) |
188 | if (IS_ERR(priv->phy1clk)) { | 186 | priv->phyclk = NULL; |
189 | ret = PTR_ERR(priv->phy1clk); | 187 | if (priv->phyclk) |
190 | goto err_clk_phy; | 188 | clk_prepare_enable(priv->phyclk); |
191 | } | ||
192 | clk_prepare_enable(priv->phy1clk); | ||
193 | } | ||
194 | 189 | ||
195 | 190 | ||
196 | /* call platform specific init function */ | 191 | /* call platform specific init function */ |
@@ -265,15 +260,13 @@ err_add: | |||
265 | if (pdata && pdata->exit) | 260 | if (pdata && pdata->exit) |
266 | pdata->exit(pdev); | 261 | pdata->exit(pdev); |
267 | err_init: | 262 | err_init: |
268 | if (priv->phy1clk) { | 263 | if (priv->phyclk) { |
269 | clk_disable_unprepare(priv->phy1clk); | 264 | clk_disable_unprepare(priv->phyclk); |
270 | clk_put(priv->phy1clk); | 265 | clk_put(priv->phyclk); |
271 | } | ||
272 | err_clk_phy: | ||
273 | if (priv->ahbclk) { | ||
274 | clk_disable_unprepare(priv->ahbclk); | ||
275 | clk_put(priv->ahbclk); | ||
276 | } | 266 | } |
267 | |||
268 | clk_disable_unprepare(priv->ahbclk); | ||
269 | clk_put(priv->ahbclk); | ||
277 | err_clk_ahb: | 270 | err_clk_ahb: |
278 | clk_disable_unprepare(priv->usbclk); | 271 | clk_disable_unprepare(priv->usbclk); |
279 | clk_put(priv->usbclk); | 272 | clk_put(priv->usbclk); |
@@ -309,13 +302,12 @@ static int __exit ehci_mxc_drv_remove(struct platform_device *pdev) | |||
309 | 302 | ||
310 | clk_disable_unprepare(priv->usbclk); | 303 | clk_disable_unprepare(priv->usbclk); |
311 | clk_put(priv->usbclk); | 304 | clk_put(priv->usbclk); |
312 | if (priv->ahbclk) { | 305 | clk_disable_unprepare(priv->ahbclk); |
313 | clk_disable_unprepare(priv->ahbclk); | 306 | clk_put(priv->ahbclk); |
314 | clk_put(priv->ahbclk); | 307 | |
315 | } | 308 | if (priv->phyclk) { |
316 | if (priv->phy1clk) { | 309 | clk_disable_unprepare(priv->phyclk); |
317 | clk_disable_unprepare(priv->phy1clk); | 310 | clk_put(priv->phyclk); |
318 | clk_put(priv->phy1clk); | ||
319 | } | 311 | } |
320 | 312 | ||
321 | kfree(priv); | 313 | kfree(priv); |