
6 Aug
2015
6 Aug
'15
1:19 a.m.
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);
+}
[...]