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: Thu, 6 Aug 2015 01:19:06 +0200 [thread overview]
Message-ID: <201508060119.06277.marex@denx.de> (raw)
In-Reply-To: <55C2874B.5060408@mleia.com>
On Wednesday, August 05, 2015 at 11:59:39 PM, Vladimir Zapolskiy wrote:
> Hi Sylvain,
Hi!
[...]
> > +static struct otg_regs *otg = (struct otg_regs *)USB_BASE;
> > +static struct clk_pm_regs *clk_pwr = (struct clk_pm_regs *)CLK_PM_BASE;
> > +
> > +static int wait_for_bit(void *reg, const u32 mask, bool set)
>
> Note, "set" is always 1 in the driver code.
Ideally, I'd like to see a generic implementation of this wait_for_bit(),
but I don't want to load this unto Slemieux.
> > +{
> > + u32 val;
> > + unsigned long start = get_timer(0);
> > +
> > + while (1) {
> > + val = readl(reg);
> > + if (!set)
> > + val = ~val;
> > +
> > + if ((val & mask) == mask)
> > + return 0;
> > +
> > + if (get_timer(start) > 1000)
>
> Please add a macro replacing 1000, or use CONFIG_SYS_HZ.
Or add a parameter, so this looks something like:
if (get_timer(start) > CONFIG_HZ * timeout)
> > + break;
> > +
> > + udelay(1);
> > + }
> > +
> > + debug("%s: Timeout (reg=%p mask=%08x wait_set=%i)\n",
> > + __func__, reg, mask, set);
> > +
> > + return -ETIMEDOUT;
> > +}
> > +
> > +static int isp1301_set_value(int reg, u8 value)
> > +{
> > + return i2c_write(ISP1301_I2C_ADDR, reg, 1, &value, 1);
> > +}
[...]
next prev parent reply other threads:[~2015-08-05 23:19 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
2015-08-05 21:59 ` Vladimir Zapolskiy
2015-08-05 23:19 ` Marek Vasut [this message]
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=201508060119.06277.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