From ef391515831a63d703ece180cf8d8475ea8a53f0 Mon Sep 17 00:00:00 2001
From: Simon Glass <sjg@chromium.org>
Date: Mon, 1 Oct 2018 12:22:13 -0600
Subject: [PATCH] blk: Support block drivers in TPL

At present it is not possible to enable/disable block drivers in TPL. This
is needed to provide sandbox support. Add a Kconfig option and adjust the
Makefile.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 drivers/block/Kconfig  | 12 ++++++++++++
 drivers/block/Makefile |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index f9502b36ba..33f4aa2418 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -27,6 +27,18 @@ config SPL_BLK
 	  be partitioned into several areas, called 'partitions' in U-Boot.
 	  A filesystem can be placed in each partition.
 
+config TPL_BLK
+	bool "Support block devices in TPL"
+	depends on TPL_DM && BLK
+	default y
+	help
+	  Enable support for block devices, such as SCSI, MMC and USB
+	  flash sticks. These provide a block-level interface which permits
+	  reading, writing and (in some cases) erasing blocks. Block
+	  devices often have a partition table which allows the device to
+	  be partitioned into several areas, called 'partitions' in U-Boot.
+	  A filesystem can be placed in each partition.
+
 config BLOCK_CACHE
 	bool "Use block device cache"
 	depends on BLK
diff --git a/drivers/block/Makefile b/drivers/block/Makefile
index 0e80ce9405..055d42f7d4 100644
--- a/drivers/block/Makefile
+++ b/drivers/block/Makefile
@@ -11,4 +11,4 @@ endif
 
 obj-$(CONFIG_IDE) += ide.o
 obj-$(CONFIG_SANDBOX) += sandbox.o
-obj-$(CONFIG_$(SPL_)BLOCK_CACHE) += blkcache.o
+obj-$(CONFIG_$(SPL_TPL_)BLOCK_CACHE) += blkcache.o
-- 
2.39.5