public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v5 5/5] usb: lpc32xx: add host USB driver
Date: Wed, 5 Aug 2015 20:50:17 +0200	[thread overview]
Message-ID: <201508052050.17935.marex@denx.de> (raw)
In-Reply-To: <1438799517-24273-4-git-send-email-slemieux.tyco@gmail.com>

On Wednesday, August 05, 2015 at 08:31:57 PM, slemieux.tyco at gmail.com wrote:
> From: Sylvain Lemieux <slemieux@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@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 !

  reply	other threads:[~2015-08-05 18:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-05 18:31 [U-Boot] [PATCH v5 5/5] usb: lpc32xx: add host USB driver slemieux.tyco at gmail.com
2015-08-05 18:50 ` Marek Vasut [this message]
2015-08-05 21:59 ` Vladimir Zapolskiy
2015-08-05 23:19   ` Marek Vasut
2015-08-06 18:01   ` LEMIEUX, SYLVAIN
2015-08-06 18:25     ` Vladimir Zapolskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201508052050.17935.marex@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox