mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-09 17:11:42 +00:00
cr50: mark updated image as good once a usb request is received
There is now a call to reset the retry counter before the hard reset after an update. Cr50 will use the updated image for the next 5 boots, but on the 6th it sees the retry counter is greater than 5 and then jumps back to the old image. Cr50 needs to call system_process_retry_counter to reset the counter and corrupt the old image header to prevent falling back to the old image. Normally the reset counter would be processed after it receives a TPM command. Reef does not have Cr50 TPM support. Until Cr50 has TPM support for Reef, Cr50 should have a different point to know when the update is good. This change adds a board property to mark the process the reset counter once the Cr50 USB controller receives a set address request from the host. On Reef the controller defaults to the AP PHY when suzyq is not connected, so it should have a connection to the AP or through suzyq after boot. The board property is only added to Reef. Behavior on Kevin and Gru is unchanged. BUG=chrome-os-partner:56864 BRANCH=none TEST=update reef. Wait until Cr50 prints 'SETAD' then run 'rw 0x4000012c' and verify it is reset to 0. Change-Id: If517202f25a694cd70550e3be047ea502e7c5383 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/380354
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user