Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * NXP XCVR ALSA SoC Digital Audio Interface (DAI) driver
0004  *
0005  * Copyright 2019 NXP
0006  */
0007 
0008 #ifndef __FSL_XCVR_H
0009 #define __FSL_XCVR_H
0010 
0011 #define FSL_XCVR_MODE_SPDIF 0
0012 #define FSL_XCVR_MODE_ARC   1
0013 #define FSL_XCVR_MODE_EARC  2
0014 
0015 /* XCVR Registers */
0016 #define FSL_XCVR_REG_OFFSET     0x800 /* regs offset */
0017 #define FSL_XCVR_FIFO_SIZE      0x80  /* 128 */
0018 #define FSL_XCVR_FIFO_WMK_RX        (FSL_XCVR_FIFO_SIZE >> 1)   /* 64 */
0019 #define FSL_XCVR_FIFO_WMK_TX        (FSL_XCVR_FIFO_SIZE >> 1)   /* 64 */
0020 #define FSL_XCVR_MAXBURST_RX        (FSL_XCVR_FIFO_WMK_RX >> 2) /* 16 */
0021 #define FSL_XCVR_MAXBURST_TX        (FSL_XCVR_FIFO_WMK_TX >> 2) /* 16 */
0022 
0023 #define FSL_XCVR_RX_FIFO_ADDR       0x0C00
0024 #define FSL_XCVR_TX_FIFO_ADDR       0x0E00
0025 
0026 #define FSL_XCVR_VERSION        0x00  /* Version */
0027 #define FSL_XCVR_EXT_CTRL       0x10  /* Control */
0028 #define FSL_XCVR_EXT_STATUS     0x20  /* Status */
0029 #define FSL_XCVR_EXT_IER0       0x30  /* Interrupt en 0 */
0030 #define FSL_XCVR_EXT_IER1       0x40  /* Interrupt en 1 */
0031 #define FSL_XCVR_EXT_ISR        0x50  /* Interrupt status */
0032 #define FSL_XCVR_EXT_ISR_SET        0x54  /* Interrupt status */
0033 #define FSL_XCVR_EXT_ISR_CLR        0x58  /* Interrupt status */
0034 #define FSL_XCVR_EXT_ISR_TOG        0x5C  /* Interrupt status */
0035 #define FSL_XCVR_IER            0x70  /* Interrupt en for M0+ */
0036 #define FSL_XCVR_ISR            0x80  /* Interrupt status */
0037 #define FSL_XCVR_ISR_SET        0x84  /* Interrupt status set */
0038 #define FSL_XCVR_ISR_CLR        0x88  /* Interrupt status clear */
0039 #define FSL_XCVR_ISR_TOG        0x8C  /* Interrupt status toggle */
0040 #define FSL_XCVR_PHY_AI_CTRL        0x90
0041 #define FSL_XCVR_PHY_AI_CTRL_SET    0x94
0042 #define FSL_XCVR_PHY_AI_CTRL_CLR    0x98
0043 #define FSL_XCVR_PHY_AI_CTRL_TOG    0x9C
0044 #define FSL_XCVR_PHY_AI_WDATA       0xA0
0045 #define FSL_XCVR_PHY_AI_RDATA       0xA4
0046 #define FSL_XCVR_CLK_CTRL       0xB0
0047 #define FSL_XCVR_RX_DPTH_CTRL       0x180 /* RX datapath ctrl reg */
0048 #define FSL_XCVR_RX_DPTH_CTRL_SET   0x184
0049 #define FSL_XCVR_RX_DPTH_CTRL_CLR   0x188
0050 #define FSL_XCVR_RX_DPTH_CTRL_TOG   0x18c
0051 
0052 #define FSL_XCVR_TX_DPTH_CTRL       0x220 /* TX datapath ctrl reg */
0053 #define FSL_XCVR_TX_DPTH_CTRL_SET   0x224
0054 #define FSL_XCVR_TX_DPTH_CTRL_CLR   0x228
0055 #define FSL_XCVR_TX_DPTH_CTRL_TOG   0x22C
0056 #define FSL_XCVR_TX_CS_DATA_0       0x230 /* TX channel status bits regs */
0057 #define FSL_XCVR_TX_CS_DATA_1       0x234
0058 #define FSL_XCVR_TX_CS_DATA_2       0x238
0059 #define FSL_XCVR_TX_CS_DATA_3       0x23C
0060 #define FSL_XCVR_TX_CS_DATA_4       0x240
0061 #define FSL_XCVR_TX_CS_DATA_5       0x244
0062 #define FSL_XCVR_DEBUG_REG_0        0x2E0
0063 #define FSL_XCVR_DEBUG_REG_1        0x2F0
0064 
0065 #define FSL_XCVR_MAX_REG        FSL_XCVR_DEBUG_REG_1
0066 
0067 #define FSL_XCVR_EXT_CTRL_CORE_RESET    BIT(31)
0068 
0069 #define FSL_XCVR_EXT_CTRL_RX_CMDC_RESET BIT(30)
0070 #define FSL_XCVR_EXT_CTRL_TX_CMDC_RESET BIT(29)
0071 #define FSL_XCVR_EXT_CTRL_CMDC_RESET(t) (t ? BIT(29) : BIT(30))
0072 
0073 #define FSL_XCVR_EXT_CTRL_RX_DPTH_RESET BIT(28)
0074 #define FSL_XCVR_EXT_CTRL_TX_DPTH_RESET BIT(27)
0075 #define FSL_XCVR_EXT_CTRL_DPTH_RESET(t) (t ? BIT(27) : BIT(28))
0076 
0077 #define FSL_XCVR_EXT_CTRL_TX_RX_MODE    BIT(26)
0078 #define FSL_XCVR_EXT_CTRL_DMA_RD_DIS    BIT(25)
0079 #define FSL_XCVR_EXT_CTRL_DMA_WR_DIS    BIT(24)
0080 #define FSL_XCVR_EXT_CTRL_DMA_DIS(t)    (t ? BIT(24) : BIT(25))
0081 #define FSL_XCVR_EXT_CTRL_SPDIF_MODE    BIT(23)
0082 #define FSL_XCVR_EXT_CTRL_SLEEP_MODE    BIT(21)
0083 
0084 #define FSL_XCVR_EXT_CTRL_TX_FWM_SHFT   0
0085 #define FSL_XCVR_EXT_CTRL_TX_FWM_MASK   GENMASK(6, 0)
0086 #define FSL_XCVR_EXT_CTRL_TX_FWM(i) (((i) << FSL_XCVR_EXT_CTRL_TX_FWM_SHFT) \
0087                       & FSL_XCVR_EXT_CTRL_TX_FWM_MASK)
0088 #define FSL_XCVR_EXT_CTRL_RX_FWM_SHFT   8
0089 #define FSL_XCVR_EXT_CTRL_RX_FWM_MASK   GENMASK(14, 8)
0090 #define FSL_XCVR_EXT_CTRL_RX_FWM(i) (((i) << FSL_XCVR_EXT_CTRL_RX_FWM_SHFT) \
0091                       & FSL_XCVR_EXT_CTRL_RX_FWM_MASK)
0092 #define FSL_XCVR_EXT_CTRL_PAGE_SHFT 16
0093 #define FSL_XCVR_EXT_CTRL_PAGE_MASK GENMASK(19, 16)
0094 #define FSL_XCVR_EXT_CTRL_PAGE(i)   (((i) << FSL_XCVR_EXT_CTRL_PAGE_SHFT) \
0095                       & FSL_XCVR_EXT_CTRL_PAGE_MASK)
0096 
0097 #define FSL_XCVR_EXT_STUS_NT_FIFO_ENTR  GENMASK(7, 0)
0098 #define FSL_XCVR_EXT_STUS_NR_FIFO_ENTR  GENMASK(15, 8)
0099 #define FSL_XCVR_EXT_STUS_CM0_SLEEPING  BIT(16)
0100 #define FSL_XCVR_EXT_STUS_CM0_DEEP_SLP  BIT(17)
0101 #define FSL_XCVR_EXT_STUS_CM0_SLP_HACK  BIT(18)
0102 #define FSL_XCVR_EXT_STUS_RX_CMDC_RSTO  BIT(23)
0103 #define FSL_XCVR_EXT_STUS_TX_CMDC_RSTO  BIT(24)
0104 #define FSL_XCVR_EXT_STUS_RX_CMDC_COTO  BIT(25)
0105 #define FSL_XCVR_EXT_STUS_TX_CMDC_COTO  BIT(26)
0106 #define FSL_XCVR_EXT_STUS_HB_STATUS BIT(27)
0107 #define FSL_XCVR_EXT_STUS_NEW_UD4_REC   BIT(28)
0108 #define FSL_XCVR_EXT_STUS_NEW_UD5_REC   BIT(29)
0109 #define FSL_XCVR_EXT_STUS_NEW_UD6_REC   BIT(30)
0110 #define FSL_XCVR_EXT_STUS_HPD_INPUT BIT(31)
0111 
0112 #define FSL_XCVR_IRQ_NEW_CS     BIT(0)
0113 #define FSL_XCVR_IRQ_NEW_UD     BIT(1)
0114 #define FSL_XCVR_IRQ_MUTE       BIT(2)
0115 #define FSL_XCVR_IRQ_CMDC_RESP_TO   BIT(3)
0116 #define FSL_XCVR_IRQ_ECC_ERR        BIT(4)
0117 #define FSL_XCVR_IRQ_PREAMBLE_MISMATCH  BIT(5)
0118 #define FSL_XCVR_IRQ_FIFO_UOFL_ERR  BIT(6)
0119 #define FSL_XCVR_IRQ_HOST_WAKEUP    BIT(7)
0120 #define FSL_XCVR_IRQ_HOST_OHPD      BIT(8)
0121 #define FSL_XCVR_IRQ_DMAC_NO_DATA_REC   BIT(9)
0122 #define FSL_XCVR_IRQ_DMAC_FMT_CHG_DET   BIT(10)
0123 #define FSL_XCVR_IRQ_HB_STATE_CHG   BIT(11)
0124 #define FSL_XCVR_IRQ_CMDC_STATUS_UPD    BIT(12)
0125 #define FSL_XCVR_IRQ_TEMP_UPD       BIT(13)
0126 #define FSL_XCVR_IRQ_DMA_RD_REQ     BIT(14)
0127 #define FSL_XCVR_IRQ_DMA_WR_REQ     BIT(15)
0128 #define FSL_XCVR_IRQ_DMAC_BME_BIT_ERR   BIT(16)
0129 #define FSL_XCVR_IRQ_PREAMBLE_MATCH BIT(17)
0130 #define FSL_XCVR_IRQ_M_W_PRE_MISMATCH   BIT(18)
0131 #define FSL_XCVR_IRQ_B_PRE_MISMATCH BIT(19)
0132 #define FSL_XCVR_IRQ_UNEXP_PRE_REC  BIT(20)
0133 #define FSL_XCVR_IRQ_ARC_MODE       BIT(21)
0134 #define FSL_XCVR_IRQ_CH_UD_OFLOW    BIT(22)
0135 #define FSL_XCVR_IRQ_EARC_ALL       (FSL_XCVR_IRQ_NEW_CS | \
0136                      FSL_XCVR_IRQ_NEW_UD | \
0137                      FSL_XCVR_IRQ_MUTE | \
0138                      FSL_XCVR_IRQ_FIFO_UOFL_ERR | \
0139                      FSL_XCVR_IRQ_HOST_WAKEUP | \
0140                      FSL_XCVR_IRQ_ARC_MODE)
0141 
0142 #define FSL_XCVR_ISR_CMDC_TX_EN     BIT(3)
0143 #define FSL_XCVR_ISR_HPD_TGL        BIT(15)
0144 #define FSL_XCVR_ISR_DMAC_SPARE_INT BIT(19)
0145 #define FSL_XCVR_ISR_SET_SPDIF_RX_INT   BIT(20)
0146 #define FSL_XCVR_ISR_SET_SPDIF_TX_INT   BIT(21)
0147 #define FSL_XCVR_ISR_SET_SPDIF_MODE(t)  (t ? BIT(21) : BIT(20))
0148 #define FSL_XCVR_ISR_SET_ARC_CM_INT BIT(22)
0149 #define FSL_XCVR_ISR_SET_ARC_SE_INT BIT(23)
0150 
0151 #define FSL_XCVR_PHY_AI_ADDR_MASK   GENMASK(7, 0)
0152 #define FSL_XCVR_PHY_AI_RESETN      BIT(15)
0153 #define FSL_XCVR_PHY_AI_TOG_PLL     BIT(24)
0154 #define FSL_XCVR_PHY_AI_TOG_DONE_PLL    BIT(25)
0155 #define FSL_XCVR_PHY_AI_TOG_PHY     BIT(26)
0156 #define FSL_XCVR_PHY_AI_TOG_DONE_PHY    BIT(27)
0157 #define FSL_XCVR_PHY_AI_RW_MASK     BIT(31)
0158 
0159 #define FSL_XCVR_RX_DPTH_CTRL_PAPB_FIFO_STATUS  BIT(0)
0160 #define FSL_XCVR_RX_DPTH_CTRL_DIS_PRE_ERR_CHK   BIT(1)
0161 #define FSL_XCVR_RX_DPTH_CTRL_DIS_NOD_REC_CHK   BIT(2)
0162 #define FSL_XCVR_RX_DPTH_CTRL_ECC_VUC_BIT_CHK   BIT(3)
0163 #define FSL_XCVR_RX_DPTH_CTRL_EN_CMP_PAR_CALC   BIT(4)
0164 #define FSL_XCVR_RX_DPTH_CTRL_RST_PKT_CNT_FIFO  BIT(5)
0165 #define FSL_XCVR_RX_DPTH_CTRL_STORE_FMT     BIT(6)
0166 #define FSL_XCVR_RX_DPTH_CTRL_EN_PAR_CALC   BIT(7)
0167 #define FSL_XCVR_RX_DPTH_CTRL_UDR       BIT(8)
0168 #define FSL_XCVR_RX_DPTH_CTRL_CSR       BIT(9)
0169 #define FSL_XCVR_RX_DPTH_CTRL_UDA       BIT(10)
0170 #define FSL_XCVR_RX_DPTH_CTRL_CSA       BIT(11)
0171 #define FSL_XCVR_RX_DPTH_CTRL_CLR_RX_FIFO   BIT(12)
0172 #define FSL_XCVR_RX_DPTH_CTRL_DIS_B_PRE_ERR_CHK BIT(13)
0173 #define FSL_XCVR_RX_DPTH_CTRL_PABS      BIT(19)
0174 #define FSL_XCVR_RX_DPTH_CTRL_DTS_CDS       BIT(20)
0175 #define FSL_XCVR_RX_DPTH_CTRL_BLKC      BIT(21)
0176 #define FSL_XCVR_RX_DPTH_CTRL_MUTE_CTRL     BIT(22)
0177 #define FSL_XCVR_RX_DPTH_CTRL_MUTE_MODE     BIT(23)
0178 #define FSL_XCVR_RX_DPTH_CTRL_FMT_CHG_CTRL  BIT(24)
0179 #define FSL_XCVR_RX_DPTH_CTRL_FMT_CHG_MODE  BIT(25)
0180 #define FSL_XCVR_RX_DPTH_CTRL_LAYB_CTRL     BIT(26)
0181 #define FSL_XCVR_RX_DPTH_CTRL_LAYB_MODE     BIT(27)
0182 #define FSL_XCVR_RX_DPTH_CTRL_PRC       BIT(28)
0183 #define FSL_XCVR_RX_DPTH_CTRL_COMP      BIT(29)
0184 #define FSL_XCVR_RX_DPTH_CTRL_FSM       GENMASK(31, 30)
0185 
0186 #define FSL_XCVR_TX_DPTH_CTRL_CS_ACK        BIT(0)
0187 #define FSL_XCVR_TX_DPTH_CTRL_UD_ACK        BIT(1)
0188 #define FSL_XCVR_TX_DPTH_CTRL_CS_MOD        BIT(2)
0189 #define FSL_XCVR_TX_DPTH_CTRL_UD_MOD        BIT(3)
0190 #define FSL_XCVR_TX_DPTH_CTRL_VLD_MOD       BIT(4)
0191 #define FSL_XCVR_TX_DPTH_CTRL_FRM_VLD       BIT(5)
0192 #define FSL_XCVR_TX_DPTH_CTRL_EN_PARITY     BIT(6)
0193 #define FSL_XCVR_TX_DPTH_CTRL_EN_PREAMBLE   BIT(7)
0194 #define FSL_XCVR_TX_DPTH_CTRL_EN_ECC_INTER  BIT(8)
0195 #define FSL_XCVR_TX_DPTH_CTRL_BYPASS_FEM    BIT(10)
0196 #define FSL_XCVR_TX_DPTH_CTRL_FRM_FMT       BIT(11)
0197 #define FSL_XCVR_TX_DPTH_CTRL_STRT_DATA_TX  BIT(14)
0198 #define FSL_XCVR_TX_DPTH_CTRL_ADD_CYC_TX_OE_STR BIT(15)
0199 #define FSL_XCVR_TX_DPTH_CTRL_ADD_CYC_TX_OE_END BIT(16)
0200 #define FSL_XCVR_TX_DPTH_CTRL_CLK_RATIO     BIT(29)
0201 #define FSL_XCVR_TX_DPTH_CTRL_TM_NO_PRE_BME GENMASK(31, 30)
0202 
0203 #define FSL_XCVR_PHY_AI_CTRL_AI_RESETN      BIT(15)
0204 
0205 #define FSL_XCVR_PLL_CTRL0          0x00
0206 #define FSL_XCVR_PLL_CTRL0_SET          0x04
0207 #define FSL_XCVR_PLL_CTRL0_CLR          0x08
0208 #define FSL_XCVR_PLL_NUM            0x20
0209 #define FSL_XCVR_PLL_DEN            0x30
0210 #define FSL_XCVR_PLL_PDIV           0x40
0211 #define FSL_XCVR_PLL_BANDGAP_SET        0x54
0212 #define FSL_XCVR_PHY_CTRL           0x00
0213 #define FSL_XCVR_PHY_CTRL_SET           0x04
0214 #define FSL_XCVR_PHY_CTRL_CLR           0x08
0215 #define FSL_XCVR_PHY_CTRL2          0x70
0216 #define FSL_XCVR_PHY_CTRL2_SET          0x74
0217 #define FSL_XCVR_PHY_CTRL2_CLR          0x78
0218 
0219 #define FSL_XCVR_PLL_BANDGAP_EN_VBG     BIT(0)
0220 #define FSL_XCVR_PLL_CTRL0_HROFF        BIT(13)
0221 #define FSL_XCVR_PLL_CTRL0_PWP          BIT(14)
0222 #define FSL_XCVR_PLL_CTRL0_CM0_EN       BIT(24)
0223 #define FSL_XCVR_PLL_CTRL0_CM1_EN       BIT(25)
0224 #define FSL_XCVR_PLL_CTRL0_CM2_EN       BIT(26)
0225 #define FSL_XCVR_PLL_PDIVx(v, i)        ((v & 0x7) << (4 * i))
0226 
0227 #define FSL_XCVR_PHY_CTRL_PHY_EN        BIT(0)
0228 #define FSL_XCVR_PHY_CTRL_RX_CM_EN      BIT(1)
0229 #define FSL_XCVR_PHY_CTRL_TSDIFF_OE     BIT(5)
0230 #define FSL_XCVR_PHY_CTRL_SPDIF_EN      BIT(8)
0231 #define FSL_XCVR_PHY_CTRL_ARC_MODE_SE_EN    BIT(9)
0232 #define FSL_XCVR_PHY_CTRL_ARC_MODE_CM_EN    BIT(10)
0233 #define FSL_XCVR_PHY_CTRL_TX_CLK_MASK       GENMASK(26, 25)
0234 #define FSL_XCVR_PHY_CTRL_TX_CLK_HDMI_SS    BIT(25)
0235 #define FSL_XCVR_PHY_CTRL_TX_CLK_AUD_SS     BIT(26)
0236 #define FSL_XCVR_PHY_CTRL2_EARC_TXMS        BIT(14)
0237 
0238 #define FSL_XCVR_CS_DATA_0_FS_MASK      GENMASK(31, 24)
0239 #define FSL_XCVR_CS_DATA_0_FS_32000     0x3000000
0240 #define FSL_XCVR_CS_DATA_0_FS_44100     0x0000000
0241 #define FSL_XCVR_CS_DATA_0_FS_48000     0x2000000
0242 #define FSL_XCVR_CS_DATA_0_FS_64000     0xB000000
0243 #define FSL_XCVR_CS_DATA_0_FS_88200     0x8000000
0244 #define FSL_XCVR_CS_DATA_0_FS_96000     0xA000000
0245 #define FSL_XCVR_CS_DATA_0_FS_176400        0xC000000
0246 #define FSL_XCVR_CS_DATA_0_FS_192000        0xE000000
0247 
0248 #define FSL_XCVR_CS_DATA_0_CH_MASK      0x3A
0249 #define FSL_XCVR_CS_DATA_0_CH_U2LPCM        0x00
0250 #define FSL_XCVR_CS_DATA_0_CH_UMLPCM        0x20
0251 #define FSL_XCVR_CS_DATA_0_CH_U1BAUD        0x30
0252 
0253 #define FSL_XCVR_CS_DATA_1_CH_MASK      0xF000
0254 #define FSL_XCVR_CS_DATA_1_CH_2         0x0000
0255 #define FSL_XCVR_CS_DATA_1_CH_8         0x7000
0256 #define FSL_XCVR_CS_DATA_1_CH_16        0xB000
0257 #define FSL_XCVR_CS_DATA_1_CH_32        0x3000
0258 
0259 /* Data memory structures */
0260 #define FSL_XCVR_RX_CS_CTRL_0       0x20 /* First  RX CS control register */
0261 #define FSL_XCVR_RX_CS_CTRL_1       0x24 /* Second RX CS control register */
0262 #define FSL_XCVR_RX_CS_BUFF_0       0x80 /* First  RX CS buffer */
0263 #define FSL_XCVR_RX_CS_BUFF_1       0xA0 /* Second RX CS buffer */
0264 #define FSL_XCVR_CAP_DATA_STR       0x300 /* Capabilities data structure */
0265 
0266 #endif /* __FSL_XCVR_H */