diff options
author | Samuel Holland <samuel@sholland.org> | 2021-10-08 00:17:21 -0500 |
---|---|---|
committer | Andre Przywara <andre.przywara@arm.com> | 2021-10-12 10:19:18 +0100 |
commit | 3227c85fe76312290c3ec15a02dcba3f9c6bc399 (patch) | |
tree | 1b7f74ecdbf023f730d21a706fe7f9476cb8f14f /include/axp_pmic.h | |
parent | 104950a7feae7926e40676f27cfbd279a43b4bc3 (diff) | |
download | u-boot-3227c85fe76312290c3ec15a02dcba3f9c6bc399.tar.gz |
i2c: Add a DM_I2C driver for the sun8i RSB 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.
Refactor the rsb functions to take the base address as a parameter,
and implement both the existing interface (which is still needed in
SPL) and the DM_I2C interface on top of them.
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 <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Diffstat (limited to 'include/axp_pmic.h')
-rw-r--r-- | include/axp_pmic.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/axp_pmic.h b/include/axp_pmic.h index 0db3e143eda..46a017d2efa 100644 --- a/include/axp_pmic.h +++ b/include/axp_pmic.h @@ -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 0x3a int axp_set_dcdc1(unsigned int mvolt); int axp_set_dcdc2(unsigned int mvolt); |