From 12dc8e7522230b269b4ca8fecc64bc8e59070a53 Mon Sep 17 00:00:00 2001
From: Simon Glass <sjg@chromium.org>
Date: Fri, 17 Jul 2015 09:22:07 -0600
Subject: [PATCH] dm: Make regmap and syscon optional

Not all boards use garbage collection in their link step, so we should avoid
adding options that rely on this for prevention of code bloat. Add separate
Kconfig options for syscon and regmap uclasses.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 configs/sandbox_defconfig |  1 +
 drivers/core/Kconfig      | 19 +++++++++++++++++++
 drivers/core/Makefile     |  4 ++--
 3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 553574682d..e6a45904d0 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -52,3 +52,4 @@ CONFIG_DM_MMC=y
 CONFIG_LED=y
 CONFIG_LED_GPIO=y
 CONFIG_SYSCON=y
+CONFIG_REGMAP=y
diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig
index e40372dd75..5d0e949f05 100644
--- a/drivers/core/Kconfig
+++ b/drivers/core/Kconfig
@@ -59,3 +59,22 @@ config DM_SEQ_ALIAS
 	  Most boards will have a '/aliases' node containing the path to
 	  numbered devices (e.g. serial0 = &serial0). This feature can be
 	  disabled if it is not required, to save code space in SPL.
+
+config REGMAP
+	bool "Support register maps"
+	depends on DM
+	help
+	  Hardware peripherals tend to have one or more sets of registers
+	  which can be accessed to control the hardware. A register map
+	  models this with a simple read/write interface. It can in principle
+	  support any bus type (I2C, SPI) but so far this only supports
+	  direct memory access.
+
+config SYSCON
+	bool "Support system controllers"
+	depends on REGMAP
+	help
+	  Many SoCs have a number of system controllers which are dealt with
+	  as a group by a single driver. Some common functionality is provided
+	  by this uclass, including accessing registers via regmap and
+	  assigning a unique number to each.
diff --git a/drivers/core/Makefile b/drivers/core/Makefile
index 5c2ead870b..ce3027a851 100644
--- a/drivers/core/Makefile
+++ b/drivers/core/Makefile
@@ -10,5 +10,5 @@ obj-$(CONFIG_OF_CONTROL) += simple-bus.o
 endif
 obj-$(CONFIG_DM_DEVICE_REMOVE)	+= device-remove.o
 obj-$(CONFIG_DM)	+= dump.o
-obj-$(CONFIG_OF_CONTROL)	+= regmap.o
-obj-$(CONFIG_OF_CONTROL)	+= syscon-uclass.o
+obj-$(CONFIG_REGMAP)	+= regmap.o
+obj-$(CONFIG_SYSCON)	+= syscon-uclass.o
-- 
2.39.5