c2973d196d
SPI_ATOMIC_SEQUENCING was added to accomodate spi flash controllers with the ability to perform tx and rx of flash command and response at the same time. Instead of introducing this notion at SPI flash driver layer, clean up the interface to SPI used by flash. Flash uses a command-response kind of communication. Thus, even though SPI is duplex, flash command needs to be sent out on SPI bus and then flash response should be received on the bus. Some specialized x86 flash controllers are capable of handling command and response in a single transaction. In order to support all the varied cases: 1. Add spi_xfer_vector that takes as input a vector of SPI operations and calls back into SPI controller driver to process these operations. 2. In order to accomodate flash command-response model, use two vectors while calling into spi_xfer_vector -- one with dout set to non-NULL(command) and other with din set to non-NULL(response). 3. For specialized SPI flash controllers combine two successive vectors if the transactions look like a command-response pair. 4. Provide helper functions for common cases like supporting only 2 vectors at a time, supporting n vectors at a time, default vector operation to cycle through all SPI op vectors one by one. BUG=chrome-os-partner:59832 BRANCH=None TEST=Compiles successfully Change-Id: I4c9e78c585ad95c40c0d5af078ff8251da286236 Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://review.coreboot.org/17681 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
167 lines
4.5 KiB
Text
167 lines
4.5 KiB
Text
##
|
|
## This file is part of the coreboot project.
|
|
##
|
|
## Copyright (C) 2012 The Chromium OS Authors.
|
|
##
|
|
## This program is free software; you can redistribute it and/or modify
|
|
## it under the terms of the GNU General Public License as published by
|
|
## the Free Software Foundation; version 2 of the License.
|
|
##
|
|
## This program is distributed in the hope that it will be useful,
|
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
## GNU General Public License for more details.
|
|
##
|
|
|
|
config COMMON_CBFS_SPI_WRAPPER
|
|
bool
|
|
default n
|
|
depends on !ARCH_X86
|
|
depends on BOOT_DEVICE_SPI_FLASH
|
|
select BOOT_DEVICE_SUPPORTS_WRITES
|
|
help
|
|
Use common wrapper to interface CBFS to SPI bootrom.
|
|
|
|
config SPI_FLASH
|
|
bool
|
|
default y if BOOT_DEVICE_SPI_FLASH && BOOT_DEVICE_SUPPORTS_WRITES
|
|
default n
|
|
help
|
|
Select this option if your chipset driver needs to store certain
|
|
data in the SPI flash.
|
|
|
|
if SPI_FLASH
|
|
|
|
# Keep at 0 because lots of boards assume this default.
|
|
config BOOT_DEVICE_SPI_FLASH_BUS
|
|
int
|
|
default 0
|
|
help
|
|
Which SPI bus the boot device is connected to.
|
|
|
|
config BOOT_DEVICE_SPI_FLASH_RW_NOMMAP
|
|
bool
|
|
default y if !COMMON_CBFS_SPI_WRAPPER
|
|
default n
|
|
depends on BOOT_DEVICE_SPI_FLASH
|
|
help
|
|
Provide common implementation of the RW boot device that
|
|
doesn't provide mmap() operations.
|
|
|
|
config BOOT_DEVICE_SPI_FLASH_RW_NOMMAP_EARLY
|
|
bool
|
|
default n
|
|
depends on BOOT_DEVICE_SPI_FLASH_RW_NOMMAP
|
|
help
|
|
Include the common implementation in all stages, including the
|
|
early ones.
|
|
|
|
config SPI_FLASH_INCLUDE_ALL_DRIVERS
|
|
bool
|
|
default n if COMMON_CBFS_SPI_WRAPPER
|
|
default y
|
|
|
|
config SPI_FLASH_SMM
|
|
bool "SPI flash driver support in SMM"
|
|
default n
|
|
depends on HAVE_SMI_HANDLER
|
|
help
|
|
Select this option if you want SPI flash support in SMM.
|
|
|
|
config SPI_FLASH_NO_FAST_READ
|
|
bool "Disable Fast Read command"
|
|
default n
|
|
help
|
|
Select this option if your setup requires to avoid "fast read"s
|
|
from the SPI flash parts.
|
|
|
|
config SPI_FLASH_ADESTO
|
|
bool
|
|
default y if SPI_FLASH_INCLUDE_ALL_DRIVERS
|
|
help
|
|
Select this option if your chipset driver needs to store certain
|
|
data in the SPI flash and your SPI flash is made by Adesto Technologies.
|
|
|
|
config SPI_FLASH_AMIC
|
|
bool
|
|
default y if SPI_FLASH_INCLUDE_ALL_DRIVERS
|
|
help
|
|
Select this option if your chipset driver needs to store certain
|
|
data in the SPI flash and your SPI flash is made by AMIC.
|
|
|
|
config SPI_FLASH_ATMEL
|
|
bool
|
|
default y if SPI_FLASH_INCLUDE_ALL_DRIVERS
|
|
help
|
|
Select this option if your chipset driver needs to store certain
|
|
data in the SPI flash and your SPI flash is made by Atmel.
|
|
|
|
config SPI_FLASH_EON
|
|
bool
|
|
default y if SPI_FLASH_INCLUDE_ALL_DRIVERS
|
|
help
|
|
Select this option if your chipset driver needs to store certain
|
|
data in the SPI flash and your SPI flash is made by EON.
|
|
|
|
config SPI_FLASH_GIGADEVICE
|
|
bool
|
|
default y if SPI_FLASH_INCLUDE_ALL_DRIVERS
|
|
help
|
|
Select this option if your chipset driver needs to store certain
|
|
data in the SPI flash and your SPI flash is made by Gigadevice.
|
|
|
|
config SPI_FLASH_MACRONIX
|
|
bool
|
|
default y if SPI_FLASH_INCLUDE_ALL_DRIVERS
|
|
help
|
|
Select this option if your chipset driver needs to store certain
|
|
data in the SPI flash and your SPI flash is made by Macronix.
|
|
|
|
config SPI_FLASH_SPANSION
|
|
bool
|
|
default y if SPI_FLASH_INCLUDE_ALL_DRIVERS
|
|
help
|
|
Select this option if your chipset driver needs to store certain
|
|
data in the SPI flash and your SPI flash is made by Spansion.
|
|
|
|
config SPI_FLASH_SST
|
|
bool
|
|
default y if SPI_FLASH_INCLUDE_ALL_DRIVERS
|
|
help
|
|
Select this option if your chipset driver needs to store certain
|
|
data in the SPI flash and your SPI flash is made by SST.
|
|
|
|
config SPI_FLASH_STMICRO
|
|
bool
|
|
default y if SPI_FLASH_INCLUDE_ALL_DRIVERS
|
|
help
|
|
Select this option if your chipset driver needs to store certain
|
|
data in the SPI flash and your SPI flash is made by ST MICRO.
|
|
|
|
config SPI_FLASH_WINBOND
|
|
bool
|
|
default y if SPI_FLASH_INCLUDE_ALL_DRIVERS
|
|
help
|
|
Select this option if your chipset driver needs to store certain
|
|
data in the SPI flash and your SPI flash is made by Winbond.
|
|
|
|
config SPI_FLASH_FAST_READ_DUAL_OUTPUT_3B
|
|
bool
|
|
default n
|
|
depends on SPI_FLASH
|
|
help
|
|
Select this option if your SPI flash supports the fast read dual-
|
|
output command (opcode 0x3b) where the opcode and address are sent
|
|
to the chip on MOSI and data is received on both MOSI and MISO.
|
|
|
|
config SPI_FLASH_HAS_VOLATILE_GROUP
|
|
bool
|
|
default n
|
|
help
|
|
Allows chipset to group write/erase operations under a single volatile
|
|
group.
|
|
|
|
endif # SPI_FLASH
|
|
|
|
config HAVE_SPI_CONSOLE_SUPPORT
|
|
def_bool n
|