
On Mon, 16 Feb 2009, Wolfgang Denk wrote:
Dear ksi@koi8.net,
In message Pine.LNX.4.64ksi.0902142104100.6240@home-gw.koi8.net you wrote:
OK, please explain how that cur_adap_nr->hwadapnr gets assigned. Please also explain how can one invoke a function on other adapter than "current". Remember, i2c_init is quite often called BEFORE the code is relocated to RAM so you can NOT change "current" adapter.
We could assign an entry in the global data for it.
But then - how often will it bbe necessary to switch adapters before relocation? What is I2C being used for? To read the SPD data for the RAM init code. Which other adapter would be needed?
I can not tell it right away. There might be several RAM DIMMs with their own SPD EPROMS sitting on different busses or something else. It is not like we absolutely need this feature right now, urgently but it is so easy to implement that it would've been a crime to not to... :)
There is another problem with choosing a proper i2c_init() function with i2c_set_bus_num() -- the latter also reprograms I2C multiplexers/switches if there are any so you essentially need an initialized adapter to switch to it to initialize it. Catch 22...
Please also note that you will loose a capability of working with more than one adapter before the code is relocated to RAM.
I don't see this.
Why? There is no writable global variables before relocation...
--- ****************************************************************** * KSI@home KOI8 Net < > The impossible we do immediately. * * Las Vegas NV, USA < > Miracles require 24-hour notice. * ******************************************************************