1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 2015, Intel Corporation.
5  */
6 
7 #ifndef _STREAM2MMMIO_DEFS_H
8 #define _STREAM2MMMIO_DEFS_H
9 
10 #include <mipi_backend_defs.h>
11 
12 #define _STREAM2MMIO_REG_ALIGN                  4
13 
14 #define _STREAM2MMIO_COMMAND_REG_ID             0
15 #define _STREAM2MMIO_ACKNOWLEDGE_REG_ID         1
16 #define _STREAM2MMIO_PIX_WIDTH_ID_REG_ID        2
17 #define _STREAM2MMIO_START_ADDR_REG_ID          3      /* master port address,NOT Byte */
18 #define _STREAM2MMIO_END_ADDR_REG_ID            4      /* master port address,NOT Byte */
19 #define _STREAM2MMIO_STRIDE_REG_ID              5      /* stride in master port words, increment is per packet for long sids, stride is not used for short sid's*/
20 #define _STREAM2MMIO_NUM_ITEMS_REG_ID           6      /* number of packets for store packets cmd, number of words for store_words cmd */
21 #define _STREAM2MMIO_BLOCK_WHEN_NO_CMD_REG_ID   7      /* if this register is 1, input will be stalled if there is no pending command for this sid */
22 #define _STREAM2MMIO_REGS_PER_SID               8
23 
24 #define _STREAM2MMIO_SID_REG_OFFSET             8
25 #define _STREAM2MMIO_MAX_NOF_SIDS              64      /* value used in hss model */
26 
27 /* command token definition     */
28 #define _STREAM2MMIO_CMD_TOKEN_CMD_LSB          0      /* bits 1-0 is for the command field */
29 #define _STREAM2MMIO_CMD_TOKEN_CMD_MSB          1
30 
31 #define _STREAM2MMIO_CMD_TOKEN_WIDTH           (_STREAM2MMIO_CMD_TOKEN_CMD_MSB + 1 - _STREAM2MMIO_CMD_TOKEN_CMD_LSB)
32 
33 #define _STREAM2MMIO_CMD_TOKEN_STORE_WORDS              0      /* command for storing a number of output words indicated by reg _STREAM2MMIO_NUM_ITEMS */
34 #define _STREAM2MMIO_CMD_TOKEN_STORE_PACKETS            1      /* command for storing a number of packets indicated by reg _STREAM2MMIO_NUM_ITEMS      */
35 #define _STREAM2MMIO_CMD_TOKEN_SYNC_FRAME               2      /* command for waiting for a frame start                                                */
36 
37 /* acknowledges from packer module */
38 /* fields: eof   - indicates whether last (short) packet received was an eof packet */
39 /*         eop   - indicates whether command has ended due to packet end or due to no of words requested has been received */
40 /*         count - indicates number of words stored */
41 #define _STREAM2MMIO_PACK_NUM_ITEMS_BITS        16
42 #define _STREAM2MMIO_PACK_ACK_EOP_BIT           _STREAM2MMIO_PACK_NUM_ITEMS_BITS
43 #define _STREAM2MMIO_PACK_ACK_EOF_BIT           (_STREAM2MMIO_PACK_ACK_EOP_BIT + 1)
44 
45 /* acknowledge token definition */
46 #define _STREAM2MMIO_ACK_TOKEN_NUM_ITEMS_LSB    0      /* bits 3-0 is for the command field */
47 #define _STREAM2MMIO_ACK_TOKEN_NUM_ITEMS_MSB   (_STREAM2MMIO_PACK_NUM_ITEMS_BITS - 1)
48 #define _STREAM2MMIO_ACK_TOKEN_EOP_BIT         _STREAM2MMIO_PACK_ACK_EOP_BIT
49 #define _STREAM2MMIO_ACK_TOKEN_EOF_BIT         _STREAM2MMIO_PACK_ACK_EOF_BIT
50 #define _STREAM2MMIO_ACK_TOKEN_VALID_BIT       (_STREAM2MMIO_ACK_TOKEN_EOF_BIT + 1)      /* this bit indicates a valid ack    */
51 /* if there is no valid ack, a read  */
52 /* on the ack register returns 0     */
53 #define _STREAM2MMIO_ACK_TOKEN_WIDTH           (_STREAM2MMIO_ACK_TOKEN_VALID_BIT + 1)
54 
55 /* commands for packer module */
56 #define _STREAM2MMIO_PACK_CMD_STORE_WORDS        0
57 #define _STREAM2MMIO_PACK_CMD_STORE_LONG_PACKET  1
58 #define _STREAM2MMIO_PACK_CMD_STORE_SHORT_PACKET 2
59 
60 #endif /* _STREAM2MMIO_DEFS_H */
61