Rob Rice | a24532f | 2016-06-30 15:59:23 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 Broadcom |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 as |
| 6 | * published by the Free Software Foundation. |
| 7 | * |
| 8 | * Common header for Broadcom mailbox messages which is shared across |
| 9 | * Broadcom SoCs and Broadcom mailbox client drivers. |
| 10 | */ |
| 11 | |
| 12 | #ifndef _LINUX_BRCM_MESSAGE_H_ |
| 13 | #define _LINUX_BRCM_MESSAGE_H_ |
| 14 | |
| 15 | #include <linux/scatterlist.h> |
| 16 | |
| 17 | enum brcm_message_type { |
| 18 | BRCM_MESSAGE_UNKNOWN = 0, |
Anup Patel | dbc049e | 2017-03-15 12:10:00 +0530 | [diff] [blame] | 19 | BRCM_MESSAGE_BATCH, |
Rob Rice | a24532f | 2016-06-30 15:59:23 -0400 | [diff] [blame] | 20 | BRCM_MESSAGE_SPU, |
| 21 | BRCM_MESSAGE_SBA, |
| 22 | BRCM_MESSAGE_MAX, |
| 23 | }; |
| 24 | |
| 25 | struct brcm_sba_command { |
| 26 | u64 cmd; |
Anup Patel | dbc049e | 2017-03-15 12:10:00 +0530 | [diff] [blame] | 27 | u64 *cmd_dma; |
| 28 | dma_addr_t cmd_dma_addr; |
Rob Rice | a24532f | 2016-06-30 15:59:23 -0400 | [diff] [blame] | 29 | #define BRCM_SBA_CMD_TYPE_A BIT(0) |
| 30 | #define BRCM_SBA_CMD_TYPE_B BIT(1) |
| 31 | #define BRCM_SBA_CMD_TYPE_C BIT(2) |
| 32 | #define BRCM_SBA_CMD_HAS_RESP BIT(3) |
| 33 | #define BRCM_SBA_CMD_HAS_OUTPUT BIT(4) |
| 34 | u64 flags; |
Rob Rice | a24532f | 2016-06-30 15:59:23 -0400 | [diff] [blame] | 35 | dma_addr_t resp; |
| 36 | size_t resp_len; |
Anup Patel | dbc049e | 2017-03-15 12:10:00 +0530 | [diff] [blame] | 37 | dma_addr_t data; |
| 38 | size_t data_len; |
Rob Rice | a24532f | 2016-06-30 15:59:23 -0400 | [diff] [blame] | 39 | }; |
| 40 | |
| 41 | struct brcm_message { |
| 42 | enum brcm_message_type type; |
| 43 | union { |
| 44 | struct { |
Anup Patel | dbc049e | 2017-03-15 12:10:00 +0530 | [diff] [blame] | 45 | struct brcm_message *msgs; |
| 46 | unsigned int msgs_queued; |
| 47 | unsigned int msgs_count; |
| 48 | } batch; |
| 49 | struct { |
Rob Rice | a24532f | 2016-06-30 15:59:23 -0400 | [diff] [blame] | 50 | struct scatterlist *src; |
| 51 | struct scatterlist *dst; |
| 52 | } spu; |
| 53 | struct { |
| 54 | struct brcm_sba_command *cmds; |
| 55 | unsigned int cmds_count; |
| 56 | } sba; |
| 57 | }; |
| 58 | void *ctx; |
| 59 | int error; |
| 60 | }; |
| 61 | |
| 62 | #endif /* _LINUX_BRCM_MESSAGE_H_ */ |