Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/56778 )
Change subject: soc/amd/common: move GPIO register state save struct to gpio_banks.h ......................................................................
soc/amd/common: move GPIO register state save struct to gpio_banks.h
The common_i2c_save struct isn't specific to the I2C code and since it contains the state of the GPIO control & status register and the state of the GPIO MUX register, move it to include/amdblocks/gpio_banks.h and rename it to soc_amd_gpio_register_save.
Signed-off-by: Felix Held felix-coreboot@felixheld.de Change-Id: If7cd47e5a32427d856948e319de8dfad8c928e96 Reviewed-on: https://review.coreboot.org/c/coreboot/+/56778 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Martin Roth martinroth@google.com --- M src/soc/amd/common/block/i2c/i2c.c M src/soc/amd/common/block/include/amdblocks/gpio_banks.h 2 files changed, 8 insertions(+), 8 deletions(-)
Approvals: build bot (Jenkins): Verified Martin Roth: Looks good to me, approved
diff --git a/src/soc/amd/common/block/i2c/i2c.c b/src/soc/amd/common/block/i2c/i2c.c index ba89e9c..f277323 100644 --- a/src/soc/amd/common/block/i2c/i2c.c +++ b/src/soc/amd/common/block/i2c/i2c.c @@ -129,22 +129,17 @@ .acpi_fill_ssdt = dw_i2c_acpi_fill_ssdt, };
-struct common_i2c_save { - uint32_t control_value; - uint8_t mux_value; -}; - /* * To program I2C pins without destroying their programming, the registers * that will be changed need to be saved first. */ -static void save_i2c_pin_registers(uint8_t gpio, struct common_i2c_save *save_table) +static void save_i2c_pin_registers(uint8_t gpio, struct soc_amd_gpio_register_save *save_table) { save_table->mux_value = iomux_read8(gpio); save_table->control_value = gpio_read32(gpio); }
-static void restore_i2c_pin_registers(uint8_t gpio, struct common_i2c_save *save_table) +static void restore_i2c_pin_registers(uint8_t gpio, struct soc_amd_gpio_register_save *save_table) { /* Write and flush posted writes. */ iomux_write8(gpio, save_table->mux_value); @@ -172,7 +167,7 @@
void sb_reset_i2c_peripherals(const struct soc_i2c_peripheral_reset_info *reset_info) { - struct common_i2c_save save_table[MAX_PIN_COUNT]; + struct soc_amd_gpio_register_save save_table[MAX_PIN_COUNT]; size_t i;
if (!reset_info || !reset_info->i2c_scl || !reset_info->num_pins || diff --git a/src/soc/amd/common/block/include/amdblocks/gpio_banks.h b/src/soc/amd/common/block/include/amdblocks/gpio_banks.h index d17aa7a..8f36b24 100644 --- a/src/soc/amd/common/block/include/amdblocks/gpio_banks.h +++ b/src/soc/amd/common/block/include/amdblocks/gpio_banks.h @@ -15,6 +15,11 @@ uint32_t flags; };
+struct soc_amd_gpio_register_save { + uint32_t control_value; + uint8_t mux_value; +}; + struct soc_amd_event { gpio_t gpio; uint8_t event;