On 20-05-24 06:55:02, Jun Li wrote: > > > > #define USB3_CORE_CTRL1 0x00 > > #define USB3_CORE_CTRL2 0x04 > > @@ -66,11 +68,30 @@ > > #define CLK_VALID_COMPARE_BITS (0xf << 28) > > GENMASK(31, 28) > > > #define PHY_REFCLK_REQ (1 << 0) > > BIT(0), also for others Will change for all. > > > > > +/* OTG registers definition */ > > +#define OTGSTS 0x4 > > +/* OTGSTS */ > > +#define OTG_NRDY (1 << 11) > > + > > +/* xHCI registers definition */ > > +#define XECP_PM_PMCSR 0x8018 > > +#define XECP_AUX_CTRL_REG1 0x8120 > > + > > +/* Register bits definition */ > > +/* XECP_AUX_CTRL_REG1 */ > > +#define CFG_RXDET_P3_EN (1 << 15) > > + > > +/* XECP_PM_PMCSR */ > > +#define PS_MASK (3 << 0) > > +#define PS_D0 0 > > +#define PS_D1 (1 << 0) > > + > > + /* wait for mdctrl_clk_status is cleared */ > > + value = cdns_imx_readl(data, USB3_CORE_STATUS); > > + ret = readl_poll_timeout_atomic(data->noncore + USB3_CORE_STATUS, value, > > + (value & MDCTRL_CLK_STATUS) != MDCTRL_CLK_STATUS, > > + 10, 100000); > > + if (ret) > > + dev_warn(parent, "wait mdctrl_clk_status cleared timeout\n"); > > + > > + /* Wait until OTG_NRDY is 0 */ > > + value = readl(otg_regs + OTGSTS); > > + ret = readl_poll_timeout_atomic(otg_regs + OTGSTS, value, > > + (value & OTG_NRDY) != OTG_NRDY, > > + 10, 100000); > > + if (ret) > > + dev_warn(parent, "wait OTG ready timeout\n"); > > Make sense to move forward if any of above timeout happens? I will return -ETIMEOUT for all timeout case, thanks. Peter > > Li Jun > > > + } > > + > > + return ret; > > + > > +} > > + > > +static int cdns_imx_resume(struct device *dev) { > > + struct cdns_imx *data = dev_get_drvdata(dev); > > + > > + return clk_bulk_prepare_enable(data->num_clks, data->clks); } > > + > > +static int cdns_imx_suspend(struct device *dev) { > > + struct cdns_imx *data = dev_get_drvdata(dev); > > + > > + clk_bulk_disable_unprepare(data->num_clks, data->clks); > > + > > + return 0; > > +} > > + > > +#endif /* CONFIG_PM */ > > + > > +static const struct dev_pm_ops cdns_imx_pm_ops = { > > + SET_RUNTIME_PM_OPS(cdns_imx_suspend, cdns_imx_resume, NULL) }; > > + > > static const struct of_device_id cdns_imx_of_match[] = { > > { .compatible = "fsl,imx8qm-usb3", }, > > {}, > > @@ -206,6 +380,7 @@ static struct platform_driver cdns_imx_driver = { > > .driver = { > > .name = "cdns3-imx", > > .of_match_table = cdns_imx_of_match, > > + .pm = &cdns_imx_pm_ops, > > }, > > }; > > module_platform_driver(cdns_imx_driver); > > -- > > 2.17.1 > -- Thanks, Peter Chen