• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  *  Copyright (C) 2016 Broadcom
4  *
5  * Common header for Broadcom mailbox messages which is shared across
6  * Broadcom SoCs and Broadcom mailbox client drivers.
7  */
8 
9 #ifndef _LINUX_BRCM_MESSAGE_H_
10 #define _LINUX_BRCM_MESSAGE_H_
11 
12 #include <linux/scatterlist.h>
13 
14 enum brcm_message_type {
15 	BRCM_MESSAGE_UNKNOWN = 0,
16 	BRCM_MESSAGE_BATCH,
17 	BRCM_MESSAGE_SPU,
18 	BRCM_MESSAGE_SBA,
19 	BRCM_MESSAGE_MAX,
20 };
21 
22 struct brcm_sba_command {
23 	u64 cmd;
24 	u64 *cmd_dma;
25 	dma_addr_t cmd_dma_addr;
26 #define BRCM_SBA_CMD_TYPE_A		BIT(0)
27 #define BRCM_SBA_CMD_TYPE_B		BIT(1)
28 #define BRCM_SBA_CMD_TYPE_C		BIT(2)
29 #define BRCM_SBA_CMD_HAS_RESP		BIT(3)
30 #define BRCM_SBA_CMD_HAS_OUTPUT		BIT(4)
31 	u64 flags;
32 	dma_addr_t resp;
33 	size_t resp_len;
34 	dma_addr_t data;
35 	size_t data_len;
36 };
37 
38 struct brcm_message {
39 	enum brcm_message_type type;
40 	union {
41 		struct {
42 			struct brcm_message *msgs;
43 			unsigned int msgs_queued;
44 			unsigned int msgs_count;
45 		} batch;
46 		struct {
47 			struct scatterlist *src;
48 			struct scatterlist *dst;
49 		} spu;
50 		struct {
51 			struct brcm_sba_command *cmds;
52 			unsigned int cmds_count;
53 		} sba;
54 	};
55 	void *ctx;
56 	int error;
57 };
58 
59 #endif /* _LINUX_BRCM_MESSAGE_H_ */
60