PDK API Guide for J721E
csirx_soc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Texas Instruments Incorporated 2018-2019
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 #define CSIRX_INSTANCE_ID_MAX ((uint32_t) 0x2U)
77 /* @} */
78 
80 #define CSIRX_NUM_VIRTUAL_CONTEXT (8U)
81 
83 /* TODO: This should be 'CSIRX_MAX_NUM_OF_STREAMS' when OTF and LPBK are supported */
84 #define CSIRX_NUM_STREAM (1U)
85 
95 #define CSIRX_NUM_STRMS_CAPT ((uint32_t) 2U)
96 
98 #define CSIRX_NUM_STRMS_OTF ((uint32_t) 1U)
99 
100 #define CSIRX_NUM_STRMS_LPBK ((uint32_t) 2U)
101 
102 #define CSIRX_NUM_CH_CAPT ((uint32_t) 32U)
103 
104 #define CSIRX_NUM_CH_CAPT_MAX ((uint32_t) (CSIRX_NUM_CH_CAPT *\
105  CSIRX_INSTANCE_ID_MAX))
106 
107 #define CSIRX_NUM_CH_OTF_MAX ((uint32_t) 1U)
108 
112 #define CSIRX_NUM_CH_LPBK_MAX ((uint32_t) 1U)
113 
116 #define CSIRX_NUM_CH_MAX ((uint32_t) (CSIRX_NUM_CH_CAPT +\
117  CSIRX_NUM_CH_OTF_MAX +\
118  CSIRX_NUM_CH_LPBK_MAX))
119 
121 #define CSIRX_CAPT_DATA_LANES_MAX ((uint32_t)4U)
122 /* @} */
123 
132 #define CSIRX_LANE_BAND_SPEED_80_TO_100_MBPS ((uint32_t) 0x00U)
133 
134 #define CSIRX_LANE_BAND_SPEED_100_TO_120_MBPS ((uint32_t) 0x01U)
135 
136 #define CSIRX_LANE_BAND_SPEED_120_TO_160_MBPS ((uint32_t) 0x02U)
137 
138 #define CSIRX_LANE_BAND_SPEED_160_TO_200_MBPS ((uint32_t) 0x03U)
139 
140 #define CSIRX_LANE_BAND_SPEED_200_TO_240_MBPS ((uint32_t) 0x04U)
141 
142 #define CSIRX_LANE_BAND_SPEED_240_TO_280_MBPS ((uint32_t) 0x05U)
143 
144 #define CSIRX_LANE_BAND_SPEED_280_TO_320_MBPS ((uint32_t) 0x06U)
145 
146 #define CSIRX_LANE_BAND_SPEED_320_TO_360_MBPS ((uint32_t) 0x07U)
147 
148 #define CSIRX_LANE_BAND_SPEED_360_TO_400_MBPS ((uint32_t) 0x08U)
149 
150 #define CSIRX_LANE_BAND_SPEED_400_TO_480_MBPS ((uint32_t) 0x09U)
151 
152 #define CSIRX_LANE_BAND_SPEED_480_TO_560_MBPS ((uint32_t) 0x0AU)
153 
154 #define CSIRX_LANE_BAND_SPEED_560_TO_640_MBPS ((uint32_t) 0x0BU)
155 
156 #define CSIRX_LANE_BAND_SPEED_640_TO_720_MBPS ((uint32_t) 0x0CU)
157 
158 #define CSIRX_LANE_BAND_SPEED_720_TO_800_MBPS ((uint32_t) 0x0DU)
159 
160 #define CSIRX_LANE_BAND_SPEED_800_TO_880_MBPS ((uint32_t) 0x0EU)
161 
162 #define CSIRX_LANE_BAND_SPEED_880_TO_1040_MBPS ((uint32_t) 0x0FU)
163 
164 #define CSIRX_LANE_BAND_SPEED_1040_TO_1200_MBPS ((uint32_t) 0x10U)
165 
166 #define CSIRX_LANE_BAND_SPEED_1200_TO_1350_MBPS ((uint32_t) 0x11U)
167 
168 #define CSIRX_LANE_BAND_SPEED_1350_TO_1500_MBPS ((uint32_t) 0x12U)
169 
170 #define CSIRX_LANE_BAND_SPEED_1500_TO_1750_MBPS ((uint32_t) 0x13U)
171 
172 #define CSIRX_LANE_BAND_SPEED_1750_TO_2000_MBPS ((uint32_t) 0x14U)
173 
174 #define CSIRX_LANE_BAND_SPEED_2000_TO_2250_MBPS ((uint32_t) 0x15U)
175 
176 #define CSIRX_LANE_BAND_SPEED_2250_TO_2500_MBPS ((uint32_t) 0x16U)
177 
178 #define CSIRX_LANE_BAND_SPEED_RESERVED ((uint32_t) 0x17U)
179 /* @} */
180 
188 #if defined (BUILD_MCU2_0) || defined (BUILD_MCU2_1)
189 
190 #define CSIRX_CORE_INTR_NUM_MOD_0_ERR_INTR \
191  (CSLR_R5FSS0_CORE0_INTR_CSI_RX_IF0_CSI_ERR_IRQ_0)
192 
193 #define CSIRX_CORE_INTR_NUM_MOD_0_INFO_INTR \
194  (CSLR_R5FSS0_CORE0_INTR_CSI_RX_IF0_CSI_IRQ_0)
195 
196 #define CSIRX_CORE_INTR_NUM_MOD_0_LEVEL_INTR \
197  (CSLR_R5FSS0_CORE0_INTR_CSI_RX_IF0_CSI_LEVEL_0)
198 
199 #define CSIRX_CORE_INTR_NUM_MOD_1_ERR_INTR \
200  (CSLR_R5FSS0_CORE0_INTR_CSI_RX_IF1_CSI_ERR_IRQ_0)
201 
202 #define CSIRX_CORE_INTR_NUM_MOD_1_INFO_INTR \
203  (CSLR_R5FSS0_CORE0_INTR_CSI_RX_IF1_CSI_IRQ_0)
204 
205 #define CSIRX_CORE_INTR_NUM_MOD_1_LEVEL_INTR \
206  (CSLR_R5FSS0_CORE0_INTR_CSI_RX_IF1_CSI_LEVEL_0)
207 #endif
208 #if defined (BUILD_MPU1_0)
209 
210 #define CSIRX_CORE_INTR_NUM_MOD_0_ERR_INTR \
211  (CSLR_COMPUTE_CLUSTER0_GIC500SS_SPI_CSI_RX_IF0_CSI_ERR_IRQ_0)
212 
213 #define CSIRX_CORE_INTR_NUM_MOD_0_INFO_INTR \
214  (CSLR_COMPUTE_CLUSTER0_GIC500SS_SPI_CSI_RX_IF0_CSI_IRQ_0)
215 
216 #define CSIRX_CORE_INTR_NUM_MOD_0_LEVEL_INTR \
217  (CSLR_COMPUTE_CLUSTER0_GIC500SS_SPI_CSI_RX_IF0_CSI_LEVEL_0)
218 
219 #define CSIRX_CORE_INTR_NUM_MOD_1_ERR_INTR \
220  (CSLR_COMPUTE_CLUSTER0_GIC500SS_SPI_CSI_RX_IF1_CSI_ERR_IRQ_0)
221 
222 #define CSIRX_CORE_INTR_NUM_MOD_1_INFO_INTR \
223  (CSLR_COMPUTE_CLUSTER0_GIC500SS_SPI_CSI_RX_IF1_CSI_IRQ_0)
224 
225 #define CSIRX_CORE_INTR_NUM_MOD_1_LEVEL_INTR \
226  (CSLR_COMPUTE_CLUSTER0_GIC500SS_SPI_CSI_RX_IF1_CSI_LEVEL_0)
227 #endif
228 /* @} */
229 
230 
232 #define CSIRX_CORE_PIXEL_OUTPUT_BUS_WIDTH (32U)
233 /* ========================================================================== */
234 /* Structure Declarations */
235 /* ========================================================================== */
239 typedef struct
240 {
241  uint32_t inst;
244  uint32_t psmClkFreqDiv;
253  uint32_t bandGapTimerVal;
256 } Csirx_DPhyCfg;
257 
258 /* ========================================================================== */
259 /* Global Variables */
260 /* ========================================================================== */
261 
262 /* None */
263 
264 /* ========================================================================== */
265 /* Function Declarations */
266 /* ========================================================================== */
274 static inline void Csirx_initDPhyCfg(Csirx_DPhyCfg *dphyCfg);
275 
276 void CsirxDrv_dphyrxWrapPsmClockConfig(uint32_t addr, uint32_t value);
277 
279  const Csirx_DPhyCfg *dphyCfg);
280 
281 void CsirxDrv_dphyrxCoreLaneReady(uint32_t addr, uint32_t numLanes);
282 
283 void CsirxDrv_dphyrxCoreCommonReady(uint32_t addr);
284 
285 int32_t CsirxDrv_checkDphyrxConfig(const Csirx_DPhyCfg *programmedCfg,
286  const Csirx_DPhyCfg *newCfg);
287 /* ========================================================================== */
288 /* Static Function Definitions */
289 /* ========================================================================== */
290 static inline void Csirx_initDPhyCfg(Csirx_DPhyCfg *dphyCfg)
291 {
292  dphyCfg->inst = CSIRX_INSTANCE_ID_0;
293  dphyCfg->psmClkFreqDiv = 0x53;
296  dphyCfg->bandGapTimerVal = 0x14;
297 }
298 
299 #ifdef __cplusplus
300 }
301 #endif
302 
303 #endif /* #ifndef CSIRX_SOC_H_ */
304 
305 /* @} */
void CsirxDrv_dphyrxCoreCommonReady(uint32_t addr)
#define CSIRX_INSTANCE_ID_0
CSIRX Module Instance ID: CSI2RX Module 0.
Definition: csirx_soc.h:72
uint32_t value
Definition: tisci_otp_revision.h:197
static void Csirx_initDPhyCfg(Csirx_DPhyCfg *dphyCfg)
Csirx_DPhyCfg structure init function. Called through 'IOCTL_CSIRX_SET_DPHY_CONFIG' IOCTL.
Definition: csirx_soc.h:290
#define CSIRX_LANE_BAND_SPEED_1350_TO_1500_MBPS
Lane Band Speed: 1350 Mbps to 1500 Mbps.
Definition: csirx_soc.h:168
uint32_t inst
Definition: csirx_soc.h:241
D-PHY configuration structure.
Definition: csirx_soc.h:239
uint32_t psmClkFreqDiv
Definition: csirx_soc.h:244
uint64_t addr
Definition: csl_udmap_tr.h:214
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:253
uint32_t rightLaneBandSpeed
Definition: csirx_soc.h:250
uint32_t leftLaneBandSpeed
Definition: csirx_soc.h:247