summaryrefslogtreecommitdiff
path: root/board/servo_v4p1/board.c
diff options
context:
space:
mode:
authorMichał Barnaś <mb@semihalf.com>2021-01-19 18:58:11 +0100
committerCommit Bot <commit-bot@chromium.org>2021-02-23 19:12:37 +0000
commit25fa055c3ecd98c5d339cc4002054c584f99cb1b (patch)
tree1c2075387722a2a41f396da1b663e7639a4de337 /board/servo_v4p1/board.c
parent9497502d59d5979d4a60abb58a67eda7a8051fa4 (diff)
downloadchrome-ec-25fa055c3ecd98c5d339cc4002054c584f99cb1b.tar.gz
servo_v4p1: improve I/O expander implementation
Remove servo_v4p1 custom ioex implementations for TCA64xxA modules. Enable I/O expander module and move from custom interface to generic one. Due to the lack of flash in RW section, IOEX is not available there and required 'board_id_det' function is stubbed using raw i2c functions. This results in IOEX and DAC functions available only in RO section, so their initialization functions are moved to RO-only init. BUG=b:168385201 BRANCH=main TEST=Connect to servo's console and execute 'ioexget' command. All IOEX pins' states should be printed in terminal. Pin TCA_GPIO_DBG_LED_K_ODL should change as LED is blinking. TEST=Connect to servo's console. Plug USB-C charger to servo power port. 'ioexget' command should display EN_PP5000_ALT_3P3 value as 1. Execute 'ioexset EN_PP5000_ALT_3P3 0' command. Unplug fast the servo charger. Servo should be fully operational without any sign of reboot. Signed-off-by: Michał Barnaś <mb@semihalf.com> Change-Id: Iff98b37746a95d6a59954507ab18defac65d6329 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2700297 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'board/servo_v4p1/board.c')
-rw-r--r--board/servo_v4p1/board.c38
1 files changed, 29 insertions, 9 deletions
diff --git a/board/servo_v4p1/board.c b/board/servo_v4p1/board.c
index 79a8a20fe6..7d92c603c8 100644
--- a/board/servo_v4p1/board.c
+++ b/board/servo_v4p1/board.c
@@ -12,6 +12,7 @@
#include "console.h"
#include "dacs.h"
#include <driver/gl3590.h>
+#include "driver/ioexpander/tca64xxa.h"
#include "ec_version.h"
#include "fusb302b.h"
#include "gpio.h"
@@ -425,24 +426,25 @@ static void board_init(void)
/* Delay DUT hub to avoid brownout. */
usleep(MSEC);
- init_ioexpanders();
- CPRINTS("Board ID is %d", board_id_det());
-
- vbus_dischrg_en(0);
-
- init_dacs();
init_pi3usb9201();
/* Clear BBRAM, we don't want any PD state carried over on reset. */
system_set_bbram(SYSTEM_BBRAM_IDX_PD0, 0);
system_set_bbram(SYSTEM_BBRAM_IDX_PD1, 0);
- /* Bring atmel part out of reset */
- atmel_reset_l(1);
-
#ifdef SECTION_IS_RO
+ init_ioexpanders();
+ CPRINTS("Board ID is %d", board_id_det());
+
+ init_dacs();
+ init_uservo_port();
+ init_pathsel();
init_ina231s();
init_fusb302b(1);
+ vbus_dischrg_en(0);
+
+ /* Bring atmel part out of reset */
+ atmel_reset_l(1);
/*
* Get data about available input power. Defer this check, since we need
@@ -474,6 +476,8 @@ static void board_init(void)
/* Start SuzyQ detection */
start_ccd_meas_sbu_cycle();
+#else /* SECTION_IS_RO */
+ CPRINTS("Board ID is %d", board_id_det());
#endif /* SECTION_IS_RO */
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -499,4 +503,20 @@ void tick_event(void)
}
}
DECLARE_HOOK(HOOK_TICK, tick_event, HOOK_PRIO_DEFAULT);
+
+struct ioexpander_config_t ioex_config[] = {
+ [0] = {
+ .drv = &tca64xxa_ioexpander_drv,
+ .i2c_host_port = TCA6416A_PORT,
+ .i2c_slave_addr = TCA6416A_ADDR,
+ .flags = TCA64XXA_FLAG_VER_TCA6416A
+ },
+ [1] = {
+ .drv = &tca64xxa_ioexpander_drv,
+ .i2c_host_port = TCA6424A_PORT,
+ .i2c_slave_addr = TCA6424A_ADDR,
+ .flags = TCA64XXA_FLAG_VER_TCA6424A
+ }
+};
+
#endif /* SECTION_IS_RO */