aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhangfei Gao <zhangfei.gao@linaro.org>2014-07-02 15:28:10 +0800
committerZhangfei Gao <zhangfei.gao@linaro.org>2014-07-02 15:28:10 +0800
commitcb5aabaa9163df44eeab810212de58d9dc550a9c (patch)
tree3b10279e19c18f943a3b0defa273bf0f65bc2774
parent18e98706be30545d2fe324443f946b69d289ec07 (diff)
usb: add clk to ohci & ehcitest-usb
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-rw-r--r--drivers/usb/host/ehci-platform.c16
-rw-r--r--drivers/usb/host/ohci-platform.c21
-rw-r--r--include/linux/usb/hcd.h1
3 files changed, 38 insertions, 0 deletions
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index f47f2594c9d4..22f30dcbfe9b 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -29,6 +29,7 @@
#include <linux/usb.h>
#include <linux/usb/hcd.h>
#include <linux/usb/ehci_pdriver.h>
+#include <linux/clk.h>
#include "ehci.h"
@@ -114,6 +115,19 @@ static int ehci_platform_probe(struct platform_device *dev)
goto err_power;
}
+ hcd->clk = devm_clk_get(&dev->dev, NULL);
+ if (IS_ERR(hcd->clk)) {
+ dev_err(&dev->dev, "failed to get clk\n");
+ err = -ENODEV;
+ goto err_put_hcd;
+ }
+
+ err = clk_prepare_enable(hcd->clk);
+ if (err < 0) {
+ dev_err(&dev->dev, "failed to enable clk %d\n", err);
+ goto err_put_hcd;
+ }
+
hcd->rsrc_start = res_mem->start;
hcd->rsrc_len = resource_size(res_mem);
@@ -144,6 +158,7 @@ static int ehci_platform_remove(struct platform_device *dev)
struct usb_hcd *hcd = platform_get_drvdata(dev);
struct usb_ehci_pdata *pdata = dev->dev.platform_data;
+ clk_disable_unprepare(hcd->clk);
usb_remove_hcd(hcd);
usb_put_hcd(hcd);
platform_set_drvdata(dev, NULL);
@@ -201,6 +216,7 @@ static int ehci_platform_resume(struct device *dev)
static const struct of_device_id vt8500_ehci_ids[] = {
{ .compatible = "via,vt8500-ehci", },
{ .compatible = "wm,prizm-ehci", },
+ { .compatible = "generic-ehci", },
{}
};
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index c3e7287f7921..7c2738bf540a 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -16,6 +16,7 @@
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/usb/ohci_pdriver.h>
+#include <linux/clk.h>
static int ohci_platform_reset(struct usb_hcd *hcd)
{
@@ -125,6 +126,19 @@ static int ohci_platform_probe(struct platform_device *dev)
goto err_power;
}
+ hcd->clk = devm_clk_get(&dev->dev, NULL);
+ if (IS_ERR(hcd->clk)) {
+ dev_err(&dev->dev, "failed to get clk\n");
+ err = -ENODEV;
+ goto err_put_hcd;
+ }
+
+ err = clk_prepare_enable(hcd->clk);
+ if (err < 0) {
+ dev_err(&dev->dev, "failed to enable clk %d\n", err);
+ goto err_put_hcd;
+ }
+
hcd->rsrc_start = res_mem->start;
hcd->rsrc_len = resource_size(res_mem);
@@ -155,6 +169,7 @@ static int ohci_platform_remove(struct platform_device *dev)
struct usb_hcd *hcd = platform_get_drvdata(dev);
struct usb_ohci_pdata *pdata = dev->dev.platform_data;
+ clk_disable_unprepare(hcd->clk);
usb_remove_hcd(hcd);
usb_put_hcd(hcd);
platform_set_drvdata(dev, NULL);
@@ -212,6 +227,12 @@ static const struct dev_pm_ops ohci_platform_pm_ops = {
.resume = ohci_platform_resume,
};
+static const struct of_device_id ohci_platform_ids[] = {
+ { .compatible = "generic-ohci", },
+ { }
+};
+MODULE_DEVICE_TABLE(of, ohci_platform_ids);
+
static struct platform_driver ohci_platform_driver = {
.id_table = ohci_platform_table,
.probe = ohci_platform_probe,
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 0fdff28d5015..ec9b79742eb9 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -98,6 +98,7 @@ struct usb_hcd {
* other external phys should be software-transparent
*/
struct usb_phy *phy;
+ struct clk *clk;
/* Flags that need to be manipulated atomically because they can
* change while the host controller is running. Always use