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>
This commit is contained in:
Felix Held 2021-07-31 03:59:28 +02:00
parent db3337d929
commit f363ad4acf
2 changed files with 8 additions and 8 deletions

View File

@ -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 ||

View File

@ -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;