]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
board: common: vid: Move IR chip specific code in flag
authorRajesh Bhagat <rajesh.bhagat@nxp.com>
Wed, 17 Jan 2018 10:43:03 +0000 (16:13 +0530)
committerYork Sun <york.sun@nxp.com>
Tue, 23 Jan 2018 19:19:38 +0000 (11:19 -0800)
Moves IR chip (IR36021) specific code in flag to resolve
compilation issue where it is not present. For example,
LS1088A is having a new LTC3882 voltage chip.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
board/freescale/common/vid.c

index 89904c199c4bdc0cd3ac13a963d633c600cf8a17..f68068eaf896b601bc71e942c141fab95ec16a81 100644 (file)
@@ -41,6 +41,8 @@ int __weak board_adjust_vdd(int vdd)
        return 0;
 }
 
+#if defined(CONFIG_VOL_MONITOR_IR36021_SET) || \
+       defined(CONFIG_VOL_MONITOR_IR36021_READ)
 /*
  * Get the i2c address configuration for the IR regulator chip
  *
@@ -73,6 +75,7 @@ static int find_ir_chip_on_i2c(void)
        }
        return -1;
 }
+#endif
 
 /* Maximum loop count waiting for new voltage to take effect */
 #define MAX_LOOP_WAIT_NEW_VOL          100
@@ -184,6 +187,7 @@ static int read_voltage(int i2caddress)
        return voltage_read;
 }
 
+#ifdef CONFIG_VOL_MONITOR_IR36021_SET
 /*
  * We need to calculate how long before the voltage stops to drop
  * or increase. It returns with the loop count. Each loop takes
@@ -243,7 +247,6 @@ static int wait_for_voltage_stable(int i2caddress)
        return vdd_current;
 }
 
-#ifdef CONFIG_VOL_MONITOR_IR36021_SET
 /* Set the voltage to the IR chip */
 static int set_voltage_to_IR(int i2caddress, int vdd)
 {
@@ -298,7 +301,12 @@ int adjust_vdd(ulong vdd_override)
        int re_enable = disable_interrupts();
        struct ccsr_gur *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
        u32 fusesr;
+#if defined(CONFIG_VOL_MONITOR_IR36021_SET) || \
+       defined(CONFIG_VOL_MONITOR_IR36021_READ)
        u8 vid, buf;
+#else
+       u8 vid;
+#endif
        int vdd_target, vdd_current, vdd_last;
        int ret, i2caddress;
        unsigned long vdd_string_override;
@@ -386,6 +394,8 @@ int adjust_vdd(ulong vdd_override)
                ret = -1;
                goto exit;
        }
+#if defined(CONFIG_VOL_MONITOR_IR36021_SET) || \
+       defined(CONFIG_VOL_MONITOR_IR36021_READ)
        ret = find_ir_chip_on_i2c();
        if (ret < 0) {
                printf("VID: Could not find voltage regulator on I2C.\n");
@@ -410,6 +420,7 @@ int adjust_vdd(ulong vdd_override)
                ret = -1;
                goto exit;
        }
+#endif
 
        /* get the voltage ID from fuse status register */
        fusesr = in_le32(&gur->dcfg_fusesr);
@@ -549,6 +560,8 @@ int adjust_vdd(ulong vdd_override)
                ret = -1;
                goto exit;
        }
+#if defined(CONFIG_VOL_MONITOR_IR36021_SET) || \
+       defined(CONFIG_VOL_MONITOR_IR36021_READ)
        ret = find_ir_chip_on_i2c();
        if (ret < 0) {
                printf("VID: Could not find voltage regulator on I2C.\n");
@@ -573,6 +586,7 @@ int adjust_vdd(ulong vdd_override)
                ret = -1;
                goto exit;
        }
+#endif
 
        /* get the voltage ID from fuse status register */
        fusesr = in_be32(&gur->dcfg_fusesr);
@@ -683,6 +697,8 @@ static int print_vdd(void)
                debug("VID : I2c failed to switch channel\n");
                return -1;
        }
+#if defined(CONFIG_VOL_MONITOR_IR36021_SET) || \
+       defined(CONFIG_VOL_MONITOR_IR36021_READ)
        ret = find_ir_chip_on_i2c();
        if (ret < 0) {
                printf("VID: Could not find voltage regulator on I2C.\n");
@@ -691,6 +707,7 @@ static int print_vdd(void)
                i2caddress = ret;
                debug("VID: IR Chip found on I2C address 0x%02x\n", i2caddress);
        }
+#endif
 
        /*
         * Read voltage monitor to check real voltage.