• Home
  • Raw
  • Download

Lines Matching +full:usb +full:- +full:ehci

1 // SPDX-License-Identifier: GPL-2.0+
13 #include <linux/usb/otg.h>
14 #include <linux/usb/ulpi.h>
16 #include <linux/usb.h>
17 #include <linux/usb/hcd.h>
18 #include <linux/platform_data/usb-ehci-mxc.h>
19 #include "ehci.h"
21 #define DRIVER_DESC "Freescale On-Chip EHCI Host driver"
23 static const char hcd_name[] = "ehci-mxc";
39 struct device *dev = &pdev->dev; in ehci_mxc_drv_probe()
45 struct ehci_hcd *ehci; in ehci_mxc_drv_probe() local
49 return -EINVAL; in ehci_mxc_drv_probe()
58 return -ENOMEM; in ehci_mxc_drv_probe()
61 hcd->regs = devm_ioremap_resource(dev, res); in ehci_mxc_drv_probe()
62 if (IS_ERR(hcd->regs)) { in ehci_mxc_drv_probe()
63 ret = PTR_ERR(hcd->regs); in ehci_mxc_drv_probe()
66 hcd->rsrc_start = res->start; in ehci_mxc_drv_probe()
67 hcd->rsrc_len = resource_size(res); in ehci_mxc_drv_probe()
69 hcd->has_tt = 1; in ehci_mxc_drv_probe()
70 ehci = hcd_to_ehci(hcd); in ehci_mxc_drv_probe()
71 priv = (struct ehci_mxc_priv *) ehci->priv; in ehci_mxc_drv_probe()
74 priv->usbclk = devm_clk_get(dev, "ipg"); in ehci_mxc_drv_probe()
75 if (IS_ERR(priv->usbclk)) { in ehci_mxc_drv_probe()
76 ret = PTR_ERR(priv->usbclk); in ehci_mxc_drv_probe()
79 clk_prepare_enable(priv->usbclk); in ehci_mxc_drv_probe()
81 priv->ahbclk = devm_clk_get(dev, "ahb"); in ehci_mxc_drv_probe()
82 if (IS_ERR(priv->ahbclk)) { in ehci_mxc_drv_probe()
83 ret = PTR_ERR(priv->ahbclk); in ehci_mxc_drv_probe()
86 clk_prepare_enable(priv->ahbclk); in ehci_mxc_drv_probe()
89 priv->phyclk = devm_clk_get(dev, "phy"); in ehci_mxc_drv_probe()
90 if (IS_ERR(priv->phyclk)) in ehci_mxc_drv_probe()
91 priv->phyclk = NULL; in ehci_mxc_drv_probe()
92 if (priv->phyclk) in ehci_mxc_drv_probe()
93 clk_prepare_enable(priv->phyclk); in ehci_mxc_drv_probe()
96 if (pdata->init) { in ehci_mxc_drv_probe()
97 ret = pdata->init(pdev); in ehci_mxc_drv_probe()
106 /* EHCI registers start at offset 0x100 */ in ehci_mxc_drv_probe()
107 ehci->caps = hcd->regs + 0x100; in ehci_mxc_drv_probe()
108 ehci->regs = hcd->regs + 0x100 + in ehci_mxc_drv_probe()
109 HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase)); in ehci_mxc_drv_probe()
112 ehci_writel(ehci, pdata->portsc, &ehci->regs->port_status[0]); in ehci_mxc_drv_probe()
118 if (pdata->otg) { in ehci_mxc_drv_probe()
119 pdata->otg->io_priv = hcd->regs + ULPI_VIEWPORT_OFFSET; in ehci_mxc_drv_probe()
120 ret = usb_phy_init(pdata->otg); in ehci_mxc_drv_probe()
123 ret = -ENODEV; in ehci_mxc_drv_probe()
126 ret = otg_set_vbus(pdata->otg->otg, 1); in ehci_mxc_drv_probe()
139 device_wakeup_enable(hcd->self.controller); in ehci_mxc_drv_probe()
143 if (pdata && pdata->exit) in ehci_mxc_drv_probe()
144 pdata->exit(pdev); in ehci_mxc_drv_probe()
146 if (priv->phyclk) in ehci_mxc_drv_probe()
147 clk_disable_unprepare(priv->phyclk); in ehci_mxc_drv_probe()
149 clk_disable_unprepare(priv->ahbclk); in ehci_mxc_drv_probe()
151 clk_disable_unprepare(priv->usbclk); in ehci_mxc_drv_probe()
159 struct mxc_usbh_platform_data *pdata = dev_get_platdata(&pdev->dev); in ehci_mxc_drv_remove()
161 struct ehci_hcd *ehci = hcd_to_ehci(hcd); in ehci_mxc_drv_remove() local
162 struct ehci_mxc_priv *priv = (struct ehci_mxc_priv *) ehci->priv; in ehci_mxc_drv_remove()
166 if (pdata && pdata->exit) in ehci_mxc_drv_remove()
167 pdata->exit(pdev); in ehci_mxc_drv_remove()
169 if (pdata && pdata->otg) in ehci_mxc_drv_remove()
170 usb_phy_shutdown(pdata->otg); in ehci_mxc_drv_remove()
172 clk_disable_unprepare(priv->usbclk); in ehci_mxc_drv_remove()
173 clk_disable_unprepare(priv->ahbclk); in ehci_mxc_drv_remove()
175 if (priv->phyclk) in ehci_mxc_drv_remove()
176 clk_disable_unprepare(priv->phyclk); in ehci_mxc_drv_remove()
182 MODULE_ALIAS("platform:mxc-ehci");
189 .name = "mxc-ehci",
196 return -ENODEV; in ehci_mxc_init()