summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/spi/Makefile.inc129
1 files changed, 29 insertions, 100 deletions
diff --git a/src/drivers/spi/Makefile.inc b/src/drivers/spi/Makefile.inc
index cd404f489e..e55233e9d8 100644
--- a/src/drivers/spi/Makefile.inc
+++ b/src/drivers/spi/Makefile.inc
@@ -7,105 +7,34 @@ ramstage-y += spiconsole.c
smm-y += spiconsole.c
endif
-ifeq ($(CONFIG_CONSOLE_SPI_FLASH),y)
-bootblock-y += flashconsole.c
-verstage-y += flashconsole.c
-romstage-y += flashconsole.c
-ramstage-y += flashconsole.c
-postcar-y += flashconsole.c
-smm-y += flashconsole.c
-endif
-
-bootblock-y += spi-generic.c
-bootblock-y += bitbang.c
-bootblock-$(CONFIG_COMMON_CBFS_SPI_WRAPPER) += cbfs_spi.c
-bootblock-$(CONFIG_SPI_FLASH) += spi_flash.c
-bootblock-$(CONFIG_BOOT_DEVICE_SPI_FLASH_RW_NOMMAP_EARLY) += boot_device_rw_nommap.c
-bootblock-$(CONFIG_SPI_FLASH_ADESTO) += adesto.c
-bootblock-$(CONFIG_SPI_FLASH_AMIC) += amic.c
-bootblock-$(CONFIG_SPI_FLASH_ATMEL) += atmel.c
-bootblock-$(CONFIG_SPI_FLASH_EON) += eon.c
-bootblock-$(CONFIG_SPI_FLASH_GIGADEVICE) += gigadevice.c
-bootblock-$(CONFIG_SPI_FLASH_MACRONIX) += macronix.c
-bootblock-$(CONFIG_SPI_FLASH_SPANSION) += spansion.c
-bootblock-$(CONFIG_SPI_FLASH_SST) += sst.c
-bootblock-$(CONFIG_SPI_FLASH_STMICRO) += stmicro.c
-bootblock-$(CONFIG_SPI_FLASH_WINBOND) += winbond.c
-bootblock-$(CONFIG_SPI_FRAM_RAMTRON) += ramtron.c
-
-romstage-y += spi-generic.c
-romstage-y += bitbang.c
-romstage-$(CONFIG_COMMON_CBFS_SPI_WRAPPER) += cbfs_spi.c
-romstage-$(CONFIG_SPI_FLASH) += spi_flash.c
-romstage-$(CONFIG_BOOT_DEVICE_SPI_FLASH_RW_NOMMAP_EARLY) += boot_device_rw_nommap.c
-romstage-$(CONFIG_SPI_FLASH_ADESTO) += adesto.c
-romstage-$(CONFIG_SPI_FLASH_AMIC) += amic.c
-romstage-$(CONFIG_SPI_FLASH_ATMEL) += atmel.c
-romstage-$(CONFIG_SPI_FLASH_EON) += eon.c
-romstage-$(CONFIG_SPI_FLASH_GIGADEVICE) += gigadevice.c
-romstage-$(CONFIG_SPI_FLASH_MACRONIX) += macronix.c
-romstage-$(CONFIG_SPI_FLASH_SPANSION) += spansion.c
-romstage-$(CONFIG_SPI_FLASH_SST) += sst.c
-romstage-$(CONFIG_SPI_FLASH_STMICRO) += stmicro.c
-romstage-$(CONFIG_SPI_FLASH_WINBOND) += winbond.c
-romstage-$(CONFIG_SPI_FRAM_RAMTRON) += ramtron.c
-
-verstage-y += spi-generic.c
-verstage-y += bitbang.c
-verstage-$(CONFIG_COMMON_CBFS_SPI_WRAPPER) += cbfs_spi.c
-verstage-$(CONFIG_SPI_FLASH) += spi_flash.c
-verstage-$(CONFIG_BOOT_DEVICE_SPI_FLASH_RW_NOMMAP_EARLY) += boot_device_rw_nommap.c
-verstage-$(CONFIG_SPI_FLASH_ADESTO) += adesto.c
-verstage-$(CONFIG_SPI_FLASH_AMIC) += amic.c
-verstage-$(CONFIG_SPI_FLASH_ATMEL) += atmel.c
-verstage-$(CONFIG_SPI_FLASH_EON) += eon.c
-verstage-$(CONFIG_SPI_FLASH_GIGADEVICE) += gigadevice.c
-verstage-$(CONFIG_SPI_FLASH_MACRONIX) += macronix.c
-verstage-$(CONFIG_SPI_FLASH_SPANSION) += spansion.c
-verstage-$(CONFIG_SPI_FLASH_SST) += sst.c
-verstage-$(CONFIG_SPI_FLASH_STMICRO) += stmicro.c
-verstage-$(CONFIG_SPI_FLASH_WINBOND) += winbond.c
-verstage-$(CONFIG_SPI_FRAM_RAMTRON) += ramtron.c
-
-ramstage-y += spi-generic.c
-ramstage-y += bitbang.c
-ramstage-$(CONFIG_COMMON_CBFS_SPI_WRAPPER) += cbfs_spi.c
-ramstage-$(CONFIG_SPI_FLASH) += spi_flash.c
-ramstage-$(CONFIG_BOOT_DEVICE_SPI_FLASH_RW_NOMMAP) += boot_device_rw_nommap.c
-ramstage-$(CONFIG_SPI_FLASH_ADESTO) += adesto.c
-ramstage-$(CONFIG_SPI_FLASH_AMIC) += amic.c
-ramstage-$(CONFIG_SPI_FLASH_ATMEL) += atmel.c
-ramstage-$(CONFIG_SPI_FLASH_EON) += eon.c
-ramstage-$(CONFIG_SPI_FLASH_GIGADEVICE) += gigadevice.c
-ramstage-$(CONFIG_SPI_FLASH_MACRONIX) += macronix.c
-ramstage-$(CONFIG_SPI_FLASH_SPANSION) += spansion.c
-ramstage-$(CONFIG_SPI_FLASH_SST) += sst.c
-ramstage-$(CONFIG_SPI_FLASH_STMICRO) += stmicro.c
-ramstage-$(CONFIG_SPI_FLASH_WINBOND) += winbond.c
-ramstage-$(CONFIG_SPI_FRAM_RAMTRON) += ramtron.c
-
+# add SPI drivers per stage
+# $1 stage name
+# $2 optional _EARLY suffix for CONFIG_BOOT_DEVICE_SPI_FLASH_RW_NOMMAP(_EARLY)
+define add_spi_stage
+$(1)-y += spi-generic.c
+$(1)-y += bitbang.c
+$(1)-$(CONFIG_COMMON_CBFS_SPI_WRAPPER) += cbfs_spi.c
+$(1)-$(CONFIG_SPI_FLASH) += spi_flash.c
+$(1)-$(CONFIG_BOOT_DEVICE_SPI_FLASH_RW_NOMMAP$(2)) += boot_device_rw_nommap.c
+$(1)-$(CONFIG_CONSOLE_SPI_FLASH) += flashconsole.c
+$(1)-$(CONFIG_SPI_FLASH_ADESTO) += adesto.c
+$(1)-$(CONFIG_SPI_FLASH_AMIC) += amic.c
+$(1)-$(CONFIG_SPI_FLASH_ATMEL) += atmel.c
+$(1)-$(CONFIG_SPI_FLASH_EON) += eon.c
+$(1)-$(CONFIG_SPI_FLASH_GIGADEVICE) += gigadevice.c
+$(1)-$(CONFIG_SPI_FLASH_MACRONIX) += macronix.c
+$(1)-$(CONFIG_SPI_FLASH_SPANSION) += spansion.c
+$(1)-$(CONFIG_SPI_FLASH_SST) += sst.c
+$(1)-$(CONFIG_SPI_FLASH_STMICRO) += stmicro.c
+$(1)-$(CONFIG_SPI_FLASH_WINBOND) += winbond.c
+$(1)-$(CONFIG_SPI_FRAM_RAMTRON) += ramtron.c
+endef
+
+$(eval $(call add_spi_stage,bootblock,_EARLY))
+$(eval $(call add_spi_stage,romstage,_EARLY))
+$(eval $(call add_spi_stage,verstage,_EARLY))
+$(eval $(call add_spi_stage,postcar,_EARLY))
+$(eval $(call add_spi_stage,ramstage))
ifeq ($(CONFIG_SPI_FLASH_SMM),y)
-smm-y += spi-generic.c
-smm-y += bitbang.c
-# SPI flash driver interface
-smm-$(CONFIG_SPI_FLASH) += spi_flash.c
-smm-$(CONFIG_BOOT_DEVICE_SPI_FLASH_RW_NOMMAP) += boot_device_rw_nommap.c
-
-# drivers
-smm-$(CONFIG_SPI_FLASH_ADESTO) += adesto.c
-smm-$(CONFIG_SPI_FLASH_AMIC) += amic.c
-smm-$(CONFIG_SPI_FLASH_ATMEL) += atmel.c
-smm-$(CONFIG_SPI_FLASH_EON) += eon.c
-smm-$(CONFIG_SPI_FLASH_MACRONIX) += macronix.c
-smm-$(CONFIG_SPI_FLASH_GIGADEVICE) += gigadevice.c
-smm-$(CONFIG_SPI_FLASH_SPANSION) += spansion.c
-smm-$(CONFIG_SPI_FLASH_SST) += sst.c
-smm-$(CONFIG_SPI_FLASH_STMICRO) += stmicro.c
-smm-$(CONFIG_SPI_FLASH_WINBOND) += winbond.c
-smm-$(CONFIG_SPI_FRAM_RAMTRON) += ramtron.c
+$(eval $(call add_spi_stage,smm))
endif
-
-postcar-y += spi-generic.c
-postcar-y += bitbang.c
-postcar-$(CONFIG_BOOT_DEVICE_SPI_FLASH_RW_NOMMAP_EARLY) += boot_device_rw_nommap.c
-postcar-$(CONFIG_SPI_FLASH) += spi_flash.c