35 #define SUART_TRX_DIV_CONF_SZ 4
37 static short suart_mcasp_tx_baud_set(
unsigned int txBaudValue,
39 static short suart_mcasp_rx_baud_set(
unsigned int rxBaudValue,
40 unsigned int oversampling,
58 {300, 80000, 24, 3200},
59 {600, 40000, 15, 2500},
60 {1800, 13333, 10, 1212},
61 {2400, 10000, 4, 2000},
62 {4800, 5000, 1, 2500},
63 {7200, 3333, 0, 3333},
64 {9600, 2500, 0, 2500},
65 {14400, 1666, 0, 1666},
66 {19200, 1250, 0, 1250},
69 {115200, 208, 0, 208},
87 {300, 10000, 4, 2000},
89 {1800, 1667, 0, 1667},
90 {2400, 1250, 0, 1250},
116 {300, 5000, 1, 2500},
117 {600, 2500, 0, 2500},
123 {14400, 104, 0, 104},
146 mcasp0Regs->GBLCTL = 0;
147 mcasp0Regs->RGBLCTL = 0;
148 mcasp0Regs->XGBLCTL = 0;
149 mcasp0Regs->XSTAT = 0x0000FFFF;
150 mcasp0Regs->RSTAT = 0x0000FFFF;
155 unsigned int txBaudValue,
156 unsigned int rxBaudValue,
157 unsigned int oversampling,
163 mcasp0Regs->GBLCTL = 0;
164 mcasp0Regs->RGBLCTL = 0;
165 mcasp0Regs->XGBLCTL = 0;
169 mcasp0Regs->RMASK = 0x000000FF;
170 mcasp0Regs->RFMT = 0x0000A038;
173 mcasp0Regs->RMASK = 0x0000FFFF;
174 mcasp0Regs->RFMT = 0x0000A078;
177 mcasp0Regs->AFSRCTL = 0x00000002;
178 mcasp0Regs->ACLKRCTL = 0x000000A0;
179 mcasp0Regs->AHCLKRCTL = 0x00008000;
180 suart_mcasp_rx_baud_set(rxBaudValue, oversampling, pru_arm_iomap);
182 mcasp0Regs->RTDM = 0x00000001;
183 mcasp0Regs->RINTCTL = 0x00000002;
184 mcasp0Regs->RCLKCHK = 0x00FF0008;
187 mcasp0Regs->XMASK = 0x0000FFFF;
188 mcasp0Regs->XFMT = 0x00002078;
189 mcasp0Regs->AFSXCTL = 0x0000002;
190 mcasp0Regs->ACLKXCTL = 0x000000E0;
191 mcasp0Regs->AHCLKXCTL = 0x00008000;
193 suart_mcasp_tx_baud_set(txBaudValue, pru_arm_iomap);
195 mcasp0Regs->XTDM = 0x00000001;
196 mcasp0Regs->XINTCTL = 0x00000002;
197 mcasp0Regs->XCLKCHK = 0x00FF0008;
200 mcasp0Regs->SRCTL0 = 0x000c;
201 mcasp0Regs->SRCTL1 = 0x000c;
202 mcasp0Regs->SRCTL2 = 0x000c;
203 mcasp0Regs->SRCTL3 = 0x000c;
204 mcasp0Regs->SRCTL4 = 0x000c;
205 mcasp0Regs->SRCTL5 = 0x000c;
206 mcasp0Regs->SRCTL6 = 0x000c;
207 mcasp0Regs->SRCTL7 = 0x000c;
208 mcasp0Regs->SRCTL8 = 0x000c;
209 mcasp0Regs->SRCTL9 = 0x000c;
210 mcasp0Regs->SRCTL10 = 0x000c;
211 mcasp0Regs->SRCTL11 = 0x000c;
212 mcasp0Regs->SRCTL12 = 0x000c;
213 mcasp0Regs->SRCTL13 = 0x000c;
214 mcasp0Regs->SRCTL14 = 0x000c;
215 mcasp0Regs->SRCTL15 = 0x000c;
232 mcasp0Regs->PDOUT = 0xFFFF;
235 mcasp0Regs->PDIR = 0x00000000;
242 mcasp0Regs->PDOUT = 0xFFFF;
244 mcasp0Regs->DITCTL = 0x00000000;
245 mcasp0Regs->DLBCTL = 0x00000000;
246 mcasp0Regs->AMUTE = 0x00000000;
248 mcasp0Regs->XSTAT = 0x0000FFFF;
249 mcasp0Regs->RSTAT = 0x0000FFFF;
258 mcasp0Regs->PFUNC |= (0x1 << serializerNum);
264 short suart_mcasp_tx_baud_set(
unsigned int txBaudValue,
267 unsigned int clkDivVal;
268 unsigned int loopCnt;
285 mcasp0Regs->ACLKXCTL |=
288 mcasp0Regs->AHCLKXCTL |=
299 short suart_mcasp_rx_baud_set(
unsigned int rxBaudValue,
300 unsigned int oversampling,
303 unsigned int clkDivVal;
304 unsigned int loopCnt;
316 mcasp0Regs->ACLKRCTL |=
320 mcasp0Regs->AHCLKRCTL |=
332 mcasp0Regs->ACLKRCTL |=
336 mcasp0Regs->AHCLKRCTL |=
343 }
else if (oversampling == 0) {
348 mcasp0Regs->ACLKRCTL |=
352 mcasp0Regs->AHCLKRCTL |=
375 unsigned int rxBaudValue,
376 unsigned int oversampling,
381 status = suart_mcasp_tx_baud_set(txBaudValue, pru_arm_iomap);
383 suart_mcasp_rx_baud_set(rxBaudValue, oversampling, pru_arm_iomap);
398 unsigned int * pu32SrCtlAddr =
NULL;
406 pu32SrCtlAddr = (
unsigned int *)&(mcasp0Regs->SRCTL0);
407 pu32SrCtlAddr += u16srNum;
408 * (pu32SrCtlAddr) = 0x000C;
415 #if !(defined CONFIG_OMAPL_SUART_MCASP) || (CONFIG_OMAPL_SUART_MCASP == 0)
416 #define MCASP_PSC_OFFSET (CSL_PSC_MCASP0)
417 #elif (CONFIG_OMAPL_SUART_MCASP == 1)
418 #define MCASP_PSC_OFFSET (CSL_PSC_MCASP0 + 1)
419 #elif (CONFIG_OMAPL_SUART_MCASP == 2)
420 #define MCASP_PSC_OFFSET (CSL_PSC_MCASP0 + 2)
431 while (
CSL_FEXT(PSC->PTSTAT, PSC_PTSTAT_GOSTAT0) ==
444 while (
CSL_FEXT(PSC->PTSTAT, PSC_PTSTAT_GOSTAT0) ==
460 while (
CSL_FEXT(PSC->PTSTAT, PSC_PTSTAT_GOSTAT0) ==
473 while (
CSL_FEXT(PSC->PTSTAT, PSC_PTSTAT_GOSTAT0) ==
#define SUART_INVALID_OVERSAMPLING
#define PRU_SUART3_CONFIG_TX_SER
void suart_mcasp_psc_enable(unsigned int psc1_addr)
#define PRU_SUART6_CONFIG_TX_SER
#define CSL_FEXT(reg, PER_REG_FIELD)
#define SUART_16X_OVRSMPL
#define SUART_INVALID_RX_BAUD
#define CSL_PSC_MDSTAT_STATE_SYNCRST
void suart_mcasp_config(unsigned int mcasp_addr, unsigned int txBaudValue, unsigned int rxBaudValue, unsigned int oversampling, arm_pru_iomap *pru_arm_iomap)
volatile CSL_McaspRegs * CSL_McaspRegsOvly
#define CSL_MCASP_PFUNC_RESETVAL
#define CSL_PSC_PTSTAT_GOSTAT0_IN_TRANSITION
unsigned int lt_rx_16x_baud_rate[][SUART_TRX_DIV_CONF_SZ]
short suart_asp_baud_set(unsigned int txBaudValue, unsigned int rxBaudValue, unsigned int oversampling, arm_pru_iomap *pru_arm_iomap)
#define SUART_NUM_OF_BAUDS_SUPPORTED
short suart_asp_serializer_deactivate(unsigned short u16srNum, arm_pru_iomap *pru_arm_iomap)
#define PRU_SUART2_CONFIG_TX_SER
volatile CSL_PscRegs * CSL_PscRegsOvly
#define PRU_SUART1_CONFIG_TX_SER
#define CSL_MCASP_ACLKXCTL_CLKXDIV_SHIFT
unsigned int lt_tx_baud_rate[][SUART_TRX_DIV_CONF_SZ]
#define CSL_MCASP_AHCLKXCTL_HCLKXDIV_SHIFT
void suart_mcasp_tx_serialzier_set(unsigned int serializerNum, arm_pru_iomap *pru_arm_iomap)
#define SUART_TRX_DIV_CONF_SZ
#define PRU_SUART4_CONFIG_TX_SER
#define CSL_FINST(reg, PER_REG_FIELD, TOKEN)
#define PRU_SUART8_CONFIG_TX_SER
void suart_mcasp_psc_disable(unsigned int psc1_addr)
#define PRU_SUART5_CONFIG_TX_SER
#define PRU_SUART7_CONFIG_TX_SER
void suart_mcasp_reset(arm_pru_iomap *pru_arm_iomap)
#define CSL_PSC_MDSTAT_STATE_ENABLE
#define SUART_INVALID_TX_BAUD
unsigned int lt_rx_8x_baud_rate[][SUART_TRX_DIV_CONF_SZ]
#define SUART_INVALID_SR_NUM