Lines Matching +full:reset +full:- +full:delay

1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2014-2023, The Linux Foundation. All rights reserved.
7 #include <linux/delay.h>
15 #include <linux/reset.h>
76 u32 delay; member
93 .delay = 15
200 struct reset_control *reset; member
208 const struct m31_phy_regs *regs = qphy->regs; in m31usb_phy_init()
211 ret = regulator_enable(qphy->vreg); in m31usb_phy_init()
213 dev_err(&phy->dev, "failed to enable regulator, %d\n", ret); in m31usb_phy_init()
217 ret = clk_prepare_enable(qphy->clk); in m31usb_phy_init()
219 regulator_disable(qphy->vreg); in m31usb_phy_init()
220 dev_err(&phy->dev, "failed to enable cfg ahb clock, %d\n", ret); in m31usb_phy_init()
224 /* Perform phy reset */ in m31usb_phy_init()
225 reset_control_assert(qphy->reset); in m31usb_phy_init()
227 reset_control_deassert(qphy->reset); in m31usb_phy_init()
230 if (qphy->ulpi_mode) in m31usb_phy_init()
231 writel(0x0, qphy->base + USB2PHY_PORT_UTMI_CTRL2); in m31usb_phy_init()
234 writel(POWER_UP, qphy->base + USB2PHY_PORT_POWERDOWN); in m31usb_phy_init()
237 for (i = 0; i < qphy->nregs; i++) { in m31usb_phy_init()
238 writel(regs[i].val, qphy->base + regs[i].off); in m31usb_phy_init()
239 if (regs[i].delay) in m31usb_phy_init()
240 udelay(regs[i].delay); in m31usb_phy_init()
251 writel_relaxed(POWER_DOWN, qphy->base + USB2PHY_PORT_POWERDOWN); in m31usb_phy_shutdown()
253 clk_disable_unprepare(qphy->clk); in m31usb_phy_shutdown()
255 regulator_disable(qphy->vreg); in m31usb_phy_shutdown()
270 struct device *dev = &pdev->dev; in m31usb_phy_probe()
275 return -ENOMEM; in m31usb_phy_probe()
277 qphy->base = devm_platform_ioremap_resource(pdev, 0); in m31usb_phy_probe()
278 if (IS_ERR(qphy->base)) in m31usb_phy_probe()
279 return PTR_ERR(qphy->base); in m31usb_phy_probe()
281 qphy->reset = devm_reset_control_get_exclusive_by_index(dev, 0); in m31usb_phy_probe()
282 if (IS_ERR(qphy->reset)) in m31usb_phy_probe()
283 return PTR_ERR(qphy->reset); in m31usb_phy_probe()
285 qphy->clk = devm_clk_get(dev, NULL); in m31usb_phy_probe()
286 if (IS_ERR(qphy->clk)) in m31usb_phy_probe()
287 return dev_err_probe(dev, PTR_ERR(qphy->clk), in m31usb_phy_probe()
291 qphy->regs = data->regs; in m31usb_phy_probe()
292 qphy->nregs = data->nregs; in m31usb_phy_probe()
293 qphy->ulpi_mode = data->ulpi_mode; in m31usb_phy_probe()
295 qphy->phy = devm_phy_create(dev, NULL, &m31usb_phy_gen_ops); in m31usb_phy_probe()
296 if (IS_ERR(qphy->phy)) in m31usb_phy_probe()
297 return dev_err_probe(dev, PTR_ERR(qphy->phy), in m31usb_phy_probe()
300 qphy->vreg = devm_regulator_get(dev, "vdd"); in m31usb_phy_probe()
301 if (IS_ERR(qphy->vreg)) in m31usb_phy_probe()
302 return dev_err_probe(dev, PTR_ERR(qphy->vreg), in m31usb_phy_probe()
305 phy_set_drvdata(qphy->phy, qphy); in m31usb_phy_probe()
327 { .compatible = "qcom,ipq5018-usb-hsphy", .data = &m31_ipq5018_data },
328 { .compatible = "qcom,ipq5332-usb-hsphy", .data = &m31_ipq5332_data },
336 .name = "qcom-m31usb-phy",