Lines Matching +full:has +full:- +full:transaction +full:- +full:translator
1 // SPDX-License-Identifier: GPL-2.0
6 * Copyright 2010-2012 Hauke Mehrtens <hauke@hauke-m.de>
9 * Derived from the ohci-ssb driver
12 * Derived from the EHCI-PCI driver
13 * Copyright (c) 2000-2004 by David Brownell
15 * Derived from the ohci-pci driver
17 * Copyright 2000-2002 David Brownell
23 #include <linux/dma-mapping.h>
43 #define hcd_to_ehci_priv(h) ((struct ehci_platform_priv *)hcd_to_ehci(h)->priv)
58 struct platform_device *pdev = to_platform_device(hcd->self.controller); in ehci_platform_reset()
59 struct usb_ehci_pdata *pdata = dev_get_platdata(&pdev->dev); in ehci_platform_reset()
63 ehci->has_synopsys_hc_bug = pdata->has_synopsys_hc_bug; in ehci_platform_reset()
65 if (pdata->pre_setup) { in ehci_platform_reset()
66 retval = pdata->pre_setup(hcd); in ehci_platform_reset()
71 ehci->caps = hcd->regs + pdata->caps_offset; in ehci_platform_reset()
76 if (pdata->no_io_watchdog) in ehci_platform_reset()
77 ehci->need_io_watchdog = 0; in ehci_platform_reset()
79 if (of_device_is_compatible(pdev->dev.of_node, "brcm,xgs-iproc-ehci")) in ehci_platform_reset()
81 &ehci->regs->brcm_insnreg[1]); in ehci_platform_reset()
92 for (clk = 0; clk < EHCI_MAX_CLKS && priv->clks[clk]; clk++) { in ehci_platform_power_on()
93 ret = clk_prepare_enable(priv->clks[clk]); in ehci_platform_power_on()
101 while (--clk >= 0) in ehci_platform_power_on()
102 clk_disable_unprepare(priv->clks[clk]); in ehci_platform_power_on()
113 for (clk = EHCI_MAX_CLKS - 1; clk >= 0; clk--) in ehci_platform_power_off()
114 if (priv->clks[clk]) in ehci_platform_power_off()
115 clk_disable_unprepare(priv->clks[clk]); in ehci_platform_power_off()
132 * quirk_poll_check_port_status - Poll port_status if the device sticks
135 * Since EHCI/OHCI controllers on R-Car Gen3 SoCs are possible to be getting
144 u32 port_status = ehci_readl(ehci, &ehci->regs->port_status[0]); in quirk_poll_check_port_status()
156 * quirk_poll_rebind_companion - rebind comanion device to recover
159 * Since EHCI/OHCI controllers on R-Car Gen3 SoCs are possible to be getting
169 companion_dev = usb_of_get_companion_dev(hcd->self.controller); in quirk_poll_rebind_companion()
213 schedule_delayed_work(&priv->poll_work, msecs_to_jiffies(5)); in quirk_poll_timer()
216 mod_timer(&priv->poll_timer, jiffies + HZ); in quirk_poll_timer()
221 INIT_DELAYED_WORK(&priv->poll_work, quirk_poll_work); in quirk_poll_init()
222 timer_setup(&priv->poll_timer, quirk_poll_timer, 0); in quirk_poll_init()
223 mod_timer(&priv->poll_timer, jiffies + HZ); in quirk_poll_init()
228 timer_delete_sync(&priv->poll_timer); in quirk_poll_end()
229 cancel_delayed_work(&priv->poll_work); in quirk_poll_end()
233 { .family = "R-Car Gen3" },
241 struct usb_ehci_pdata *pdata = dev_get_platdata(&dev->dev); in ehci_platform_probe()
247 return -ENODEV; in ehci_platform_probe()
256 err = dma_coerce_mask_and_coherent(&dev->dev, in ehci_platform_probe()
257 pdata->dma_mask_64 ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32)); in ehci_platform_probe()
259 dev_err(&dev->dev, "Error: DMA mask configuration failed\n"); in ehci_platform_probe()
267 hcd = usb_create_hcd(&ehci_platform_hc_driver, &dev->dev, in ehci_platform_probe()
268 dev_name(&dev->dev)); in ehci_platform_probe()
270 return -ENOMEM; in ehci_platform_probe()
273 dev->dev.platform_data = pdata; in ehci_platform_probe()
277 if (pdata == &ehci_platform_defaults && dev->dev.of_node) { in ehci_platform_probe()
278 if (of_property_read_bool(dev->dev.of_node, "big-endian-regs")) in ehci_platform_probe()
279 ehci->big_endian_mmio = 1; in ehci_platform_probe()
281 if (of_property_read_bool(dev->dev.of_node, "big-endian-desc")) in ehci_platform_probe()
282 ehci->big_endian_desc = 1; in ehci_platform_probe()
284 if (of_property_read_bool(dev->dev.of_node, "big-endian")) in ehci_platform_probe()
285 ehci->big_endian_mmio = ehci->big_endian_desc = 1; in ehci_platform_probe()
287 if (of_property_read_bool(dev->dev.of_node, "spurious-oc")) in ehci_platform_probe()
288 ehci->spurious_oc = 1; in ehci_platform_probe()
290 if (of_property_read_bool(dev->dev.of_node, in ehci_platform_probe()
291 "needs-reset-on-resume")) in ehci_platform_probe()
292 priv->reset_on_resume = true; in ehci_platform_probe()
294 if (of_property_read_bool(dev->dev.of_node, in ehci_platform_probe()
295 "has-transaction-translator")) in ehci_platform_probe()
296 hcd->has_tt = 1; in ehci_platform_probe()
298 if (of_device_is_compatible(dev->dev.of_node, in ehci_platform_probe()
299 "aspeed,ast2500-ehci") || in ehci_platform_probe()
300 of_device_is_compatible(dev->dev.of_node, in ehci_platform_probe()
301 "aspeed,ast2600-ehci")) in ehci_platform_probe()
302 ehci->is_aspeed = 1; in ehci_platform_probe()
305 priv->quirk_poll = true; in ehci_platform_probe()
308 priv->clks[clk] = of_clk_get(dev->dev.of_node, clk); in ehci_platform_probe()
309 if (IS_ERR(priv->clks[clk])) { in ehci_platform_probe()
310 err = PTR_ERR(priv->clks[clk]); in ehci_platform_probe()
311 if (err == -EPROBE_DEFER) in ehci_platform_probe()
313 priv->clks[clk] = NULL; in ehci_platform_probe()
319 priv->rsts = devm_reset_control_array_get_optional_shared(&dev->dev); in ehci_platform_probe()
320 if (IS_ERR(priv->rsts)) { in ehci_platform_probe()
321 err = PTR_ERR(priv->rsts); in ehci_platform_probe()
325 err = reset_control_deassert(priv->rsts); in ehci_platform_probe()
329 if (pdata->big_endian_desc) in ehci_platform_probe()
330 ehci->big_endian_desc = 1; in ehci_platform_probe()
331 if (pdata->big_endian_mmio) in ehci_platform_probe()
332 ehci->big_endian_mmio = 1; in ehci_platform_probe()
333 if (pdata->has_tt) in ehci_platform_probe()
334 hcd->has_tt = 1; in ehci_platform_probe()
335 if (pdata->reset_on_resume) in ehci_platform_probe()
336 priv->reset_on_resume = true; in ehci_platform_probe()
337 if (pdata->spurious_oc) in ehci_platform_probe()
338 ehci->spurious_oc = 1; in ehci_platform_probe()
341 if (ehci->big_endian_mmio) { in ehci_platform_probe()
342 dev_err(&dev->dev, in ehci_platform_probe()
344 err = -EINVAL; in ehci_platform_probe()
349 if (ehci->big_endian_desc) { in ehci_platform_probe()
350 dev_err(&dev->dev, in ehci_platform_probe()
352 err = -EINVAL; in ehci_platform_probe()
357 if (pdata->power_on) { in ehci_platform_probe()
358 err = pdata->power_on(dev); in ehci_platform_probe()
363 hcd->regs = devm_platform_get_and_ioremap_resource(dev, 0, &res_mem); in ehci_platform_probe()
364 if (IS_ERR(hcd->regs)) { in ehci_platform_probe()
365 err = PTR_ERR(hcd->regs); in ehci_platform_probe()
368 hcd->rsrc_start = res_mem->start; in ehci_platform_probe()
369 hcd->rsrc_len = resource_size(res_mem); in ehci_platform_probe()
371 hcd->tpl_support = of_usb_host_tpl_support(dev->dev.of_node); in ehci_platform_probe()
377 device_wakeup_enable(hcd->self.controller); in ehci_platform_probe()
378 device_enable_async_suspend(hcd->self.controller); in ehci_platform_probe()
381 if (priv->quirk_poll) in ehci_platform_probe()
387 if (pdata->power_off) in ehci_platform_probe()
388 pdata->power_off(dev); in ehci_platform_probe()
390 reset_control_assert(priv->rsts); in ehci_platform_probe()
392 while (--clk >= 0) in ehci_platform_probe()
393 clk_put(priv->clks[clk]); in ehci_platform_probe()
396 dev->dev.platform_data = NULL; in ehci_platform_probe()
406 struct usb_ehci_pdata *pdata = dev_get_platdata(&dev->dev); in ehci_platform_remove()
410 if (priv->quirk_poll) in ehci_platform_remove()
415 if (pdata->power_off) in ehci_platform_remove()
416 pdata->power_off(dev); in ehci_platform_remove()
418 reset_control_assert(priv->rsts); in ehci_platform_remove()
420 for (clk = 0; clk < EHCI_MAX_CLKS && priv->clks[clk]; clk++) in ehci_platform_remove()
421 clk_put(priv->clks[clk]); in ehci_platform_remove()
426 dev->dev.platform_data = NULL; in ehci_platform_remove()
438 if (priv->quirk_poll) in ehci_platform_suspend()
445 if (pdata->power_suspend) in ehci_platform_suspend()
446 pdata->power_suspend(pdev); in ehci_platform_suspend()
459 if (pdata->power_on) { in ehci_platform_resume()
460 int err = pdata->power_on(pdev); in ehci_platform_resume()
465 companion_dev = usb_of_get_companion_dev(hcd->self.controller); in ehci_platform_resume()
467 device_pm_wait_for_dev(hcd->self.controller, companion_dev); in ehci_platform_resume()
471 ehci_resume(hcd, priv->reset_on_resume); in ehci_platform_resume()
477 if (priv->quirk_poll) in ehci_platform_resume()
484 { .compatible = "via,vt8500-ehci", },
485 { .compatible = "wm,prizm-ehci", },
486 { .compatible = "generic-ehci", },
487 { .compatible = "cavium,octeon-6335-ehci", },
501 { "ehci-platform", 0 },
515 .name = "ehci-platform",
526 return -ENODEV; in ehci_platform_init()