sunxi: Migrate to DM_I2C
Subsystems (5)
Samuel Holland
maintainercover sunxi: Migrate to DM_I2C
This series does the initial work to migrate sunxi boards to DM_I2C.
First it takes care of the PMIC:
- Patches 1-2 add DM_I2C versions of two drivers.
- Patches 3-4 allow us to use DM_PMIC without DM_SPL.
- Patch 5 then adds a DM_PMIC driver.
- Patches 6-9 migrate the "pmic_bus" functions to use that DM_PMIC driver when possible.
Then it takes care of the LCD panels:
- Patch 10 converts those drivers to use DM_I2C.
Finally, patch 11 switches all sunxi boards over to DM_I2C.
There is some remaining work to clean up uses of pmic_bus in U-Boot proper and replace them with DM_PMIC functions:
- drivers/gpio/axp_gpio.c - I have a series for this.
- do_poweroff() in drivers/gpio/axp???.c - I have a series for this.
- axp_get_sid() in drivers/power/axp221.c - Not sure what to do here.
- axp_set_eldo() in drivers/video/sunxi/sunxi_display.c - This will need a DM_REGULATOR driver.
This series is on top of
https://patchwork.ozlabs.org/project/uboot/list/?series=258648
which is on top of
https://patchwork.ozlabs.org/project/uboot/list/?series=258482
I have build-tested each commit on all sunxi boards, and boot-tested the series on Pine H64 (H6) and Orange Pi Zero2 (H616).
Samuel Holland (11):
i2c: Add a DM_I2C wrapper for the sun6i_p2wi controller
i2c: Add a DM_I2C wrapper for the sun8i_rsb controller
power: pmic: Consistently depend on DM_PMIC
power: pmic: Make the uclass optional in SPL
power: pmic: Add a driver for X-Powers AXP PMICs
sunxi: Select SUN8I_RSB more carefully
sunxi: pmic_bus: Fix Kconfig dependencies
sunxi: pmic_bus: Clean up preprocessor conditions
sunxi: pmic_bus: Use the DM PMIC interface when possible
sunxi: video: Convert panel I2C to use DM_I2C
sunxi: Enable DM_I2C for all sunxi boards
arch/arm/Kconfig | 1 + arch/arm/mach-sunxi/Kconfig | 51 +++---------- arch/arm/mach-sunxi/pmic_bus.c | 109 ++++++++++++++-------------- board/sunxi/board.c | 44 +---------- configs/Colombus_defconfig | 6 -- configs/UTOO_P66_defconfig | 3 - drivers/i2c/Kconfig | 16 ++++ drivers/i2c/Makefile | 2 + drivers/i2c/sun6i_p2wi.c | 66 +++++++++++++++++ drivers/i2c/sun8i_rsb.c | 86 ++++++++++++++++++++++ drivers/power/pmic/Kconfig | 72 +++++++++--------- drivers/power/pmic/Makefile | 3 +- drivers/power/pmic/axp.c | 49 +++++++++++++ drivers/video/anx9804.c | 107 +++++++++++++-------------- drivers/video/anx9804.h | 5 +- drivers/video/sunxi/sunxi_display.c | 55 +++++++++----- include/axp_pmic.h | 12 +++ include/configs/sunxi-common.h | 17 ----- 18 files changed, 435 insertions(+), 269 deletions(-) create mode 100644 drivers/i2c/sun6i_p2wi.c create mode 100644 drivers/i2c/sun8i_rsb.c create mode 100644 drivers/power/pmic/axp.c
Signature · 1 line
2.31.1
Samuel Holland
maintainerPATCH 1/11 i2c: Add a DM_I2C wrapper for the sun6i_p2wi controller
This bus controller is used to communicate with an X-Powers AXP PMIC. Currently, various drivers access PMIC registers through a platform- specific non-DM "pmic_bus" interface, which depends on the legacy I2C framework. In order to convert those drivers to use DM_PMIC, this bus needs a DM_I2C driver.
Since the non-DM bus controller driver is still needed in SPL, the quick solution is to implement the DM_I2C ops using the existing functions.
The register for switching between I2C/P2WI/RSB mode is the same across all PMIC variants, so move that to the common header.
---
arch/arm/mach-sunxi/Kconfig | 11 ------ arch/arm/mach-sunxi/pmic_bus.c | 7 ++-- drivers/i2c/Kconfig | 8 +++++ drivers/i2c/Makefile | 1 + drivers/i2c/sun6i_p2wi.c | 66 ++++++++++++++++++++++++++++++++++ include/axp_pmic.h | 6 ++++ 6 files changed, 84 insertions(+), 15 deletions(-) create mode 100644 drivers/i2c/sun6i_p2wi.c
arch/arm/mach-sunxi/Kconfig +0 -11
@@ -88,17 +88,6 @@ config DRAM_SUN50I_H616_UNKNOWN_FEATURE feature. endif -config SUN6I_P2WI - bool "Allwinner sun6i internal P2WI controller" - help - If you say yes to this option, support will be included for the - P2WI (Push/Pull 2 Wire Interface) controller embedded in some sunxi - SOCs. - The P2WI looks like an SMBus controller (which supports only byte - accesses), except that it only supports one slave device. - This interface is used to connect to specific PMIC devices (like the - AXP221). - config SUN6I_PRCM bool help
arch/arm/mach-sunxi/pmic_bus.c +3 -4
@@ -8,6 +8,7 @@* axp223 uses the rsb bus, these functions abstract this. */ +#include <axp_pmic.h> #include <common.h> #include <asm/arch/p2wi.h> #include <asm/arch/rsb.h>
@@ -21,8 +22,6 @@#define AXP305_I2C_ADDR 0x36#define AXP221_CHIP_ADDR 0x68 -#define AXP221_CTRL_ADDR 0x3e -#define AXP221_INIT_DATA 0x3e/* AXP818 device and runtime addresses are same as AXP223 */ #define AXP223_DEVICE_ADDR 0x3a3
@@ -40,8 +39,8 @@ int pmic_bus_init(void)#if definedCONFIG_AXP221_POWER || definedCONFIG_AXP809_POWER || definedCONFIG_AXP818_POWER # ifdef CONFIG_MACH_SUN6I p2wi_init (); - ret =p2wi_change_to_p2wi_mode (AXP221_CHIP_ADDR ,AXP221_CTRL_ADDR , -AXP221_INIT_DATA ); + ret =p2wi_change_to_p2wi_mode (AXP221_CHIP_ADDR ,AXP_PMIC_MODE_REG , +AXP_PMIC_MODE_P2WI );# elif definedCONFIG_MACH_SUN8I_R40 /* Nothing. R40 uses the AXP221s in I2C mode */ ret =0 ;
drivers/i2c/Kconfig +8 -0
@@ -577,6 +577,14 @@ config SYS_I2C_STM32F7 _ Optional clock stretching _ Software reset +config SUN6I_P2WI + bool "Allwinner sun6i P2WI controller" + depends on ARCH_SUNXI + help + Support for the P2WI (Push/Pull 2 Wire Interface) controller embedded + in the Allwinner A31 and A31s SOCs. This interface is used to connect + to specific devices like the X-Powers AXP221 PMIC. + config SYS_I2C_SYNQUACER bool "Socionext SynQuacer I2C controller" depends on ARCH_SYNQUACER && DM_I2C
drivers/i2c/Makefile +1 -0
@@ -43,6 +43,7 @@ obj-$(CONFIG_SYS_I2C_SANDBOX) += sandbox_i2c.o i2c-emul-uclass.o obj-$(CONFIG_SYS_I2C_SH) += sh_i2c.o obj-$(CONFIG_SYS_I2C_SOFT) += soft_i2c.o obj-$(CONFIG_SYS_I2C_STM32F7) += stm32f7_i2c.o +obj-$(CONFIG_SUN6I_P2WI) += sun6i_p2wi.o obj-$(CONFIG_SYS_I2C_SYNQUACER) += synquacer_i2c.o obj-$(CONFIG_SYS_I2C_TEGRA) += tegra_i2c.o obj-$(CONFIG_SYS_I2C_UNIPHIER) += i2c-uniphier.o
drivers/i2c/sun6i_p2wi.c new file +66 -0
66 lines not on this page · raw message
include/axp_pmic.h +6 -0
@@ -6,6 +6,8 @@*/ #ifndef _AXP_PMIC_H_ +#include <stdbool.h> +#ifdef CONFIG_AXP152_POWER #include <axp152.h> #endif
@@ -25,6 +27,10 @@#include <axp818.h> #endif +#define AXP_PMIC_MODE_REG 0x3e +#define AXP_PMIC_MODE_I2C 0x00 +#define AXP_PMIC_MODE_P2WI 0x3e +int axp_set_dcdc1 (unsigned int mvolt);int axp_set_dcdc2 (unsigned int mvolt);int axp_set_dcdc3 (unsigned int mvolt);
Signature · 1 line
2.31.1
Re: [PATCH 01/11] i2c: Add a DM_I2C wrapper for the sun6i_p2wi controller
Hello Samuel,
Quoted 12 lines · Samuel Holland
This bus controller is used to communicate with an X-Powers AXP PMIC. Currently, various drivers access PMIC registers through a platform- specific non-DM "
pmic_bus" interface, which depends on the legacy I2C framework. In order to convert those drivers to useDM_PMIC, this bus needs aDM_I2Cdriver.Since the non-DM bus controller driver is still needed in SPL, the quick solution is to implement the
DM_I2Cops using the existing functions.The register for switching between I2C/P2WI/RSB mode is the same across all PMIC variants, so move that to the common header.
Quoted 8 lines
Signed-off-by Samuel Holland <[email protected]>---
arch/arm/mach-sunxi/Kconfig | 11 ------ arch/arm/mach-sunxi/pmic_bus.c | 7 ++-- drivers/i2c/Kconfig | 8 +++++ drivers/i2c/Makefile | 1 + drivers/i2c/sun6i_p2wi.c | 66 ++++++++++++++++++++++++++++++++++
I wonder, as this config symbol gets also removed, that there is no remove of driver code?
Quoted 63 lines
include/axp_pmic.h | 6 ++++ 6 files changed, 84 insertions(+), 15 deletions(-) create mode 100644 drivers/i2c/sun6i_p2wi.carch/arm/mach-sunxi/Kconfig +0
-11@@ -88,17 +88,6 @@ config DRAM_SUN50I_H616_UNKNOWN_FEATURE feature. endif -config SUN6I_P2WI - bool "Allwinner sun6i internal P2WI controller" - help - If you say yes to this option, support will be included for the - P2WI (Push/Pull 2 Wire Interface) controller embedded in some sunxi - SOCs. - The P2WI looks like an SMBus controller (which supports only byte - accesses), except that it only supports one slave device. - This interface is used to connect to specific PMIC devices (like the - AXP221). - config SUN6I_PRCM bool helparch/arm/mach-sunxi/pmic_bus.c +3
-4@@ -8,6 +8,7 @@* axp223 uses the rsb bus, these functions abstract this. */ +#include <axp_pmic.h> #include <common.h> #include <asm/arch/p2wi.h> #include <asm/arch/rsb.h> @@ -21,8 +22,6 @@#define AXP305_I2C_ADDR 0x36#define AXP221_CHIP_ADDR 0x68 -#define AXP221_CTRL_ADDR 0x3e -#define AXP221_INIT_DATA 0x3e/* AXP818 device and runtime addresses are same as AXP223 */ #define AXP223_DEVICE_ADDR 0x3a3@@ -40,8 +39,8 @@ int pmic_bus_init(void)#if definedCONFIG_AXP221_POWER || definedCONFIG_AXP809_POWER || definedCONFIG_AXP818_POWER # ifdef CONFIG_MACH_SUN6I p2wi_init (); - ret =p2wi_change_to_p2wi_mode (AXP221_CHIP_ADDR ,AXP221_CTRL_ADDR , -AXP221_INIT_DATA ); + ret =p2wi_change_to_p2wi_mode (AXP221_CHIP_ADDR ,AXP_PMIC_MODE_REG , +AXP_PMIC_MODE_P2WI );# elif definedCONFIG_MACH_SUN8I_R40 /* Nothing. R40 uses the AXP221s in I2C mode */ ret =0 ;drivers/i2c/Kconfig +0
-0
drivers/i2c/Kconfig config SYS_I2C_STM32F7 · line 580
Quoted 4 lines
drivers/i2c/Kconfig +1
-0@@ -577,6 +577,14 @@ config SYS_I2C_STM32F7 _ Optional clock stretching _ Software reset +config SUN6I_P2WI
Could you please use "SYS_I2C_" ?
Quoted 15 lines
drivers/i2c/Kconfig +7
-0+ bool "Allwinner sun6i P2WI controller" + depends on ARCH_SUNXI + help + Support for the P2WI (Push/Pull 2 Wire Interface) controller embedded + in the Allwinner A31 and A31s SOCs. This interface is used to connect + to specific devices like the X-Powers AXP221 PMIC. + config SYNQUACER bool "Socionext SynQuacer I2C controller" depends on ARCH_SYNQUACER && DM_I2Cdrivers/i2c/Makefile +0
-0
drivers/i2c/Makefile obj-$(CONFIG_SYS_I2C_SANDBOX) += sandbox_i2c.o i2c-emul-uclass.o · line 46
Quoted 4 lines
drivers/i2c/Makefile +1
-0@@ -43,6 +43,7 @@ obj-$(CONFIG_SYS_I2C_SANDBOX) += sandbox_i2c.o i2c-emul-uclass.o obj-$(CONFIG_SYS_I2C_SH) += sh_i2c.o obj-$(CONFIG_SYS_I2C_SOFT) += soft_i2c.o obj-$(CONFIG_SYS_I2C_STM32F7) += stm32f7_i2c.o +obj-$(CONFIG_SUN6I_P2WI) += sun6i_p2wi.o
please sort alphabetical.
Quoted 90 lines
drivers/i2c/Makefile +0
-0obj-$(CONFIG_SYS_I2C_SYNQUACER) += synquacer_i2c.o obj-$(CONFIG_SYS_I2C_TEGRA) += tegra_i2c.o obj-$(CONFIG_SYS_I2C_UNIPHIER) += i2c-uniphier.odrivers/i2c/sun6i_p2wi.c new file +66
-0@@ -0,0 +1,66 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include <axp_pmic.h> +#include <dm.h> +#include <i2c.h> +#include <asm/arch/p2wi.h> + +#if CONFIG_IS_ENABLED (DM_I2C ) + +static int sun6i_p2wi_xfer (struct udevice *bus,struct i2c_msg *msg,int nmsgs) +{ +/* The hardware only supports SMBus-style transfers. */ +if (nmsgs ==2 && msg[1 ].flags ==I2C_M_RD && msg[1 ].len ==1 ) +return p2wi_read (msg[0 ].buf[0 ], msg[1 ].buf); + +if (nmsgs ==1 && msg[0 ].len ==2 ) +return p2wi_write (msg[0 ].buf[0 ], msg[0 ].buf[1 ]); + +return -EINVAL ; +} + +static int sun6i_p2wi_probe_chip (struct udevice *bus,uint chip_addr, +uint chip_flags) +{ +return p2wi_change_to_p2wi_mode (chip_addr, +AXP_PMIC_MODE_REG , +AXP_PMIC_MODE_P2WI ); +} + +static int sun6i_p2wi_probe (struct udevice *bus) +{ +p2wi_init (); + +return 0 ; +} + +static int sun6i_p2wi_child_pre_probe (struct udevice *child) +{ +struct dm_i2c_chip *chip =dev_get_parent_plat (child); + +/* Ensure each transfer is for a single register. */ + chip->flags |=DM_I2C_CHIP_RD_ADDRESS |DM_I2C_CHIP_WR_ADDRESS ; + +return 0 ; +} + +static const struct dm_i2c_ops sun6i_p2wi_ops = { + .xfer = sun6i_p2wi_xfer, + .probe_chip = sun6i_p2wi_probe_chip, +}; + +static const struct udevice_id sun6i_p2wi_ids[] = { + { .compatible ="allwinner,sun6i-a31-p2wi" }, + {/* sentinel */ } +}; + +U_BOOT_DRIVER (sun6i_p2wi) = { + .name ="sun6i_p2wi" , + .id =UCLASS_I2C , + .of_match = sun6i_p2wi_ids, + .probe = sun6i_p2wi_probe, + .child_pre_probe = sun6i_p2wi_child_pre_probe, + .ops = &sun6i_p2wi_ops, +}; + +#endif /* CONFIG_IS_ENABLED(DM_I2C) */ include/axp_pmic.h +2
-0@@ -6,6 +6,8 @@*/ #ifndef _AXP_PMIC_H_ +#include <stdbool.h> +#ifdef CONFIG_AXP152_POWER #include <axp152.h> #endif
include/axp_pmic.h line 36
Quoted 10 lines
include/axp_pmic.h +4
-0@@ -25,6 +27,10 @@#include <axp818.h> #endif +#define AXP_PMIC_MODE_REG 0x3e +#define AXP_PMIC_MODE_I2C 0x00 +#define AXP_PMIC_MODE_P2WI 0x3e +int axp_set_dcdc1 (unsigned int mvolt);int axp_set_dcdc2 (unsigned int mvolt);int axp_set_dcdc3 (unsigned int mvolt);
Beside of the nitpicks:
Thanks!
bye,
Heiko
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: [email protected]
Samuel Holland
maintainerRe: [PATCH 01/11] i2c: Add a DM_I2C wrapper for the sun6i_p2wi controller
Hi Heiko,
Quoted 18 lines · Heiko Schocher
Hello Samuel,
Quoted 15 lines · Samuel Holland
This bus controller is used to communicate with an X-Powers AXP PMIC. Currently, various drivers access PMIC registers through a platform- specific non-DM "
pmic_bus" interface, which depends on the legacy I2C framework. In order to convert those drivers to useDM_PMIC, this bus needs aDM_I2Cdriver.Since the non-DM bus controller driver is still needed in SPL, the quick solution is to implement the
DM_I2Cops using the existing functions.The register for switching between I2C/P2WI/RSB mode is the same across all PMIC variants, so move that to the common header.
Signed-off-by Samuel Holland <[email protected]>---
Quoted 8 lines
Quoted 5 lines
arch/arm/mach-sunxi/Kconfig | 11 ------ arch/arm/mach-sunxi/pmic_bus.c | 7 ++-- drivers/i2c/Kconfig | 8 +++++ drivers/i2c/Makefile | 1 + drivers/i2c/sun6i_p2wi.c | 66 ++++++++++++++++++++++++++++++++++I wonder, as this config symbol gets also removed, that there is no remove of driver code?
I did not remove any config symbol, only moved it to a different file. It sounds like you want me to use a new symbol for the DM_I2C driver (SYS_I2C_SUN6I_P2WI). So in that case, I would leave the old symbol alone, and have SYS_I2C_SUN6I_P2WI select it.
Quoted 83 lines
Quoted 63 lines
include/axp_pmic.h | 6 ++++ 6 files changed, 84 insertions(+), 15 deletions(-) create mode 100644 drivers/i2c/sun6i_p2wi.carch/arm/mach-sunxi/Kconfig +0
-11@@ -88,17 +88,6 @@ config DRAM_SUN50I_H616_UNKNOWN_FEATURE feature. endif -config SUN6I_P2WI - bool "Allwinner sun6i internal P2WI controller" - help - If you say yes to this option, support will be included for the - P2WI (Push/Pull 2 Wire Interface) controller embedded in some sunxi - SOCs. - The P2WI looks like an SMBus controller (which supports only byte - accesses), except that it only supports one slave device. - This interface is used to connect to specific PMIC devices (like the - AXP221). - config SUN6I_PRCM bool helparch/arm/mach-sunxi/pmic_bus.c +3
-4@@ -8,6 +8,7 @@* axp223 uses the rsb bus, these functions abstract this. */ +#include <axp_pmic.h> #include <common.h> #include <asm/arch/p2wi.h> #include <asm/arch/rsb.h> @@ -21,8 +22,6 @@#define AXP305_I2C_ADDR 0x36#define AXP221_CHIP_ADDR 0x68 -#define AXP221_CTRL_ADDR 0x3e -#define AXP221_INIT_DATA 0x3e/* AXP818 device and runtime addresses are same as AXP223 */ #define AXP223_DEVICE_ADDR 0x3a3@@ -40,8 +39,8 @@ int pmic_bus_init(void)#if definedCONFIG_AXP221_POWER || definedCONFIG_AXP809_POWER || definedCONFIG_AXP818_POWER # ifdef CONFIG_MACH_SUN6I p2wi_init (); - ret =p2wi_change_to_p2wi_mode (AXP221_CHIP_ADDR ,AXP221_CTRL_ADDR , -AXP221_INIT_DATA ); + ret =p2wi_change_to_p2wi_mode (AXP221_CHIP_ADDR ,AXP_PMIC_MODE_REG , +AXP_PMIC_MODE_P2WI );# elif definedCONFIG_MACH_SUN8I_R40 /* Nothing. R40 uses the AXP221s in I2C mode */ ret =0 ;drivers/i2c/Kconfig +0
-0drivers/i2c/Kconfig config SYS_I2C_STM32F7 · line 580
Quoted 4 lines
drivers/i2c/Kconfig +1
-0@@ -577,6 +577,14 @@ config SYS_I2C_STM32F7 _ Optional clock stretching _ Software reset +config SUN6I_P2WICould you please use "
SYS_I2C_" ?Quoted 13 lines
drivers/i2c/Kconfig +7
-0+ bool "Allwinner sun6i P2WI controller" + depends on ARCH_SUNXI + help + Support for the P2WI (Push/Pull 2 Wire Interface) controller embedded + in the Allwinner A31 and A31s SOCs. This interface is used to connect + to specific devices like the X-Powers AXP221 PMIC. + config SYNQUACER bool "Socionext SynQuacer I2C controller" depends on ARCH_SYNQUACER && DM_I2Cdrivers/i2c/Makefile +0
-1--- a/drivers/i2c/Makefile
Quoted 8 lines
drivers/i2c/Makefile obj-$(CONFIG_SYS_I2C_SANDBOX) += sandbox_i2c.o i2c-emul-uclass.o · line 46
Quoted 6 lines
+++ b/drivers/i2c/Makefile
drivers/i2c/Makefile +1
-0@@ -43,6 +43,7 @@ obj-$(CONFIG_SYS_I2C_SANDBOX) += sandbox_i2c.o i2c-emul-uclass.o obj-$(CONFIG_SYS_I2C_SH) += sh_i2c.o obj-$(CONFIG_SYS_I2C_SOFT) += soft_i2c.o obj-$(CONFIG_SYS_I2C_STM32F7) += stm32f7_i2c.o +obj-$(CONFIG_SUN6I_P2WI) += sun6i_p2wi.oplease sort alphabetical.
I was sorting by file name -- this will be fixed by renaming the config symbol.
Regards,
Samuel
Quoted 109 lines
Quoted 90 lines
drivers/i2c/Makefile +0
-0obj-$(CONFIG_SYS_I2C_SYNQUACER) += synquacer_i2c.o obj-$(CONFIG_SYS_I2C_TEGRA) += tegra_i2c.o obj-$(CONFIG_SYS_I2C_UNIPHIER) += i2c-uniphier.odrivers/i2c/sun6i_p2wi.c new file +66
-0@@ -0,0 +1,66 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include <axp_pmic.h> +#include <dm.h> +#include <i2c.h> +#include <asm/arch/p2wi.h> + +#if CONFIG_IS_ENABLED (DM_I2C ) + +static int sun6i_p2wi_xfer (struct udevice *bus,struct i2c_msg *msg,int nmsgs) +{ +/* The hardware only supports SMBus-style transfers. */ +if (nmsgs ==2 && msg[1 ].flags ==I2C_M_RD && msg[1 ].len ==1 ) +return p2wi_read (msg[0 ].buf[0 ], msg[1 ].buf); + +if (nmsgs ==1 && msg[0 ].len ==2 ) +return p2wi_write (msg[0 ].buf[0 ], msg[0 ].buf[1 ]); + +return -EINVAL ; +} + +static int sun6i_p2wi_probe_chip (struct udevice *bus,uint chip_addr, +uint chip_flags) +{ +return p2wi_change_to_p2wi_mode (chip_addr, +AXP_PMIC_MODE_REG , +AXP_PMIC_MODE_P2WI ); +} + +static int sun6i_p2wi_probe (struct udevice *bus) +{ +p2wi_init (); + +return 0 ; +} + +static int sun6i_p2wi_child_pre_probe (struct udevice *child) +{ +struct dm_i2c_chip *chip =dev_get_parent_plat (child); + +/* Ensure each transfer is for a single register. */ + chip->flags |=DM_I2C_CHIP_RD_ADDRESS |DM_I2C_CHIP_WR_ADDRESS ; + +return 0 ; +} + +static const struct dm_i2c_ops sun6i_p2wi_ops = { + .xfer = sun6i_p2wi_xfer, + .probe_chip = sun6i_p2wi_probe_chip, +}; + +static const struct udevice_id sun6i_p2wi_ids[] = { + { .compatible ="allwinner,sun6i-a31-p2wi" }, + {/* sentinel */ } +}; + +U_BOOT_DRIVER (sun6i_p2wi) = { + .name ="sun6i_p2wi" , + .id =UCLASS_I2C , + .of_match = sun6i_p2wi_ids, + .probe = sun6i_p2wi_probe, + .child_pre_probe = sun6i_p2wi_child_pre_probe, + .ops = &sun6i_p2wi_ops, +}; + +#endif /* CONFIG_IS_ENABLED(DM_I2C) */ include/axp_pmic.h +2
-0@@ -6,6 +6,8 @@*/ #ifndef _AXP_PMIC_H_ +#include <stdbool.h> +#ifdef CONFIG_AXP152_POWER #include <axp152.h> #endif include/axp_pmic.h line 36
Quoted 10 lines
include/axp_pmic.h +4
-0@@ -25,6 +27,10 @@#include <axp818.h> #endif +#define AXP_PMIC_MODE_REG 0x3e +#define AXP_PMIC_MODE_I2C 0x00 +#define AXP_PMIC_MODE_P2WI 0x3e +int axp_set_dcdc1 (unsigned int mvolt);int axp_set_dcdc2 (unsigned int mvolt);int axp_set_dcdc3 (unsigned int mvolt);Beside of the nitpicks:
Reviewed-by Heiko Schocher <[email protected]>Thanks!
bye,
Heiko
Re: [PATCH 01/11] i2c: Add a DM_I2C wrapper for the sun6i_p2wi controller
Hello Samuel,
Quoted 27 lines · Samuel Holland
Hi Heiko,
Quoted 24 lines · Heiko Schocher
Hello Samuel,
Quoted 20 lines · Samuel Holland
This bus controller is used to communicate with an X-Powers AXP PMIC. Currently, various drivers access PMIC registers through a platform- specific non-DM "
pmic_bus" interface, which depends on the legacy I2C framework. In order to convert those drivers to useDM_PMIC, this bus needs aDM_I2Cdriver.Since the non-DM bus controller driver is still needed in SPL, the quick solution is to implement the
DM_I2Cops using the existing functions.The register for switching between I2C/P2WI/RSB mode is the same across all PMIC variants, so move that to the common header.
Signed-off-by Samuel Holland <[email protected]>---
arch/arm/mach-sunxi/Kconfig | 11 ------ arch/arm/mach-sunxi/pmic_bus.c | 7 ++-- drivers/i2c/Kconfig | 8 +++++ drivers/i2c/Makefile | 1 + drivers/i2c/sun6i_p2wi.c | 66 ++++++++++++++++++++++++++++++++++
Quoted 4 lines
Quoted 2 lines
I wonder, as this config symbol gets also removed, that there is no remove of driver code?
I did not remove any config symbol, only moved it to a different file.
Yes, and you add "drivers/i2c/sun6i_p2wi.c", and nowhere code is removed, which is enabled by this config symbol... was the config symbol not used before?
Ah, I see, you use code from arch/arm/mach-sunxi/p2wi.c...
Shouldn;t this be moved than to drivers/i2c too? Only i2c driver use this functions ... or?
(Hope it is not to dummy question...)
Quoted 3 lines
It sounds like you want me to use a new symbol for the
DM_I2Cdriver (SYS_I2C_SUN6I_P2WI). So in that case, I would leave the old symbol alone, and haveSYS_I2C_SUN6I_P2WIselect it.
Hmm.. better to move the whole code to dirvers/i2c ?
Quoted 93 lines
Quoted 84 lines
Quoted 64 lines
include/axp_pmic.h | 6 ++++ 6 files changed, 84 insertions(+), 15 deletions(-) create mode 100644 drivers/i2c/sun6i_p2wi.carch/arm/mach-sunxi/Kconfig +0
-11@@ -88,17 +88,6 @@ config DRAM_SUN50I_H616_UNKNOWN_FEATURE feature. endif -config SUN6I_P2WI - bool "Allwinner sun6i internal P2WI controller" - help - If you say yes to this option, support will be included for the - P2WI (Push/Pull 2 Wire Interface) controller embedded in some sunxi - SOCs. - The P2WI looks like an SMBus controller (which supports only byte - accesses), except that it only supports one slave device. - This interface is used to connect to specific PMIC devices (like the - AXP221). - config SUN6I_PRCM bool helparch/arm/mach-sunxi/pmic_bus.c +3
-4@@ -8,6 +8,7 @@* axp223 uses the rsb bus, these functions abstract this. */ +#include <axp_pmic.h> #include <common.h> #include <asm/arch/p2wi.h> #include <asm/arch/rsb.h> @@ -21,8 +22,6 @@#define AXP305_I2C_ADDR 0x36#define AXP221_CHIP_ADDR 0x68 -#define AXP221_CTRL_ADDR 0x3e -#define AXP221_INIT_DATA 0x3e/* AXP818 device and runtime addresses are same as AXP223 */ #define AXP223_DEVICE_ADDR 0x3a3@@ -40,8 +39,8 @@ int pmic_bus_init(void)#if definedCONFIG_AXP221_POWER || definedCONFIG_AXP809_POWER || definedCONFIG_AXP818_POWER # ifdef CONFIG_MACH_SUN6I p2wi_init (); - ret =p2wi_change_to_p2wi_mode (AXP221_CHIP_ADDR ,AXP221_CTRL_ADDR , -AXP221_INIT_DATA ); + ret =p2wi_change_to_p2wi_mode (AXP221_CHIP_ADDR ,AXP_PMIC_MODE_REG , +AXP_PMIC_MODE_P2WI );# elif definedCONFIG_MACH_SUN8I_R40 /* Nothing. R40 uses the AXP221s in I2C mode */ ret =0 ;drivers/i2c/Kconfig +0
-0drivers/i2c/Kconfig config SYS_I2C_STM32F7 · line 580
Quoted 4 lines
drivers/i2c/Kconfig +1
-0@@ -577,6 +577,14 @@ config SYS_I2C_STM32F7 _ Optional clock stretching _ Software reset +config SUN6I_P2WICould you please use "
SYS_I2C_" ?Quoted 13 lines
drivers/i2c/Kconfig +7
-0+ bool "Allwinner sun6i P2WI controller" + depends on ARCH_SUNXI + help + Support for the P2WI (Push/Pull 2 Wire Interface) controller embedded + in the Allwinner A31 and A31s SOCs. This interface is used to connect + to specific devices like the X-Powers AXP221 PMIC. + config SYNQUACER bool "Socionext SynQuacer I2C controller" depends on ARCH_SYNQUACER && DM_I2Cdrivers/i2c/Makefile +0
-1--- a/drivers/i2c/MakefileQuoted 8 lines
drivers/i2c/Makefile obj-$(CONFIG_SYS_I2C_SANDBOX) += sandbox_i2c.o i2c-emul-uclass.o · line 46
Quoted 6 lines
+++ b/drivers/i2c/Makefile
drivers/i2c/Makefile +1
-0@@ -43,6 +43,7 @@ obj-$(CONFIG_SYS_I2C_SANDBOX) += sandbox_i2c.o i2c-emul-uclass.o obj-$(CONFIG_SYS_I2C_SH) += sh_i2c.o obj-$(CONFIG_SYS_I2C_SOFT) += soft_i2c.o obj-$(CONFIG_SYS_I2C_STM32F7) += stm32f7_i2c.o +obj-$(CONFIG_SUN6I_P2WI) += sun6i_p2wi.oplease sort alphabetical.
Quoted 2 lines
I was sorting by file name -- this will be fixed by renaming the config symbol.
we sort by config symbol.
bye,
Heiko
Quoted 113 lines
Regards,
SamuelQuoted 109 lines
Quoted 90 lines
drivers/i2c/Makefile +0
-0obj-$(CONFIG_SYS_I2C_SYNQUACER) += synquacer_i2c.o obj-$(CONFIG_SYS_I2C_TEGRA) += tegra_i2c.o obj-$(CONFIG_SYS_I2C_UNIPHIER) += i2c-uniphier.odrivers/i2c/sun6i_p2wi.c new file +66
-0@@ -0,0 +1,66 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include <axp_pmic.h> +#include <dm.h> +#include <i2c.h> +#include <asm/arch/p2wi.h> + +#if CONFIG_IS_ENABLED (DM_I2C ) + +static int sun6i_p2wi_xfer (struct udevice *bus,struct i2c_msg *msg,int nmsgs) +{ +/* The hardware only supports SMBus-style transfers. */ +if (nmsgs ==2 && msg[1 ].flags ==I2C_M_RD && msg[1 ].len ==1 ) +return p2wi_read (msg[0 ].buf[0 ], msg[1 ].buf); + +if (nmsgs ==1 && msg[0 ].len ==2 ) +return p2wi_write (msg[0 ].buf[0 ], msg[0 ].buf[1 ]); + +return -EINVAL ; +} + +static int sun6i_p2wi_probe_chip (struct udevice *bus,uint chip_addr, +uint chip_flags) +{ +return p2wi_change_to_p2wi_mode (chip_addr, +AXP_PMIC_MODE_REG , +AXP_PMIC_MODE_P2WI ); +} + +static int sun6i_p2wi_probe (struct udevice *bus) +{ +p2wi_init (); + +return 0 ; +} + +static int sun6i_p2wi_child_pre_probe (struct udevice *child) +{ +struct dm_i2c_chip *chip =dev_get_parent_plat (child); + +/* Ensure each transfer is for a single register. */ + chip->flags |=DM_I2C_CHIP_RD_ADDRESS |DM_I2C_CHIP_WR_ADDRESS ; + +return 0 ; +} + +static const struct dm_i2c_ops sun6i_p2wi_ops = { + .xfer = sun6i_p2wi_xfer, + .probe_chip = sun6i_p2wi_probe_chip, +}; + +static const struct udevice_id sun6i_p2wi_ids[] = { + { .compatible ="allwinner,sun6i-a31-p2wi" }, + {/* sentinel */ } +}; + +U_BOOT_DRIVER (sun6i_p2wi) = { + .name ="sun6i_p2wi" , + .id =UCLASS_I2C , + .of_match = sun6i_p2wi_ids, + .probe = sun6i_p2wi_probe, + .child_pre_probe = sun6i_p2wi_child_pre_probe, + .ops = &sun6i_p2wi_ops, +}; + +#endif /* CONFIG_IS_ENABLED(DM_I2C) */ include/axp_pmic.h +2
-0@@ -6,6 +6,8 @@*/ #ifndef _AXP_PMIC_H_ +#include <stdbool.h> +#ifdef CONFIG_AXP152_POWER #include <axp152.h> #endif include/axp_pmic.h line 36
Quoted 10 lines
include/axp_pmic.h +4
-0@@ -25,6 +27,10 @@#include <axp818.h> #endif +#define AXP_PMIC_MODE_REG 0x3e +#define AXP_PMIC_MODE_I2C 0x00 +#define AXP_PMIC_MODE_P2WI 0x3e +int axp_set_dcdc1 (unsigned int mvolt);int axp_set_dcdc2 (unsigned int mvolt);int axp_set_dcdc3 (unsigned int mvolt);Beside of the nitpicks:
Reviewed-by Heiko Schocher <[email protected]>Thanks!
bye,
Heiko
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: [email protected]
Samuel Holland
maintainerPATCH 2/11 i2c: Add a DM_I2C wrapper for the sun8i_rsb controller
In reply to Samuel HollandThis bus controller is used to communicate with an X-Powers AXP PMIC. Currently, various drivers access PMIC registers through a platform- specific non-DM "pmic_bus" interface, which depends on the legacy I2C framework. In order to convert those drivers to use DM_PMIC, this bus needs a DM_I2C driver.
Since the non-DM bus controller driver is still needed in SPL, the quick solution is to implement the DM_I2C ops using the existing functions.
The register for switching between I2C/P2WI/RSB mode is the same across all PMIC variants, so move that to the common header.
There are only a couple of pairs of hardware/runtime addresses used across all PMIC variants. So far the code expected only the "primary" pair, but some PMICs like the AXP305 and AXP805 use the secondary pair, so add support for that to the DM driver as well.
---
arch/arm/mach-sunxi/Kconfig | 8 ---- arch/arm/mach-sunxi/pmic_bus.c | 11 ++--- drivers/i2c/Kconfig | 8 ++++ drivers/i2c/Makefile | 1 + drivers/i2c/sun8i_rsb.c | 86 ++++++++++++++++++++++++++++++++++ include/axp_pmic.h | 6 +++ 6 files changed, 105 insertions(+), 15 deletions(-) create mode 100644 drivers/i2c/sun8i_rsb.c
arch/arm/mach-sunxi/Kconfig +0 -8
@@ -100,14 +100,6 @@ config AXP_PMIC_BUS Select this PMIC bus access helpers for Sunxi platform PRCM or other AXP family PMIC devices. -config SUN8I_RSB - bool "Allwinner sunXi Reduced Serial Bus Driver" - help - Say y here to enable support for Allwinner's Reduced Serial Bus - (RSB) support. This controller is responsible for communicating - with various RSB based devices, such as AXP223, AXP8XX PMICs, - and AC100/AC200 ICs. - config SUNXI_SRAM_ADDRESS hex default 0x10000 if MACH_SUN9I || MACH_SUN50I || MACH_SUN50I_H5
arch/arm/mach-sunxi/pmic_bus.c +4 -7
@@ -23,10 +23,6 @@#define AXP221_CHIP_ADDR 0x68 -/* AXP818 device and runtime addresses are same as AXP223 */ -#define AXP223_DEVICE_ADDR 0x3a3 -#define AXP223_RUNTIME_ADDR 0x2d -int pmic_bus_init (void ) {/* This cannot be 0 because it is used in SPL before BSS is ready */
@@ -49,7 +45,8 @@ int pmic_bus_init(void)if (ret)return ret; - ret =rsb_set_device_address (AXP223_DEVICE_ADDR ,AXP223_RUNTIME_ADDR ); + ret =rsb_set_device_address (AXP_PMIC_PRI_DEVICE_ADDR , +AXP_PMIC_PRI_RUNTIME_ADDR );# endif if (ret)return ret;
@@ -73,7 +70,7 @@ int pmic_bus_read(u8 reg, u8 *data)# elif definedCONFIG_MACH_SUN8I_R40 return i2c_read (AXP209_I2C_ADDR , reg,1 , data,1 );# else -return rsb_read (AXP223_RUNTIME_ADDR , reg, data); +return rsb_read (AXP_PMIC_PRI_RUNTIME_ADDR , reg, data);# endif #endif }
@@ -92,7 +89,7 @@ int pmic_bus_write(u8 reg, u8 data)# elif definedCONFIG_MACH_SUN8I_R40 return i2c_write (AXP209_I2C_ADDR , reg,1 , &data,1 );# else -return rsb_write (AXP223_RUNTIME_ADDR , reg, data); +return rsb_write (AXP_PMIC_PRI_RUNTIME_ADDR , reg, data);# endif #endif }
drivers/i2c/Kconfig +8 -0
@@ -585,6 +585,14 @@ config SUN6I_P2WI in the Allwinner A31 and A31s SOCs. This interface is used to connect to specific devices like the X-Powers AXP221 PMIC. +config SUN8I_RSB + bool "Allwinner sun8i Reduced Serial Bus controller" + depends on ARCH_SUNXI + help + Support for Allwinner's Reduced Serial Bus (RSB) controller. This + controller is responsible for communicating with various RSB based + devices, such as X-Powers AXPxxx PMICs and AC100/AC200 CODEC ICs. + config SYS_I2C_SYNQUACER bool "Socionext SynQuacer I2C controller" depends on ARCH_SYNQUACER && DM_I2C
drivers/i2c/Makefile +1 -0
@@ -44,6 +44,7 @@ obj-$(CONFIG_SYS_I2C_SH) += sh_i2c.o obj-$(CONFIG_SYS_I2C_SOFT) += soft_i2c.o obj-$(CONFIG_SYS_I2C_STM32F7) += stm32f7_i2c.o obj-$(CONFIG_SUN6I_P2WI) += sun6i_p2wi.o +obj-$(CONFIG_SUN8I_RSB) += sun8i_rsb.o obj-$(CONFIG_SYS_I2C_SYNQUACER) += synquacer_i2c.o obj-$(CONFIG_SYS_I2C_TEGRA) += tegra_i2c.o obj-$(CONFIG_SYS_I2C_UNIPHIER) += i2c-uniphier.o
drivers/i2c/sun8i_rsb.c new file +86 -0
86 lines not on this page · raw message
include/axp_pmic.h +6 -0
@@ -30,6 +30,12 @@#define AXP_PMIC_MODE_REG 0x3e#define AXP_PMIC_MODE_I2C 0x00#define AXP_PMIC_MODE_P2WI 0x3e +#define AXP_PMIC_MODE_RSB 0x7c + +#define AXP_PMIC_PRI_DEVICE_ADDR 0x3a3 +#define AXP_PMIC_PRI_RUNTIME_ADDR 0x2d +#define AXP_PMIC_SEC_DEVICE_ADDR 0x745 +#define AXP_PMIC_SEC_RUNTIME_ADDR 0x3aint axp_set_dcdc1 (unsigned int mvolt);int axp_set_dcdc2 (unsigned int mvolt);
Signature · 1 line
2.31.1
Re: [PATCH 02/11] i2c: Add a DM_I2C wrapper for the sun8i_rsb controller
Hello Samuel,
Quoted 20 lines · Samuel Holland
This bus controller is used to communicate with an X-Powers AXP PMIC. Currently, various drivers access PMIC registers through a platform- specific non-DM "
pmic_bus" interface, which depends on the legacy I2C framework. In order to convert those drivers to useDM_PMIC, this bus needs aDM_I2Cdriver.Since the non-DM bus controller driver is still needed in SPL, the quick solution is to implement the
DM_I2Cops using the existing functions.The register for switching between I2C/P2WI/RSB mode is the same across all PMIC variants, so move that to the common header.
There are only a couple of pairs of hardware/runtime addresses used across all PMIC variants. So far the code expected only the "primary" pair, but some PMICs like the AXP305 and AXP805 use the secondary pair, so add support for that to the DM driver as well.
Signed-off-by Samuel Holland <[email protected]>---
Quoted 8 lines
arch/arm/mach-sunxi/Kconfig | 8 ---- arch/arm/mach-sunxi/pmic_bus.c | 11 ++--- drivers/i2c/Kconfig | 8 ++++ drivers/i2c/Makefile | 1 + drivers/i2c/sun8i_rsb.c | 86 ++++++++++++++++++++++++++++++++++ include/axp_pmic.h | 6 +++ 6 files changed, 105 insertions(+), 15 deletions(-) create mode 100644 drivers/i2c/sun8i_rsb.c
Same comments as for path 1 of this series, beside of this:
bye,
Heiko
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: [email protected]
Samuel Holland
maintainerPATCH 3/11 power: pmic: Consistently depend on DM_PMIC
In reply to Samuel HollandKconfig symbols for two PMIC drivers (PMIC_AS3722 and DM_PMIC_MC34708) were missing a dependency on DM_PMIC. To fix this inconsistency, and to keep it from happening again, wrap the driver section with "if DM_PMIC" instead of using a "depends on DM_PMIC" clause for each driver.
---
drivers/power/pmic/Kconfig | 43 +++++++------------------------------- 1 file changed, 8 insertions(+), 35 deletions(-)
drivers/power/pmic/Kconfig +8 -35
@@ -10,9 +10,10 @@ config DM_PMIC - 'drivers/power/pmic/pmic-uclass.c' - 'include/power/pmic.h' +if DM_PMIC + config PMIC_CHILDREN bool "Allow child devices for PMICs" - depends on DM_PMIC default y ---help--- This allows PMICs to support child devices (such as regulators) in
@@ -22,7 +23,6 @@ config PMIC_CHILDREN config SPL_PMIC_CHILDREN bool "Allow child devices for PMICs in SPL" - depends on DM_PMIC default y ---help--- This allows PMICs to support child devices (such as regulators) in
@@ -33,7 +33,6 @@ config SPL_PMIC_CHILDREN config PMIC_AB8500 bool "Enable driver for ST-Ericsson AB8500 PMIC via PRCMU" - depends on DM_PMIC select REGMAP select SYSCON help
@@ -43,7 +42,7 @@ config PMIC_AB8500 config PMIC_ACT8846 bool "Enable support for the active-semi 8846 PMIC" - depends on DM_PMIC && DM_I2C + depends on DM_I2C ---help--- This PMIC includes 4 DC/DC step-down buck regulators and 8 low-dropout regulators (LDOs). It also provides some GPIO, reset and battery
@@ -52,14 +51,13 @@ config PMIC_ACT8846 config DM_PMIC_DA9063 bool "Enable Driver Model for the Dialog DA9063 PMIC" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC DA9063. The driver implements read/write operations. config SPL_DM_PMIC_DA9063 bool "Enable Driver Model for the Dialog DA9063 PMIC in SPL" - depends on DM_PMIC && SPL + depends on SPL help This config enables implementation of driver-model pmic uclass features for PMIC DA9063. The driver implements read/write operations.
@@ -74,14 +72,12 @@ config PMIC_AS3722 config DM_PMIC_BD71837 bool "Enable Driver Model for PMIC BD71837" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC BD71837. The driver implements read/write operations. config SPL_DM_PMIC_BD71837 bool "Enable Driver Model for PMIC BD71837 in SPL stage" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC BD71837. The driver implements read/write
@@ -89,7 +85,7 @@ config SPL_DM_PMIC_BD71837 config DM_PMIC_FAN53555 bool "Enable support for OnSemi FAN53555" - depends on DM_PMIC && DM_REGULATOR && DM_I2C + depends on DM_REGULATOR && DM_I2C select DM_REGULATOR_FAN53555 help This config enables implementation of driver-model PMIC
@@ -103,14 +99,12 @@ config DM_PMIC_FAN53555 config DM_PMIC_MP5416 bool "Enable Driver Model for PMIC MP5416" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC MP5416. The driver implements read/write operations. config SPL_DM_PMIC_MP5416 bool "Enable Driver Model for PMIC MP5416 in SPL stage" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC MP5416. The driver implements read/write
@@ -118,56 +112,48 @@ config SPL_DM_PMIC_MP5416 config DM_PMIC_PCA9450 bool "Enable Driver Model for PMIC PCA9450" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC PCA9450. The driver implements read/write operations. config SPL_DM_PMIC_PCA9450 bool "Enable Driver Model for PMIC PCA9450" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC PCA9450 in SPL. The driver implements read/write operations. config DM_PMIC_PFUZE100 bool "Enable Driver Model for PMIC PFUZE100" - depends on DM_PMIC ---help--- This config enables implementation of driver-model pmic uclass features for PMIC PFUZE100. The driver implements read/write operations. config SPL_DM_PMIC_PFUZE100 bool "Enable Driver Model for PMIC PFUZE100 in SPL" - depends on DM_PMIC ---help--- This config enables implementation of driver-model pmic uclass features for PMIC PFUZE100 in SPL. The driver implements read/write operations. config DM_PMIC_MAX77686 bool "Enable Driver Model for PMIC MAX77686" - depends on DM_PMIC ---help--- This config enables implementation of driver-model pmic uclass features for PMIC MAX77686. The driver implements read/write operations. config DM_PMIC_MAX8998 bool "Enable Driver Model for PMIC MAX8998" - depends on DM_PMIC ---help--- This config enables implementation of driver-model pmic uclass features for PMIC MAX8998. The driver implements read/write operations. config DM_PMIC_MC34708 bool "Enable Driver Model for PMIC MC34708" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC MC34708. The driver implements read/write operations. config PMIC_MAX8997 bool "Enable Driver Model for PMIC MAX8997" - depends on DM_PMIC ---help--- This config enables implementation of driver-model pmic uclass features for PMIC MAX8997. The driver implements read/write operations.
@@ -182,7 +168,6 @@ config PMIC_MAX8997 config PMIC_PM8916 bool "Enable Driver Model for Qualcomm PM8916 PMIC" - depends on DM_PMIC ---help--- The PM8916 is a PMIC connected to one (or several) processors with SPMI bus. It has 2 slaves with several peripherals:
@@ -198,7 +183,6 @@ config PMIC_PM8916 config PMIC_RK8XX bool "Enable support for Rockchip PMIC RK8XX" - depends on DM_PMIC ---help--- The Rockchip RK808 PMIC provides four buck DC-DC convertors, 8 LDOs, an RTC and two low Rds (resistance (drain to source)) switches. It is
@@ -207,7 +191,6 @@ config PMIC_RK8XX config PMIC_S2MPS11 bool "Enable Driver Model for PMIC Samsung S2MPS11" - depends on DM_PMIC ---help--- The Samsung S2MPS11 PMIC provides: - 38 adjustable LDO regulators
@@ -221,7 +204,6 @@ config PMIC_S2MPS11 config DM_PMIC_SANDBOX bool "Enable Driver Model for emulated Sandbox PMIC" - depends on DM_PMIC ---help--- Enable the driver for Sandbox PMIC emulation. The emulated PMIC device depends on two drivers:
@@ -246,7 +228,6 @@ config DM_PMIC_SANDBOX config PMIC_S5M8767 bool "Enable Driver Model for the Samsung S5M8767 PMIC" - depends on DM_PMIC ---help--- The S5M8767 PMIC provides a large array of LDOs and BUCKs for use as a SoC power controller. It also provides 32KHz clock outputs. This
@@ -255,7 +236,6 @@ config PMIC_S5M8767 config PMIC_RN5T567 bool "Enable driver for Ricoh RN5T567 PMIC" - depends on DM_PMIC ---help--- The RN5T567 is a PMIC with 4 step-down DC/DC converters, 5 LDO regulators Real-Time Clock and 4 GPIOs. This driver provides
@@ -263,7 +243,6 @@ config PMIC_RN5T567 config PMIC_TPS65090 bool "Enable driver for Texas Instruments TPS65090 PMIC" - depends on DM_PMIC ---help--- The TPS65090 is a PMIC containing several LDOs, DC to DC convertors, FETs and a battery charger. This driver provides register access
@@ -272,21 +251,18 @@ config PMIC_TPS65090 config PMIC_PALMAS bool "Enable driver for Texas Instruments PALMAS PMIC" - depends on DM_PMIC ---help--- The PALMAS is a PMIC containing several LDOs, SMPS. This driver binds the pmic children. config PMIC_LP873X bool "Enable driver for Texas Instruments LP873X PMIC" - depends on DM_PMIC ---help--- The LP873X is a PMIC containing couple of LDOs and couple of SMPS. This driver binds the pmic children. config PMIC_LP87565 bool "Enable driver for Texas Instruments LP87565 PMIC" - depends on DM_PMIC ---help--- The LP87565 is a PMIC containing a bunch of SMPS. This driver binds the pmic children.
@@ -300,7 +276,6 @@ config POWER_MC34VR500 config DM_PMIC_TPS65910 bool "Enable driver for Texas Instruments TPS65910 PMIC" - depends on DM_PMIC ---help--- The TPS65910 is a PMIC containing 3 buck DC-DC converters, one boost DC-DC converter, 8 LDOs and a RTC. This driver binds the SMPS and LDO
@@ -308,7 +283,7 @@ config DM_PMIC_TPS65910 config PMIC_STPMIC1 bool "Enable support for STMicroelectronics STPMIC1 PMIC" - depends on DM_PMIC && DM_I2C + depends on DM_I2C select SYSRESET_CMD_POWEROFF if CMD_POWEROFF && !ARM_PSCI_FW ---help--- The STPMIC1 PMIC provides 4 BUCKs, 6 LDOs, 1 VREF and 2 power switches.
@@ -317,28 +292,26 @@ config PMIC_STPMIC1 config SPL_PMIC_PALMAS bool "Enable driver for Texas Instruments PALMAS PMIC" - depends on DM_PMIC help The PALMAS is a PMIC containing several LDOs, SMPS. This driver binds the pmic children in SPL. config SPL_PMIC_LP873X bool "Enable driver for Texas Instruments LP873X PMIC" - depends on DM_PMIC help The LP873X is a PMIC containing couple of LDOs and couple of SMPS. This driver binds the pmic children in SPL. config SPL_PMIC_LP87565 bool "Enable driver for Texas Instruments LP87565 PMIC" - depends on DM_PMIC help The LP87565 is a PMIC containing a bunch of SMPS. This driver binds the pmic children in SPL. config PMIC_TPS65941 bool "Enable driver for Texas Instruments TPS65941 PMIC" - depends on DM_PMIC help The TPS65941 is a PMIC containing a bunch of SMPS & LDOs. This driver binds the pmic children. + +endif
Signature · 1 line
2.31.1
Re: [PATCH 03/11] power: pmic: Consistently depend on DM_PMIC
Quoted 6 lines · Samuel Holland
Kconfigsymbols for two PMIC drivers (PMIC_AS3722andDM_PMIC_MC34708) were missing a dependency onDM_PMIC. To fix this inconsistency, and to keep it from happening again, wrap the driver section with "ifDM_PMIC" instead of using a "depends onDM_PMIC" clause for each driver.Signed-off-by Samuel Holland <[email protected]>
Best Regards,
Jaehoon Chung
Quoted 285 lines
---
drivers/power/pmic/Kconfig | 43 +++++++------------------------------- 1 file changed, 8 insertions(+), 35 deletions(-)drivers/power/pmic/Kconfig +8
-35@@ -10,9 +10,10 @@ config DM_PMIC - 'drivers/power/pmic/pmic-uclass.c' - 'include/power/pmic.h' +if DM_PMIC + config PMIC_CHILDREN bool "Allow child devices for PMICs" - depends on DM_PMIC default y ---help--- This allows PMICs to support child devices (such as regulators) in@@ -22,7 +23,6 @@ config PMIC_CHILDREN config SPL_PMIC_CHILDREN bool "Allow child devices for PMICs in SPL" - depends on DM_PMIC default y ---help--- This allows PMICs to support child devices (such as regulators) in@@ -33,7 +33,6 @@ config SPL_PMIC_CHILDREN config PMIC_AB8500 bool "Enable driver for ST-Ericsson AB8500 PMIC via PRCMU" - depends on DM_PMIC select REGMAP select SYSCON help@@ -43,7 +42,7 @@ config PMIC_AB8500 config PMIC_ACT8846 bool "Enable support for the active-semi 8846 PMIC" - depends on DM_PMIC && DM_I2C + depends on DM_I2C ---help--- This PMIC includes 4 DC/DC step-down buck regulators and 8 low-dropout regulators (LDOs). It also provides some GPIO, reset and battery@@ -52,14 +51,13 @@ config PMIC_ACT8846 config DM_PMIC_DA9063 bool "Enable Driver Model for the Dialog DA9063 PMIC" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC DA9063. The driver implements read/write operations. config SPL_DM_PMIC_DA9063 bool "Enable Driver Model for the Dialog DA9063 PMIC in SPL" - depends on DM_PMIC && SPL + depends on SPL help This config enables implementation of driver-model pmic uclass features for PMIC DA9063. The driver implements read/write operations.@@ -74,14 +72,12 @@ config PMIC_AS3722 config DM_PMIC_BD71837 bool "Enable Driver Model for PMIC BD71837" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC BD71837. The driver implements read/write operations. config SPL_DM_PMIC_BD71837 bool "Enable Driver Model for PMIC BD71837 in SPL stage" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC BD71837. The driver implements read/write@@ -89,7 +85,7 @@ config SPL_DM_PMIC_BD71837 config DM_PMIC_FAN53555 bool "Enable support for OnSemi FAN53555" - depends on DM_PMIC && DM_REGULATOR && DM_I2C + depends on DM_REGULATOR && DM_I2C select DM_REGULATOR_FAN53555 help This config enables implementation of driver-model PMIC@@ -103,14 +99,12 @@ config DM_PMIC_FAN53555 config DM_PMIC_MP5416 bool "Enable Driver Model for PMIC MP5416" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC MP5416. The driver implements read/write operations. config SPL_DM_PMIC_MP5416 bool "Enable Driver Model for PMIC MP5416 in SPL stage" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC MP5416. The driver implements read/write@@ -118,56 +112,48 @@ config SPL_DM_PMIC_MP5416 config DM_PMIC_PCA9450 bool "Enable Driver Model for PMIC PCA9450" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC PCA9450. The driver implements read/write operations. config SPL_DM_PMIC_PCA9450 bool "Enable Driver Model for PMIC PCA9450" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC PCA9450 in SPL. The driver implements read/write operations. config DM_PMIC_PFUZE100 bool "Enable Driver Model for PMIC PFUZE100" - depends on DM_PMIC ---help--- This config enables implementation of driver-model pmic uclass features for PMIC PFUZE100. The driver implements read/write operations. config SPL_DM_PMIC_PFUZE100 bool "Enable Driver Model for PMIC PFUZE100 in SPL" - depends on DM_PMIC ---help--- This config enables implementation of driver-model pmic uclass features for PMIC PFUZE100 in SPL. The driver implements read/write operations. config DM_PMIC_MAX77686 bool "Enable Driver Model for PMIC MAX77686" - depends on DM_PMIC ---help--- This config enables implementation of driver-model pmic uclass features for PMIC MAX77686. The driver implements read/write operations. config DM_PMIC_MAX8998 bool "Enable Driver Model for PMIC MAX8998" - depends on DM_PMIC ---help--- This config enables implementation of driver-model pmic uclass features for PMIC MAX8998. The driver implements read/write operations. config DM_PMIC_MC34708 bool "Enable Driver Model for PMIC MC34708" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC MC34708. The driver implements read/write operations. config PMIC_MAX8997 bool "Enable Driver Model for PMIC MAX8997" - depends on DM_PMIC ---help--- This config enables implementation of driver-model pmic uclass features for PMIC MAX8997. The driver implements read/write operations.@@ -182,7 +168,6 @@ config PMIC_MAX8997 config PMIC_PM8916 bool "Enable Driver Model for Qualcomm PM8916 PMIC" - depends on DM_PMIC ---help--- The PM8916 is a PMIC connected to one (or several) processors with SPMI bus. It has 2 slaves with several peripherals:@@ -198,7 +183,6 @@ config PMIC_PM8916 config PMIC_RK8XX bool "Enable support for Rockchip PMIC RK8XX" - depends on DM_PMIC ---help--- The Rockchip RK808 PMIC provides four buck DC-DC convertors, 8 LDOs, an RTC and two low Rds (resistance (drain to source)) switches. It is@@ -207,7 +191,6 @@ config PMIC_RK8XX config PMIC_S2MPS11 bool "Enable Driver Model for PMIC Samsung S2MPS11" - depends on DM_PMIC ---help--- The Samsung S2MPS11 PMIC provides: - 38 adjustable LDO regulators@@ -221,7 +204,6 @@ config PMIC_S2MPS11 config DM_PMIC_SANDBOX bool "Enable Driver Model for emulated Sandbox PMIC" - depends on DM_PMIC ---help--- Enable the driver for Sandbox PMIC emulation. The emulated PMIC device depends on two drivers:@@ -246,7 +228,6 @@ config DM_PMIC_SANDBOX config PMIC_S5M8767 bool "Enable Driver Model for the Samsung S5M8767 PMIC" - depends on DM_PMIC ---help--- The S5M8767 PMIC provides a large array of LDOs and BUCKs for use as a SoC power controller. It also provides 32KHz clock outputs. This@@ -255,7 +236,6 @@ config PMIC_S5M8767 config PMIC_RN5T567 bool "Enable driver for Ricoh RN5T567 PMIC" - depends on DM_PMIC ---help--- The RN5T567 is a PMIC with 4 step-down DC/DC converters, 5 LDO regulators Real-Time Clock and 4 GPIOs. This driver provides@@ -263,7 +243,6 @@ config PMIC_RN5T567 config PMIC_TPS65090 bool "Enable driver for Texas Instruments TPS65090 PMIC" - depends on DM_PMIC ---help--- The TPS65090 is a PMIC containing several LDOs, DC to DC convertors, FETs and a battery charger. This driver provides register access@@ -272,21 +251,18 @@ config PMIC_TPS65090 config PMIC_PALMAS bool "Enable driver for Texas Instruments PALMAS PMIC" - depends on DM_PMIC ---help--- The PALMAS is a PMIC containing several LDOs, SMPS. This driver binds the pmic children. config PMIC_LP873X bool "Enable driver for Texas Instruments LP873X PMIC" - depends on DM_PMIC ---help--- The LP873X is a PMIC containing couple of LDOs and couple of SMPS. This driver binds the pmic children. config PMIC_LP87565 bool "Enable driver for Texas Instruments LP87565 PMIC" - depends on DM_PMIC ---help--- The LP87565 is a PMIC containing a bunch of SMPS. This driver binds the pmic children.@@ -300,7 +276,6 @@ config POWER_MC34VR500 config DM_PMIC_TPS65910 bool "Enable driver for Texas Instruments TPS65910 PMIC" - depends on DM_PMIC ---help--- The TPS65910 is a PMIC containing 3 buck DC-DC converters, one boost DC-DC converter, 8 LDOs and a RTC. This driver binds the SMPS and LDO@@ -308,7 +283,7 @@ config DM_PMIC_TPS65910 config PMIC_STPMIC1 bool "Enable support for STMicroelectronics STPMIC1 PMIC" - depends on DM_PMIC && DM_I2C + depends on DM_I2C select SYSRESET_CMD_POWEROFF if CMD_POWEROFF && !ARM_PSCI_FW ---help--- The STPMIC1 PMIC provides 4 BUCKs, 6 LDOs, 1 VREF and 2 power switches.@@ -317,28 +292,26 @@ config PMIC_STPMIC1 config SPL_PMIC_PALMAS bool "Enable driver for Texas Instruments PALMAS PMIC" - depends on DM_PMIC help The PALMAS is a PMIC containing several LDOs, SMPS. This driver binds the pmic children in SPL. config SPL_PMIC_LP873X bool "Enable driver for Texas Instruments LP873X PMIC" - depends on DM_PMIC help The LP873X is a PMIC containing couple of LDOs and couple of SMPS. This driver binds the pmic children in SPL. config SPL_PMIC_LP87565 bool "Enable driver for Texas Instruments LP87565 PMIC" - depends on DM_PMIC help The LP87565 is a PMIC containing a bunch of SMPS. This driver binds the pmic children in SPL. config PMIC_TPS65941 bool "Enable driver for Texas Instruments TPS65941 PMIC" - depends on DM_PMIC help The TPS65941 is a PMIC containing a bunch of SMPS & LDOs. This driver binds the pmic children. + +endif
Re: [PATCH 03/11] power: pmic: Consistently depend on DM_PMIC
In reply to Samuel HollandHi Samuel,
Quoted 292 lines · Samuel Holland
Kconfigsymbols for two PMIC drivers (PMIC_AS3722andDM_PMIC_MC34708) were missing a dependency onDM_PMIC. To fix this inconsistency, and to keep it from happening again, wrap the driver section with "ifDM_PMIC" instead of using a "depends onDM_PMIC" clause for each driver.Signed-off-by Samuel Holland <[email protected]>---
drivers/power/pmic/Kconfig | 43 +++++++------------------------------- 1 file changed, 8 insertions(+), 35 deletions(-)drivers/power/pmic/Kconfig +8
-36@@ -10,9 +10,10 @@ config DM_PMIC - 'drivers/power/pmic/pmic-uclass.c' - 'include/power/pmic.h' +if DM_PMIC + config PMIC_CHILDREN bool "Allow child devices for PMICs" - depends on DM_PMIC default y ---help--- This allows PMICs to support child devices (such as regulators) in@@ -22,7 +23,6 @@ config PMIC_CHILDREN config SPL_PMIC_CHILDREN bool "Allow child devices for PMICs in SPL" - depends on DM_PMIC default y ---help--- This allows PMICs to support child devices (such as regulators) in@@ -33,7 +33,6 @@ config SPL_PMIC_CHILDREN config PMIC_AB8500 bool "Enable driver for ST-Ericsson AB8500 PMIC via PRCMU" - depends on DM_PMIC select REGMAP select SYSCON help@@ -43,7 +42,7 @@ config PMIC_AB8500 config PMIC_ACT8846 bool "Enable support for the active-semi 8846 PMIC" - depends on DM_PMIC && DM_I2C + depends on DM_I2C ---help--- This PMIC includes 4 DC/DC step-down buck regulators and 8 low-dropout regulators (LDOs). It also provides some GPIO, reset and battery@@ -52,14 +51,13 @@ config PMIC_ACT8846 config DM_PMIC_DA9063 bool "Enable Driver Model for the Dialog DA9063 PMIC" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC DA9063. The driver implements read/write operations. config SPL_DM_PMIC_DA9063 bool "Enable Driver Model for the Dialog DA9063 PMIC in SPL" - depends on DM_PMIC && SPL + depends on SPL help This config enables implementation of driver-model pmic uclass features for PMIC DA9063. The driver implements read/write operations.@@ -74,14 +72,12 @@ config PMIC_AS3722 config DM_PMIC_BD71837 bool "Enable Driver Model for PMIC BD71837" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC BD71837. The driver implements read/write operations. config SPL_DM_PMIC_BD71837 bool "Enable Driver Model for PMIC BD71837 in SPL stage" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC BD71837. The driver implements read/write@@ -89,7 +85,7 @@ config SPL_DM_PMIC_BD71837 config DM_PMIC_FAN53555 bool "Enable support for OnSemi FAN53555" - depends on DM_PMIC && DM_REGULATOR && DM_I2C + depends on DM_REGULATOR && DM_I2C select DM_REGULATOR_FAN53555 help This config enables implementation of driver-model PMIC@@ -103,14 +99,12 @@ config DM_PMIC_FAN53555 config DM_PMIC_MP5416 bool "Enable Driver Model for PMIC MP5416" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC MP5416. The driver implements read/write operations. config SPL_DM_PMIC_MP5416 bool "Enable Driver Model for PMIC MP5416 in SPL stage" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC MP5416. The driver implements read/write@@ -118,56 +112,48 @@ config SPL_DM_PMIC_MP5416 config DM_PMIC_PCA9450 bool "Enable Driver Model for PMIC PCA9450" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC PCA9450. The driver implements read/write operations. config SPL_DM_PMIC_PCA9450 bool "Enable Driver Model for PMIC PCA9450" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC PCA9450 in SPL. The driver implements read/write operations. config DM_PMIC_PFUZE100 bool "Enable Driver Model for PMIC PFUZE100" - depends on DM_PMIC ---help--- This config enables implementation of driver-model pmic uclass features for PMIC PFUZE100. The driver implements read/write operations. config SPL_DM_PMIC_PFUZE100 bool "Enable Driver Model for PMIC PFUZE100 in SPL" - depends on DM_PMIC ---help--- This config enables implementation of driver-model pmic uclass features for PMIC PFUZE100 in SPL. The driver implements read/write operations. config DM_PMIC_MAX77686 bool "Enable Driver Model for PMIC MAX77686" - depends on DM_PMIC ---help--- This config enables implementation of driver-model pmic uclass features for PMIC MAX77686. The driver implements read/write operations. config DM_PMIC_MAX8998 bool "Enable Driver Model for PMIC MAX8998" - depends on DM_PMIC ---help--- This config enables implementation of driver-model pmic uclass features for PMIC MAX8998. The driver implements read/write operations. config DM_PMIC_MC34708 bool "Enable Driver Model for PMIC MC34708" - depends on DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC MC34708. The driver implements read/write operations. config PMIC_MAX8997 bool "Enable Driver Model for PMIC MAX8997" - depends on DM_PMIC ---help--- This config enables implementation of driver-model pmic uclass features for PMIC MAX8997. The driver implements read/write operations.@@ -182,7 +168,6 @@ config PMIC_MAX8997 config PMIC_PM8916 bool "Enable Driver Model for Qualcomm PM8916 PMIC" - depends on DM_PMIC ---help--- The PM8916 is a PMIC connected to one (or several) processors with SPMI bus. It has 2 slaves with several peripherals:@@ -198,7 +183,6 @@ config PMIC_PM8916 config PMIC_RK8XX bool "Enable support for Rockchip PMIC RK8XX" - depends on DM_PMIC ---help--- The Rockchip RK808 PMIC provides four buck DC-DC convertors, 8 LDOs, an RTC and two low Rds (resistance (drain to source)) switches. It is@@ -207,7 +191,6 @@ config PMIC_RK8XX config PMIC_S2MPS11 bool "Enable Driver Model for PMIC Samsung S2MPS11" - depends on DM_PMIC ---help--- The Samsung S2MPS11 PMIC provides: - 38 adjustable LDO regulators@@ -221,7 +204,6 @@ config PMIC_S2MPS11 config DM_PMIC_SANDBOX bool "Enable Driver Model for emulated Sandbox PMIC" - depends on DM_PMIC ---help--- Enable the driver for Sandbox PMIC emulation. The emulated PMIC device depends on two drivers:@@ -246,7 +228,6 @@ config DM_PMIC_SANDBOX config PMIC_S5M8767 bool "Enable Driver Model for the Samsung S5M8767 PMIC" - depends on DM_PMIC ---help--- The S5M8767 PMIC provides a large array of LDOs and BUCKs for use as a SoC power controller. It also provides 32KHz clock outputs. This@@ -255,7 +236,6 @@ config PMIC_S5M8767 config PMIC_RN5T567 bool "Enable driver for Ricoh RN5T567 PMIC" - depends on DM_PMIC ---help--- The RN5T567 is a PMIC with 4 step-down DC/DC converters, 5 LDO regulators Real-Time Clock and 4 GPIOs. This driver provides@@ -263,7 +243,6 @@ config PMIC_RN5T567 config PMIC_TPS65090 bool "Enable driver for Texas Instruments TPS65090 PMIC" - depends on DM_PMIC ---help--- The TPS65090 is a PMIC containing several LDOs, DC to DC convertors, FETs and a battery charger. This driver provides register access@@ -272,21 +251,18 @@ config PMIC_TPS65090 config PMIC_PALMAS bool "Enable driver for Texas Instruments PALMAS PMIC" - depends on DM_PMIC ---help--- The PALMAS is a PMIC containing several LDOs, SMPS. This driver binds the pmic children. config PMIC_LP873X bool "Enable driver for Texas Instruments LP873X PMIC" - depends on DM_PMIC ---help--- The LP873X is a PMIC containing couple of LDOs and couple of SMPS. This driver binds the pmic children. config PMIC_LP87565 bool "Enable driver for Texas Instruments LP87565 PMIC" - depends on DM_PMIC ---help--- The LP87565 is a PMIC containing a bunch of SMPS. This driver binds the pmic children.@@ -300,7 +276,6 @@ config POWER_MC34VR500 config DM_PMIC_TPS65910 bool "Enable driver for Texas Instruments TPS65910 PMIC" - depends on DM_PMIC ---help--- The TPS65910 is a PMIC containing 3 buck DC-DC converters, one boost DC-DC converter, 8 LDOs and a RTC. This driver binds the SMPS and LDO@@ -308,7 +283,7 @@ config DM_PMIC_TPS65910 config PMIC_STPMIC1 bool "Enable support for STMicroelectronics STPMIC1 PMIC" - depends on DM_PMIC && DM_I2C + depends on DM_I2C select SYSRESET_CMD_POWEROFF if CMD_POWEROFF && !ARM_PSCI_FW ---help--- The STPMIC1 PMIC provides 4 BUCKs, 6 LDOs, 1 VREF and 2 power switches.@@ -317,28 +292,26 @@ config PMIC_STPMIC1 config SPL_PMIC_PALMAS bool "Enable driver for Texas Instruments PALMAS PMIC" - depends on DM_PMIC help The PALMAS is a PMIC containing several LDOs, SMPS. This driver binds the pmic children in SPL. config SPL_PMIC_LP873X bool "Enable driver for Texas Instruments LP873X PMIC" - depends on DM_PMIC help The LP873X is a PMIC containing couple of LDOs and couple of SMPS. This driver binds the pmic children in SPL. config SPL_PMIC_LP87565 bool "Enable driver for Texas Instruments LP87565 PMIC" - depends on DM_PMIC help The LP87565 is a PMIC containing a bunch of SMPS. This driver binds the pmic children in SPL. config PMIC_TPS65941 bool "Enable driver for Texas Instruments TPS65941 PMIC" - depends on DM_PMIC help The TPS65941 is a PMIC containing a bunch of SMPS & LDOs. This driver binds the pmic children. + +endif --
Quoted 2 lines
2.31.1
Signature · 7 lines
Best regards - Freundliche Grüsse - Meilleures salutations Igor Opaniuk Embedded Software Engineer T: +380 938364067 E: [email protected] W: www.foundries.io
Samuel Holland
maintainerPATCH 4/11 power: pmic: Make the uclass optional in SPL
In reply to Samuel HollandSome platforms still cannot use the driver model in SPL due to SRAM space limitations. However, they need to use DM_PMIC in U-Boot proper. Add a new symbol so that DM_PMIC can be disabled in SPL, while keeping it available elsewhere. Also update the SPL-specific symbols to depend on this new option.
---
drivers/power/pmic/Kconfig | 17 ++++++++++++++++- drivers/power/pmic/Makefile | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/power/pmic/Kconfig +16 -1
@@ -12,6 +12,13 @@ config DM_PMIC if DM_PMIC +config SPL_DM_PMIC + bool "Enable Driver Model for PMIC drivers (UCLASS_PMIC) in SPL" + depends on SPL_DM + default y + help + This config enables the driver-model PMIC support in SPL. + config PMIC_CHILDREN bool "Allow child devices for PMICs" default y
@@ -23,6 +30,7 @@ config PMIC_CHILDREN config SPL_PMIC_CHILDREN bool "Allow child devices for PMICs in SPL" + depends on SPL_DM_PMIC default y ---help--- This allows PMICs to support child devices (such as regulators) in
@@ -57,7 +65,7 @@ config DM_PMIC_DA9063 config SPL_DM_PMIC_DA9063 bool "Enable Driver Model for the Dialog DA9063 PMIC in SPL" - depends on SPL + depends on SPL_DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC DA9063. The driver implements read/write operations.
@@ -78,6 +86,7 @@ config DM_PMIC_BD71837 config SPL_DM_PMIC_BD71837 bool "Enable Driver Model for PMIC BD71837 in SPL stage" + depends on SPL_DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC BD71837. The driver implements read/write
@@ -105,6 +114,7 @@ config DM_PMIC_MP5416 config SPL_DM_PMIC_MP5416 bool "Enable Driver Model for PMIC MP5416 in SPL stage" + depends on SPL_DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC MP5416. The driver implements read/write
@@ -118,6 +128,7 @@ config DM_PMIC_PCA9450 config SPL_DM_PMIC_PCA9450 bool "Enable Driver Model for PMIC PCA9450" + depends on SPL_DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC PCA9450 in SPL. The driver implements read/write operations.
@@ -130,6 +141,7 @@ config DM_PMIC_PFUZE100 config SPL_DM_PMIC_PFUZE100 bool "Enable Driver Model for PMIC PFUZE100 in SPL" + depends on SPL_DM_PMIC ---help--- This config enables implementation of driver-model pmic uclass features for PMIC PFUZE100 in SPL. The driver implements read/write operations.
@@ -292,18 +304,21 @@ config PMIC_STPMIC1 config SPL_PMIC_PALMAS bool "Enable driver for Texas Instruments PALMAS PMIC" + depends on SPL_DM_PMIC help The PALMAS is a PMIC containing several LDOs, SMPS. This driver binds the pmic children in SPL. config SPL_PMIC_LP873X bool "Enable driver for Texas Instruments LP873X PMIC" + depends on SPL_DM_PMIC help The LP873X is a PMIC containing couple of LDOs and couple of SMPS. This driver binds the pmic children in SPL. config SPL_PMIC_LP87565 bool "Enable driver for Texas Instruments LP87565 PMIC" + depends on SPL_DM_PMIC help The LP87565 is a PMIC containing a bunch of SMPS. This driver binds the pmic children in SPL.
drivers/power/pmic/Makefile +1 -1
@@ -3,7 +3,7 @@ # Copyright (C) 2012 Samsung Electronics # Lukasz Majewski <[email protected]> -obj-$(CONFIG_DM_PMIC) += pmic-uclass.o +obj-$(CONFIG_$(SPL_)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
Signature · 1 line
2.31.1
Re: [PATCH 04/11] power: pmic: Make the uclass optional in SPL
Quoted 7 lines · Samuel Holland
Some platforms still cannot use the driver model in SPL due to SRAM space limitations. However, they need to use
DM_PMICin U-Boot proper. Add a new symbol so thatDM_PMICcan be disabled in SPL, while keeping it available elsewhere. Also update the SPL-specific symbols to depend on this new option.Signed-off-by Samuel Holland <[email protected]>
Best Regards,
Jaehoon Chung
Quoted 109 lines
---
drivers/power/pmic/Kconfig | 17 ++++++++++++++++- drivers/power/pmic/Makefile | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-)drivers/power/pmic/Kconfig +16
-1@@ -12,6 +12,13 @@ config DM_PMIC if DM_PMIC +config SPL_DM_PMIC + bool "Enable Driver Model for PMIC drivers (UCLASS_PMIC) in SPL" + depends on SPL_DM + default y + help + This config enables the driver-model PMIC support in SPL. + config PMIC_CHILDREN bool "Allow child devices for PMICs" default y@@ -23,6 +30,7 @@ config PMIC_CHILDREN config SPL_PMIC_CHILDREN bool "Allow child devices for PMICs in SPL" + depends on SPL_DM_PMIC default y ---help--- This allows PMICs to support child devices (such as regulators) in@@ -57,7 +65,7 @@ config DM_PMIC_DA9063 config SPL_DM_PMIC_DA9063 bool "Enable Driver Model for the Dialog DA9063 PMIC in SPL" - depends on SPL + depends on SPL_DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC DA9063. The driver implements read/write operations.@@ -78,6 +86,7 @@ config DM_PMIC_BD71837 config SPL_DM_PMIC_BD71837 bool "Enable Driver Model for PMIC BD71837 in SPL stage" + depends on SPL_DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC BD71837. The driver implements read/write@@ -105,6 +114,7 @@ config DM_PMIC_MP5416 config SPL_DM_PMIC_MP5416 bool "Enable Driver Model for PMIC MP5416 in SPL stage" + depends on SPL_DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC MP5416. The driver implements read/write@@ -118,6 +128,7 @@ config DM_PMIC_PCA9450 config SPL_DM_PMIC_PCA9450 bool "Enable Driver Model for PMIC PCA9450" + depends on SPL_DM_PMIC help This config enables implementation of driver-model pmic uclass features for PMIC PCA9450 in SPL. The driver implements read/write operations.@@ -130,6 +141,7 @@ config DM_PMIC_PFUZE100 config SPL_DM_PMIC_PFUZE100 bool "Enable Driver Model for PMIC PFUZE100 in SPL" + depends on SPL_DM_PMIC ---help--- This config enables implementation of driver-model pmic uclass features for PMIC PFUZE100 in SPL. The driver implements read/write operations.@@ -292,18 +304,21 @@ config PMIC_STPMIC1 config SPL_PMIC_PALMAS bool "Enable driver for Texas Instruments PALMAS PMIC" + depends on SPL_DM_PMIC help The PALMAS is a PMIC containing several LDOs, SMPS. This driver binds the pmic children in SPL. config SPL_PMIC_LP873X bool "Enable driver for Texas Instruments LP873X PMIC" + depends on SPL_DM_PMIC help The LP873X is a PMIC containing couple of LDOs and couple of SMPS. This driver binds the pmic children in SPL. config SPL_PMIC_LP87565 bool "Enable driver for Texas Instruments LP87565 PMIC" + depends on SPL_DM_PMIC help The LP87565 is a PMIC containing a bunch of SMPS. This driver binds the pmic children in SPL.drivers/power/pmic/Makefile +1
-1@@ -3,7 +3,7 @@ # Copyright (C) 2012 Samsung Electronics # Lukasz Majewski <[email protected]> -obj-$(CONFIG_DM_PMIC) += pmic-uclass.o +obj-$(CONFIG_$(SPL_)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
Samuel Holland
maintainerPATCH 5/11 power: pmic: Add a driver for X-Powers AXP PMICs
In reply to Samuel HollandThese PMICs provide some combination of battery charger, fuel gauge, GPIOs, regulators, and VBUS routing. These functions are represented as child nodes in the device tree. Add the minimal driver needed to probe these child devices and provide the DM_PMIC ops.
Enable the driver by default for SoCs that normally pair with a PMIC.
---
drivers/power/pmic/Kconfig | 14 +++++++++++ drivers/power/pmic/Makefile | 1 + drivers/power/pmic/axp.c | 49 +++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 drivers/power/pmic/axp.c
drivers/power/pmic/Kconfig +14 -0
@@ -57,6 +57,20 @@ config PMIC_ACT8846 functions. It uses an I2C interface and is designed for use with tablets and smartphones. +config PMIC_AXP + bool "Enable Driver Model for X-Powers AXP PMICs" + depends on DM_I2C + help + This config enables driver-model PMIC uclass features for + X-Powers AXP152, AXP2xx, and AXP8xx PMICs. + +config SPL_PMIC_AXP + bool "Enable Driver Model for X-Powers AXP PMICs in SPL" + depends on SPL_DM_I2C && SPL_DM_PMIC + help + This config enables driver-model PMIC uclass features in the SPL for + X-Powers AXP152, AXP2xx, and AXP8xx PMICs. + config DM_PMIC_DA9063 bool "Enable Driver Model for the Dialog DA9063 PMIC" help
drivers/power/pmic/Makefile +1 -0
@@ -18,6 +18,7 @@ obj-$(CONFIG_DM_PMIC_SANDBOX) += sandbox.o i2c_pmic_emul.o obj-$(CONFIG_PMIC_AB8500) += ab8500.o obj-$(CONFIG_PMIC_ACT8846) += act8846.o obj-$(CONFIG_PMIC_AS3722) += as3722.o as3722_gpio.o +obj-$(CONFIG_$(SPL_)PMIC_AXP) += axp.o obj-$(CONFIG_PMIC_MAX8997) += max8997.o obj-$(CONFIG_PMIC_PM8916) += pm8916.o obj-$(CONFIG_PMIC_RK8XX) += rk8xx.o
drivers/power/pmic/axp.c new file +49 -0
49 lines not on this page · raw message
Signature · 1 line
2.31.1
Re: [PATCH 05/11] power: pmic: Add a driver for X-Powers AXP PMICs
Quoted 76 lines · Samuel Holland
These PMICs provide some combination of battery charger, fuel gauge, GPIOs, regulators, and VBUS routing. These functions are represented as child nodes in the device tree. Add the minimal driver needed to probe these child devices and provide the
DM_PMICops.Enable the driver by default for SoCs that normally pair with a PMIC.
Signed-off-by Samuel Holland <[email protected]>---
drivers/power/pmic/Kconfig | 14 +++++++++++ drivers/power/pmic/Makefile | 1 + drivers/power/pmic/axp.c | 49 +++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 drivers/power/pmic/axp.cdrivers/power/pmic/Kconfig +14
-0@@ -57,6 +57,20 @@ config PMIC_ACT8846 functions. It uses an I2C interface and is designed for use with tablets and smartphones. +config PMIC_AXP + bool "Enable Driver Model for X-Powers AXP PMICs" + depends on DM_I2C + help + This config enables driver-model PMIC uclass features for + X-Powers AXP152, AXP2xx, and AXP8xx PMICs. + +config SPL_PMIC_AXP + bool "Enable Driver Model for X-Powers AXP PMICs in SPL" + depends on SPL_DM_I2C && SPL_DM_PMIC + help + This config enables driver-model PMIC uclass features in the SPL for + X-Powers AXP152, AXP2xx, and AXP8xx PMICs. + config DM_PMIC_DA9063 bool "Enable Driver Model for the Dialog DA9063 PMIC" helpdrivers/power/pmic/Makefile +1
-0@@ -18,6 +18,7 @@ obj-$(CONFIG_DM_PMIC_SANDBOX) += sandbox.o i2c_pmic_emul.o obj-$(CONFIG_PMIC_AB8500) += ab8500.o obj-$(CONFIG_PMIC_ACT8846) += act8846.o obj-$(CONFIG_PMIC_AS3722) += as3722.o as3722_gpio.o +obj-$(CONFIG_$(SPL_)PMIC_AXP) += axp.o obj-$(CONFIG_PMIC_MAX8997) += max8997.o obj-$(CONFIG_PMIC_PM8916) += pm8916.o obj-$(CONFIG_PMIC_RK8XX) += rk8xx.odrivers/power/pmic/axp.c new file +17
-0@@ -0,0 +1,49 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include <dm.h> +#include <i2c.h> +#include <power/pmic.h> + +static int axp_pmic_reg_count (struct udevice *dev) +{ +/* TODO: Get the specific value from driver data. */ +return 0x100 ; +} + +static struct dm_pmic_ops axp_pmic_ops = { + .reg_count = axp_pmic_reg_count, + .read = dm_i2c_read, + .write = dm_i2c_write, +};
drivers/power/pmic/axp.c line 27
Quoted 10 lines
drivers/power/pmic/axp.c new file +10
-0+ +static int axp_pmic_bind (struct udevice *dev) +{ +int ret; + + ret =dm_scan_fdt_dev (dev); +if (ret) +return ret; + +return 0 ;
return dm_scan_fdt_dev(); ?
or { .bind = dm_scan_fdt_dev, } ?
Best Regards,
Jaehoon Chung
Quoted 23 lines
drivers/power/pmic/axp.c new file +22
-0+} + +static const struct udevice_id axp_pmic_ids[] = { + { .compatible ="x-powers,axp152" }, + { .compatible ="x-powers,axp202" }, + { .compatible ="x-powers,axp209" }, + { .compatible ="x-powers,axp221" }, + { .compatible ="x-powers,axp223" }, + { .compatible ="x-powers,axp803" }, + { .compatible ="x-powers,axp806" }, + { .compatible ="x-powers,axp809" }, + { .compatible ="x-powers,axp813" }, + { } +}; + +U_BOOT_DRIVER (axp_pmic) = { + .name ="axp_pmic" , + .id =UCLASS_PMIC , + .of_match = axp_pmic_ids, + .bind = axp_pmic_bind, + .ops = &axp_pmic_ops, +};
Samuel Holland
maintainerRe: [PATCH 05/11] power: pmic: Add a driver for X-Powers AXP PMICs
Quoted 90 lines · Jaehoon Chung
Quoted 76 lines · Samuel Holland
These PMICs provide some combination of battery charger, fuel gauge, GPIOs, regulators, and VBUS routing. These functions are represented as child nodes in the device tree. Add the minimal driver needed to probe these child devices and provide the
DM_PMICops.Enable the driver by default for SoCs that normally pair with a PMIC.
Signed-off-by Samuel Holland <[email protected]>---
drivers/power/pmic/Kconfig | 14 +++++++++++ drivers/power/pmic/Makefile | 1 + drivers/power/pmic/axp.c | 49 +++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 drivers/power/pmic/axp.cdrivers/power/pmic/Kconfig +14
-0@@ -57,6 +57,20 @@ config PMIC_ACT8846 functions. It uses an I2C interface and is designed for use with tablets and smartphones. +config PMIC_AXP + bool "Enable Driver Model for X-Powers AXP PMICs" + depends on DM_I2C + help + This config enables driver-model PMIC uclass features for + X-Powers AXP152, AXP2xx, and AXP8xx PMICs. + +config SPL_PMIC_AXP + bool "Enable Driver Model for X-Powers AXP PMICs in SPL" + depends on SPL_DM_I2C && SPL_DM_PMIC + help + This config enables driver-model PMIC uclass features in the SPL for + X-Powers AXP152, AXP2xx, and AXP8xx PMICs. + config DM_PMIC_DA9063 bool "Enable Driver Model for the Dialog DA9063 PMIC" helpdrivers/power/pmic/Makefile +1
-0@@ -18,6 +18,7 @@ obj-$(CONFIG_DM_PMIC_SANDBOX) += sandbox.o i2c_pmic_emul.o obj-$(CONFIG_PMIC_AB8500) += ab8500.o obj-$(CONFIG_PMIC_ACT8846) += act8846.o obj-$(CONFIG_PMIC_AS3722) += as3722.o as3722_gpio.o +obj-$(CONFIG_$(SPL_)PMIC_AXP) += axp.o obj-$(CONFIG_PMIC_MAX8997) += max8997.o obj-$(CONFIG_PMIC_PM8916) += pm8916.o obj-$(CONFIG_PMIC_RK8XX) += rk8xx.odrivers/power/pmic/axp.c new file +17
-0@@ -0,0 +1,49 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include <dm.h> +#include <i2c.h> +#include <power/pmic.h> + +static int axp_pmic_reg_count (struct udevice *dev) +{ +/* TODO: Get the specific value from driver data. */ +return 0x100 ; +} + +static struct dm_pmic_ops axp_pmic_ops = { + .reg_count = axp_pmic_reg_count, + .read = dm_i2c_read, + .write = dm_i2c_write, +};drivers/power/pmic/axp.c line 27
Quoted 10 lines
drivers/power/pmic/axp.c new file +10
-0+ +static int axp_pmic_bind (struct udevice *dev) +{ +int ret; + + ret =dm_scan_fdt_dev (dev); +if (ret) +return ret; + +return 0 ;return
dm_scan_fdt_dev(); ?
Quoted 1 line
or { .bind =
dm_scan_fdt_dev, } ?
The PMIC will eventually need to do more in this function, including binding a sysreset device[1] and regulators, so this minimized the diff. I do like the idea of .bind = dm_scan_fdt_dev, so I will plan to do that for v2.
Regards,
Samuel
[1]:
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Quoted 27 lines
Best Regards,
Jaehoon ChungQuoted 23 lines
drivers/power/pmic/axp.c new file +22
-0+} + +static const struct udevice_id axp_pmic_ids[] = { + { .compatible ="x-powers,axp152" }, + { .compatible ="x-powers,axp202" }, + { .compatible ="x-powers,axp209" }, + { .compatible ="x-powers,axp221" }, + { .compatible ="x-powers,axp223" }, + { .compatible ="x-powers,axp803" }, + { .compatible ="x-powers,axp806" }, + { .compatible ="x-powers,axp809" }, + { .compatible ="x-powers,axp813" }, + { } +}; + +U_BOOT_DRIVER (axp_pmic) = { + .name ="axp_pmic" , + .id =UCLASS_PMIC , + .of_match = axp_pmic_ids, + .bind = axp_pmic_bind, + .ops = &axp_pmic_ops, +};
Samuel Holland
maintainerPATCH 6/11 sunxi: Select SUN8I_RSB more carefully
In reply to Samuel HollandSUN8I_RSB should not be selected by MACH_SUN8I, because the hardware is not present in half of those SoCs (H3/H5, R40, and V3s). Move the selection to the SoCs where the hardware actually exists.
---
arch/arm/mach-sunxi/Kconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-sunxi/Kconfig +3 -1
@@ -241,6 +241,7 @@ config MACH_SUN8I_A23 select ARCH_SUPPORT_PSCI select DRAM_SUN8I_A23 select PHY_SUN4I_USB + select SUN8I_RSB select SUNXI_GEN_SUN6I select SUPPORT_SPL select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
@@ -254,6 +255,7 @@ config MACH_SUN8I_A33 select ARCH_SUPPORT_PSCI select DRAM_SUN8I_A33 select PHY_SUN4I_USB + select SUN8I_RSB select SUNXI_GEN_SUN6I select SUPPORT_SPL select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
@@ -264,6 +266,7 @@ config MACH_SUN8I_A83T select CPU_V7A select DRAM_SUN8I_A83T select PHY_SUN4I_USB + select SUN8I_RSB select SUNXI_GEN_SUN6I select MMC_SUNXI_HAS_NEW_MODE select MMC_SUNXI_HAS_MODE_SWITCH
@@ -358,7 +361,6 @@ endchoice # The sun8i SoCs share a lot, this helps to avoid a lot of "if A23 || A33" config MACH_SUN8I bool - select SUN8I_RSB select SUN6I_PRCM default y if MACH_SUN8I_A23 default y if MACH_SUN8I_A33
Signature · 1 line
2.31.1
Re: [PATCH 06/11] sunxi: Select SUN8I_RSB more carefully
Quoted 3 lines · On Sat, 21 Aug 2021 18:05:14 -0500 Samuel Holland <[email protected]> wrote:
SUN8I_RSBshould not be selected byMACH_SUN8I, because the hardware is not present in half of those SoCs (H3/H5, R40, and V3s). Move the selection to the SoCs where the hardware actually exists.
Indeed, only those SoCs below have the RSB controller.
Quoted 1 line
Signed-off-by Samuel Holland <[email protected]>
Cheers,
Andre
Quoted 41 lines
---
arch/arm/mach-sunxi/Kconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)arch/arm/mach-sunxi/Kconfig +3
-1@@ -241,6 +241,7 @@ config MACH_SUN8I_A23 select ARCH_SUPPORT_PSCI select DRAM_SUN8I_A23 select PHY_SUN4I_USB + select SUN8I_RSB select SUNXI_GEN_SUN6I select SUPPORT_SPL select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT@@ -254,6 +255,7 @@ config MACH_SUN8I_A33 select ARCH_SUPPORT_PSCI select DRAM_SUN8I_A33 select PHY_SUN4I_USB + select SUN8I_RSB select SUNXI_GEN_SUN6I select SUPPORT_SPL select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT@@ -264,6 +266,7 @@ config MACH_SUN8I_A83T select CPU_V7A select DRAM_SUN8I_A83T select PHY_SUN4I_USB + select SUN8I_RSB select SUNXI_GEN_SUN6I select MMC_SUNXI_HAS_NEW_MODE select MMC_SUNXI_HAS_MODE_SWITCH@@ -358,7 +361,6 @@ endchoice # The sun8i SoCs share a lot, this helps to avoid a lot of "if A23 || A33" config MACH_SUN8I bool - select SUN8I_RSB select SUN6I_PRCM default y if MACH_SUN8I_A23 default y if MACH_SUN8I_A33
Samuel Holland
maintainerPATCH 7/11 sunxi: pmic_bus: Fix Kconfig dependencies
In reply to Samuel HollandAXP_PMIC_BUS enables communication with a specific AXP PMIC at a PMIC-dependent I2C/P2WI/RSB bus address. It is automatically selected as a dependency of the PMIC driver. It should not be selectable by the user when no PMIC is chosen.
AXP_GPIO uses the pmic_bus functions, and also depends on a specific PMIC header to pick up register definitions.
Both of these changes have no impact on any existing configs, since the code does not compile if the dependencies are not met.
---
arch/arm/mach-sunxi/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-sunxi/Kconfig +2 -1
@@ -95,7 +95,7 @@ config SUN6I_PRCM in A31 SoC. config AXP_PMIC_BUS - bool "Sunxi AXP PMIC bus access helpers" + bool help Select this PMIC bus access helpers for Sunxi platform PRCM or other AXP family PMIC devices.
@@ -796,6 +796,7 @@ endif config AXP_GPIO bool "Enable support for gpio-s on axp PMICs" + depends on AXP_PMIC_BUS default n ---help--- Say Y here to enable support for the gpio pins of the axp PMIC ICs.
Signature · 1 line
2.31.1
Re: [PATCH 07/11] sunxi: pmic_bus: Fix Kconfig dependencies
Quoted 5 lines · Samuel Holland
AXP_PMIC_BUSenables communication with a specific AXP PMIC at a PMIC-dependent I2C/P2WI/RSB bus address. It is automatically selected as a dependency of the PMIC driver. It should not be selectable by the user when no PMIC is chosen.
Quoted 7 lines
AXP_GPIOuses thepmic_busfunctions, and also depends on a specific PMIC header to pick up register definitions.Both of these changes have no impact on any existing configs, since the code does not compile if the dependencies are not met.
Signed-off-by Samuel Holland <[email protected]>
Best Regards,
Jaehoon Chung
Quoted 27 lines
---
arch/arm/mach-sunxi/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/arm/mach-sunxi/Kconfig +2
-1@@ -95,7 +95,7 @@ config SUN6I_PRCM in A31 SoC. config AXP_PMIC_BUS - bool "Sunxi AXP PMIC bus access helpers" + bool help Select this PMIC bus access helpers for Sunxi platform PRCM or other AXP family PMIC devices.@@ -796,6 +796,7 @@ endif config AXP_GPIO bool "Enable support for gpio-s on axp PMICs" + depends on AXP_PMIC_BUS default n ---help--- Say Y here to enable support for the gpio pins of the axp PMIC ICs.
Samuel Holland
maintainerPATCH 8/11 sunxi: pmic_bus: Clean up preprocessor conditions
In reply to Samuel HollandInstead of using the SoC symbols to decide the bus type, use whichever bus driver is actually enabled. This allows collapsing all of the AXP2xx and AXP8xx variants into one "else" case. It also has the advantage of falling back to I2C when the other bus drivers are disabled; this works because all of the PMICs support I2C in addition to other interfaces.
---
arch/arm/mach-sunxi/pmic_bus.c | 90 +++++++++++++++------------------- 1 file changed, 39 insertions(+), 51 deletions(-)
arch/arm/mach-sunxi/pmic_bus.c +39 -51
@@ -23,75 +23,63 @@#define AXP221_CHIP_ADDR 0x68 +static int pmic_i2c_address (void ) +{ +if (IS_ENABLED (CONFIG_AXP152_POWER )) +return AXP152_I2C_ADDR ; +if (IS_ENABLED (CONFIG_AXP305_POWER )) +return AXP305_I2C_ADDR ; + +/* Other AXP2xx and AXP8xx variants */ +return AXP209_I2C_ADDR ; +} +int pmic_bus_init (void ) {/* This cannot be 0 because it is used in SPL before BSS is ready */ static int needs_init =1 ; -__maybe_unused int ret; +int ret =0 ;if (!needs_init)return 0 ; -#if definedCONFIG_AXP221_POWER || definedCONFIG_AXP809_POWER || definedCONFIG_AXP818_POWER -# ifdef CONFIG_MACH_SUN6I -p2wi_init (); - ret =p2wi_change_to_p2wi_mode (AXP221_CHIP_ADDR ,AXP_PMIC_MODE_REG , -AXP_PMIC_MODE_P2WI ); -# elif definedCONFIG_MACH_SUN8I_R40 -/* Nothing. R40 uses the AXP221s in I2C mode */ - ret =0 ; -# else - ret =rsb_init (); -if (ret) -return ret; +if (IS_ENABLED (CONFIG_SUN6I_P2WI )) { +p2wi_init (); + ret =p2wi_change_to_p2wi_mode (AXP221_CHIP_ADDR , +AXP_PMIC_MODE_REG , +AXP_PMIC_MODE_P2WI ); + }else if (IS_ENABLED (CONFIG_SUN8I_RSB )) { + ret =rsb_init (); +if (ret) +return ret; - ret =rsb_set_device_address (AXP_PMIC_PRI_DEVICE_ADDR , -AXP_PMIC_PRI_RUNTIME_ADDR ); -# endif -if (ret) -return ret; -#endif + ret =rsb_set_device_address (AXP_PMIC_PRI_DEVICE_ADDR , +AXP_PMIC_PRI_RUNTIME_ADDR ); + } + + needs_init = ret; - needs_init =0 ; -return 0 ; +return ret; }int pmic_bus_read (u8 reg,u8 *data) { -#ifdef CONFIG_AXP152_POWER -return i2c_read (AXP152_I2C_ADDR , reg,1 , data,1 ); -#elif definedCONFIG_AXP209_POWER -return i2c_read (AXP209_I2C_ADDR , reg,1 , data,1 ); -#elif definedCONFIG_AXP305_POWER -return i2c_read (AXP305_I2C_ADDR , reg,1 , data,1 ); -#elif definedCONFIG_AXP221_POWER || definedCONFIG_AXP809_POWER || definedCONFIG_AXP818_POWER -# ifdef CONFIG_MACH_SUN6I -return p2wi_read (reg, data); -# elif definedCONFIG_MACH_SUN8I_R40 -return i2c_read (AXP209_I2C_ADDR , reg,1 , data,1 ); -# else -return rsb_read (AXP_PMIC_PRI_RUNTIME_ADDR , reg, data); -# endif -#endif +if (IS_ENABLED (CONFIG_SUN6I_P2WI )) +return p2wi_read (reg, data); +if (IS_ENABLED (CONFIG_SUN8I_RSB )) +return rsb_read (AXP_PMIC_PRI_RUNTIME_ADDR , reg, data); + +return i2c_read (pmic_i2c_address (), reg,1 , data,1 ); }int pmic_bus_write (u8 reg,u8 data) { -#ifdef CONFIG_AXP152_POWER -return i2c_write (AXP152_I2C_ADDR , reg,1 , &data,1 ); -#elif definedCONFIG_AXP209_POWER -return i2c_write (AXP209_I2C_ADDR , reg,1 , &data,1 ); -#elif definedCONFIG_AXP305_POWER -return i2c_write (AXP305_I2C_ADDR , reg,1 , &data,1 ); -#elif definedCONFIG_AXP221_POWER || definedCONFIG_AXP809_POWER || definedCONFIG_AXP818_POWER -# ifdef CONFIG_MACH_SUN6I -return p2wi_write (reg, data); -# elif definedCONFIG_MACH_SUN8I_R40 -return i2c_write (AXP209_I2C_ADDR , reg,1 , &data,1 ); -# else -return rsb_write (AXP_PMIC_PRI_RUNTIME_ADDR , reg, data); -# endif -#endif +if (IS_ENABLED (CONFIG_SUN6I_P2WI )) +return p2wi_write (reg, data); +if (IS_ENABLED (CONFIG_SUN8I_RSB )) +return rsb_write (AXP_PMIC_PRI_RUNTIME_ADDR , reg, data); + +return i2c_write (pmic_i2c_address (), reg,1 , &data,1 ); }int pmic_bus_setbits (u8 reg,u8 bits)
Signature · 1 line
2.31.1
Samuel Holland
maintainerPATCH 9/11 sunxi: pmic_bus: Use the DM PMIC interface when possible
In reply to Samuel HollandThe pmic_bus functions are used in both SPL (for regulator setup) and U-Boot proper (for regulator setup, SID access, GPIO, and poweroff).
Currently, pmic_bus conflicts with DM_I2C because it uses the legacy I2C interface. This commit makes pmic_bus dual-compatible with either the legacy I2C functions or the newly-added PMIC_AXP driver (which uses DM_I2C). In turn, this allows platforms to start transitioning to DM_I2C in U-Boot proper, without breaking boards that still depend on the legacy I2C interface for other reasons.
---
arch/arm/mach-sunxi/Kconfig | 2 ++ arch/arm/mach-sunxi/pmic_bus.c | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+)
arch/arm/mach-sunxi/Kconfig +2 -0
@@ -96,6 +96,8 @@ config SUN6I_PRCM config AXP_PMIC_BUS bool + select DM_PMIC if DM_I2C + select PMIC_AXP if DM_I2C help Select this PMIC bus access helpers for Sunxi platform PRCM or other AXP family PMIC devices.
arch/arm/mach-sunxi/pmic_bus.c +19 -0
@@ -10,9 +10,11 @@#include <axp_pmic.h> #include <common.h> +#include <dm.h> #include <asm/arch/p2wi.h> #include <asm/arch/rsb.h> #include <i2c.h> +#include <power/pmic.h> #include <asm/arch/pmic_bus.h> #define AXP152_I2C_ADDR 0x30
@@ -23,6 +25,9 @@#define AXP221_CHIP_ADDR 0x68 +#if CONFIG_IS_ENABLED (PMIC_AXP ) +static struct udevice *pmic; +#else static int pmic_i2c_address (void ) {if (IS_ENABLED (CONFIG_AXP152_POWER ))
@@ -33,6 +38,7 @@ static int pmic_i2c_address(void)/* Other AXP2xx and AXP8xx variants */ return AXP209_I2C_ADDR; } +#endif int pmic_bus_init (void ) {
@@ -43,6 +49,10 @@ int pmic_bus_init(void)if (!needs_init)return 0 ; +#if CONFIG_IS_ENABLED (PMIC_AXP ) + ret =uclass_get_device_by_driver (UCLASS_PMIC ,DM_DRIVER_GET (axp_pmic), + &pmic); +#else if (IS_ENABLED (CONFIG_SUN6I_P2WI )) {p2wi_init (); ret = p2wi_change_to_p2wi_mode(AXP221_CHIP_ADDR,
@@ -56,6 +66,7 @@ int pmic_bus_init(void) ret =rsb_set_device_address (AXP_PMIC_PRI_DEVICE_ADDR , AXP_PMIC_PRI_RUNTIME_ADDR); } +#endif needs_init = ret;
@@ -64,22 +75,30 @@ int pmic_bus_init(void)int pmic_bus_read (u8 reg,u8 *data) { +#if CONFIG_IS_ENABLED (PMIC_AXP ) +return pmic_read (pmic, reg, data,1 ); +#else if (IS_ENABLED (CONFIG_SUN6I_P2WI ))return p2wi_read (reg, data);if (IS_ENABLED (CONFIG_SUN8I_RSB ))return rsb_read (AXP_PMIC_PRI_RUNTIME_ADDR , reg, data);return i2c_read (pmic_i2c_address (), reg,1 , data,1 ); +#endif }int pmic_bus_write (u8 reg,u8 data) { +#if CONFIG_IS_ENABLED (PMIC_AXP ) +return pmic_write (pmic, reg, &data,1 ); +#else if (IS_ENABLED (CONFIG_SUN6I_P2WI ))return p2wi_write (reg, data);if (IS_ENABLED (CONFIG_SUN8I_RSB ))return rsb_write (AXP_PMIC_PRI_RUNTIME_ADDR , reg, data);return i2c_write (pmic_i2c_address (), reg,1 , &data,1 ); +#endif }int pmic_bus_setbits (u8 reg,u8 bits)
Signature · 1 line
2.31.1
Samuel Holland
maintainerPATCH 10/11 sunxi: video: Convert panel I2C to use DM_I2C
In reply to Samuel HollandTwo displays supported by the sunxi display driver (each one used by a single board) require initialization over I2C. Both previously used i2c_soft; replace this with the i2c-gpio instance that already exists in those boards' device trees (sun5i-a13-utoo-p66 and sun6i-a31-colombus).
Since the i2c-gpio nodes are not referenced by any other node in the device trees (the device trees have no panel node), the I2C bus is selected by its node name.
This panel initialization code was the only i2c_soft user, so the i2c_soft GPIO setup code can be removed now as well.
---
arch/arm/mach-sunxi/Kconfig | 22 ++---- board/sunxi/board.c | 44 +----------- configs/Colombus_defconfig | 6 -- configs/UTOO_P66_defconfig | 3 - drivers/video/anx9804.c | 107 ++++++++++++++-------------- drivers/video/anx9804.h | 5 +- drivers/video/sunxi/sunxi_display.c | 55 +++++++++----- include/configs/sunxi-common.h | 17 ----- 8 files changed, 102 insertions(+), 157 deletions(-)
arch/arm/mach-sunxi/Kconfig +6 -16
@@ -929,28 +929,18 @@ config VIDEO_LCD_BL_PWM_ACTIVE_LOW config VIDEO_LCD_PANEL_I2C bool "LCD panel needs to be configured via i2c" depends on VIDEO_SUNXI - default n - select CMD_I2C + select DM_I2C + select DM_I2C_GPIO ---help--- Say y here if the LCD panel needs to be configured via i2c. This will add a bitbang i2c controller using gpios to talk to the LCD. -config VIDEO_LCD_PANEL_I2C_SDA - string "LCD panel i2c interface SDA pin" +config VIDEO_LCD_PANEL_I2C_NAME + string "LCD panel i2c interface node name" depends on VIDEO_LCD_PANEL_I2C - default "PG12" + default "i2c@0" ---help--- - Set the SDA pin for the LCD i2c interface. This takes a string in the - format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. - -config VIDEO_LCD_PANEL_I2C_SCL - string "LCD panel i2c interface SCL pin" - depends on VIDEO_LCD_PANEL_I2C - default "PG10" - ---help--- - Set the SCL pin for the LCD i2c interface. This takes a string in the - format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. - + Set the device tree node name for the LCD i2c interface. # Note only one of these may be selected at a time! But hidden choices are # not supported by Kconfig
board/sunxi/board.c +1 -43
56 lines not on this page · raw message
configs/Colombus_defconfig +0 -6
@@ -13,15 +13,9 @@ CONFIG_VIDEO_LCD_DCLK_PHASE=0 CONFIG_VIDEO_LCD_POWER="PH27" CONFIG_VIDEO_LCD_BL_EN="PM1" CONFIG_VIDEO_LCD_BL_PWM="PH13" -CONFIG_VIDEO_LCD_PANEL_I2C_SDA="PA23" -CONFIG_VIDEO_LCD_PANEL_I2C_SCL="PA24" CONFIG_VIDEO_LCD_PANEL_EDP_4_LANE_1620M_VIA_ANX9804=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set -CONFIG_SYS_I2C_LEGACY=y CONFIG_SPL_SYS_I2C_LEGACY=y -CONFIG_SYS_I2C_SOFT=y -CONFIG_SYS_I2C_SOFT_SPEED=50000 -CONFIG_SYS_I2C_SOFT_SLAVE=0x00 CONFIG_SYS_I2C_MVTWSI=y CONFIG_SYS_I2C_SLAVE=0x7f CONFIG_SYS_I2C_SPEED=400000
configs/UTOO_P66_defconfig +0 -3
@@ -21,9 +21,6 @@ CONFIG_VIDEO_LCD_BL_PWM="PB2" CONFIG_VIDEO_LCD_TL059WV5C0=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SPL_I2C=y -CONFIG_SYS_I2C_SOFT=y -CONFIG_SYS_I2C_SOFT_SPEED=50000 -CONFIG_SYS_I2C_SOFT_SLAVE=0x00 CONFIG_SYS_I2C_MVTWSI=y CONFIG_SYS_I2C_SLAVE=0x7f CONFIG_SYS_I2C_SPEED=400000
drivers/video/anx9804.c +54 -53
164 lines not on this page · raw message
drivers/video/anx9804.h +3 -2
@@ -16,9 +16,10 @@#define ANX9804_DATA_RATE_2700M 0x0a#ifdef CONFIG_VIDEO_LCD_PANEL_EDP_4_LANE_1620M_VIA_ANX9804 -void anx9804_init (unsigned int i2c_bus,u8 lanes,u8 data_rate,int bpp); +void anx9804_init (struct udevice *i2c_bus,u8 lanes,u8 data_rate,int bpp);#else -static inline void anx9804_init (unsigned int i2c_bus,u8 lanes,u8 data_rate, +static inline void anx9804_init (struct udevice *i2c_bus,u8 lanes,u8 data_rate,int bpp) {}#endif +#endif
drivers/video/sunxi/sunxi_display.c +38 -17
71 lines not on this page · raw message
include/configs/sunxi-common.h +0 -17
@@ -192,23 +192,6 @@#define CONFIG_SPL_PAD_TO 32768/* decimal for 'dd' */ #endif - -/* I2C */ -#if defined(CONFIG_VIDEO_LCD_PANEL_I2C ) -/* We use pin names in Kconfig and sunxi_name_to_gpio() */ -#define CONFIG_SOFT_I2C_GPIO_SDA soft_i2c_gpio_sda -#define CONFIG_SOFT_I2C_GPIO_SCL soft_i2c_gpio_scl -#ifndef __ASSEMBLY__ -extern int soft_i2c_gpio_sda; -extern int soft_i2c_gpio_scl; -#endif -#define CONFIG_VIDEO_LCD_I2C_BUS 0/* The lcd panel soft i2c is bus 0 */ -#define CONFIG_SYS_SPD_BUS_NUM 1/* And the axp209 i2c bus is bus 1 */ -#else -#define CONFIG_SYS_SPD_BUS_NUM 0/* The axp209 i2c bus is bus 0 */ -#define CONFIG_VIDEO_LCD_I2C_BUS -1/* NA, but necessary to compile */ -#endif -/* Ethernet support */ #ifdef CONFIG_USB_EHCI_HCD
Signature · 1 line
2.31.1
Re: [PATCH 10/11] sunxi: video: Convert panel I2C to use DM_I2C
Hello Samuel,
Quoted 15 lines · Samuel Holland
Two displays supported by the sunxi display driver (each one used by a single board) require initialization over I2C. Both previously used
i2c_soft; replace this with the i2c-gpio instance that already exists in those boards' device trees (sun5i-a13-utoo-p66 and sun6i-a31-colombus).Since the i2c-gpio nodes are not referenced by any other node in the device trees (the device trees have no panel node), the I2C bus is selected by its node name.
This panel initialization code was the only
i2c_softuser, so thei2c_softGPIO setup code can be removed now as well.Signed-off-by Samuel Holland <[email protected]>---
Quoted 9 lines
arch/arm/mach-sunxi/Kconfig | 22 ++---- board/sunxi/board.c | 44 +----------- configs/Colombus_defconfig | 6 -- configs/UTOO_P66_defconfig | 3 - drivers/video/anx9804.c | 107 ++++++++++++++-------------- drivers/video/anx9804.h | 5 +- drivers/video/sunxi/sunxi_display.c | 55 +++++++++----- include/configs/sunxi-common.h | 17 ----- 8 files changed, 102 insertions(+), 157 deletions(-)
bye,
Heiko
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: [email protected]
Samuel Holland
maintainerPATCH 11/11 sunxi: Enable DM_I2C for all sunxi boards
In reply to Samuel HollandNow that the last users of legacy I2C (outside of SPL) have been resolved, we can enable DM_I2C at the sunxi architecture level.
---
arch/arm/Kconfig | 1 + arch/arm/mach-sunxi/Kconfig | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-)
arch/arm/Kconfig +1 -0
@@ -1000,6 +1000,7 @@ config ARCH_SUNXI select DM select DM_ETH select DM_GPIO + select DM_I2C if I2C select DM_KEYBOARD select DM_MMC if MMC select DM_SCSI if SCSI
arch/arm/mach-sunxi/Kconfig +0 -3
@@ -165,7 +165,6 @@ endif config MACH_SUNXI_H3_H5 bool - select DM_I2C select PHY_SUN4I_USB select SUNXI_DE2 select SUNXI_DRAM_DW
@@ -322,7 +321,6 @@ config MACH_SUN50I bool "sun50i (Allwinner A64)" select ARM64 select SPI - select DM_I2C select DM_SPI if SPI select DM_SPI_FLASH select PHY_SUN4I_USB
@@ -929,7 +927,6 @@ config VIDEO_LCD_BL_PWM_ACTIVE_LOW config VIDEO_LCD_PANEL_I2C bool "LCD panel needs to be configured via i2c" depends on VIDEO_SUNXI - select DM_I2C select DM_I2C_GPIO ---help--- Say y here if the LCD panel needs to be configured via i2c. This
Signature · 1 line
2.31.1
Re: [PATCH 11/11] sunxi: Enable DM_I2C for all sunxi boards
Hello Samuel,
Quoted 9 lines · Samuel Holland
Now that the last users of legacy I2C (outside of SPL) have been resolved, we can enable
DM_I2Cat the sunxi architecture level.Signed-off-by Samuel Holland <[email protected]>---
arch/arm/Kconfig | 1 + arch/arm/mach-sunxi/Kconfig | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-)
Thanks!
bye,
Heiko
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: [email protected]