aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/omap-usb-host.c
diff options
context:
space:
mode:
authorRoger Quadros <rogerq@ti.com>2012-11-08 11:04:26 -0500
committerRoger Quadros <rogerq@ti.com>2013-02-13 06:22:48 -0500
commitd7eaf866104757d66ccb6627dccf7fb9d07aae7e (patch)
tree74e0adb8a937075dd76942a575b0d571c3c57d20 /drivers/mfd/omap-usb-host.c
parent27d4f2c654e39bed13374af9537633de414057b6 (diff)
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/omap-usb-host.c')
-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 310aaa9731ee..26319ca72e38 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -91,6 +91,8 @@
91 91
92 92
93struct usbhs_hcd_omap { 93struct usbhs_hcd_omap {
94 int nports;
95
94 struct clk *xclk60mhsp1_ck; 96 struct clk *xclk60mhsp1_ck;
95 struct clk *xclk60mhsp2_ck; 97 struct clk *xclk60mhsp2_ck;
96 struct clk *utmi_p1_fck; 98 struct clk *utmi_p1_fck;
@@ -347,8 +349,6 @@ static void omap_usbhs_init(struct device *dev)
347 349
348 pm_runtime_get_sync(dev); 350 pm_runtime_get_sync(dev);
349 spin_lock_irqsave(&omap->lock, flags); 351 spin_lock_irqsave(&omap->lock, flags);
350 omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION);
351 dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev);
352 352
353 reg = usbhs_read(omap->uhh_base, OMAP_UHH_HOSTCONFIG); 353 reg = usbhs_read(omap->uhh_base, OMAP_UHH_HOSTCONFIG);
354 /* setup ULPI bypass and burst configurations */ 354 /* setup ULPI bypass and burst configurations */
@@ -483,7 +483,32 @@ static int usbhs_omap_probe(struct platform_device *pdev)
483 483
484 pm_runtime_enable(dev); 484 pm_runtime_enable(dev);
485 485
486 for (i = 0; i < OMAP3_HS_USB_PORTS; i++) 486 platform_set_drvdata(pdev, omap);
487 pm_runtime_get_sync(dev);
488
489 omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION);
490
491 /* we need to call runtime suspend before we update omap->nports
492 * to prevent unbalanced clk_disable()
493 */
494 pm_runtime_put_sync(dev);
495
496 switch (omap->usbhs_rev) {
497 case OMAP_USBHS_REV1:
498 omap->nports = 3;
499 break;
500 case OMAP_USBHS_REV2:
501 omap->nports = 2;
502 break;
503 default:
504 omap->nports = OMAP3_HS_USB_PORTS;
505 dev_dbg(dev,
506 "USB HOST Rev : 0x%d not recognized, assuming %d ports\n",
507 omap->usbhs_rev, omap->nports);
508 break;
509 }
510
511 for (i = 0; i < omap->nports; i++)
487 if (is_ehci_phy_mode(i) || is_ehci_tll_mode(i) || 512 if (is_ehci_phy_mode(i) || is_ehci_tll_mode(i) ||
488 is_ehci_hsic_mode(i)) { 513 is_ehci_hsic_mode(i)) {
489 omap->ehci_logic_fck = clk_get(dev, "ehci_logic_fck"); 514 omap->ehci_logic_fck = clk_get(dev, "ehci_logic_fck");
@@ -573,8 +598,6 @@ static int usbhs_omap_probe(struct platform_device *pdev)
573 "failed error:%d\n", ret); 598 "failed error:%d\n", ret);
574 } 599 }
575 600
576 platform_set_drvdata(pdev, omap);
577
578 omap_usbhs_init(dev); 601 omap_usbhs_init(dev);
579 ret = omap_usbhs_alloc_children(pdev); 602 ret = omap_usbhs_alloc_children(pdev);
580 if (ret) { 603 if (ret) {