stm32mp: stm32prog: add pmic NVM update support

Add a virtual partition to update the pmic non volatile memory.
(on ST board, STPMIC1).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
This commit is contained in:
Patrick Delaunay 2020-03-18 09:24:59 +01:00
parent 936f1aea80
commit 6ce1f4ad8d
3 changed files with 115 additions and 1 deletions

View file

@ -12,6 +12,7 @@
#define PHASE_LAST_USER 0xF0
#define PHASE_CMD 0xF1
#define PHASE_OTP 0xF2
#define PHASE_PMIC 0xF4
#define PHASE_END 0xFE
#define PHASE_RESET 0xFF
#define PHASE_DO_RESET 0x1FF
@ -19,6 +20,7 @@
#define DEFAULT_ADDRESS 0xFFFFFFFF
#define OTP_SIZE 1024
#define PMIC_SIZE 8
enum stm32prog_target {
STM32PROG_NONE,
@ -120,6 +122,7 @@ struct stm32prog_data {
char error[255];
struct stm32prog_part_t *cur_part;
u32 *otp_part;
u8 pmic_part[PMIC_SIZE];
/* STM32 header information */
struct raw_header_s *header_data;
@ -135,6 +138,13 @@ int stm32prog_otp_read(struct stm32prog_data *data, u32 offset,
u8 *buffer, long *size);
int stm32prog_otp_start(struct stm32prog_data *data);
/* PMIC access */
int stm32prog_pmic_write(struct stm32prog_data *data, u32 offset,
u8 *buffer, long *size);
int stm32prog_pmic_read(struct stm32prog_data *data, u32 offset,
u8 *buffer, long *size);
int stm32prog_pmic_start(struct stm32prog_data *data);
/* generic part*/
u8 stm32prog_header_check(struct raw_header_s *raw_header,
struct image_header_s *header);