diff options
-rw-r--r-- | board/cr50/board.c | 5 | ||||
-rw-r--r-- | chip/g/usb.c | 8 | ||||
-rw-r--r-- | include/system.h | 5 |
3 files changed, 17 insertions, 1 deletions
diff --git a/board/cr50/board.c b/board/cr50/board.c index 2ea8f74318..13e86e842e 100644 --- a/board/cr50/board.c +++ b/board/cr50/board.c @@ -553,6 +553,11 @@ void system_init_board_properties(void) * UART0RX so disable it until that is fixed. */ properties |= BOARD_DISABLE_UART0_RX; + /* + * Use receiving a usb set address request as a + * benchmark for marking the updated image as good. + */ + properties |= BOARD_MARK_UPDATE_ON_USB_REQ; } /* diff --git a/chip/g/usb.c b/chip/g/usb.c index e2d3e15177..932081f363 100644 --- a/chip/g/usb.c +++ b/chip/g/usb.c @@ -303,6 +303,7 @@ static int cur_out_idx; /* latest with xfercompl=1 */ static const struct g_usb_desc *cur_out_desc; static int next_out_idx; /* next packet will go here */ static struct g_usb_desc *next_out_desc; +static int processed_update_counter; /* For IN: Several DMA descriptors, all pointing into one large buffer, so that * we can return the configuration descriptor as one big blob. */ @@ -731,6 +732,13 @@ static int handle_setup_with_no_data_stage(enum table_case tc, CPRINTS("SETAD 0x%02x (%d)", set_addr, set_addr); print_later("SETAD 0x%02x (%d)", set_addr, set_addr, 0, 0, 0); device_state = DS_ADDRESS; +#ifdef BOARD_CR50 + /* TODO(crosbug.com/p/56540): Remove when no longer needed */ + if (!processed_update_counter && system_get_board_properties() & + BOARD_MARK_UPDATE_ON_USB_REQ) + system_process_retry_counter(); +#endif + processed_update_counter = 1; break; case USB_REQ_SET_CONFIGURATION: diff --git a/include/system.h b/include/system.h index d8d10950ce..d6d2c063b7 100644 --- a/include/system.h +++ b/include/system.h @@ -467,7 +467,10 @@ int system_process_retry_counter(void); #define BOARD_SLAVE_CONFIG_I2C (1 << 1) /* Slave I2C interface */ #define BOARD_USB_AP (1 << 2) /* One of the PHYs is */ /* connected to the AP */ -#define BOARD_DISABLE_UART0_RX (1 << 3) /* Disable UART0 RX */ +#define BOARD_DISABLE_UART0_RX (1 << 3) /* Disable UART0 RX */ +#define BOARD_MARK_UPDATE_ON_USB_REQ (1 << 4) /* update is good once the */ + /* controller gets a request */ + /** * Get board properites * |