]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
imx: ventana: detect pmic using i2c probe instead of board model
authorTim Harvey <tharvey@gateworks.com>
Sat, 9 May 2015 01:28:37 +0000 (18:28 -0700)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 1 Sep 2015 13:00:30 +0000 (15:00 +0200)
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 <tharvey@gateworks.com>
board/gateworks/gw_ventana/common.c
board/gateworks/gw_ventana/common.h
board/gateworks/gw_ventana/gw_ventana.c

index 45c5b4c9761476da374d3b065ce2da347088652a..5fa5d6a4de757bc6f09bd15b163787f29082c951 100644 (file)
@@ -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)) {
index a303b5511f319cd67c84ee070cfdb5a04345d579..b7c0e96f2d23ccc7e3d35f00696481210b290da2 100644 (file)
@@ -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) */
index 8c6f4692fbfd266776654d3020476882fe3baddb..22f3b3860b4718c4dfc60560e8010dbd327d77ca 100644 (file)
@@ -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;
 }