diff options
author | Lee Leahy <leroy.p.leahy@intel.com> | 2017-03-23 10:54:57 -0700 |
---|---|---|
committer | Lee Leahy <leroy.p.leahy@intel.com> | 2017-04-25 01:05:05 +0200 |
commit | eef40eb2a9138035402873396368c34963688bfc (patch) | |
tree | 92dbc74d7e330f37df21c336a92cb08ffb1769b4 /src/drivers/storage/Makefile.inc | |
parent | bb70c40f2ef5b8a02f6c0490751cb732ed25fa3d (diff) |
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>
Diffstat (limited to 'src/drivers/storage/Makefile.inc')
-rw-r--r-- | src/drivers/storage/Makefile.inc | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/src/drivers/storage/Makefile.inc b/src/drivers/storage/Makefile.inc new file mode 100644 index 0000000000..c4f75c70e2 --- /dev/null +++ b/src/drivers/storage/Makefile.inc @@ -0,0 +1,107 @@ +# +# This file is part of the coreboot project. +# +# Copyright (C) 2017 Intel Corporation. +# +# 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. +# + +ifeq ($(CONFIG_DRIVERS_STORAGE),y) + +bootblock-y += sd_mmc.c +bootblock-y += storage.c + +verstage-y += sd_mmc.c +verstage-y += storage.c + +romstage-y += sd_mmc.c +romstage-y += storage.c + +postcar-y += sd_mmc.c +postcar-y += storage.c + +ramstage-y += sd_mmc.c +ramstage-y += storage.c + +# Determine the type of controller being used +ifeq ($(CONFIG_SDHCI_CONTROLLER),y) +bootblock-y += pci_sdhci.c +bootblock-y += sdhci.c +bootblock-$(CONFIG_SDHCI_ADMA_IN_BOOTBLOCK) += sdhci_adma.c +bootblock-y += sdhci_display.c + +verstage-y += pci_sdhci.c +verstage-y += sdhci.c +verstage-$(CONFIG_SDHCI_ADMA_IN_VERSTAGE) += sdhci_adma.c +verstage-y += sdhci_display.c + +romstage-y += pci_sdhci.c +romstage-y += sdhci.c +romstage-$(CONFIG_SDHCI_ADMA_IN_ROMSTAGE) += sdhci_adma.c +romstage-y += sdhci_display.c + +postcar-y += pci_sdhci.c +postcar-y += sdhci.c +postcar-y += sdhci_adma.c +postcar-y += sdhci_display.c + +ramstage-y += pci_sdhci.c +ramstage-y += sdhci.c +ramstage-y += sdhci_adma.c +ramstage-y += sdhci_display.c + +# Determine if the bounce buffer is necessary +ifeq ($(CONFIG_SDHCI_BOUNCE_BUFFER),y) +bootblock-y += bouncebuf.c +verstage-y += bouncebuf.c +romstage-y += bouncebuf.c +postcar-y += bouncebuf.c +ramstage-y += bouncebuf.c +endif # CONFIG_SDHCI_BOUNCE_BUFFER + +endif # CONFIG_SDHCI_CONTROLLER + +# Determine if MultiMediaCards or embedded MMC devices are supported +ifeq ($(CONFIG_DRIVERS_STORAGE_MMC),y) +bootblock-y += mmc.c +verstage-y += mmc.c +romstage-y += mmc.c +postcar-y += mmc.c +ramstage-y += mmc.c +endif # CONFIG_DRIVERS_STORAGE_MMC + +# Determine if Secure Digital cards are supported +ifeq ($(CONFIG_DRIVERS_STORAGE_SD),y) +bootblock-y += sd.c +verstage-y += sd.c +romstage-y += sd.c +postcar-y += sd.c +ramstage-y += sd.c +endif # CONFIG_DRIVERS_STORAGE_SD + +# Determine if erase operations are supported +ifeq ($(CONFIG_STORAGE_ERASE),y) +bootblock-$(CONFIG_STORAGE_EARLY_ERASE) += storage_erase.c +verstage-$(CONFIG_STORAGE_EARLY_ERASE) += storage_erase.c +romstage-y += storage_erase.c +postcar-y += storage_erase.c +ramstage-y += storage_erase.c +endif # CONFIG_STORAGE_ERASE + +# Determine if write operations are supported +ifeq ($(CONFIG_STORAGE_WRITE),y) +bootblock-$(CONFIG_STORAGE_EARLY_WRITE) += storage_write.c +verstage-$(CONFIG_STORAGE_EARLY_WRITE) += storage_write.c +romstage-y += storage_write.c +postcar-y += storage_write.c +ramstage-y += storage_write.c +endif # CONFIG_STORAGE_WRITE + +endif # CONFIG_DRIVERS_STORAGE |