From f363ad4acf7b749deb2c546890101d19bfb6d75d Mon Sep 17 00:00:00 2001 From: Felix Held Date: Sat, 31 Jul 2021 03:59:28 +0200 Subject: 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 Change-Id: If7cd47e5a32427d856948e319de8dfad8c928e96 Reviewed-on: https://review.coreboot.org/c/coreboot/+/56778 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth --- src/soc/amd/common/block/i2c/i2c.c | 11 +++-------- src/soc/amd/common/block/include/amdblocks/gpio_banks.h | 5 +++++ 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/soc') diff --git a/src/soc/amd/common/block/i2c/i2c.c b/src/soc/amd/common/block/i2c/i2c.c index ba89e9c589..f2773235a6 100644 --- a/src/soc/amd/common/block/i2c/i2c.c +++ b/src/soc/amd/common/block/i2c/i2c.c @@ -129,22 +129,17 @@ struct device_operations soc_amd_i2c_mmio_ops = { .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 @@ static void drive_scl(const struct soc_i2c_peripheral_reset_info *reset_info, ui 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 d17aa7aea7..8f36b24313 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 @@ struct soc_amd_gpio { 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; -- cgit v1.2.3