feat(allwinner): h616: add support for AXP717 PMIC

On at least one new device we see an Allwinner H700 SoC paired with the
X-Powers AXP717 PMIC. In contrast to the small AXP313, this is a quite
complete PMIC, with many voltage rails, battery and USB-C charging
support. It supports both RSB and I2C control options.

Add the compatible string to the list of checked devices. The AXP717
apparently does not feature a version ID register, but we read 0xff from
that address 0x3, so use this as an indication of its presence, since
this value differs from what we read from the other PMICs.
The register offset and bit position for the power off functionality is
again different, but easy to put into our switch/case.

Setting up regulators in TF-A is now somewhat obsolete, since U-Boot
does a much better job in this now, and can figure out which regulators
are actually needed. So we don't add the regulator setup code, and just
use the PMIC for the power-off functionality.

Change-Id: Ie6b4c91517014adcc79d9a3459c75545fa3a63e6
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
This commit is contained in:
Andre Przywara 2024-03-21 14:19:14 +00:00 committed by André Przywara
parent 03851367db
commit 646d06b237

View file

@ -34,11 +34,13 @@ static enum pmic_type {
UNKNOWN,
AXP305,
AXP313,
AXP717,
} pmic;
static uint8_t get_rsb_rt_address(uint16_t hw_addr)
{
switch (hw_addr) {
case 0x3a3: return 0x2d;
case 0x745: return 0x3a;
}
@ -154,6 +156,13 @@ int sunxi_pmic_setup(uint16_t socid, const void *fdt)
}
}
if (pmic == UNKNOWN) {
node = fdt_node_offset_by_compatible(fdt, 0, "x-powers,axp717");
if (node >= 0) {
pmic = AXP717;
}
}
if (pmic == UNKNOWN) {
INFO("PMIC: No known PMIC in DT, skipping setup.\n");
return -ENODEV;
@ -203,6 +212,14 @@ int sunxi_pmic_setup(uint16_t socid, const void *fdt)
pmic = UNKNOWN;
}
break;
case 0xcf: /* version reg not implemented on AXP717 */
if (pmic == AXP717) {
INFO("PMIC: found AXP717\n");
/* no regulators to set up, U-Boot takes care of this */
} else {
pmic = UNKNOWN;
}
break;
}
if (is_using_rsb()) {
@ -239,6 +256,9 @@ void sunxi_power_down(void)
case AXP313:
axp_setbits(0x1a, BIT(7));
break;
case AXP717:
axp_setbits(0x27, BIT(0));
break;
default:
break;
}