1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 15:12:36 +02:00

raiden_debug_spi: add param for a custom reset setup

GSC firmware asserts EC_RST_L before programming the AP with
raiden_debug:target=AP.Some Chromium devices don't power the AP flash
 when the EC is in reset. These boards can't flash the AP with the
current CCD behavior. This change adds a custom_rst raiden_debug param
to tell Cr50 not to assert EC_RST_L or touch any reset signals while
flashing the AP. Users will need to configure the reset signals before
running the flashrom command.

BUG=b:154885210
BRANCH=none
TEST=manual

	flashrom -p raiden_debug:target=EC -r ec.bin

	flashrom -p raiden_debug:target=AP -r ap.bin

	flashrom -p raiden_debug:target=AP,custom_rst=true -r ap.bin

	flashrom -p raiden_debug:target=AP,custom_rst=inv -r ap.bin

	flashrom -p raiden_debug -r base.bin

Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Change-Id: I2da26469120c5304bc129b5578fcb7ca805fc1d1
Reviewed-on: https://review.coreboot.org/c/flashrom/+/43527
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Mary Ruthven 2020-07-16 12:03:20 -07:00 committed by Edward O'Callaghan
parent caf56e7ac9
commit c66d5f8cb3

View File

@ -399,17 +399,17 @@ enum usb_spi_error {
}; };
enum raiden_debug_spi_request { enum raiden_debug_spi_request {
RAIDEN_DEBUG_SPI_REQ_ENABLE = 0x0000, RAIDEN_DEBUG_SPI_REQ_ENABLE = 0x0000,
RAIDEN_DEBUG_SPI_REQ_DISABLE = 0x0001, RAIDEN_DEBUG_SPI_REQ_DISABLE = 0x0001,
RAIDEN_DEBUG_SPI_REQ_ENABLE_AP = 0x0002, RAIDEN_DEBUG_SPI_REQ_ENABLE_AP = 0x0002,
RAIDEN_DEBUG_SPI_REQ_ENABLE_EC = 0x0003, RAIDEN_DEBUG_SPI_REQ_ENABLE_EC = 0x0003,
RAIDEN_DEBUG_SPI_REQ_ENABLE_H1 = 0x0004, RAIDEN_DEBUG_SPI_REQ_ENABLE_H1 = 0x0004,
RAIDEN_DEBUG_SPI_REQ_RESET = 0x0005, RAIDEN_DEBUG_SPI_REQ_RESET = 0x0005,
RAIDEN_DEBUG_SPI_REQ_BOOT_CFG = 0x0006, RAIDEN_DEBUG_SPI_REQ_BOOT_CFG = 0x0006,
RAIDEN_DEBUG_SPI_REQ_SOCKET = 0x0007, RAIDEN_DEBUG_SPI_REQ_SOCKET = 0x0007,
RAIDEN_DEBUG_SPI_REQ_SIGNING_START = 0x0008, RAIDEN_DEBUG_SPI_REQ_SIGNING_START = 0x0008,
RAIDEN_DEBUG_SPI_REQ_SIGNING_SIGN = 0x0009, RAIDEN_DEBUG_SPI_REQ_SIGNING_SIGN = 0x0009,
RAIDEN_DEBUG_SPI_REQ_ENABLE_AP_CUSTOM = 0x000a,
}; };
/* /*
@ -1407,6 +1407,23 @@ static int raiden_debug_spi_shutdown(void * data)
return 0; return 0;
} }
static int get_ap_request_type(void)
{
int ap_request = RAIDEN_DEBUG_SPI_REQ_ENABLE_AP;
char *custom_rst_str = extract_programmer_param("custom_rst");
if (custom_rst_str) {
if (!strcasecmp(custom_rst_str, "true"))
ap_request = RAIDEN_DEBUG_SPI_REQ_ENABLE_AP_CUSTOM;
else {
msg_perr("Invalid custom rst param: %s\n",
custom_rst_str);
ap_request = -1;
}
}
free(custom_rst_str);
return ap_request;
}
static int get_target(void) static int get_target(void)
{ {
int request_enable = RAIDEN_DEBUG_SPI_REQ_ENABLE; int request_enable = RAIDEN_DEBUG_SPI_REQ_ENABLE;
@ -1414,7 +1431,7 @@ static int get_target(void)
char *target_str = extract_programmer_param("target"); char *target_str = extract_programmer_param("target");
if (target_str) { if (target_str) {
if (!strcasecmp(target_str, "ap")) if (!strcasecmp(target_str, "ap"))
request_enable = RAIDEN_DEBUG_SPI_REQ_ENABLE_AP; request_enable = get_ap_request_type();
else if (!strcasecmp(target_str, "ec")) else if (!strcasecmp(target_str, "ec"))
request_enable = RAIDEN_DEBUG_SPI_REQ_ENABLE_EC; request_enable = RAIDEN_DEBUG_SPI_REQ_ENABLE_EC;
else { else {
@ -1423,6 +1440,7 @@ static int get_target(void)
} }
} }
free(target_str); free(target_str);
msg_pinfo("Raiden target: %d\n", request_enable);
return request_enable; return request_enable;
} }