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