Lines Matching +full:irq +full:- +full:syscfg
1 // SPDX-License-Identifier: GPL-1.0+
33 * +-------+ +-----------+
34 * | pipe0 |------>| fifo pio |
35 * +------------+ +-------+ +-----------+
36 * | mod_gadget |=====> | pipe1 |--+
37 * +------------+ +-------+ | +-----------+
38 * | pipe2 | | +-| fifo dma0 |
39 * +------------+ +-------+ | | +-----------+
40 * | mod_host | | pipe3 |<-|--+
41 * +------------+ +-------+ | +-----------+
42 * | .... | +--->| fifo dma1 |
43 * | .... | +-----------+
54 (!(priv) ? -ENODEV : \
55 !((priv)->pfunc->func) ? 0 : \
56 (priv)->pfunc->func(args))
63 return ioread16(priv->base + reg); in usbhs_read()
68 iowrite16(data, priv->base + reg); in usbhs_write()
83 return dev_get_drvdata(&pdev->dev); in usbhs_pdev_to_priv()
92 * syscfg functions
96 usbhs_bset(priv, SYSCFG, SCKE, enable ? SCKE : 0); in usbhs_sys_clock_ctrl()
107 * - select Host mode in usbhs_sys_host_ctrl()
108 * - D+ Line/D- Line Pull-down in usbhs_sys_host_ctrl()
110 usbhs_bset(priv, SYSCFG, mask, enable ? val : 0); in usbhs_sys_host_ctrl()
127 * - select Function mode in usbhs_sys_function_ctrl()
128 * - D+ Line Pull-up is disabled in usbhs_sys_function_ctrl()
129 * When D+ Line Pull-up is enabled, in usbhs_sys_function_ctrl()
132 usbhs_bset(priv, SYSCFG, mask, enable ? val : 0); in usbhs_sys_function_ctrl()
137 usbhs_bset(priv, SYSCFG, DPRPU, enable ? DPRPU : 0); in usbhs_sys_function_pullup()
161 req->bRequest = (val >> 8) & 0xFF; in usbhs_usbreq_get_val()
162 req->bRequestType = (val >> 0) & 0xFF; in usbhs_usbreq_get_val()
164 req->wValue = cpu_to_le16(usbhs_read(priv, USBVAL)); in usbhs_usbreq_get_val()
165 req->wIndex = cpu_to_le16(usbhs_read(priv, USBINDX)); in usbhs_usbreq_get_val()
166 req->wLength = cpu_to_le16(usbhs_read(priv, USBLENG)); in usbhs_usbreq_get_val()
171 usbhs_write(priv, USBREQ, (req->bRequest << 8) | req->bRequestType); in usbhs_usbreq_set_val()
172 usbhs_write(priv, USBVAL, le16_to_cpu(req->wValue)); in usbhs_usbreq_set_val()
173 usbhs_write(priv, USBINDX, le16_to_cpu(req->wIndex)); in usbhs_usbreq_set_val()
174 usbhs_write(priv, USBLENG, le16_to_cpu(req->wLength)); in usbhs_usbreq_set_val()
241 return -EIO; in usbhs_set_device_config()
246 return -EIO; in usbhs_set_device_config()
261 return -EIO; in usbhs_set_device_config()
295 return priv->dparam.multi_clks; in usbhsc_is_multi_clks()
304 priv->clks[0] = of_clk_get(dev_of_node(dev), 0); in usbhsc_clk_get()
305 if (IS_ERR(priv->clks[0])) in usbhsc_clk_get()
306 return PTR_ERR(priv->clks[0]); in usbhsc_clk_get()
310 * value if it's -ENOENT or not. in usbhsc_clk_get()
312 priv->clks[1] = of_clk_get(dev_of_node(dev), 1); in usbhsc_clk_get()
313 if (PTR_ERR(priv->clks[1]) == -ENOENT) in usbhsc_clk_get()
314 priv->clks[1] = NULL; in usbhsc_clk_get()
315 else if (IS_ERR(priv->clks[1])) in usbhsc_clk_get()
316 return PTR_ERR(priv->clks[1]); in usbhsc_clk_get()
328 for (i = 0; i < ARRAY_SIZE(priv->clks); i++) in usbhsc_clk_put()
329 clk_put(priv->clks[i]); in usbhsc_clk_put()
339 for (i = 0; i < ARRAY_SIZE(priv->clks); i++) { in usbhsc_clk_prepare_enable()
340 ret = clk_prepare_enable(priv->clks[i]); in usbhsc_clk_prepare_enable()
342 while (--i >= 0) in usbhsc_clk_prepare_enable()
343 clk_disable_unprepare(priv->clks[i]); in usbhsc_clk_prepare_enable()
358 for (i = 0; i < ARRAY_SIZE(priv->clks); i++) in usbhsc_clk_disable_unprepare()
359 clk_disable_unprepare(priv->clks[i]); in usbhsc_clk_disable_unprepare()
366 /* commonly used on old SH-Mobile and RZ/G2L family SoCs */
380 /* commonly used on newer SH-Mobile and R-Car SoCs */
417 usbhs_platform_call(priv, power_ctrl, pdev, priv->base, enable); in usbhsc_power_ctrl()
426 usbhs_platform_call(priv, power_ctrl, pdev, priv->base, enable); in usbhsc_power_ctrl()
459 if (priv->edev) { in usbhsc_hotplug()
460 cable = extcon_get_state(priv->edev, EXTCON_USB_HOST); in usbhsc_hotplug()
463 dev_info(&pdev->dev, in usbhsc_hotplug()
473 dev_dbg(&pdev->dev, "%s enable\n", __func__); in usbhsc_hotplug()
487 dev_dbg(&pdev->dev, "%s disable\n", __func__); in usbhsc_hotplug()
499 usbhs_mod_change(priv, -1); in usbhsc_hotplug()
527 schedule_delayed_work(&priv->notify_hotplug_work, in usbhsc_schedule_notify_hotplug()
537 .compatible = "renesas,usbhs-r8a774c0",
541 .compatible = "renesas,usbhs-r8a7790",
545 .compatible = "renesas,usbhs-r8a7791",
549 .compatible = "renesas,usbhs-r8a7794",
553 .compatible = "renesas,usbhs-r8a7795",
557 .compatible = "renesas,usbhs-r8a7796",
561 .compatible = "renesas,usbhs-r8a77990",
565 .compatible = "renesas,usbhs-r8a77995",
569 .compatible = "renesas,usbhs-r9a07g043",
573 .compatible = "renesas,usbhs-r9a07g044",
577 .compatible = "renesas,usbhs-r9a07g054",
581 .compatible = "renesas,rcar-gen2-usbhs",
585 .compatible = "renesas,rcar-gen3-usbhs",
589 .compatible = "renesas,rza1-usbhs",
593 .compatible = "renesas,rza2-usbhs",
597 .compatible = "renesas,rzg2l-usbhs",
608 struct device *dev = &pdev->dev; in usbhs_probe()
612 int irq; in usbhs_probe() local
618 return dev_err_probe(dev, -EINVAL, "no platform info\n"); in usbhs_probe()
622 irq = platform_get_irq(pdev, 0); in usbhs_probe()
623 if (irq < 0) in usbhs_probe()
624 return irq; in usbhs_probe()
629 return -ENOMEM; in usbhs_probe()
631 priv->base = devm_platform_ioremap_resource(pdev, 0); in usbhs_probe()
632 if (IS_ERR(priv->base)) in usbhs_probe()
633 return PTR_ERR(priv->base); in usbhs_probe()
636 priv->edev = extcon_get_edev_by_phandle(dev, 0); in usbhs_probe()
637 if (IS_ERR(priv->edev)) in usbhs_probe()
638 return PTR_ERR(priv->edev); in usbhs_probe()
641 priv->rsts = devm_reset_control_array_get_optional_shared(dev); in usbhs_probe()
642 if (IS_ERR(priv->rsts)) in usbhs_probe()
643 return PTR_ERR(priv->rsts); in usbhs_probe()
649 priv->dparam = info->driver_param; in usbhs_probe()
651 if (!info->platform_callback.get_id) { in usbhs_probe()
653 return -EINVAL; in usbhs_probe()
655 priv->pfunc = &info->platform_callback; in usbhs_probe()
659 priv->dparam.pipe_configs = usbhsc_new_pipe; in usbhs_probe()
660 priv->dparam.pipe_size = ARRAY_SIZE(usbhsc_new_pipe); in usbhs_probe()
661 } else if (!priv->dparam.pipe_configs) { in usbhs_probe()
662 priv->dparam.pipe_configs = usbhsc_default_pipe; in usbhs_probe()
663 priv->dparam.pipe_size = ARRAY_SIZE(usbhsc_default_pipe); in usbhs_probe()
665 if (!priv->dparam.pio_dma_border) in usbhs_probe()
666 priv->dparam.pio_dma_border = 64; /* 64byte */ in usbhs_probe()
668 priv->dparam.buswait_bwait = tmp; in usbhs_probe()
675 if (priv->pfunc->get_vbus) in usbhs_probe()
681 priv->irq = irq; in usbhs_probe()
682 priv->pdev = pdev; in usbhs_probe()
683 INIT_DELAYED_WORK(&priv->notify_hotplug_work, usbhsc_notify_hotplug); in usbhs_probe()
702 ret = reset_control_deassert(priv->rsts); in usbhs_probe()
721 ret = -ENOTSUPP; in usbhs_probe()
763 reset_control_assert(priv->rsts); in usbhs_probe()
780 dev_dbg(&pdev->dev, "usb remove\n"); in usbhs_remove()
786 pm_runtime_disable(&pdev->dev); in usbhs_remove()
790 reset_control_assert(priv->rsts); in usbhs_remove()
803 usbhs_mod_change(priv, -1); in usbhsc_suspend()