From cbdd890e412614ba21643ceb56007cfe136fc761 Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Thu, 23 Jul 2020 16:12:33 -0600 Subject: soc/amd: Use spi_writeX & spi_readX for all spi accesses BUG=b:161366241 TEST=Build & boot Trembyle Signed-off-by: Martin Roth Change-Id: Ied7789e9315c75174df9a686c831c5a969ce3bfe Reviewed-on: https://review.coreboot.org/c/coreboot/+/43773 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin Reviewed-by: Felix Held --- src/soc/amd/common/block/spi/fch_spi.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/soc/amd/common/block') diff --git a/src/soc/amd/common/block/spi/fch_spi.c b/src/soc/amd/common/block/spi/fch_spi.c index 175be794ad..c39147a8b3 100644 --- a/src/soc/amd/common/block/spi/fch_spi.c +++ b/src/soc/amd/common/block/spi/fch_spi.c @@ -10,26 +10,22 @@ static void fch_spi_set_spi100(int norm, int fast, int alt, int tpm) { - uintptr_t base = spi_get_bar(); - - write16((void *)(base + SPI100_SPEED_CONFIG), SPI_SPEED_CFG(norm, fast, alt, tpm)); - write16((void *)(base + SPI100_ENABLE), SPI_USE_SPI100); + spi_write16(SPI100_SPEED_CONFIG, SPI_SPEED_CFG(norm, fast, alt, tpm)); + spi_write16(SPI100_ENABLE, SPI_USE_SPI100); } static void fch_spi_disable_4dw_burst(void) { - uintptr_t base = spi_get_bar(); - uint16_t val = read16((void *)(base + SPI100_HOST_PREF_CONFIG)); + uint16_t val = spi_read16(SPI100_HOST_PREF_CONFIG); - write16((void *)(base + SPI100_HOST_PREF_CONFIG), val & ~SPI_RD4DW_EN_HOST); + spi_write16(SPI100_HOST_PREF_CONFIG, val & ~SPI_RD4DW_EN_HOST); } static void fch_spi_set_read_mode(u32 mode) { - uintptr_t base = spi_get_bar(); - uint32_t val = read32((void *)(base + SPI_CNTRL0)) & ~SPI_READ_MODE_MASK; + uint32_t val = spi_read32(SPI_CNTRL0) & ~SPI_READ_MODE_MASK; - write32((void *)(base + SPI_CNTRL0), val | SPI_READ_MODE(mode)); + spi_write32(SPI_CNTRL0, val | SPI_READ_MODE(mode)); } static void fch_spi_config_mb_modes(void) -- cgit v1.2.3