From a666af7b015e7625c3d1ae679d50c69190c6cd5d Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Sat, 29 Oct 2022 13:27:22 -0600 Subject: device/dram: Add kconfig options for memory types Currently, we're building support for all memory types into every board, and letting the linker remove anything that isn't needed. This is okay, but it'd be nice to be able to build in just what's actually needed. This change adds options to specify both what is used and what is not. By doing it that way, the default values don't change, but platforms can start removing support for memory types that are not needed. When all platforms (SoCs, CPUs and/or Northbridge chips) specify what memory types they support, the defaults on the options to use a particular memory type can be set to no, and the options not to use a memory type can be removed. Signed-off-by: Martin Roth Change-Id: I07c98a702e0d67c5ad7bd9b8a4ff24c9288ab569 Reviewed-on: https://review.coreboot.org/c/coreboot/+/68992 Tested-by: build bot (Jenkins) Reviewed-by: Elyes Haouas Reviewed-by: Angel Pons Reviewed-by: Eric Lai --- src/device/Kconfig | 2 ++ src/device/dram/Kconfig | 57 ++++++++++++++++++++++++++++++++++++++++++++ src/device/dram/Makefile.inc | 19 +++++++++++++-- 3 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 src/device/dram/Kconfig (limited to 'src/device') diff --git a/src/device/Kconfig b/src/device/Kconfig index c0ba3d1614..60ee04709b 100644 --- a/src/device/Kconfig +++ b/src/device/Kconfig @@ -953,4 +953,6 @@ config XHCI_UTILS help Provides xHCI utility functions. +source "src/device/dram/Kconfig" + endmenu diff --git a/src/device/dram/Kconfig b/src/device/dram/Kconfig new file mode 100644 index 0000000000..7bb1dab50d --- /dev/null +++ b/src/device/dram/Kconfig @@ -0,0 +1,57 @@ +## SPDX-License-Identifier: GPL-2.0-only + +# Short-term plan: Start adding 'USE_' and "NO_" options to each chip. +# +# Long-term plan: Every SoC or chipset should select the memory types they +# use. When they all select their memory, the 'no_' options can be removed +# and the defaults for all memory types can be set to n. + +config NO_DDR5 + bool + +config NO_LPDDR4 + bool + +config NO_DDR4 + bool + +config NO_DDR3 + bool + +config NO_DDR2 + bool + +config USE_DDR5 + bool + default n if NO_DDR5 + default y + help + system supports DDR5 memory + +config USE_LPDDR4 + bool + default n if NO_LPDDR4 + default y + help + system supports LPDDR4 memory + +config USE_DDR4 + bool + default n if NO_DDR4 + default y + help + system supports DDR4 memory + +config USE_DDR3 + bool + default n if NO_DDR3 + default y + help + system supports DDR3 memory + +config USE_DDR2 + bool + default n if NO_DDR2 + default y + help + system supports DDR2 memory diff --git a/src/device/dram/Makefile.inc b/src/device/dram/Makefile.inc index 31dfb91d7f..fc472ea711 100644 --- a/src/device/dram/Makefile.inc +++ b/src/device/dram/Makefile.inc @@ -1,3 +1,18 @@ -romstage-y += ddr5.c lpddr4.c ddr4.c ddr3.c ddr2.c ddr_common.c -ramstage-y += ddr5.c lpddr4.c ddr4.c ddr3.c ddr2.c ddr_common.c spd.c +romstage-y += ddr_common.c +ramstage-y += ddr_common.c spd.c + +romstage-$(CONFIG_USE_DDR5) += ddr5.c +ramstage-$(CONFIG_USE_DDR5) += ddr5.c + +romstage-$(CONFIG_USE_LPDDR4) += lpddr4.c +ramstage-$(CONFIG_USE_LPDDR4) += lpddr4.c + +romstage-$(CONFIG_USE_DDR4) += ddr4.c +ramstage-$(CONFIG_USE_DDR4) += ddr4.c + +romstage-$(CONFIG_USE_DDR3) += ddr3.c +ramstage-$(CONFIG_USE_DDR3) += ddr3.c + +romstage-$(CONFIG_USE_DDR2) += ddr2.c +ramstage-$(CONFIG_USE_DDR2) += ddr2.c -- cgit v1.2.3