GNU Linux-libre 4.14.303-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / css_2401_csi2p_system / host / system_local.h
1 /*
2  * Support for Intel Camera Imaging ISP subsystem.
3  * Copyright (c) 2015, Intel Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  */
14
15 #ifndef __SYSTEM_LOCAL_H_INCLUDED__
16 #define __SYSTEM_LOCAL_H_INCLUDED__
17
18 #ifdef HRT_ISP_CSS_CUSTOM_HOST
19 #ifndef HRT_USE_VIR_ADDRS
20 #define HRT_USE_VIR_ADDRS
21 #endif
22 /* This interface is deprecated */
23 /*#include "hive_isp_css_custom_host_hrt.h"*/
24 #endif
25
26 #include "system_global.h"
27
28 #ifdef __FIST__
29 #define HRT_ADDRESS_WIDTH       32              /* Surprise, this is a local property and even differs per platform */
30 #else
31 #define HRT_ADDRESS_WIDTH       64              /* Surprise, this is a local property */
32 #endif
33
34 #if !defined(__KERNEL__) || (1 == 1)
35 /* This interface is deprecated */
36 #include "hrt/hive_types.h"
37 #else  /* __KERNEL__ */
38 #include <type_support.h>
39
40 #if HRT_ADDRESS_WIDTH == 64
41 typedef uint64_t                        hrt_address;
42 #elif HRT_ADDRESS_WIDTH == 32
43 typedef uint32_t                        hrt_address;
44 #else
45 #error "system_local.h: HRT_ADDRESS_WIDTH must be one of {32,64}"
46 #endif
47
48 typedef uint32_t                        hrt_vaddress;
49 typedef uint32_t                        hrt_data;
50 #endif /* __KERNEL__ */
51
52 /*
53  * Cell specific address maps
54  */
55 #if HRT_ADDRESS_WIDTH == 64
56
57 #define GP_FIFO_BASE   ((hrt_address)0x0000000000090104)                /* This is NOT a base address */
58
59 /* DDR */
60 static const hrt_address DDR_BASE[N_DDR_ID] = {
61         0x0000000120000000ULL};
62
63 /* ISP */
64 static const hrt_address ISP_CTRL_BASE[N_ISP_ID] = {
65         0x0000000000020000ULL};
66
67 static const hrt_address ISP_DMEM_BASE[N_ISP_ID] = {
68         0x0000000000200000ULL};
69
70 static const hrt_address ISP_BAMEM_BASE[N_BAMEM_ID] = {
71         0x0000000000100000ULL};
72
73 static const hrt_address ISP_VAMEM_BASE[N_VAMEM_ID] = {
74         0x00000000001C0000ULL,
75         0x00000000001D0000ULL,
76         0x00000000001E0000ULL};
77
78 static const hrt_address ISP_HMEM_BASE[N_HMEM_ID] = {
79         0x00000000001F0000ULL};
80
81 /* SP */
82 static const hrt_address SP_CTRL_BASE[N_SP_ID] = {
83         0x0000000000010000ULL};
84
85 static const hrt_address SP_DMEM_BASE[N_SP_ID] = {
86         0x0000000000300000ULL};
87
88 /* MMU */
89 #if defined(IS_ISP_2400_MAMOIADA_SYSTEM) || defined(IS_ISP_2401_MAMOIADA_SYSTEM)
90 /*
91  * MMU0_ID: The data MMU
92  * MMU1_ID: The icache MMU
93  */
94 static const hrt_address MMU_BASE[N_MMU_ID] = {
95         0x0000000000070000ULL,
96         0x00000000000A0000ULL};
97 #else
98 #error "system_local.h: SYSTEM must be one of {2400, 2401 }"
99 #endif
100
101 /* DMA */
102 static const hrt_address DMA_BASE[N_DMA_ID] = {
103         0x0000000000040000ULL};
104
105 static const hrt_address ISYS2401_DMA_BASE[N_ISYS2401_DMA_ID] = {
106         0x00000000000CA000ULL};
107
108 /* IRQ */
109 static const hrt_address IRQ_BASE[N_IRQ_ID] = {
110         0x0000000000000500ULL,
111         0x0000000000030A00ULL,
112         0x000000000008C000ULL,
113         0x0000000000090200ULL};
114 /*
115         0x0000000000000500ULL};
116  */
117
118 /* GDC */
119 static const hrt_address GDC_BASE[N_GDC_ID] = {
120         0x0000000000050000ULL,
121         0x0000000000060000ULL};
122
123 /* FIFO_MONITOR (not a subset of GP_DEVICE) */
124 static const hrt_address FIFO_MONITOR_BASE[N_FIFO_MONITOR_ID] = {
125         0x0000000000000000ULL};
126
127 /*
128 static const hrt_address GP_REGS_BASE[N_GP_REGS_ID] = {
129         0x0000000000000000ULL};
130
131 static const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = {
132         0x0000000000090000ULL};
133 */
134
135 /* GP_DEVICE (single base for all separate GP_REG instances) */
136 static const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = {
137         0x0000000000000000ULL};
138
139 /*GP TIMER , all timer registers are inter-twined,
140  * so, having multiple base addresses for
141  * different timers does not help*/
142 static const hrt_address GP_TIMER_BASE =
143         (hrt_address)0x0000000000000600ULL;
144
145 /* GPIO */
146 static const hrt_address GPIO_BASE[N_GPIO_ID] = {
147         0x0000000000000400ULL};
148
149 /* TIMED_CTRL */
150 static const hrt_address TIMED_CTRL_BASE[N_TIMED_CTRL_ID] = {
151         0x0000000000000100ULL};
152
153
154 /* INPUT_FORMATTER */
155 static const hrt_address INPUT_FORMATTER_BASE[N_INPUT_FORMATTER_ID] = {
156         0x0000000000030000ULL,
157         0x0000000000030200ULL,
158         0x0000000000030400ULL,
159         0x0000000000030600ULL}; /* memcpy() */
160
161 /* INPUT_SYSTEM */
162 static const hrt_address INPUT_SYSTEM_BASE[N_INPUT_SYSTEM_ID] = {
163         0x0000000000080000ULL};
164 /*      0x0000000000081000ULL, */ /* capture A */
165 /*      0x0000000000082000ULL, */ /* capture B */
166 /*      0x0000000000083000ULL, */ /* capture C */
167 /*      0x0000000000084000ULL, */ /* Acquisition */
168 /*      0x0000000000085000ULL, */ /* DMA */
169 /*      0x0000000000089000ULL, */ /* ctrl */
170 /*      0x000000000008A000ULL, */ /* GP regs */
171 /*      0x000000000008B000ULL, */ /* FIFO */
172 /*      0x000000000008C000ULL, */ /* IRQ */
173
174 /* RX, the MIPI lane control regs start at offset 0 */
175 static const hrt_address RX_BASE[N_RX_ID] = {
176         0x0000000000080100ULL};
177
178 /* IBUF_CTRL, part of the Input System 2401 */
179 static const hrt_address IBUF_CTRL_BASE[N_IBUF_CTRL_ID] = {
180         0x00000000000C1800ULL,  /* ibuf controller A */
181         0x00000000000C3800ULL,  /* ibuf controller B */
182         0x00000000000C5800ULL   /* ibuf controller C */
183 };
184
185 /* ISYS IRQ Controllers, part of the Input System 2401 */
186 static const hrt_address ISYS_IRQ_BASE[N_ISYS_IRQ_ID] = {
187         0x00000000000C1400ULL,  /* port a */
188         0x00000000000C3400ULL,  /* port b */
189         0x00000000000C5400ULL   /* port c */
190 };
191
192 /* CSI FE, part of the Input System 2401 */
193 static const hrt_address CSI_RX_FE_CTRL_BASE[N_CSI_RX_FRONTEND_ID] = {
194         0x00000000000C0400ULL,  /* csi fe controller A */
195         0x00000000000C2400ULL,  /* csi fe controller B */
196         0x00000000000C4400ULL   /* csi fe controller C */
197 };
198 /* CSI BE, part of the Input System 2401 */
199 static const hrt_address CSI_RX_BE_CTRL_BASE[N_CSI_RX_BACKEND_ID] = {
200         0x00000000000C0800ULL,  /* csi be controller A */
201         0x00000000000C2800ULL,  /* csi be controller B */
202         0x00000000000C4800ULL   /* csi be controller C */
203 };
204 /* PIXEL Generator, part of the Input System 2401 */
205 static const hrt_address PIXELGEN_CTRL_BASE[N_PIXELGEN_ID] = {
206         0x00000000000C1000ULL,  /* pixel gen controller A */
207         0x00000000000C3000ULL,  /* pixel gen controller B */
208         0x00000000000C5000ULL   /* pixel gen controller C */
209 };
210 /* Stream2MMIO, part of the Input System 2401 */
211 static const hrt_address STREAM2MMIO_CTRL_BASE[N_STREAM2MMIO_ID] = {
212         0x00000000000C0C00ULL,  /* stream2mmio controller A */
213         0x00000000000C2C00ULL,  /* stream2mmio controller B */
214         0x00000000000C4C00ULL   /* stream2mmio controller C */
215 };
216 #elif HRT_ADDRESS_WIDTH == 32
217
218 #define GP_FIFO_BASE   ((hrt_address)0x00090104)                /* This is NOT a base address */
219
220 /* DDR : Attention, this value not defined in 32-bit */
221 static const hrt_address DDR_BASE[N_DDR_ID] = {
222         0x00000000UL};
223
224 /* ISP */
225 static const hrt_address ISP_CTRL_BASE[N_ISP_ID] = {
226         0x00020000UL};
227
228 static const hrt_address ISP_DMEM_BASE[N_ISP_ID] = {
229         0xffffffffUL};
230
231 static const hrt_address ISP_BAMEM_BASE[N_BAMEM_ID] = {
232         0xffffffffUL};
233
234 static const hrt_address ISP_VAMEM_BASE[N_VAMEM_ID] = {
235         0xffffffffUL,
236         0xffffffffUL,
237         0xffffffffUL};
238
239 static const hrt_address ISP_HMEM_BASE[N_HMEM_ID] = {
240         0xffffffffUL};
241
242 /* SP */
243 static const hrt_address SP_CTRL_BASE[N_SP_ID] = {
244         0x00010000UL};
245
246 static const hrt_address SP_DMEM_BASE[N_SP_ID] = {
247         0x00300000UL};
248
249 /* MMU */
250 #if defined(IS_ISP_2400_MAMOIADA_SYSTEM) || defined(IS_ISP_2401_MAMOIADA_SYSTEM)
251 /*
252  * MMU0_ID: The data MMU
253  * MMU1_ID: The icache MMU
254  */
255 static const hrt_address MMU_BASE[N_MMU_ID] = {
256         0x00070000UL,
257         0x000A0000UL};
258 #else
259 #error "system_local.h: SYSTEM must be one of {2400, 2401 }"
260 #endif
261
262 /* DMA */
263 static const hrt_address DMA_BASE[N_DMA_ID] = {
264         0x00040000UL};
265
266 static const hrt_address ISYS2401_DMA_BASE[N_ISYS2401_DMA_ID] = {
267         0x000CA000UL};
268
269 /* IRQ */
270 static const hrt_address IRQ_BASE[N_IRQ_ID] = {
271         0x00000500UL,
272         0x00030A00UL,
273         0x0008C000UL,
274         0x00090200UL};
275 /*
276         0x00000500UL};
277  */
278
279 /* GDC */
280 static const hrt_address GDC_BASE[N_GDC_ID] = {
281         0x00050000UL,
282         0x00060000UL};
283
284 /* FIFO_MONITOR (not a subset of GP_DEVICE) */
285 static const hrt_address FIFO_MONITOR_BASE[N_FIFO_MONITOR_ID] = {
286         0x00000000UL};
287
288 /*
289 static const hrt_address GP_REGS_BASE[N_GP_REGS_ID] = {
290         0x00000000UL};
291
292 static const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = {
293         0x00090000UL};
294 */
295
296 /* GP_DEVICE (single base for all separate GP_REG instances) */
297 static const hrt_address GP_DEVICE_BASE[N_GP_DEVICE_ID] = {
298         0x00000000UL};
299
300 /*GP TIMER , all timer registers are inter-twined,
301  * so, having multiple base addresses for
302  * different timers does not help*/
303 static const hrt_address GP_TIMER_BASE =
304         (hrt_address)0x00000600UL;
305 /* GPIO */
306 static const hrt_address GPIO_BASE[N_GPIO_ID] = {
307         0x00000400UL};
308
309 /* TIMED_CTRL */
310 static const hrt_address TIMED_CTRL_BASE[N_TIMED_CTRL_ID] = {
311         0x00000100UL};
312
313
314 /* INPUT_FORMATTER */
315 static const hrt_address INPUT_FORMATTER_BASE[N_INPUT_FORMATTER_ID] = {
316         0x00030000UL,
317         0x00030200UL,
318         0x00030400UL};
319 /*      0x00030600UL, */ /* memcpy() */
320
321 /* INPUT_SYSTEM */
322 static const hrt_address INPUT_SYSTEM_BASE[N_INPUT_SYSTEM_ID] = {
323         0x00080000UL};
324 /*      0x00081000UL, */ /* capture A */
325 /*      0x00082000UL, */ /* capture B */
326 /*      0x00083000UL, */ /* capture C */
327 /*      0x00084000UL, */ /* Acquisition */
328 /*      0x00085000UL, */ /* DMA */
329 /*      0x00089000UL, */ /* ctrl */
330 /*      0x0008A000UL, */ /* GP regs */
331 /*      0x0008B000UL, */ /* FIFO */
332 /*      0x0008C000UL, */ /* IRQ */
333
334 /* RX, the MIPI lane control regs start at offset 0 */
335 static const hrt_address RX_BASE[N_RX_ID] = {
336         0x00080100UL};
337
338 /* IBUF_CTRL, part of the Input System 2401 */
339 static const hrt_address IBUF_CTRL_BASE[N_IBUF_CTRL_ID] = {
340         0x000C1800UL,   /* ibuf controller A */
341         0x000C3800UL,   /* ibuf controller B */
342         0x000C5800UL    /* ibuf controller C */
343 };
344
345 /* ISYS IRQ Controllers, part of the Input System 2401 */
346 static const hrt_address ISYS_IRQ_BASE[N_ISYS_IRQ_ID] = {
347         0x000C1400ULL,  /* port a */
348         0x000C3400ULL,  /* port b */
349         0x000C5400ULL   /* port c */
350 };
351
352 /* CSI FE, part of the Input System 2401 */
353 static const hrt_address CSI_RX_FE_CTRL_BASE[N_CSI_RX_FRONTEND_ID] = {
354         0x000C0400UL,   /* csi fe controller A */
355         0x000C2400UL,   /* csi fe controller B */
356         0x000C4400UL    /* csi fe controller C */
357 };
358 /* CSI BE, part of the Input System 2401 */
359 static const hrt_address CSI_RX_FE_CTRL_BASE[N_CSI_RX_BACKEND_ID] = {
360         0x000C0800UL,   /* csi be controller A */
361         0x000C2800UL,   /* csi be controller B */
362         0x000C4800UL    /* csi be controller C */
363 };
364 /* PIXEL Generator, part of the Input System 2401 */
365 static const hrt_address PIXELGEN_CTRL_BASE[N_PIXELGEN_ID] = {
366         0x000C1000UL,   /* pixel gen controller A */
367         0x000C3000UL,   /* pixel gen controller B */
368         0x000C5000UL    /* pixel gen controller C */
369 };
370 /* Stream2MMIO, part of the Input System 2401 */
371 static const hrt_address STREAM2MMIO_CTRL_BASE[N_STREAM2MMIO_ID] = {
372         0x000C0C00UL,   /* stream2mmio controller A */
373         0x000C2C00UL,   /* stream2mmio controller B */
374         0x000C4C00UL    /* stream2mmio controller C */
375 };
376
377 #else
378 #error "system_local.h: HRT_ADDRESS_WIDTH must be one of {32,64}"
379 #endif
380
381 #endif /* __SYSTEM_LOCAL_H_INCLUDED__ */