From: Quanyang Wang <quanyang.w...@windriver.com> Add initialization for the structure usb_phy.
And a series of operations "flush-stop-reset" is needed so that we can access usb phy via ULPI interface. And otg_set_vbus is called after the host mode is determined because we need call ulpi_set_vbus to set vbus via it. Signed-off-by: Quanyang Wang <quanyang.w...@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfi...@gmail.com> --- drivers/usb/chipidea/core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 1fbcc3e1d3689..df3298c3eb766 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -216,6 +216,7 @@ static void ci_hdrc_enter_lpm(struct ci_hdrc *ci, bool enable) static int hw_device_init(struct ci_hdrc *ci, void __iomem *base) { u32 reg; + int ret; /* bank is a module variable */ ci->hw_bank.abs = base; @@ -241,6 +242,15 @@ static int hw_device_init(struct ci_hdrc *ci, void __iomem *base) if (ci->hw_ep_max > ENDPT_MAX) return -ENODEV; + /* should flush & stop before reset */ + hw_write(ci, OP_ENDPTFLUSH, ~0, ~0); + hw_write(ci, OP_USBCMD, USBCMD_RS, 0); + ret = hw_controller_reset(ci); + if (ret) { + dev_err(ci->dev, "error resetting controller, ret=%d\n", ret); + return ret; + } + ci_hdrc_enter_lpm(ci, false); /* Disable all interrupts bits */ @@ -1090,6 +1100,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) ci->phy = ci->platdata->phy; } else if (ci->platdata->usb_phy) { ci->usb_phy = ci->platdata->usb_phy; + ci->usb_phy->io_priv = ci->hw_bank.regmap[OP_ULPI_VIEWPORT]; } else { /* Look for a generic PHY first */ ci->phy = devm_phy_get(dev->parent, "usb-phy"); @@ -1160,6 +1171,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) else goto deinit_phy; } + otg_set_vbus(ci->usb_phy->otg, true); } if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_PERIPHERAL) { -- 2.36.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12311): https://lists.yoctoproject.org/g/linux-yocto/message/12311 Mute This Topic: https://lists.yoctoproject.org/mt/97817799/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-