summaryrefslogtreecommitdiff
path: root/src/soc
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2021-07-31 03:59:28 +0200
committerFelix Held <felix-coreboot@felixheld.de>2021-08-30 16:30:45 +0000
commitf363ad4acf7b749deb2c546890101d19bfb6d75d (patch)
treed9777759ab98bfc4ccfed80c803f37dbefbb8f22 /src/soc
parentdb3337d9297d1f1d7759ffaa846115f946701906 (diff)
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>
Diffstat (limited to 'src/soc')
-rw-r--r--src/soc/amd/common/block/i2c/i2c.c11
-rw-r--r--src/soc/amd/common/block/include/amdblocks/gpio_banks.h5
2 files changed, 8 insertions, 8 deletions
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;