diff options
author | Vijay Hiremath <vijay.p.hiremath@intel.com> | 2022-08-30 17:40:02 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-02-22 21:34:37 +0000 |
commit | 5a411a31d1ef42b88af8d1808eb0bb3e325e8057 (patch) | |
tree | 3d7efa9e3d5659f156de9eabcd5ecb93463d93b3 | |
parent | 04c3bf95de1e11ebc35f0b6fb82ad784430e1ba5 (diff) | |
download | chrome-ec-5a411a31d1ef42b88af8d1808eb0bb3e325e8057.tar.gz |
mtlrvp: rex: Send VW based overcurrent to AP
Meteorlake PCH uses Virtual Wire for over current error,
hence Send 'Over Current Virtual Wire' eSPI signal.
BUG=b:243120083
BRANCH=none
TEST=Observed 'usb usb3-portX: over-current condition' on MTLRVP
Kernel console
Change-Id: Ia4ac4b71622e91377410458efd57b1fa75c985a7
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3863940
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Brandon Breitenstein <brandon.breitenstein@intel.corp-partner.google.com>
-rw-r--r-- | zephyr/program/intelrvp/mtlrvp/src/mtlrvp.c | 13 | ||||
-rw-r--r-- | zephyr/program/rex/src/usbc_config.c | 12 |
2 files changed, 19 insertions, 6 deletions
diff --git a/zephyr/program/intelrvp/mtlrvp/src/mtlrvp.c b/zephyr/program/intelrvp/mtlrvp/src/mtlrvp.c index dbbcb0aef8..cb7e282f63 100644 --- a/zephyr/program/intelrvp/mtlrvp/src/mtlrvp.c +++ b/zephyr/program/intelrvp/mtlrvp/src/mtlrvp.c @@ -32,9 +32,14 @@ #include "usbc_ppc.h" #include "util.h" +#include <zephyr/drivers/espi.h> + #define CPRINTF(format, args...) cprintf(CC_COMMAND, format, ##args) #define CPRINTS(format, args...) cprints(CC_COMMAND, format, ##args) +/* eSPI device */ +#define espi_dev DEVICE_DT_GET(DT_CHOSEN(cros_ec_espi)) + /*******************************************************************/ /* USB-C Configuration Start */ @@ -134,12 +139,14 @@ static void board_connect_c0_sbu_deferred(void) } DECLARE_DEFERRED(board_connect_c0_sbu_deferred); -void board_overcurrent_event(int port, int is_overcurrented) +__override void board_overcurrent_event(int port, int is_overcurrented) { /* - * TODO: Meteorlake PCH does not use Physical GPIO for over current - * error, hence Send 'Over Current Virtual Wire' eSPI signal. + * Meteorlake PCH uses Virtual Wire for over current error, + * hence Send 'Over Current Virtual Wire' eSPI signal. */ + espi_send_vwire(espi_dev, port + ESPI_VWIRE_SIGNAL_SLV_GPIO_0, + !is_overcurrented); } void board_reset_pd_mcu(void) diff --git a/zephyr/program/rex/src/usbc_config.c b/zephyr/program/rex/src/usbc_config.c index 0401b6892b..fceb6e0197 100644 --- a/zephyr/program/rex/src/usbc_config.c +++ b/zephyr/program/rex/src/usbc_config.c @@ -25,11 +25,15 @@ #include "usb_mux.h" #include "usbc_ppc.h" +#include <zephyr/drivers/espi.h> #include <zephyr/drivers/gpio.h> #define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args) #define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args) +/* eSPI device */ +#define espi_dev DEVICE_DT_GET(DT_CHOSEN(cros_ec_espi)) + /*******************************************************************/ /* USB-C Configuration Start */ @@ -57,12 +61,14 @@ static void usbc_interrupt_init(void) } DECLARE_HOOK(HOOK_INIT, usbc_interrupt_init, HOOK_PRIO_POST_I2C); -void board_overcurrent_event(int port, int is_overcurrented) +__override void board_overcurrent_event(int port, int is_overcurrented) { /* - * TODO: Meteorlake PCH does not use Physical GPIO for over current - * error, hence Send 'Over Current Virtual Wire' eSPI signal. + * Meteorlake PCH uses Virtual Wire for over current error, + * hence Send 'Over Current Virtual Wire' eSPI signal. */ + espi_send_vwire(espi_dev, port + ESPI_VWIRE_SIGNAL_SLV_GPIO_0, + !is_overcurrented); } void sbu_fault_interrupt(enum gpio_signal signal) |