Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ */
0002 /*
0003  * NWL MIPI DSI host driver
0004  *
0005  * Copyright (C) 2017 NXP
0006  * Copyright (C) 2019 Purism SPC
0007  */
0008 #ifndef __NWL_DSI_H__
0009 #define __NWL_DSI_H__
0010 
0011 /* DSI HOST registers */
0012 #define NWL_DSI_CFG_NUM_LANES           0x0
0013 #define NWL_DSI_CFG_NONCONTINUOUS_CLK       0x4
0014 #define NWL_DSI_CFG_T_PRE           0x8
0015 #define NWL_DSI_CFG_T_POST          0xc
0016 #define NWL_DSI_CFG_TX_GAP          0x10
0017 #define NWL_DSI_CFG_AUTOINSERT_EOTP     0x14
0018 #define NWL_DSI_CFG_EXTRA_CMDS_AFTER_EOTP   0x18
0019 #define NWL_DSI_CFG_HTX_TO_COUNT        0x1c
0020 #define NWL_DSI_CFG_LRX_H_TO_COUNT      0x20
0021 #define NWL_DSI_CFG_BTA_H_TO_COUNT      0x24
0022 #define NWL_DSI_CFG_TWAKEUP         0x28
0023 #define NWL_DSI_CFG_STATUS_OUT          0x2c
0024 #define NWL_DSI_RX_ERROR_STATUS         0x30
0025 
0026 /* DSI DPI registers */
0027 #define NWL_DSI_PIXEL_PAYLOAD_SIZE      0x200
0028 #define NWL_DSI_PIXEL_FIFO_SEND_LEVEL       0x204
0029 #define NWL_DSI_INTERFACE_COLOR_CODING      0x208
0030 #define NWL_DSI_PIXEL_FORMAT            0x20c
0031 #define NWL_DSI_VSYNC_POLARITY          0x210
0032 #define NWL_DSI_VSYNC_POLARITY_ACTIVE_LOW   0
0033 #define NWL_DSI_VSYNC_POLARITY_ACTIVE_HIGH  BIT(1)
0034 
0035 #define NWL_DSI_HSYNC_POLARITY          0x214
0036 #define NWL_DSI_HSYNC_POLARITY_ACTIVE_LOW   0
0037 #define NWL_DSI_HSYNC_POLARITY_ACTIVE_HIGH  BIT(1)
0038 
0039 #define NWL_DSI_VIDEO_MODE          0x218
0040 #define NWL_DSI_HFP             0x21c
0041 #define NWL_DSI_HBP             0x220
0042 #define NWL_DSI_HSA             0x224
0043 #define NWL_DSI_ENABLE_MULT_PKTS        0x228
0044 #define NWL_DSI_VBP             0x22c
0045 #define NWL_DSI_VFP             0x230
0046 #define NWL_DSI_BLLP_MODE           0x234
0047 #define NWL_DSI_USE_NULL_PKT_BLLP       0x238
0048 #define NWL_DSI_VACTIVE             0x23c
0049 #define NWL_DSI_VC              0x240
0050 
0051 /* DSI APB PKT control */
0052 #define NWL_DSI_TX_PAYLOAD          0x280
0053 #define NWL_DSI_PKT_CONTROL         0x284
0054 #define NWL_DSI_SEND_PACKET         0x288
0055 #define NWL_DSI_PKT_STATUS          0x28c
0056 #define NWL_DSI_PKT_FIFO_WR_LEVEL       0x290
0057 #define NWL_DSI_PKT_FIFO_RD_LEVEL       0x294
0058 #define NWL_DSI_RX_PAYLOAD          0x298
0059 #define NWL_DSI_RX_PKT_HEADER           0x29c
0060 
0061 /* DSI IRQ handling */
0062 #define NWL_DSI_IRQ_STATUS          0x2a0
0063 #define NWL_DSI_SM_NOT_IDLE         BIT(0)
0064 #define NWL_DSI_TX_PKT_DONE         BIT(1)
0065 #define NWL_DSI_DPHY_DIRECTION          BIT(2)
0066 #define NWL_DSI_TX_FIFO_OVFLW           BIT(3)
0067 #define NWL_DSI_TX_FIFO_UDFLW           BIT(4)
0068 #define NWL_DSI_RX_FIFO_OVFLW           BIT(5)
0069 #define NWL_DSI_RX_FIFO_UDFLW           BIT(6)
0070 #define NWL_DSI_RX_PKT_HDR_RCVD         BIT(7)
0071 #define NWL_DSI_RX_PKT_PAYLOAD_DATA_RCVD    BIT(8)
0072 #define NWL_DSI_BTA_TIMEOUT         BIT(29)
0073 #define NWL_DSI_LP_RX_TIMEOUT           BIT(30)
0074 #define NWL_DSI_HS_TX_TIMEOUT           BIT(31)
0075 
0076 #define NWL_DSI_IRQ_STATUS2         0x2a4
0077 #define NWL_DSI_SINGLE_BIT_ECC_ERR      BIT(0)
0078 #define NWL_DSI_MULTI_BIT_ECC_ERR       BIT(1)
0079 #define NWL_DSI_CRC_ERR             BIT(2)
0080 
0081 #define NWL_DSI_IRQ_MASK            0x2a8
0082 #define NWL_DSI_SM_NOT_IDLE_MASK        BIT(0)
0083 #define NWL_DSI_TX_PKT_DONE_MASK        BIT(1)
0084 #define NWL_DSI_DPHY_DIRECTION_MASK     BIT(2)
0085 #define NWL_DSI_TX_FIFO_OVFLW_MASK      BIT(3)
0086 #define NWL_DSI_TX_FIFO_UDFLW_MASK      BIT(4)
0087 #define NWL_DSI_RX_FIFO_OVFLW_MASK      BIT(5)
0088 #define NWL_DSI_RX_FIFO_UDFLW_MASK      BIT(6)
0089 #define NWL_DSI_RX_PKT_HDR_RCVD_MASK        BIT(7)
0090 #define NWL_DSI_RX_PKT_PAYLOAD_DATA_RCVD_MASK   BIT(8)
0091 #define NWL_DSI_BTA_TIMEOUT_MASK        BIT(29)
0092 #define NWL_DSI_LP_RX_TIMEOUT_MASK      BIT(30)
0093 #define NWL_DSI_HS_TX_TIMEOUT_MASK      BIT(31)
0094 
0095 #define NWL_DSI_IRQ_MASK2           0x2ac
0096 #define NWL_DSI_SINGLE_BIT_ECC_ERR_MASK     BIT(0)
0097 #define NWL_DSI_MULTI_BIT_ECC_ERR_MASK      BIT(1)
0098 #define NWL_DSI_CRC_ERR_MASK            BIT(2)
0099 
0100 /*
0101  * PKT_CONTROL format:
0102  * [15: 0] - word count
0103  * [17:16] - virtual channel
0104  * [23:18] - data type
0105  * [24]    - LP or HS select (0 - LP, 1 - HS)
0106  * [25]    - perform BTA after packet is sent
0107  * [26]    - perform BTA only, no packet tx
0108  */
0109 #define NWL_DSI_WC(x)       FIELD_PREP(GENMASK(15, 0), (x))
0110 #define NWL_DSI_TX_VC(x)    FIELD_PREP(GENMASK(17, 16), (x))
0111 #define NWL_DSI_TX_DT(x)    FIELD_PREP(GENMASK(23, 18), (x))
0112 #define NWL_DSI_HS_SEL(x)   FIELD_PREP(GENMASK(24, 24), (x))
0113 #define NWL_DSI_BTA_TX(x)   FIELD_PREP(GENMASK(25, 25), (x))
0114 #define NWL_DSI_BTA_NO_TX(x)    FIELD_PREP(GENMASK(26, 26), (x))
0115 
0116 /*
0117  * RX_PKT_HEADER format:
0118  * [15: 0] - word count
0119  * [21:16] - data type
0120  * [23:22] - virtual channel
0121  */
0122 #define NWL_DSI_RX_DT(x)    FIELD_GET(GENMASK(21, 16), (x))
0123 #define NWL_DSI_RX_VC(x)    FIELD_GET(GENMASK(23, 22), (x))
0124 
0125 /* DSI Video mode */
0126 #define NWL_DSI_VM_BURST_MODE_WITH_SYNC_PULSES      0
0127 #define NWL_DSI_VM_NON_BURST_MODE_WITH_SYNC_EVENTS  BIT(0)
0128 #define NWL_DSI_VM_BURST_MODE               BIT(1)
0129 
0130 /* * DPI color coding */
0131 #define NWL_DSI_DPI_16_BIT_565_PACKED   0
0132 #define NWL_DSI_DPI_16_BIT_565_ALIGNED  1
0133 #define NWL_DSI_DPI_16_BIT_565_SHIFTED  2
0134 #define NWL_DSI_DPI_18_BIT_PACKED   3
0135 #define NWL_DSI_DPI_18_BIT_ALIGNED  4
0136 #define NWL_DSI_DPI_24_BIT      5
0137 
0138 /* * DPI Pixel format */
0139 #define NWL_DSI_PIXEL_FORMAT_16  0
0140 #define NWL_DSI_PIXEL_FORMAT_18  BIT(0)
0141 #define NWL_DSI_PIXEL_FORMAT_18L BIT(1)
0142 #define NWL_DSI_PIXEL_FORMAT_24  (BIT(0) | BIT(1))
0143 
0144 #endif /* __NWL_DSI_H__ */