[U-Boot] [PATCH v2 4/5] dm: core: Allow driver model to be disabled for TPL

Simon Glass sjg at chromium.org
Sun Apr 2 15:50:31 UTC 2017


Since TPL often needs to be very very small it may not make sense to
enable driver model. Add an option for this.

This changes brings the 'rock' board under the TPL limit with gcc 4.9.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v2:
- Add new patch to allow driver model to be disabled for TPL

 drivers/Makefile     |  2 +-
 drivers/core/Kconfig | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/Makefile b/drivers/Makefile
index 34c55bfb2f..5d8baa5a1f 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -2,7 +2,7 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-obj-$(CONFIG_$(SPL_)DM)		+= core/
+obj-$(CONFIG_$(SPL_TPL_)DM)	+= core/
 obj-$(CONFIG_$(SPL_)CLK)	+= clk/
 obj-$(CONFIG_$(SPL_)LED)	+= led/
 obj-$(CONFIG_$(SPL_)PINCTRL)	+= pinctrl/
diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig
index 87495614c2..405e9ad8ef 100644
--- a/drivers/core/Kconfig
+++ b/drivers/core/Kconfig
@@ -21,6 +21,20 @@ config SPL_DM
 	  and devices in SPL, so 1KB should be enable. See
 	  CONFIG_SYS_MALLOC_F_LEN for more details on how to enable it.
 
+config TPL_DM
+	bool "Enable Driver Model for TPL"
+	depends on DM && TPL
+	help
+	  Enable driver model in TPL. You will need to provide a
+	  suitable malloc() implementation. If you are not using the
+	  full malloc() enabled by CONFIG_SYS_SPL_MALLOC_START,
+	  consider using CONFIG_SYS_MALLOC_SIMPLE. In that case you
+	  must provide CONFIG_SYS_MALLOC_F_LEN to set the size.
+	  In most cases driver model will only allocate a few uclasses
+	  and devices in SPL, so 1KB should be enough. See
+	  CONFIG_SYS_MALLOC_F_LEN for more details on how to enable it.
+	  Disable this for very small implementations.
+
 config DM_WARN
 	bool "Enable warnings in driver model"
 	depends on DM
-- 
2.12.2.564.g063fe858b8-goog



More information about the U-Boot mailing list