1 /*
2  * Copyright (c) 2019 Linaro Limited
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_DRIVERS_IPM_IPM_MHU_H_
8 #define ZEPHYR_DRIVERS_IPM_IPM_MHU_H_
9 
10 #include <zephyr/kernel.h>
11 #include <zephyr/drivers/ipm.h>
12 #include <zephyr/device.h>
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #define IPM_MHU_MAX_DATA_SIZE		1
19 #define IPM_MHU_MAX_ID_VAL		0
20 #define SSE_200_CPU_ID_UNIT_OFFSET	((0x1F000UL))
21 #define SSE_200_DEVICE_BASE_REG_MSK	(0xF0000000UL)
22 
23 /* SSE 200 MHU register map structure */
24 struct ipm_mhu_reg_map_t {
25 	/* (R/ ) CPU 0 Interrupt Status Register */
26 	volatile uint32_t cpu0intr_stat;
27 	volatile uint32_t cpu0intr_set;  /* ( /W) CPU 0 Interrupt Set Register */
28 	volatile uint32_t cpu0intr_clr;  /* ( /W) CPU 0 Interrupt Clear Register */
29 	volatile uint32_t reserved0;
30 	/* (R/ ) CPU 1 Interrupt Status Register */
31 	volatile uint32_t cpu1intr_stat;
32 	volatile uint32_t cpu1intr_set;  /* ( /W) CPU 1 Interrupt Set Register */
33 	volatile uint32_t cpu1intr_clr;  /* ( /W) CPU 1 Interrupt Clear Register */
34 	volatile uint32_t reserved1[1004];
35 	volatile uint32_t pidr4;         /* ( /W) Peripheral ID 4 */
36 	volatile uint32_t reserved2[3];
37 	volatile uint32_t pidr0;         /* ( /W) Peripheral ID 0 */
38 	volatile uint32_t pidr1;         /* ( /W) Peripheral ID 1 */
39 	volatile uint32_t pidr2;         /* ( /W) Peripheral ID 2 */
40 	volatile uint32_t pidr3;         /* ( /W) Peripheral ID 3 */
41 	volatile uint32_t cidr0;         /* ( /W) Component ID 0 */
42 	volatile uint32_t cidr1;         /* ( /W) Component ID 1 */
43 	volatile uint32_t cidr2;         /* ( /W) Component ID 2 */
44 	volatile uint32_t cidr3;         /* ( /W) Component ID 3 */
45 };
46 
47 /* MHU enumeration types */
48 enum ipm_mhu_error_t {
49 	IPM_MHU_ERR_NONE = 0,		/* No error */
50 	IPM_MHU_ERR_INVALID_ARG,	/* Invalid argument */
51 };
52 
53 /* MHU enumeration types */
54 enum ipm_mhu_cpu_id_t {
55 	IPM_MHU_CPU0 = 0,
56 	IPM_MHU_CPU1,
57 	IPM_MHU_CPU_MAX,
58 };
59 
60 struct ipm_mhu_device_config {
61 	uint8_t *base;
62 	void (*irq_config_func)(const struct device *d);
63 };
64 
65 /* Device data structure */
66 struct ipm_mhu_data {
67 	ipm_callback_t callback;
68 	void *user_data;
69 };
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif /* ZEPHYR_DRIVERS_IPM_IPM_MHU_H_ */
76