1 /* Copyright (c) 2022 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 #define INTEL_ADSP_IPC_BUSY BIT(31)
40 #define INTEL_ADSP_IPC_DONE BIT(31)
41 
42 /**
43  * @brief Clear TDA busy bit.
44  *
45  * On ACE SoC family boards TDA bit 31 (BUSY) during IPC doorbell acknowledgment
46  * must be cleared (!), not set (in contrary to CAVS SoC family boards).
47  * This clears BUSY on the other side of the connection in IDR register.
48  */
49 #define INTEL_ADSP_IPC_ACE1X_TDA_DONE 0
50 
51 #define INTEL_ADSP_IPC_CTL_TBIE BIT(0)
52 #define INTEL_ADSP_IPC_CTL_IDIE BIT(1)
53 /**
54  * @brief ACE SoC family Intra DSP Communication.
55  *
56  * ACE SoC platform family provides an array of IPC endpoints to be used for
57  * peer-to-peer communication between DSP cores - master to slave and backwards.
58  * Given endpoint can be accessed by:
59  * @code
60  * IDC[slave_core_id].agents[agent_id].ipc;
61  * @endcode
62  */
63 struct ace_idc {
64 	/**
65 	 * @brief IPC Agent Endpoints.
66 	 *
67 	 * Each connection is organized into two "agents" ("A" - master core and "B" - slave core).
68 	 * Each agent is wired to its own interrupt.
69 	 * Agents array represents mutually exclusive IPC endpoint access:
70 	 * (A=1/B=0) - agents[0].
71 	 * (A=0/B=1) - agents[1].
72 	 */
73 	union {
74 		int8_t unused[512];
75 		struct intel_adsp_ipc ipc;
76 	} agents[2];
77 };
78 
79 /**
80  * @brief Defines register for intra DSP communication.
81  */
82 #define IDC ((volatile struct ace_idc *)INTEL_ADSP_IDC_REG_ADDRESS)
83 
84 #endif /* ZEPHYR_SOC_INTEL_ADSP_ACE_IPC_REGS_H */
85