summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSandrine Bailleux <sandrine.bailleux@arm.com>2019-12-17 09:32:26 +0000
committerTrustedFirmware Code Review <review@review.trustedfirmware.org>2019-12-17 09:32:26 +0000
commit2f3abc19d3edbd0c3789f3a97628745ac454bd51 (patch)
tree9fb18f9b612e53c6a563079aa3f6f0f7831f1e6a /include
parent52ff3b4c79a3a10a7ece02d914bc4609354df721 (diff)
parent0bc752c9adedbda4434fddf68d3bc18c5274360b (diff)
downloadarm-trusted-firmware-2f3abc19d3edbd0c3789f3a97628745ac454bd51.tar.gz
Merge changes from topic "allwinner_pmic" into integration
* changes: allwinner: Convert AXP803 regulator setup code into a driver allwinner: a64: power: Use fdt_for_each_subnode allwinner: a64: power: Remove obsolete register check allwinner: a64: power: Remove duplicate DT check allwinner: Build PMIC bus drivers only in BL31 allwinner: a64: power: Make sunxi_turn_off_soc static allwinner: Merge duplicate code in sunxi_power_down allwinner: Clean up PMIC-related error handling allwinner: Synchronize PMIC enumerations allwinner: Enable clock before resetting I2C/RSB
Diffstat (limited to 'include')
-rw-r--r--include/drivers/allwinner/axp.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/include/drivers/allwinner/axp.h b/include/drivers/allwinner/axp.h
new file mode 100644
index 000000000..f3d6277cb
--- /dev/null
+++ b/include/drivers/allwinner/axp.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef AXP_H
+#define AXP_H
+
+#include <stdint.h>
+
+#define NA 0xff
+
+enum {
+ AXP803_CHIP_ID = 0x41,
+};
+
+struct axp_regulator {
+ const char *dt_name;
+ uint16_t min_volt;
+ uint16_t max_volt;
+ uint16_t step;
+ unsigned char split;
+ unsigned char volt_reg;
+ unsigned char switch_reg;
+ unsigned char switch_bit;
+};
+
+extern const uint8_t axp_chip_id;
+extern const char *const axp_compatible;
+extern const struct axp_regulator axp_regulators[];
+
+/*
+ * Since the PMIC can be connected to multiple bus types,
+ * low-level read/write functions must be provided by the platform
+ */
+int axp_read(uint8_t reg);
+int axp_write(uint8_t reg, uint8_t val);
+int axp_clrsetbits(uint8_t reg, uint8_t clr_mask, uint8_t set_mask);
+#define axp_clrbits(reg, clr_mask) axp_clrsetbits(reg, clr_mask, 0)
+#define axp_setbits(reg, set_mask) axp_clrsetbits(reg, 0, set_mask)
+
+int axp_check_id(void);
+void axp_power_off(void);
+void axp_setup_regulators(const void *fdt);
+
+#endif /* AXP_H */