[U-Boot] [PATCH] 2/12 Multiadapter/multibus I2C, common part 2
ksi at koi8.net
ksi at koi8.net
Thu Feb 12 23:13:54 CET 2009
Signed-off-by: Sergey Kubushyn <ksi at koi8.net>
---
diff -purN u-boot-i2c.orig/cpu/mpc8xx/video.c u-boot-i2c/cpu/mpc8xx/video.c
--- u-boot-i2c.orig/cpu/mpc8xx/video.c 2009-02-12 10:43:41.000000000 -0800
+++ u-boot-i2c/cpu/mpc8xx/video.c 2009-02-12 10:46:00.000000000 -0800
@@ -809,7 +809,11 @@ static void video_encoder_init (void)
/* Initialize the I2C */
debug ("[VIDEO ENCODER] Initializing I2C bus...\n");
+#ifdef CONFIG_NEW_I2C
+ i2c_init_all();
+#else
i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+#endif
#ifdef CONFIG_FADS
/* Reset ADV7176 chip */
diff -purN u-boot-i2c.orig/lib_arm/board.c u-boot-i2c/lib_arm/board.c
--- u-boot-i2c.orig/lib_arm/board.c 2009-02-12 10:43:41.000000000 -0800
+++ u-boot-i2c/lib_arm/board.c 2009-02-12 10:46:00.000000000 -0800
@@ -81,7 +81,8 @@ extern void rtl8019_get_enetaddr (uchar
#endif
#if defined(CONFIG_HARD_I2C) || \
- defined(CONFIG_SOFT_I2C)
+ defined(CONFIG_SOFT_I2C) || \
+ defined(CONFIG_SYS_I2C_ADAPTERS)
#include <i2c.h>
#endif
@@ -211,11 +212,15 @@ static void display_flash_config (ulong
}
#endif /* CONFIG_SYS_NO_FLASH */
-#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
+#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) || defined(CONFIG_SYS_I2C_ADAPTERS)
static int init_func_i2c (void)
{
puts ("I2C: ");
+#ifdef CONFIG_NEW_I2C
+ i2c_init_all();
+#else
i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+#endif
puts ("ready\n");
return (0);
}
@@ -272,7 +277,7 @@ init_fnc_t *init_sequence[] = {
#if defined(CONFIG_DISPLAY_BOARDINFO)
checkboard, /* display board info */
#endif
-#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
+#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) || defined(CONFIG_SYS_I2C_ADAPTERS)
init_func_i2c,
#endif
dram_init, /* configure available RAM banks */
@@ -368,6 +373,10 @@ void start_armboot (void)
/* initialize environment */
env_relocate ();
+#if defined(CONFIG_NEW_I2C) && defined(CONFIG_SYS_I2C_ADAPTERS)
+ i2c_reloc_fixup();
+#endif
+
#ifdef CONFIG_VFD
/* must do this after the framebuffer is allocated */
drv_vfd_init();
diff -purN u-boot-i2c.orig/lib_blackfin/board.c u-boot-i2c/lib_blackfin/board.c
--- u-boot-i2c.orig/lib_blackfin/board.c 2009-02-12 10:43:41.000000000 -0800
+++ u-boot-i2c/lib_blackfin/board.c 2009-02-12 10:46:00.000000000 -0800
@@ -31,6 +31,10 @@
int post_flag;
#endif
+#if defined(CONFIG_SYS_I2C_ADAPTERS)
+#include <i2c.h>
+#endif
+
DECLARE_GLOBAL_DATA_PTR;
const char version_string[] = U_BOOT_VERSION " ("U_BOOT_DATE" - "U_BOOT_TIME")";
@@ -338,6 +342,10 @@ void board_init_r(gd_t * id, ulong dest_
/* relocate environment function pointers etc. */
env_relocate();
+#if defined(CONFIG_SYS_I2C_ADAPTERS)
+ i2c_reloc_fixup();
+#endif
+
#ifdef CONFIG_CMD_NET
/* board MAC address */
s = getenv("ethaddr");
diff -purN u-boot-i2c.orig/lib_m68k/board.c u-boot-i2c/lib_m68k/board.c
--- u-boot-i2c.orig/lib_m68k/board.c 2009-02-12 10:43:41.000000000 -0800
+++ u-boot-i2c/lib_m68k/board.c 2009-02-12 10:46:00.000000000 -0800
@@ -55,7 +55,8 @@
#include <version.h>
#if defined(CONFIG_HARD_I2C) || \
- defined(CONFIG_SOFT_I2C)
+ defined(CONFIG_SOFT_I2C) || \
+ defined(CONFIG_SYS_I2C_ADAPTERS)
#include <i2c.h>
#endif
@@ -191,11 +192,15 @@ static int init_func_ram (void)
/***********************************************************************/
-#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
+#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) || defined(CONFIG_SYS_I2C_ADAPTERS)
static int init_func_i2c (void)
{
puts ("I2C: ");
+#ifdef CONFIG_NEW_I2C
+ i2c_init_all();
+#else
i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+#endif
puts ("ready\n");
return (0);
}
@@ -227,7 +232,7 @@ init_fnc_t *init_sequence[] = {
display_options,
checkcpu,
checkboard,
-#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
+#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) || defined(CONFIG_SYS_I2C_ADAPTERS)
init_func_i2c,
#endif
#if defined(CONFIG_HARD_SPI)
@@ -577,6 +582,11 @@ void board_init_r (gd_t *id, ulong dest_
/* relocate environment function pointers etc. */
env_relocate ();
+#if defined(CONFIG_NEW_I2C) && defined(CONFIG_SYS_I2C_ADAPTERS)
+ /* Adjust I2C subsystem pointers after relocation */
+ i2c_reloc_fixup();
+#endif
+
/*
* Fill in missing fields of bd_info.
* We do this here, where we have "normal" access to the
diff -purN u-boot-i2c.orig/lib_mips/board.c u-boot-i2c/lib_mips/board.c
--- u-boot-i2c.orig/lib_mips/board.c 2009-02-12 10:43:41.000000000 -0800
+++ u-boot-i2c/lib_mips/board.c 2009-02-12 10:46:00.000000000 -0800
@@ -33,6 +33,10 @@
#include <onenand_uboot.h>
#include <spi.h>
+#if defined(CONFIG_SYS_I2C_ADAPTERS)
+#include <i2c.h>
+#endif
+
DECLARE_GLOBAL_DATA_PTR;
#if ( ((CONFIG_ENV_ADDR+CONFIG_ENV_SIZE) < CONFIG_SYS_MONITOR_BASE) || \
@@ -401,6 +405,10 @@ void board_init_r (gd_t *id, ulong dest_
/* relocate environment function pointers etc. */
env_relocate();
+#if defined(CONFIG_SYS_I2C_ADAPTERS)
+ i2c_reloc_fixup();
+#endif
+
/* board MAC address */
s = getenv ("ethaddr");
for (i = 0; i < 6; ++i) {
diff -purN u-boot-i2c.orig/lib_ppc/board.c u-boot-i2c/lib_ppc/board.c
--- u-boot-i2c.orig/lib_ppc/board.c 2009-02-12 10:43:41.000000000 -0800
+++ u-boot-i2c/lib_ppc/board.c 2009-02-12 10:46:00.000000000 -0800
@@ -88,7 +88,8 @@ extern void sc3_read_eeprom(void);
void doc_init (void);
#endif
#if defined(CONFIG_HARD_I2C) || \
- defined(CONFIG_SOFT_I2C)
+ defined(CONFIG_SOFT_I2C) || \
+ defined(CONFIG_SYS_I2C_ADAPTERS)
#include <i2c.h>
#endif
#include <spi.h>
@@ -231,11 +232,15 @@ static int init_func_ram (void)
/***********************************************************************/
-#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
+#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) || defined(CONFIG_SYS_I2C_ADAPTERS)
static int init_func_i2c (void)
{
puts ("I2C: ");
+#ifdef CONFIG_NEW_I2C
+ i2c_init_all();
+#else
i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+#endif
puts ("ready\n");
return (0);
}
@@ -330,7 +335,7 @@ init_fnc_t *init_sequence[] = {
misc_init_f,
#endif
INIT_FUNC_WATCHDOG_RESET
-#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
+#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) || defined(CONFIG_SYS_I2C_ADAPTERS)
init_func_i2c,
#endif
#if defined(CONFIG_HARD_SPI)
@@ -847,6 +852,11 @@ void board_init_r (gd_t *id, ulong dest_
* the environment is in EEPROM.
*/
+#if defined(CONFIG_NEW_I2C) && defined(CONFIG_SYS_I2C_ADAPTERS)
+ /* Adjust I2C subsystem pointers after relocation */
+ i2c_reloc_fixup();
+#endif
+
#if defined(CONFIG_SYS_EXTBDINFO)
#if defined(CONFIG_405GP) || defined(CONFIG_405EP)
#if defined(CONFIG_I2CFAST)
More information about the U-Boot
mailing list