Lines Matching +full:spurious +full:- +full:oc
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>
44 #define hcd_to_ehci_priv(h) ((struct ehci_platform_priv *)hcd_to_ehci(h)->priv)
59 struct platform_device *pdev = to_platform_device(hcd->self.controller); in ehci_platform_reset()
60 struct usb_ehci_pdata *pdata = dev_get_platdata(&pdev->dev); in ehci_platform_reset()
64 ehci->has_synopsys_hc_bug = pdata->has_synopsys_hc_bug; in ehci_platform_reset()
66 if (pdata->pre_setup) { in ehci_platform_reset()
67 retval = pdata->pre_setup(hcd); in ehci_platform_reset()
72 ehci->caps = hcd->regs + pdata->caps_offset; in ehci_platform_reset()
77 if (pdata->no_io_watchdog) in ehci_platform_reset()
78 ehci->need_io_watchdog = 0; in ehci_platform_reset()
80 if (of_device_is_compatible(pdev->dev.of_node, "brcm,xgs-iproc-ehci")) in ehci_platform_reset()
82 &ehci->regs->brcm_insnreg[1]); in ehci_platform_reset()
93 for (clk = 0; clk < EHCI_MAX_CLKS && priv->clks[clk]; clk++) { in ehci_platform_power_on()
94 ret = clk_prepare_enable(priv->clks[clk]); in ehci_platform_power_on()
102 while (--clk >= 0) in ehci_platform_power_on()
103 clk_disable_unprepare(priv->clks[clk]); in ehci_platform_power_on()
114 for (clk = EHCI_MAX_CLKS - 1; clk >= 0; 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()
249 return -ENODEV; in ehci_platform_probe()
258 dma_mask_64 = pdata->dma_mask_64; in ehci_platform_probe()
259 match = of_match_device(dev->dev.driver->of_match_table, &dev->dev); in ehci_platform_probe()
260 if (match && match->data) in ehci_platform_probe()
263 err = dma_coerce_mask_and_coherent(&dev->dev, in ehci_platform_probe()
266 dev_err(&dev->dev, "Error: DMA mask configuration failed\n"); in ehci_platform_probe()
274 hcd = usb_create_hcd(&ehci_platform_hc_driver, &dev->dev, in ehci_platform_probe()
275 dev_name(&dev->dev)); in ehci_platform_probe()
277 return -ENOMEM; in ehci_platform_probe()
280 dev->dev.platform_data = pdata; in ehci_platform_probe()
284 if (pdata == &ehci_platform_defaults && dev->dev.of_node) { in ehci_platform_probe()
285 if (of_property_read_bool(dev->dev.of_node, "big-endian-regs")) in ehci_platform_probe()
286 ehci->big_endian_mmio = 1; in ehci_platform_probe()
288 if (of_property_read_bool(dev->dev.of_node, "big-endian-desc")) in ehci_platform_probe()
289 ehci->big_endian_desc = 1; in ehci_platform_probe()
291 if (of_property_read_bool(dev->dev.of_node, "big-endian")) in ehci_platform_probe()
292 ehci->big_endian_mmio = ehci->big_endian_desc = 1; in ehci_platform_probe()
294 if (of_property_read_bool(dev->dev.of_node, "spurious-oc")) in ehci_platform_probe()
295 ehci->spurious_oc = 1; in ehci_platform_probe()
297 if (of_property_read_bool(dev->dev.of_node, in ehci_platform_probe()
298 "needs-reset-on-resume")) in ehci_platform_probe()
299 priv->reset_on_resume = true; in ehci_platform_probe()
301 if (of_property_read_bool(dev->dev.of_node, in ehci_platform_probe()
302 "has-transaction-translator")) in ehci_platform_probe()
303 hcd->has_tt = 1; in ehci_platform_probe()
305 if (of_device_is_compatible(dev->dev.of_node, in ehci_platform_probe()
306 "aspeed,ast2500-ehci") || in ehci_platform_probe()
307 of_device_is_compatible(dev->dev.of_node, in ehci_platform_probe()
308 "aspeed,ast2600-ehci") || in ehci_platform_probe()
309 of_device_is_compatible(dev->dev.of_node, in ehci_platform_probe()
310 "aspeed,ast2700-ehci")) in ehci_platform_probe()
311 ehci->is_aspeed = 1; in ehci_platform_probe()
314 priv->quirk_poll = true; in ehci_platform_probe()
317 priv->clks[clk] = of_clk_get(dev->dev.of_node, clk); in ehci_platform_probe()
318 if (IS_ERR(priv->clks[clk])) { in ehci_platform_probe()
319 err = PTR_ERR(priv->clks[clk]); in ehci_platform_probe()
320 if (err == -EPROBE_DEFER) in ehci_platform_probe()
322 priv->clks[clk] = NULL; in ehci_platform_probe()
328 priv->rsts = devm_reset_control_array_get_optional_shared(&dev->dev); in ehci_platform_probe()
329 if (IS_ERR(priv->rsts)) { in ehci_platform_probe()
330 err = PTR_ERR(priv->rsts); in ehci_platform_probe()
334 err = reset_control_deassert(priv->rsts); in ehci_platform_probe()
338 if (pdata->big_endian_desc) in ehci_platform_probe()
339 ehci->big_endian_desc = 1; in ehci_platform_probe()
340 if (pdata->big_endian_mmio) in ehci_platform_probe()
341 ehci->big_endian_mmio = 1; in ehci_platform_probe()
342 if (pdata->has_tt) in ehci_platform_probe()
343 hcd->has_tt = 1; in ehci_platform_probe()
344 if (pdata->reset_on_resume) in ehci_platform_probe()
345 priv->reset_on_resume = true; in ehci_platform_probe()
346 if (pdata->spurious_oc) in ehci_platform_probe()
347 ehci->spurious_oc = 1; in ehci_platform_probe()
350 if (ehci->big_endian_mmio) { in ehci_platform_probe()
351 dev_err(&dev->dev, in ehci_platform_probe()
353 err = -EINVAL; in ehci_platform_probe()
358 if (ehci->big_endian_desc) { in ehci_platform_probe()
359 dev_err(&dev->dev, in ehci_platform_probe()
361 err = -EINVAL; in ehci_platform_probe()
366 if (pdata->power_on) { in ehci_platform_probe()
367 err = pdata->power_on(dev); in ehci_platform_probe()
372 hcd->regs = devm_platform_get_and_ioremap_resource(dev, 0, &res_mem); in ehci_platform_probe()
373 if (IS_ERR(hcd->regs)) { in ehci_platform_probe()
374 err = PTR_ERR(hcd->regs); in ehci_platform_probe()
377 hcd->rsrc_start = res_mem->start; in ehci_platform_probe()
378 hcd->rsrc_len = resource_size(res_mem); in ehci_platform_probe()
380 hcd->tpl_support = of_usb_host_tpl_support(dev->dev.of_node); in ehci_platform_probe()
386 device_wakeup_enable(hcd->self.controller); in ehci_platform_probe()
387 device_enable_async_suspend(hcd->self.controller); in ehci_platform_probe()
390 if (priv->quirk_poll) in ehci_platform_probe()
396 if (pdata->power_off) in ehci_platform_probe()
397 pdata->power_off(dev); in ehci_platform_probe()
399 reset_control_assert(priv->rsts); in ehci_platform_probe()
401 while (--clk >= 0) in ehci_platform_probe()
402 clk_put(priv->clks[clk]); in ehci_platform_probe()
405 dev->dev.platform_data = NULL; in ehci_platform_probe()
415 struct usb_ehci_pdata *pdata = dev_get_platdata(&dev->dev); in ehci_platform_remove()
419 if (priv->quirk_poll) in ehci_platform_remove()
424 if (pdata->power_off) in ehci_platform_remove()
425 pdata->power_off(dev); in ehci_platform_remove()
427 reset_control_assert(priv->rsts); in ehci_platform_remove()
429 for (clk = 0; clk < EHCI_MAX_CLKS && priv->clks[clk]; clk++) in ehci_platform_remove()
430 clk_put(priv->clks[clk]); in ehci_platform_remove()
435 dev->dev.platform_data = NULL; in ehci_platform_remove()
447 if (priv->quirk_poll) in ehci_platform_suspend()
454 if (pdata->power_suspend) in ehci_platform_suspend()
455 pdata->power_suspend(pdev); in ehci_platform_suspend()
457 ret = reset_control_assert(priv->rsts); in ehci_platform_suspend()
459 if (pdata->power_on) in ehci_platform_suspend()
460 pdata->power_on(pdev); in ehci_platform_suspend()
464 if (priv->quirk_poll) in ehci_platform_suspend()
480 err = reset_control_deassert(priv->rsts); in ehci_platform_resume()
484 if (pdata->power_on) { in ehci_platform_resume()
485 err = pdata->power_on(pdev); in ehci_platform_resume()
487 reset_control_assert(priv->rsts); in ehci_platform_resume()
492 companion_dev = usb_of_get_companion_dev(hcd->self.controller); in ehci_platform_resume()
494 device_pm_wait_for_dev(hcd->self.controller, companion_dev); in ehci_platform_resume()
498 ehci_resume(hcd, priv->reset_on_resume); in ehci_platform_resume()
504 if (priv->quirk_poll) in ehci_platform_resume()
511 { .compatible = "via,vt8500-ehci", },
512 { .compatible = "wm,prizm-ehci", },
513 { .compatible = "generic-ehci", },
514 { .compatible = "cavium,octeon-6335-ehci", },
515 { .compatible = "aspeed,ast2700-ehci", .data = (void *)1 },
529 { "ehci-platform", 0 },
543 .name = "ehci-platform",
554 return -ENODEV; in ehci_platform_init()