diff options
author | Andrew Lunn <andrew@lunn.ch> | 2012-04-15 06:53:47 -0400 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2012-05-08 19:33:59 -0400 |
commit | 8c869edaee07c623066266827371235fb9c12e01 (patch) | |
tree | f7fc9da52e9a0ca79368d2033434e3fd551f1642 /drivers/usb | |
parent | eee989902aab45f0ca2739727ef615420802649c (diff) |
ARM: Orion: EHCI: Add support for enabling clocks
Not all platforms support gating the clock, so it is not an error if
the clock does not exist. However, if it does exist, we should
enable/disable it as appropriate.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Jamie Lentin <jm@lentin.co.uk>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/host/ehci-orion.c | 16 |
1 files changed, 16 insertions, 0 deletions
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: | |||
301 | static int __exit ehci_orion_drv_remove(struct platform_device *pdev) | 311 | static 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 | ||