
Hi Tolunay,
Am Mittwoch, 3. März 2004 18:36 schrieb listmember@orkun.us:
We have some instrumentation hanging on I2C bus. I would like to introduce a new u-boot command ispeed to set the i2c speed so fast devices would not be constrained to the lowest denominator speed.
Makes sense, but why do you need measuring datas in context of a bootloader ?
If desired we can make be conditionally included if CONFIG_CMD_ISPEED (suggestions?) so it would not take space when it is not needed (or desired) on a particular board. The proposed syntax would be.
ispeed {i2c bus speed}
Since u-boot uses hex: 100kHz => 186A0, 400kHz => 61A80
Hm, I think you should expand the command syntax -- ex.:
ispeed [i2c_bus_speed_in_hz]
Without a argument 'ispeed' gets back the current setting.
With an argument 'ispeed' converts the given string to ulong and setup the new speed. The argument can be a decimal integer, because simple_strtoul() from lib_generic/vsprintf.c understands base option 10.
I would also set an environment variable in ispeed command indicating current i2c speed ("i2cspeed") so it could be used in scripts.
Is it really needed ... I don't think so. You can read back the current setting with 'ispeed' and save the result into a environment variable of your choice. So you can use it again in another or the same script.
Best Regards, Stephan Linz