blob: 8b61135aebaee191daecb56c6caddb601f20a42a [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 Delaunaydb33b0e2020-02-26 11:26:43 +01006/* ID = Device Version (bit31:16) + Device Part Number (RPN) (bit7: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 Delaunay45c82d22019-02-27 17:01:13 +010020/* return CPU_STMP32MP...Xxx constants */
Patrick Delaunay01e3afe2018-03-19 19:09:21 +010021u32 get_cpu_type(void);
22
Patrick Delaunay79bc6402020-03-18 09:24:48 +010023#define CPU_DEV_STM32MP15 0x500
24
25/* return CPU_DEV constants */
26u32 get_cpu_dev(void);
27
Patrick Delaunay92033592022-04-15 15:00:43 +020028#define CPU_REV1 0x1000
29#define CPU_REV1_1 0x1001
30#define CPU_REV2 0x2000
31#define CPU_REV2_1 0x2001
Patrick Delaunay01e3afe2018-03-19 19:09:21 +010032
Patrick Delaunay92033592022-04-15 15:00:43 +020033/* return Silicon revision = REV_ID[15:0] of Device Version */
Patrick Delaunay01e3afe2018-03-19 19:09:21 +010034u32 get_cpu_rev(void);
Patrick Delaunayc74d6342019-07-05 17:20:13 +020035
36/* Get Package options from OTP */
37u32 get_cpu_package(void);
38
Patrick Delaunaye4bdd542022-05-20 18:24:42 +020039/* package used for STM32MP15x */
40#define STM32MP15_PKG_AA_LBGA448 4
41#define STM32MP15_PKG_AB_LBGA354 3
42#define STM32MP15_PKG_AC_TFBGA361 2
43#define STM32MP15_PKG_AD_TFBGA257 1
44#define STM32MP15_PKG_UNKNOWN 0
Patrick Delaunayc74d6342019-07-05 17:20:13 +020045
Patrick Delaunay3e738f22020-02-12 19:37:43 +010046/* Get SOC name */
47#define SOC_NAME_SIZE 20
48void get_soc_name(char name[SOC_NAME_SIZE]);
49
Patrick Delaunay18660a62019-02-27 17:01:12 +010050/* return boot mode */
51u32 get_bootmode(void);
Marek Vasut187cae22019-12-18 16:52:19 +010052
53int setup_mac_address(void);
Patrick Delaunay3d1fe4e2020-05-25 12:19:45 +020054
55/* board power management : configure vddcore according OPP */
56void board_vddcore_init(u32 voltage_mv);
Patrick Delaunay9fa24a52022-05-20 18:24:41 +020057
Patrick Delaunaye4bdd542022-05-20 18:24:42 +020058/* weak function */
59void stm32mp_cpu_init(void);
60void stm32mp_misc_init(void);
61
Patrick Delaunay9fa24a52022-05-20 18:24:41 +020062/* helper function: read data from OTP */
63u32 get_otp(int index, int shift, int mask);