1// Copyright 2018 The Fuchsia Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#pragma once 6 7/// define register access macros here 8 9////////////////////////////////////////////////// 10// DesignWare MIPI DSI Register Definitions 11////////////////////////////////////////////////// 12#define DW_DSI_VERSION (0x00 << 2) // contains the vers of the DSI host controller 13#define DW_DSI_PWR_UP (0x01 << 2) // controls the power up of the core 14#define DW_DSI_CLKMGR_CFG (0x02 << 2) // configs the factor for internal dividers 15#define DW_DSI_DPI_VCID (0x03 << 2) // configs the Virt Chan ID for DPI traffic 16#define DW_DSI_DPI_COLOR_CODING (0x04 << 2) // configs DPI color coding 17#define DW_DSI_DPI_CFG_POL (0x05 << 2) // configs the polarity of DPI signals 18#define DW_DSI_DPI_LP_CMD_TIM (0x06 << 2) // configs the timing for lp cmds (in vid mode) 19#define DW_DSI_DBI_VCID (0x07 << 2) // configs Virtual Channel ID for DBI traffic 20#define DW_DSI_DBI_CFG (0x08 << 2) // configs the bit width of pixels for DBI 21#define DW_DSI_DBI_PARTITIONING_EN (0x09 << 2) // host partition DBI traffic automatically 22#define DW_DSI_DBI_CMDSIZE (0x0A << 2) // cmd size for auto partitioning of DBI 23#define DW_DSI_PCKHDL_CFG (0x0B << 2) // how EoTp, BTA, CRC and ECC are to be used 24#define DW_DSI_GEN_VCID (0x0C << 2) // Virt Channel ID of READ responses to store 25#define DW_DSI_MODE_CFG (0x0D << 2) // mode of op between Video or Command Mode 26#define DW_DSI_VID_MODE_CFG (0x0E << 2) // Video mode operation config 27#define DW_DSI_VID_PKT_SIZE (0x0F << 2) // video packet size 28#define DW_DSI_VID_NUM_CHUNKS (0x10 << 2) // number of chunks to use 29#define DW_DSI_VID_NULL_SIZE (0x11 << 2) // configs the size of null packets 30#define DW_DSI_VID_HSA_TIME (0x12 << 2) // configs the video HSA time 31#define DW_DSI_VID_HBP_TIME (0x13 << 2) // configs the video HBP time 32#define DW_DSI_VID_HLINE_TIME (0x14 << 2) // configs the overall time for each video line 33#define DW_DSI_VID_VSA_LINES (0x15 << 2) // configs the VSA period 34#define DW_DSI_VID_VBP_LINES (0x16 << 2) // configs the VBP period 35#define DW_DSI_VID_VFP_LINES (0x17 << 2) // configs the VFP period 36#define DW_DSI_VID_VACTIVE_LINES (0x18 << 2) // configs the vertical resolution of video 37#define DW_DSI_EDPI_CMD_SIZE (0x19 << 2) // configs the size of eDPI packets 38#define DW_DSI_CMD_MODE_CFG (0x1A << 2) // command mode operation config 39#define DW_DSI_GEN_HDR (0x1B << 2) // header for new packets 40#define DW_DSI_GEN_PLD_DATA (0x1C << 2) // payload for packets sent using the Gen i/f 41#define DW_DSI_CMD_PKT_STATUS (0x1D << 2) // info about FIFOs related to DBI and Gen i/f 42#define DW_DSI_TO_CNT_CFG (0x1E << 2) // counters that trig timeout errors 43#define DW_DSI_HS_RD_TO_CNT (0x1F << 2) // Peri Resp timeout after HS Rd operations 44#define DW_DSI_LP_RD_TO_CNT (0x20 << 2) // Peri Resp timeout after LP Rd operations 45#define DW_DSI_HS_WR_TO_CNT (0x21 << 2) // Peri Resp timeout after HS Wr operations 46#define DW_DSI_LP_WR_TO_CNT (0x22 << 2) // Peri Resp timeout after LP Wr operations 47#define DW_DSI_BTA_TO_CNT (0x23 << 2) // Peri Resp timeout after Bus Turnaround comp 48#define DW_DSI_SDF_3D (0x24 << 2) // 3D cntrl info for VSS packets in video mode. 49#define DW_DSI_LPCLK_CTRL (0x25 << 2) // non continuous clock in the clock lane. 50#define DW_DSI_PHY_TMR_LPCLK_CFG (0x26 << 2) // time for the clock lane 51#define DW_DSI_PHY_TMR_CFG (0x27 << 2) // time for the data lanes 52#define DW_DSI_PHY_RSTZ (0x28 << 2) // controls resets and the PLL of the D-PHY. 53#define DW_DSI_PHY_IF_CFG (0x29 << 2) // number of active lanes 54#define DW_DSI_PHY_ULPS_CTRL (0x2A << 2) // entering and leaving ULPS in the D- PHY. 55#define DW_DSI_PHY_TX_TRIGGERS (0x2B << 2) // pins that activate triggers in the D-PHY 56#define DW_DSI_PHY_STATUS (0x2C << 2) // contains info about the status of the D- PHY 57#define DW_DSI_PHY_TST_CTRL0 (0x2D << 2) // controls clock and clear pins of the D-PHY 58#define DW_DSI_PHY_TST_CTRL1 (0x2E << 2) // controls data and enable pins of the D-PHY 59#define DW_DSI_INT_ST0 (0x3F << 2) // status of intr from ack and D-PHY 60#define DW_DSI_INT_ST1 (0x30 << 2) // status of intr related to timeout, ECC, etc 61#define DW_DSI_INT_MSK0 (0x31 << 2) // masks interrupts that affect the INT_ST0 reg 62#define DW_DSI_INT_MSK1 (0x32 << 2) // masks interrupts that affect the INT_ST1 reg 63 64////////////////////////////////////////////////// 65// DesignWare MIPI DSI Register Bit Definition 66////////////////////////////////////////////////// 67 68// DW_DSI_PWR_UP Register Def 69#define PWR_UP_RST (0) 70#define PWR_UP_ON (1) 71 72// DW_DSI_GEN_HDR Register Bit Def 73#define GEN_HDR_WC_MSB(x) ((x & 0xFF) << 16) 74#define GEN_HDR_WC_LSB(x) ((x & 0xFF) << 8) 75#define GEN_HDR_VC(x) ((x & 0x03) << 6) 76#define GEN_HDR_DT(x) ((x & 0x3F) << 0) 77 78// DW_DSI_CMD_PKT_STATUS Register Bit Def 79#define CMD_PKT_STATUS_RD_CMD_BUSY (6) 80#define CMD_PKT_STATUS_PLD_R_FULL (5) 81#define CMD_PKT_STATUS_PLD_R_EMPTY (4) 82#define CMD_PKT_STATUS_PLD_W_FULL (3) 83#define CMD_PKT_STATUS_PLD_W_EMPTY (2) 84#define CMD_PKT_STATUS_CMD_FULL (1) 85#define CMD_PKT_STATUS_CMD_EMPTY (0) 86 87// DW_DSI_CLKMGR_CFG Register Bit Def 88#define CLKMGR_CFG_TO_CLK_DIV(x) ((x & 0xFF) << 8) 89#define CLKMGR_CFG_TX_ESC_CLK_DIV(x) ((x & 0xFF) << 0) 90 91// DW_DSI_PCKHDL_CFG Register Bit Def 92#define PCKHDL_CFG_CRC_RX_EN (1 << 4) 93#define PCKHDL_CFG_ECC_RX_EN (1 << 3) 94#define PCKHDL_CFG_BTA_EN (2) 95#define PCKHDL_CFG_EN_CRC_ECC (PCKHDL_CFG_ECC_RX_EN | PCKHDL_CFG_CRC_RX_EN) 96 97// DW_DSI_VID_MODE_CFG Register Bit Def 98#define VID_MODE_CFG_LP_EN_ALL (0x1ff << 8) 99#define VID_MODE_CFG_VID_MODE_TYPE(x) (x << 0) 100#define VID_MODE_TYPE_BURST_MODE (2) 101 102 103// DW_DSI_PHY_STATUS Register Bit Def 104#define PHY_STATUS_PHY_STOPSTATECLKLANE (2) 105#define PHY_STATUS_PHY_DIRECTION (1) 106#define PHY_STATUS_PHY_LOCK (0) 107 108#define PHY_TX (0) 109#define PHY_RX (1) 110 111// DW_DSI_CMD_MODE_CFG Register Bit Def 112#define CMD_MODE_CFG_ACK_RQST_EN (1) 113#define CMD_MODE_CFG_CMD_LP_ALL (0x10F7F00) 114 115// DW_DSI_PHY_IF_CFG Register Bit Def 116#define PHY_IF_CFG_STOP_WAIT_TIME (0x28 << 8) // value from vendor 117#define PHY_IF_CFG_N_LANES(x) ((x - 1) << 0) 118 119// DW_DSI_DPI_LP_CMD_TIM Register Bit Def 120#define LP_CMD_TIM_OUTVACT(x) (x << 16) 121#define LP_CMD_TIM_INVACT(x) (x << 0) 122 123// DW_DSI_DPI_COLOR_CODING Register Bit Def 124#define DPI_COLOR_CODING(x) (x << 0) 125#define MIPI_DSI_COLOR_24BIT (0x5) 126 127// DW_DSI_PHY_TMR_LPCLK_CFG Register Bit Def 128#define PHY_TMR_LPCLK_CFG_CLKHS_TO_LP(x) (x << 16) 129#define PHY_TMR_LPCLK_CFG_CLKLP_TO_HS(x) (x << 0) 130 131// DW_DSI_PHY_TMR_CFG Register Bit Def 132#define PHY_TMR_CFG_HS_TO_LP(x) (x << 16) 133#define PHY_TMR_CFG_LP_TO_HS(x) (x << 0) 134 135// DW_DSI_PHY_RSTZ Register Bit Def 136#define PHY_RSTZ_PWR_UP (0xf) 137 138// DW_DSI_LPCLK_CTRL Register Bit Def 139#define LPCLK_CTRL_AUTOCLKLANE_CTRL (1) 140#define LPCLK_CTRL_TXREQUESTCLKHS (0) 141 142// Default FIFO Depth based on spec. This value may change based on how the DW IP 143// block is synthesized. 144#define DWC_DEFAULT_MAX_PLD_FIFO_DEPTH (200) 145 146// Generic retry value used for BTA and FIFO related events 147#define MIPI_DSI_RETRY_MAX (3000) 148