spi: Clean up SPI flash driver interface

Hardware / Coreboot - Furquan Shaikh [chromium.org] - 22 November 2016 10:32 UTC

RW flag was added to spi_slave structure to get around a requirement on some AMD flash controllers that need to group together all spi volatile operations (write/erase). This rw flag is not a property or attribute of the SPI slave or controller. Thus, instead of saving it in spi_slave structure, clean up the SPI flash driver interface. This allows chipsets/mainboards (that require volatile operations to be grouped) to indicate beginning and end of such grouped operations.

New user APIs are added to allow users to perform probe, read, write, erase, volatile group begin and end operations. Callbacks defined in spi_flash structure are expected to be used only by the SPI flash driver. Any chipset that requires grouping of volatile operations can select the newly added Kconfig option SPI_FLASH_HAS_VOLATILE_GROUP and define callbacks for chipset_volatile_group_{begin,end}.

spi_claim_bus/spi_release_bus calls have been removed from the SPI flash chip drivers which end up calling do_spi_flash_cmd since it already has required calls for claiming and releasing SPI bus before performing a read/write operation.

BUG=None BRANCH=None TEST=Compiles successfully.

Change-Id: Idfc052e82ec15b6c9fa874cee7a61bd06e923fbf

c28984d spi: Clean up SPI flash driver interface
src/cpu/amd/pi/spi.c | 12 +--
src/drivers/intel/fsp1_0/fastboot_cache.c | 8 +-
src/drivers/spi/Kconfig | 7 ++
src/drivers/spi/adesto.c | 24 ++---
src/drivers/spi/amic.c | 24 ++---
src/drivers/spi/atmel.c | 24 ++---
src/drivers/spi/boot_device_rw_nommap.c | 7 +-
src/drivers/spi/cbfs_spi.c | 7 +-
src/drivers/spi/eon.c | 17 ++--
src/drivers/spi/gigadevice.c | 21 ++--
src/drivers/spi/macronix.c | 22 ++--
src/drivers/spi/spansion.c | 20 ++--
src/drivers/spi/spi_flash.c | 105 +++++++++++++++++---
src/drivers/spi/spi_flash_internal.h | 12 +--
src/drivers/spi/spiconsole.c | 2 +-
src/drivers/spi/sst.c | 42 ++++----
src/drivers/spi/stmicro.c | 17 ++--
src/drivers/spi/winbond.c | 20 ++--
src/include/spi-generic.h | 5 -
src/include/spi_flash.h | 66 ++++++++----
src/northbridge/amd/agesa/oem_s3.c | 12 +--
src/northbridge/amd/amdmct/mct_ddr3/s3utils.c | 13 +--
src/northbridge/intel/common/mrc_cache.c | 7 +-
src/soc/imgtec/pistachio/spi.c | 2 +-
src/soc/intel/apollolake/spi.c | 22 ++--
src/soc/intel/baytrail/spi.c | 2 +-
src/soc/intel/braswell/spi.c | 2 +-
src/soc/intel/common/nvm.c | 7 +-
src/soc/intel/fsp_baytrail/nvm.c | 4 +-
src/soc/intel/fsp_baytrail/spi.c | 2 +-
src/soc/intel/skylake/flash_controller.c | 23 ++---
.../intel/skylake/include/soc/flash_controller.h | 13 ++-
src/soc/intel/skylake/romstage/spi.c | 1 +
src/soc/mediatek/mt8173/flash_controller.c | 17 ++--
src/soc/qualcomm/ipq40xx/include/soc/spi.h | 2 +-
src/soc/qualcomm/ipq40xx/spi.c | 1 +
src/soc/qualcomm/ipq806x/include/soc/spi.h | 2 +-
src/soc/qualcomm/ipq806x/spi.c | 1 +
src/soc/rockchip/common/spi.c | 27 ++---
src/soc/samsung/exynos5420/spi.c | 7 +-
src/southbridge/amd/agesa/hudson/Kconfig | 1 +
src/southbridge/amd/agesa/hudson/spi.c | 43 ++++----
src/southbridge/amd/cimx/sb800/Kconfig | 1 +
src/southbridge/amd/cimx/sb800/spi.c | 46 ++++-----
src/southbridge/intel/common/spi.c | 18 ++--
45 files changed, 406 insertions(+), 332 deletions(-)

Upstream: review.coreboot.org


  • Share