From 6d38f3a85d9bfee387c4509d3d927beb4c110901 Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Fri, 8 May 2015 18:28:37 -0700 Subject: [PATCH] imx: ventana: detect pmic using i2c probe instead of board model Avoid requiring board-model and probe pmic by its i2c address. This is in preparation for being able to call pmic_setup() from SPL and not need board type. Signed-off-by: Tim Harvey --- board/gateworks/gw_ventana/common.c | 10 +++++++--- board/gateworks/gw_ventana/common.h | 2 +- board/gateworks/gw_ventana/gw_ventana.c | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/board/gateworks/gw_ventana/common.c b/board/gateworks/gw_ventana/common.c index 45c5b4c976..5fa5d6a4de 100644 --- a/board/gateworks/gw_ventana/common.c +++ b/board/gateworks/gw_ventana/common.c @@ -759,13 +759,16 @@ void setup_board_gpio(int board, struct ventana_board_info *info) } /* setup board specific PMIC */ -void setup_pmic(int board) +void setup_pmic(void) { struct pmic *p; u32 reg; + i2c_set_bus_num(CONFIG_I2C_PMIC); + /* configure PFUZE100 PMIC */ - if (board == GW54xx || board == GW54proto) { + if (!i2c_probe(CONFIG_POWER_PFUZE100_I2C_ADDR)) { + debug("probed PFUZE100@0x%x\n", CONFIG_POWER_PFUZE100_I2C_ADDR); power_pfuze100_init(CONFIG_I2C_PMIC); p = pmic_get("PFUZE100"); if (p && !pmic_probe(p)) { @@ -787,7 +790,8 @@ void setup_pmic(int board) } /* configure LTC3676 PMIC */ - else { + else if (!i2c_probe(CONFIG_POWER_LTC3676_I2C_ADDR)) { + debug("probed LTC3676@0x%x\n", CONFIG_POWER_LTC3676_I2C_ADDR); power_ltc3676_init(CONFIG_I2C_PMIC); p = pmic_get("LTC3676_PMIC"); if (p && !pmic_probe(p)) { diff --git a/board/gateworks/gw_ventana/common.h b/board/gateworks/gw_ventana/common.h index a303b5511f..b7c0e96f2d 100644 --- a/board/gateworks/gw_ventana/common.h +++ b/board/gateworks/gw_ventana/common.h @@ -89,7 +89,7 @@ void setup_ventana_i2c(void); /* configure uart iomux */ void setup_iomux_uart(void); /* conifgure PMIC */ -void setup_pmic(int board); +void setup_pmic(void); /* configure gpio iomux/defaults */ void setup_iomux_gpio(int board, struct ventana_board_info *); /* late setup of GPIO (configuration per baseboard and env) */ diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c index 8c6f4692fb..22f3b3860b 100644 --- a/board/gateworks/gw_ventana/gw_ventana.c +++ b/board/gateworks/gw_ventana/gw_ventana.c @@ -468,7 +468,7 @@ static void setup_display(void) /* setup board specific PMIC */ int power_init_board(void) { - setup_pmic(board_type); + setup_pmic(); return 0; } -- 2.25.1