From 29d7153ec384e072755e8951a8a33f29372f925c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 8 Aug 2021 12:20:26 -0600 Subject: [PATCH] power: Rename CONFIG_POWER to CONFIG_POWER_LEGACY This option is used in pre-driver model code and much of it has never been converted to driver model. We want to add a new option to enable power support, so we can use a simple rule in the Makefile. Rename this one, which is really about a particular implementation of power. Also update the pmic.h header file so it either includes the legacy API or the driver model one. Signed-off-by: Simon Glass Reviewed-by: Jaehoon Chung --- board/compulab/cl-som-imx7/cl-som-imx7.c | 4 ++-- board/freescale/imx8mp_evk/spl.c | 2 +- board/freescale/imx8mq_evk/spl.c | 2 +- board/samsung/common/board.c | 2 +- board/technexion/pico-imx7d/pico-imx7d.c | 2 +- board/tqc/tqma6/tqma6.c | 2 +- board/udoo/neo/neo.c | 2 +- drivers/power/Makefile | 2 +- drivers/power/regulator/Makefile | 2 +- include/configs/am43xx_evm.h | 2 +- include/configs/cl-som-imx7.h | 2 +- include/configs/cm_t43.h | 2 +- include/configs/el6x_common.h | 2 +- include/configs/gw_ventana.h | 2 +- include/configs/hikey.h | 2 +- include/configs/imx8mp_evk.h | 2 +- include/configs/imx8mq_evk.h | 2 +- include/configs/imx8mq_phanbell.h | 2 +- include/configs/ls1046ardb.h | 4 ++-- include/configs/mx51evk.h | 2 +- include/configs/mx53loco.h | 2 +- include/configs/mx6sabreauto.h | 2 +- include/configs/mx6sabresd.h | 2 +- include/configs/novena.h | 2 +- include/configs/phycore_imx8mp.h | 2 +- include/configs/pico-imx7d.h | 2 +- include/configs/pico-imx8mq.h | 2 +- include/configs/tqma6.h | 2 +- include/configs/udoo_neo.h | 2 +- include/configs/vining_2000.h | 2 +- include/configs/warp.h | 2 +- include/power/max77686_pmic.h | 2 +- include/power/pmic.h | 15 ++++++++++----- scripts/config_whitelist.txt | 2 +- 34 files changed, 45 insertions(+), 40 deletions(-) diff --git a/board/compulab/cl-som-imx7/cl-som-imx7.c b/board/compulab/cl-som-imx7/cl-som-imx7.c index 454c93a572..c54e02fdb4 100644 --- a/board/compulab/cl-som-imx7/cl-som-imx7.c +++ b/board/compulab/cl-som-imx7/cl-som-imx7.c @@ -267,7 +267,7 @@ int board_init(void) return 0; } -#ifdef CONFIG_POWER +#ifdef CONFIG_POWER_LEGACY #define I2C_PMIC 0 int power_init_board(void) { @@ -293,7 +293,7 @@ int power_init_board(void) return 0; } -#endif /* CONFIG_POWER */ +#endif /* CONFIG_POWER_LEGACY */ /* * cl_som_imx7_setup_wdog() - watchdog configuration. diff --git a/board/freescale/imx8mp_evk/spl.c b/board/freescale/imx8mp_evk/spl.c index a7564e9b1a..d317f21297 100644 --- a/board/freescale/imx8mp_evk/spl.c +++ b/board/freescale/imx8mp_evk/spl.c @@ -63,7 +63,7 @@ struct i2c_pads_info i2c_pad_info1 = { }, }; -#ifdef CONFIG_POWER +#ifdef CONFIG_POWER_LEGACY #define I2C_PMIC 0 int power_init_board(void) { diff --git a/board/freescale/imx8mq_evk/spl.c b/board/freescale/imx8mq_evk/spl.c index e8e0efe485..6ee6230f74 100644 --- a/board/freescale/imx8mq_evk/spl.c +++ b/board/freescale/imx8mq_evk/spl.c @@ -156,7 +156,7 @@ int board_mmc_init(struct bd_info *bis) return 0; } -#ifdef CONFIG_POWER +#ifdef CONFIG_POWER_LEGACY #define I2C_PMIC 0 int power_init_board(void) { diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c index 1c2fe025e8..08f9202b71 100644 --- a/board/samsung/common/board.c +++ b/board/samsung/common/board.c @@ -185,7 +185,7 @@ int board_early_init_f(void) } #endif -#if defined(CONFIG_POWER) || defined(CONFIG_DM_PMIC) +#if defined(CONFIG_POWER_LEGACY) || defined(CONFIG_DM_PMIC) int power_init_board(void) { set_ps_hold_ctrl(); diff --git a/board/technexion/pico-imx7d/pico-imx7d.c b/board/technexion/pico-imx7d/pico-imx7d.c index 2d749dac19..81b1fb3512 100644 --- a/board/technexion/pico-imx7d/pico-imx7d.c +++ b/board/technexion/pico-imx7d/pico-imx7d.c @@ -60,7 +60,7 @@ int dram_init(void) return 0; } -#ifdef CONFIG_POWER +#ifdef CONFIG_POWER_LEGACY #define I2C_PMIC 3 int power_init_board(void) { diff --git a/board/tqc/tqma6/tqma6.c b/board/tqc/tqma6/tqma6.c index 0d8229d112..f851e1948c 100644 --- a/board/tqc/tqma6/tqma6.c +++ b/board/tqc/tqma6/tqma6.c @@ -247,7 +247,7 @@ static const char *tqma6_get_boardname(void) }; } -#ifdef CONFIG_POWER +#ifdef CONFIG_POWER_LEGACY /* setup board specific PMIC */ int power_init_board(void) { diff --git a/board/udoo/neo/neo.c b/board/udoo/neo/neo.c index 92a1e084b5..88889df2d2 100644 --- a/board/udoo/neo/neo.c +++ b/board/udoo/neo/neo.c @@ -96,7 +96,7 @@ static struct i2c_pads_info i2c_pad_info1 = { }; #endif -#ifdef CONFIG_POWER +#ifdef CONFIG_POWER_LEGACY int power_init_board(void) { struct pmic *p; diff --git a/drivers/power/Makefile b/drivers/power/Makefile index 0bef06920a..ab52bc1582 100644 --- a/drivers/power/Makefile +++ b/drivers/power/Makefile @@ -16,7 +16,7 @@ obj-$(CONFIG_TPS6586X_POWER) += tps6586x.o obj-$(CONFIG_TWL4030_POWER) += twl4030.o obj-$(CONFIG_TWL6030_POWER) += twl6030.o obj-$(CONFIG_PALMAS_POWER) += palmas.o -obj-$(CONFIG_POWER) += power_core.o +obj-$(CONFIG_POWER_LEGACY) += power_core.o obj-$(CONFIG_DIALOG_POWER) += power_dialog.o obj-$(CONFIG_POWER_FSL) += power_fsl.o obj-$(CONFIG_POWER_I2C) += power_i2c.o diff --git a/drivers/power/regulator/Makefile b/drivers/power/regulator/Makefile index 677134c822..4efb32a322 100644 --- a/drivers/power/regulator/Makefile +++ b/drivers/power/regulator/Makefile @@ -16,7 +16,7 @@ obj-$(CONFIG_$(SPL_)DM_REGULATOR_FAN53555) += fan53555.o obj-$(CONFIG_$(SPL_)DM_REGULATOR_COMMON) += regulator_common.o obj-$(CONFIG_$(SPL_)DM_REGULATOR_FIXED) += fixed.o obj-$(CONFIG_$(SPL_)DM_REGULATOR_GPIO) += gpio-regulator.o -obj-$(CONFIG_REGULATOR_RK8XX) += rk8xx.o +obj-$(CONFIG_$(SPL_TPL_)REGULATOR_RK8XX) += rk8xx.o obj-$(CONFIG_DM_REGULATOR_S2MPS11) += s2mps11_regulator.o obj-$(CONFIG_REGULATOR_S5M8767) += s5m8767.o obj-$(CONFIG_DM_REGULATOR_SANDBOX) += sandbox.o diff --git a/include/configs/am43xx_evm.h b/include/configs/am43xx_evm.h index 83fc00de31..ac735f8722 100644 --- a/include/configs/am43xx_evm.h +++ b/include/configs/am43xx_evm.h @@ -24,7 +24,7 @@ /* Power */ #if !CONFIG_IS_ENABLED(DM_I2C) -#define CONFIG_POWER +#define CONFIG_POWER_LEGACY #define CONFIG_POWER_I2C #endif #define CONFIG_POWER_TPS65218 diff --git a/include/configs/cl-som-imx7.h b/include/configs/cl-som-imx7.h index 7c7ddadbf5..0692653a9f 100644 --- a/include/configs/cl-som-imx7.h +++ b/include/configs/cl-som-imx7.h @@ -22,7 +22,7 @@ #define IMX_FEC_BASE ENET_IPS_BASE_ADDR /* PMIC */ -#define CONFIG_POWER +#define CONFIG_POWER_LEGACY #define CONFIG_POWER_I2C #define CONFIG_POWER_PFUZE3000 #define CONFIG_POWER_PFUZE3000_I2C_ADDR 0x08 diff --git a/include/configs/cm_t43.h b/include/configs/cm_t43.h index 80db84162f..32d2581764 100644 --- a/include/configs/cm_t43.h +++ b/include/configs/cm_t43.h @@ -50,7 +50,7 @@ #define CONFIG_AM437X_USB2PHY2_HOST /* Power */ -#define CONFIG_POWER +#define CONFIG_POWER_LEGACY #define CONFIG_POWER_I2C #define CONFIG_POWER_TPS65218 diff --git a/include/configs/el6x_common.h b/include/configs/el6x_common.h index 3f71db3219..f8af7c427b 100644 --- a/include/configs/el6x_common.h +++ b/include/configs/el6x_common.h @@ -23,7 +23,7 @@ #define CONFIG_SYS_FSL_USDHC_NUM 2 /* PMIC */ -#define CONFIG_POWER +#define CONFIG_POWER_LEGACY #define CONFIG_POWER_I2C #define CONFIG_POWER_PFUZE100 #define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08 diff --git a/include/configs/gw_ventana.h b/include/configs/gw_ventana.h index dbe36989aa..615cc0b2e0 100644 --- a/include/configs/gw_ventana.h +++ b/include/configs/gw_ventana.h @@ -65,7 +65,7 @@ /* * PMIC */ -#define CONFIG_POWER +#define CONFIG_POWER_LEGACY #define CONFIG_POWER_I2C #define CONFIG_POWER_PFUZE100 #define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08 diff --git a/include/configs/hikey.h b/include/configs/hikey.h index eee342e774..f6685a928a 100644 --- a/include/configs/hikey.h +++ b/include/configs/hikey.h @@ -13,7 +13,7 @@ #include -#define CONFIG_POWER +#define CONFIG_POWER_LEGACY #define CONFIG_POWER_HI6553 #define CONFIG_REMAKE_ELF diff --git a/include/configs/imx8mp_evk.h b/include/configs/imx8mp_evk.h index 9dd4bf7b24..16417926c9 100644 --- a/include/configs/imx8mp_evk.h +++ b/include/configs/imx8mp_evk.h @@ -31,7 +31,7 @@ #undef CONFIG_DM_MMC -#define CONFIG_POWER +#define CONFIG_POWER_LEGACY #define CONFIG_POWER_I2C #define CONFIG_POWER_PCA9450 diff --git a/include/configs/imx8mq_evk.h b/include/configs/imx8mq_evk.h index e0666c9add..d694379fdd 100644 --- a/include/configs/imx8mq_evk.h +++ b/include/configs/imx8mq_evk.h @@ -44,7 +44,7 @@ #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG -#define CONFIG_POWER +#define CONFIG_POWER_LEGACY #define CONFIG_POWER_I2C #define CONFIG_POWER_PFUZE100 #define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08 diff --git a/include/configs/imx8mq_phanbell.h b/include/configs/imx8mq_phanbell.h index 2fd1302bcf..ff8a168288 100644 --- a/include/configs/imx8mq_phanbell.h +++ b/include/configs/imx8mq_phanbell.h @@ -41,7 +41,7 @@ #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG -#define CONFIG_POWER +#define CONFIG_POWER_LEGACY #define CONFIG_POWER_I2C #endif diff --git a/include/configs/ls1046ardb.h b/include/configs/ls1046ardb.h index 40c045a97f..b40a696916 100644 --- a/include/configs/ls1046ardb.h +++ b/include/configs/ls1046ardb.h @@ -124,8 +124,8 @@ #define I2C_RETIMER_ADDR 0x18 /* PMIC */ -#define CONFIG_POWER -#ifdef CONFIG_POWER +#define CONFIG_POWER_LEGACY +#ifdef CONFIG_POWER_LEGACY #define CONFIG_POWER_I2C #endif diff --git a/include/configs/mx51evk.h b/include/configs/mx51evk.h index 0022c33483..bd2d0e5ee7 100644 --- a/include/configs/mx51evk.h +++ b/include/configs/mx51evk.h @@ -30,7 +30,7 @@ #define CONFIG_MXC_UART_BASE UART1_BASE /* PMIC Controller */ -#define CONFIG_POWER +#define CONFIG_POWER_LEGACY #define CONFIG_POWER_SPI #define CONFIG_POWER_FSL #define CONFIG_FSL_PMIC_BUS 0 diff --git a/include/configs/mx53loco.h b/include/configs/mx53loco.h index 479ffdf02f..a546e9620c 100644 --- a/include/configs/mx53loco.h +++ b/include/configs/mx53loco.h @@ -33,7 +33,7 @@ #define CONFIG_MXC_USB_FLAGS 0 /* PMIC Controller */ -#define CONFIG_POWER +#define CONFIG_POWER_LEGACY #define CONFIG_POWER_I2C #define CONFIG_DIALOG_POWER #define CONFIG_POWER_FSL diff --git a/include/configs/mx6sabreauto.h b/include/configs/mx6sabreauto.h index f854ddd87b..ccf631dedd 100644 --- a/include/configs/mx6sabreauto.h +++ b/include/configs/mx6sabreauto.h @@ -59,7 +59,7 @@ /* DMA stuff, needed for GPMI/MXS NAND support */ /* PMIC */ -#define CONFIG_POWER +#define CONFIG_POWER_LEGACY #define CONFIG_POWER_I2C #define CONFIG_POWER_PFUZE100 #define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08 diff --git a/include/configs/mx6sabresd.h b/include/configs/mx6sabresd.h index 73f48c6dae..ee75ada5a7 100644 --- a/include/configs/mx6sabresd.h +++ b/include/configs/mx6sabresd.h @@ -38,7 +38,7 @@ #endif /* PMIC */ -#define CONFIG_POWER +#define CONFIG_POWER_LEGACY #define CONFIG_POWER_I2C #define CONFIG_POWER_PFUZE100 #define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08 diff --git a/include/configs/novena.h b/include/configs/novena.h index 1a175f1315..e39191fa1a 100644 --- a/include/configs/novena.h +++ b/include/configs/novena.h @@ -68,7 +68,7 @@ #endif /* PMIC */ -#define CONFIG_POWER +#define CONFIG_POWER_LEGACY #define CONFIG_POWER_I2C #define CONFIG_POWER_PFUZE100 #define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08 diff --git a/include/configs/phycore_imx8mp.h b/include/configs/phycore_imx8mp.h index 3f3b175df7..f9686e14a8 100644 --- a/include/configs/phycore_imx8mp.h +++ b/include/configs/phycore_imx8mp.h @@ -29,7 +29,7 @@ #define CONFIG_SPL_ABORT_ON_RAW_IMAGE -#define CONFIG_POWER +#define CONFIG_POWER_LEGACY #define CONFIG_POWER_I2C #define CONFIG_POWER_PCA9450 diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h index a1cf8fc7d8..a0e782dbd3 100644 --- a/include/configs/pico-imx7d.h +++ b/include/configs/pico-imx7d.h @@ -122,7 +122,7 @@ (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) /* PMIC */ -#define CONFIG_POWER +#define CONFIG_POWER_LEGACY #define CONFIG_POWER_I2C #define CONFIG_POWER_PFUZE3000 #define CONFIG_POWER_PFUZE3000_I2C_ADDR 0x08 diff --git a/include/configs/pico-imx8mq.h b/include/configs/pico-imx8mq.h index 09e0f44872..c67264da17 100644 --- a/include/configs/pico-imx8mq.h +++ b/include/configs/pico-imx8mq.h @@ -41,7 +41,7 @@ #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG -#define CONFIG_POWER +#define CONFIG_POWER_LEGACY #define CONFIG_POWER_I2C #endif diff --git a/include/configs/tqma6.h b/include/configs/tqma6.h index 97113b0343..11ad2f7cc2 100644 --- a/include/configs/tqma6.h +++ b/include/configs/tqma6.h @@ -42,7 +42,7 @@ #define CONFIG_SYS_I2C_EEPROM_PAGE_WRITE_DELAY_MS 20 #if !defined(CONFIG_DM_PMIC) -#define CONFIG_POWER +#define CONFIG_POWER_LEGACY #define CONFIG_POWER_I2C #define CONFIG_POWER_PFUZE100 #define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08 diff --git a/include/configs/udoo_neo.h b/include/configs/udoo_neo.h index cf47e3fbe9..d51a25dd2e 100644 --- a/include/configs/udoo_neo.h +++ b/include/configs/udoo_neo.h @@ -68,7 +68,7 @@ (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) /* PMIC */ -#define CONFIG_POWER +#define CONFIG_POWER_LEGACY #define CONFIG_POWER_I2C #define CONFIG_POWER_PFUZE3000 #define CONFIG_POWER_PFUZE3000_I2C_ADDR 0x08 diff --git a/include/configs/vining_2000.h b/include/configs/vining_2000.h index ade0537f87..4c34bec292 100644 --- a/include/configs/vining_2000.h +++ b/include/configs/vining_2000.h @@ -40,7 +40,7 @@ #define CONFIG_SYS_FSL_ESDHC_ADDR USDHC4_BASE_ADDR /* PMIC */ -#define CONFIG_POWER +#define CONFIG_POWER_LEGACY #define CONFIG_POWER_I2C #define CONFIG_POWER_PFUZE100 #define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08 diff --git a/include/configs/warp.h b/include/configs/warp.h index d3921dabf6..29f69bb7dc 100644 --- a/include/configs/warp.h +++ b/include/configs/warp.h @@ -52,7 +52,7 @@ /* I2C Configs */ /* PMIC */ -#define CONFIG_POWER +#define CONFIG_POWER_LEGACY #define CONFIG_POWER_I2C #define CONFIG_EXTRA_ENV_SETTINGS \ diff --git a/include/power/max77686_pmic.h b/include/power/max77686_pmic.h index 82fe3509a0..95ba61d953 100644 --- a/include/power/max77686_pmic.h +++ b/include/power/max77686_pmic.h @@ -154,7 +154,7 @@ enum { OPMODE_ON, }; -#ifdef CONFIG_POWER +#ifdef CONFIG_POWER_LEGACY int max77686_set_ldo_voltage(struct pmic *p, int ldo, ulong uV); int max77686_set_ldo_mode(struct pmic *p, int ldo, char opmode); int max77686_set_buck_voltage(struct pmic *p, int buck, ulong uV); diff --git a/include/power/pmic.h b/include/power/pmic.h index be9de6b4de..a10e173500 100644 --- a/include/power/pmic.h +++ b/include/power/pmic.h @@ -17,7 +17,8 @@ enum { PMIC_I2C, PMIC_SPI, PMIC_NONE}; -#ifdef CONFIG_POWER +/* TODO: Change to !CONFIG_IS_ENABLED(DM_PMIC) when SPL_DM_PMIC exists */ +#ifdef CONFIG_POWER_LEGACY enum { I2C_PMIC, I2C_NUM, }; enum { PMIC_READ, PMIC_WRITE, }; enum { PMIC_SENSOR_BYTE_ORDER_LITTLE, PMIC_SENSOR_BYTE_ORDER_BIG, }; @@ -82,8 +83,9 @@ struct pmic { struct pmic *parent; struct list_head list; }; -#endif /* CONFIG_POWER */ +#endif /* CONFIG_POWER_LEGACY */ +/* TODO: Change to CONFIG_IS_ENABLED(DM_PMIC) when SPL_DM_PMIC exists */ #ifdef CONFIG_DM_PMIC /** * U-Boot PMIC Framework @@ -306,9 +308,12 @@ struct uc_pmic_priv { uint trans_len; }; -#endif /* CONFIG_DM_PMIC */ +#endif /* DM_PMIC */ -#ifdef CONFIG_POWER +/* TODO: Change to CONFIG_IS_ENABLED(DM_PMIC) when SPL_DM_PMIC exists */ +#ifdef CONFIG_POWER_LEGACY + +/* Legacy API, do not use */ int pmic_init(unsigned char bus); int power_init_board(void); int pmic_dialog_init(unsigned char bus); @@ -319,7 +324,7 @@ int pmic_probe(struct pmic *p); int pmic_reg_read(struct pmic *p, u32 reg, u32 *val); int pmic_reg_write(struct pmic *p, u32 reg, u32 val); int pmic_set_output(struct pmic *p, u32 reg, int ldo, int on); -#endif +#endif /* CONFIG_POWER_LEGACY */ #define pmic_i2c_addr (p->hw.i2c.addr) #define pmic_i2c_tx_num (p->hw.i2c.tx_num) diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 0dbcc165a6..50e607f436 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -1032,11 +1032,11 @@ CONFIG_POST_EXTERNAL_WORD_FUNCS CONFIG_POST_SKIP_ENV_FLAGS CONFIG_POST_UART CONFIG_POST_WATCHDOG -CONFIG_POWER CONFIG_POWER_FSL CONFIG_POWER_FSL_MC13892 CONFIG_POWER_HI6553 CONFIG_POWER_I2C +CONFIG_POWER_LEGACY CONFIG_POWER_LTC3676 CONFIG_POWER_LTC3676_I2C_ADDR CONFIG_POWER_MAX77696_I2C_ADDR