summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/system.c19
-rw-r--r--common/usb_pd_protocol.c7
-rw-r--r--include/usb_pd.h4
3 files changed, 20 insertions, 10 deletions
diff --git a/common/system.c b/common/system.c
index 856f3d981f..42eb91bf71 100644
--- a/common/system.c
+++ b/common/system.c
@@ -440,12 +440,8 @@ static void jump_to_image(uintptr_t init_addr)
gpio_set_level(GPIO_ENTERING_RW, 0);
#ifdef CONFIG_USB_POWER_DELIVERY
- /*
- * Notify USB PD module that we are about to sysjump and give it time
- * to do what it needs.
- */
- pd_prepare_sysjump();
- usleep(5*MSEC);
+ /* Notify USB PD module that we are about to reset */
+ pd_prepare_reset();
#endif
#ifdef CONFIG_I2C
@@ -725,10 +721,15 @@ static int handle_pending_reboot(enum ec_reboot_cmd cmd)
case EC_REBOOT_JUMP_RW:
return system_run_image_copy(SYSTEM_IMAGE_RW);
case EC_REBOOT_COLD:
+#ifdef CONFIG_USB_POWER_DELIVERY
+ /* Notify USB PD module that we are about to reset */
+ pd_prepare_reset();
+#endif
#ifdef HAS_TASK_PDCMD
/* Reboot the PD chip as well */
board_reset_pd_mcu();
#endif
+
system_reset(SYSTEM_RESET_HARD);
/* That shouldn't return... */
return EC_ERROR_UNKNOWN;
@@ -918,6 +919,12 @@ static int command_reboot(int argc, char **argv)
ccputs("Hard-");
ccputs("Rebooting!\n\n\n");
cflush();
+
+#ifdef CONFIG_USB_POWER_DELIVERY
+ /* Notify USB PD module that we are about to reset */
+ pd_prepare_reset();
+#endif
+
system_reset(flags);
return EC_SUCCESS;
}
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index b6507baa5c..07ce8189dc 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -558,12 +558,12 @@ void pd_soft_reset(void)
}
}
-void pd_prepare_sysjump(void)
+void pd_prepare_reset(void)
{
int i;
/*
- * On sysjump, we are most definitely going to drop pings (if any)
+ * On reset, we are most definitely going to drop pings (if any)
* and lose all of our PD state. Instead of trying to remember all
* the states and deal with on-going transmission, let's send soft
* reset here and then disable PD communication until after sysjump
@@ -575,6 +575,9 @@ void pd_prepare_sysjump(void)
pd[i].flags |= PD_FLAGS_SFT_RST_DIS_COMM;
pd_soft_reset();
+
+ /* Give time for soft reset to be sent */
+ usleep(5*MSEC);
}
#ifdef CONFIG_USB_PD_DUAL_ROLE
diff --git a/include/usb_pd.h b/include/usb_pd.h
index 6ca88bb55a..5a67965853 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -1502,8 +1502,8 @@ void pd_ping_enable(int port, int enable);
/* Issue PD soft reset */
void pd_soft_reset(void);
-/* Prepare PD communication for sysjump */
-void pd_prepare_sysjump(void);
+/* Prepare PD communication for reset */
+void pd_prepare_reset(void);
/**
* Signal power request to indicate a charger update that affects the port.