From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiko Schocher Date: Thu, 19 Feb 2009 07:34:54 +0100 Subject: [U-Boot] [PATCH] 7/12 Multiadapter/multibus I2C, drivers part 4 In-Reply-To: References: <499548C2.7060305@denx.de> <49967FAC.6090905@denx.de> <20090216221151.08966832E893@gemini.denx.de> <499BC42E.50001@denx.de> Message-ID: <499CFD8E.2030901@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello ksi, ksi at koi8.net wrote: > On Wed, 18 Feb 2009, Heiko Schocher wrote: > >> Hello ksi, >> >> ksi at koi8.net wrote: >>> On Mon, 16 Feb 2009, Wolfgang Denk wrote: >>> >>>> Dear ksi at koi8.net, >>>> >>>> In message you wrote: >> [...] >>>>> And remember, the devil is in details. How are you going to assign >>>>> (initialize) that innocent looking "cur_adap_nr->hwadapnr"? How are you >>>>> going to work on an adapter other that "current" in a situation when you can >>>>> NOT change "current" adapter (e.g. perform all I2C layer initialization >>>>> while still running from flash?) Remember, this is plain C and there is no >>>> What makes you insist that we cannot change a variable if we need to >>>> be able to change one? >>> It is NOT just variable. My approach uses i2c _BUS_, not _ADAPTER_. And >>> number of busses can be bigger than number of adapters (e.g. when some >>> busses a reached via muxes or switches.) When doing i2c_set_current_bus() >>> you are switching _NOT_ adapters, but busses. That involves not only >>> changing that global variable but also reprogramming muxes/switches for >>> i2c_set_current_bus() to be consistent and hardware independent. Otherwise >> You have no i2c_set_current_bus() in your code! I think you mean >> i2c_set_current_bus(), right? >> >> And this function fails when running from flash! So, how can you switch >> busses with your patches when running from flash? >> >> Here your function: >> >> int i2c_set_bus_num(unsigned int bus) >> { >> #ifndef CONFIG_SYS_I2C_DIRECT_BUS >> int i; >> u_int8_t buf; >> #endif >> >> if ((bus >= CONFIG_SYS_NUM_I2C_BUSSES) || !(gd->flags & GD_FLG_RELOC)) >> return(-1); >> [...] >> >> This function wouldn;t work from flash ... > > So what? I don't need that function to initialize adapters. Read my EMail! But to switch busses, right? And how you switch busses, when running from flash, and you do a: if ((bus >= CONFIG_SYS_NUM_I2C_BUSSES) || !(gd->flags & GD_FLG_RELOC)) return(-1); in it?? bye Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany