summaryrefslogtreecommitdiff
path: root/include/axp_pmic.h
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2021-10-08 08:17:20 +0300
committerAndre Przywara <andre.przywara@arm.com>2021-10-12 11:50:56 +0300
commit104950a7feae7926e40676f27cfbd279a43b4bc3 (patch)
treece45115b87c8d40491d8b1e3e44fcb1aaf050901 /include/axp_pmic.h
parent4ab39e74b640799748dfdef49f099b416a5ae497 (diff)
downloadu-boot-104950a7feae7926e40676f27cfbd279a43b4bc3.tar.xz
i2c: Add a DM_I2C driver 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. Refactor the p2wi 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. Move that to the common header, so it can be used by both interface implementations. 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.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/axp_pmic.h b/include/axp_pmic.h
index 405044c3a3..0db3e143ed 100644
--- a/include/axp_pmic.h
+++ b/include/axp_pmic.h
@@ -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);