Lines Matching +full:usb2 +full:- +full:lpm +full:- +full:disable
1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 2017-2018 HiSilicon Co., Ltd. http://www.hisilicon.com
11 #include <linux/dma-mapping.h>
46 return dev_get_drvdata(hcd->self.controller); in hcd_to_histb()
51 struct device_node *np = histb->dev->of_node; in xhci_histb_config()
54 if (of_property_match_string(np, "phys-names", "inno") >= 0) { in xhci_histb_config()
55 /* USB2 PHY chose ulpi 8bit interface */ in xhci_histb_config()
56 regval = readl(histb->ctrl + REG_GUSB2PHYCFG0); in xhci_histb_config()
60 writel(regval, histb->ctrl + REG_GUSB2PHYCFG0); in xhci_histb_config()
63 if (of_property_match_string(np, "phys-names", "combo") >= 0) { in xhci_histb_config()
68 * GUSB3PIPECTL0[2:1] = 01 : Tx Deemphasis = -3.5dB, in xhci_histb_config()
71 regval = readl(histb->ctrl + REG_GUSB3PIPECTL0); in xhci_histb_config()
75 writel(regval, histb->ctrl + REG_GUSB3PIPECTL0); in xhci_histb_config()
78 writel(0x23100000, histb->ctrl + GTXTHRCFG); in xhci_histb_config()
79 writel(0x23100000, histb->ctrl + GRXTHRCFG); in xhci_histb_config()
86 struct device *dev = histb->dev; in xhci_histb_clks_get()
88 histb->bus_clk = devm_clk_get(dev, "bus"); in xhci_histb_clks_get()
89 if (IS_ERR(histb->bus_clk)) { in xhci_histb_clks_get()
91 return PTR_ERR(histb->bus_clk); in xhci_histb_clks_get()
94 histb->utmi_clk = devm_clk_get(dev, "utmi"); in xhci_histb_clks_get()
95 if (IS_ERR(histb->utmi_clk)) { in xhci_histb_clks_get()
97 return PTR_ERR(histb->utmi_clk); in xhci_histb_clks_get()
100 histb->pipe_clk = devm_clk_get(dev, "pipe"); in xhci_histb_clks_get()
101 if (IS_ERR(histb->pipe_clk)) { in xhci_histb_clks_get()
103 return PTR_ERR(histb->pipe_clk); in xhci_histb_clks_get()
106 histb->suspend_clk = devm_clk_get(dev, "suspend"); in xhci_histb_clks_get()
107 if (IS_ERR(histb->suspend_clk)) { in xhci_histb_clks_get()
109 return PTR_ERR(histb->suspend_clk); in xhci_histb_clks_get()
119 ret = clk_prepare_enable(histb->bus_clk); in xhci_histb_host_enable()
121 dev_err(histb->dev, "failed to enable bus clk\n"); in xhci_histb_host_enable()
125 ret = clk_prepare_enable(histb->utmi_clk); in xhci_histb_host_enable()
127 dev_err(histb->dev, "failed to enable utmi clk\n"); in xhci_histb_host_enable()
131 ret = clk_prepare_enable(histb->pipe_clk); in xhci_histb_host_enable()
133 dev_err(histb->dev, "failed to enable pipe clk\n"); in xhci_histb_host_enable()
137 ret = clk_prepare_enable(histb->suspend_clk); in xhci_histb_host_enable()
139 dev_err(histb->dev, "failed to enable suspend clk\n"); in xhci_histb_host_enable()
143 reset_control_deassert(histb->soft_reset); in xhci_histb_host_enable()
148 clk_disable_unprepare(histb->pipe_clk); in xhci_histb_host_enable()
150 clk_disable_unprepare(histb->utmi_clk); in xhci_histb_host_enable()
152 clk_disable_unprepare(histb->bus_clk); in xhci_histb_host_enable()
159 reset_control_assert(histb->soft_reset); in xhci_histb_host_disable()
161 clk_disable_unprepare(histb->suspend_clk); in xhci_histb_host_disable()
162 clk_disable_unprepare(histb->pipe_clk); in xhci_histb_host_disable()
163 clk_disable_unprepare(histb->utmi_clk); in xhci_histb_host_disable()
164 clk_disable_unprepare(histb->bus_clk); in xhci_histb_host_disable()
189 struct device *dev = &pdev->dev; in xhci_histb_probe()
196 int ret = -ENODEV; in xhci_histb_probe()
199 return -ENODEV; in xhci_histb_probe()
204 return -ENOMEM; in xhci_histb_probe()
206 histb->dev = dev; in xhci_histb_probe()
212 histb->ctrl = devm_platform_get_and_ioremap_resource(pdev, 0, &res); in xhci_histb_probe()
213 if (IS_ERR(histb->ctrl)) in xhci_histb_probe()
214 return PTR_ERR(histb->ctrl); in xhci_histb_probe()
220 histb->soft_reset = devm_reset_control_get(dev, "soft"); in xhci_histb_probe()
221 if (IS_ERR(histb->soft_reset)) { in xhci_histb_probe()
223 return PTR_ERR(histb->soft_reset); in xhci_histb_probe()
230 /* Initialize dma_mask and coherent_dma_mask to 32-bits */ in xhci_histb_probe()
237 ret = -ENOMEM; in xhci_histb_probe()
241 hcd->regs = histb->ctrl; in xhci_histb_probe()
242 hcd->rsrc_start = res->start; in xhci_histb_probe()
243 hcd->rsrc_len = resource_size(res); in xhci_histb_probe()
245 histb->hcd = hcd; in xhci_histb_probe()
246 dev_set_drvdata(hcd->self.controller, histb); in xhci_histb_probe()
254 device_wakeup_enable(hcd->self.controller); in xhci_histb_probe()
256 xhci->main_hcd = hcd; in xhci_histb_probe()
257 xhci->shared_hcd = usb_create_shared_hcd(driver, dev, dev_name(dev), in xhci_histb_probe()
259 if (!xhci->shared_hcd) { in xhci_histb_probe()
260 ret = -ENOMEM; in xhci_histb_probe()
264 if (device_property_read_bool(dev, "usb2-lpm-disable")) in xhci_histb_probe()
265 xhci->quirks |= XHCI_HW_LPM_DISABLE; in xhci_histb_probe()
267 if (device_property_read_bool(dev, "usb3-lpm-capable")) in xhci_histb_probe()
268 xhci->quirks |= XHCI_LPM_SUPPORT; in xhci_histb_probe()
271 xhci->imod_interval = 40000; in xhci_histb_probe()
272 device_property_read_u32(dev, "imod-interval-ns", in xhci_histb_probe()
273 &xhci->imod_interval); in xhci_histb_probe()
279 if (HCC_MAX_PSA(xhci->hcc_params) >= 4) in xhci_histb_probe()
280 xhci->shared_hcd->can_do_streams = 1; in xhci_histb_probe()
282 ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED); in xhci_histb_probe()
300 usb_put_hcd(xhci->shared_hcd); in xhci_histb_probe()
315 struct usb_hcd *hcd = histb->hcd; in xhci_histb_remove()
317 struct usb_hcd *shared_hcd = xhci->shared_hcd; in xhci_histb_remove()
319 xhci->xhc_state |= XHCI_STATE_REMOVING; in xhci_histb_remove()
322 xhci->shared_hcd = NULL; in xhci_histb_remove()
323 device_wakeup_disable(&dev->dev); in xhci_histb_remove()
330 pm_runtime_put_sync(&dev->dev); in xhci_histb_remove()
331 pm_runtime_disable(&dev->dev); in xhci_histb_remove()
337 struct usb_hcd *hcd = histb->hcd; in xhci_histb_suspend()
352 struct usb_hcd *hcd = histb->hcd; in xhci_histb_resume()
368 { .compatible = "hisilicon,hi3798cv200-xhci"},
378 .name = "xhci-histb",
383 MODULE_ALIAS("platform:xhci-histb");