diff options
-rw-r--r-- | zephyr/program/skyrim/frostflow/src/usb_mux_config.c | 7 | ||||
-rw-r--r-- | zephyr/program/skyrim/skyrim/src/usb_mux_config.c | 7 | ||||
-rw-r--r-- | zephyr/test/skyrim/CMakeLists.txt | 3 | ||||
-rw-r--r-- | zephyr/test/skyrim/Kconfig | 8 | ||||
-rw-r--r-- | zephyr/test/skyrim/boards/native_posix.overlay | 18 | ||||
-rw-r--r-- | zephyr/test/skyrim/testcase.yaml | 9 | ||||
-rw-r--r-- | zephyr/test/skyrim/tests/common/CMakeLists.txt | 5 | ||||
-rw-r--r-- | zephyr/test/skyrim/tests/frostflow/CMakeLists.txt | 5 | ||||
-rw-r--r-- | zephyr/test/skyrim/tests/frostflow/src/usb_mux_config.c (renamed from zephyr/test/skyrim/src/frostflow/usb_mux_config.c) | 7 |
9 files changed, 56 insertions, 13 deletions
diff --git a/zephyr/program/skyrim/frostflow/src/usb_mux_config.c b/zephyr/program/skyrim/frostflow/src/usb_mux_config.c index f2c5bd2444..d018ff12f3 100644 --- a/zephyr/program/skyrim/frostflow/src/usb_mux_config.c +++ b/zephyr/program/skyrim/frostflow/src/usb_mux_config.c @@ -17,6 +17,13 @@ #include "usbc/usb_muxes.h" #include "util.h" +#ifdef CONFIG_ZTEST +/* Verify this is still needed for b/247151116. */ +#undef I2C_PORT_NODELABEL +#define I2C_PORT_NODELABEL(x) 0 + +#endif /* CONFIG_ZTEST */ + #define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args) #define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args) diff --git a/zephyr/program/skyrim/skyrim/src/usb_mux_config.c b/zephyr/program/skyrim/skyrim/src/usb_mux_config.c index 8d409dffdd..17e452a778 100644 --- a/zephyr/program/skyrim/skyrim/src/usb_mux_config.c +++ b/zephyr/program/skyrim/skyrim/src/usb_mux_config.c @@ -16,6 +16,13 @@ #include <zephyr/drivers/gpio.h> +#ifdef CONFIG_ZTEST + +#undef USB_MUX_ENABLE_ALTERNATIVE +#define USB_MUX_ENABLE_ALTERNATIVE(x) + +#endif /* CONFIG_ZTEST */ + #define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args) #define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args) diff --git a/zephyr/test/skyrim/CMakeLists.txt b/zephyr/test/skyrim/CMakeLists.txt index 3a6c866a7b..25eb4a333a 100644 --- a/zephyr/test/skyrim/CMakeLists.txt +++ b/zephyr/test/skyrim/CMakeLists.txt @@ -12,8 +12,7 @@ add_subdirectory(${PLATFORM_EC}/zephyr/test/test_utils test_utils) add_subdirectory(tests/common) add_subdirectory_ifdef(CONFIG_TEST_BOARD_BASEBOARD tests/baseboard) +add_subdirectory_ifdef(CONFIG_TEST_BOARD_FROSTFLOW tests/frostflow) add_subdirectory_ifdef(CONFIG_TEST_BOARD_WINTERHOLD tests/winterhold) target_sources(app PRIVATE src/${CONFIG_TEST_BOARD_NAME}/common.c) - -target_sources_ifdef(CONFIG_TEST_BOARD_USB_MUX_CONFIG app PRIVATE src/${TEST_BOARD_USB_MUX_CONFIG_SRC} ${PLATFORM_EC_PROGRAM_DIR}/skyrim/${CONFIG_TEST_BOARD_NAME}/src/usb_mux_config.c) diff --git a/zephyr/test/skyrim/Kconfig b/zephyr/test/skyrim/Kconfig index b96d5ce05b..c6193e0325 100644 --- a/zephyr/test/skyrim/Kconfig +++ b/zephyr/test/skyrim/Kconfig @@ -76,12 +76,10 @@ config TEST_BOARD_PPC_CONFIG_CUSTOM config TEST_BOARD_USB_MUX_CONFIG bool "Enable USB mux config tests" - default n -config TEST_BOARD_USB_MUX_CONFIG_SRC - string "Source file to use for this test" - default "common/usb_mux_config.c" - depends on TEST_BOARD_USB_MUX_CONFIG +config TEST_BOARD_USB_MUX_CONFIG_CUSTOM + bool "Enable USB mux config tests with a variant-specific test file" + select TEST_BOARD_USB_MUX_CONFIG config SKYRIM_LOG_LEVEL int "Fake config to allow building" diff --git a/zephyr/test/skyrim/boards/native_posix.overlay b/zephyr/test/skyrim/boards/native_posix.overlay index 5bf8c86ec7..cbf687b743 100644 --- a/zephyr/test/skyrim/boards/native_posix.overlay +++ b/zephyr/test/skyrim/boards/native_posix.overlay @@ -59,6 +59,24 @@ skyrim-fw-config { compatible = "cros-ec,cbi-fw-config"; + io-db { + enum-name = "FW_IO_DB"; + start = <6>; + size = <2>; + + io-db-ps8811-ps8818 { + compatible = "cros-ec,cbi-fw-config-value"; + enum-name = "FW_IO_DB_PS8811_PS8818"; + value = <0>; + }; + io-db-none-anx7483 { + compatible = "cros-ec,cbi-fw-config-value"; + enum-name = "FW_IO_DB_NONE_ANX7483"; + value = <1>; + default; + }; + }; + fan { enum-name = "FW_FAN"; start = <10>; diff --git a/zephyr/test/skyrim/testcase.yaml b/zephyr/test/skyrim/testcase.yaml index 83c7727a7a..c718e888d7 100644 --- a/zephyr/test/skyrim/testcase.yaml +++ b/zephyr/test/skyrim/testcase.yaml @@ -51,11 +51,10 @@ tests: - CONFIG_TEST_BOARD_FROSTFLOW=y - CONFIG_TEST_BOARD_PPC_CONFIG=y -# skyrim.frostflow.usb_mux_config: -# extra_configs: -# - CONFIG_TEST_BOARD_FROSTFLOW=y -# - CONFIG_TEST_BOARD_USB_MUX_CONFIG=y -# - CONFIG_TEST_BOARD_USB_MUX_CONFIG_SRC="frostflow/usb_mux_config.c" + skyrim.frostflow.usb_mux_config: + extra_configs: + - CONFIG_TEST_BOARD_FROSTFLOW=y + - CONFIG_TEST_BOARD_USB_MUX_CONFIG_CUSTOM=y # Markarth tests skyrim.markarth: diff --git a/zephyr/test/skyrim/tests/common/CMakeLists.txt b/zephyr/test/skyrim/tests/common/CMakeLists.txt index efe8703fe1..49da87b372 100644 --- a/zephyr/test/skyrim/tests/common/CMakeLists.txt +++ b/zephyr/test/skyrim/tests/common/CMakeLists.txt @@ -26,4 +26,9 @@ if (DEFINED CONFIG_TEST_BOARD_PPC_CONFIG) if (NOT DEFINED CONFIG_TEST_BOARD_PPC_CONFIG_CUSTOM) target_sources(app PRIVATE src/ppc_config.c) endif() +endif() + +# USB mux config +if (DEFINED CONFIG_TEST_BOARD_USB_MUX_CONFIG) + target_sources(app PRIVATE ${PLATFORM_EC_PROGRAM_DIR}/skyrim/${CONFIG_TEST_BOARD_NAME}/src/usb_mux_config.c) endif()
\ No newline at end of file diff --git a/zephyr/test/skyrim/tests/frostflow/CMakeLists.txt b/zephyr/test/skyrim/tests/frostflow/CMakeLists.txt new file mode 100644 index 0000000000..c195c83093 --- /dev/null +++ b/zephyr/test/skyrim/tests/frostflow/CMakeLists.txt @@ -0,0 +1,5 @@ +# Copyright 2023 The ChromiumOS Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +target_sources_ifdef(CONFIG_TEST_BOARD_USB_MUX_CONFIG app PRIVATE src/usb_mux_config.c)
\ No newline at end of file diff --git a/zephyr/test/skyrim/src/frostflow/usb_mux_config.c b/zephyr/test/skyrim/tests/frostflow/src/usb_mux_config.c index 929bd318d4..3a4b80d347 100644 --- a/zephyr/test/skyrim/src/frostflow/usb_mux_config.c +++ b/zephyr/test/skyrim/tests/frostflow/src/usb_mux_config.c @@ -6,9 +6,14 @@ #include <zephyr/fff.h> #include <zephyr/ztest.h> -#include <gpio.h> +#include <driver/retimer/ps8811.h> #include <usbc/usb_muxes.h> +FAKE_VALUE_FUNC(int, ps8811_i2c_read, const struct usb_mux *, int, int, int *); +FAKE_VALUE_FUNC(int, ps8811_i2c_field_update, const struct usb_mux *, int, int, + uint8_t, uint8_t); +FAKE_VALUE_FUNC(int, ps8811_i2c_write, const struct usb_mux *, int, int, int); + int board_c0_amd_fp6_mux_set(const struct usb_mux *me, mux_state_t mux_state); int board_c1_ps8818_mux_set(const struct usb_mux *me, mux_state_t mux_state); |