[U-Boot] [PATCH 3/3] mpc5200: make i2c faster

Grant Likely grant.likely at secretlab.ca
Mon Mar 23 04:00:11 CET 2009


On Sun, Mar 22, 2009 at 5:16 PM, Sascha Hauer <s.hauer at pengutronix.de> wrote:
> On Sat, Mar 21, 2009 at 09:38:48AM -0400, Jon wrote:
>>  struct mpc5xxx_i2c_tap {
>> @@ -94,7 +94,7 @@ static int wait_for_bb(void)
>>               mpc_reg_out(&regs->mcr, 0, 0);
>>               mpc_reg_out(&regs->mcr, I2C_EN, 0);
>>  #endif
>> -             udelay(1000);
>> +             udelay(1);
>>               status = mpc_reg_in(&regs->msr);
>>       }
>>
>
> The actual condition we wait for takes only a few useconds to become
> true, but we wait for at least 1ms. As the I2C EEPROM environment
> routine reads nearly the complete EEPROM several times during startup
> the speed gain is enormous.
> I can't recall if it was intentional to reduce the overall timeout with
> this patch, but I can imagine that the i2c detect function will be
> faster aswell.

Even better, since this is entirely a busywait, the udelay(1) could be
dropped entirely and the exit condition be based on the value of
timebase.  That would give the absolute maximum resolution to the
busyloop.  However, the incremental improvement probably isn't a great
deal better than this patch.

g.


More information about the U-Boot mailing list