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 __ISP_GLOBAL_H_INCLUDED__
8 #define __ISP_GLOBAL_H_INCLUDED__
9 
10 #include <system_local.h>
11 
12 #include "mamoiada_params.h"
13 
14 #define ISP_PMEM_WIDTH_LOG2		ISP_LOG2_PMEM_WIDTH
15 #define ISP_PMEM_SIZE			ISP_PMEM_DEPTH
16 
17 #define ISP_NWAY_LOG2			6
18 #define ISP_VEC_NELEMS_LOG2		ISP_NWAY_LOG2
19 
20 #ifdef PIPE_GENERATION
21 #define PIPEMEM(x) MEM(x)
22 #define ISP_NWAY   BIT(ISP_NWAY_LOG2)
23 #else
24 #define PIPEMEM(x)
25 #endif
26 
27 /* The number of data bytes in a vector disregarding the reduced precision */
28 #define ISP_VEC_BYTES			(ISP_VEC_NELEMS * sizeof(uint16_t))
29 
30 /* ISP SC Registers */
31 #define ISP_SC_REG			0x00
32 #define ISP_PC_REG			0x07
33 #define ISP_IRQ_READY_REG		0x00
34 #define ISP_IRQ_CLEAR_REG		0x00
35 
36 /* ISP SC Register bits */
37 #define ISP_RST_BIT			0x00
38 #define ISP_START_BIT			0x01
39 #define ISP_BREAK_BIT			0x02
40 #define ISP_RUN_BIT			0x03
41 #define ISP_BROKEN_BIT			0x04
42 #define ISP_IDLE_BIT			0x05     /* READY */
43 #define ISP_SLEEPING_BIT		0x06
44 #define ISP_STALLING_BIT		0x07
45 #define ISP_IRQ_CLEAR_BIT		0x08
46 #define ISP_IRQ_READY_BIT		0x0A
47 #define ISP_IRQ_SLEEPING_BIT		0x0B
48 
49 /* ISP Register bits */
50 #define ISP_CTRL_SINK_BIT		0x00
51 #define ISP_PMEM_SINK_BIT		0x01
52 #define ISP_DMEM_SINK_BIT		0x02
53 #define ISP_FIFO0_SINK_BIT		0x03
54 #define ISP_FIFO1_SINK_BIT		0x04
55 #define ISP_FIFO2_SINK_BIT		0x05
56 #define ISP_FIFO3_SINK_BIT		0x06
57 #define ISP_FIFO4_SINK_BIT		0x07
58 #define ISP_FIFO5_SINK_BIT		0x08
59 #define ISP_FIFO6_SINK_BIT		0x09
60 #define ISP_VMEM_SINK_BIT		0x0A
61 #define ISP_VAMEM1_SINK_BIT		0x0B
62 #define ISP_VAMEM2_SINK_BIT		0x0C
63 #define ISP_VAMEM3_SINK_BIT		0x0D
64 #define ISP_HMEM_SINK_BIT		0x0E
65 
66 #define ISP_CTRL_SINK_REG		0x08
67 #define ISP_PMEM_SINK_REG		0x08
68 #define ISP_DMEM_SINK_REG		0x08
69 #define ISP_FIFO0_SINK_REG		0x08
70 #define ISP_FIFO1_SINK_REG		0x08
71 #define ISP_FIFO2_SINK_REG		0x08
72 #define ISP_FIFO3_SINK_REG		0x08
73 #define ISP_FIFO4_SINK_REG		0x08
74 #define ISP_FIFO5_SINK_REG		0x08
75 #define ISP_FIFO6_SINK_REG		0x08
76 #define ISP_VMEM_SINK_REG		0x08
77 #define ISP_VAMEM1_SINK_REG		0x08
78 #define ISP_VAMEM2_SINK_REG		0x08
79 #define ISP_VAMEM3_SINK_REG		0x08
80 #define ISP_HMEM_SINK_REG		0x08
81 
82 /* ISP2401 */
83 #define BAMEM VMEM
84 #define XNR3_DOWN_BAMEM_BASE_ADDRESS    (0x16880)
85 #define XNR3_UP_BAMEM_BASE_ADDRESS      (0x12880)
86 #define bmem_ldrow(fu, pid, offset, data) bmem_ldrow_s(fu, pid, offset, data)
87 #define bmem_strow(fu, pid, offset, data) bmem_strow_s(fu, pid, offset, data)
88 #define bmem_ldblk(fu, pid, offset, data) bmem_ldblk_s(fu, pid, offset, data)
89 #define bmem_stblk(fu, pid, offset, data) bmem_stblk_s(fu, pid, offset, data)
90 
91 #endif /* __ISP_GLOBAL_H_INCLUDED__ */
92