summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorHeiko Schocher <hs@denx.de>2012-01-16 21:12:24 +0000
committerHeiko Schocher <hs@denx.de>2013-07-23 05:54:28 +0200
commit3f4978c713255c8406875fbdf23ffed1129bc44b (patch)
treec27f00ba6219d75f772167b7630bb4ebb383a271 /arch
parent385c9ef5a7215b2b0c22836fee6c692dfc8559d7 (diff)
downloadu-boot-imx-3f4978c713255c8406875fbdf23ffed1129bc44b.zip
u-boot-imx-3f4978c713255c8406875fbdf23ffed1129bc44b.tar.gz
u-boot-imx-3f4978c713255c8406875fbdf23ffed1129bc44b.tar.bz2
i2c: common changes for multibus/multiadapter support
Signed-off-by: Heiko Schocher <hs@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org> Cc: Henrik Nordström <henrik@henriknordstrom.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/lib/board.c7
-rw-r--r--arch/blackfin/lib/board.c7
-rw-r--r--arch/m68k/lib/board.c17
-rw-r--r--arch/nds32/lib/board.c10
-rw-r--r--arch/powerpc/cpu/mpc8xx/video.c4
-rw-r--r--arch/powerpc/lib/board.c12
6 files changed, 49 insertions, 8 deletions
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 09ab4ad..5302a13 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -69,7 +69,8 @@ extern void dataflash_print_info(void);
#endif
#if defined(CONFIG_HARD_I2C) || \
- defined(CONFIG_SOFT_I2C)
+ defined(CONFIG_SOFT_I2C) || \
+ defined(CONFIG_SYS_I2C)
#include <i2c.h>
#endif
@@ -169,7 +170,11 @@ static int display_dram_config(void)
static int init_func_i2c(void)
{
puts("I2C: ");
+#ifdef CONFIG_SYS_I2C
+ i2c_init_all();
+#else
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+#endif
puts("ready\n");
return (0);
}
diff --git a/arch/blackfin/lib/board.c b/arch/blackfin/lib/board.c
index f1d5547..10223bd 100644
--- a/arch/blackfin/lib/board.c
+++ b/arch/blackfin/lib/board.c
@@ -37,6 +37,10 @@
int post_flag;
#endif
+#if defined(CONFIG_SYS_I2C)
+#include <i2c.h>
+#endif
+
DECLARE_GLOBAL_DATA_PTR;
__attribute__((always_inline))
@@ -387,6 +391,9 @@ void board_init_r(gd_t * id, ulong dest_addr)
mmc_initialize(bd);
#endif
+#if defined(CONFIG_SYS_I2C)
+ i2c_reloc_fixup();
+#endif
/* relocate environment function pointers etc. */
env_relocate();
diff --git a/arch/m68k/lib/board.c b/arch/m68k/lib/board.c
index efc9fcc..582f47b 100644
--- a/arch/m68k/lib/board.c
+++ b/arch/m68k/lib/board.c
@@ -56,7 +56,7 @@
#include <version.h>
#if defined(CONFIG_HARD_I2C) || \
- defined(CONFIG_SOFT_I2C)
+ defined(CONFIG_SOFT_I2C)
#include <i2c.h>
#endif
@@ -142,11 +142,16 @@ 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)
static int init_func_i2c (void)
{
puts ("I2C: ");
+#ifdef CONFIG_SYS_I2C
+ i2c_init_all();
+#else
i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+#endif
puts ("ready\n");
return (0);
}
@@ -178,7 +183,8 @@ 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)
init_func_i2c,
#endif
#if defined(CONFIG_HARD_SPI)
@@ -501,6 +507,11 @@ void board_init_r (gd_t *id, ulong dest_addr)
spi_init_r ();
#endif
+#if defined(CONFIG_SYS_I2C)
+ /* Adjust I2C subsystem pointers after relocation */
+ i2c_reloc_fixup();
+#endif
+
/* relocate environment function pointers etc. */
env_relocate ();
diff --git a/arch/nds32/lib/board.c b/arch/nds32/lib/board.c
index 1157d8c..29fe120 100644
--- a/arch/nds32/lib/board.c
+++ b/arch/nds32/lib/board.c
@@ -40,6 +40,10 @@
DECLARE_GLOBAL_DATA_PTR;
+#if defined(CONFIG_SYS_I2C)
+#include <i2c.h>
+#endif
+
ulong monitor_flash_len;
/*
@@ -173,7 +177,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_SYS_I2C)
init_func_i2c,
#endif
dram_init, /* configure available RAM banks */
@@ -347,6 +351,10 @@ void board_init_r(gd_t *id, ulong dest_addr)
mmc_initialize(gd->bd);
#endif
+#if defined(CONFIG_SYS_I2C_ADAPTERS)
+ i2c_reloc_fixup();
+#endif
+
/* initialize environment */
env_relocate();
diff --git a/arch/powerpc/cpu/mpc8xx/video.c b/arch/powerpc/cpu/mpc8xx/video.c
index 1bbf4cc..10e3e88 100644
--- a/arch/powerpc/cpu/mpc8xx/video.c
+++ b/arch/powerpc/cpu/mpc8xx/video.c
@@ -809,7 +809,11 @@ static void video_encoder_init (void)
/* Initialize the I2C */
debug ("[VIDEO ENCODER] Initializing I2C bus...\n");
+#ifdef CONFIG_SYS_I2C
+ i2c_init_all();
+#else
i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+#endif
#ifdef CONFIG_FADS
/* Reset ADV7176 chip */
diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index fc4c1d5..0c2e008 100644
--- a/arch/powerpc/lib/board.c
+++ b/arch/powerpc/lib/board.c
@@ -99,7 +99,7 @@ extern void sc3_read_eeprom(void);
void doc_init(void);
#endif
#if defined(CONFIG_HARD_I2C) || \
- defined(CONFIG_SOFT_I2C)
+ defined(CONFIG_SOFT_I2C)
#include <i2c.h>
#endif
#include <spi.h>
@@ -214,11 +214,16 @@ 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)
static int init_func_i2c(void)
{
puts("I2C: ");
+#ifdef CONFIG_SYS_I2C
+ i2c_init_all();
+#else
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+#endif
puts("ready\n");
return 0;
}
@@ -307,7 +312,8 @@ static 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)
init_func_i2c,
#endif
#if defined(CONFIG_HARD_SPI)