[U-Boot] [PATCH v3 3/6] pmic_fsl: Introduce FSL_PMIC_I2C_LENGTH

Fabio Estevam fabio.estevam at freescale.com
Tue Oct 23 18:34:50 CEST 2012


Introduce FSL_PMIC_I2C_LENGTH to configure the number of bytes that are used to 
communicate with the PMIC via I2C.

Instead of hardcoding the value, pass the number via a configurable option per
PMIC type.

This will be useful for adding support for PMIC MC34704 from Freescale, which 
uses only one byte in its I2C protocol.

Signed-off-by: Fabio Estevam <fabio.estevam at freescale.com>
---
Changes since v2:
- Do not pass FSL_PMIC_I2C_LENGTH in the board file

 drivers/misc/pmic_fsl.c    |    6 +++++-
 include/configs/mx35pdk.h  |    1 +
 include/configs/mx53loco.h |    1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/pmic_fsl.c b/drivers/misc/pmic_fsl.c
index 0ff75ed..9d80b55 100644
--- a/drivers/misc/pmic_fsl.c
+++ b/drivers/misc/pmic_fsl.c
@@ -26,6 +26,10 @@
 #include <pmic.h>
 #include <fsl_pmic.h>
 
+#if defined(CONFIG_PMIC_FSL_MC13892)
+#define FSL_PMIC_I2C_LENGTH	3
+#endif
+
 #if defined(CONFIG_PMIC_SPI)
 static u32 pmic_spi_prepare_tx(u32 reg, u32 *val, u32 write)
 {
@@ -53,7 +57,7 @@ int pmic_init(void)
 #elif defined(CONFIG_PMIC_I2C)
 	p->interface = PMIC_I2C;
 	p->hw.i2c.addr = CONFIG_SYS_FSL_PMIC_I2C_ADDR;
-	p->hw.i2c.tx_num = 3;
+	p->hw.i2c.tx_num = FSL_PMIC_I2C_LENGTH;
 	p->bus = I2C_PMIC;
 #else
 #error "You must select CONFIG_PMIC_SPI or CONFIG_PMIC_I2C"
diff --git a/include/configs/mx35pdk.h b/include/configs/mx35pdk.h
index 826c912..e79f76e 100644
--- a/include/configs/mx35pdk.h
+++ b/include/configs/mx35pdk.h
@@ -68,6 +68,7 @@
 #define CONFIG_PMIC
 #define CONFIG_PMIC_I2C
 #define CONFIG_PMIC_FSL
+#define CONFIG_PMIC_FSL_MC13892
 #define CONFIG_SYS_FSL_PMIC_I2C_ADDR	0x08
 #define CONFIG_RTC_MC13XXX
 
diff --git a/include/configs/mx53loco.h b/include/configs/mx53loco.h
index 0658dd3..9e8f5ce 100644
--- a/include/configs/mx53loco.h
+++ b/include/configs/mx53loco.h
@@ -93,6 +93,7 @@
 #define CONFIG_PMIC_I2C
 #define CONFIG_DIALOG_PMIC
 #define CONFIG_PMIC_FSL
+#define CONFIG_PMIC_FSL_MC13892
 #define CONFIG_SYS_DIALOG_PMIC_I2C_ADDR	0x48
 #define CONFIG_SYS_FSL_PMIC_I2C_ADDR	0x8
 
-- 
1.7.9.5




More information about the U-Boot mailing list