]> Git Repo - linux.git/blob - drivers/media/platform/broadcom/bcm2835-unicam-regs.h
dma-mapping: don't return errors from dma_set_max_seg_size
[linux.git] / drivers / media / platform / broadcom / bcm2835-unicam-regs.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 /*
4  * Copyright (C) 2017-2020 Raspberry Pi Trading.
5  * Dave Stevenson <[email protected]>
6  */
7
8 #ifndef VC4_REGS_UNICAM_H
9 #define VC4_REGS_UNICAM_H
10
11 #include <linux/bits.h>
12
13 /*
14  * The following values are taken from files found within the code drop
15  * made by Broadcom for the BCM21553 Graphics Driver, predominantly in
16  * brcm_usrlib/dag/vmcsx/vcinclude/hardware_vc4.h.
17  * They have been modified to be only the register offset.
18  */
19 #define UNICAM_CTRL             0x000
20 #define UNICAM_STA              0x004
21 #define UNICAM_ANA              0x008
22 #define UNICAM_PRI              0x00c
23 #define UNICAM_CLK              0x010
24 #define UNICAM_CLT              0x014
25 #define UNICAM_DAT0             0x018
26 #define UNICAM_DAT1             0x01c
27 #define UNICAM_DAT2             0x020
28 #define UNICAM_DAT3             0x024
29 #define UNICAM_DLT              0x028
30 #define UNICAM_CMP0             0x02c
31 #define UNICAM_CMP1             0x030
32 #define UNICAM_CAP0             0x034
33 #define UNICAM_CAP1             0x038
34 #define UNICAM_ICTL             0x100
35 #define UNICAM_ISTA             0x104
36 #define UNICAM_IDI0             0x108
37 #define UNICAM_IPIPE            0x10c
38 #define UNICAM_IBSA0            0x110
39 #define UNICAM_IBEA0            0x114
40 #define UNICAM_IBLS             0x118
41 #define UNICAM_IBWP             0x11c
42 #define UNICAM_IHWIN            0x120
43 #define UNICAM_IHSTA            0x124
44 #define UNICAM_IVWIN            0x128
45 #define UNICAM_IVSTA            0x12c
46 #define UNICAM_ICC              0x130
47 #define UNICAM_ICS              0x134
48 #define UNICAM_IDC              0x138
49 #define UNICAM_IDPO             0x13c
50 #define UNICAM_IDCA             0x140
51 #define UNICAM_IDCD             0x144
52 #define UNICAM_IDS              0x148
53 #define UNICAM_DCS              0x200
54 #define UNICAM_DBSA0            0x204
55 #define UNICAM_DBEA0            0x208
56 #define UNICAM_DBWP             0x20c
57 #define UNICAM_DBCTL            0x300
58 #define UNICAM_IBSA1            0x304
59 #define UNICAM_IBEA1            0x308
60 #define UNICAM_IDI1             0x30c
61 #define UNICAM_DBSA1            0x310
62 #define UNICAM_DBEA1            0x314
63 #define UNICAM_MISC             0x400
64
65 /*
66  * The following bitmasks are from the kernel released by Broadcom
67  * for Android - https://android.googlesource.com/kernel/bcm/
68  * The Rhea, Hawaii, and Java chips all contain the same VideoCore4
69  * Unicam block as BCM2835, as defined in eg
70  * arch/arm/mach-rhea/include/mach/rdb_A0/brcm_rdb_cam.h and similar.
71  * Values reworked to use the kernel BIT and GENMASK macros.
72  *
73  * Some of the bit mnenomics have been amended to match the datasheet.
74  */
75 /* UNICAM_CTRL Register */
76 #define UNICAM_CPE              BIT(0)
77 #define UNICAM_MEM              BIT(1)
78 #define UNICAM_CPR              BIT(2)
79 #define UNICAM_CPM_MASK         GENMASK(3, 3)
80 #define UNICAM_CPM_CSI2         0
81 #define UNICAM_CPM_CCP2         1
82 #define UNICAM_SOE              BIT(4)
83 #define UNICAM_DCM_MASK         GENMASK(5, 5)
84 #define UNICAM_DCM_STROBE       0
85 #define UNICAM_DCM_DATA         1
86 #define UNICAM_SLS              BIT(6)
87 #define UNICAM_PFT_MASK         GENMASK(11, 8)
88 #define UNICAM_OET_MASK         GENMASK(20, 12)
89
90 /* UNICAM_STA Register */
91 #define UNICAM_SYN              BIT(0)
92 #define UNICAM_CS               BIT(1)
93 #define UNICAM_SBE              BIT(2)
94 #define UNICAM_PBE              BIT(3)
95 #define UNICAM_HOE              BIT(4)
96 #define UNICAM_PLE              BIT(5)
97 #define UNICAM_SSC              BIT(6)
98 #define UNICAM_CRCE             BIT(7)
99 #define UNICAM_OES              BIT(8)
100 #define UNICAM_IFO              BIT(9)
101 #define UNICAM_OFO              BIT(10)
102 #define UNICAM_BFO              BIT(11)
103 #define UNICAM_DL               BIT(12)
104 #define UNICAM_PS               BIT(13)
105 #define UNICAM_IS               BIT(14)
106 #define UNICAM_PI0              BIT(15)
107 #define UNICAM_PI1              BIT(16)
108 #define UNICAM_FSI_S            BIT(17)
109 #define UNICAM_FEI_S            BIT(18)
110 #define UNICAM_LCI_S            BIT(19)
111 #define UNICAM_BUF0_RDY         BIT(20)
112 #define UNICAM_BUF0_NO          BIT(21)
113 #define UNICAM_BUF1_RDY         BIT(22)
114 #define UNICAM_BUF1_NO          BIT(23)
115 #define UNICAM_DI               BIT(24)
116
117 #define UNICAM_STA_MASK_ALL \
118         (UNICAM_SBE  | UNICAM_PBE | UNICAM_HOE | UNICAM_PLE | UNICAM_SSC | \
119          UNICAM_CRCE | UNICAM_IFO | UNICAM_OFO | UNICAM_DL  | UNICAM_PS  | \
120          UNICAM_PI0  | UNICAM_PI1)
121
122 /* UNICAM_ANA Register */
123 #define UNICAM_APD              BIT(0)
124 #define UNICAM_BPD              BIT(1)
125 #define UNICAM_AR               BIT(2)
126 #define UNICAM_DDL              BIT(3)
127 #define UNICAM_CTATADJ_MASK     GENMASK(7, 4)
128 #define UNICAM_PTATADJ_MASK     GENMASK(11, 8)
129
130 /* UNICAM_PRI Register */
131 #define UNICAM_PE               BIT(0)
132 #define UNICAM_PT_MASK          GENMASK(2, 1)
133 #define UNICAM_NP_MASK          GENMASK(7, 4)
134 #define UNICAM_PP_MASK          GENMASK(11, 8)
135 #define UNICAM_BS_MASK          GENMASK(15, 12)
136 #define UNICAM_BL_MASK          GENMASK(17, 16)
137
138 /* UNICAM_CLK Register */
139 #define UNICAM_CLE              BIT(0)
140 #define UNICAM_CLPD             BIT(1)
141 #define UNICAM_CLLPE            BIT(2)
142 #define UNICAM_CLHSE            BIT(3)
143 #define UNICAM_CLTRE            BIT(4)
144 #define UNICAM_CLAC_MASK        GENMASK(8, 5)
145 #define UNICAM_CLSTE            BIT(29)
146
147 /* UNICAM_CLT Register */
148 #define UNICAM_CLT1_MASK        GENMASK(7, 0)
149 #define UNICAM_CLT2_MASK        GENMASK(15, 8)
150
151 /* UNICAM_DATn Registers */
152 #define UNICAM_DLE              BIT(0)
153 #define UNICAM_DLPD             BIT(1)
154 #define UNICAM_DLLPE            BIT(2)
155 #define UNICAM_DLHSE            BIT(3)
156 #define UNICAM_DLTRE            BIT(4)
157 #define UNICAM_DLSM             BIT(5)
158 #define UNICAM_DLFO             BIT(28)
159 #define UNICAM_DLSTE            BIT(29)
160
161 #define UNICAM_DAT_MASK_ALL     (UNICAM_DLSTE | UNICAM_DLFO)
162
163 /* UNICAM_DLT Register */
164 #define UNICAM_DLT1_MASK        GENMASK(7, 0)
165 #define UNICAM_DLT2_MASK        GENMASK(15, 8)
166 #define UNICAM_DLT3_MASK        GENMASK(23, 16)
167
168 /* UNICAM_ICTL Register */
169 #define UNICAM_FSIE             BIT(0)
170 #define UNICAM_FEIE             BIT(1)
171 #define UNICAM_IBOB             BIT(2)
172 #define UNICAM_FCM              BIT(3)
173 #define UNICAM_TFC              BIT(4)
174 #define UNICAM_LIP_MASK         GENMASK(6, 5)
175 #define UNICAM_LCIE_MASK        GENMASK(28, 16)
176
177 /* UNICAM_IDI0/1 Register */
178 #define UNICAM_ID0_MASK         GENMASK(7, 0)
179 #define UNICAM_ID1_MASK         GENMASK(15, 8)
180 #define UNICAM_ID2_MASK         GENMASK(23, 16)
181 #define UNICAM_ID3_MASK         GENMASK(31, 24)
182
183 /* UNICAM_ISTA Register */
184 #define UNICAM_FSI              BIT(0)
185 #define UNICAM_FEI              BIT(1)
186 #define UNICAM_LCI              BIT(2)
187
188 #define UNICAM_ISTA_MASK_ALL    (UNICAM_FSI | UNICAM_FEI | UNICAM_LCI)
189
190 /* UNICAM_IPIPE Register */
191 #define UNICAM_PUM_MASK         GENMASK(2, 0)
192 /* Unpacking modes */
193 #define UNICAM_PUM_NONE         0
194 #define UNICAM_PUM_UNPACK6      1
195 #define UNICAM_PUM_UNPACK7      2
196 #define UNICAM_PUM_UNPACK8      3
197 #define UNICAM_PUM_UNPACK10     4
198 #define UNICAM_PUM_UNPACK12     5
199 #define UNICAM_PUM_UNPACK14     6
200 #define UNICAM_PUM_UNPACK16     7
201 #define UNICAM_DDM_MASK         GENMASK(6, 3)
202 #define UNICAM_PPM_MASK         GENMASK(9, 7)
203 /* Packing modes */
204 #define UNICAM_PPM_NONE         0
205 #define UNICAM_PPM_PACK8        1
206 #define UNICAM_PPM_PACK10       2
207 #define UNICAM_PPM_PACK12       3
208 #define UNICAM_PPM_PACK14       4
209 #define UNICAM_PPM_PACK16       5
210 #define UNICAM_DEM_MASK         GENMASK(11, 10)
211 #define UNICAM_DEBL_MASK        GENMASK(14, 12)
212 #define UNICAM_ICM_MASK         GENMASK(16, 15)
213 #define UNICAM_IDM_MASK         GENMASK(17, 17)
214
215 /* UNICAM_ICC Register */
216 #define UNICAM_ICFL_MASK        GENMASK(4, 0)
217 #define UNICAM_ICFH_MASK        GENMASK(9, 5)
218 #define UNICAM_ICST_MASK        GENMASK(12, 10)
219 #define UNICAM_ICLT_MASK        GENMASK(15, 13)
220 #define UNICAM_ICLL_MASK        GENMASK(31, 16)
221
222 /* UNICAM_DCS Register */
223 #define UNICAM_DIE              BIT(0)
224 #define UNICAM_DIM              BIT(1)
225 #define UNICAM_DBOB             BIT(3)
226 #define UNICAM_FDE              BIT(4)
227 #define UNICAM_LDP              BIT(5)
228 #define UNICAM_EDL_MASK         GENMASK(15, 8)
229
230 /* UNICAM_DBCTL Register */
231 #define UNICAM_DBEN             BIT(0)
232 #define UNICAM_BUF0_IE          BIT(1)
233 #define UNICAM_BUF1_IE          BIT(2)
234
235 /* UNICAM_CMP[0,1] register */
236 #define UNICAM_PCE              BIT(31)
237 #define UNICAM_GI               BIT(9)
238 #define UNICAM_CPH              BIT(8)
239 #define UNICAM_PCVC_MASK        GENMASK(7, 6)
240 #define UNICAM_PCDT_MASK        GENMASK(5, 0)
241
242 /* UNICAM_MISC register */
243 #define UNICAM_FL0              BIT(6)
244 #define UNICAM_FL1              BIT(9)
245
246 #endif
This page took 0.046929 seconds and 4 git commands to generate.