blob: b191d53a0f580aacd9283f06f057b47858864fe5 [file] [log] [blame]
Lokesh Vutlac7bfb852018-08-27 15:57:11 +05301/* SPDX-License-Identifier: GPL-2.0+ */
2/*
Nishanth Menoneaa39c62023-11-01 15:56:03 -05003 * Copyright (C) 2018 Texas Instruments Incorporated - https://www.ti.com/
Lokesh Vutlac7bfb852018-08-27 15:57:11 +05304 * Lokesh Vutla <lokeshvutla@ti.com>
5 */
6#ifndef _ASM_ARCH_HARDWARE_H_
7#define _ASM_ARCH_HARDWARE_H_
8
Andrew Davis7d194c92023-04-06 11:38:11 -05009#include <asm/io.h>
10
Jayesh Choudhary5060b872024-06-12 14:41:10 +053011#ifdef CONFIG_SOC_K3_AM625
12#include "am62_hardware.h"
Lokesh Vutlac7bfb852018-08-27 15:57:11 +053013#endif
Lokesh Vutla6edde292019-06-13 10:29:43 +053014
Jayesh Choudhary5060b872024-06-12 14:41:10 +053015#ifdef CONFIG_SOC_K3_AM62A7
16#include "am62a_hardware.h"
Lokesh Vutla6edde292019-06-13 10:29:43 +053017#endif
Lokesh Vutlaa04cf3b2019-09-27 13:32:11 +053018
Jayesh Choudhary5060b872024-06-12 14:41:10 +053019#ifdef CONFIG_SOC_K3_AM62P5
20#include "am62p_hardware.h"
David Huang61098202022-01-25 20:56:31 +053021#endif
22
Keerthy05d670e2021-04-23 11:27:33 -050023#ifdef CONFIG_SOC_K3_AM642
24#include "am64_hardware.h"
25#endif
26
Jayesh Choudhary5060b872024-06-12 14:41:10 +053027#ifdef CONFIG_SOC_K3_AM654
28#include "am6_hardware.h"
Suman Anna27fa4122022-05-25 13:38:42 +053029#endif
30
Jayesh Choudhary5060b872024-06-12 14:41:10 +053031#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 Brattlofdaa39a62022-11-03 19:13:55 -050037#endif
38
Jayesh Choudhary732d2ff2024-06-12 14:41:18 +053039#ifdef CONFIG_SOC_K3_J722S
40#include "j722s_hardware.h"
41#endif
42
Apurva Nandan67ebc302024-02-24 01:51:41 +053043#ifdef CONFIG_SOC_K3_J784S4
44#include "j784s4_hardware.h"
45#endif
46
Bryan Brattlofa4d5cc22024-03-12 15:20:24 -050047
Lokesh Vutlaa04cf3b2019-09-27 13:32:11 +053048/* Assuming these addresses and definitions stay common across K3 devices */
Andrew Davis990ec702022-10-07 14:22:05 -050049#define CTRLMMR_WKUP_JTAG_ID (WKUP_CTRL_MMR0_BASE + 0x14)
Lokesh Vutlaa04cf3b2019-09-27 13:32:11 +053050#define JTAG_ID_VARIANT_SHIFT 28
51#define JTAG_ID_VARIANT_MASK (0xf << 28)
52#define JTAG_ID_PARTNO_SHIFT 12
Lokesh Vutlab4075872020-04-17 13:43:53 +053053#define JTAG_ID_PARTNO_MASK (0xffff << 12)
Apurva Nandan73775da2024-02-24 01:51:42 +053054#define JTAG_ID_PARTNO_AM62AX 0xbb8d
Bryan Brattloff0f6ce12024-03-12 15:20:19 -050055#define JTAG_ID_PARTNO_AM62PX 0xbb9d
Apurva Nandan73775da2024-02-24 01:51:42 +053056#define JTAG_ID_PARTNO_AM62X 0xbb7e
57#define JTAG_ID_PARTNO_AM64X 0xbb38
Andrew Davis7d194c92023-04-06 11:38:11 -050058#define JTAG_ID_PARTNO_AM65X 0xbb5a
Andrew Davis7d194c92023-04-06 11:38:11 -050059#define JTAG_ID_PARTNO_J7200 0xbb6d
Apurva Nandan73775da2024-02-24 01:51:42 +053060#define JTAG_ID_PARTNO_J721E 0xbb64
Andrew Davis7d194c92023-04-06 11:38:11 -050061#define JTAG_ID_PARTNO_J721S2 0xbb75
Jayesh Choudharyef18f772024-06-12 14:41:12 +053062#define JTAG_ID_PARTNO_J722S 0xbba0
Apurva Nandan197dc2c2024-02-24 01:51:43 +053063#define JTAG_ID_PARTNO_J784S4 0xbb80
Andrew Davis7d194c92023-04-06 11:38:11 -050064
65#define K3_SOC_ID(id, ID) \
66static inline bool soc_is_##id(void) \
67{ \
68 u32 soc = (readl(CTRLMMR_WKUP_JTAG_ID) & \
69 JTAG_ID_PARTNO_MASK) >> JTAG_ID_PARTNO_SHIFT; \
70 return soc == JTAG_ID_PARTNO_##ID; \
71}
Andrew Davis7d194c92023-04-06 11:38:11 -050072K3_SOC_ID(am62x, AM62X)
73K3_SOC_ID(am62ax, AM62AX)
Bryan Brattloff0f6ce12024-03-12 15:20:19 -050074K3_SOC_ID(am62px, AM62PX)
Jayesh Choudhary5060b872024-06-12 14:41:10 +053075K3_SOC_ID(am64x, AM64X)
76K3_SOC_ID(am65x, AM65X)
77K3_SOC_ID(j7200, J7200)
78K3_SOC_ID(j721e, J721E)
79K3_SOC_ID(j721s2, J721S2)
Jayesh Choudharyef18f772024-06-12 14:41:12 +053080K3_SOC_ID(j722s, J722S)
Andrew Davis7d194c92023-04-06 11:38:11 -050081
Andrew Davisf8c98362022-07-15 11:34:32 -050082#define K3_SEC_MGR_SYS_STATUS 0x44234100
83#define SYS_STATUS_DEV_TYPE_SHIFT 0
84#define SYS_STATUS_DEV_TYPE_MASK (0xf)
85#define SYS_STATUS_DEV_TYPE_GP 0x3
86#define SYS_STATUS_DEV_TYPE_TEST 0x5
87#define SYS_STATUS_DEV_TYPE_EMU 0x9
88#define SYS_STATUS_DEV_TYPE_HS 0xa
89#define SYS_STATUS_SUB_TYPE_SHIFT 8
90#define SYS_STATUS_SUB_TYPE_MASK (0xf << 8)
91#define SYS_STATUS_SUB_TYPE_VAL_FS 0xa
Lokesh Vutlaa04cf3b2019-09-27 13:32:11 +053092
Andrew Davis990ec702022-10-07 14:22:05 -050093/*
94 * The CTRL_MMR0 memory space is divided into several equally-spaced
95 * partitions, so defining the partition size allows us to determine
96 * register addresses common to those partitions.
97 */
98#define CTRL_MMR0_PARTITION_SIZE 0x4000
99
100/*
101 * CTRL_MMR0, WKUP_CTRL_MMR0, and MCU_CTRL_MMR0 lock/kick-mechanism
102 * shared register definitions. The same registers are also used for
103 * PADCFG_MMR lock/kick-mechanism.
104 */
105#define CTRLMMR_LOCK_KICK0 0x1008
106#define CTRLMMR_LOCK_KICK0_UNLOCK_VAL 0x68ef3490
107#define CTRLMMR_LOCK_KICK1 0x100c
108#define CTRLMMR_LOCK_KICK1_UNLOCK_VAL 0xd172bc5a
109
Lokesh Vutla8e7bd012020-08-05 22:44:22 +0530110#define K3_ROM_BOOT_HEADER_MAGIC "EXTBOOT"
111
112struct rom_extended_boot_data {
113 char header[8];
114 u32 num_components;
115};
116
Wadim Egorov3eab2062024-04-03 15:59:10 +0200117u32 get_boot_device(void);
Lokesh Vutlac7bfb852018-08-27 15:57:11 +0530118#endif /* _ASM_ARCH_HARDWARE_H_ */