From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiko Schocher Date: Wed, 25 Feb 2009 09:00:39 +0100 Subject: [U-Boot] [PATCH 4/9 v3] 83xx, i2c: add mux support for fsl_i2c In-Reply-To: <20090224180859.f898c410.kim.phillips@freescale.com> References: <499D87A9.3060004@denx.de> <20090223163548.7bcc21b6.kim.phillips@freescale.com> <49A3A77D.4090704@denx.de> <20090224180859.f898c410.kim.phillips@freescale.com> Message-ID: <49A4FAA7.6050200@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 Kim, Kim Phillips wrote: > On Tue, 24 Feb 2009 08:53:33 +0100 > Heiko Schocher wrote: > >> Hello Kim, >> >> Kim Phillips wrote: >>> On Thu, 19 Feb 2009 17:24:09 +0100 >>> Heiko Schocher wrote: >> [...] >>>> unsigned int i2c_get_bus_num(void) >>>> { >>>> +#if defined(CONFIG_I2C_MUX) >>>> + return i2c_bus_num_mux; >>>> +#else >>>> return i2c_bus_num; >>>> +#endif >>>> } >>> I don't get this mux variant - why aren't we reusing i2c_bus_num in the >>> mux case? >> Because i2c_bus_num is used as an index which hardware i2c controller >> is used (0 or 1). In CONFIG_I2C_MUX case, you have more than 2 i2c >> busses -> i2c_bus_num would be greater than 1, so you must have a >> variable, where you store which hardware adapter you use, and one >> which stores on which i2c bus you are. > > so instead of naming it "i2c_bus_num_mux" it should be renamed > "i2c_adapter_num"?, or does i2c_get_bus_num() still imply that it will No, i2c_adapter_num should be 0 or 1 for Controller 0 or 1, I think, and i2c_bus_num_mux can be greater then 1. If we would do a rename, we should rename "i2c_bus_num" to "i2c_adapter_num". In case, we don;t use i2c mux, i2c_bus_num = i2c_adapter_num. else i2c_bus_num >= i2c_adapter_num (=0 or 1) > return the /bus/ number? Perhaps we should we have a separate function Yes, i2c_get_bus_num() returns the bus number. > altogether? We should rework this "i2c multibus" instead complete, so we can remove all this instances from i2c_get_bus_num()/i2c_set_bus_num() in every i2c driver ... such an attempt was in discussion, but unfortunately failed ... but I hope I can retrigger it. bye Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany