oak/elm: Add support for anx7688 as PD device.
authorNicolas Boichat <drinkcat@google.com>
Mon, 18 Apr 2016 12:22:56 +0000 (20:22 +0800)
committerchrome-bot <chrome-bot@chromium.org>
Thu, 9 Jun 2016 07:22:48 +0000 (00:22 -0700)
Makes it possible to update ANX7688 FW from AP-FW.

BRANCH=none
BUG=chrome-os-partner:52442
TEST=Boot elm-rev1

Change-Id: I4ecbdf5be5e501b70ccf679b4bd786bf5bfbdb39
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/339476
Reviewed-by: Julius Werner <jwerner@chromium.org>
src/board/oak/board.c

index a084f0a..599ae32 100644 (file)
 
 #include "base/init_funcs.h"
 #include "boot/ramoops.h"
+#include "drivers/bus/i2c/cros_ec_tunnel.h"
 #include "drivers/bus/i2c/mtk_i2c.h"
 #include "drivers/bus/i2s/mt8173.h"
 #include "drivers/bus/spi/mt8173.h"
 #include "drivers/bus/usb/usb.h"
+#include "drivers/ec/anx7688/anx7688.h"
 #include "drivers/ec/cros/ec.h"
 #include "drivers/ec/cros/spi.h"
 #include "drivers/flash/spi.h"
@@ -129,9 +131,21 @@ static int board_setup(void)
        GpioOps *ec_int = sysinfo_lookup_gpio("EC interrupt", 1,
                                              new_mtk_gpio_input);
        CrosEc *cros_ec = new_cros_ec(&cros_ec_spi_bus->ops, 0, ec_int);
-       CrosEc *cros_pd = new_cros_ec(&cros_ec_spi_bus->ops, 1, NULL);
        register_vboot_ec(&cros_ec->vboot, 0);
-       register_vboot_ec(&cros_pd->vboot, 1);
+
+       /* oak-rev7 / elm-rev0 onwards use ANX7688. */
+       if (lib_sysinfo.board_id + CONFIG_BOARD_ID_ADJUSTMENT < 7) {
+               CrosEc *cros_pd = new_cros_ec(&cros_ec_spi_bus->ops, 1, NULL);
+
+               register_vboot_ec(&cros_pd->vboot, 1);
+       } else {
+               CrosECTunnelI2c *cros_ec_i2c_tunnel =
+                       new_cros_ec_tunnel_i2c(cros_ec, 1);
+
+               Anx7688 *anx7688 = new_anx7688(cros_ec_i2c_tunnel);
+
+               register_vboot_ec(&anx7688->vboot, 1);
+       }
 
        Mt6397Pmic *pmic = new_mt6397_power(0x1000D000, 0x10007000);
        power_set_ops(&pmic->ops);