blob: 7e143c6bdc8980fa5db9c636edb7426cf3b86aa4 [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
Andrew Davis1be5e972022-07-15 10:25:27 -050011#ifdef CONFIG_SOC_K3_AM654
Lokesh Vutlac7bfb852018-08-27 15:57:11 +053012#include "am6_hardware.h"
13#endif
Lokesh Vutla6edde292019-06-13 10:29:43 +053014
15#ifdef CONFIG_SOC_K3_J721E
16#include "j721e_hardware.h"
17#endif
Lokesh Vutlaa04cf3b2019-09-27 13:32:11 +053018
David Huang61098202022-01-25 20:56:31 +053019#ifdef CONFIG_SOC_K3_J721S2
20#include "j721s2_hardware.h"
21#endif
22
Keerthy05d670e2021-04-23 11:27:33 -050023#ifdef CONFIG_SOC_K3_AM642
24#include "am64_hardware.h"
25#endif
26
Suman Anna27fa4122022-05-25 13:38:42 +053027#ifdef CONFIG_SOC_K3_AM625
28#include "am62_hardware.h"
29#endif
30
Bryan Brattlofdaa39a62022-11-03 19:13:55 -050031#ifdef CONFIG_SOC_K3_AM62A7
32#include "am62a_hardware.h"
Aradhya Bhatia94024e92023-04-14 12:57:25 +053033#include "am62a_qos.h"
Bryan Brattlofdaa39a62022-11-03 19:13:55 -050034#endif
35
Apurva Nandan67ebc302024-02-24 01:51:41 +053036#ifdef CONFIG_SOC_K3_J784S4
37#include "j784s4_hardware.h"
38#endif
39
Lokesh Vutlaa04cf3b2019-09-27 13:32:11 +053040/* Assuming these addresses and definitions stay common across K3 devices */
Andrew Davis990ec702022-10-07 14:22:05 -050041#define CTRLMMR_WKUP_JTAG_ID (WKUP_CTRL_MMR0_BASE + 0x14)
Lokesh Vutlaa04cf3b2019-09-27 13:32:11 +053042#define JTAG_ID_VARIANT_SHIFT 28
43#define JTAG_ID_VARIANT_MASK (0xf << 28)
44#define JTAG_ID_PARTNO_SHIFT 12
Lokesh Vutlab4075872020-04-17 13:43:53 +053045#define JTAG_ID_PARTNO_MASK (0xffff << 12)
Apurva Nandan73775da2024-02-24 01:51:42 +053046#define JTAG_ID_PARTNO_AM62AX 0xbb8d
47#define JTAG_ID_PARTNO_AM62X 0xbb7e
48#define JTAG_ID_PARTNO_AM64X 0xbb38
Andrew Davis7d194c92023-04-06 11:38:11 -050049#define JTAG_ID_PARTNO_AM65X 0xbb5a
Andrew Davis7d194c92023-04-06 11:38:11 -050050#define JTAG_ID_PARTNO_J7200 0xbb6d
Apurva Nandan73775da2024-02-24 01:51:42 +053051#define JTAG_ID_PARTNO_J721E 0xbb64
Andrew Davis7d194c92023-04-06 11:38:11 -050052#define JTAG_ID_PARTNO_J721S2 0xbb75
Andrew Davis7d194c92023-04-06 11:38:11 -050053
54#define K3_SOC_ID(id, ID) \
55static inline bool soc_is_##id(void) \
56{ \
57 u32 soc = (readl(CTRLMMR_WKUP_JTAG_ID) & \
58 JTAG_ID_PARTNO_MASK) >> JTAG_ID_PARTNO_SHIFT; \
59 return soc == JTAG_ID_PARTNO_##ID; \
60}
61K3_SOC_ID(am65x, AM65X)
62K3_SOC_ID(j721e, J721E)
63K3_SOC_ID(j7200, J7200)
64K3_SOC_ID(am64x, AM64X)
65K3_SOC_ID(j721s2, J721S2)
66K3_SOC_ID(am62x, AM62X)
67K3_SOC_ID(am62ax, AM62AX)
68
Andrew Davisf8c98362022-07-15 11:34:32 -050069#define K3_SEC_MGR_SYS_STATUS 0x44234100
70#define SYS_STATUS_DEV_TYPE_SHIFT 0
71#define SYS_STATUS_DEV_TYPE_MASK (0xf)
72#define SYS_STATUS_DEV_TYPE_GP 0x3
73#define SYS_STATUS_DEV_TYPE_TEST 0x5
74#define SYS_STATUS_DEV_TYPE_EMU 0x9
75#define SYS_STATUS_DEV_TYPE_HS 0xa
76#define SYS_STATUS_SUB_TYPE_SHIFT 8
77#define SYS_STATUS_SUB_TYPE_MASK (0xf << 8)
78#define SYS_STATUS_SUB_TYPE_VAL_FS 0xa
Lokesh Vutlaa04cf3b2019-09-27 13:32:11 +053079
Andrew Davis990ec702022-10-07 14:22:05 -050080/*
81 * The CTRL_MMR0 memory space is divided into several equally-spaced
82 * partitions, so defining the partition size allows us to determine
83 * register addresses common to those partitions.
84 */
85#define CTRL_MMR0_PARTITION_SIZE 0x4000
86
87/*
88 * CTRL_MMR0, WKUP_CTRL_MMR0, and MCU_CTRL_MMR0 lock/kick-mechanism
89 * shared register definitions. The same registers are also used for
90 * PADCFG_MMR lock/kick-mechanism.
91 */
92#define CTRLMMR_LOCK_KICK0 0x1008
93#define CTRLMMR_LOCK_KICK0_UNLOCK_VAL 0x68ef3490
94#define CTRLMMR_LOCK_KICK1 0x100c
95#define CTRLMMR_LOCK_KICK1_UNLOCK_VAL 0xd172bc5a
96
Lokesh Vutla8e7bd012020-08-05 22:44:22 +053097#define K3_ROM_BOOT_HEADER_MAGIC "EXTBOOT"
98
99struct rom_extended_boot_data {
100 char header[8];
101 u32 num_components;
102};
103
Aradhya Bhatia94024e92023-04-14 12:57:25 +0530104struct k3_qos_data {
105 u32 reg;
106 u32 val;
107};
108
109extern struct k3_qos_data am62a_qos_data[];
110extern u32 am62a_qos_count;
111
Lokesh Vutlac7bfb852018-08-27 15:57:11 +0530112#endif /* _ASM_ARCH_HARDWARE_H_ */