Lines Matching +full:rzg2l +full:- +full:usbphy +full:- +full:ctrl

1 // SPDX-License-Identifier: GPL-2.0
3 * Renesas RZ/G2L USBPHY control driver
15 #include <linux/reset-controller.h>
49 void __iomem *base = priv->base; in rzg2l_usbphy_ctrl_assert()
53 spin_lock_irqsave(&priv->lock, flags); in rzg2l_usbphy_ctrl_assert()
59 spin_unlock_irqrestore(&priv->lock, flags); in rzg2l_usbphy_ctrl_assert()
68 void __iomem *base = priv->base; in rzg2l_usbphy_ctrl_deassert()
72 spin_lock_irqsave(&priv->lock, flags); in rzg2l_usbphy_ctrl_deassert()
78 spin_unlock_irqrestore(&priv->lock, flags); in rzg2l_usbphy_ctrl_deassert()
91 return !!(readl(priv->base + RESET) & port_mask); in rzg2l_usbphy_ctrl_status()
95 { .compatible = "renesas,rzg2l-usbphy-ctrl" },
115 struct device *dev = &pdev->dev; in rzg2l_usbphy_ctrl_probe()
125 return -ENOMEM; in rzg2l_usbphy_ctrl_probe()
127 priv->base = devm_platform_ioremap_resource(pdev, 0); in rzg2l_usbphy_ctrl_probe()
128 if (IS_ERR(priv->base)) in rzg2l_usbphy_ctrl_probe()
129 return PTR_ERR(priv->base); in rzg2l_usbphy_ctrl_probe()
131 regmap = devm_regmap_init_mmio(dev, priv->base + VBENCTL, &rzg2l_usb_regconf); in rzg2l_usbphy_ctrl_probe()
135 priv->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); in rzg2l_usbphy_ctrl_probe()
136 if (IS_ERR(priv->rstc)) in rzg2l_usbphy_ctrl_probe()
137 return dev_err_probe(dev, PTR_ERR(priv->rstc), in rzg2l_usbphy_ctrl_probe()
140 error = reset_control_deassert(priv->rstc); in rzg2l_usbphy_ctrl_probe()
144 spin_lock_init(&priv->lock); in rzg2l_usbphy_ctrl_probe()
147 pm_runtime_enable(&pdev->dev); in rzg2l_usbphy_ctrl_probe()
148 error = pm_runtime_resume_and_get(&pdev->dev); in rzg2l_usbphy_ctrl_probe()
150 dev_err_probe(&pdev->dev, error, "pm_runtime_resume_and_get failed"); in rzg2l_usbphy_ctrl_probe()
155 spin_lock_irqsave(&priv->lock, flags); in rzg2l_usbphy_ctrl_probe()
156 val = readl(priv->base + RESET); in rzg2l_usbphy_ctrl_probe()
158 writel(val, priv->base + RESET); in rzg2l_usbphy_ctrl_probe()
159 spin_unlock_irqrestore(&priv->lock, flags); in rzg2l_usbphy_ctrl_probe()
161 priv->rcdev.ops = &rzg2l_usbphy_ctrl_reset_ops; in rzg2l_usbphy_ctrl_probe()
162 priv->rcdev.of_reset_n_cells = 1; in rzg2l_usbphy_ctrl_probe()
163 priv->rcdev.nr_resets = NUM_PORTS; in rzg2l_usbphy_ctrl_probe()
164 priv->rcdev.of_node = dev->of_node; in rzg2l_usbphy_ctrl_probe()
165 priv->rcdev.dev = dev; in rzg2l_usbphy_ctrl_probe()
167 error = devm_reset_controller_register(dev, &priv->rcdev); in rzg2l_usbphy_ctrl_probe()
171 vdev = platform_device_alloc("rzg2l-usb-vbus-regulator", pdev->id); in rzg2l_usbphy_ctrl_probe()
173 error = -ENOMEM; in rzg2l_usbphy_ctrl_probe()
176 vdev->dev.parent = dev; in rzg2l_usbphy_ctrl_probe()
177 priv->vdev = vdev; in rzg2l_usbphy_ctrl_probe()
188 pm_runtime_put(&pdev->dev); in rzg2l_usbphy_ctrl_probe()
190 pm_runtime_disable(&pdev->dev); in rzg2l_usbphy_ctrl_probe()
191 reset_control_assert(priv->rstc); in rzg2l_usbphy_ctrl_probe()
197 struct rzg2l_usbphy_ctrl_priv *priv = dev_get_drvdata(&pdev->dev); in rzg2l_usbphy_ctrl_remove()
199 platform_device_unregister(priv->vdev); in rzg2l_usbphy_ctrl_remove()
200 pm_runtime_put(&pdev->dev); in rzg2l_usbphy_ctrl_remove()
201 pm_runtime_disable(&pdev->dev); in rzg2l_usbphy_ctrl_remove()
202 reset_control_assert(priv->rstc); in rzg2l_usbphy_ctrl_remove()
216 MODULE_DESCRIPTION("Renesas RZ/G2L USBPHY Control");