The MIPI D-PHY initialization sequence is not implemented within CSI2 PHY. The CAL CSI2 low level protocol coordinates the PHY initialization. The controller must ensure that the CSI2 PHY is held in RESET/WAIT for RX mode until the D-PHY transmitter is powered up and the link comes to the defined state. The controller can use the STOPSTATE and FORCERXMODE signals of CSI2 PHY for this purpose. STOPSTATE indicates the line states, while FORCERXMODE forces the receiver state-machine into "wait for stop state". In addition the pull down function on GPI buffer can be used to put a weak pull down on link. One possible initialization sequence is:
To fully initialize the CSI2 PHY, perform the following steps:
- Configure all CSI2 low level protocol registers to be ready to receive signals/data from the CSI2 PHY:
- Set CAL_CSI2_COMPLEXIO_CFG_l[18:16] DATA4_POSITION.
- Set CAL_CSI2_COMPLEXIO_CFG_l[14:12] DATA3_POSITION.
- Set CAL_CSI2_COMPLEXIO_CFG_l[10:8] DATA2_POSITION.
- Set CAL_CSI2_COMPLEXIO_CFG_l[6:4] DATA1_POSITION.
- Set CAL_CSI2_COMPLEXIO_CFG_l[2:0] CLOCK_POSITION.
- Set the CTRL_CORE_CONTROL_CSI[10:9] CSI0_CAMMODE (for CSI2_PHY1) and CTRL_CORE_CONTROL_CSI[2:1] CSI1_CAMMODE (for CSI2_PHY2).
CAUTION: The above settings must be done before the CSI2 PHY is active.
- A dedicated internal clock gate control is present for each CSI2 PHY. Enable/disable the internal CTRLCLK from the CTRL_CORE_CONTROL_CSI register by setting the following bits:
- [8] CSI0_CTRLCLKEN for CSI2_PHY1
- [0] CSI1_CTRLCLKEN for CSI2_PHY2
- CSI2 PHY and link initialization sequence:
- Deassert the CSI2 PHY reset:
- Set CAL_CSI2_COMPLEXIO_CFG_l[30] RESET_CTRL to 0x1.
CAUTION: For the CAL_CSI2_COMPLEXIO_CFG_l[29] RESET_DONE bit to be set to 0x1 (reset completed), the external sensor must to be active and sending the MIPI HS BYTECLK.
The following registers can be set only after deasserting the CSI2 PHY reset and before asserting the FORCERXMODE signal:
- Assert the FORCERXMODE signal:
- Set CAL_CSI2_TIMING_l[15] FORCE_RX_MODE_IO1 to 0x1.
- Connect pulldown on CSI2 PHY link (DP/DN) by asserting the respective PIPD signals (PIPD = 0):
For CSI2_PHY1 pulldown on signals through the SMA_SW_3[19] CSI2_0_XY_PIPD register bit.
For CSI2_PHY2 pulldown on signals through the SMA_SW_3[18] CSI2_1_XY_PIPD register bit.
- Power up the CSI2 PHY:
- Set CAL_CSI2_COMPLEXIO_CFG_l[28:27] PWR_CMD to 0x1.
- Check whether the state status reaches the ON state:
- Wait for STOPSTATE = 1 (for all enabled lane modules):
- The timer is set through the CAL_CSI2_TIMING_l[14:0] bit field. The reset value can be kept.
- Wait until CAL_CSI2_TIMING_l[15] FORCE_RX_MODE_IO1 = 0x0. It is automatically put at 0 when all enabled lanes are in STOPSTATE and the timer is finished.
- Release PIPD signals (PIPD = 1):
For CSI2_PHY1 pulldown on signals through the SMA_SW_3[19] CSI2_0_XY_PIPD register bit.
For CSI2_PHY2 pulldown on signals through the SMA_SW_3[18] CSI2_1_XY_PIPD register bit.
- The CSI2 PHY is initialized and ready/active in CSI-2 (D-PHY) mode.