css_mhu_doorbell.c 958 Bytes
Newer Older
1
/*
2
 * Copyright (c) 2014-2020, ARM Limited and Contributors. All rights reserved.
3
4
5
6
7
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#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

Roberto Vargas's avatar
Roberto Vargas committed
13
void mhu_ring_doorbell(struct scmi_channel_plat_info *plat_info)
14
15
16
17
18
19
20
{
	MHU_RING_DOORBELL(plat_info->db_reg_addr,
			plat_info->db_modify_mask,
			plat_info->db_preserve_mask);
	return;
}

Roberto Vargas's avatar
Roberto Vargas committed
21
void mhuv2_ring_doorbell(struct scmi_channel_plat_info *plat_info)
22
{
23
24
	uintptr_t mhuv2_base = plat_info->db_reg_addr & MHU_V2_FRAME_BASE_MASK;

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
33
34
35
		;

	MHU_RING_DOORBELL(plat_info->db_reg_addr,
			plat_info->db_modify_mask,
			plat_info->db_preserve_mask);

Paul Beesley's avatar
Paul Beesley committed
36
	/* clear the access request for the receiver */
37
	MHU_V2_CLEAR_REQUEST(mhuv2_base);
38
39
40

	return;
}