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()
174 xhci->quirks |= XHCI_PLAT; in xhci_histb_quirks()
199 struct device *dev = &pdev->dev; in xhci_histb_probe()
206 int ret = -ENODEV; in xhci_histb_probe()
209 return -ENODEV; in xhci_histb_probe()
214 return -ENOMEM; in xhci_histb_probe()
216 histb->dev = dev; in xhci_histb_probe()
222 histb->ctrl = devm_platform_get_and_ioremap_resource(pdev, 0, &res); in xhci_histb_probe()
223 if (IS_ERR(histb->ctrl)) in xhci_histb_probe()
224 return PTR_ERR(histb->ctrl); in xhci_histb_probe()
230 histb->soft_reset = devm_reset_control_get(dev, "soft"); in xhci_histb_probe()
231 if (IS_ERR(histb->soft_reset)) { in xhci_histb_probe()
233 return PTR_ERR(histb->soft_reset); in xhci_histb_probe()
240 /* Initialize dma_mask and coherent_dma_mask to 32-bits */ in xhci_histb_probe()
247 ret = -ENOMEM; in xhci_histb_probe()
251 hcd->regs = histb->ctrl; in xhci_histb_probe()
252 hcd->rsrc_start = res->start; in xhci_histb_probe()
253 hcd->rsrc_len = resource_size(res); in xhci_histb_probe()
255 histb->hcd = hcd; in xhci_histb_probe()
256 dev_set_drvdata(hcd->self.controller, histb); in xhci_histb_probe()
264 device_wakeup_enable(hcd->self.controller); in xhci_histb_probe()
266 xhci->main_hcd = hcd; in xhci_histb_probe()
267 xhci->shared_hcd = usb_create_shared_hcd(driver, dev, dev_name(dev), in xhci_histb_probe()
269 if (!xhci->shared_hcd) { in xhci_histb_probe()
270 ret = -ENOMEM; in xhci_histb_probe()
274 if (device_property_read_bool(dev, "usb2-lpm-disable")) in xhci_histb_probe()
275 xhci->quirks |= XHCI_HW_LPM_DISABLE; in xhci_histb_probe()
277 if (device_property_read_bool(dev, "usb3-lpm-capable")) in xhci_histb_probe()
278 xhci->quirks |= XHCI_LPM_SUPPORT; in xhci_histb_probe()
281 xhci->imod_interval = 40000; in xhci_histb_probe()
282 device_property_read_u32(dev, "imod-interval-ns", in xhci_histb_probe()
283 &xhci->imod_interval); in xhci_histb_probe()
289 if (HCC_MAX_PSA(xhci->hcc_params) >= 4) in xhci_histb_probe()
290 xhci->shared_hcd->can_do_streams = 1; in xhci_histb_probe()
292 ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED); in xhci_histb_probe()
310 usb_put_hcd(xhci->shared_hcd); in xhci_histb_probe()
325 struct usb_hcd *hcd = histb->hcd; in xhci_histb_remove()
327 struct usb_hcd *shared_hcd = xhci->shared_hcd; in xhci_histb_remove()
329 xhci->xhc_state |= XHCI_STATE_REMOVING; in xhci_histb_remove()
332 xhci->shared_hcd = NULL; in xhci_histb_remove()
333 device_wakeup_disable(&dev->dev); in xhci_histb_remove()
340 pm_runtime_put_sync(&dev->dev); in xhci_histb_remove()
341 pm_runtime_disable(&dev->dev); in xhci_histb_remove()
349 struct usb_hcd *hcd = histb->hcd; in xhci_histb_suspend()
364 struct usb_hcd *hcd = histb->hcd; in xhci_histb_resume()
380 { .compatible = "hisilicon,hi3798cv200-xhci"},
390 .name = "xhci-histb",
395 MODULE_ALIAS("platform:xhci-histb");