summaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorRoger Quadros <rogerq@ti.com>2012-11-08 18:04:26 +0200
committerRoger Quadros <rogerq@ti.com>2013-02-13 13:22:48 +0200
commitd7eaf866104757d66ccb6627dccf7fb9d07aae7e (patch)
tree74e0adb8a937075dd76942a575b0d571c3c57d20 /drivers/mfd
parent27d4f2c654e39bed13374af9537633de414057b6 (diff)
downloadop-kernel-dev-d7eaf866104757d66ccb6627dccf7fb9d07aae7e.zip
op-kernel-dev-d7eaf866104757d66ccb6627dccf7fb9d07aae7e.tar.gz
mfd: omap-usb-host: know about number of ports from revision register
The revision register should tell us how many ports are present. Signed-off-by: Roger Quadros <rogerq@ti.com> Reviewed-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/omap-usb-host.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 310aaa9..26319ca 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -91,6 +91,8 @@
struct usbhs_hcd_omap {
+ int nports;
+
struct clk *xclk60mhsp1_ck;
struct clk *xclk60mhsp2_ck;
struct clk *utmi_p1_fck;
@@ -347,8 +349,6 @@ static void omap_usbhs_init(struct device *dev)
pm_runtime_get_sync(dev);
spin_lock_irqsave(&omap->lock, flags);
- omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION);
- dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev);
reg = usbhs_read(omap->uhh_base, OMAP_UHH_HOSTCONFIG);
/* setup ULPI bypass and burst configurations */
@@ -483,7 +483,32 @@ static int usbhs_omap_probe(struct platform_device *pdev)
pm_runtime_enable(dev);
- for (i = 0; i < OMAP3_HS_USB_PORTS; i++)
+ platform_set_drvdata(pdev, omap);
+ pm_runtime_get_sync(dev);
+
+ omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION);
+
+ /* we need to call runtime suspend before we update omap->nports
+ * to prevent unbalanced clk_disable()
+ */
+ pm_runtime_put_sync(dev);
+
+ switch (omap->usbhs_rev) {
+ case OMAP_USBHS_REV1:
+ omap->nports = 3;
+ break;
+ case OMAP_USBHS_REV2:
+ omap->nports = 2;
+ break;
+ default:
+ omap->nports = OMAP3_HS_USB_PORTS;
+ dev_dbg(dev,
+ "USB HOST Rev : 0x%d not recognized, assuming %d ports\n",
+ omap->usbhs_rev, omap->nports);
+ break;
+ }
+
+ for (i = 0; i < omap->nports; i++)
if (is_ehci_phy_mode(i) || is_ehci_tll_mode(i) ||
is_ehci_hsic_mode(i)) {
omap->ehci_logic_fck = clk_get(dev, "ehci_logic_fck");
@@ -573,8 +598,6 @@ static int usbhs_omap_probe(struct platform_device *pdev)
"failed error:%d\n", ret);
}
- platform_set_drvdata(pdev, omap);
-
omap_usbhs_init(dev);
ret = omap_usbhs_alloc_children(pdev);
if (ret) {
OpenPOWER on IntegriCloud