[PATCH 17/23] power: Tidy up #undef of CONFIG_DM_PMIC

Simon Glass sjg at chromium.org
Sun Aug 8 20:20:25 CEST 2021


Add a proper Kconfig option for SPL so we can remove the hack in some of
the board config files.

This involves adding CONFIG_SPL_DM_PMIC to some of the configs as well
as updateing the Makefile rule for PMIC_RK8XX to exclude SPL.

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

 configs/imx8mm-cl-iot-gate_defconfig |  1 +
 configs/imx8mm_beacon_defconfig      |  1 +
 configs/imx8mm_evk_defconfig         |  1 +
 configs/imx8mm_venice_defconfig      |  1 +
 configs/imx8mn_evk_defconfig         |  1 +
 configs/verdin-imx8mm_defconfig      |  1 +
 drivers/power/pmic/Kconfig           | 13 +++++++++++++
 drivers/power/pmic/Makefile          |  4 ++--
 include/configs/imx8mp_evk.h         |  1 -
 include/configs/imx8mq_evk.h         |  5 -----
 include/configs/imx8mq_phanbell.h    |  5 -----
 include/configs/pico-imx8mq.h        |  5 -----
 12 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/configs/imx8mm-cl-iot-gate_defconfig b/configs/imx8mm-cl-iot-gate_defconfig
index 58eb2d49c9d..41efb0f2454 100644
--- a/configs/imx8mm-cl-iot-gate_defconfig
+++ b/configs/imx8mm-cl-iot-gate_defconfig
@@ -102,6 +102,7 @@ CONFIG_PINCTRL_IMX8M=y
 CONFIG_POWER_DOMAIN=y
 CONFIG_IMX8M_POWER_DOMAIN=y
 CONFIG_DM_PMIC=y
+CONFIG_SPL_DM_PMIC=y
 CONFIG_DM_PMIC_BD71837=y
 CONFIG_SPL_DM_PMIC_BD71837=y
 CONFIG_DM_REGULATOR=y
diff --git a/configs/imx8mm_beacon_defconfig b/configs/imx8mm_beacon_defconfig
index a3f1515f4eb..0d99d04edcb 100644
--- a/configs/imx8mm_beacon_defconfig
+++ b/configs/imx8mm_beacon_defconfig
@@ -97,6 +97,7 @@ CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_IMX8M=y
 CONFIG_DM_PMIC=y
+CONFIG_SPL_DM_PMIC=y
 CONFIG_DM_PMIC_BD71837=y
 CONFIG_SPL_DM_PMIC_BD71837=y
 CONFIG_DM_REGULATOR=y
diff --git a/configs/imx8mm_evk_defconfig b/configs/imx8mm_evk_defconfig
index e0c0c66f2db..bfd2c7aa6c1 100644
--- a/configs/imx8mm_evk_defconfig
+++ b/configs/imx8mm_evk_defconfig
@@ -74,6 +74,7 @@ CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_IMX8M=y
 CONFIG_DM_PMIC=y
+CONFIG_SPL_DM_PMIC=y
 CONFIG_SPL_DM_PMIC_PCA9450=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
diff --git a/configs/imx8mm_venice_defconfig b/configs/imx8mm_venice_defconfig
index 1a98a8eb6f5..3e09a4a6639 100644
--- a/configs/imx8mm_venice_defconfig
+++ b/configs/imx8mm_venice_defconfig
@@ -99,6 +99,7 @@ CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_IMX8M=y
 CONFIG_DM_PMIC=y
+CONFIG_SPL_DM_PMIC=y
 CONFIG_DM_PMIC_BD71837=y
 CONFIG_SPL_DM_PMIC_BD71837=y
 CONFIG_DM_PMIC_MP5416=y
diff --git a/configs/imx8mn_evk_defconfig b/configs/imx8mn_evk_defconfig
index 4da37bd0227..ccbd8753b32 100644
--- a/configs/imx8mn_evk_defconfig
+++ b/configs/imx8mn_evk_defconfig
@@ -75,6 +75,7 @@ CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_IMX8M=y
 CONFIG_DM_PMIC=y
+CONFIG_SPL_DM_PMIC=y
 CONFIG_SPL_DM_PMIC_PCA9450=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
diff --git a/configs/verdin-imx8mm_defconfig b/configs/verdin-imx8mm_defconfig
index 341d802d611..2d7e9bebeb7 100644
--- a/configs/verdin-imx8mm_defconfig
+++ b/configs/verdin-imx8mm_defconfig
@@ -91,6 +91,7 @@ CONFIG_PINCTRL_IMX8M=y
 CONFIG_POWER_DOMAIN=y
 CONFIG_IMX8M_POWER_DOMAIN=y
 CONFIG_DM_PMIC=y
+CONFIG_SPL_DM_PMIC=y
 CONFIG_SPL_DM_PMIC_PCA9450=y
 CONFIG_DM_PMIC_PFUZE100=y
 CONFIG_DM_REGULATOR=y
diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig
index fd6648b313e..cb2a6adf84e 100644
--- a/drivers/power/pmic/Kconfig
+++ b/drivers/power/pmic/Kconfig
@@ -10,6 +10,19 @@ config DM_PMIC
 	- 'drivers/power/pmic/pmic-uclass.c'
 	- 'include/power/pmic.h'
 
+config SPL_DM_PMIC
+	bool "Enable Driver Model for PMIC drivers (UCLASS_PMIC) in SPL"
+	depends on SPL_DM
+	default y if DM_PMIC
+	---help---
+	This config enables the driver-model PMIC support in SPL.
+	UCLASS_PMIC - designed to provide an I/O interface for PMIC devices.
+	For the multi-function PMIC devices, this can be used as parent I/O
+	device for each IC's interface. Then, each children uses its parent
+	for read/write. For detailed description, please refer to the files:
+	- 'drivers/power/pmic/pmic-uclass.c'
+	- 'include/power/pmic.h'
+
 config PMIC_CHILDREN
 	bool "Allow child devices for PMICs"
 	depends on DM_PMIC
diff --git a/drivers/power/pmic/Makefile b/drivers/power/pmic/Makefile
index 5d1a97e5f6f..5250eac12f2 100644
--- a/drivers/power/pmic/Makefile
+++ b/drivers/power/pmic/Makefile
@@ -3,7 +3,7 @@
 # Copyright (C) 2012 Samsung Electronics
 # Lukasz Majewski <l.majewski at samsung.com>
 
-obj-$(CONFIG_DM_PMIC) += pmic-uclass.o
+obj-$(CONFIG_$(SPL_TPL_)DM_PMIC) += pmic-uclass.o
 obj-$(CONFIG_DM_PMIC_FAN53555) += fan53555.o
 obj-$(CONFIG_$(SPL_)DM_PMIC_DA9063) += da9063.o
 obj-$(CONFIG_DM_PMIC_MAX77686) += max77686.o
@@ -20,7 +20,7 @@ obj-$(CONFIG_PMIC_ACT8846) += act8846.o
 obj-$(CONFIG_PMIC_AS3722) += as3722.o as3722_gpio.o
 obj-$(CONFIG_PMIC_MAX8997) += max8997.o
 obj-$(CONFIG_PMIC_PM8916) += pm8916.o
-obj-$(CONFIG_PMIC_RK8XX) += rk8xx.o
+obj-$(CONFIG_$(SPL_TPL_)PMIC_RK8XX) += rk8xx.o
 obj-$(CONFIG_PMIC_RN5T567) += rn5t567.o
 obj-$(CONFIG_PMIC_TPS65090) += tps65090.o
 obj-$(CONFIG_PMIC_S5M8767) += s5m8767.o
diff --git a/include/configs/imx8mp_evk.h b/include/configs/imx8mp_evk.h
index a6569d5566e..29c74a5c63c 100644
--- a/include/configs/imx8mp_evk.h
+++ b/include/configs/imx8mp_evk.h
@@ -30,7 +30,6 @@
 #define CONFIG_SPL_ABORT_ON_RAW_IMAGE
 
 #undef CONFIG_DM_MMC
-#undef CONFIG_DM_PMIC
 #undef CONFIG_DM_PMIC_PFUZE100
 
 #define CONFIG_POWER
diff --git a/include/configs/imx8mq_evk.h b/include/configs/imx8mq_evk.h
index 1008b393217..a0d061fef79 100644
--- a/include/configs/imx8mq_evk.h
+++ b/include/configs/imx8mq_evk.h
@@ -41,7 +41,6 @@
 #define CONFIG_SPL_ABORT_ON_RAW_IMAGE
 
 #undef CONFIG_DM_MMC
-#undef CONFIG_DM_PMIC
 #undef CONFIG_DM_PMIC_PFUZE100
 
 #define CONFIG_SYS_I2C_LEGACY
@@ -144,8 +143,4 @@
 
 #define CONFIG_OF_SYSTEM_SETUP
 
-#ifndef CONFIG_SPL_BUILD
-#define CONFIG_DM_PMIC
-#endif
-
 #endif
diff --git a/include/configs/imx8mq_phanbell.h b/include/configs/imx8mq_phanbell.h
index cf62d21e930..64b4d3162e7 100644
--- a/include/configs/imx8mq_phanbell.h
+++ b/include/configs/imx8mq_phanbell.h
@@ -38,7 +38,6 @@
 #define CONFIG_SPL_ABORT_ON_RAW_IMAGE
 
 #undef CONFIG_DM_MMC
-#undef CONFIG_DM_PMIC
 #undef CONFIG_DM_PMIC_PFUZE100
 
 #define CONFIG_SYS_I2C_LEGACY
@@ -189,8 +188,4 @@
 
 #define CONFIG_OF_SYSTEM_SETUP
 
-#ifndef CONFIG_SPL_BUILD
-#define CONFIG_DM_PMIC
-#endif
-
 #endif
diff --git a/include/configs/pico-imx8mq.h b/include/configs/pico-imx8mq.h
index 66fbea8f90e..f1af4db527d 100644
--- a/include/configs/pico-imx8mq.h
+++ b/include/configs/pico-imx8mq.h
@@ -38,7 +38,6 @@
 #define CONFIG_SPL_ABORT_ON_RAW_IMAGE
 
 #undef CONFIG_DM_MMC
-#undef CONFIG_DM_PMIC
 
 #define CONFIG_SYS_I2C_LEGACY
 #define CONFIG_SYS_I2C_MXC_I2C1		/* enable I2C bus 1 */
@@ -168,10 +167,6 @@
 
 #define CONFIG_OF_SYSTEM_SETUP
 
-#ifndef CONFIG_SPL_BUILD
-#define CONFIG_DM_PMIC
-#endif
-
 #define CONFIG_SYS_BOOTM_LEN		SZ_128M
 
 #endif
-- 
2.32.0.605.g8dce9f2422-goog



More information about the U-Boot mailing list