From: Marek Vasut Date: Mon, 29 Jun 2020 04:21:38 +0200 Subject: [PATCH 1/7] usb: ehci-mx6: Add powerup_fixup implementation In-Reply-To: <20200629021350.21262-1-peng.fan@nxp.com> References: <20200629021350.21262-1-peng.fan@nxp.com> Message-ID: <83b6793a-fa7f-ecf4-cd2a-a09e9182ea22@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 6/29/20 4:13 AM, Peng Fan wrote: [...] > +static void ehci_mx6_powerup_fixup(struct ehci_ctrl *ctrl, uint32_t *status_reg, > + uint32_t *reg) > +{ > + u32 result; > + int usec = 2000; > + > + mdelay(50); > + > + do { > + result = ehci_readl(status_reg); > + udelay(5); > + if (!(result & EHCI_PS_PR)) > + break; > + usec--; > + } while (usec > 0); > + > + *reg = ehci_readl(status_reg); > +} Please use wait_for_bit*() . Also, is the 50 mS delay upfront required or can this be wait_for_bit with 60000 uS timeout ?