blob: bf1c39742c120ba01bea04a032496baa7ff5d4bb [file] [log] [blame]
Tom Rini8b0c8a12018-05-06 18:27:01 -04001/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
Patrick Delaunay01e3afe2018-03-19 19:09:21 +01002/*
3 * Copyright (C) 2015-2017, STMicroelectronics - All Rights Reserved
Patrick Delaunay01e3afe2018-03-19 19:09:21 +01004 */
5
Patrick Delaunay123687c2022-05-20 18:24:46 +02006/* ID = Device Version (bit31:16) + Device Part Number (RPN) (bit15:0) */
Patrick Delaunay45c82d22019-02-27 17:01:13 +01007#define CPU_STM32MP157Cxx 0x05000000
8#define CPU_STM32MP157Axx 0x05000001
9#define CPU_STM32MP153Cxx 0x05000024
10#define CPU_STM32MP153Axx 0x05000025
11#define CPU_STM32MP151Cxx 0x0500002E
12#define CPU_STM32MP151Axx 0x0500002F
Patrick Delaunaydb33b0e2020-02-26 11:26:43 +010013#define CPU_STM32MP157Fxx 0x05000080
14#define CPU_STM32MP157Dxx 0x05000081
15#define CPU_STM32MP153Fxx 0x050000A4
16#define CPU_STM32MP153Dxx 0x050000A5
17#define CPU_STM32MP151Fxx 0x050000AE
18#define CPU_STM32MP151Dxx 0x050000AF
Patrick Delaunay01e3afe2018-03-19 19:09:21 +010019
Patrick Delaunay123687c2022-05-20 18:24:46 +020020#define CPU_STM32MP135Cxx 0x05010000
21#define CPU_STM32MP135Axx 0x05010001
22#define CPU_STM32MP133Cxx 0x050100C0
23#define CPU_STM32MP133Axx 0x050100C1
24#define CPU_STM32MP131Cxx 0x050106C8
25#define CPU_STM32MP131Axx 0x050106C9
26#define CPU_STM32MP135Fxx 0x05010800
27#define CPU_STM32MP135Dxx 0x05010801
28#define CPU_STM32MP133Fxx 0x050108C0
29#define CPU_STM32MP133Dxx 0x050108C1
30#define CPU_STM32MP131Fxx 0x05010EC8
31#define CPU_STM32MP131Dxx 0x05010EC9
32
Patrice Chotardd29531c2023-10-27 16:43:04 +020033/* ID for STM32MP25x = Device Part Number (RPN) (bit31:0) */
34#define CPU_STM32MP257Cxx 0x00002000
35#define CPU_STM32MP255Cxx 0x00082000
36#define CPU_STM32MP253Cxx 0x000B2004
37#define CPU_STM32MP251Cxx 0x000B3065
38#define CPU_STM32MP257Axx 0x40002E00
39#define CPU_STM32MP255Axx 0x40082E00
40#define CPU_STM32MP253Axx 0x400B2E04
41#define CPU_STM32MP251Axx 0x400B3E65
42#define CPU_STM32MP257Fxx 0x80002000
43#define CPU_STM32MP255Fxx 0x80082000
44#define CPU_STM32MP253Fxx 0x800B2004
45#define CPU_STM32MP251Fxx 0x800B3065
46#define CPU_STM32MP257Dxx 0xC0002E00
47#define CPU_STM32MP255Dxx 0xC0082E00
48#define CPU_STM32MP253Dxx 0xC00B2E04
49#define CPU_STM32MP251Dxx 0xC00B3E65
50
Patrick Delaunay45c82d22019-02-27 17:01:13 +010051/* return CPU_STMP32MP...Xxx constants */
Patrick Delaunay01e3afe2018-03-19 19:09:21 +010052u32 get_cpu_type(void);
53
Patrick Delaunay79bc6402020-03-18 09:24:48 +010054#define CPU_DEV_STM32MP15 0x500
Patrick Delaunay123687c2022-05-20 18:24:46 +020055#define CPU_DEV_STM32MP13 0x501
Patrice Chotardd29531c2023-10-27 16:43:04 +020056#define CPU_DEV_STM32MP25 0x505
Patrick Delaunay79bc6402020-03-18 09:24:48 +010057
58/* return CPU_DEV constants */
59u32 get_cpu_dev(void);
60
Patrick Delaunayf296fd22024-03-19 20:14:27 +010061/* Silicon revision = REV_ID[15:0] of Device Version */
Patrick Delaunay92033592022-04-15 15:00:43 +020062#define CPU_REV1 0x1000
63#define CPU_REV1_1 0x1001
Patrick Delaunay95b02762022-06-30 10:20:16 +020064#define CPU_REV1_2 0x1003
Patrick Delaunay92033592022-04-15 15:00:43 +020065#define CPU_REV2 0x2000
66#define CPU_REV2_1 0x2001
Patrick Delaunayc4a76ff2023-04-27 15:36:33 +020067#define CPU_REV2_2 0x2003
Patrick Delaunay01e3afe2018-03-19 19:09:21 +010068
Patrick Delaunayf296fd22024-03-19 20:14:27 +010069/* OTP revision ID = 6 bits : 3 for Major / 3 for Minor */
70#define OTP_REVID_1 0b001000
71#define OTP_REVID_1_1 0b001001
72#define OTP_REVID_1_2 0b001010
73#define OTP_REVID_2 0b010000
74#define OTP_REVID_2_1 0b010001
75#define OTP_REVID_2_2 0b010010
76
77/* return SoC revision = Silicon revision (STM32MP1) or OTP revision ID (STM32MP2)*/
Patrick Delaunay01e3afe2018-03-19 19:09:21 +010078u32 get_cpu_rev(void);
Patrick Delaunayc74d6342019-07-05 17:20:13 +020079
80/* Get Package options from OTP */
81u32 get_cpu_package(void);
82
Patrick Delaunaye4bdd542022-05-20 18:24:42 +020083/* package used for STM32MP15x */
84#define STM32MP15_PKG_AA_LBGA448 4
85#define STM32MP15_PKG_AB_LBGA354 3
86#define STM32MP15_PKG_AC_TFBGA361 2
87#define STM32MP15_PKG_AD_TFBGA257 1
88#define STM32MP15_PKG_UNKNOWN 0
Patrick Delaunayc74d6342019-07-05 17:20:13 +020089
Patrice Chotardd29531c2023-10-27 16:43:04 +020090/* package used for STM32MP25x */
91#define STM32MP25_PKG_CUSTOM 0
Patrice Chotarde9acbc32024-07-04 15:54:35 +020092#define STM32MP25_PKG_AL_VFBGA361 1
93#define STM32MP25_PKG_AK_VFBGA424 3
94#define STM32MP25_PKG_AI_TFBGA436 5
Patrice Chotardd29531c2023-10-27 16:43:04 +020095#define STM32MP25_PKG_UNKNOWN 7
96
Patrick Delaunay3e738f22020-02-12 19:37:43 +010097/* Get SOC name */
98#define SOC_NAME_SIZE 20
99void get_soc_name(char name[SOC_NAME_SIZE]);
100
Patrick Delaunay18660a62019-02-27 17:01:12 +0100101/* return boot mode */
102u32 get_bootmode(void);
Marek Vasut187cae22019-12-18 16:52:19 +0100103
Igor Opaniuk100e0ec2023-11-06 11:41:52 +0100104/* return auth status and partition */
105u32 get_bootauth(void);
106
Patrick Delaunay6425f582022-05-20 18:24:47 +0200107int get_eth_nb(void);
Marek Vasut187cae22019-12-18 16:52:19 +0100108int setup_mac_address(void);
Patrice Chotard539fec32024-01-15 15:05:50 +0100109int setup_serial_number(void);
Patrick Delaunay3d1fe4e2020-05-25 12:19:45 +0200110
111/* board power management : configure vddcore according OPP */
112void board_vddcore_init(u32 voltage_mv);
Patrick Delaunay9fa24a52022-05-20 18:24:41 +0200113
Patrick Delaunaye4bdd542022-05-20 18:24:42 +0200114/* weak function */
115void stm32mp_cpu_init(void);
116void stm32mp_misc_init(void);
117
Patrick Delaunay9fa24a52022-05-20 18:24:41 +0200118/* helper function: read data from OTP */
119u32 get_otp(int index, int shift, int mask);
Marek Vasutefdedcb2023-01-12 18:58:40 +0100120
121uintptr_t get_stm32mp_rom_api_table(void);
122uintptr_t get_stm32mp_bl2_dtb(void);