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 }
19 
mhuv2_ring_doorbell(struct scmi_channel_plat_info * plat_info)20 void mhuv2_ring_doorbell(struct scmi_channel_plat_info *plat_info)
21 {
22 	uintptr_t mhuv2_base = plat_info->db_reg_addr & MHU_V2_FRAME_BASE_MASK;
23 
24 	/* wake receiver */
25 	MHU_V2_ACCESS_REQUEST(mhuv2_base);
26 
27 	/* wait for receiver to acknowledge its ready */
28 	while (MHU_V2_IS_ACCESS_READY(mhuv2_base) == 0)
29 		;
30 
31 	MHU_RING_DOORBELL(plat_info->db_reg_addr,
32 			plat_info->db_modify_mask,
33 			plat_info->db_preserve_mask);
34 
35 	/* clear the access request for the receiver */
36 	MHU_V2_CLEAR_REQUEST(mhuv2_base);
37 }
38