
On Tue, Jan 17, 2012 at 1:12 AM, Simon Glass sjg@chromium.org wrote:
From: Heiko Schocher hs@denx.de
This Patch introduce the new i2c_core file, which holds the I2C core functions, for the rework of the multibus/ multiadapter support. Also adds changes in i2c.h for the new I2C multibus/multiadapter support. This new support can be activated with the CONFIG_SYS_I2C define.
Signed-off-by: Heiko Schocher hs@denx.de Signed-off-by: Simon Glass sjg@chromium.org
arch/arm/include/asm/global_data.h | 3 + arch/avr32/include/asm/global_data.h | 3 + arch/blackfin/include/asm/global_data.h | 4 +- arch/m68k/include/asm/global_data.h | 3 + arch/microblaze/include/asm/global_data.h | 3 + arch/mips/include/asm/global_data.h | 3 + arch/nios2/include/asm/global_data.h | 3 + arch/powerpc/include/asm/global_data.h | 3 + arch/sh/include/asm/global_data.h | 3 + arch/sparc/include/asm/global_data.h | 3 + arch/x86/include/asm/global_data.h | 3 + drivers/i2c/Makefile | 1 + drivers/i2c/i2c_core.c | 360 +++++++++++++++++++++++++++++ include/i2c.h | 199 +++++++++++++++- 14 files changed, 584 insertions(+), 10 deletions(-) create mode 100644 drivers/i2c/i2c_core.c
diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h index 23a6077..924cea2 100644 --- a/arch/arm/include/asm/global_data.h +++ b/arch/arm/include/asm/global_data.h @@ -87,6 +87,9 @@ typedef struct global_data { unsigned long post_log_res; /* success of POST test */ unsigned long post_init_f_time; /* When post_init_f started */ #endif +#if defined(CONFIG_SYS_I2C)
- void *cur_adap; /* current used i2c adapter */
+#endif
I was really hoping we could get rid of the concept of a "current" i2c adapter, and just force all drivers to specify the I2C adapter they want to use for a given I2C operation. That's how Linux operates, and it will prevent stuff like this:
void *old; void *new;
old = get_current_i2c_adapter(); set_i2c_adapter(new); // do I2C stuff set_i2c_adapter(old);