]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
imx: ventana: move GSC boot watchdog disable function to gsc.c
authorTim Harvey <tharvey@gateworks.com>
Sat, 9 May 2015 01:28:36 +0000 (18:28 -0700)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 1 Sep 2015 13:00:30 +0000 (15:00 +0200)
Move the code that disables the GSC boot watchdog into gsc.c

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
board/gateworks/gw_ventana/gsc.c
board/gateworks/gw_ventana/gsc.h
board/gateworks/gw_ventana/gw_ventana.c

index 718e1651d0f652f609bedb42351cfe2a29a6877c..3febd1276ebc081edc741c5cb787c52d75cf6b74 100644 (file)
@@ -132,6 +132,33 @@ int gsc_info(int verbose)
        return 0;
 }
 
+/*
+ *  The Gateworks System Controller implements a boot
+ *  watchdog (always enabled) as a workaround for IMX6 boot related
+ *  errata such as:
+ *    ERR005768 - no fix scheduled
+ *    ERR006282 - fixed in silicon r1.2
+ *    ERR007117 - fixed in silicon r1.3
+ *    ERR007220 - fixed in silicon r1.3
+ *    ERR007926 - no fix scheduled
+ *  see http://cache.freescale.com/files/32bit/doc/errata/IMX6DQCE.pdf
+ *
+ * Disable the boot watchdog
+ */
+int gsc_boot_wd_disable(void)
+{
+       u8 reg;
+
+       i2c_set_bus_num(CONFIG_I2C_GSC);
+       if (!gsc_i2c_read(GSC_SC_ADDR, GSC_SC_CTRL1, 1, &reg, 1)) {
+               reg |= (1 << GSC_SC_CTRL1_WDDIS);
+               if (!gsc_i2c_write(GSC_SC_ADDR, GSC_SC_CTRL1, 1, &reg, 1))
+                       return 0;
+       }
+       puts("Error: could not disable GSC Watchdog\n");
+       return 1;
+}
+
 #ifdef CONFIG_CMD_GSC
 static int do_gsc_wd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
index 2d4969ecdd3e5bb95be54f319c6f348f733e01ec..e0c0ed0df1ff5e7c4b4dada79ddab0f18801de3c 100644 (file)
@@ -66,5 +66,6 @@ enum {
 int gsc_i2c_read(uchar chip, uint addr, int alen, uchar *buf, int len);
 int gsc_i2c_write(uchar chip, uint addr, int alen, uchar *buf, int len);
 int gsc_info(int verbose);
+int gsc_boot_wd_disable(void);
 #endif
 
index 8163d388e1a4cb8d57daff92b7bd666eb1a925e1..8c6f4692fbfd266776654d3020476882fe3baddb 100644 (file)
@@ -659,7 +659,6 @@ static const struct boot_mode board_boot_modes[] = {
 int misc_init_r(void)
 {
        struct ventana_board_info *info = &ventana_info;
-       unsigned char reg;
 
        /* set env vars based on EEPROM data */
        if (ventana_info.model[0]) {
@@ -740,27 +739,8 @@ int misc_init_r(void)
        add_board_boot_modes(board_boot_modes);
 #endif
 
-       /*
-        *  The Gateworks System Controller implements a boot
-        *  watchdog (always enabled) as a workaround for IMX6 boot related
-        *  errata such as:
-        *    ERR005768 - no fix scheduled
-        *    ERR006282 - fixed in silicon r1.2
-        *    ERR007117 - fixed in silicon r1.3
-        *    ERR007220 - fixed in silicon r1.3
-        *    ERR007926 - no fix scheduled
-        *  see http://cache.freescale.com/files/32bit/doc/errata/IMX6DQCE.pdf
-        *
-        * Disable the boot watchdog and display/clear the timeout flag if set
-        */
-       i2c_set_bus_num(CONFIG_I2C_GSC);
-       if (!gsc_i2c_read(GSC_SC_ADDR, GSC_SC_CTRL1, 1, &reg, 1)) {
-               reg |= (1 << GSC_SC_CTRL1_WDDIS);
-               if (gsc_i2c_write(GSC_SC_ADDR, GSC_SC_CTRL1, 1, &reg, 1))
-                       puts("Error: could not disable GSC Watchdog\n");
-       } else {
-               puts("Error: could not disable GSC Watchdog\n");
-       }
+       /* disable boot watchdog */
+       gsc_boot_wd_disable();
 
        return 0;
 }