From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiko Schocher Date: Sat, 14 Feb 2009 09:24:12 +0100 Subject: [U-Boot] [PATCH] 7/12 Multiadapter/multibus I2C, drivers part 4 In-Reply-To: References: <499548C2.7060305@denx.de> Message-ID: <49967FAC.6090905@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 Fri, 13 Feb 2009, Heiko Schocher wrote: >> ksi at koi8.net wrote: >>> Signed-off-by: Sergey Kubushyn >>> --- >>> diff -purN u-boot-i2c.orig/drivers/i2c/soft_i2c.c u-boot-i2c/drivers/i2c/soft_i2c.c >>> --- u-boot-i2c.orig/drivers/i2c/soft_i2c.c 2009-02-12 10:43:41.000000000 -0800 >>> +++ u-boot-i2c/drivers/i2c/soft_i2c.c 2009-02-12 10:46:00.000000000 -0800 >>> @@ -1,4 +1,8 @@ >>> /* >>> + * Copyright (c) 2009 Sergey Kubushyn >>> + * >>> + * Changes for multibus/multiadapter I2C support. >>> + * >>> * (C) Copyright 2001, 2002 >>> * Wolfgang Denk, DENX Software Engineering, wd at denx.de. >> [...] >> >> The following patch is based on your patches without 7/12 and >> adds multibus support for the soft_i2c driver without doing such >> a big change as you did. Maybe it is not yet perfect, because >> it is just a fast try, but I think we should go this way. What >> do you/others think? > > The reason behind this patch is making SEVERAL different SOFT_I2C ADAPTERS > available. Not BUSSES but separate PHYSICAL I2C ADAPTERS made of different > pin pairs from different chips. This you can also do with "my" suggestion ... > OK, please explain how are you going to make different functions for > different adapters? Let's say you want to use 2 on-SoC GPIO pins for You can do now the following for example in your include/configs/MPC8548CDS.h example: you only have to define #define I2C_SDA(bit) (printf("hwadap: %d sda1: %d", cur_adap_nr->hwadapnr, bit)) if this is a real driver you can make a function in your board code say (just a fast thought): void i2c_soft_sda (int bit) { switch(cur_adap_nr->hwadapnr) { case 0: /* adapter specfic code 0 */ break; case 1: /* adapter specfic code 1 */ break; [...] } } and define in config file #define I2C_SDA(bit) i2c_soft_sda (bit) > adapter #0, 2 GPIOs from a PCI-PCI bridge for adapter #1, and 2 pins from > some chip sitting behind that bridge for adapter #2 if all those pin sets > are accessed totally different. I won't even start about using pins from > different chips for SDA and SCL (let's say you only have one GPIO available > on your SoC and another one on PCI Bridge.) > > What your patch creates is just aliases to the SAME physical adapter. No, it is not! I only use the same functions, but in the board specific code it is possible to made a switch and access the Pins where ever they are. bye Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany