From cd8d0e6ce628e112840c870e6934afc0c387b314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Fri, 26 Jun 2020 10:22:24 +0300 Subject: [PATCH] soc/amd/common: Refactor ACPIMMIO posted writes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ic1a5c17c789dd79fea8f348d1a9d32d4301ced88 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/42825 Reviewed-by: Felix Held Reviewed-by: Angel Pons Reviewed-by: Raul Rangel Tested-by: build bot (Jenkins) --- src/soc/amd/common/block/include/amdblocks/acpimmio.h | 6 ------ src/soc/amd/picasso/i2c.c | 4 +++- src/soc/amd/stoneyridge/i2c.c | 4 +++- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/soc/amd/common/block/include/amdblocks/acpimmio.h b/src/soc/amd/common/block/include/amdblocks/acpimmio.h index 4fcaa9204a..15445baaad 100644 --- a/src/soc/amd/common/block/include/amdblocks/acpimmio.h +++ b/src/soc/amd/common/block/include/amdblocks/acpimmio.h @@ -387,12 +387,6 @@ static inline void gpio_write32(uint8_t gpio_num, uint32_t value) write32(gpio_ctrl_ptr(gpio_num), value); } -static inline void gpio_write32_rb(uint8_t gpio_num, uint32_t value) -{ - write32(gpio_ctrl_ptr(gpio_num), value); - read32(gpio_ctrl_ptr(gpio_num)); -} - /* GPIO bank 0 */ static inline uint8_t gpio0_read8(uint8_t reg) { diff --git a/src/soc/amd/picasso/i2c.c b/src/soc/amd/picasso/i2c.c index 1eb0720dc9..af4c41f8a6 100644 --- a/src/soc/amd/picasso/i2c.c +++ b/src/soc/amd/picasso/i2c.c @@ -169,9 +169,11 @@ static void save_i2c_pin_registers(uint8_t gpio, static void restore_i2c_pin_registers(uint8_t gpio, struct soc_amd_i2c_save *save_table) { + /* Write and flush posted writes. */ iomux_write8(gpio, save_table->mux_value); iomux_read8(gpio); - gpio_write32_rb(gpio, save_table->control_value); + gpio_write32(gpio, save_table->control_value); + gpio_read32(gpio); } /* Slaves to be reset are controlled by devicetree register i2c_scl_reset */ diff --git a/src/soc/amd/stoneyridge/i2c.c b/src/soc/amd/stoneyridge/i2c.c index 0327028241..295a833046 100644 --- a/src/soc/amd/stoneyridge/i2c.c +++ b/src/soc/amd/stoneyridge/i2c.c @@ -144,9 +144,11 @@ static void save_i2c_pin_registers(uint8_t gpio, static void restore_i2c_pin_registers(uint8_t gpio, struct soc_amd_i2c_save *save_table) { + /* Write and flush posted writes. */ iomux_write8(gpio, save_table->mux_value); iomux_read8(gpio); - gpio_write32_rb(gpio, save_table->control_value); + gpio_write32(gpio, save_table->control_value); + gpio_read32(gpio); } /* Slaves to be reset are controlled by devicetree register i2c_scl_reset */