arm-trusted-firmware/drivers/allwinner/axp/axp805.c
Andre Przywara 67412e4d7a feat(allwinner): allow to skip PMIC regulator setup
For somewhat historical reasons we are doing some initial PMIC regulator
setup in BL31, as U-Boot does not (yet) have a PMIC driver. This worked
fine so far, but there is at least one board (OrangePi 3) that gets upset,
because the Ethernet PHY needs some *coordinated* bringup of *two*
regulators.

To avoid custom hacks, let's introduce a build option to keep doing the
regulator setup in TF-A. Defining SUNXI_SETUP_REGULATORS to 0 will break
support for some devices on some boards in U-Boot (Ethernet and HDMI),
but will allow to bring up the OrangePi 3 in Linux correctly. We keep
the default at 1 to not change the behaviour for all other boards.

After U-Boot gained proper PMIC support at some point in the future, we
will probably change the default to 0, to get rid of the less optimal
PMIC code in TF-A.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Change-Id: Ie8e2583d0396f6eeaae8ffe6b6190f27db63e2a7
2021-12-27 15:32:22 +00:00

35 lines
1.2 KiB
C

/*
* Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <drivers/allwinner/axp.h>
const uint8_t axp_chip_id = AXP805_CHIP_ID;
const char *const axp_compatible = "x-powers,axp805";
#if SUNXI_SETUP_REGULATORS == 1
/*
* The "dcdcd" split changes the step size by a factor of 5, not 2;
* disallow values above the split to maintain accuracy.
*/
const struct axp_regulator axp_regulators[] = {
{"dcdca", 600, 1520, 10, 50, 0x12, 0x10, 0},
{"dcdcb", 1000, 2550, 50, NA, 0x13, 0x10, 1},
{"dcdcc", 600, 1520, 10, 50, 0x14, 0x10, 2},
{"dcdcd", 600, 1500, 20, NA, 0x15, 0x10, 3},
{"dcdce", 1100, 3400, 100, NA, 0x16, 0x10, 4},
{"aldo1", 700, 3300, 100, NA, 0x17, 0x10, 5},
{"aldo2", 700, 3300, 100, NA, 0x18, 0x10, 6},
{"aldo3", 700, 3300, 100, NA, 0x19, 0x10, 7},
{"bldo1", 700, 1900, 100, NA, 0x20, 0x11, 0},
{"bldo2", 700, 1900, 100, NA, 0x21, 0x11, 1},
{"bldo3", 700, 1900, 100, NA, 0x22, 0x11, 2},
{"bldo4", 700, 1900, 100, NA, 0x23, 0x11, 3},
{"cldo1", 700, 3300, 100, NA, 0x24, 0x11, 4},
{"cldo2", 700, 4200, 100, 27, 0x25, 0x11, 5},
{"cldo3", 700, 3300, 100, NA, 0x26, 0x11, 6},
{}
};
#endif