summaryrefslogtreecommitdiff
path: root/gxp-doorbell.h
blob: d2f167b2e188a560efae70d352d5254d2f952ed4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * GXP doorbell interface.
 *
 * Copyright (C) 2020 Google LLC
 */
#ifndef __GXP_DOORBELL_H__
#define __GXP_DOORBELL_H__

#include "gxp-internal.h"

/**
 * gxp_doorbell_enable_for_core() - Enable a core to receive interrupts from
 *                                  the specified doorbell
 * @gxp: The GXP device to enable the doorbell for
 * @doorbell_num: The index of the doorbell to enable
 * @core: The core which will receive interrupts from the enabled doorbell
 *
 * This function can only be called before firmware is running on @core or as
 * part of halting firmware on it. Firmware may read or modify which doorbells
 * it is listening to and accesses are not synchronized between the driver and
 * firmware.
 */
void gxp_doorbell_enable_for_core(struct gxp_dev *gxp, u32 doorbell_num,
				  uint core);

/**
 * gxp_doorbell_set() - Ring the specified doorbell
 * @gxp: The GXP device to ring the doorbell for
 * @doorbell_num: The index of the doorbell to ring
 *
 * Any cores this doorbell is enabled for willexecute their handler.
 */
void gxp_doorbell_set(struct gxp_dev *gxp, u32 doorbell_num);

/**
 * gxp_doorbell_clear() - Clear the specified doorbell's interrupt
 * @gxp: The GXP device to clear the doorbell for
 * @doorbell_num: The index of the doorbell to clear
 */
void gxp_doorbell_clear(struct gxp_dev *gxp, u32 doorbell_num);

/**
 * gxp_doorbell_status() - Returns whether the specified doorbell is rung
 * @gxp: The GXP device containing the doorbell
 * @doorbell_num: The index of the doorbell to check
 *
 * Return: The status register of the doorbell, 1 for rung, 0 for cleared
 */
u32 gxp_doorbell_status(struct gxp_dev *gxp, u32 doorbell_num);

#endif /* __GXP_DOORBELL_H__ */