Skip to contentSkip to conversation

imx: Explicitly pass the I2C bus number in pmic_init()

PATCH New Fabio Estevam 2 participants 2 messages Nov 20, 2013 – Nov 21, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 imx: Explicitly pass the I2C bus number in pmic_init()

From: Fabio Estevam <[email protected]>

The pmic_init() function has the I2C or SPI bus number that is connected to the PMIC.

Instead of passing I2C_PMIC, explicitly pass the I2C bus number via I2C_x definition.

The motivation for doing this is to avoid people just doing a copy and paste of I2C_PMIC into their board file when another I2C bus is actually used to interface to their PMIC.

This also makes more obvious which is the I2C bus connected to the PMIC, without having to search in the source code for the meaning of the 'I2C_PMIC' number.

---
 board/freescale/mx25pdk/mx25pdk.c   | 2 +-
 board/freescale/mx35pdk/mx35pdk.c   | 2 +-
 board/freescale/mx53evk/mx53evk.c   | 2 +-
 board/freescale/mx53loco/mx53loco.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
board/freescale/mx25pdk/mx25pdk.c +1 -1
index ebe3bcb..71a395c 100644
@@ -138,7 +138,7 @@ int board_late_init(void)
 
 	mx25pdk_fec_init();
 
-	ret = pmic_init(I2C_PMIC);
+	ret = pmic_init(I2C_0);
 	if (ret)
 		return ret;
 
board/freescale/mx35pdk/mx35pdk.c +1 -1
index 9fabef5..12467a9 100644
@@ -213,7 +213,7 @@ int board_late_init(void)
 	struct pmic *p;
 	int ret;
 
-	ret = pmic_init(I2C_PMIC);
+	ret = pmic_init(I2C_0);
 	if (ret)
 		return ret;
 
board/freescale/mx53evk/mx53evk.c +1 -1
index 3b398b6..13519e2 100644
@@ -81,7 +81,7 @@ void power_init(void)
 	struct pmic *p;
 	int ret;
 
-	ret = pmic_init(I2C_PMIC);
+	ret = pmic_init(I2C_0);
 	if (ret)
 		return;
 
board/freescale/mx53loco/mx53loco.c +1 -1
index ae7eca8..db0bf17 100644
@@ -258,7 +258,7 @@ static int power_init(void)
 	}
 
 	if (!i2c_probe(CONFIG_SYS_FSL_PMIC_I2C_ADDR)) {
-		ret = pmic_init(I2C_PMIC);
+		ret = pmic_init(I2C_0);
 		if (ret)
 			return ret;
 
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH 1/1 imx: Explicitly pass the I2C bus number in pmic_init()

Quoted 68 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

The pmic_init() function has the I2C or SPI bus number that is connected to the PMIC.

Instead of passing I2C_PMIC, explicitly pass the I2C bus number via I2C_x definition.

The motivation for doing this is to avoid people just doing a copy and paste of I2C_PMIC into their board file when another I2C bus is actually used to interface to their PMIC.

This also makes more obvious which is the I2C bus connected to the PMIC, without having to search in the source code for the meaning of the 'I2C_PMIC' number.

---
 board/freescale/mx25pdk/mx25pdk.c   | 2 +-
 board/freescale/mx35pdk/mx35pdk.c   | 2 +-
 board/freescale/mx53evk/mx53evk.c   | 2 +-
 board/freescale/mx53loco/mx53loco.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
board/freescale/mx25pdk/mx25pdk.c +1 -1
index ebe3bcb..71a395c 100644
@@ -138,7 +138,7 @@ int board_late_init(void)
 
 	mx25pdk_fec_init();
 
-	ret = pmic_init(I2C_PMIC);
+	ret = pmic_init(I2C_0);
 	if (ret)
 		return ret;
 
board/freescale/mx35pdk/mx35pdk.c +1 -1
index 9fabef5..12467a9 100644
@@ -213,7 +213,7 @@ int board_late_init(void)
 	struct pmic *p;
 	int ret;
 
-	ret = pmic_init(I2C_PMIC);
+	ret = pmic_init(I2C_0);
 	if (ret)
 		return ret;
 
board/freescale/mx53evk/mx53evk.c +1 -1
index 3b398b6..13519e2 100644
@@ -81,7 +81,7 @@ void power_init(void)
 	struct pmic *p;
 	int ret;
 
-	ret = pmic_init(I2C_PMIC);
+	ret = pmic_init(I2C_0);
 	if (ret)
 		return;
 
board/freescale/mx53loco/mx53loco.c +0 -0
index ae7eca8..db0bf17 100644

board/freescale/mx53loco/mx53loco.c static int power_init(void) · line 264

Quoted 8 lines
board/freescale/mx53loco/mx53loco.c +1 -1
@@ -258,7 +258,7 @@ static int power_init(void)
 	}
 
 	if (!i2c_probe(CONFIG_SYS_FSL_PMIC_I2C_ADDR)) {
-		ret = pmic_init(I2C_PMIC);
+		ret = pmic_init(I2C_0);
 		if (ret)
 			return ret;
 

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================