summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@freescale.com>2012-10-23 06:34:50 +0000
committerStefano Babic <sbabic@denx.de>2012-10-26 16:28:07 +0200
commit4cfc6c4fa7611e79e6434e97db56b6072ad4d05c (patch)
tree565b8a51b36f1d4f811c47a7383bea249fc7c3b0 /drivers
parentaf2a4093cb141f9c5ea433c41ab06a528a7792a6 (diff)
downloadu-boot-imx-4cfc6c4fa7611e79e6434e97db56b6072ad4d05c.zip
u-boot-imx-4cfc6c4fa7611e79e6434e97db56b6072ad4d05c.tar.gz
u-boot-imx-4cfc6c4fa7611e79e6434e97db56b6072ad4d05c.tar.bz2
pmic_fsl: Introduce FSL_PMIC_I2C_LENGTH
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@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/misc/pmic_fsl.c6
1 files changed, 5 insertions, 1 deletions
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"