diff options
author | Keith Short <keithshort@chromium.org> | 2023-05-09 09:04:03 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-05-09 16:45:19 +0000 |
commit | a291065141bd97c6f9bbc433228a4671600e7822 (patch) | |
tree | 42fc27fefa78bf3aab5215c74d5da9d62048cc03 /zephyr/shim | |
parent | cd82d004731312765d64c93b78057aa38296a432 (diff) | |
download | chrome-ec-a291065141bd97c6f9bbc433228a4671600e7822.tar.gz |
zephyr: make PPC/TCPC support optional
The "ppc" and "tcpc" properties are tagged as optional by the
devicetree. Update the PPC and TCPC shim drivers to support an empty
entry in the ppc_chips[] and tcpc_config[] arrays.
This is useful for boards that need to setup different USB-C chips at
runtime and ensures there is a valid entry to update.
BUG=none
TEST=zmake build -a
TEST=locally, comment out the "ppc" and "tcpc" property on skyrim and
validate the corresponding arrays are correct.
Change-Id: Ief1c3670d5ef9d8e07a599286e77fbb9e229335e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4516398
Commit-Queue: Keith Short <keithshort@chromium.org>
Reviewed-by: Boris Mittelberg <bmbm@google.com>
Commit-Queue: Boris Mittelberg <bmbm@google.com>
Tested-by: Keith Short <keithshort@chromium.org>
Auto-Submit: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'zephyr/shim')
-rw-r--r-- | zephyr/shim/src/ppc.c | 12 | ||||
-rw-r--r-- | zephyr/shim/src/tcpc.c | 12 |
2 files changed, 18 insertions, 6 deletions
diff --git a/zephyr/shim/src/ppc.c b/zephyr/shim/src/ppc.c index ec5f2f26e1..9959097b9b 100644 --- a/zephyr/shim/src/ppc.c +++ b/zephyr/shim/src/ppc.c @@ -40,9 +40,15 @@ CHECK_COMPAT(SYV682X_COMPAT, usbc_id, ppc_id, PPC_CHIP_SYV682X) \ CHECK_COMPAT(SYV682X_EMUL_COMPAT, usbc_id, ppc_id, PPC_CHIP_SYV682X) -#define PPC_CHIP(usbc_id) \ - COND_CODE_1(DT_NODE_HAS_PROP(usbc_id, ppc), \ - (PPC_CHIP_FIND(usbc_id, DT_PHANDLE(usbc_id, ppc))), ()) +/* clang-format off */ +#define PPC_CHIP_STUB(usbc_id) \ + [USBC_PORT_NEW(usbc_id)] = {}, +/* clang-format on */ + +#define PPC_CHIP(usbc_id) \ + COND_CODE_1(DT_NODE_HAS_PROP(usbc_id, ppc), \ + (PPC_CHIP_FIND(usbc_id, DT_PHANDLE(usbc_id, ppc))), \ + (PPC_CHIP_STUB(usbc_id))) #define PPC_CHIP_ALT(usbc_id) \ COND_CODE_1(DT_NODE_HAS_PROP(usbc_id, ppc_alt), \ diff --git a/zephyr/shim/src/tcpc.c b/zephyr/shim/src/tcpc.c index a7fb1c11df..5d6bbf6156 100644 --- a/zephyr/shim/src/tcpc.c +++ b/zephyr/shim/src/tcpc.c @@ -71,9 +71,15 @@ LOG_MODULE_REGISTER(tcpc, CONFIG_GPIO_LOG_LEVEL); CHECK_COMPAT(TCPCI_COMPAT, usbc_id, tcpc_id, TCPC_CONFIG_TCPCI) \ TCPC_CHIP_FIND_EMUL(usbc_id, tcpc_id) -#define TCPC_CHIP(usbc_id) \ - COND_CODE_1(DT_NODE_HAS_PROP(usbc_id, tcpc), \ - (TCPC_CHIP_FIND(usbc_id, DT_PHANDLE(usbc_id, tcpc))), ()) +/* clang-format off */ +#define TCPC_CHIP_STUB(usbc_id) \ + [USBC_PORT_NEW(usbc_id)] = {}, +/* clang-format on */ + +#define TCPC_CHIP(usbc_id) \ + COND_CODE_1(DT_NODE_HAS_PROP(usbc_id, tcpc), \ + (TCPC_CHIP_FIND(usbc_id, DT_PHANDLE(usbc_id, tcpc))), \ + (TCPC_CHIP_STUB(usbc_id))) #define MAYBE_CONST \ COND_CODE_1(CONFIG_PLATFORM_EC_USB_PD_TCPC_RUNTIME_CONFIG, (), (const)) |