diff options
author | Vijay Hiremath <vijay.p.hiremath@intel.com> | 2021-10-01 13:45:27 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-10-12 20:28:24 +0000 |
commit | af15326d86c6060aa5aaabb6d6a4ec3ae9e259bb (patch) | |
tree | 783c078ec98185d8f5c68a596fc7e9b976200ca9 /common/ioexpander.c | |
parent | 184021ee2aca6d13b30c1d5b75eea39789acef92 (diff) | |
download | chrome-ec-af15326d86c6060aa5aaabb6d6a4ec3ae9e259bb.tar.gz |
IOEX: Cleanup: Use IOEX_FLAGS_INITIALIZED flag to get the IOEX status
IOEX_FLAGS_DISABLED is replaced with IOEX_FLAGS_DEFAULT_INIT_DISABLED
hence use IOEX_FLAGS_INITIALIZED flag to get the initialization status
of the IOEXes.
BUG=none
BRANCH=none
TEST=Tested on Brya. 'ioexget' command works and also default init
function skips IOEX initialization.
Change-Id: I98ff9643223c02388a2fa679b4631e3389fd466e
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3200063
Reviewed-by: Poornima Tom <poornima.tom@intel.com>
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'common/ioexpander.c')
-rw-r--r-- | common/ioexpander.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/common/ioexpander.c b/common/ioexpander.c index d3e713a243..d30ed7ad9b 100644 --- a/common/ioexpander.c +++ b/common/ioexpander.c @@ -47,7 +47,7 @@ static const struct ioex_info *ioex_get_signal_info(enum ioex_signal signal) g = ioex_list + signal - IOEX_SIGNAL_START; - if (ioex_config[g->ioex].flags & IOEX_FLAGS_DISABLED) { + if (!(ioex_config[g->ioex].flags & IOEX_FLAGS_INITIALIZED)) { CPRINTS("ioex %s disabled", g->name); return NULL; } @@ -169,9 +169,6 @@ int ioex_init(int ioex) int rv; int i; - if (ioex_config[ioex].flags & IOEX_FLAGS_DISABLED) - return EC_ERROR_BUSY; - if (drv->init != NULL) { rv = drv->init(ioex); if (rv != EC_SUCCESS) @@ -195,7 +192,7 @@ int ioex_init(int ioex) } } - ioex_config[ioex].flags |= IOEX_FLAGS_INITIALIZED; + ioex_config[ioex].flags = IOEX_FLAGS_INITIALIZED; return EC_SUCCESS; } @@ -205,8 +202,12 @@ static void ioex_init_default(void) int i; for (i = 0; i < CONFIG_IO_EXPANDER_PORT_COUNT; i++) { - /* IO Expander has been initialized, skip re-initializing */ - if (ioex_config[i].flags & IOEX_FLAGS_INITIALIZED) + /* + * If the IO Expander has been initialized or if the default + * initialization is disabled, skip initializing. + */ + if (ioex_config[i].flags & (IOEX_FLAGS_INITIALIZED | + IOEX_FLAGS_DEFAULT_INIT_DISABLED)) continue; ioex_init(i); @@ -227,7 +228,7 @@ static void print_ioex_info(enum ioex_signal signal) int flags = 0; const struct ioex_info *g = ioex_list + signal - IOEX_SIGNAL_START; - if (ioex_config[g->ioex].flags & IOEX_FLAGS_DISABLED) { + if (!(ioex_config[g->ioex].flags & IOEX_FLAGS_INITIALIZED)) { ccprintf(" DISABLED %s\n", ioex_get_name(signal)); return; } |