coreboot-kgpe-d16/src/include
Lee Leahy eef40eb2a9 drivers/storage: Add SD/MMC/eMMC driver based upon depthcharge
The SD/MMC support is broken into several pieces.  There are three main
data structures:
* sdhci_ctrlr - This is SDHCI controller specific and defined in
  include/device/sdhci.h
* sd_mmc_ctrlr - This contains generic controller management data and
  defined in include/device/sd_mmc_ctrlr.h
* storage_media - This contains the flash storage device management data
  and is defined in include/device/storage.h

The SD/MMC driver consists of several components:
* SDHCI controller code
  * bouncebuf.c
  * bouncebuf.h
  * pci_sdhci.c
  * sdhci.c
  * sdhci.h
  * sdhci_adma.c
  * sdhci_display.c
* Flash storage device support
  * mmc.c
  * mmc.h
  * sd.c
  * sd_mmc.c
  * sd_mmc.h
  * storage.c
  * storage.h
  * storage_erase.c
  * storage_write.c

Kconfig values enable various portions of the controller and storage
drivers to be built to reduce the overall size of what is included in
the final image.

Full read/write/erase operations are provided for those platforms which
want to take advantage.  It is also possible to build the driver to
perform initialization only.  By default, this driver is not included in
any platform, platforms must specifically select DRIVERS_STORAGE to add
the SD/MMC support.

After this patch is reviewed and merged, there are some additional
patches:
* Common CAR storage area - Use a predefined region of CAR to pass data
  structures between bootblock through to romstage.  This allows early
  stages to preform the SD/MMC device initialization and later stages
  to use the SD/MMC device without further initialization.  The example
  code initializes the SD/MMC device in bootblock and uses the SD/MMC
  device in romstage without further initialization.
* CBMEM ID - Add a CBMEM ID value for the data structures so that they
  may be passed from romstage to ramstage and eventually the payload.
  The example uses the SD/MMC device in ramstage without further
  initialization.
* Move the SD/MMC driver into commonlib
* Have libpayload build the SD/MMC driver from commonlib.  The intent
  is to pass the controller state to libpayload so that the SD/MMC
  device can be used without further initialization.
* On some platforms, have depthcharge use the commonlib SD/MMC driver


History:

Copy the SD/MMC driver from depthcharge revision eb583fa8 into coreboot
and make the following changes:

* Removed #include "config.h" from mmc.c, allow the lint tests to pass.
* Move include files from drivers/storage into include/device.
* Rename mmc.h to storage.h.
* Add the Kconfig and Makefile and make edits to get the code to build.
* Add support to initialize a PCI controller.
* Fix formatting issues detected by checkpatch.
* Fix data flow issues detected by checkpatch.
* Add the missing voltage (MMC_VDD_35_36) into the voltage mask.
* Rename the macros mmc_debug, mmc_trace and mmc_error to sd_mmc_*.
* Replace printf with sd_mmc_error.
* Add sdhc_debug, sdhc_trace and sd_error macros.
* Add Kconfig values to enable storage device debugging and tracing.
* Add tracing and debug support to the SDHCI driver.
* Allow SOC to override more controller features.
* Split out ADMA support.
* Move 1V8 support into SOC routine.
* Move HS400 support into SOC routine.
* Rework clock handling.
* Change all controller references to use ctrlr.
* Update the voltage handling.
* Update modes of operation.
* Move DMA fields into MmcCtrlr.
* Update bus width support.
* Change MMC_TIMING_* to BUS_TIMING_*.
* Rename MMC_MODE_ to DRVR_CAP.
* Move quirks into ctrlr->caps.
* Associate removeable with the controller.
* Statically allocate MmcMedia.
* Replace the SdhciHost structure with the MmcCtrlr structure.
* Split the code to support other SD/MMC controllers.
* Split out erase and write support.
* Update the code to be more consistent with the coreboot coding style.
* Only expose calling APIs.
* Divide up mmc.c into 4 modules: MMC, SD, storage card, common code.
* Update debug and error messages.
* Add partition support.
* Display clock frequencies once in MHz.
* Remove mmc_send_cmd, use ctrlr->send_cmd instead.
* Handle error from sd_send_op_cond.
* Allow mainboard to control delays around CMD 0.
* Support command logging.
* Mainboard may set delay after SD/MMC command.
* Display serial number with sd_mmc_trace.
* Remove cmd set parameter from mmc_switch.
* Display errors for timeout and comm errors.
* Add LED support.
* Move 64bit DMA flag into ctrlr->caps.
* Rework PIO transfer routine.
* Add HS200 bus tuning.
* Add support for HS400.
* Use same format for HS400, HS200 and HS52.
* Reduce storage_media structure size
* Add routine to update code pointers
* Add display of storage setup
* Display controller setup

TEST=Build and run on Reef and Galileo Gen2

Change-Id: I9b5f9db1e27833e4ce4a97ad4f5ef3a46f64f2a2
Signed-off-by: Lee Leahy <leroy.p.leahy@intel.com>
Reviewed-on: https://review.coreboot.org/19208
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2017-04-25 01:05:05 +02:00
..
boot
console console: Add convenient debug level macros for raminit 2017-04-19 16:25:45 +02:00
cpu AGESA: Disable CAR with empty stack 2017-04-05 15:02:43 +02:00
device drivers/storage: Add SD/MMC/eMMC driver based upon depthcharge 2017-04-25 01:05:05 +02:00
pc80 src/include: Wrap lines at 80 columns 2017-03-13 17:23:37 +01:00
smp src/include: Add space after comma 2017-03-09 17:19:16 +01:00
superio
sys
tpm_lite cr50: add unmarshaling of vendor commands and process 'enable_update' 2017-03-23 23:49:58 +01:00
adainit.h
antirollback.h src/vboot: mark factory_initialze_tpm() as static 2016-11-11 18:53:33 +01:00
assert.h src/include: Move trailing statements to next line 2017-03-09 17:16:35 +01:00
b64_decode.h
base3.h
bcd.h
boardid.h
boot_device.h
bootblock_common.h src/include: Move storage class to beginning of declaration 2017-03-13 17:19:45 +01:00
bootmem.h
bootmode.h vboot: Add new function for logging recovery mode switches 2016-11-14 20:13:26 +01:00
bootstate.h src/include: Remove space after function name 2017-03-13 17:19:16 +01:00
cbfs.h src/include: Wrap lines at 80 columns 2017-03-13 17:23:37 +01:00
cbmem.h src/include: Move storage class to beginning of declaration 2017-03-13 17:19:45 +01:00
delay.h src/include: Fix unsigned warnings 2017-03-09 17:16:09 +01:00
edid.h
elog.h elog: Add all EC event codes 2017-03-09 18:04:50 +01:00
endian.h
fallback.h pc80: Move set_boot_successful() 2016-12-13 19:15:22 +01:00
fmap.h
gic.h
gpio.h
halt.h
imd.h
inttypes.h
ip_checksum.h src/include: Wrap lines at 80 columns 2017-03-13 17:23:37 +01:00
kconfig.h
lib.h
main_decl.h
memlayout.h vboot: Move remaining features out of vendorcode/google/chromeos 2017-03-28 22:18:13 +02:00
memory_info.h src/include: Include stdint.h since struct dimm_info uses it 2017-03-01 16:57:34 +01:00
memrange.h src/include: Indent code using tabs 2017-03-09 17:18:42 +01:00
nhlt.h src/include: Wrap lines at 80 columns 2017-03-13 17:23:37 +01:00
option.h
program_loading.h
random.h arch/x86: add functions to generate random numbers 2017-02-20 04:46:10 +01:00
reg_script.h src/include: Remove space after function name 2017-03-13 17:19:16 +01:00
region_file.h lib: add region file support 2016-12-08 16:10:28 +01:00
reset.h
rmodule.h src/include: Remove space after function name 2017-03-13 17:19:16 +01:00
romstage_handoff.h lib: put romstage_handoff implementation in own compilation unit 2016-12-01 08:16:47 +01:00
rtc.h src/include: Open brace on same line as enum or struct 2017-03-12 15:46:23 +01:00
rules.h Stage rules.h: Add ENV_LIBAGESA 2017-03-07 00:43:20 +01:00
sar.h chromeos: Implement locating and decoding wifi sar data from VPD 2017-01-09 18:16:10 +01:00
sdram_mode.h src/include: Remove spaces before tabs 2017-03-12 15:45:37 +01:00
smbios.h src/include: Wrap lines at 80 columns 2017-03-13 17:23:37 +01:00
spd.h src/include: Wrap lines at 80 columns 2017-03-13 17:23:37 +01:00
spd_bin.h ddr3 spd: move accessor code into lib/spd_bin.c 2017-02-10 18:04:33 +01:00
spd_ddr2.h src/include: Wrap lines at 80 columns 2017-03-13 17:23:37 +01:00
spi-generic.h drivers/spi: Get rid of spi_get_config 2017-04-09 21:35:53 +02:00
spi_flash.h drivers/spi: provide a mechanism to obtain the SPI flash boot device 2016-12-08 16:11:01 +01:00
stage_cache.h arch/x86: cache postcar in stage cache 2016-12-01 08:17:19 +01:00
stddef.h
stdlib.h src/include: Add space after comma 2017-03-09 17:19:16 +01:00
string.h src/include: Move assignment out of if condition 2017-03-13 17:20:43 +01:00
swab.h src/include: Remove unnecessary typecast 2017-03-13 17:20:15 +01:00
symbols.h src/include: Remove spaces before ( and after ) 2017-03-12 15:45:26 +01:00
thread.h src/include: Move storage class to beginning of declaration 2017-03-13 17:19:45 +01:00
timer.h src/include: Indent code using tabs 2017-03-09 17:18:42 +01:00
timestamp.h src/include: Wrap lines at 80 columns 2017-03-13 17:23:37 +01:00
tpm.h drivers/spi/tpm: Clean up SPI TPM driver 2017-04-13 05:04:13 +02:00
trace.h src/include: Remove spaces before ( and after ) 2017-03-12 15:45:26 +01:00
types.h
vbe.h src/include: Wrap lines at 80 columns 2017-03-13 17:23:37 +01:00
version.h
watchdog.h src/include: Add parenthesis around macros 2017-03-10 22:28:35 +01:00
wrdd.h