PDK API Guide for J721E
csirx_soc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Texas Instruments Incorporated 2018-2022
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the
15  * distribution.
16  *
17  * Neither the name of Texas Instruments Incorporated nor the names of
18  * its contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
48 #ifndef CSIRX_SOC_H_
49 #define CSIRX_SOC_H_
50 
51 /* ========================================================================== */
52 /* Include Files */
53 /* ========================================================================== */
54 
55 /* None */
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
61 /* ========================================================================== */
62 /* Macros & Typedefs */
63 /* ========================================================================== */
72 #define CSIRX_INSTANCE_ID_0 ((uint32_t) 0x0U)
73 
74 #define CSIRX_INSTANCE_ID_1 ((uint32_t) 0x1U)
75 
76 #if defined (SOC_J784S4)
77 
78 #define CSIRX_INSTANCE_ID_2 ((uint32_t) 0x2U)
79 
81 #define CSIRX_INSTANCE_ID_MAX ((uint32_t) 0x3U)
82 #else
83 #define CSIRX_INSTANCE_ID_MAX ((uint32_t) 0x2U)
84 #endif
85 
86 /* @} */
87 
89 #define CSIRX_NUM_VIRTUAL_CONTEXT (8U)
90 
92 /* TODO: This should be 'CSIRX_MAX_NUM_OF_STREAMS' when OTF is supported*/
93 /* Capture and Loop-back streams are supported */
94 #define CSIRX_NUM_STREAM (2U)
95 
105 #define CSIRX_NUM_STRMS_CAPT CSIRX_INSTANCE_ID_MAX
106 
108 #define CSIRX_NUM_STRMS_OTF ((uint32_t) 1U)
109 
110 #define CSIRX_NUM_STRMS_LPBK CSIRX_INSTANCE_ID_MAX
111 
112 #define CSIRX_NUM_CH_CAPT ((uint32_t) 32U)
113 
114 #define CSIRX_NUM_CH_CAPT_MAX ((uint32_t) (CSIRX_NUM_CH_CAPT *\
115  CSIRX_INSTANCE_ID_MAX))
116 
117 #define CSIRX_NUM_CH_OTF_MAX ((uint32_t) 1U)
118 
122 #define CSIRX_NUM_CH_LPBK_MAX ((uint32_t) 4U)
123 
126 #define CSIRX_NUM_CH_MAX ((uint32_t) (CSIRX_NUM_CH_CAPT +\
127  CSIRX_NUM_CH_OTF_MAX +\
128  CSIRX_NUM_CH_LPBK_MAX))
129 
131 #define CSIRX_CAPT_DATA_LANES_MAX ((uint32_t)4U)
132 /* @} */
133 
142 #define CSIRX_LANE_BAND_SPEED_80_TO_100_MBPS ((uint32_t) 0x00U)
143 
144 #define CSIRX_LANE_BAND_SPEED_100_TO_120_MBPS ((uint32_t) 0x01U)
145 
146 #define CSIRX_LANE_BAND_SPEED_120_TO_160_MBPS ((uint32_t) 0x02U)
147 
148 #define CSIRX_LANE_BAND_SPEED_160_TO_200_MBPS ((uint32_t) 0x03U)
149 
150 #define CSIRX_LANE_BAND_SPEED_200_TO_240_MBPS ((uint32_t) 0x04U)
151 
152 #define CSIRX_LANE_BAND_SPEED_240_TO_280_MBPS ((uint32_t) 0x05U)
153 
154 #define CSIRX_LANE_BAND_SPEED_280_TO_320_MBPS ((uint32_t) 0x06U)
155 
156 #define CSIRX_LANE_BAND_SPEED_320_TO_360_MBPS ((uint32_t) 0x07U)
157 
158 #define CSIRX_LANE_BAND_SPEED_360_TO_400_MBPS ((uint32_t) 0x08U)
159 
160 #define CSIRX_LANE_BAND_SPEED_400_TO_480_MBPS ((uint32_t) 0x09U)
161 
162 #define CSIRX_LANE_BAND_SPEED_480_TO_560_MBPS ((uint32_t) 0x0AU)
163 
164 #define CSIRX_LANE_BAND_SPEED_560_TO_640_MBPS ((uint32_t) 0x0BU)
165 
166 #define CSIRX_LANE_BAND_SPEED_640_TO_720_MBPS ((uint32_t) 0x0CU)
167 
168 #define CSIRX_LANE_BAND_SPEED_720_TO_800_MBPS ((uint32_t) 0x0DU)
169 
170 #define CSIRX_LANE_BAND_SPEED_800_TO_880_MBPS ((uint32_t) 0x0EU)
171 
172 #define CSIRX_LANE_BAND_SPEED_880_TO_1040_MBPS ((uint32_t) 0x0FU)
173 
174 #define CSIRX_LANE_BAND_SPEED_1040_TO_1200_MBPS ((uint32_t) 0x10U)
175 
176 #define CSIRX_LANE_BAND_SPEED_1200_TO_1350_MBPS ((uint32_t) 0x11U)
177 
178 #define CSIRX_LANE_BAND_SPEED_1350_TO_1500_MBPS ((uint32_t) 0x12U)
179 
180 #define CSIRX_LANE_BAND_SPEED_1500_TO_1750_MBPS ((uint32_t) 0x13U)
181 
182 #define CSIRX_LANE_BAND_SPEED_1750_TO_2000_MBPS ((uint32_t) 0x14U)
183 
184 #define CSIRX_LANE_BAND_SPEED_2000_TO_2250_MBPS ((uint32_t) 0x15U)
185 
186 #define CSIRX_LANE_BAND_SPEED_2250_TO_2500_MBPS ((uint32_t) 0x16U)
187 
188 #define CSIRX_LANE_BAND_SPEED_RESERVED ((uint32_t) 0x17U)
189 /* @} */
190 
198 #if defined (BUILD_MCU2_0) || defined (BUILD_MCU2_1)
199 
200 #define CSIRX_CORE_INTR_NUM_MOD_0_ERR_INTR \
201  (CSLR_R5FSS0_CORE0_INTR_CSI_RX_IF0_CSI_ERR_IRQ_0)
202 
203 #define CSIRX_CORE_INTR_NUM_MOD_0_INFO_INTR \
204  (CSLR_R5FSS0_CORE0_INTR_CSI_RX_IF0_CSI_IRQ_0)
205 
206 #define CSIRX_CORE_INTR_NUM_MOD_0_LEVEL_INTR \
207  (CSLR_R5FSS0_CORE0_INTR_CSI_RX_IF0_CSI_LEVEL_0)
208 
209 #define CSIRX_CORE_INTR_NUM_MOD_1_ERR_INTR \
210  (CSLR_R5FSS0_CORE0_INTR_CSI_RX_IF1_CSI_ERR_IRQ_0)
211 
212 #define CSIRX_CORE_INTR_NUM_MOD_1_INFO_INTR \
213  (CSLR_R5FSS0_CORE0_INTR_CSI_RX_IF1_CSI_IRQ_0)
214 
215 #define CSIRX_CORE_INTR_NUM_MOD_1_LEVEL_INTR \
216  (CSLR_R5FSS0_CORE0_INTR_CSI_RX_IF1_CSI_LEVEL_0)
217 #if defined (SOC_J784S4)
218 
219 #define CSIRX_CORE_INTR_NUM_MOD_2_ERR_INTR \
220  (CSLR_R5FSS0_CORE0_INTR_CSI_RX_IF2_CSI_ERR_IRQ_0)
221 
222 #define CSIRX_CORE_INTR_NUM_MOD_2_INFO_INTR \
223  (CSLR_R5FSS0_CORE0_INTR_CSI_RX_IF2_CSI_IRQ_0)
224 
225 #define CSIRX_CORE_INTR_NUM_MOD_2_LEVEL_INTR \
226  (CSLR_R5FSS0_CORE0_INTR_CSI_RX_IF2_CSI_LEVEL_0)
227 
228 #endif
229 #endif
230 #if defined (BUILD_MPU1_0)
231 
232 #define CSIRX_CORE_INTR_NUM_MOD_0_ERR_INTR \
233  (CSLR_COMPUTE_CLUSTER0_GIC500SS_SPI_CSI_RX_IF0_CSI_ERR_IRQ_0)
234 
235 #define CSIRX_CORE_INTR_NUM_MOD_0_INFO_INTR \
236  (CSLR_COMPUTE_CLUSTER0_GIC500SS_SPI_CSI_RX_IF0_CSI_IRQ_0)
237 
238 #define CSIRX_CORE_INTR_NUM_MOD_0_LEVEL_INTR \
239  (CSLR_COMPUTE_CLUSTER0_GIC500SS_SPI_CSI_RX_IF0_CSI_LEVEL_0)
240 
241 #define CSIRX_CORE_INTR_NUM_MOD_1_ERR_INTR \
242  (CSLR_COMPUTE_CLUSTER0_GIC500SS_SPI_CSI_RX_IF1_CSI_ERR_IRQ_0)
243 
244 #define CSIRX_CORE_INTR_NUM_MOD_1_INFO_INTR \
245  (CSLR_COMPUTE_CLUSTER0_GIC500SS_SPI_CSI_RX_IF1_CSI_IRQ_0)
246 
247 #define CSIRX_CORE_INTR_NUM_MOD_1_LEVEL_INTR \
248  (CSLR_COMPUTE_CLUSTER0_GIC500SS_SPI_CSI_RX_IF1_CSI_LEVEL_0)
249 #if defined (SOC_J784S4)
250 
251 #define CSIRX_CORE_INTR_NUM_MOD_2_ERR_INTR \
252  (CSLR_COMPUTE_CLUSTER0_GIC500SS_SPI_CSI_RX_IF2_CSI_ERR_IRQ_0)
253 
254 #define CSIRX_CORE_INTR_NUM_MOD_2_INFO_INTR \
255  (CSLR_COMPUTE_CLUSTER0_GIC500SS_SPI_CSI_RX_IF2_CSI_IRQ_0)
256 
257 #define CSIRX_CORE_INTR_NUM_MOD_2_LEVEL_INTR \
258  (CSLR_COMPUTE_CLUSTER0_GIC500SS_SPI_CSI_RX_IF2_CSI_LEVEL_0)
259 #endif
260 #endif
261 /* @} */
262 
263 
265 #define CSIRX_CORE_PIXEL_OUTPUT_BUS_WIDTH (32U)
266 /* ========================================================================== */
267 /* Structure Declarations */
268 /* ========================================================================== */
272 typedef struct
273 {
274  uint32_t inst;
277  uint32_t psmClkFreqDiv;
286  uint32_t bandGapTimerVal;
289 } Csirx_DPhyCfg;
290 
291 /* ========================================================================== */
292 /* Global Variables */
293 /* ========================================================================== */
294 
295 /* None */
296 
297 /* ========================================================================== */
298 /* Function Declarations */
299 /* ========================================================================== */
307 static inline void Csirx_initDPhyCfg(Csirx_DPhyCfg *dphyCfg);
308 
309 void CsirxDrv_dphyrxWrapPsmClockConfig(uint32_t addr, uint32_t value);
310 
312  const Csirx_DPhyCfg *dphyCfg);
313 
314 void CsirxDrv_dphyrxCoreLaneReady(uint32_t addr, uint32_t numLanes);
315 
316 void CsirxDrv_dphyrxCoreCommonReady(uint32_t addr);
317 
318 int32_t CsirxDrv_checkDphyrxConfig(const Csirx_DPhyCfg *programmedCfg,
319  const Csirx_DPhyCfg *newCfg);
320 
321 void CsirxDrv_dphyrxPsoDisable(uint32_t addr, uint32_t value);
322 
323 void CsirxDrv_dphyCommonReset(uint32_t addr, uint32_t value);
324 
326  const Csirx_DPhyCfg *dphyCfg);
327 
328 /* ========================================================================== */
329 /* Static Function Definitions */
330 /* ========================================================================== */
331 static inline void Csirx_initDPhyCfg(Csirx_DPhyCfg *dphyCfg)
332 {
333  dphyCfg->inst = CSIRX_INSTANCE_ID_0;
334  dphyCfg->psmClkFreqDiv = 0x53;
337  dphyCfg->bandGapTimerVal = 0x14;
338 }
339 
340 #ifdef __cplusplus
341 }
342 #endif
343 
344 #endif /* #ifndef CSIRX_SOC_H_ */
345 
346 /* @} */
void CsirxDrv_dphyrxCoreCommonReady(uint32_t addr)
#define CSIRX_INSTANCE_ID_0
CSIRX Module Instance ID: CSI2RX Module 0.
Definition: csirx_soc.h:72
void CsirxDrv_dphyrxPsoDisable(uint32_t addr, uint32_t value)
uint32_t value
Definition: tisci_otp_revision.h:199
static void Csirx_initDPhyCfg(Csirx_DPhyCfg *dphyCfg)
Csirx_DPhyCfg structure init function. Called through 'IOCTL_CSIRX_SET_DPHY_CONFIG' IOCTL.
Definition: csirx_soc.h:331
void CsirxDrv_dphyrxSetLaneBandSpeed(uint32_t addr, const Csirx_DPhyCfg *dphyCfg)
#define CSIRX_LANE_BAND_SPEED_1350_TO_1500_MBPS
Lane Band Speed: 1350 Mbps to 1500 Mbps.
Definition: csirx_soc.h:178
uint32_t inst
Definition: csirx_soc.h:274
D-PHY configuration structure.
Definition: csirx_soc.h:272
void CsirxDrv_dphyCommonReset(uint32_t addr, uint32_t value)
uint32_t psmClkFreqDiv
Definition: csirx_soc.h:277
uint64_t addr
Definition: csl_udmap_tr.h:216
void CsirxDrv_dphyrxCoreLaneReady(uint32_t addr, uint32_t numLanes)
void CsirxDrv_dphyrxCorePpiClockConfig(uint32_t addr, const Csirx_DPhyCfg *dphyCfg)
int32_t CsirxDrv_checkDphyrxConfig(const Csirx_DPhyCfg *programmedCfg, const Csirx_DPhyCfg *newCfg)
void CsirxDrv_dphyrxWrapPsmClockConfig(uint32_t addr, uint32_t value)
uint32_t bandGapTimerVal
Definition: csirx_soc.h:286
uint32_t rightLaneBandSpeed
Definition: csirx_soc.h:283
uint32_t leftLaneBandSpeed
Definition: csirx_soc.h:280