1 /* Copyright (c) 2024 Intel Corporation
2  * SPDX-License-Identifier: Apache-2.0
3  */
4 #ifndef ZEPHYR_SOC_INTEL_ADSP_ACE_IPC_REGS_H
5 #define ZEPHYR_SOC_INTEL_ADSP_ACE_IPC_REGS_H
6 
7 #include <intel_adsp_ipc.h>
8 #include <intel_adsp_ipc_devtree.h>
9 
10 /**
11  * @file
12  *
13  * Inter Processor Communication - used for sending interrupts to and receiving
14  * them from another device. ACE uses it to talk to the host and the CSME.
15  * In general there is one of these blocks instantiated for each endpoint of a
16  * connection.
17  */
18 
19 /**
20  * @brief IPC registers layout for Intel ADSP ACE1X SoC family.
21  */
22 struct intel_adsp_ipc {
23 	uint32_t tdr;
24 	uint32_t tda;
25 	uint32_t unused0[2];
26 	uint32_t idr;
27 	uint32_t ida;
28 	uint32_t unused1[2];
29 	uint32_t cst;
30 	uint32_t csr;
31 	uint32_t ctl;
32 	uint32_t cap;
33 	uint32_t unused2[52];
34 	uint32_t tdd;
35 	uint32_t unused3[31];
36 	uint32_t idd;
37 };
38 
39 /**
40  * @brief Set TDA busy bit.
41  *
42  * On ACE SoC family boards TDA bit 31 (BUSY) during IPC doorbell acknowledgment
43  * must be cleared (!), not set (in contrary to CAVS SoC family boards).
44  * This clears BUSY on the other side of the connection in IDR register.
45  */
46 #define INTEL_ADSP_IPC_ACE1X_TDA_DONE 0
47 #define INTEL_ADSP_IPC_BUSY           BIT(31)
48 #define INTEL_ADSP_IPC_DONE           BIT(31)
49 
50 #define INTEL_ADSP_IPC_CTL_TBIE BIT(0)
51 #define INTEL_ADSP_IPC_CTL_IDIE BIT(1)
52 /**
53  * @brief ACE SoC family Intra DSP Communication.
54  *
55  * ACE SoC platform family provides an array of IPC endpoints to be used for
56  * peer-to-peer communication between DSP cores - master to slave and backwards.
57  * Given endpoint can be accessed by:
58  * @code
59  * IDC[slave_core_id].agents[agent_id].ipc;
60  * @endcode
61  */
62 struct ace_idc {
63 	/**
64 	 * @brief IPC Agent Endpoints.
65 	 *
66 	 * Each connection is organized into two "agents" ("A" - master core and "B" - slave core).
67 	 * Each agent is wired to its own interrupt.
68 	 * Agents array represents mutually exclusive IPC endpoint access:
69 	 * (A=1/B=0) - agents[0].
70 	 * (A=0/B=1) - agents[1].
71 	 */
72 	union {
73 		int8_t unused[512];
74 		struct intel_adsp_ipc ipc;
75 	} agents[2];
76 };
77 
78 /**
79  * @brief Defines register for intra DSP communication.
80  */
81 #define IDC ((volatile struct ace_idc *)INTEL_ADSP_IDC_REG_ADDRESS)
82 
83 #endif /* ZEPHYR_SOC_INTEL_ADSP_ACE_IPC_REGS_H */
84