aboutsummaryrefslogtreecommitdiff
path: root/drivers/mfd
diff options
context:
space:
mode:
authorAndrey Konovalov <andrey.konovalov@linaro.org>2013-04-18 20:26:10 +0400
committerAndrey Konovalov <andrey.konovalov@linaro.org>2013-04-18 20:26:10 +0400
commit5a59f9681dcf273d0dbc7826d39d77ed513821f3 (patch)
tree6c7f0f3d1ca8a1ca0dba7ebf3662e8b8bb68b63d /drivers/mfd
parenta241dda2f11243b3b87aedf87a3dc9e72580a2b3 (diff)
parent3896c8e6399e6bc73ddbd63de0734b48f9b749f2 (diff)
downloadvexpress-lsk-5a59f9681dcf273d0dbc7826d39d77ed513821f3.tar.gz
Automatically merging tracking-panda-fix-usb into merge-linux-linaro
Conflicting files:
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/omap-usb-host.c44
1 files changed, 39 insertions, 5 deletions
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 4febc5c7fde..21af9abf7e1 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -88,12 +88,12 @@
#define is_ehci_tll_mode(x) (x == OMAP_EHCI_PORT_MODE_TLL)
#define is_ehci_hsic_mode(x) (x == OMAP_EHCI_PORT_MODE_HSIC)
-
struct usbhs_hcd_omap {
int nports;
struct clk **utmi_clk;
struct clk **hsic60m_clk;
struct clk **hsic480m_clk;
+ struct clk **aux_clk; /* board dependent clock */
struct clk *xclk60mhsp1_ck;
struct clk *xclk60mhsp2_ck;
@@ -284,6 +284,14 @@ static int usbhs_runtime_resume(struct device *dev)
clk_enable(omap->ehci_logic_fck);
for (i = 0; i < omap->nports; i++) {
+ if (!IS_ERR(omap->aux_clk[i])) {
+ r = clk_prepare_enable(omap->aux_clk[i]);
+ if (r) {
+ dev_err(dev,
+ "Can't enable port %d aux clk %d\n", i, r);
+ }
+ }
+
switch (pdata->port_mode[i]) {
case OMAP_EHCI_PORT_MODE_HSIC:
if (!IS_ERR(omap->hsic60m_clk[i])) {
@@ -348,6 +356,9 @@ static int usbhs_runtime_suspend(struct device *dev)
default:
break;
}
+
+ if (!IS_ERR(omap->aux_clk[i]))
+ clk_disable(omap->aux_clk[i]);
}
if (!IS_ERR(omap->ehci_logic_fck))
@@ -581,11 +592,13 @@ static int usbhs_omap_probe(struct platform_device *pdev)
omap->utmi_clk = devm_kzalloc(dev, i, GFP_KERNEL);
omap->hsic480m_clk = devm_kzalloc(dev, i, GFP_KERNEL);
omap->hsic60m_clk = devm_kzalloc(dev, i, GFP_KERNEL);
+ omap->aux_clk = devm_kzalloc(dev, i, GFP_KERNEL);
- if (!omap->utmi_clk || !omap->hsic480m_clk || !omap->hsic60m_clk) {
- dev_err(dev, "Memory allocation failed\n");
- ret = -ENOMEM;
- goto err_mem;
+ if (!omap->utmi_clk || !omap->hsic480m_clk || !omap->hsic60m_clk ||
+ !omap->aux_clk) {
+ dev_err(dev, "Memory allocation failed\n");
+ ret = -ENOMEM;
+ goto err_mem;
}
need_logic_fck = false;
@@ -668,6 +681,23 @@ static int usbhs_omap_probe(struct platform_device *pdev)
if (IS_ERR(omap->hsic60m_clk[i]))
dev_dbg(dev, "Failed to get clock : %s : %ld\n",
clkname, PTR_ERR(omap->hsic60m_clk[i]));
+
+ /* get the auxiliary clock if required and set its rate */
+ if (pdata->clk[i] && pdata->clkrate[i]) {
+ omap->aux_clk[i] = clk_get(dev, pdata->clk[i]);
+ if (IS_ERR(omap->aux_clk[i])) {
+ dev_dbg(dev, "Failed to get clock %s\n",
+ pdata->clk[i]);
+ } else {
+ ret = clk_set_rate(omap->aux_clk[i],
+ pdata->clkrate[i]);
+ if (ret) {
+ dev_err(dev,
+ "Failed to set clock %s to %luHz\n",
+ pdata->clk[i], pdata->clkrate[i]);
+ }
+ }
+ }
}
if (is_ehci_phy_mode(pdata->port_mode[0])) {
@@ -718,6 +748,8 @@ err_alloc:
clk_put(omap->hsic60m_clk[i]);
if (!IS_ERR(omap->hsic480m_clk[i]))
clk_put(omap->hsic480m_clk[i]);
+ if (!IS_ERR(omap->aux_clk[i]))
+ clk_put(omap->aux_clk[i]);
}
clk_put(omap->init_60m_fclk);
@@ -764,6 +796,8 @@ static int usbhs_omap_remove(struct platform_device *pdev)
clk_put(omap->hsic60m_clk[i]);
if (!IS_ERR(omap->hsic480m_clk[i]))
clk_put(omap->hsic480m_clk[i]);
+ if (!IS_ERR(omap->aux_clk[i]))
+ clk_put(omap->aux_clk[i]);
}
clk_put(omap->init_60m_fclk);