Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+28 -5
+28 -5
drivers/mfd/omap-usb-host.c
··· 91 91 92 92 93 93 struct usbhs_hcd_omap { 94 + int nports; 95 + 94 96 struct clk *xclk60mhsp1_ck; 95 97 struct clk *xclk60mhsp2_ck; 96 98 struct clk *utmi_p1_fck; ··· 349 347 350 348 pm_runtime_get_sync(dev); 351 349 spin_lock_irqsave(&omap->lock, flags); 352 - omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION); 353 - dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev); 354 350 355 351 reg = usbhs_read(omap->uhh_base, OMAP_UHH_HOSTCONFIG); 356 352 /* setup ULPI bypass and burst configurations */ ··· 483 483 484 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 512 if (is_ehci_phy_mode(i) || is_ehci_tll_mode(i) || 488 513 is_ehci_hsic_mode(i)) { 489 514 omap->ehci_logic_fck = clk_get(dev, "ehci_logic_fck"); ··· 597 572 dev_err(dev, "init_60m_fclk set parent" 598 573 "failed error:%d\n", ret); 599 574 } 600 - 601 - platform_set_drvdata(pdev, omap); 602 575 603 576 omap_usbhs_init(dev); 604 577 ret = omap_usbhs_alloc_children(pdev);