[U-Boot] [PATCH v5 5/5] usb: lpc32xx: add host USB driver

Marek Vasut marex at denx.de
Wed Aug 5 20:50:17 CEST 2015


On Wednesday, August 05, 2015 at 08:31:57 PM, slemieux.tyco at gmail.com wrote:
> From: Sylvain Lemieux <slemieux at tycoint.com>
> 
> Incorporate USB driver from legacy LPCLinux NXP BSP.
> The files taken from the legacy patch are:
> - lpc32xx USB driver
> - lpc3250 header file USB registers definition.
> 
> The legacy driver was updated and clean-up as part of the integration with
> the latest u-boot.
> 
> Signed-off-by: Sylvain Lemieux <slemieux at tycoint.com>

[...]

> +int usb_cpu_init(void)
> +{
> +	unsigned long start;
> +	u32 ret;
> +
> +	/*
> +	 * USB pins routing setup is done by "lpc32xx_usb_init()" and should
> +	 * be call by board "board_init()" or "misc_init_r()" functions.
> +	 */
> +
> +	/* enable AHB slave USB clock */
> +	setbits_le32(&clk_pwr->usb_ctrl,
> +		     CLK_USBCTRL_HCLK_EN | CLK_USBCTRL_BUS_KEEPER);
> +
> +	/* enable I2C clock in OTG block if it isn't */
> +	if ((readl(&otg->otg_clk_sts) & OTG_CLK_I2C_EN) != OTG_CLK_I2C_EN) {
> +		writel(OTG_CLK_I2C_EN, &otg->otg_clk_ctrl);
> +
> +		start = get_timer(0);
> +		while (1) {
> +			if (readl(&otg->otg_clk_sts) == OTG_CLK_I2C_EN)
> +				break;
> +
> +			if (get_timer(start) > 100)
> +				return -1;

return -ETIMEDOUT :)

> +
> +			udelay(1);
> +		}

Can't you use wait_for_bit() here too ?

> +	}

Looks good otherwise, thanks !


More information about the U-Boot mailing list