Skip to content

Commit 0178244

Browse files
author
Josh Tsai
committed
Check the EEPROM flag before writing flags in EEPROM
Signed-off-by: Josh Tsai <josh_tsai@compal.corp-partner.google.com>
1 parent bb0d0ce commit 0178244

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

board/hx30/board.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,13 +376,11 @@ void board_reset_pd_mcu(void)
376376
void spi_mux_control(int enable)
377377
{
378378
if (enable) {
379-
CPRINTS("switch to spi mode");
380379
/* Disable LED drv */
381380
gpio_set_level(GPIO_TYPEC_G_DRV2_EN, 0);
382381
/* Set GPIO56 as SPI for access SPI ROM */
383382
gpio_set_alternate_function(1, 0x4000, 2);
384383
} else {
385-
CPRINTS("switch to pwm mode");
386384
/* Enable LED drv */
387385
gpio_set_level(GPIO_TYPEC_G_DRV2_EN, 1);
388386
/* Set GPIO56 as SPI for access SPI ROM */
@@ -401,6 +399,8 @@ void board_spi_read_byte(uint8_t offset, uint8_t *data)
401399
if (rv != EC_SUCCESS)
402400
CPRINTS("SPI fail to read");
403401

402+
CPRINTS("%s, offset:0x%02x, data:0x%02x", __func__, offset, *data);
403+
404404
spi_mux_control(0);
405405
}
406406

@@ -420,6 +420,8 @@ void board_spi_write_byte(uint8_t offset, uint8_t data)
420420
if (rv != EC_SUCCESS)
421421
CPRINTS("SPI fail to write");
422422

423+
CPRINTS("%s, offset:0x%02x, data:0x%02x", __func__, offset, data);
424+
423425
spi_mux_control(0);
424426
}
425427

board/hx30/host_command_customization.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,20 @@ void set_non_acpi_mode(int enable)
5656

5757
static void sci_enable(void)
5858
{
59+
uint8_t dataInSPI;
60+
int dataInEMI;
61+
5962
if (*host_get_customer_memmap(0x00) & BIT(0)) {
6063
/* when host set EC driver ready flag, EC need to enable SCI */
6164
lpc_set_host_event_mask(LPC_HOST_EVENT_SCI, SCI_HOST_EVENT_MASK);
6265
update_soc_power_limit(true, false);
63-
board_spi_write_byte(SPI_AC_BOOT_OFFSET, ac_boot_status());
66+
67+
/* check the Flag in EEPROM and EMI, if values are different, write the value in EEPROM */
68+
board_spi_read_byte(SPI_AC_BOOT_OFFSET, &dataInSPI);
69+
dataInEMI = ac_boot_status();
70+
if ((int)dataInSPI != dataInEMI)
71+
board_spi_write_byte(SPI_AC_BOOT_OFFSET, (uint8_t)dataInEMI);
72+
6473
set_non_acpi_mode(0);
6574
} else
6675
hook_call_deferred(&sci_enable_data, 250 * MSEC);

0 commit comments

Comments
 (0)