1 /* SPDX-License-Identifier: GPL-2.0-only */ 1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 2 /* 3 * Copyright (C) ST-Ericsson SA 2012 3 * Copyright (C) ST-Ericsson SA 2012 4 * 4 * 5 * Author: Ola Lilja <ola.o.lilja@stericsson.c 5 * Author: Ola Lilja <ola.o.lilja@stericsson.com>, 6 * for ST-Ericsson. 6 * for ST-Ericsson. >> 7 * >> 8 * License terms: 7 */ 9 */ 8 10 9 11 10 #ifndef UX500_MSP_I2S_H 12 #ifndef UX500_MSP_I2S_H 11 #define UX500_MSP_I2S_H 13 #define UX500_MSP_I2S_H 12 14 13 #include <linux/platform_device.h> 15 #include <linux/platform_device.h> >> 16 #include <linux/platform_data/asoc-ux500-msp.h> 14 17 15 #define MSP_INPUT_FREQ_APB 48000000 18 #define MSP_INPUT_FREQ_APB 48000000 16 19 17 /*** Stereo mode. Used for APB data accesses a 20 /*** Stereo mode. Used for APB data accesses as 16 bits accesses (mono), 18 * 32 bits accesses (stereo). 21 * 32 bits accesses (stereo). 19 ***/ 22 ***/ 20 enum msp_stereo_mode { 23 enum msp_stereo_mode { 21 MSP_MONO, 24 MSP_MONO, 22 MSP_STEREO 25 MSP_STEREO 23 }; 26 }; 24 27 25 /* Direction (Transmit/Receive mode) */ 28 /* Direction (Transmit/Receive mode) */ 26 enum msp_direction { 29 enum msp_direction { 27 MSP_TX = 1, 30 MSP_TX = 1, 28 MSP_RX = 2 31 MSP_RX = 2 29 }; 32 }; 30 33 31 /* Transmit and receive configuration register 34 /* Transmit and receive configuration register */ 32 #define MSP_BIG_ENDIAN 0x00000000 35 #define MSP_BIG_ENDIAN 0x00000000 33 #define MSP_LITTLE_ENDIAN 0x00001000 36 #define MSP_LITTLE_ENDIAN 0x00001000 34 #define MSP_UNEXPECTED_FS_ABORT 0x00000000 37 #define MSP_UNEXPECTED_FS_ABORT 0x00000000 35 #define MSP_UNEXPECTED_FS_IGNORE 0x00008000 38 #define MSP_UNEXPECTED_FS_IGNORE 0x00008000 36 #define MSP_NON_MODE_BIT_MASK 0x00009000 39 #define MSP_NON_MODE_BIT_MASK 0x00009000 37 40 38 /* Global configuration register */ 41 /* Global configuration register */ 39 #define RX_ENABLE 0x00000001 42 #define RX_ENABLE 0x00000001 40 #define RX_FIFO_ENABLE 0x00000002 43 #define RX_FIFO_ENABLE 0x00000002 41 #define RX_SYNC_SRG 0x00000010 44 #define RX_SYNC_SRG 0x00000010 42 #define RX_CLK_POL_RISING 0x00000020 45 #define RX_CLK_POL_RISING 0x00000020 43 #define RX_CLK_SEL_SRG 0x00000040 46 #define RX_CLK_SEL_SRG 0x00000040 44 #define TX_ENABLE 0x00000100 47 #define TX_ENABLE 0x00000100 45 #define TX_FIFO_ENABLE 0x00000200 48 #define TX_FIFO_ENABLE 0x00000200 46 #define TX_SYNC_SRG_PROG 0x00001800 49 #define TX_SYNC_SRG_PROG 0x00001800 47 #define TX_SYNC_SRG_AUTO 0x00001000 50 #define TX_SYNC_SRG_AUTO 0x00001000 48 #define TX_CLK_POL_RISING 0x00002000 51 #define TX_CLK_POL_RISING 0x00002000 49 #define TX_CLK_SEL_SRG 0x00004000 52 #define TX_CLK_SEL_SRG 0x00004000 50 #define TX_EXTRA_DELAY_ENABLE 0x00008000 53 #define TX_EXTRA_DELAY_ENABLE 0x00008000 51 #define SRG_ENABLE 0x00010000 54 #define SRG_ENABLE 0x00010000 52 #define FRAME_GEN_ENABLE 0x00100000 55 #define FRAME_GEN_ENABLE 0x00100000 53 #define SRG_CLK_SEL_APB 0x00000000 56 #define SRG_CLK_SEL_APB 0x00000000 54 #define RX_FIFO_SYNC_HI 0x00000000 57 #define RX_FIFO_SYNC_HI 0x00000000 55 #define TX_FIFO_SYNC_HI 0x00000000 58 #define TX_FIFO_SYNC_HI 0x00000000 56 #define SPI_CLK_MODE_NORMAL 0x00000000 59 #define SPI_CLK_MODE_NORMAL 0x00000000 57 60 58 #define MSP_FRAME_SIZE_AUTO -1 61 #define MSP_FRAME_SIZE_AUTO -1 59 62 60 #define MSP_DR 0x00 63 #define MSP_DR 0x00 61 #define MSP_GCR 0x04 64 #define MSP_GCR 0x04 62 #define MSP_TCF 0x08 65 #define MSP_TCF 0x08 63 #define MSP_RCF 0x0c 66 #define MSP_RCF 0x0c 64 #define MSP_SRG 0x10 67 #define MSP_SRG 0x10 65 #define MSP_FLR 0x14 68 #define MSP_FLR 0x14 66 #define MSP_DMACR 0x18 69 #define MSP_DMACR 0x18 67 70 68 #define MSP_IMSC 0x20 71 #define MSP_IMSC 0x20 69 #define MSP_RIS 0x24 72 #define MSP_RIS 0x24 70 #define MSP_MIS 0x28 73 #define MSP_MIS 0x28 71 #define MSP_ICR 0x2c 74 #define MSP_ICR 0x2c 72 #define MSP_MCR 0x30 75 #define MSP_MCR 0x30 73 #define MSP_RCV 0x34 76 #define MSP_RCV 0x34 74 #define MSP_RCM 0x38 77 #define MSP_RCM 0x38 75 78 76 #define MSP_TCE0 0x40 79 #define MSP_TCE0 0x40 77 #define MSP_TCE1 0x44 80 #define MSP_TCE1 0x44 78 #define MSP_TCE2 0x48 81 #define MSP_TCE2 0x48 79 #define MSP_TCE3 0x4c 82 #define MSP_TCE3 0x4c 80 83 81 #define MSP_RCE0 0x60 84 #define MSP_RCE0 0x60 82 #define MSP_RCE1 0x64 85 #define MSP_RCE1 0x64 83 #define MSP_RCE2 0x68 86 #define MSP_RCE2 0x68 84 #define MSP_RCE3 0x6c 87 #define MSP_RCE3 0x6c 85 #define MSP_IODLY 0x70 88 #define MSP_IODLY 0x70 86 89 87 #define MSP_ITCR 0x80 90 #define MSP_ITCR 0x80 88 #define MSP_ITIP 0x84 91 #define MSP_ITIP 0x84 89 #define MSP_ITOP 0x88 92 #define MSP_ITOP 0x88 90 #define MSP_TSTDR 0x8c 93 #define MSP_TSTDR 0x8c 91 94 92 #define MSP_PID0 0xfe0 95 #define MSP_PID0 0xfe0 93 #define MSP_PID1 0xfe4 96 #define MSP_PID1 0xfe4 94 #define MSP_PID2 0xfe8 97 #define MSP_PID2 0xfe8 95 #define MSP_PID3 0xfec 98 #define MSP_PID3 0xfec 96 99 97 #define MSP_CID0 0xff0 100 #define MSP_CID0 0xff0 98 #define MSP_CID1 0xff4 101 #define MSP_CID1 0xff4 99 #define MSP_CID2 0xff8 102 #define MSP_CID2 0xff8 100 #define MSP_CID3 0xffc 103 #define MSP_CID3 0xffc 101 104 102 /* Protocol dependant parameters list */ 105 /* Protocol dependant parameters list */ 103 #define RX_ENABLE_MASK BIT(0) 106 #define RX_ENABLE_MASK BIT(0) 104 #define RX_FIFO_ENABLE_MASK BIT(1) 107 #define RX_FIFO_ENABLE_MASK BIT(1) 105 #define RX_FSYNC_MASK BIT(2) 108 #define RX_FSYNC_MASK BIT(2) 106 #define DIRECT_COMPANDING_MASK BIT(3) 109 #define DIRECT_COMPANDING_MASK BIT(3) 107 #define RX_SYNC_SEL_MASK BIT(4) 110 #define RX_SYNC_SEL_MASK BIT(4) 108 #define RX_CLK_POL_MASK BIT(5) 111 #define RX_CLK_POL_MASK BIT(5) 109 #define RX_CLK_SEL_MASK BIT(6) 112 #define RX_CLK_SEL_MASK BIT(6) 110 #define LOOPBACK_MASK BIT(7) 113 #define LOOPBACK_MASK BIT(7) 111 #define TX_ENABLE_MASK BIT(8) 114 #define TX_ENABLE_MASK BIT(8) 112 #define TX_FIFO_ENABLE_MASK BIT(9) 115 #define TX_FIFO_ENABLE_MASK BIT(9) 113 #define TX_FSYNC_MASK BIT(10) 116 #define TX_FSYNC_MASK BIT(10) 114 #define TX_MSP_TDR_TSR BIT(11) 117 #define TX_MSP_TDR_TSR BIT(11) 115 #define TX_SYNC_SEL_MASK (BIT(12) | BIT 118 #define TX_SYNC_SEL_MASK (BIT(12) | BIT(11)) 116 #define TX_CLK_POL_MASK BIT(13) 119 #define TX_CLK_POL_MASK BIT(13) 117 #define TX_CLK_SEL_MASK BIT(14) 120 #define TX_CLK_SEL_MASK BIT(14) 118 #define TX_EXTRA_DELAY_MASK BIT(15) 121 #define TX_EXTRA_DELAY_MASK BIT(15) 119 #define SRG_ENABLE_MASK BIT(16) 122 #define SRG_ENABLE_MASK BIT(16) 120 #define SRG_CLK_POL_MASK BIT(17) 123 #define SRG_CLK_POL_MASK BIT(17) 121 #define SRG_CLK_SEL_MASK (BIT(19) | BIT 124 #define SRG_CLK_SEL_MASK (BIT(19) | BIT(18)) 122 #define FRAME_GEN_EN_MASK BIT(20) 125 #define FRAME_GEN_EN_MASK BIT(20) 123 #define SPI_CLK_MODE_MASK (BIT(22) | BIT 126 #define SPI_CLK_MODE_MASK (BIT(22) | BIT(21)) 124 #define SPI_BURST_MODE_MASK BIT(23) 127 #define SPI_BURST_MODE_MASK BIT(23) 125 128 126 #define RXEN_SHIFT 0 129 #define RXEN_SHIFT 0 127 #define RFFEN_SHIFT 1 130 #define RFFEN_SHIFT 1 128 #define RFSPOL_SHIFT 2 131 #define RFSPOL_SHIFT 2 129 #define DCM_SHIFT 3 132 #define DCM_SHIFT 3 130 #define RFSSEL_SHIFT 4 133 #define RFSSEL_SHIFT 4 131 #define RCKPOL_SHIFT 5 134 #define RCKPOL_SHIFT 5 132 #define RCKSEL_SHIFT 6 135 #define RCKSEL_SHIFT 6 133 #define LBM_SHIFT 7 136 #define LBM_SHIFT 7 134 #define TXEN_SHIFT 8 137 #define TXEN_SHIFT 8 135 #define TFFEN_SHIFT 9 138 #define TFFEN_SHIFT 9 136 #define TFSPOL_SHIFT 10 139 #define TFSPOL_SHIFT 10 137 #define TFSSEL_SHIFT 11 140 #define TFSSEL_SHIFT 11 138 #define TCKPOL_SHIFT 13 141 #define TCKPOL_SHIFT 13 139 #define TCKSEL_SHIFT 14 142 #define TCKSEL_SHIFT 14 140 #define TXDDL_SHIFT 15 143 #define TXDDL_SHIFT 15 141 #define SGEN_SHIFT 16 144 #define SGEN_SHIFT 16 142 #define SCKPOL_SHIFT 17 145 #define SCKPOL_SHIFT 17 143 #define SCKSEL_SHIFT 18 146 #define SCKSEL_SHIFT 18 144 #define FGEN_SHIFT 20 147 #define FGEN_SHIFT 20 145 #define SPICKM_SHIFT 21 148 #define SPICKM_SHIFT 21 146 #define TBSWAP_SHIFT 28 149 #define TBSWAP_SHIFT 28 147 150 148 #define RCKPOL_MASK BIT(0) 151 #define RCKPOL_MASK BIT(0) 149 #define TCKPOL_MASK BIT(0) 152 #define TCKPOL_MASK BIT(0) 150 #define SPICKM_MASK (BIT(1) | BIT( 153 #define SPICKM_MASK (BIT(1) | BIT(0)) 151 #define MSP_RX_CLKPOL_BIT(n) ((n & RCKPOL_ 154 #define MSP_RX_CLKPOL_BIT(n) ((n & RCKPOL_MASK) << RCKPOL_SHIFT) 152 #define MSP_TX_CLKPOL_BIT(n) ((n & TCKPOL_ 155 #define MSP_TX_CLKPOL_BIT(n) ((n & TCKPOL_MASK) << TCKPOL_SHIFT) 153 156 154 #define P1ELEN_SHIFT 0 157 #define P1ELEN_SHIFT 0 155 #define P1FLEN_SHIFT 3 158 #define P1FLEN_SHIFT 3 156 #define DTYP_SHIFT 10 159 #define DTYP_SHIFT 10 157 #define ENDN_SHIFT 12 160 #define ENDN_SHIFT 12 158 #define DDLY_SHIFT 13 161 #define DDLY_SHIFT 13 159 #define FSIG_SHIFT 15 162 #define FSIG_SHIFT 15 160 #define P2ELEN_SHIFT 16 163 #define P2ELEN_SHIFT 16 161 #define P2FLEN_SHIFT 19 164 #define P2FLEN_SHIFT 19 162 #define P2SM_SHIFT 26 165 #define P2SM_SHIFT 26 163 #define P2EN_SHIFT 27 166 #define P2EN_SHIFT 27 164 #define FSYNC_SHIFT 15 167 #define FSYNC_SHIFT 15 165 168 166 #define P1ELEN_MASK 0x00000007 169 #define P1ELEN_MASK 0x00000007 167 #define P2ELEN_MASK 0x00070000 170 #define P2ELEN_MASK 0x00070000 168 #define P1FLEN_MASK 0x00000378 171 #define P1FLEN_MASK 0x00000378 169 #define P2FLEN_MASK 0x03780000 172 #define P2FLEN_MASK 0x03780000 170 #define DDLY_MASK 0x00003000 173 #define DDLY_MASK 0x00003000 171 #define DTYP_MASK 0x00000600 174 #define DTYP_MASK 0x00000600 172 #define P2SM_MASK 0x04000000 175 #define P2SM_MASK 0x04000000 173 #define P2EN_MASK 0x08000000 176 #define P2EN_MASK 0x08000000 174 #define ENDN_MASK 0x00001000 177 #define ENDN_MASK 0x00001000 175 #define TFSPOL_MASK 0x00000400 178 #define TFSPOL_MASK 0x00000400 176 #define TBSWAP_MASK 0x30000000 179 #define TBSWAP_MASK 0x30000000 177 #define COMPANDING_MODE_MASK 0x00000c00 180 #define COMPANDING_MODE_MASK 0x00000c00 178 #define FSYNC_MASK 0x00008000 181 #define FSYNC_MASK 0x00008000 179 182 180 #define MSP_P1_ELEM_LEN_BITS(n) (n & P 183 #define MSP_P1_ELEM_LEN_BITS(n) (n & P1ELEN_MASK) 181 #define MSP_P2_ELEM_LEN_BITS(n) (((n) 184 #define MSP_P2_ELEM_LEN_BITS(n) (((n) << P2ELEN_SHIFT) & P2ELEN_MASK) 182 #define MSP_P1_FRAME_LEN_BITS(n) (((n) 185 #define MSP_P1_FRAME_LEN_BITS(n) (((n) << P1FLEN_SHIFT) & P1FLEN_MASK) 183 #define MSP_P2_FRAME_LEN_BITS(n) (((n) 186 #define MSP_P2_FRAME_LEN_BITS(n) (((n) << P2FLEN_SHIFT) & P2FLEN_MASK) 184 #define MSP_DATA_DELAY_BITS(n) (((n) 187 #define MSP_DATA_DELAY_BITS(n) (((n) << DDLY_SHIFT) & DDLY_MASK) 185 #define MSP_DATA_TYPE_BITS(n) (((n) 188 #define MSP_DATA_TYPE_BITS(n) (((n) << DTYP_SHIFT) & DTYP_MASK) 186 #define MSP_P2_START_MODE_BIT(n) ((n << 189 #define MSP_P2_START_MODE_BIT(n) ((n << P2SM_SHIFT) & P2SM_MASK) 187 #define MSP_P2_ENABLE_BIT(n) ((n << 190 #define MSP_P2_ENABLE_BIT(n) ((n << P2EN_SHIFT) & P2EN_MASK) 188 #define MSP_SET_ENDIANNES_BIT(n) ((n << 191 #define MSP_SET_ENDIANNES_BIT(n) ((n << ENDN_SHIFT) & ENDN_MASK) 189 #define MSP_FSYNC_POL(n) ((n << 192 #define MSP_FSYNC_POL(n) ((n << TFSPOL_SHIFT) & TFSPOL_MASK) 190 #define MSP_DATA_WORD_SWAP(n) ((n << 193 #define MSP_DATA_WORD_SWAP(n) ((n << TBSWAP_SHIFT) & TBSWAP_MASK) 191 #define MSP_SET_COMPANDING_MODE(n) ((n << 194 #define MSP_SET_COMPANDING_MODE(n) ((n << DTYP_SHIFT) & \ 192 195 COMPANDING_MODE_MASK) 193 #define MSP_SET_FSYNC_IGNORE(n) ((n << 196 #define MSP_SET_FSYNC_IGNORE(n) ((n << FSYNC_SHIFT) & FSYNC_MASK) 194 197 195 /* Flag register */ 198 /* Flag register */ 196 #define RX_BUSY BIT(0) 199 #define RX_BUSY BIT(0) 197 #define RX_FIFO_EMPTY BIT(1) 200 #define RX_FIFO_EMPTY BIT(1) 198 #define RX_FIFO_FULL BIT(2) 201 #define RX_FIFO_FULL BIT(2) 199 #define TX_BUSY BIT(3) 202 #define TX_BUSY BIT(3) 200 #define TX_FIFO_EMPTY BIT(4) 203 #define TX_FIFO_EMPTY BIT(4) 201 #define TX_FIFO_FULL BIT(5) 204 #define TX_FIFO_FULL BIT(5) 202 205 203 #define RBUSY_SHIFT 0 206 #define RBUSY_SHIFT 0 204 #define RFE_SHIFT 1 207 #define RFE_SHIFT 1 205 #define RFU_SHIFT 2 208 #define RFU_SHIFT 2 206 #define TBUSY_SHIFT 3 209 #define TBUSY_SHIFT 3 207 #define TFE_SHIFT 4 210 #define TFE_SHIFT 4 208 #define TFU_SHIFT 5 211 #define TFU_SHIFT 5 209 212 210 /* Multichannel control register */ 213 /* Multichannel control register */ 211 #define RMCEN_SHIFT 0 214 #define RMCEN_SHIFT 0 212 #define RMCSF_SHIFT 1 215 #define RMCSF_SHIFT 1 213 #define RCMPM_SHIFT 3 216 #define RCMPM_SHIFT 3 214 #define TMCEN_SHIFT 5 217 #define TMCEN_SHIFT 5 215 #define TNCSF_SHIFT 6 218 #define TNCSF_SHIFT 6 216 219 217 /* Sample rate generator register */ 220 /* Sample rate generator register */ 218 #define SCKDIV_SHIFT 0 221 #define SCKDIV_SHIFT 0 219 #define FRWID_SHIFT 10 222 #define FRWID_SHIFT 10 220 #define FRPER_SHIFT 16 223 #define FRPER_SHIFT 16 221 224 222 #define SCK_DIV_MASK 0x0000003FF 225 #define SCK_DIV_MASK 0x0000003FF 223 #define FRAME_WIDTH_BITS(n) (((n) << FRWID 226 #define FRAME_WIDTH_BITS(n) (((n) << FRWID_SHIFT) & 0x0000FC00) 224 #define FRAME_PERIOD_BITS(n) (((n) << FRPER 227 #define FRAME_PERIOD_BITS(n) (((n) << FRPER_SHIFT) & 0x1FFF0000) 225 228 226 /* DMA controller register */ 229 /* DMA controller register */ 227 #define RX_DMA_ENABLE BIT(0) 230 #define RX_DMA_ENABLE BIT(0) 228 #define TX_DMA_ENABLE BIT(1) 231 #define TX_DMA_ENABLE BIT(1) 229 232 230 #define RDMAE_SHIFT 0 233 #define RDMAE_SHIFT 0 231 #define TDMAE_SHIFT 1 234 #define TDMAE_SHIFT 1 232 235 233 /* Interrupt Register */ 236 /* Interrupt Register */ 234 #define RX_SERVICE_INT BIT(0) 237 #define RX_SERVICE_INT BIT(0) 235 #define RX_OVERRUN_ERROR_INT BIT(1) 238 #define RX_OVERRUN_ERROR_INT BIT(1) 236 #define RX_FSYNC_ERR_INT BIT(2) 239 #define RX_FSYNC_ERR_INT BIT(2) 237 #define RX_FSYNC_INT BIT(3) 240 #define RX_FSYNC_INT BIT(3) 238 #define TX_SERVICE_INT BIT(4) 241 #define TX_SERVICE_INT BIT(4) 239 #define TX_UNDERRUN_ERR_INT BIT(5) 242 #define TX_UNDERRUN_ERR_INT BIT(5) 240 #define TX_FSYNC_ERR_INT BIT(6) 243 #define TX_FSYNC_ERR_INT BIT(6) 241 #define TX_FSYNC_INT BIT(7) 244 #define TX_FSYNC_INT BIT(7) 242 #define ALL_INT 0x000000ff 245 #define ALL_INT 0x000000ff 243 246 244 /* MSP test control register */ 247 /* MSP test control register */ 245 #define MSP_ITCR_ITEN BIT(0) 248 #define MSP_ITCR_ITEN BIT(0) 246 #define MSP_ITCR_TESTFIFO BIT(1) 249 #define MSP_ITCR_TESTFIFO BIT(1) 247 250 248 #define RMCEN_BIT 0 251 #define RMCEN_BIT 0 249 #define RMCSF_BIT 1 252 #define RMCSF_BIT 1 250 #define RCMPM_BIT 3 253 #define RCMPM_BIT 3 251 #define TMCEN_BIT 5 254 #define TMCEN_BIT 5 252 #define TNCSF_BIT 6 255 #define TNCSF_BIT 6 253 256 254 /* Single or dual phase mode */ 257 /* Single or dual phase mode */ 255 enum msp_phase_mode { 258 enum msp_phase_mode { 256 MSP_SINGLE_PHASE, 259 MSP_SINGLE_PHASE, 257 MSP_DUAL_PHASE 260 MSP_DUAL_PHASE 258 }; 261 }; 259 262 260 /* Frame length */ 263 /* Frame length */ 261 enum msp_frame_length { 264 enum msp_frame_length { 262 MSP_FRAME_LEN_1 = 0, 265 MSP_FRAME_LEN_1 = 0, 263 MSP_FRAME_LEN_2 = 1, 266 MSP_FRAME_LEN_2 = 1, 264 MSP_FRAME_LEN_4 = 3, 267 MSP_FRAME_LEN_4 = 3, 265 MSP_FRAME_LEN_8 = 7, 268 MSP_FRAME_LEN_8 = 7, 266 MSP_FRAME_LEN_12 = 11, 269 MSP_FRAME_LEN_12 = 11, 267 MSP_FRAME_LEN_16 = 15, 270 MSP_FRAME_LEN_16 = 15, 268 MSP_FRAME_LEN_20 = 19, 271 MSP_FRAME_LEN_20 = 19, 269 MSP_FRAME_LEN_32 = 31, 272 MSP_FRAME_LEN_32 = 31, 270 MSP_FRAME_LEN_48 = 47, 273 MSP_FRAME_LEN_48 = 47, 271 MSP_FRAME_LEN_64 = 63 274 MSP_FRAME_LEN_64 = 63 272 }; 275 }; 273 276 274 /* Element length */ 277 /* Element length */ 275 enum msp_elem_length { 278 enum msp_elem_length { 276 MSP_ELEM_LEN_8 = 0, 279 MSP_ELEM_LEN_8 = 0, 277 MSP_ELEM_LEN_10 = 1, 280 MSP_ELEM_LEN_10 = 1, 278 MSP_ELEM_LEN_12 = 2, 281 MSP_ELEM_LEN_12 = 2, 279 MSP_ELEM_LEN_14 = 3, 282 MSP_ELEM_LEN_14 = 3, 280 MSP_ELEM_LEN_16 = 4, 283 MSP_ELEM_LEN_16 = 4, 281 MSP_ELEM_LEN_20 = 5, 284 MSP_ELEM_LEN_20 = 5, 282 MSP_ELEM_LEN_24 = 6, 285 MSP_ELEM_LEN_24 = 6, 283 MSP_ELEM_LEN_32 = 7 286 MSP_ELEM_LEN_32 = 7 284 }; 287 }; 285 288 286 enum msp_data_xfer_width { 289 enum msp_data_xfer_width { 287 MSP_DATA_TRANSFER_WIDTH_BYTE, 290 MSP_DATA_TRANSFER_WIDTH_BYTE, 288 MSP_DATA_TRANSFER_WIDTH_HALFWORD, 291 MSP_DATA_TRANSFER_WIDTH_HALFWORD, 289 MSP_DATA_TRANSFER_WIDTH_WORD 292 MSP_DATA_TRANSFER_WIDTH_WORD 290 }; 293 }; 291 294 292 enum msp_frame_sync { 295 enum msp_frame_sync { 293 MSP_FSYNC_UNIGNORE = 0, 296 MSP_FSYNC_UNIGNORE = 0, 294 MSP_FSYNC_IGNORE = 1, 297 MSP_FSYNC_IGNORE = 1, 295 }; 298 }; 296 299 297 enum msp_phase2_start_mode { 300 enum msp_phase2_start_mode { 298 MSP_PHASE2_START_MODE_IMEDIATE, 301 MSP_PHASE2_START_MODE_IMEDIATE, 299 MSP_PHASE2_START_MODE_FSYNC 302 MSP_PHASE2_START_MODE_FSYNC 300 }; 303 }; 301 304 302 enum msp_btf { 305 enum msp_btf { 303 MSP_BTF_MS_BIT_FIRST = 0, 306 MSP_BTF_MS_BIT_FIRST = 0, 304 MSP_BTF_LS_BIT_FIRST = 1 307 MSP_BTF_LS_BIT_FIRST = 1 305 }; 308 }; 306 309 307 enum msp_fsync_pol { 310 enum msp_fsync_pol { 308 MSP_FSYNC_POL_ACT_HI = 0, 311 MSP_FSYNC_POL_ACT_HI = 0, 309 MSP_FSYNC_POL_ACT_LO = 1 312 MSP_FSYNC_POL_ACT_LO = 1 310 }; 313 }; 311 314 312 /* Data delay (in bit clock cycles) */ 315 /* Data delay (in bit clock cycles) */ 313 enum msp_delay { 316 enum msp_delay { 314 MSP_DELAY_0 = 0, 317 MSP_DELAY_0 = 0, 315 MSP_DELAY_1 = 1, 318 MSP_DELAY_1 = 1, 316 MSP_DELAY_2 = 2, 319 MSP_DELAY_2 = 2, 317 MSP_DELAY_3 = 3 320 MSP_DELAY_3 = 3 318 }; 321 }; 319 322 320 /* Configurations of clocks (transmit, receive 323 /* Configurations of clocks (transmit, receive or sample rate generator) */ 321 enum msp_edge { 324 enum msp_edge { 322 MSP_FALLING_EDGE = 0, 325 MSP_FALLING_EDGE = 0, 323 MSP_RISING_EDGE = 1, 326 MSP_RISING_EDGE = 1, 324 }; 327 }; 325 328 326 enum msp_hws { 329 enum msp_hws { 327 MSP_SWAP_NONE = 0, 330 MSP_SWAP_NONE = 0, 328 MSP_SWAP_BYTE_PER_WORD = 1, 331 MSP_SWAP_BYTE_PER_WORD = 1, 329 MSP_SWAP_BYTE_PER_HALF_WORD = 2, 332 MSP_SWAP_BYTE_PER_HALF_WORD = 2, 330 MSP_SWAP_HALF_WORD_PER_WORD = 3 333 MSP_SWAP_HALF_WORD_PER_WORD = 3 331 }; 334 }; 332 335 333 enum msp_compress_mode { 336 enum msp_compress_mode { 334 MSP_COMPRESS_MODE_LINEAR = 0, 337 MSP_COMPRESS_MODE_LINEAR = 0, 335 MSP_COMPRESS_MODE_MU_LAW = 2, 338 MSP_COMPRESS_MODE_MU_LAW = 2, 336 MSP_COMPRESS_MODE_A_LAW = 3 339 MSP_COMPRESS_MODE_A_LAW = 3 337 }; 340 }; 338 341 339 enum msp_expand_mode { 342 enum msp_expand_mode { 340 MSP_EXPAND_MODE_LINEAR = 0, 343 MSP_EXPAND_MODE_LINEAR = 0, 341 MSP_EXPAND_MODE_LINEAR_SIGNED = 1, 344 MSP_EXPAND_MODE_LINEAR_SIGNED = 1, 342 MSP_EXPAND_MODE_MU_LAW = 2, 345 MSP_EXPAND_MODE_MU_LAW = 2, 343 MSP_EXPAND_MODE_A_LAW = 3 346 MSP_EXPAND_MODE_A_LAW = 3 344 }; 347 }; 345 348 346 #define MSP_FRAME_PERIOD_IN_MONO_MODE 256 349 #define MSP_FRAME_PERIOD_IN_MONO_MODE 256 347 #define MSP_FRAME_PERIOD_IN_STEREO_MODE 32 350 #define MSP_FRAME_PERIOD_IN_STEREO_MODE 32 348 #define MSP_FRAME_WIDTH_IN_STEREO_MODE 16 351 #define MSP_FRAME_WIDTH_IN_STEREO_MODE 16 349 352 350 enum msp_protocol { 353 enum msp_protocol { 351 MSP_I2S_PROTOCOL, 354 MSP_I2S_PROTOCOL, 352 MSP_PCM_PROTOCOL, 355 MSP_PCM_PROTOCOL, 353 MSP_PCM_COMPAND_PROTOCOL, 356 MSP_PCM_COMPAND_PROTOCOL, 354 MSP_INVALID_PROTOCOL 357 MSP_INVALID_PROTOCOL 355 }; 358 }; 356 359 357 /* 360 /* 358 * No of registers to backup during 361 * No of registers to backup during 359 * suspend resume 362 * suspend resume 360 */ 363 */ 361 #define MAX_MSP_BACKUP_REGS 36 364 #define MAX_MSP_BACKUP_REGS 36 362 365 363 enum i2s_direction_t { 366 enum i2s_direction_t { 364 MSP_DIR_TX = 0x01, 367 MSP_DIR_TX = 0x01, 365 MSP_DIR_RX = 0x02, 368 MSP_DIR_RX = 0x02, 366 }; 369 }; 367 370 368 enum msp_data_size { 371 enum msp_data_size { 369 MSP_DATA_BITS_DEFAULT = -1, 372 MSP_DATA_BITS_DEFAULT = -1, 370 MSP_DATA_BITS_8 = 0x00, 373 MSP_DATA_BITS_8 = 0x00, 371 MSP_DATA_BITS_10, 374 MSP_DATA_BITS_10, 372 MSP_DATA_BITS_12, 375 MSP_DATA_BITS_12, 373 MSP_DATA_BITS_14, 376 MSP_DATA_BITS_14, 374 MSP_DATA_BITS_16, 377 MSP_DATA_BITS_16, 375 MSP_DATA_BITS_20, 378 MSP_DATA_BITS_20, 376 MSP_DATA_BITS_24, 379 MSP_DATA_BITS_24, 377 MSP_DATA_BITS_32, 380 MSP_DATA_BITS_32, 378 }; 381 }; 379 382 380 enum msp_state { 383 enum msp_state { 381 MSP_STATE_IDLE = 0, 384 MSP_STATE_IDLE = 0, 382 MSP_STATE_CONFIGURED = 1, 385 MSP_STATE_CONFIGURED = 1, 383 MSP_STATE_RUNNING = 2, 386 MSP_STATE_RUNNING = 2, 384 }; 387 }; 385 388 386 enum msp_rx_comparison_enable_mode { 389 enum msp_rx_comparison_enable_mode { 387 MSP_COMPARISON_DISABLED = 0, 390 MSP_COMPARISON_DISABLED = 0, 388 MSP_COMPARISON_NONEQUAL_ENABLED = 2, 391 MSP_COMPARISON_NONEQUAL_ENABLED = 2, 389 MSP_COMPARISON_EQUAL_ENABLED = 3 392 MSP_COMPARISON_EQUAL_ENABLED = 3 390 }; 393 }; 391 394 392 struct msp_multichannel_config { 395 struct msp_multichannel_config { 393 bool rx_multichannel_enable; 396 bool rx_multichannel_enable; 394 bool tx_multichannel_enable; 397 bool tx_multichannel_enable; 395 enum msp_rx_comparison_enable_mode rx_ 398 enum msp_rx_comparison_enable_mode rx_comparison_enable_mode; 396 u8 padding; 399 u8 padding; 397 u32 comparison_value; 400 u32 comparison_value; 398 u32 comparison_mask; 401 u32 comparison_mask; 399 u32 rx_channel_0_enable; 402 u32 rx_channel_0_enable; 400 u32 rx_channel_1_enable; 403 u32 rx_channel_1_enable; 401 u32 rx_channel_2_enable; 404 u32 rx_channel_2_enable; 402 u32 rx_channel_3_enable; 405 u32 rx_channel_3_enable; 403 u32 tx_channel_0_enable; 406 u32 tx_channel_0_enable; 404 u32 tx_channel_1_enable; 407 u32 tx_channel_1_enable; 405 u32 tx_channel_2_enable; 408 u32 tx_channel_2_enable; 406 u32 tx_channel_3_enable; 409 u32 tx_channel_3_enable; 407 }; 410 }; 408 411 409 struct msp_protdesc { 412 struct msp_protdesc { 410 u32 rx_phase_mode; 413 u32 rx_phase_mode; 411 u32 tx_phase_mode; 414 u32 tx_phase_mode; 412 u32 rx_phase2_start_mode; 415 u32 rx_phase2_start_mode; 413 u32 tx_phase2_start_mode; 416 u32 tx_phase2_start_mode; 414 u32 rx_byte_order; 417 u32 rx_byte_order; 415 u32 tx_byte_order; 418 u32 tx_byte_order; 416 u32 rx_frame_len_1; 419 u32 rx_frame_len_1; 417 u32 rx_frame_len_2; 420 u32 rx_frame_len_2; 418 u32 tx_frame_len_1; 421 u32 tx_frame_len_1; 419 u32 tx_frame_len_2; 422 u32 tx_frame_len_2; 420 u32 rx_elem_len_1; 423 u32 rx_elem_len_1; 421 u32 rx_elem_len_2; 424 u32 rx_elem_len_2; 422 u32 tx_elem_len_1; 425 u32 tx_elem_len_1; 423 u32 tx_elem_len_2; 426 u32 tx_elem_len_2; 424 u32 rx_data_delay; 427 u32 rx_data_delay; 425 u32 tx_data_delay; 428 u32 tx_data_delay; 426 u32 rx_clk_pol; 429 u32 rx_clk_pol; 427 u32 tx_clk_pol; 430 u32 tx_clk_pol; 428 u32 rx_fsync_pol; 431 u32 rx_fsync_pol; 429 u32 tx_fsync_pol; 432 u32 tx_fsync_pol; 430 u32 rx_half_word_swap; 433 u32 rx_half_word_swap; 431 u32 tx_half_word_swap; 434 u32 tx_half_word_swap; 432 u32 compression_mode; 435 u32 compression_mode; 433 u32 expansion_mode; 436 u32 expansion_mode; 434 u32 frame_sync_ignore; 437 u32 frame_sync_ignore; 435 u32 frame_period; 438 u32 frame_period; 436 u32 frame_width; 439 u32 frame_width; 437 u32 clocks_per_frame; 440 u32 clocks_per_frame; 438 }; 441 }; 439 442 440 struct ux500_msp_config { 443 struct ux500_msp_config { 441 unsigned int f_inputclk; 444 unsigned int f_inputclk; 442 unsigned int rx_clk_sel; 445 unsigned int rx_clk_sel; 443 unsigned int tx_clk_sel; 446 unsigned int tx_clk_sel; 444 unsigned int srg_clk_sel; 447 unsigned int srg_clk_sel; 445 unsigned int rx_fsync_pol; 448 unsigned int rx_fsync_pol; 446 unsigned int tx_fsync_pol; 449 unsigned int tx_fsync_pol; 447 unsigned int rx_fsync_sel; 450 unsigned int rx_fsync_sel; 448 unsigned int tx_fsync_sel; 451 unsigned int tx_fsync_sel; 449 unsigned int rx_fifo_config; 452 unsigned int rx_fifo_config; 450 unsigned int tx_fifo_config; 453 unsigned int tx_fifo_config; 451 unsigned int loopback_enable; 454 unsigned int loopback_enable; 452 unsigned int tx_data_enable; 455 unsigned int tx_data_enable; 453 unsigned int default_protdesc; 456 unsigned int default_protdesc; 454 struct msp_protdesc protdesc; 457 struct msp_protdesc protdesc; 455 int multichannel_configured; 458 int multichannel_configured; 456 struct msp_multichannel_config multich 459 struct msp_multichannel_config multichannel_config; 457 unsigned int direction; 460 unsigned int direction; 458 unsigned int protocol; 461 unsigned int protocol; 459 unsigned int frame_freq; 462 unsigned int frame_freq; 460 enum msp_data_size data_size; 463 enum msp_data_size data_size; 461 unsigned int def_elem_len; 464 unsigned int def_elem_len; 462 unsigned int iodelay; 465 unsigned int iodelay; 463 }; 466 }; 464 467 >> 468 struct ux500_msp_dma_params { >> 469 unsigned int data_size; >> 470 dma_addr_t tx_rx_addr; >> 471 struct stedma40_chan_cfg *dma_cfg; >> 472 }; >> 473 465 struct ux500_msp { 474 struct ux500_msp { 466 int id; 475 int id; 467 void __iomem *registers; 476 void __iomem *registers; 468 struct device *dev; 477 struct device *dev; 469 dma_addr_t tx_rx_addr; !! 478 struct ux500_msp_dma_params playback_dma_data; >> 479 struct ux500_msp_dma_params capture_dma_data; 470 enum msp_state msp_state; 480 enum msp_state msp_state; 471 int def_elem_len; 481 int def_elem_len; 472 unsigned int dir_busy; 482 unsigned int dir_busy; 473 int loopback_enable; 483 int loopback_enable; 474 unsigned int f_bitclk; 484 unsigned int f_bitclk; 475 }; 485 }; 476 486 >> 487 struct msp_i2s_platform_data; 477 int ux500_msp_i2s_init_msp(struct platform_dev 488 int ux500_msp_i2s_init_msp(struct platform_device *pdev, 478 struct ux500_msp **msp !! 489 struct ux500_msp **msp_p, >> 490 struct msp_i2s_platform_data *platform_data); 479 void ux500_msp_i2s_cleanup_msp(struct platform 491 void ux500_msp_i2s_cleanup_msp(struct platform_device *pdev, 480 struct ux500_msp *msp) 492 struct ux500_msp *msp); 481 int ux500_msp_i2s_open(struct ux500_msp *msp, 493 int ux500_msp_i2s_open(struct ux500_msp *msp, struct ux500_msp_config *config); 482 int ux500_msp_i2s_close(struct ux500_msp *msp, 494 int ux500_msp_i2s_close(struct ux500_msp *msp, 483 unsigned int dir); 495 unsigned int dir); 484 int ux500_msp_i2s_trigger(struct ux500_msp *ms 496 int ux500_msp_i2s_trigger(struct ux500_msp *msp, int cmd, 485 int direction); 497 int direction); 486 498 487 #endif 499 #endif 488 500
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.