Skip to content

Commit

Permalink
espi: it8xxx2: make sure h2ram offset is configured correctly
Browse files Browse the repository at this point in the history
This change for addressing the below symptoms.
Two FW images have different h2ram offset settings.
Jumping to each other will cause offset setting errors.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
  • Loading branch information
Dino-Li authored and fabiobaltieri committed Jan 4, 2023
1 parent 02578cb commit 5bcd47f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/espi/espi_it8xxx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ static const struct ec2i_t pmc2_settings[] = {
* Linker script of h2ram.ld will make the pool 4K aligned.
*/
#define IT8XXX2_ESPI_H2RAM_POOL_SIZE_MAX 0x1000
#define IT8XXX2_ESPI_H2RAM_OFFSET_MASK GENMASK(3, 0)

#if defined(CONFIG_ESPI_PERIPHERAL_ACPI_SHM_REGION)
#define H2RAM_ACPI_SHM_MAX ((CONFIG_ESPI_IT8XXX2_ACPI_SHM_H2RAM_SIZE) + \
Expand Down Expand Up @@ -249,7 +250,9 @@ static void smfi_it8xxx2_init(const struct device *dev)
/* Set the host to RAM cycle address offset */
h2ram_offset = ((uint32_t)h2ram_pool & 0xffff) /
IT8XXX2_ESPI_H2RAM_POOL_SIZE_MAX;
gctrl->GCTRL_H2ROFSR |= h2ram_offset;
gctrl->GCTRL_H2ROFSR =
(gctrl->GCTRL_H2ROFSR & ~IT8XXX2_ESPI_H2RAM_OFFSET_MASK) |
h2ram_offset;

#ifdef CONFIG_ESPI_PERIPHERAL_EC_HOST_CMD
memset(&h2ram_pool[CONFIG_ESPI_PERIPHERAL_HOST_CMD_PARAM_PORT_NUM], 0,
Expand Down

0 comments on commit 5bcd47f

Please sign in to comment.