Lines Matching refs:bas
73 static int imx_uart_probe(struct uart_bas *bas);
74 static void imx_uart_init(struct uart_bas *bas, int, int, int, int);
75 static void imx_uart_term(struct uart_bas *bas);
76 static void imx_uart_putc(struct uart_bas *bas, int);
77 static int imx_uart_rxready(struct uart_bas *bas);
78 static int imx_uart_getc(struct uart_bas *bas, struct mtx *);
91 dumpregs(struct uart_bas *bas, const char * msg)
98 msg, bas->bsh,
99 GETREG(bas, REG(UCR1)), GETREG(bas, REG(UCR2)),
100 GETREG(bas, REG(UCR3)), GETREG(bas, REG(UCR4)),
101 GETREG(bas, REG(USR1)), GETREG(bas, REG(USR2)));
106 imx_uart_probe(struct uart_bas *bas) in imx_uart_probe() argument
113 imx_uart_getbaud(struct uart_bas *bas) in imx_uart_getbaud() argument
131 i = (GETREG(bas, REG(UFCR)) & IMXUART_UFCR_RFDIV_MASK) >> in imx_uart_getbaud()
133 rate = bas->rclk / predivs[i]; in imx_uart_getbaud()
134 ubir = GETREG(bas, REG(UBIR)) + 1; in imx_uart_getbaud()
135 ubmr = GETREG(bas, REG(UBMR)) + 1; in imx_uart_getbaud()
152 imx_uart_init(struct uart_bas *bas, int baudrate, int databits, in imx_uart_init() argument
158 SET(bas, REG(UCR1), FLD(UCR1, UARTEN)); in imx_uart_init()
159 SET(bas, REG(UCR2), FLD(UCR2, RXEN) | FLD(UCR2, TXEN)); in imx_uart_init()
162 DIS(bas, UCR2, WS); in imx_uart_init()
164 ENA(bas, UCR2, WS); in imx_uart_init()
167 ENA(bas, UCR2, STPB); in imx_uart_init()
169 DIS(bas, UCR2, STPB); in imx_uart_init()
173 DIS(bas, UCR2, PROE); in imx_uart_init()
174 ENA(bas, UCR2, PREN); in imx_uart_init()
177 ENA(bas, UCR2, PROE); in imx_uart_init()
178 ENA(bas, UCR2, PREN); in imx_uart_init()
185 DIS(bas, UCR2, PREN); in imx_uart_init()
201 if ((baudrate > 0) && (bas->rclk != 0)) { in imx_uart_init()
202 baseclk = bas->rclk; in imx_uart_init()
203 reg = GETREG(bas, REG(UFCR)); in imx_uart_init()
205 SETREG(bas, REG(UFCR), reg); in imx_uart_init()
206 SETREG(bas, REG(UBIR), 15); in imx_uart_init()
207 SETREG(bas, REG(UBMR), (baseclk / baudrate) - 1); in imx_uart_init()
215 reg = GETREG(bas, REG(UFCR)); in imx_uart_init()
219 SETREG(bas, REG(UFCR), reg); in imx_uart_init()
223 imx_uart_term(struct uart_bas *bas) in imx_uart_term() argument
229 imx_uart_putc(struct uart_bas *bas, int c) in imx_uart_putc() argument
232 while (!(IS(bas, USR1, TRDY))) in imx_uart_putc()
234 SETREG(bas, REG(UTXD), c); in imx_uart_putc()
238 imx_uart_rxready(struct uart_bas *bas) in imx_uart_rxready() argument
241 return ((IS(bas, USR2, RDR)) ? 1 : 0); in imx_uart_rxready()
245 imx_uart_getc(struct uart_bas *bas, struct mtx *hwmtx) in imx_uart_getc() argument
250 while (!(IS(bas, USR2, RDR))) in imx_uart_getc()
253 c = GETREG(bas, REG(URXD)); in imx_uart_getc()
335 struct uart_bas *bas; in imx_uart_setup_clocks() local
340 bas = &sc->sc_bas; in imx_uart_setup_clocks()
361 bas->rclk = (uint32_t)freq; in imx_uart_setup_clocks()
370 struct uart_bas *bas; in imx_uart_bus_attach() local
373 bas = &sc->sc_bas; in imx_uart_bus_attach()
380 bas->rclk = imx_ccm_uart_hz(); in imx_uart_bus_attach()
385 imx_uart_init(bas, di->baudrate, di->databits, di->stopbits, in imx_uart_bus_attach()
388 imx_uart_init(bas, 115200, 8, 1, 0); in imx_uart_bus_attach()
394 SETREG(bas, REG(USR1), 0xffff); in imx_uart_bus_attach()
395 SETREG(bas, REG(USR2), 0xffff); in imx_uart_bus_attach()
397 DIS(bas, UCR4, DREN); in imx_uart_bus_attach()
398 ENA(bas, UCR1, RRDYEN); in imx_uart_bus_attach()
399 DIS(bas, UCR1, IDEN); in imx_uart_bus_attach()
400 DIS(bas, UCR3, RXDSEN); in imx_uart_bus_attach()
401 ENA(bas, UCR2, ATEN); in imx_uart_bus_attach()
402 DIS(bas, UCR1, TXMPTYEN); in imx_uart_bus_attach()
403 DIS(bas, UCR1, TRDYEN); in imx_uart_bus_attach()
404 DIS(bas, UCR4, TCEN); in imx_uart_bus_attach()
405 DIS(bas, UCR4, OREN); in imx_uart_bus_attach()
406 ENA(bas, UCR4, BKEN); in imx_uart_bus_attach()
407 DIS(bas, UCR4, WKEN); in imx_uart_bus_attach()
408 DIS(bas, UCR1, ADEN); in imx_uart_bus_attach()
409 DIS(bas, UCR3, ACIEN); in imx_uart_bus_attach()
410 DIS(bas, UCR2, ESCI); in imx_uart_bus_attach()
411 DIS(bas, UCR4, ENIRI); in imx_uart_bus_attach()
412 DIS(bas, UCR3, AIRINTEN); in imx_uart_bus_attach()
413 DIS(bas, UCR3, AWAKEN); in imx_uart_bus_attach()
414 DIS(bas, UCR3, FRAERREN); in imx_uart_bus_attach()
415 DIS(bas, UCR3, PARERREN); in imx_uart_bus_attach()
416 DIS(bas, UCR1, RTSDEN); in imx_uart_bus_attach()
417 DIS(bas, UCR2, RTSEN); in imx_uart_bus_attach()
418 DIS(bas, UCR3, DTREN); in imx_uart_bus_attach()
419 DIS(bas, UCR3, RI); in imx_uart_bus_attach()
420 DIS(bas, UCR3, DCD); in imx_uart_bus_attach()
421 DIS(bas, UCR3, DTRDEN); in imx_uart_bus_attach()
422 ENA(bas, UCR2, IRTS); in imx_uart_bus_attach()
423 ENA(bas, UCR3, RXDMUXSEL); in imx_uart_bus_attach()
468 struct uart_bas *bas; in imx_uart_bus_ioctl() local
471 bas = &sc->sc_bas; in imx_uart_bus_ioctl()
479 *(u_int*)data = imx_uart_getbaud(bas); in imx_uart_bus_ioctl()
493 struct uart_bas *bas; in imx_uart_bus_ipend() local
498 bas = &sc->sc_bas; in imx_uart_bus_ipend()
504 usr1 = GETREG(bas, REG(USR1)); in imx_uart_bus_ipend()
505 usr2 = GETREG(bas, REG(USR2)); in imx_uart_bus_ipend()
507 SETREG(bas, REG(USR1), usr1); in imx_uart_bus_ipend()
508 SETREG(bas, REG(USR2), usr2); in imx_uart_bus_ipend()
510 ucr1 = GETREG(bas, REG(UCR1)); in imx_uart_bus_ipend()
511 ucr2 = GETREG(bas, REG(UCR2)); in imx_uart_bus_ipend()
512 ucr4 = GETREG(bas, REG(UCR4)); in imx_uart_bus_ipend()
516 DIS(bas, UCR1, TRDYEN); in imx_uart_bus_ipend()
527 DIS(bas, UCR1, RRDYEN); in imx_uart_bus_ipend()
528 DIS(bas, UCR2, ATEN); in imx_uart_bus_ipend()
577 struct uart_bas *bas; in imx_uart_bus_receive() local
580 bas = &sc->sc_bas; in imx_uart_bus_receive()
589 while (IS(bas, USR2, RDR)) { in imx_uart_bus_receive()
595 xc = GETREG(bas, REG(URXD)); in imx_uart_bus_receive()
608 ENA(bas, UCR1, RRDYEN); in imx_uart_bus_receive()
609 ENA(bas, UCR2, ATEN); in imx_uart_bus_receive()
625 struct uart_bas *bas = &sc->sc_bas; in imx_uart_bus_transmit() local
628 bas = &sc->sc_bas; in imx_uart_bus_transmit()
638 SETREG(bas, REG(UTXD), sc->sc_txbuf[i] & 0xff); in imx_uart_bus_transmit()
641 ENA(bas, UCR1, TRDYEN); in imx_uart_bus_transmit()
651 struct uart_bas *bas = &sc->sc_bas; in imx_uart_bus_grab() local
653 bas = &sc->sc_bas; in imx_uart_bus_grab()
655 DIS(bas, UCR1, RRDYEN); in imx_uart_bus_grab()
656 DIS(bas, UCR2, ATEN); in imx_uart_bus_grab()
663 struct uart_bas *bas = &sc->sc_bas; in imx_uart_bus_ungrab() local
665 bas = &sc->sc_bas; in imx_uart_bus_ungrab()
667 ENA(bas, UCR1, RRDYEN); in imx_uart_bus_ungrab()
668 ENA(bas, UCR2, ATEN); in imx_uart_bus_ungrab()