Lines Matching +full:big +full:- +full:endian +full:- +full:desc

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()
212 schedule_delayed_work(&priv->poll_work, msecs_to_jiffies(5)); in quirk_poll_timer()
215 mod_timer(&priv->poll_timer, jiffies + HZ); in quirk_poll_timer()
220 INIT_DELAYED_WORK(&priv->poll_work, quirk_poll_work); in quirk_poll_init()
221 timer_setup(&priv->poll_timer, quirk_poll_timer, 0); in quirk_poll_init()
222 mod_timer(&priv->poll_timer, jiffies + HZ); in quirk_poll_init()
227 del_timer_sync(&priv->poll_timer); in quirk_poll_end()
228 cancel_delayed_work(&priv->poll_work); in quirk_poll_end()
232 { .family = "R-Car Gen3" },
240 struct usb_ehci_pdata *pdata = dev_get_platdata(&dev->dev); in ehci_platform_probe()
246 return -ENODEV; in ehci_platform_probe()
255 err = dma_coerce_mask_and_coherent(&dev->dev, in ehci_platform_probe()
256 pdata->dma_mask_64 ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32)); in ehci_platform_probe()
258 dev_err(&dev->dev, "Error: DMA mask configuration failed\n"); in ehci_platform_probe()
266 hcd = usb_create_hcd(&ehci_platform_hc_driver, &dev->dev, in ehci_platform_probe()
267 dev_name(&dev->dev)); in ehci_platform_probe()
269 return -ENOMEM; in ehci_platform_probe()
272 dev->dev.platform_data = pdata; in ehci_platform_probe()
276 if (pdata == &ehci_platform_defaults && dev->dev.of_node) { in ehci_platform_probe()
277 if (of_property_read_bool(dev->dev.of_node, "big-endian-regs")) in ehci_platform_probe()
278 ehci->big_endian_mmio = 1; in ehci_platform_probe()
280 if (of_property_read_bool(dev->dev.of_node, "big-endian-desc")) in ehci_platform_probe()
281 ehci->big_endian_desc = 1; in ehci_platform_probe()
283 if (of_property_read_bool(dev->dev.of_node, "big-endian")) in ehci_platform_probe()
284 ehci->big_endian_mmio = ehci->big_endian_desc = 1; in ehci_platform_probe()
286 if (of_property_read_bool(dev->dev.of_node, "spurious-oc")) in ehci_platform_probe()
287 ehci->spurious_oc = 1; in ehci_platform_probe()
289 if (of_property_read_bool(dev->dev.of_node, in ehci_platform_probe()
290 "needs-reset-on-resume")) in ehci_platform_probe()
291 priv->reset_on_resume = true; in ehci_platform_probe()
293 if (of_property_read_bool(dev->dev.of_node, in ehci_platform_probe()
294 "has-transaction-translator")) in ehci_platform_probe()
295 hcd->has_tt = 1; in ehci_platform_probe()
297 if (of_device_is_compatible(dev->dev.of_node, in ehci_platform_probe()
298 "aspeed,ast2500-ehci") || in ehci_platform_probe()
299 of_device_is_compatible(dev->dev.of_node, in ehci_platform_probe()
300 "aspeed,ast2600-ehci")) in ehci_platform_probe()
301 ehci->is_aspeed = 1; in ehci_platform_probe()
304 priv->quirk_poll = true; in ehci_platform_probe()
307 priv->clks[clk] = of_clk_get(dev->dev.of_node, clk); in ehci_platform_probe()
308 if (IS_ERR(priv->clks[clk])) { in ehci_platform_probe()
309 err = PTR_ERR(priv->clks[clk]); in ehci_platform_probe()
310 if (err == -EPROBE_DEFER) in ehci_platform_probe()
312 priv->clks[clk] = NULL; in ehci_platform_probe()
318 priv->rsts = devm_reset_control_array_get_optional_shared(&dev->dev); in ehci_platform_probe()
319 if (IS_ERR(priv->rsts)) { in ehci_platform_probe()
320 err = PTR_ERR(priv->rsts); in ehci_platform_probe()
324 err = reset_control_deassert(priv->rsts); in ehci_platform_probe()
328 if (pdata->big_endian_desc) in ehci_platform_probe()
329 ehci->big_endian_desc = 1; in ehci_platform_probe()
330 if (pdata->big_endian_mmio) in ehci_platform_probe()
331 ehci->big_endian_mmio = 1; in ehci_platform_probe()
332 if (pdata->has_tt) in ehci_platform_probe()
333 hcd->has_tt = 1; in ehci_platform_probe()
334 if (pdata->reset_on_resume) in ehci_platform_probe()
335 priv->reset_on_resume = true; in ehci_platform_probe()
336 if (pdata->spurious_oc) in ehci_platform_probe()
337 ehci->spurious_oc = 1; in ehci_platform_probe()
340 if (ehci->big_endian_mmio) { in ehci_platform_probe()
341 dev_err(&dev->dev, in ehci_platform_probe()
343 err = -EINVAL; in ehci_platform_probe()
348 if (ehci->big_endian_desc) { in ehci_platform_probe()
349 dev_err(&dev->dev, in ehci_platform_probe()
351 err = -EINVAL; in ehci_platform_probe()
356 if (pdata->power_on) { in ehci_platform_probe()
357 err = pdata->power_on(dev); in ehci_platform_probe()
362 hcd->regs = devm_platform_get_and_ioremap_resource(dev, 0, &res_mem); in ehci_platform_probe()
363 if (IS_ERR(hcd->regs)) { in ehci_platform_probe()
364 err = PTR_ERR(hcd->regs); in ehci_platform_probe()
367 hcd->rsrc_start = res_mem->start; in ehci_platform_probe()
368 hcd->rsrc_len = resource_size(res_mem); in ehci_platform_probe()
370 hcd->tpl_support = of_usb_host_tpl_support(dev->dev.of_node); in ehci_platform_probe()
376 device_wakeup_enable(hcd->self.controller); in ehci_platform_probe()
377 device_enable_async_suspend(hcd->self.controller); in ehci_platform_probe()
380 if (priv->quirk_poll) in ehci_platform_probe()
386 if (pdata->power_off) in ehci_platform_probe()
387 pdata->power_off(dev); in ehci_platform_probe()
389 reset_control_assert(priv->rsts); in ehci_platform_probe()
391 while (--clk >= 0) in ehci_platform_probe()
392 clk_put(priv->clks[clk]); in ehci_platform_probe()
395 dev->dev.platform_data = NULL; in ehci_platform_probe()
405 struct usb_ehci_pdata *pdata = dev_get_platdata(&dev->dev); in ehci_platform_remove()
409 if (priv->quirk_poll) in ehci_platform_remove()
414 if (pdata->power_off) in ehci_platform_remove()
415 pdata->power_off(dev); in ehci_platform_remove()
417 reset_control_assert(priv->rsts); in ehci_platform_remove()
419 for (clk = 0; clk < EHCI_MAX_CLKS && priv->clks[clk]; clk++) in ehci_platform_remove()
420 clk_put(priv->clks[clk]); in ehci_platform_remove()
425 dev->dev.platform_data = NULL; in ehci_platform_remove()
437 if (priv->quirk_poll) in ehci_platform_suspend()
444 if (pdata->power_suspend) in ehci_platform_suspend()
445 pdata->power_suspend(pdev); in ehci_platform_suspend()
458 if (pdata->power_on) { in ehci_platform_resume()
459 int err = pdata->power_on(pdev); in ehci_platform_resume()
464 companion_dev = usb_of_get_companion_dev(hcd->self.controller); in ehci_platform_resume()
466 device_pm_wait_for_dev(hcd->self.controller, companion_dev); in ehci_platform_resume()
470 ehci_resume(hcd, priv->reset_on_resume); in ehci_platform_resume()
476 if (priv->quirk_poll) in ehci_platform_resume()
483 { .compatible = "via,vt8500-ehci", },
484 { .compatible = "wm,prizm-ehci", },
485 { .compatible = "generic-ehci", },
486 { .compatible = "cavium,octeon-6335-ehci", },
500 { "ehci-platform", 0 },
514 .name = "ehci-platform",
525 return -ENODEV; in ehci_platform_init()