summaryrefslogtreecommitdiff
path: root/include/linux/mailbox/brcm-message.h
blob: 18da8211547683d70f3b9495cccf418fe90451fa (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
53
54
55
56
57
58
59
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 *  Copyright (C) 2016 Broadcom
 *
 * Common header for Broadcom mailbox messages which is shared across
 * Broadcom SoCs and Broadcom mailbox client drivers.
 */

#ifndef _LINUX_BRCM_MESSAGE_H_
#define _LINUX_BRCM_MESSAGE_H_

#include <linux/scatterlist.h>

enum brcm_message_type {
	BRCM_MESSAGE_UNKNOWN = 0,
	BRCM_MESSAGE_BATCH,
	BRCM_MESSAGE_SPU,
	BRCM_MESSAGE_SBA,
	BRCM_MESSAGE_MAX,
};

struct brcm_sba_command {
	u64 cmd;
	u64 *cmd_dma;
	dma_addr_t cmd_dma_addr;
#define BRCM_SBA_CMD_TYPE_A		BIT(0)
#define BRCM_SBA_CMD_TYPE_B		BIT(1)
#define BRCM_SBA_CMD_TYPE_C		BIT(2)
#define BRCM_SBA_CMD_HAS_RESP		BIT(3)
#define BRCM_SBA_CMD_HAS_OUTPUT		BIT(4)
	u64 flags;
	dma_addr_t resp;
	size_t resp_len;
	dma_addr_t data;
	size_t data_len;
};

struct brcm_message {
	enum brcm_message_type type;
	union {
		struct {
			struct brcm_message *msgs;
			unsigned int msgs_queued;
			unsigned int msgs_count;
		} batch;
		struct {
			struct scatterlist *src;
			struct scatterlist *dst;
		} spu;
		struct {
			struct brcm_sba_command *cmds;
			unsigned int cmds_count;
		} sba;
	};
	void *ctx;
	int error;
};

#endif /* _LINUX_BRCM_MESSAGE_H_ */