Lines Matching full:omap

3  * omap-usb-host.c - The USBHS core driver for OMAP EHCI & OHCI
17 #include <linux/platform_data/usb-omap.h>
23 #include "omap-usb.h"
26 #define OMAP_EHCI_DEVICE "ehci-omap"
29 /* OMAP USBHOST Register addresses */
123 * Map 'enum usbhs_omap_port_mode' found in <linux/platform_data/usb-omap.h>
125 * 'Documentation/devicetree/bindings/mfd/omap-usb-host.txt'
279 struct usbhs_hcd_omap *omap = dev_get_drvdata(dev); in usbhs_runtime_resume() local
280 struct usbhs_omap_platform_data *pdata = omap->pdata; in usbhs_runtime_resume()
287 if (!IS_ERR(omap->ehci_logic_fck)) in usbhs_runtime_resume()
288 clk_prepare_enable(omap->ehci_logic_fck); in usbhs_runtime_resume()
290 for (i = 0; i < omap->nports; i++) { in usbhs_runtime_resume()
293 if (!IS_ERR(omap->hsic60m_clk[i])) { in usbhs_runtime_resume()
294 r = clk_prepare_enable(omap->hsic60m_clk[i]); in usbhs_runtime_resume()
302 if (!IS_ERR(omap->hsic480m_clk[i])) { in usbhs_runtime_resume()
303 r = clk_prepare_enable(omap->hsic480m_clk[i]); in usbhs_runtime_resume()
313 if (!IS_ERR(omap->utmi_clk[i])) { in usbhs_runtime_resume()
314 r = clk_prepare_enable(omap->utmi_clk[i]); in usbhs_runtime_resume()
332 struct usbhs_hcd_omap *omap = dev_get_drvdata(dev); in usbhs_runtime_suspend() local
333 struct usbhs_omap_platform_data *pdata = omap->pdata; in usbhs_runtime_suspend()
338 for (i = 0; i < omap->nports; i++) { in usbhs_runtime_suspend()
341 if (!IS_ERR(omap->hsic60m_clk[i])) in usbhs_runtime_suspend()
342 clk_disable_unprepare(omap->hsic60m_clk[i]); in usbhs_runtime_suspend()
344 if (!IS_ERR(omap->hsic480m_clk[i])) in usbhs_runtime_suspend()
345 clk_disable_unprepare(omap->hsic480m_clk[i]); in usbhs_runtime_suspend()
349 if (!IS_ERR(omap->utmi_clk[i])) in usbhs_runtime_suspend()
350 clk_disable_unprepare(omap->utmi_clk[i]); in usbhs_runtime_suspend()
357 if (!IS_ERR(omap->ehci_logic_fck)) in usbhs_runtime_suspend()
358 clk_disable_unprepare(omap->ehci_logic_fck); in usbhs_runtime_suspend()
365 static unsigned omap_usbhs_rev1_hostconfig(struct usbhs_hcd_omap *omap, in omap_usbhs_rev1_hostconfig() argument
368 struct usbhs_omap_platform_data *pdata = omap->pdata; in omap_usbhs_rev1_hostconfig()
371 for (i = 0; i < omap->nports; i++) { in omap_usbhs_rev1_hostconfig()
403 for (i = 0; i < omap->nports; i++) { in omap_usbhs_rev1_hostconfig()
414 static unsigned omap_usbhs_rev2_hostconfig(struct usbhs_hcd_omap *omap, in omap_usbhs_rev2_hostconfig() argument
417 struct usbhs_omap_platform_data *pdata = omap->pdata; in omap_usbhs_rev2_hostconfig()
420 for (i = 0; i < omap->nports; i++) { in omap_usbhs_rev2_hostconfig()
436 struct usbhs_hcd_omap *omap = dev_get_drvdata(dev); in omap_usbhs_init() local
443 reg = usbhs_read(omap->uhh_base, OMAP_UHH_HOSTCONFIG); in omap_usbhs_init()
451 switch (omap->usbhs_rev) { in omap_usbhs_init()
453 reg = omap_usbhs_rev1_hostconfig(omap, reg); in omap_usbhs_init()
457 reg = omap_usbhs_rev2_hostconfig(omap, reg); in omap_usbhs_init()
461 reg = omap_usbhs_rev2_hostconfig(omap, reg); in omap_usbhs_init()
465 usbhs_write(omap->uhh_base, OMAP_UHH_HOSTCONFIG, reg); in omap_usbhs_init()
519 { .compatible = "ti,ehci-omap", },
535 struct usbhs_hcd_omap *omap; in usbhs_omap_probe() local
564 omap = devm_kzalloc(dev, sizeof(*omap), GFP_KERNEL); in usbhs_omap_probe()
565 if (!omap) { in usbhs_omap_probe()
570 omap->uhh_base = devm_platform_ioremap_resource(pdev, 0); in usbhs_omap_probe()
571 if (IS_ERR(omap->uhh_base)) in usbhs_omap_probe()
572 return PTR_ERR(omap->uhh_base); in usbhs_omap_probe()
574 omap->pdata = pdata; in usbhs_omap_probe()
581 platform_set_drvdata(pdev, omap); in usbhs_omap_probe()
584 omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION); in usbhs_omap_probe()
586 /* we need to call runtime suspend before we update omap->nports in usbhs_omap_probe()
596 omap->nports = pdata->nports; in usbhs_omap_probe()
598 switch (omap->usbhs_rev) { in usbhs_omap_probe()
600 omap->nports = 3; in usbhs_omap_probe()
603 omap->nports = 2; in usbhs_omap_probe()
606 omap->nports = OMAP3_HS_USB_PORTS; in usbhs_omap_probe()
609 omap->usbhs_rev, omap->nports); in usbhs_omap_probe()
612 pdata->nports = omap->nports; in usbhs_omap_probe()
615 i = sizeof(struct clk *) * omap->nports; in usbhs_omap_probe()
616 omap->utmi_clk = devm_kzalloc(dev, i, GFP_KERNEL); in usbhs_omap_probe()
617 omap->hsic480m_clk = devm_kzalloc(dev, i, GFP_KERNEL); in usbhs_omap_probe()
618 omap->hsic60m_clk = devm_kzalloc(dev, i, GFP_KERNEL); in usbhs_omap_probe()
620 if (!omap->utmi_clk || !omap->hsic480m_clk || !omap->hsic60m_clk) { in usbhs_omap_probe()
627 omap->ehci_logic_fck = ERR_PTR(-ENODEV); in usbhs_omap_probe()
628 omap->init_60m_fclk = ERR_PTR(-ENODEV); in usbhs_omap_probe()
629 omap->utmi_p1_gfclk = ERR_PTR(-ENODEV); in usbhs_omap_probe()
630 omap->utmi_p2_gfclk = ERR_PTR(-ENODEV); in usbhs_omap_probe()
631 omap->xclk60mhsp1_ck = ERR_PTR(-ENODEV); in usbhs_omap_probe()
632 omap->xclk60mhsp2_ck = ERR_PTR(-ENODEV); in usbhs_omap_probe()
634 for (i = 0; i < omap->nports; i++) { in usbhs_omap_probe()
635 omap->utmi_clk[i] = ERR_PTR(-ENODEV); in usbhs_omap_probe()
636 omap->hsic480m_clk[i] = ERR_PTR(-ENODEV); in usbhs_omap_probe()
637 omap->hsic60m_clk[i] = ERR_PTR(-ENODEV); in usbhs_omap_probe()
641 if (omap->usbhs_rev == OMAP_USBHS_REV1) { in usbhs_omap_probe()
643 for (i = 0; i < omap->nports; i++) { in usbhs_omap_probe()
652 omap->ehci_logic_fck = devm_clk_get(dev, in usbhs_omap_probe()
654 if (IS_ERR(omap->ehci_logic_fck)) { in usbhs_omap_probe()
655 ret = PTR_ERR(omap->ehci_logic_fck); in usbhs_omap_probe()
665 omap->utmi_p1_gfclk = devm_clk_get(dev, "utmi_p1_gfclk"); in usbhs_omap_probe()
666 if (IS_ERR(omap->utmi_p1_gfclk)) { in usbhs_omap_probe()
667 ret = PTR_ERR(omap->utmi_p1_gfclk); in usbhs_omap_probe()
672 omap->utmi_p2_gfclk = devm_clk_get(dev, "utmi_p2_gfclk"); in usbhs_omap_probe()
673 if (IS_ERR(omap->utmi_p2_gfclk)) { in usbhs_omap_probe()
674 ret = PTR_ERR(omap->utmi_p2_gfclk); in usbhs_omap_probe()
679 omap->xclk60mhsp1_ck = devm_clk_get(dev, "refclk_60m_ext_p1"); in usbhs_omap_probe()
680 if (IS_ERR(omap->xclk60mhsp1_ck)) { in usbhs_omap_probe()
681 ret = PTR_ERR(omap->xclk60mhsp1_ck); in usbhs_omap_probe()
686 omap->xclk60mhsp2_ck = devm_clk_get(dev, "refclk_60m_ext_p2"); in usbhs_omap_probe()
687 if (IS_ERR(omap->xclk60mhsp2_ck)) { in usbhs_omap_probe()
688 ret = PTR_ERR(omap->xclk60mhsp2_ck); in usbhs_omap_probe()
693 omap->init_60m_fclk = devm_clk_get(dev, "refclk_60m_int"); in usbhs_omap_probe()
694 if (IS_ERR(omap->init_60m_fclk)) { in usbhs_omap_probe()
695 ret = PTR_ERR(omap->init_60m_fclk); in usbhs_omap_probe()
700 for (i = 0; i < omap->nports; i++) { in usbhs_omap_probe()
711 omap->utmi_clk[i] = devm_clk_get(dev, clkname); in usbhs_omap_probe()
712 if (IS_ERR(omap->utmi_clk[i])) { in usbhs_omap_probe()
713 ret = PTR_ERR(omap->utmi_clk[i]); in usbhs_omap_probe()
721 omap->hsic480m_clk[i] = devm_clk_get(dev, clkname); in usbhs_omap_probe()
722 if (IS_ERR(omap->hsic480m_clk[i])) { in usbhs_omap_probe()
723 ret = PTR_ERR(omap->hsic480m_clk[i]); in usbhs_omap_probe()
731 omap->hsic60m_clk[i] = devm_clk_get(dev, clkname); in usbhs_omap_probe()
732 if (IS_ERR(omap->hsic60m_clk[i])) { in usbhs_omap_probe()
733 ret = PTR_ERR(omap->hsic60m_clk[i]); in usbhs_omap_probe()
741 ret = clk_set_parent(omap->utmi_p1_gfclk, in usbhs_omap_probe()
742 omap->xclk60mhsp1_ck); in usbhs_omap_probe()
749 ret = clk_set_parent(omap->utmi_p1_gfclk, in usbhs_omap_probe()
750 omap->init_60m_fclk); in usbhs_omap_probe()
759 ret = clk_set_parent(omap->utmi_p2_gfclk, in usbhs_omap_probe()
760 omap->xclk60mhsp2_ck); in usbhs_omap_probe()
767 ret = clk_set_parent(omap->utmi_p2_gfclk, in usbhs_omap_probe()
768 omap->init_60m_fclk); in usbhs_omap_probe()
852 MODULE_DESCRIPTION("usb host common core driver for omap EHCI and OHCI");
862 * the omap ehci and ohci probe functions are called.