aboutsummaryrefslogtreecommitdiff
path: root/src/soc/amd/common/block/spi/fch_spi_ctrl.c
diff options
context:
space:
mode:
authorMartin Roth <martin@coreboot.org>2020-07-23 13:50:11 -0600
committerFelix Held <felix-coreboot@felixheld.de>2020-07-27 21:10:21 +0000
commit3b8b14dc27eceb9f40885d5e025095d06c4dedb7 (patch)
treed8f57576d442465f0b9bdff6302d365593f9aaea /src/soc/amd/common/block/spi/fch_spi_ctrl.c
parent4b3c063afddb01b91226a19b6c8ce1e5451ecfc9 (diff)
soc/amd/common: Move spi access functions into their own file
Because there was a lot of discussion about the size increase, I also looked at the impact of calling the get_spi_bar() function vs reading spi_base directly and just not worring about whether or not spi_base was already set. Using the spi_base variable directly is 77 bytes bytes for all 6 functions. it's roughly double the size to call the function at 153 bytes. This was almost entirely due to setting up a call stack. If we add an assert into each function to make sure that the spi_base variable is set, it doubles from the size of the function call to 333 bytes. For my money, the function call is the best bet, because it not only protects us from using spi_base before it's set, it also gets the value for us (at least on x86, on the PSP, it still just dies.) BUG=b:161366241 TEST: Build Signed-off-by: Martin Roth <martin@coreboot.org> Change-Id: I0b0d005426ef90f09bf090789acb9d6383f17bd2 Reviewed-on: https://review.coreboot.org/c/coreboot/+/43772 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'src/soc/amd/common/block/spi/fch_spi_ctrl.c')
-rw-r--r--src/soc/amd/common/block/spi/fch_spi_ctrl.c21
1 files changed, 0 insertions, 21 deletions
diff --git a/src/soc/amd/common/block/spi/fch_spi_ctrl.c b/src/soc/amd/common/block/spi/fch_spi_ctrl.c
index 0be6b0e72f..1e0c31ab27 100644
--- a/src/soc/amd/common/block/spi/fch_spi_ctrl.c
+++ b/src/soc/amd/common/block/spi/fch_spi_ctrl.c
@@ -1,6 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0-only */
-#include <arch/mmio.h>
#include <console/console.h>
#include <spi_flash.h>
#include <soc/pci_devs.h>
@@ -30,26 +29,6 @@
#define SPI_FIFO_RD_PTR_SHIFT 16
#define SPI_FIFO_RD_PTR_MASK 0x7f
-static uint8_t spi_read8(uint8_t reg)
-{
- return read8((void *)(spi_get_bar() + reg));
-}
-
-static uint32_t spi_read32(uint8_t reg)
-{
- return read32((void *)(spi_get_bar() + reg));
-}
-
-static void spi_write8(uint8_t reg, uint8_t val)
-{
- write8((void *)(spi_get_bar() + reg), val);
-}
-
-static void spi_write32(uint8_t reg, uint32_t val)
-{
- write32((void *)(spi_get_bar() + reg), val);
-}
-
static void dump_state(const char *str, u8 phase)
{
u8 dump_size;