1 /*
2  * Copyright (c) 2014-2020, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <platform_def.h>
8 
9 #include <arch_helpers.h>
10 #include <drivers/arm/css/css_mhu_doorbell.h>
11 #include <drivers/arm/css/scmi.h>
12 
mhu_ring_doorbell(struct scmi_channel_plat_info * plat_info)13 void mhu_ring_doorbell(struct scmi_channel_plat_info *plat_info)
14 {
15 	MHU_RING_DOORBELL(plat_info->db_reg_addr,
16 			plat_info->db_modify_mask,
17 			plat_info->db_preserve_mask);
18 	return;
19 }
20 
mhuv2_ring_doorbell(struct scmi_channel_plat_info * plat_info)21 void mhuv2_ring_doorbell(struct scmi_channel_plat_info *plat_info)
22 {
23 	uintptr_t mhuv2_base = plat_info->db_reg_addr & MHU_V2_FRAME_BASE_MASK;
24 
25 	/* wake receiver */
26 	MHU_V2_ACCESS_REQUEST(mhuv2_base);
27 
28 	/* wait for receiver to acknowledge its ready */
29 	while (MHU_V2_IS_ACCESS_READY(mhuv2_base) == 0)
30 		;
31 
32 	MHU_RING_DOORBELL(plat_info->db_reg_addr,
33 			plat_info->db_modify_mask,
34 			plat_info->db_preserve_mask);
35 
36 	/* clear the access request for the receiver */
37 	MHU_V2_CLEAR_REQUEST(mhuv2_base);
38 
39 	return;
40 }
41