Yann Gautier | bb836ee | 2018-07-16 17:55:07 +0200 | [diff] [blame] | 1 | /* |
Yann Gautier | e05e8cf | 2022-01-18 15:49:42 +0100 | [diff] [blame] | 2 | * Copyright (c) 2017-2022, STMicroelectronics - All Rights Reserved |
Yann Gautier | bb836ee | 2018-07-16 17:55:07 +0200 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
Yann Gautier | a45433b | 2019-01-16 18:31:00 +0100 | [diff] [blame] | 7 | #ifndef STM32MP_PMIC_H |
| 8 | #define STM32MP_PMIC_H |
Yann Gautier | bb836ee | 2018-07-16 17:55:07 +0200 | [diff] [blame] | 9 | |
| 10 | #include <stdbool.h> |
| 11 | |
Yann Gautier | 57e282b | 2019-01-07 11:17:24 +0100 | [diff] [blame] | 12 | #include <platform_def.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 13 | |
Yann Gautier | f3928f6 | 2019-02-14 11:15:03 +0100 | [diff] [blame] | 14 | /* |
| 15 | * dt_pmic_status - Check PMIC status from device tree |
| 16 | * |
| 17 | * Returns the status of the PMIC (secure, non-secure), or a negative value on |
| 18 | * error |
| 19 | */ |
| 20 | int dt_pmic_status(void); |
| 21 | |
| 22 | /* |
Yann Gautier | f3928f6 | 2019-02-14 11:15:03 +0100 | [diff] [blame] | 23 | * initialize_pmic_i2c - Initialize I2C for the PMIC control |
| 24 | * |
| 25 | * Returns true if PMIC is available, false if not found, panics on errors |
| 26 | */ |
| 27 | bool initialize_pmic_i2c(void); |
| 28 | |
| 29 | /* |
| 30 | * initialize_pmic - Main PMIC initialization function, called at platform init |
| 31 | * |
| 32 | * Panics on errors |
| 33 | */ |
Yann Gautier | bb836ee | 2018-07-16 17:55:07 +0200 | [diff] [blame] | 34 | void initialize_pmic(void); |
Yann Gautier | f3928f6 | 2019-02-14 11:15:03 +0100 | [diff] [blame] | 35 | |
Nicolas Le Bayon | 0b10b65 | 2019-11-18 13:13:36 +0100 | [diff] [blame] | 36 | #if DEBUG |
| 37 | void print_pmic_info_and_debug(void); |
| 38 | #else |
| 39 | static inline void print_pmic_info_and_debug(void) |
| 40 | { |
| 41 | } |
| 42 | #endif |
| 43 | |
Yann Gautier | f3928f6 | 2019-02-14 11:15:03 +0100 | [diff] [blame] | 44 | /* |
| 45 | * pmic_ddr_power_init - Initialize regulators required for DDR |
| 46 | * |
| 47 | * Returns 0 on success, and negative values on errors |
| 48 | */ |
Yann Gautier | bb836ee | 2018-07-16 17:55:07 +0200 | [diff] [blame] | 49 | int pmic_ddr_power_init(enum ddr_type ddr_type); |
| 50 | |
Yann Gautier | e05e8cf | 2022-01-18 15:49:42 +0100 | [diff] [blame] | 51 | /* |
| 52 | * pmic_voltages_init - Update voltages for platform init |
| 53 | * |
| 54 | * Returns 0 on success, and negative values on errors |
| 55 | */ |
| 56 | int pmic_voltages_init(void); |
| 57 | |
Yann Gautier | a45433b | 2019-01-16 18:31:00 +0100 | [diff] [blame] | 58 | #endif /* STM32MP_PMIC_H */ |