Skip to content

Commit 8f2df01

Browse files
Keshava MunegowdaSamuel Ortiz
authored andcommitted
Revert "mfd: Add omap-usbhs runtime PM support"
This reverts commit 7e6502d. Oops are produced during initialization of ehci and ohci drivers. This is because the run time pm apis are used by the driver but the corresponding hwmod structures and initialization is not merged. hence revering back the commit id 7e6502d Signed-off-by: Keshava Munegowda <[email protected]> Reported-by: Luciano Coelho <[email protected]> Acked-by: Felipe Balbi <[email protected]> Signed-off-by: Samuel Ortiz <[email protected]>
1 parent 63ef112 commit 8f2df01

File tree

1 file changed

+122
-9
lines changed

1 file changed

+122
-9
lines changed

drivers/mfd/omap-usb-host.c

Lines changed: 122 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include <linux/spinlock.h>
2727
#include <linux/gpio.h>
2828
#include <plat/usb.h>
29-
#include <linux/pm_runtime.h>
3029

3130
#define USBHS_DRIVER_NAME "usbhs-omap"
3231
#define OMAP_EHCI_DEVICE "ehci-omap"
@@ -147,6 +146,9 @@
147146

148147

149148
struct usbhs_hcd_omap {
149+
struct clk *usbhost_ick;
150+
struct clk *usbhost_hs_fck;
151+
struct clk *usbhost_fs_fck;
150152
struct clk *xclk60mhsp1_ck;
151153
struct clk *xclk60mhsp2_ck;
152154
struct clk *utmi_p1_fck;
@@ -156,6 +158,8 @@ struct usbhs_hcd_omap {
156158
struct clk *usbhost_p2_fck;
157159
struct clk *usbtll_p2_fck;
158160
struct clk *init_60m_fclk;
161+
struct clk *usbtll_fck;
162+
struct clk *usbtll_ick;
159163

160164
void __iomem *uhh_base;
161165
void __iomem *tll_base;
@@ -349,13 +353,46 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev)
349353
omap->platdata.ehci_data = pdata->ehci_data;
350354
omap->platdata.ohci_data = pdata->ohci_data;
351355

352-
pm_runtime_enable(&pdev->dev);
356+
omap->usbhost_ick = clk_get(dev, "usbhost_ick");
357+
if (IS_ERR(omap->usbhost_ick)) {
358+
ret = PTR_ERR(omap->usbhost_ick);
359+
dev_err(dev, "usbhost_ick failed error:%d\n", ret);
360+
goto err_end;
361+
}
362+
363+
omap->usbhost_hs_fck = clk_get(dev, "hs_fck");
364+
if (IS_ERR(omap->usbhost_hs_fck)) {
365+
ret = PTR_ERR(omap->usbhost_hs_fck);
366+
dev_err(dev, "usbhost_hs_fck failed error:%d\n", ret);
367+
goto err_usbhost_ick;
368+
}
369+
370+
omap->usbhost_fs_fck = clk_get(dev, "fs_fck");
371+
if (IS_ERR(omap->usbhost_fs_fck)) {
372+
ret = PTR_ERR(omap->usbhost_fs_fck);
373+
dev_err(dev, "usbhost_fs_fck failed error:%d\n", ret);
374+
goto err_usbhost_hs_fck;
375+
}
376+
377+
omap->usbtll_fck = clk_get(dev, "usbtll_fck");
378+
if (IS_ERR(omap->usbtll_fck)) {
379+
ret = PTR_ERR(omap->usbtll_fck);
380+
dev_err(dev, "usbtll_fck failed error:%d\n", ret);
381+
goto err_usbhost_fs_fck;
382+
}
383+
384+
omap->usbtll_ick = clk_get(dev, "usbtll_ick");
385+
if (IS_ERR(omap->usbtll_ick)) {
386+
ret = PTR_ERR(omap->usbtll_ick);
387+
dev_err(dev, "usbtll_ick failed error:%d\n", ret);
388+
goto err_usbtll_fck;
389+
}
353390

354391
omap->utmi_p1_fck = clk_get(dev, "utmi_p1_gfclk");
355392
if (IS_ERR(omap->utmi_p1_fck)) {
356393
ret = PTR_ERR(omap->utmi_p1_fck);
357394
dev_err(dev, "utmi_p1_gfclk failed error:%d\n", ret);
358-
goto err_end;
395+
goto err_usbtll_ick;
359396
}
360397

361398
omap->xclk60mhsp1_ck = clk_get(dev, "xclk60mhsp1_ck");
@@ -485,8 +522,22 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev)
485522
err_utmi_p1_fck:
486523
clk_put(omap->utmi_p1_fck);
487524

525+
err_usbtll_ick:
526+
clk_put(omap->usbtll_ick);
527+
528+
err_usbtll_fck:
529+
clk_put(omap->usbtll_fck);
530+
531+
err_usbhost_fs_fck:
532+
clk_put(omap->usbhost_fs_fck);
533+
534+
err_usbhost_hs_fck:
535+
clk_put(omap->usbhost_hs_fck);
536+
537+
err_usbhost_ick:
538+
clk_put(omap->usbhost_ick);
539+
488540
err_end:
489-
pm_runtime_disable(&pdev->dev);
490541
kfree(omap);
491542

492543
end_probe:
@@ -520,7 +571,11 @@ static int __devexit usbhs_omap_remove(struct platform_device *pdev)
520571
clk_put(omap->utmi_p2_fck);
521572
clk_put(omap->xclk60mhsp1_ck);
522573
clk_put(omap->utmi_p1_fck);
523-
pm_runtime_disable(&pdev->dev);
574+
clk_put(omap->usbtll_ick);
575+
clk_put(omap->usbtll_fck);
576+
clk_put(omap->usbhost_fs_fck);
577+
clk_put(omap->usbhost_hs_fck);
578+
clk_put(omap->usbhost_ick);
524579
kfree(omap);
525580

526581
return 0;
@@ -640,6 +695,7 @@ static int usbhs_enable(struct device *dev)
640695
struct usbhs_omap_platform_data *pdata = &omap->platdata;
641696
unsigned long flags = 0;
642697
int ret = 0;
698+
unsigned long timeout;
643699
unsigned reg;
644700

645701
dev_dbg(dev, "starting TI HSUSB Controller\n");
@@ -652,7 +708,11 @@ static int usbhs_enable(struct device *dev)
652708
if (omap->count > 0)
653709
goto end_count;
654710

655-
pm_runtime_get_sync(dev);
711+
clk_enable(omap->usbhost_ick);
712+
clk_enable(omap->usbhost_hs_fck);
713+
clk_enable(omap->usbhost_fs_fck);
714+
clk_enable(omap->usbtll_fck);
715+
clk_enable(omap->usbtll_ick);
656716

657717
if (pdata->ehci_data->phy_reset) {
658718
if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) {
@@ -676,6 +736,50 @@ static int usbhs_enable(struct device *dev)
676736
omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION);
677737
dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev);
678738

739+
/* perform TLL soft reset, and wait until reset is complete */
740+
usbhs_write(omap->tll_base, OMAP_USBTLL_SYSCONFIG,
741+
OMAP_USBTLL_SYSCONFIG_SOFTRESET);
742+
743+
/* Wait for TLL reset to complete */
744+
timeout = jiffies + msecs_to_jiffies(1000);
745+
while (!(usbhs_read(omap->tll_base, OMAP_USBTLL_SYSSTATUS)
746+
& OMAP_USBTLL_SYSSTATUS_RESETDONE)) {
747+
cpu_relax();
748+
749+
if (time_after(jiffies, timeout)) {
750+
dev_dbg(dev, "operation timed out\n");
751+
ret = -EINVAL;
752+
goto err_tll;
753+
}
754+
}
755+
756+
dev_dbg(dev, "TLL RESET DONE\n");
757+
758+
/* (1<<3) = no idle mode only for initial debugging */
759+
usbhs_write(omap->tll_base, OMAP_USBTLL_SYSCONFIG,
760+
OMAP_USBTLL_SYSCONFIG_ENAWAKEUP |
761+
OMAP_USBTLL_SYSCONFIG_SIDLEMODE |
762+
OMAP_USBTLL_SYSCONFIG_AUTOIDLE);
763+
764+
/* Put UHH in NoIdle/NoStandby mode */
765+
reg = usbhs_read(omap->uhh_base, OMAP_UHH_SYSCONFIG);
766+
if (is_omap_usbhs_rev1(omap)) {
767+
reg |= (OMAP_UHH_SYSCONFIG_ENAWAKEUP
768+
| OMAP_UHH_SYSCONFIG_SIDLEMODE
769+
| OMAP_UHH_SYSCONFIG_CACTIVITY
770+
| OMAP_UHH_SYSCONFIG_MIDLEMODE);
771+
reg &= ~OMAP_UHH_SYSCONFIG_AUTOIDLE;
772+
773+
774+
} else if (is_omap_usbhs_rev2(omap)) {
775+
reg &= ~OMAP4_UHH_SYSCONFIG_IDLEMODE_CLEAR;
776+
reg |= OMAP4_UHH_SYSCONFIG_NOIDLE;
777+
reg &= ~OMAP4_UHH_SYSCONFIG_STDBYMODE_CLEAR;
778+
reg |= OMAP4_UHH_SYSCONFIG_NOSTDBY;
779+
}
780+
781+
usbhs_write(omap->uhh_base, OMAP_UHH_SYSCONFIG, reg);
782+
679783
reg = usbhs_read(omap->uhh_base, OMAP_UHH_HOSTCONFIG);
680784
/* setup ULPI bypass and burst configurations */
681785
reg |= (OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN
@@ -815,15 +919,20 @@ static int usbhs_enable(struct device *dev)
815919
return 0;
816920

817921
err_tll:
818-
pm_runtime_put_sync(dev);
819-
spin_unlock_irqrestore(&omap->lock, flags);
820922
if (pdata->ehci_data->phy_reset) {
821923
if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0]))
822924
gpio_free(pdata->ehci_data->reset_gpio_port[0]);
823925

824926
if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1]))
825927
gpio_free(pdata->ehci_data->reset_gpio_port[1]);
826928
}
929+
930+
clk_disable(omap->usbtll_ick);
931+
clk_disable(omap->usbtll_fck);
932+
clk_disable(omap->usbhost_fs_fck);
933+
clk_disable(omap->usbhost_hs_fck);
934+
clk_disable(omap->usbhost_ick);
935+
spin_unlock_irqrestore(&omap->lock, flags);
827936
return ret;
828937
}
829938

@@ -896,7 +1005,11 @@ static void usbhs_disable(struct device *dev)
8961005
clk_disable(omap->utmi_p1_fck);
8971006
}
8981007

899-
pm_runtime_put_sync(dev);
1008+
clk_disable(omap->usbtll_ick);
1009+
clk_disable(omap->usbtll_fck);
1010+
clk_disable(omap->usbhost_fs_fck);
1011+
clk_disable(omap->usbhost_hs_fck);
1012+
clk_disable(omap->usbhost_ick);
9001013

9011014
/* The gpio_free migh sleep; so unlock the spinlock */
9021015
spin_unlock_irqrestore(&omap->lock, flags);

0 commit comments

Comments
 (0)