From 3f4978c713255c8406875fbdf23ffed1129bc44b Mon Sep 17 00:00:00 2001 From: Heiko Schocher Date: Mon, 16 Jan 2012 21:12:24 +0000 Subject: i2c: common changes for multibus/multiadapter support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Heiko Schocher Signed-off-by: Simon Glass Cc: Henrik Nordström --- arch/arm/lib/board.c | 7 ++++++- arch/blackfin/lib/board.c | 7 +++++++ arch/m68k/lib/board.c | 17 ++++++++++++++--- arch/nds32/lib/board.c | 10 +++++++++- arch/powerpc/cpu/mpc8xx/video.c | 4 ++++ arch/powerpc/lib/board.c | 12 +++++++++--- 6 files changed, 49 insertions(+), 8 deletions(-) (limited to 'arch') diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index 09ab4ad736..5302a1369c 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 #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 f1d55470e8..10223bdb79 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 +#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 efc9fccc1b..582f47b50e 100644 --- a/arch/m68k/lib/board.c +++ b/arch/m68k/lib/board.c @@ -56,7 +56,7 @@ #include #if defined(CONFIG_HARD_I2C) || \ - defined(CONFIG_SOFT_I2C) + defined(CONFIG_SOFT_I2C) #include #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 1157d8c503..29fe12014b 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 +#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 1bbf4ccc65..10e3e88b5e 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 fc4c1d5812..0c2e008e00 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 #endif #include @@ -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) -- cgit v1.2.1 From ea818dbbcd59300b56014ac2d67798a54994eb9b Mon Sep 17 00:00:00 2001 From: Heiko Schocher Date: Tue, 29 Jan 2013 08:53:15 +0100 Subject: i2c, soft-i2c: switch to new multibus/multiadapter support - added to soft_i2c driver new multibus/multiadpater support - adapted all config files, which uses this driver Signed-off-by: Heiko Schocher Cc: Simon Glass Cc: Stephen Warren --- arch/arm/include/asm/arch-kirkwood/config.h | 2 +- arch/arm/lib/board.c | 5 ++--- arch/m68k/lib/board.c | 8 +++----- arch/powerpc/lib/board.c | 9 +++------ 4 files changed, 9 insertions(+), 15 deletions(-) (limited to 'arch') diff --git a/arch/arm/include/asm/arch-kirkwood/config.h b/arch/arm/include/asm/arch-kirkwood/config.h index a9499b70cd..f0e84e62b0 100644 --- a/arch/arm/include/asm/arch-kirkwood/config.h +++ b/arch/arm/include/asm/arch-kirkwood/config.h @@ -144,7 +144,7 @@ * I2C related stuff */ #ifdef CONFIG_CMD_I2C -#ifndef CONFIG_SOFT_I2C +#ifndef CONFIG_SYS_I2C_SOFT #define CONFIG_I2C_MVTWSI #endif #define CONFIG_SYS_I2C_SLAVE 0x0 diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index 5302a1369c..5360883db7 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -69,7 +69,6 @@ extern void dataflash_print_info(void); #endif #if defined(CONFIG_HARD_I2C) || \ - defined(CONFIG_SOFT_I2C) || \ defined(CONFIG_SYS_I2C) #include #endif @@ -166,7 +165,7 @@ static int display_dram_config(void) return (0); } -#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) +#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C) static int init_func_i2c(void) { puts("I2C: "); @@ -273,7 +272,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 */ diff --git a/arch/m68k/lib/board.c b/arch/m68k/lib/board.c index 582f47b50e..2baafa5df3 100644 --- a/arch/m68k/lib/board.c +++ b/arch/m68k/lib/board.c @@ -56,7 +56,7 @@ #include #if defined(CONFIG_HARD_I2C) || \ - defined(CONFIG_SOFT_I2C) + defined(CONFIG_SYS_I2C) #include #endif @@ -142,8 +142,7 @@ static int init_func_ram (void) /***********************************************************************/ -#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) || \ - defined(CONFIG_SYS_I2C) +#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C) static int init_func_i2c (void) { puts ("I2C: "); @@ -183,8 +182,7 @@ init_fnc_t *init_sequence[] = { display_options, checkcpu, checkboard, -#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) || \ - defined(CONFIG_SYS_I2C) +#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C) init_func_i2c, #endif #if defined(CONFIG_HARD_SPI) diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c index 0c2e008e00..bc7c362cf2 100644 --- a/arch/powerpc/lib/board.c +++ b/arch/powerpc/lib/board.c @@ -98,8 +98,7 @@ extern void sc3_read_eeprom(void); #if defined(CONFIG_CMD_DOC) void doc_init(void); #endif -#if defined(CONFIG_HARD_I2C) || \ - defined(CONFIG_SOFT_I2C) +#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C) #include #endif #include @@ -214,8 +213,7 @@ static int init_func_ram(void) /***********************************************************************/ -#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) || \ - defined(CONFIG_SYS_I2C) +#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C) static int init_func_i2c(void) { puts("I2C: "); @@ -312,8 +310,7 @@ static init_fnc_t *init_sequence[] = { misc_init_f, #endif INIT_FUNC_WATCHDOG_RESET -#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) || \ - defined(CONFIG_SYS_I2C) +#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C) init_func_i2c, #endif #if defined(CONFIG_HARD_SPI) -- cgit v1.2.1 From 00f792e0df9ae942427e44595a0f4379582accee Mon Sep 17 00:00:00 2001 From: Heiko Schocher Date: Wed, 24 Oct 2012 13:48:22 +0200 Subject: i2c, fsl_i2c: switch to new multibus/multiadapter support - added to fsl_i2c driver new multibus/multiadpater support - adapted all config files, which uses this driver Signed-off-by: Heiko Schocher Cc: Simon Glass Cc: Stephen Warren --- arch/m68k/cpu/mcf5227x/cpu_init.c | 2 +- arch/m68k/cpu/mcf5227x/speed.c | 2 +- arch/m68k/cpu/mcf523x/cpu_init.c | 2 +- arch/m68k/cpu/mcf523x/speed.c | 2 +- arch/m68k/cpu/mcf52x2/cpu_init.c | 4 ++-- arch/m68k/cpu/mcf52x2/speed.c | 4 ++-- arch/m68k/cpu/mcf532x/cpu_init.c | 4 ++-- arch/m68k/cpu/mcf532x/speed.c | 2 +- arch/m68k/cpu/mcf5445x/cpu_init.c | 2 +- arch/m68k/cpu/mcf5445x/speed.c | 4 ++-- arch/m68k/cpu/mcf547x_8x/cpu_init.c | 2 +- arch/m68k/cpu/mcf547x_8x/speed.c | 2 +- arch/m68k/include/asm/global_data.h | 2 +- 13 files changed, 17 insertions(+), 17 deletions(-) (limited to 'arch') diff --git a/arch/m68k/cpu/mcf5227x/cpu_init.c b/arch/m68k/cpu/mcf5227x/cpu_init.c index 1928eb384e..e9ac21a31d 100644 --- a/arch/m68k/cpu/mcf5227x/cpu_init.c +++ b/arch/m68k/cpu/mcf5227x/cpu_init.c @@ -105,7 +105,7 @@ void cpu_init_f(void) out_be32(&fbcs->csmr5, CONFIG_SYS_CS5_MASK); #endif -#ifdef CONFIG_FSL_I2C +#ifdef CONFIG_SYS_I2C_FSL out_8(&gpio->par_i2c, GPIO_PAR_I2C_SCL_SCL | GPIO_PAR_I2C_SDA_SDA); #endif diff --git a/arch/m68k/cpu/mcf5227x/speed.c b/arch/m68k/cpu/mcf5227x/speed.c index 98f554aa7f..30d32071ad 100644 --- a/arch/m68k/cpu/mcf5227x/speed.c +++ b/arch/m68k/cpu/mcf5227x/speed.c @@ -134,7 +134,7 @@ int get_clocks(void) gd->bus_clk = gd->arch.flb_clk; } -#ifdef CONFIG_FSL_I2C +#ifdef CONFIG_SYS_I2C_FSL gd->arch.i2c1_clk = gd->bus_clk; #endif diff --git a/arch/m68k/cpu/mcf523x/cpu_init.c b/arch/m68k/cpu/mcf523x/cpu_init.c index d1c0b401c1..1ad5d02d29 100644 --- a/arch/m68k/cpu/mcf523x/cpu_init.c +++ b/arch/m68k/cpu/mcf523x/cpu_init.c @@ -115,7 +115,7 @@ void cpu_init_f(void) out_be32(&fbcs->csmr7, CONFIG_SYS_CS7_MASK); #endif -#ifdef CONFIG_FSL_I2C +#ifdef CONFIG_SYS_I2C_FSL CONFIG_SYS_I2C_PINMUX_REG &= CONFIG_SYS_I2C_PINMUX_CLR; CONFIG_SYS_I2C_PINMUX_REG |= CONFIG_SYS_I2C_PINMUX_SET; #endif diff --git a/arch/m68k/cpu/mcf523x/speed.c b/arch/m68k/cpu/mcf523x/speed.c index ae462579e2..7876ba8ab5 100644 --- a/arch/m68k/cpu/mcf523x/speed.c +++ b/arch/m68k/cpu/mcf523x/speed.c @@ -47,7 +47,7 @@ int get_clocks(void) gd->bus_clk = CONFIG_SYS_CLK; gd->cpu_clk = (gd->bus_clk * 2); -#ifdef CONFIG_FSL_I2C +#ifdef CONFIG_SYS_I2C_FSL gd->arch.i2c1_clk = gd->bus_clk; #endif diff --git a/arch/m68k/cpu/mcf52x2/cpu_init.c b/arch/m68k/cpu/mcf52x2/cpu_init.c index 5d0e9f06f3..5d01670ca8 100644 --- a/arch/m68k/cpu/mcf52x2/cpu_init.c +++ b/arch/m68k/cpu/mcf52x2/cpu_init.c @@ -228,7 +228,7 @@ void cpu_init_f(void) /* FlexBus Chipselect */ init_fbcs(); -#ifdef CONFIG_FSL_I2C +#ifdef CONFIG_SYS_I2C_FSL CONFIG_SYS_I2C_PINMUX_REG = CONFIG_SYS_I2C_PINMUX_REG & CONFIG_SYS_I2C_PINMUX_CLR; CONFIG_SYS_I2C_PINMUX_REG |= CONFIG_SYS_I2C_PINMUX_SET; @@ -498,7 +498,7 @@ void cpu_init_f(void) init_fbcs(); #endif /* #ifndef CONFIG_MONITOR_IS_IN_RAM */ -#ifdef CONFIG_FSL_I2C +#ifdef CONFIG_SYS_I2C_FSL CONFIG_SYS_I2C_PINMUX_REG &= CONFIG_SYS_I2C_PINMUX_CLR; CONFIG_SYS_I2C_PINMUX_REG |= CONFIG_SYS_I2C_PINMUX_SET; #endif diff --git a/arch/m68k/cpu/mcf52x2/speed.c b/arch/m68k/cpu/mcf52x2/speed.c index ba7dbaa1cf..ad68692323 100644 --- a/arch/m68k/cpu/mcf52x2/speed.c +++ b/arch/m68k/cpu/mcf52x2/speed.c @@ -90,9 +90,9 @@ int get_clocks (void) gd->bus_clk = gd->cpu_clk; #endif -#ifdef CONFIG_FSL_I2C +#ifdef CONFIG_SYS_I2C_FSL gd->arch.i2c1_clk = gd->bus_clk; -#ifdef CONFIG_SYS_I2C2_OFFSET +#ifdef CONFIG_SYS_I2C2_FSL_OFFSET gd->arch.i2c2_clk = gd->bus_clk; #endif #endif diff --git a/arch/m68k/cpu/mcf532x/cpu_init.c b/arch/m68k/cpu/mcf532x/cpu_init.c index f571fadc35..bd7672d6f4 100644 --- a/arch/m68k/cpu/mcf532x/cpu_init.c +++ b/arch/m68k/cpu/mcf532x/cpu_init.c @@ -98,7 +98,7 @@ void cpu_init_f(void) out_be32(&fbcs->csmr5, CONFIG_SYS_CS5_MASK); #endif -#ifdef CONFIG_FSL_I2C +#ifdef CONFIG_SYS_I2C_FSL out_8(&gpio->par_feci2c, GPIO_PAR_FECI2C_SDA_SDA | GPIO_PAR_FECI2C_SCL_SCL); #endif @@ -292,7 +292,7 @@ void cpu_init_f(void) out_be32(&fbcs->csmr5, CONFIG_SYS_CS5_MASK); #endif -#ifdef CONFIG_FSL_I2C +#ifdef CONFIG_SYS_I2C_FSL out_8(&gpio->par_feci2c, GPIO_PAR_FECI2C_SCL_SCL | GPIO_PAR_FECI2C_SDA_SDA); #endif diff --git a/arch/m68k/cpu/mcf532x/speed.c b/arch/m68k/cpu/mcf532x/speed.c index 8efb451dc1..6e1d6a58e5 100644 --- a/arch/m68k/cpu/mcf532x/speed.c +++ b/arch/m68k/cpu/mcf532x/speed.c @@ -270,7 +270,7 @@ int get_clocks(void) gd->bus_clk = clock_pll(CONFIG_SYS_CLK / 1000, 0) * 1000; gd->cpu_clk = (gd->bus_clk * 3); -#ifdef CONFIG_FSL_I2C +#ifdef CONFIG_SYS_I2C_FSL gd->arch.i2c1_clk = gd->bus_clk; #endif diff --git a/arch/m68k/cpu/mcf5445x/cpu_init.c b/arch/m68k/cpu/mcf5445x/cpu_init.c index 6e947d06f9..3c53a7fe1e 100644 --- a/arch/m68k/cpu/mcf5445x/cpu_init.c +++ b/arch/m68k/cpu/mcf5445x/cpu_init.c @@ -212,7 +212,7 @@ void cpu_init_f(void) GPIO_PAR_FBCTL_OE | GPIO_PAR_FBCTL_TA_TA | GPIO_PAR_FBCTL_RW_RW | GPIO_PAR_FBCTL_TS_TS); -#ifdef CONFIG_FSL_I2C +#ifdef CONFIG_SYS_FSL_I2C out_be16(&gpio->par_feci2c, GPIO_PAR_FECI2C_SCL_SCL | GPIO_PAR_FECI2C_SDA_SDA); #endif diff --git a/arch/m68k/cpu/mcf5445x/speed.c b/arch/m68k/cpu/mcf5445x/speed.c index 0276d4d826..3b341b8964 100644 --- a/arch/m68k/cpu/mcf5445x/speed.c +++ b/arch/m68k/cpu/mcf5445x/speed.c @@ -273,7 +273,7 @@ void setup_5445x_clocks(void) #endif } -#ifdef CONFIG_FSL_I2C +#ifdef CONFIG_SYS_I2C_FSL gd->arch.i2c1_clk = gd->bus_clk; #endif } @@ -289,7 +289,7 @@ int get_clocks(void) setup_5445x_clocks(); #endif -#ifdef CONFIG_FSL_I2C +#ifdef CONFIG_SYS_FSL_I2C gd->arch.i2c1_clk = gd->bus_clk; #endif diff --git a/arch/m68k/cpu/mcf547x_8x/cpu_init.c b/arch/m68k/cpu/mcf547x_8x/cpu_init.c index 4eb8a7c182..4c529dcf91 100644 --- a/arch/m68k/cpu/mcf547x_8x/cpu_init.c +++ b/arch/m68k/cpu/mcf547x_8x/cpu_init.c @@ -95,7 +95,7 @@ void cpu_init_f(void) out_be32(&fbcs->csmr5, CONFIG_SYS_CS5_MASK); #endif -#ifdef CONFIG_FSL_I2C +#ifdef CONFIG_SYS_I2C_FSL out_be16(&gpio->par_feci2cirq, GPIO_PAR_FECI2CIRQ_SCL | GPIO_PAR_FECI2CIRQ_SDA); #endif diff --git a/arch/m68k/cpu/mcf547x_8x/speed.c b/arch/m68k/cpu/mcf547x_8x/speed.c index 41aae9d9eb..80e006b9e0 100644 --- a/arch/m68k/cpu/mcf547x_8x/speed.c +++ b/arch/m68k/cpu/mcf547x_8x/speed.c @@ -40,7 +40,7 @@ int get_clocks(void) gd->bus_clk = CONFIG_SYS_CLK; gd->cpu_clk = (gd->bus_clk * 2); -#ifdef CONFIG_FSL_I2C +#ifdef CONFIG_SYS_I2C_FSL gd->arch.i2c1_clk = gd->bus_clk; #endif diff --git a/arch/m68k/include/asm/global_data.h b/arch/m68k/include/asm/global_data.h index 3ec298ff4a..58a481d834 100644 --- a/arch/m68k/include/asm/global_data.h +++ b/arch/m68k/include/asm/global_data.h @@ -26,7 +26,7 @@ /* Architecture-specific global data */ struct arch_global_data { -#ifdef CONFIG_FSL_I2C +#ifdef CONFIG_SYS_I2C_FSL unsigned long i2c1_clk; unsigned long i2c2_clk; #endif -- cgit v1.2.1 From 9a2accb44f871af9c87c34d1c9ac95010f4e6f09 Mon Sep 17 00:00:00 2001 From: Heiko Schocher Date: Thu, 25 Oct 2012 10:32:14 +0200 Subject: i2c, multibus: get rid of CONFIG_I2C_MUX CONFIG_I2C_MUX is replaced through the new i2c multibus/multiadapter framework, configured through CONFIG_SYS_I2C. As CONFIG_I2C_MUX is only used on the keymile boards, and they are now completely moved to the new framework, remove CONFIG_I2C_MUX. Signed-off-by: Heiko Schocher Cc: Holger Brunck Tested-By: Holger Brunck --- arch/powerpc/cpu/mpc8260/i2c.c | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'arch') diff --git a/arch/powerpc/cpu/mpc8260/i2c.c b/arch/powerpc/cpu/mpc8260/i2c.c index e2341e9c39..bbbe4041af 100644 --- a/arch/powerpc/cpu/mpc8260/i2c.c +++ b/arch/powerpc/cpu/mpc8260/i2c.c @@ -746,23 +746,9 @@ unsigned int i2c_get_bus_num(void) int i2c_set_bus_num(unsigned int bus) { -#if defined(CONFIG_I2C_MUX) - if (bus < CONFIG_SYS_MAX_I2C_BUS) { - i2c_bus_num = bus; - } else { - int ret; - - ret = i2x_mux_select_mux(bus); - if (ret == 0) - i2c_bus_num = bus; - else - return ret; - } -#else if (bus >= CONFIG_SYS_MAX_I2C_BUS) return -1; i2c_bus_num = bus; -#endif return 0; } -- cgit v1.2.1 From 880540decfb855e96bc14ac84ac7784669e4b382 Mon Sep 17 00:00:00 2001 From: Dirk Eibach Date: Thu, 25 Apr 2013 02:40:01 +0000 Subject: i2c, ppc4xx_i2c: switch to new multibus/multiadapter support Signed-off-by: Dirk Eibach Cc: Heiko Schocher Cc: Stefan Roese Tested-by: Stefan Roese --- arch/powerpc/cpu/ppc4xx/40x_spd_sdram.c | 6 +----- arch/powerpc/cpu/ppc4xx/44x_spd_ddr.c | 6 +----- arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c | 3 +-- arch/powerpc/cpu/ppc4xx/cmd_chip_config.c | 2 +- arch/powerpc/cpu/ppc4xx/denali_spd_ddr2.c | 3 +-- arch/powerpc/include/asm/ppc4xx-i2c.h | 18 ------------------ 6 files changed, 5 insertions(+), 33 deletions(-) (limited to 'arch') diff --git a/arch/powerpc/cpu/ppc4xx/40x_spd_sdram.c b/arch/powerpc/cpu/ppc4xx/40x_spd_sdram.c index 48aa75391d..fd458fdc9f 100644 --- a/arch/powerpc/cpu/ppc4xx/40x_spd_sdram.c +++ b/arch/powerpc/cpu/ppc4xx/40x_spd_sdram.c @@ -52,10 +52,6 @@ /* * Set default values */ -#ifndef CONFIG_SYS_I2C_SPEED -#define CONFIG_SYS_I2C_SPEED 50000 -#endif - #define ONE_BILLION 1000000000 #define SDRAM0_CFG_DCE 0x80000000 @@ -158,7 +154,7 @@ long int spd_sdram(int(read_spd)(uint addr)) * Make sure I2C controller is initialized * before continuing. */ - i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); + i2c_set_bus_num(CONFIG_SYS_SPD_BUS_NUM); } /* Make shure we are using SDRAM */ diff --git a/arch/powerpc/cpu/ppc4xx/44x_spd_ddr.c b/arch/powerpc/cpu/ppc4xx/44x_spd_ddr.c index 161d274dff..9c566c19f8 100644 --- a/arch/powerpc/cpu/ppc4xx/44x_spd_ddr.c +++ b/arch/powerpc/cpu/ppc4xx/44x_spd_ddr.c @@ -62,10 +62,6 @@ /* * Set default values */ -#ifndef CONFIG_SYS_I2C_SPEED -#define CONFIG_SYS_I2C_SPEED 50000 -#endif - #define ONE_BILLION 1000000000 /* @@ -168,7 +164,7 @@ long int spd_sdram(void) { * Make sure I2C controller is initialized * before continuing. */ - i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); + i2c_set_bus_num(CONFIG_SYS_SPD_BUS_NUM); /* * Read the SPD information using I2C interface. Check to see if the diff --git a/arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c b/arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c index def7ebf722..a66973ee77 100644 --- a/arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c +++ b/arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c @@ -459,8 +459,7 @@ phys_size_t initdram(int board_type) */ /* switch to correct I2C bus */ - I2C_SET_BUS(CONFIG_SYS_SPD_BUS_NUM); - i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); + i2c_set_bus_num(CONFIG_SYS_SPD_BUS_NUM); /*------------------------------------------------------------------ * Clear out the serial presence detect buffers. diff --git a/arch/powerpc/cpu/ppc4xx/cmd_chip_config.c b/arch/powerpc/cpu/ppc4xx/cmd_chip_config.c index 72c5aec706..0eafe3e067 100644 --- a/arch/powerpc/cpu/ppc4xx/cmd_chip_config.c +++ b/arch/powerpc/cpu/ppc4xx/cmd_chip_config.c @@ -56,7 +56,7 @@ static int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char * const arg * First switch to correct I2C bus. This is I2C bus 0 * for all currently available 4xx derivats. */ - I2C_SET_BUS(0); + i2c_set_bus_num(0); #ifdef CONFIG_CMD_EEPROM ret = eeprom_read(CONFIG_4xx_CONFIG_I2C_EEPROM_ADDR, diff --git a/arch/powerpc/cpu/ppc4xx/denali_spd_ddr2.c b/arch/powerpc/cpu/ppc4xx/denali_spd_ddr2.c index 3ceab32e43..df9637504a 100644 --- a/arch/powerpc/cpu/ppc4xx/denali_spd_ddr2.c +++ b/arch/powerpc/cpu/ppc4xx/denali_spd_ddr2.c @@ -1041,8 +1041,7 @@ phys_size_t initdram(int board_type) * before continuing. */ /* switch to correct I2C bus */ - I2C_SET_BUS(CONFIG_SYS_SPD_BUS_NUM); - i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); + i2c_set_bus_num(CONFIG_SYS_SPD_BUS_NUM); /*------------------------------------------------------------------ * Clear out the serial presence detect buffers. diff --git a/arch/powerpc/include/asm/ppc4xx-i2c.h b/arch/powerpc/include/asm/ppc4xx-i2c.h index 0c6c926f73..89de5086eb 100644 --- a/arch/powerpc/include/asm/ppc4xx-i2c.h +++ b/arch/powerpc/include/asm/ppc4xx-i2c.h @@ -34,24 +34,6 @@ #define IIC_TIMEOUT 1 /* 1 second */ -#if defined(CONFIG_I2C_MULTI_BUS) -#define I2C_BUS_OFFS (i2c_bus_num * 0x100) -#else -#define I2C_BUS_OFFS (0x000) -#endif /* CONFIG_I2C_MULTI_BUS */ - -#if defined(CONFIG_440EP) || defined(CONFIG_440GR) || \ - defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \ - defined(CONFIG_460EX) || defined(CONFIG_460GT) -#define I2C_BASE_ADDR (CONFIG_SYS_PERIPHERAL_BASE + 0x00000700 + I2C_BUS_OFFS) -#elif defined(CONFIG_440) || defined(CONFIG_405EX) -/* all remaining 440 variants */ -#define I2C_BASE_ADDR (CONFIG_SYS_PERIPHERAL_BASE + 0x00000400 + I2C_BUS_OFFS) -#else -/* all 405 variants */ -#define I2C_BASE_ADDR (0xEF600500 + I2C_BUS_OFFS) -#endif - struct ppc4xx_i2c { u8 mdbuf; u8 res1; -- cgit v1.2.1 From 1221b3d74a0d92f3fcb5ff3e8b6f721f562b8305 Mon Sep 17 00:00:00 2001 From: Alison Wang Date: Mon, 17 Jun 2013 15:30:38 +0800 Subject: vf610: Add I2C support for Vybrid VF610 platform This patch adds I2C support for Vybrid VF610 platform and adds I2C0 support to VF610TWR board. Signed-off-by: Alison Wang --- arch/arm/cpu/armv7/vf610/generic.c | 7 +++++++ arch/arm/include/asm/arch-vf610/clock.h | 1 + arch/arm/include/asm/arch-vf610/crm_regs.h | 1 + arch/arm/include/asm/arch-vf610/imx-regs.h | 1 + arch/arm/include/asm/arch-vf610/iomux-vf610.h | 4 ++++ 5 files changed, 14 insertions(+) (limited to 'arch') diff --git a/arch/arm/cpu/armv7/vf610/generic.c b/arch/arm/cpu/armv7/vf610/generic.c index 87f2a8642d..f6ef495382 100644 --- a/arch/arm/cpu/armv7/vf610/generic.c +++ b/arch/arm/cpu/armv7/vf610/generic.c @@ -204,6 +204,11 @@ u32 get_fec_clk(void) return freq; } +static u32 get_i2c_clk(void) +{ + return get_ipg_clk(); +} + unsigned int mxc_get_clock(enum mxc_clock clk) { switch (clk) { @@ -219,6 +224,8 @@ unsigned int mxc_get_clock(enum mxc_clock clk) return get_sdhc_clk(); case MXC_FEC_CLK: return get_fec_clk(); + case MXC_I2C_CLK: + return get_i2c_clk(); default: break; } diff --git a/arch/arm/include/asm/arch-vf610/clock.h b/arch/arm/include/asm/arch-vf610/clock.h index 04e418cf84..3cbae0b829 100644 --- a/arch/arm/include/asm/arch-vf610/clock.h +++ b/arch/arm/include/asm/arch-vf610/clock.h @@ -29,6 +29,7 @@ enum mxc_clock { MXC_UART_CLK, MXC_ESDHC_CLK, MXC_FEC_CLK, + MXC_I2C_CLK, }; void enable_ocotp_clk(unsigned char enable); diff --git a/arch/arm/include/asm/arch-vf610/crm_regs.h b/arch/arm/include/asm/arch-vf610/crm_regs.h index e3f703dc83..6a67eb048c 100644 --- a/arch/arm/include/asm/arch-vf610/crm_regs.h +++ b/arch/arm/include/asm/arch-vf610/crm_regs.h @@ -190,6 +190,7 @@ struct anadig_reg { #define CCM_CCGR4_WKUP_CTRL_MASK (0x3 << 20) #define CCM_CCGR4_CCM_CTRL_MASK (0x3 << 22) #define CCM_CCGR4_GPC_CTRL_MASK (0x3 << 24) +#define CCM_CCGR4_I2C0_CTRL_MASK (0x3 << 12) #define CCM_CCGR6_OCOTP_CTRL_MASK (0x3 << 10) #define CCM_CCGR6_DDRMC_CTRL_MASK (0x3 << 28) #define CCM_CCGR7_SDHC1_CTRL_MASK (0x3 << 4) diff --git a/arch/arm/include/asm/arch-vf610/imx-regs.h b/arch/arm/include/asm/arch-vf610/imx-regs.h index c9df32a21d..742e20a606 100644 --- a/arch/arm/include/asm/arch-vf610/imx-regs.h +++ b/arch/arm/include/asm/arch-vf610/imx-regs.h @@ -103,6 +103,7 @@ #define CONFIG_IOMUX_SHARE_CONF_REG #define FEC_QUIRK_ENET_MAC +#define I2C_QUIRK_REG /* MSCM interrupt rounter */ #define MSCM_IRSPRC_CP0_EN 1 diff --git a/arch/arm/include/asm/arch-vf610/iomux-vf610.h b/arch/arm/include/asm/arch-vf610/iomux-vf610.h index 1c728fa6b7..7aeadce380 100644 --- a/arch/arm/include/asm/arch-vf610/iomux-vf610.h +++ b/arch/arm/include/asm/arch-vf610/iomux-vf610.h @@ -30,6 +30,8 @@ #define VF610_ENET_PAD_CTRL (PAD_CTL_PUS_47K_UP | PAD_CTL_DSE_50ohm | \ PAD_CTL_OBE_IBE_ENABLE) #define VF610_DDR_PAD_CTRL PAD_CTL_DSE_25ohm +#define VF610_I2C_PAD_CTRL (PAD_CTL_PUS_47K_UP | PAD_CTL_DSE_50ohm | \ + PAD_CTL_SPEED_HIGH | PAD_CTL_OBE_IBE_ENABLE) enum { VF610_PAD_PTA6__RMII0_CLKIN = IOMUX_PAD(0x0000, 0x0000, 2, __NA_, 0, VF610_ENET_PAD_CTRL), @@ -50,6 +52,8 @@ enum { VF610_PAD_PTA27__ESDHC1_DAT1 = IOMUX_PAD(0x0044, 0x0044, 5, __NA_, 0, VF610_SDHC_PAD_CTRL), VF610_PAD_PTA28__ESDHC1_DAT2 = IOMUX_PAD(0x0048, 0x0048, 5, __NA_, 0, VF610_SDHC_PAD_CTRL), VF610_PAD_PTA29__ESDHC1_DAT3 = IOMUX_PAD(0x004c, 0x004c, 5, __NA_, 0, VF610_SDHC_PAD_CTRL), + VF610_PAD_PTB14__I2C0_SCL = IOMUX_PAD(0x0090, 0x0090, 2, 0x033c, 1, VF610_I2C_PAD_CTRL), + VF610_PAD_PTB15__I2C0_SDA = IOMUX_PAD(0x0094, 0x0094, 2, 0x0340, 1, VF610_I2C_PAD_CTRL), VF610_PAD_DDR_A15__DDR_A_15 = IOMUX_PAD(0x0220, 0x0220, 0, __NA_, 0, VF610_DDR_PAD_CTRL), VF610_PAD_DDR_A14__DDR_A_14 = IOMUX_PAD(0x0224, 0x0224, 0, __NA_, 0, VF610_DDR_PAD_CTRL), VF610_PAD_DDR_A13__DDR_A_13 = IOMUX_PAD(0x0228, 0x0228, 0, __NA_, 0, VF610_DDR_PAD_CTRL), -- cgit v1.2.1