Lokesh Vutla | c7bfb85 | 2018-08-27 15:57:11 +0530 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
Nishanth Menon | eaa39c6 | 2023-11-01 15:56:03 -0500 | [diff] [blame] | 3 | * Copyright (C) 2018 Texas Instruments Incorporated - https://www.ti.com/ |
Lokesh Vutla | c7bfb85 | 2018-08-27 15:57:11 +0530 | [diff] [blame] | 4 | * Lokesh Vutla <lokeshvutla@ti.com> |
| 5 | */ |
| 6 | #ifndef _ASM_ARCH_HARDWARE_H_ |
| 7 | #define _ASM_ARCH_HARDWARE_H_ |
| 8 | |
Andrew Davis | 7d194c9 | 2023-04-06 11:38:11 -0500 | [diff] [blame] | 9 | #include <asm/io.h> |
| 10 | |
Jayesh Choudhary | 5060b87 | 2024-06-12 14:41:10 +0530 | [diff] [blame] | 11 | #ifdef CONFIG_SOC_K3_AM625 |
| 12 | #include "am62_hardware.h" |
Lokesh Vutla | c7bfb85 | 2018-08-27 15:57:11 +0530 | [diff] [blame] | 13 | #endif |
Lokesh Vutla | 6edde29 | 2019-06-13 10:29:43 +0530 | [diff] [blame] | 14 | |
Jayesh Choudhary | 5060b87 | 2024-06-12 14:41:10 +0530 | [diff] [blame] | 15 | #ifdef CONFIG_SOC_K3_AM62A7 |
| 16 | #include "am62a_hardware.h" |
Lokesh Vutla | 6edde29 | 2019-06-13 10:29:43 +0530 | [diff] [blame] | 17 | #endif |
Lokesh Vutla | a04cf3b | 2019-09-27 13:32:11 +0530 | [diff] [blame] | 18 | |
Jayesh Choudhary | 5060b87 | 2024-06-12 14:41:10 +0530 | [diff] [blame] | 19 | #ifdef CONFIG_SOC_K3_AM62P5 |
| 20 | #include "am62p_hardware.h" |
David Huang | 6109820 | 2022-01-25 20:56:31 +0530 | [diff] [blame] | 21 | #endif |
| 22 | |
Keerthy | 05d670e | 2021-04-23 11:27:33 -0500 | [diff] [blame] | 23 | #ifdef CONFIG_SOC_K3_AM642 |
| 24 | #include "am64_hardware.h" |
| 25 | #endif |
| 26 | |
Jayesh Choudhary | 5060b87 | 2024-06-12 14:41:10 +0530 | [diff] [blame] | 27 | #ifdef CONFIG_SOC_K3_AM654 |
| 28 | #include "am6_hardware.h" |
Suman Anna | 27fa412 | 2022-05-25 13:38:42 +0530 | [diff] [blame] | 29 | #endif |
| 30 | |
Jayesh Choudhary | 5060b87 | 2024-06-12 14:41:10 +0530 | [diff] [blame] | 31 | #ifdef CONFIG_SOC_K3_J721E |
| 32 | #include "j721e_hardware.h" |
| 33 | #endif |
| 34 | |
| 35 | #ifdef CONFIG_SOC_K3_J721S2 |
| 36 | #include "j721s2_hardware.h" |
Bryan Brattlof | daa39a6 | 2022-11-03 19:13:55 -0500 | [diff] [blame] | 37 | #endif |
| 38 | |
Apurva Nandan | 67ebc30 | 2024-02-24 01:51:41 +0530 | [diff] [blame] | 39 | #ifdef CONFIG_SOC_K3_J784S4 |
| 40 | #include "j784s4_hardware.h" |
| 41 | #endif |
| 42 | |
Bryan Brattlof | a4d5cc2 | 2024-03-12 15:20:24 -0500 | [diff] [blame] | 43 | |
Lokesh Vutla | a04cf3b | 2019-09-27 13:32:11 +0530 | [diff] [blame] | 44 | /* Assuming these addresses and definitions stay common across K3 devices */ |
Andrew Davis | 990ec70 | 2022-10-07 14:22:05 -0500 | [diff] [blame] | 45 | #define CTRLMMR_WKUP_JTAG_ID (WKUP_CTRL_MMR0_BASE + 0x14) |
Lokesh Vutla | a04cf3b | 2019-09-27 13:32:11 +0530 | [diff] [blame] | 46 | #define JTAG_ID_VARIANT_SHIFT 28 |
| 47 | #define JTAG_ID_VARIANT_MASK (0xf << 28) |
| 48 | #define JTAG_ID_PARTNO_SHIFT 12 |
Lokesh Vutla | b407587 | 2020-04-17 13:43:53 +0530 | [diff] [blame] | 49 | #define JTAG_ID_PARTNO_MASK (0xffff << 12) |
Apurva Nandan | 73775da | 2024-02-24 01:51:42 +0530 | [diff] [blame] | 50 | #define JTAG_ID_PARTNO_AM62AX 0xbb8d |
Bryan Brattlof | f0f6ce1 | 2024-03-12 15:20:19 -0500 | [diff] [blame] | 51 | #define JTAG_ID_PARTNO_AM62PX 0xbb9d |
Apurva Nandan | 73775da | 2024-02-24 01:51:42 +0530 | [diff] [blame] | 52 | #define JTAG_ID_PARTNO_AM62X 0xbb7e |
| 53 | #define JTAG_ID_PARTNO_AM64X 0xbb38 |
Andrew Davis | 7d194c9 | 2023-04-06 11:38:11 -0500 | [diff] [blame] | 54 | #define JTAG_ID_PARTNO_AM65X 0xbb5a |
Andrew Davis | 7d194c9 | 2023-04-06 11:38:11 -0500 | [diff] [blame] | 55 | #define JTAG_ID_PARTNO_J7200 0xbb6d |
Apurva Nandan | 73775da | 2024-02-24 01:51:42 +0530 | [diff] [blame] | 56 | #define JTAG_ID_PARTNO_J721E 0xbb64 |
Andrew Davis | 7d194c9 | 2023-04-06 11:38:11 -0500 | [diff] [blame] | 57 | #define JTAG_ID_PARTNO_J721S2 0xbb75 |
Jayesh Choudhary | ef18f77 | 2024-06-12 14:41:12 +0530 | [diff] [blame] | 58 | #define JTAG_ID_PARTNO_J722S 0xbba0 |
Apurva Nandan | 197dc2c | 2024-02-24 01:51:43 +0530 | [diff] [blame] | 59 | #define JTAG_ID_PARTNO_J784S4 0xbb80 |
Andrew Davis | 7d194c9 | 2023-04-06 11:38:11 -0500 | [diff] [blame] | 60 | |
| 61 | #define K3_SOC_ID(id, ID) \ |
| 62 | static inline bool soc_is_##id(void) \ |
| 63 | { \ |
| 64 | u32 soc = (readl(CTRLMMR_WKUP_JTAG_ID) & \ |
| 65 | JTAG_ID_PARTNO_MASK) >> JTAG_ID_PARTNO_SHIFT; \ |
| 66 | return soc == JTAG_ID_PARTNO_##ID; \ |
| 67 | } |
Andrew Davis | 7d194c9 | 2023-04-06 11:38:11 -0500 | [diff] [blame] | 68 | K3_SOC_ID(am62x, AM62X) |
| 69 | K3_SOC_ID(am62ax, AM62AX) |
Bryan Brattlof | f0f6ce1 | 2024-03-12 15:20:19 -0500 | [diff] [blame] | 70 | K3_SOC_ID(am62px, AM62PX) |
Jayesh Choudhary | 5060b87 | 2024-06-12 14:41:10 +0530 | [diff] [blame] | 71 | K3_SOC_ID(am64x, AM64X) |
| 72 | K3_SOC_ID(am65x, AM65X) |
| 73 | K3_SOC_ID(j7200, J7200) |
| 74 | K3_SOC_ID(j721e, J721E) |
| 75 | K3_SOC_ID(j721s2, J721S2) |
Jayesh Choudhary | ef18f77 | 2024-06-12 14:41:12 +0530 | [diff] [blame] | 76 | K3_SOC_ID(j722s, J722S) |
Andrew Davis | 7d194c9 | 2023-04-06 11:38:11 -0500 | [diff] [blame] | 77 | |
Andrew Davis | f8c9836 | 2022-07-15 11:34:32 -0500 | [diff] [blame] | 78 | #define K3_SEC_MGR_SYS_STATUS 0x44234100 |
| 79 | #define SYS_STATUS_DEV_TYPE_SHIFT 0 |
| 80 | #define SYS_STATUS_DEV_TYPE_MASK (0xf) |
| 81 | #define SYS_STATUS_DEV_TYPE_GP 0x3 |
| 82 | #define SYS_STATUS_DEV_TYPE_TEST 0x5 |
| 83 | #define SYS_STATUS_DEV_TYPE_EMU 0x9 |
| 84 | #define SYS_STATUS_DEV_TYPE_HS 0xa |
| 85 | #define SYS_STATUS_SUB_TYPE_SHIFT 8 |
| 86 | #define SYS_STATUS_SUB_TYPE_MASK (0xf << 8) |
| 87 | #define SYS_STATUS_SUB_TYPE_VAL_FS 0xa |
Lokesh Vutla | a04cf3b | 2019-09-27 13:32:11 +0530 | [diff] [blame] | 88 | |
Andrew Davis | 990ec70 | 2022-10-07 14:22:05 -0500 | [diff] [blame] | 89 | /* |
| 90 | * The CTRL_MMR0 memory space is divided into several equally-spaced |
| 91 | * partitions, so defining the partition size allows us to determine |
| 92 | * register addresses common to those partitions. |
| 93 | */ |
| 94 | #define CTRL_MMR0_PARTITION_SIZE 0x4000 |
| 95 | |
| 96 | /* |
| 97 | * CTRL_MMR0, WKUP_CTRL_MMR0, and MCU_CTRL_MMR0 lock/kick-mechanism |
| 98 | * shared register definitions. The same registers are also used for |
| 99 | * PADCFG_MMR lock/kick-mechanism. |
| 100 | */ |
| 101 | #define CTRLMMR_LOCK_KICK0 0x1008 |
| 102 | #define CTRLMMR_LOCK_KICK0_UNLOCK_VAL 0x68ef3490 |
| 103 | #define CTRLMMR_LOCK_KICK1 0x100c |
| 104 | #define CTRLMMR_LOCK_KICK1_UNLOCK_VAL 0xd172bc5a |
| 105 | |
Lokesh Vutla | 8e7bd01 | 2020-08-05 22:44:22 +0530 | [diff] [blame] | 106 | #define K3_ROM_BOOT_HEADER_MAGIC "EXTBOOT" |
| 107 | |
| 108 | struct rom_extended_boot_data { |
| 109 | char header[8]; |
| 110 | u32 num_components; |
| 111 | }; |
| 112 | |
Wadim Egorov | 3eab206 | 2024-04-03 15:59:10 +0200 | [diff] [blame] | 113 | u32 get_boot_device(void); |
Lokesh Vutla | c7bfb85 | 2018-08-27 15:57:11 +0530 | [diff] [blame] | 114 | #endif /* _ASM_ARCH_HARDWARE_H_ */ |