diff options
author | tim <tim2.lin@ite.corp-partner.google.com> | 2020-04-28 11:05:00 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-04-29 13:15:58 +0000 |
commit | 459021082eb95870af2ad49ac58b5c479895c8dd (patch) | |
tree | 100b717ded3a245a10dbc7a1f71a41255ff747a7 /driver/ioexpander | |
parent | 67fa59b3ad5e49877003f02b8c639d9ed7707a63 (diff) | |
download | chrome-ec-459021082eb95870af2ad49ac58b5c479895c8dd.tar.gz |
ioexpander/it8801: to avoid causing cache to reset when EC is reset
In the initial state, we will read the value of SOVR and write
it to the cache(it8801_gpio_sov[]) to avoid causing cache to
reset when EC is reset.
BUG=b:155050379
BRANCH=none
TEST=make BOARD=kappa -j
Signed-off-by: tim <tim2.lin@ite.corp-partner.google.com>
Change-Id: Id6a881a39c3740dc9c412a854ca9708b3b20fe37
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2167123
Tested-by: Devin Lu <Devin.Lu@quantatw.com>
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'driver/ioexpander')
-rw-r--r-- | driver/ioexpander/it8801.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/driver/ioexpander/it8801.c b/driver/ioexpander/it8801.c index 1226378c9a..2f560a4468 100644 --- a/driver/ioexpander/it8801.c +++ b/driver/ioexpander/it8801.c @@ -211,12 +211,23 @@ static int it8801_ioex_write(int ioex, int reg, int data) reg, data); } +static const int it8801_valid_gpio_group[] = { + IT8801_VALID_GPIO_G0_MASK, + IT8801_VALID_GPIO_G1_MASK, + IT8801_VALID_GPIO_G2_MASK, +}; + +/* Mutexes */ +static struct mutex ioex_mutex; + +static uint8_t it8801_gpio_sov[ARRAY_SIZE(it8801_valid_gpio_group)]; + /* * Initialize the general purpose I/O port(GPIO) */ static int it8801_ioex_init(int ioex) { - int ret; + int ret, port, val = 0; /* Verify Vendor ID registers. */ ret = it8801_check_vendor_id(); @@ -225,20 +236,19 @@ static int it8801_ioex_init(int ioex) return ret; } + /* + * We will read the value of SOVR and write it to the + * cache(it8801_gpio_sov[port]) to avoid causing cache + * to reset when EC is reset. + */ + for (port = 0; port < ARRAY_SIZE(it8801_valid_gpio_group); port++) { + it8801_ioex_read(ioex, IT8801_REG_GPIO_SOVR(port), &val); + it8801_gpio_sov[port] = val; + } + return EC_SUCCESS; } -static const int it8801_valid_gpio_group[] = { - IT8801_VALID_GPIO_G0_MASK, - IT8801_VALID_GPIO_G1_MASK, - IT8801_VALID_GPIO_G2_MASK, -}; - -/* Mutexes */ -static struct mutex ioex_mutex; - -static uint8_t it8801_gpio_sov[ARRAY_SIZE(it8801_valid_gpio_group)]; - static int ioex_check_is_not_valid(int port, int mask) { if (port >= ARRAY_SIZE(it8801_valid_gpio_group)) { |