aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-26 15:42:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-26 15:42:29 -0400
commit27953437059c64d14086196eb96f43c78caa9db3 (patch)
tree0cfd5fb21262a6db3de0c64462847b4c0c43e9df /drivers/usb/host
parent2c757fd5d1a92086f225a75a8fac7cab242d11b0 (diff)
parent3c0dec5f58b3c7b3627715126d1bf9b030a076f0 (diff)
Merge tag 'clock' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull arm-soc clock driver changes from Olof Johansson: "The new clock subsystem was merged in linux-3.4 without any users, this now moves the first three platforms over to it: imx, mxs and spear. The series also contains the changes for the clock subsystem itself, since Mike preferred to have it together with the platforms that require these changes, in order to avoid interdependencies and conflicts." Fix up trivial conflicts in arch/arm/mach-kirkwood/common.c (code removed in one branch, added OF support in another) and drivers/dma/imx-sdma.c (independent changes next to each other). * tag 'clock' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (97 commits) clk: Fix CLK_SET_RATE_GATE flag validation in clk_set_rate(). clk: Provide dummy clk_unregister() SPEAr: Update defconfigs SPEAr: Add SMI NOR partition info in dts files SPEAr: Switch to common clock framework SPEAr: Call clk_prepare() before calling clk_enable SPEAr: clk: Add General Purpose Timer Synthesizer clock SPEAr: clk: Add Fractional Synthesizer clock SPEAr: clk: Add Auxiliary Synthesizer clock SPEAr: clk: Add VCO-PLL Synthesizer clock SPEAr: Add DT bindings for SPEAr's timer ARM i.MX: remove now unused clock files ARM: i.MX6: implement clocks using common clock framework ARM i.MX35: implement clocks using common clock framework ARM i.MX5: implement clocks using common clock framework ARM: Kirkwood: Replace clock gating ARM: Orion: Audio: Add clk/clkdev support ARM: Orion: PCIE: Add support for clk ARM: Orion: XOR: Add support for clk ARM: Orion: CESA: Add support for clk ...
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/ehci-mxc.c62
-rw-r--r--drivers/usb/host/ehci-orion.c16
2 files changed, 43 insertions, 35 deletions
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c
index a797d51ecbe8..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
34struct ehci_mxc_priv { 34struct 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_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_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_enable(priv->phy1clk);
193 }
194 189
195 190
196 /* call platform specific init function */ 191 /* call platform specific init function */
@@ -265,17 +260,15 @@ err_add:
265 if (pdata && pdata->exit) 260 if (pdata && pdata->exit)
266 pdata->exit(pdev); 261 pdata->exit(pdev);
267err_init: 262err_init:
268 if (priv->phy1clk) { 263 if (priv->phyclk) {
269 clk_disable(priv->phy1clk); 264 clk_disable_unprepare(priv->phyclk);
270 clk_put(priv->phy1clk); 265 clk_put(priv->phyclk);
271 }
272err_clk_phy:
273 if (priv->ahbclk) {
274 clk_disable(priv->ahbclk);
275 clk_put(priv->ahbclk);
276 } 266 }
267
268 clk_disable_unprepare(priv->ahbclk);
269 clk_put(priv->ahbclk);
277err_clk_ahb: 270err_clk_ahb:
278 clk_disable(priv->usbclk); 271 clk_disable_unprepare(priv->usbclk);
279 clk_put(priv->usbclk); 272 clk_put(priv->usbclk);
280err_clk: 273err_clk:
281 iounmap(hcd->regs); 274 iounmap(hcd->regs);
@@ -307,15 +300,14 @@ static int __exit ehci_mxc_drv_remove(struct platform_device *pdev)
307 usb_put_hcd(hcd); 300 usb_put_hcd(hcd);
308 platform_set_drvdata(pdev, NULL); 301 platform_set_drvdata(pdev, NULL);
309 302
310 clk_disable(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(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(priv->phy1clk); 310 clk_put(priv->phyclk);
318 clk_put(priv->phy1clk);
319 } 311 }
320 312
321 kfree(priv); 313 kfree(priv);
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
index 6c6a5a3b4ea7..82de1073aa52 100644
--- a/drivers/usb/host/ehci-orion.c
+++ b/drivers/usb/host/ehci-orion.c
@@ -12,6 +12,7 @@
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/mbus.h> 14#include <linux/mbus.h>
15#include <linux/clk.h>
15#include <plat/ehci-orion.h> 16#include <plat/ehci-orion.h>
16 17
17#define rdl(off) __raw_readl(hcd->regs + (off)) 18#define rdl(off) __raw_readl(hcd->regs + (off))
@@ -198,6 +199,7 @@ static int __devinit ehci_orion_drv_probe(struct platform_device *pdev)
198 struct resource *res; 199 struct resource *res;
199 struct usb_hcd *hcd; 200 struct usb_hcd *hcd;
200 struct ehci_hcd *ehci; 201 struct ehci_hcd *ehci;
202 struct clk *clk;
201 void __iomem *regs; 203 void __iomem *regs;
202 int irq, err; 204 int irq, err;
203 205
@@ -238,6 +240,14 @@ static int __devinit ehci_orion_drv_probe(struct platform_device *pdev)
238 goto err2; 240 goto err2;
239 } 241 }
240 242
243 /* Not all platforms can gate the clock, so it is not
244 an error if the clock does not exists. */
245 clk = clk_get(&pdev->dev, NULL);
246 if (!IS_ERR(clk)) {
247 clk_prepare_enable(clk);
248 clk_put(clk);
249 }
250
241 hcd = usb_create_hcd(&ehci_orion_hc_driver, 251 hcd = usb_create_hcd(&ehci_orion_hc_driver,
242 &pdev->dev, dev_name(&pdev->dev)); 252 &pdev->dev, dev_name(&pdev->dev));
243 if (!hcd) { 253 if (!hcd) {
@@ -301,12 +311,18 @@ err1:
301static int __exit ehci_orion_drv_remove(struct platform_device *pdev) 311static int __exit ehci_orion_drv_remove(struct platform_device *pdev)
302{ 312{
303 struct usb_hcd *hcd = platform_get_drvdata(pdev); 313 struct usb_hcd *hcd = platform_get_drvdata(pdev);
314 struct clk *clk;
304 315
305 usb_remove_hcd(hcd); 316 usb_remove_hcd(hcd);
306 iounmap(hcd->regs); 317 iounmap(hcd->regs);
307 release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 318 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
308 usb_put_hcd(hcd); 319 usb_put_hcd(hcd);
309 320
321 clk = clk_get(&pdev->dev, NULL);
322 if (!IS_ERR(clk)) {
323 clk_disable_unprepare(clk);
324 clk_put(clk);
325 }
310 return 0; 326 return 0;
311} 327}
312 328