Tom Rini | 8b0c8a1 | 2018-05-06 18:27:01 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */ |
Patrick Delaunay | 01e3afe | 2018-03-19 19:09:21 +0100 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2015-2017, STMicroelectronics - All Rights Reserved |
Patrick Delaunay | 01e3afe | 2018-03-19 19:09:21 +0100 | [diff] [blame] | 4 | */ |
| 5 | |
Patrick Delaunay | 123687c | 2022-05-20 18:24:46 +0200 | [diff] [blame] | 6 | /* ID = Device Version (bit31:16) + Device Part Number (RPN) (bit15:0) */ |
Patrick Delaunay | 45c82d2 | 2019-02-27 17:01:13 +0100 | [diff] [blame] | 7 | #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 Delaunay | db33b0e | 2020-02-26 11:26:43 +0100 | [diff] [blame] | 13 | #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 Delaunay | 01e3afe | 2018-03-19 19:09:21 +0100 | [diff] [blame] | 19 | |
Patrick Delaunay | 123687c | 2022-05-20 18:24:46 +0200 | [diff] [blame] | 20 | #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 | |
Patrick Delaunay | 45c82d2 | 2019-02-27 17:01:13 +0100 | [diff] [blame] | 33 | /* return CPU_STMP32MP...Xxx constants */ |
Patrick Delaunay | 01e3afe | 2018-03-19 19:09:21 +0100 | [diff] [blame] | 34 | u32 get_cpu_type(void); |
| 35 | |
Patrick Delaunay | 79bc640 | 2020-03-18 09:24:48 +0100 | [diff] [blame] | 36 | #define CPU_DEV_STM32MP15 0x500 |
Patrick Delaunay | 123687c | 2022-05-20 18:24:46 +0200 | [diff] [blame] | 37 | #define CPU_DEV_STM32MP13 0x501 |
Patrick Delaunay | 79bc640 | 2020-03-18 09:24:48 +0100 | [diff] [blame] | 38 | |
| 39 | /* return CPU_DEV constants */ |
| 40 | u32 get_cpu_dev(void); |
| 41 | |
Patrick Delaunay | 9203359 | 2022-04-15 15:00:43 +0200 | [diff] [blame] | 42 | #define CPU_REV1 0x1000 |
| 43 | #define CPU_REV1_1 0x1001 |
Patrick Delaunay | 95b0276 | 2022-06-30 10:20:16 +0200 | [diff] [blame] | 44 | #define CPU_REV1_2 0x1003 |
Patrick Delaunay | 9203359 | 2022-04-15 15:00:43 +0200 | [diff] [blame] | 45 | #define CPU_REV2 0x2000 |
| 46 | #define CPU_REV2_1 0x2001 |
Patrick Delaunay | c4a76ff | 2023-04-27 15:36:33 +0200 | [diff] [blame] | 47 | #define CPU_REV2_2 0x2003 |
Patrick Delaunay | 01e3afe | 2018-03-19 19:09:21 +0100 | [diff] [blame] | 48 | |
Patrick Delaunay | 9203359 | 2022-04-15 15:00:43 +0200 | [diff] [blame] | 49 | /* return Silicon revision = REV_ID[15:0] of Device Version */ |
Patrick Delaunay | 01e3afe | 2018-03-19 19:09:21 +0100 | [diff] [blame] | 50 | u32 get_cpu_rev(void); |
Patrick Delaunay | c74d634 | 2019-07-05 17:20:13 +0200 | [diff] [blame] | 51 | |
| 52 | /* Get Package options from OTP */ |
| 53 | u32 get_cpu_package(void); |
| 54 | |
Patrick Delaunay | e4bdd54 | 2022-05-20 18:24:42 +0200 | [diff] [blame] | 55 | /* package used for STM32MP15x */ |
| 56 | #define STM32MP15_PKG_AA_LBGA448 4 |
| 57 | #define STM32MP15_PKG_AB_LBGA354 3 |
| 58 | #define STM32MP15_PKG_AC_TFBGA361 2 |
| 59 | #define STM32MP15_PKG_AD_TFBGA257 1 |
| 60 | #define STM32MP15_PKG_UNKNOWN 0 |
Patrick Delaunay | c74d634 | 2019-07-05 17:20:13 +0200 | [diff] [blame] | 61 | |
Patrick Delaunay | 3e738f2 | 2020-02-12 19:37:43 +0100 | [diff] [blame] | 62 | /* Get SOC name */ |
| 63 | #define SOC_NAME_SIZE 20 |
| 64 | void get_soc_name(char name[SOC_NAME_SIZE]); |
| 65 | |
Patrick Delaunay | 18660a6 | 2019-02-27 17:01:12 +0100 | [diff] [blame] | 66 | /* return boot mode */ |
| 67 | u32 get_bootmode(void); |
Marek Vasut | 187cae2 | 2019-12-18 16:52:19 +0100 | [diff] [blame] | 68 | |
Patrick Delaunay | 6425f58 | 2022-05-20 18:24:47 +0200 | [diff] [blame] | 69 | int get_eth_nb(void); |
Marek Vasut | 187cae2 | 2019-12-18 16:52:19 +0100 | [diff] [blame] | 70 | int setup_mac_address(void); |
Patrick Delaunay | 3d1fe4e | 2020-05-25 12:19:45 +0200 | [diff] [blame] | 71 | |
| 72 | /* board power management : configure vddcore according OPP */ |
| 73 | void board_vddcore_init(u32 voltage_mv); |
Patrick Delaunay | 9fa24a5 | 2022-05-20 18:24:41 +0200 | [diff] [blame] | 74 | |
Patrick Delaunay | e4bdd54 | 2022-05-20 18:24:42 +0200 | [diff] [blame] | 75 | /* weak function */ |
| 76 | void stm32mp_cpu_init(void); |
| 77 | void stm32mp_misc_init(void); |
| 78 | |
Patrick Delaunay | 9fa24a5 | 2022-05-20 18:24:41 +0200 | [diff] [blame] | 79 | /* helper function: read data from OTP */ |
| 80 | u32 get_otp(int index, int shift, int mask); |
Marek Vasut | efdedcb | 2023-01-12 18:58:40 +0100 | [diff] [blame] | 81 | |
| 82 | uintptr_t get_stm32mp_rom_api_table(void); |
| 83 | uintptr_t get_stm32mp_bl2_dtb(void); |