diff mbox

[U-Boot,v4,04/11] KM: define CONFIG_SYS_I2C_INIT_BOARD only for concerned board

Message ID 1382089644-14595-5-git-send-email-valentin.longchamp@keymile.com
State Accepted
Delegated to: York Sun
Headers show

Commit Message

Valentin Longchamp Oct. 18, 2013, 9:47 a.m. UTC
This must be defined for all the keymile boards that use the common
i2c_abort function that is used to "reset" the I2C bus. These are
currently km82xx and km_arm boards.

The  km83xx boards use other functions and thus do not need this.

This patch removes the CONFIG_SYS_I2C_INIT_BOARD from keymile-common.h
and defines it for km_arm.h and km82xx.h.

Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>

---
Changes in v4: None
Changes in v3:
- take the new I2C defines into account and use
  CONFIG_SYS_I2C_INIT_BOARD instead of an additional option and define
  it only for the I2C bitbang KM boards (km_arm and km82xx) and not for
  all KM boards.

Changes in v2:
- Introduce CONFIG_KM_I2C_ABORT #define to avoid #if !defined in
  common.c

 board/keymile/common/common.c       | 25 -------------------------
 include/configs/km/keymile-common.h |  2 --
 include/configs/km/km_arm.h         |  4 +---
 include/configs/km82xx.h            |  2 ++
 4 files changed, 3 insertions(+), 30 deletions(-)

Comments

York Sun Oct. 18, 2013, 6:21 p.m. UTC | #1
On 10/18/2013 02:47 AM, Valentin Longchamp wrote:
> This must be defined for all the keymile boards that use the common
> i2c_abort function that is used to "reset" the I2C bus. These are
> currently km82xx and km_arm boards.
> 
> The  km83xx boards use other functions and thus do not need this.
> 
> This patch removes the CONFIG_SYS_I2C_INIT_BOARD from keymile-common.h
> and defines it for km_arm.h and km82xx.h.
> 
> Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
> 
> ---
> Changes in v4: None
> Changes in v3:
> - take the new I2C defines into account and use
>   CONFIG_SYS_I2C_INIT_BOARD instead of an additional option and define
>   it only for the I2C bitbang KM boards (km_arm and km82xx) and not for
>   all KM boards.
> 
> Changes in v2:
> - Introduce CONFIG_KM_I2C_ABORT #define to avoid #if !defined in
>   common.c

Applied to 85xx/next, pending merge to 85xx/master.

York
Heiko Schocher Oct. 28, 2013, 7:02 a.m. UTC | #2
Hello Valentin,

Am 18.10.2013 11:47, schrieb Valentin Longchamp:
> This must be defined for all the keymile boards that use the common
> i2c_abort function that is used to "reset" the I2C bus. These are
> currently km82xx and km_arm boards.
>
> The  km83xx boards use other functions and thus do not need this.
>
> This patch removes the CONFIG_SYS_I2C_INIT_BOARD from keymile-common.h
> and defines it for km_arm.h and km82xx.h.
>
> Signed-off-by: Valentin Longchamp<valentin.longchamp@keymile.com>
>
> ---
> Changes in v4: None
> Changes in v3:
> - take the new I2C defines into account and use
>    CONFIG_SYS_I2C_INIT_BOARD instead of an additional option and define
>    it only for the I2C bitbang KM boards (km_arm and km82xx) and not for
>    all KM boards.
>
> Changes in v2:
> - Introduce CONFIG_KM_I2C_ABORT #define to avoid #if !defined in
>    common.c
>
>   board/keymile/common/common.c       | 25 -------------------------
>   include/configs/km/keymile-common.h |  2 --
>   include/configs/km/km_arm.h         |  4 +---
>   include/configs/km82xx.h            |  2 ++
>   4 files changed, 3 insertions(+), 30 deletions(-)

Thanks.

Acked-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
diff mbox

Patch

diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index 136b2de..3d7b056 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -24,10 +24,6 @@ 
 #include "common.h"
 #include <i2c.h>
 
-#if !defined(CONFIG_MPC83xx)
-static void i2c_write_start_seq(void);
-#endif
-
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
@@ -78,7 +74,6 @@  int set_km_env(void)
 }
 
 #if defined(CONFIG_SYS_I2C_INIT_BOARD)
-#if !defined(CONFIG_MPC83xx)
 static void i2c_write_start_seq(void)
 {
 	set_sda(1);
@@ -101,21 +96,6 @@  static void i2c_write_start_seq(void)
  */
 int i2c_make_abort(void)
 {
-
-#if defined(CONFIG_HARD_I2C) && !defined(MACH_TYPE_KM_KIRKWOOD)
-	immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
-	i2c8260_t *i2c	= (i2c8260_t *)&immap->im_i2c;
-
-	/*
-	 * disable I2C controller first, otherwhise it thinks we want to
-	 * talk to the slave port...
-	 */
-	clrbits_8(&i2c->i2c_i2mod, 0x01);
-
-	/* Set the PortPins to GPIO */
-	setports(1);
-#endif
-
 	int	scl_state = 0;
 	int	sda_state = 0;
 	int	i = 0;
@@ -148,13 +128,8 @@  int i2c_make_abort(void)
 	set_sda(1);
 	get_sda();
 
-#if defined(CONFIG_HARD_I2C)
-	/* Set the PortPins back to use for I2C */
-	setports(0);
-#endif
 	return ret;
 }
-#endif
 
 /**
  * i2c_init_board - reset i2c bus. When the board is powercycled during a
diff --git a/include/configs/km/keymile-common.h b/include/configs/km/keymile-common.h
index 2524ceb..f62fdf6 100644
--- a/include/configs/km/keymile-common.h
+++ b/include/configs/km/keymile-common.h
@@ -63,8 +63,6 @@ 
 #define CONFIG_LOADS_ECHO
 #define CONFIG_SYS_LOADS_BAUD_CHANGE
 
-#define CONFIG_SYS_I2C_INIT_BOARD
-
 /* Support the IVM EEprom */
 #define	CONFIG_SYS_IVM_EEPROM_ADR	0x50
 #define CONFIG_SYS_IVM_EEPROM_MAX_LEN	0x400
diff --git a/include/configs/km/km_arm.h b/include/configs/km/km_arm.h
index 75b6250..36c2fba 100644
--- a/include/configs/km/km_arm.h
+++ b/include/configs/km/km_arm.h
@@ -176,10 +176,9 @@ 
 #undef CONFIG_I2C_MVTWSI
 #define CONFIG_SYS_I2C
 #define	CONFIG_SYS_I2C_SOFT	/* I2C bit-banged	*/
+#define CONFIG_SYS_I2C_INIT_BOARD
 
 #define	CONFIG_KIRKWOOD_GPIO		/* Enable GPIO Support */
-#if defined(CONFIG_SYS_I2C_SOFT)
-
 #define CONFIG_SYS_NUM_I2C_BUSES	6
 #define CONFIG_SYS_I2C_MAX_HOPS		1
 #define CONFIG_SYS_I2C_BUSES	{	{0, {I2C_NULL_HOP} }, \
@@ -214,7 +213,6 @@  int get_scl(void);
 
 #define	CONFIG_SYS_I2C_SOFT_SLAVE	0x0
 #define	CONFIG_SYS_I2C_SOFT_SPEED	100000
-#endif
 
 /* EEprom support 24C128, 24C256 valid for environment eeprom */
 #define CONFIG_SYS_I2C_MULTI_EEPROMS
diff --git a/include/configs/km82xx.h b/include/configs/km82xx.h
index 986c65f..029c348 100644
--- a/include/configs/km82xx.h
+++ b/include/configs/km82xx.h
@@ -227,6 +227,7 @@ 
 /* enable I2C and select the hardware/software driver */
 #define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_SOFT		/* I2C bit-banged */
+#define CONFIG_SYS_I2C_INIT_BOARD
 #define CONFIG_SYS_NUM_I2C_BUSES	3
 #define CONFIG_SYS_I2C_MAX_HOPS		1
 #define CONFIG_SYS_I2C_SOFT_SPEED	50000
@@ -237,6 +238,7 @@ 
 			{0, {{I2C_MUX_PCA9542, 0x70, 1} } } }
 
 #define CONFIG_KM_IVM_BUS		1	/* I2C2 (Mux-Port 1)*/
+#define CONFIG_KM_I2C_ABORT
 
 /*
  * Software (bit-bang) I2C driver configuration