mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-16 17:44:19 +00:00

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
59 lines
1.3 KiB
C
59 lines
1.3 KiB
C
/*
|
|
* 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 AXP20X_MODE_REG 0x3e
|
|
#define AXP20X_MODE_I2C 0x00
|
|
#define AXP20X_MODE_RSB 0x7c
|
|
|
|
#define NA 0xff
|
|
|
|
enum {
|
|
AXP803_CHIP_ID = 0x41,
|
|
AXP805_CHIP_ID = 0x40,
|
|
};
|
|
|
|
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);
|
|
|
|
#if SUNXI_SETUP_REGULATORS == 1
|
|
void axp_setup_regulators(const void *fdt);
|
|
#else
|
|
static inline void axp_setup_regulators(const void *fdt)
|
|
{
|
|
}
|
|
#endif
|
|
|
|
#endif /* AXP_H */
|