Lines Matching refs:bas

67 static int mtk_uart_probe(struct uart_bas *bas);
68 static void mtk_uart_init(struct uart_bas *bas, int, int, int, int);
69 static void mtk_uart_term(struct uart_bas *bas);
70 static void mtk_uart_putc(struct uart_bas *bas, int);
71 static int mtk_uart_rxready(struct uart_bas *bas);
72 static int mtk_uart_getc(struct uart_bas *bas, struct mtx *);
89 mtk_uart_probe(struct uart_bas *bas) in mtk_uart_probe() argument
95 mtk_uart_init(struct uart_bas *bas, int baudrate, int databits, in mtk_uart_init() argument
125 if (bas->rclk && baudrate) { in mtk_uart_init()
126 uart_setreg(bas, UART_CDDL_REG, bas->rclk/16/baudrate); in mtk_uart_init()
127 uart_barrier(bas); in mtk_uart_init()
130 uart_setreg(bas, UART_LCR_REG, databits | in mtk_uart_init()
133 uart_barrier(bas); in mtk_uart_init()
137 mtk_uart_term(struct uart_bas *bas) in mtk_uart_term() argument
139 uart_setreg(bas, UART_MCR_REG, 0); in mtk_uart_term()
140 uart_barrier(bas); in mtk_uart_term()
144 mtk_uart_putc(struct uart_bas *bas, int c) in mtk_uart_putc() argument
149 while (!(uart_getreg(bas, UART_LSR_REG) & UART_LSR_THRE)); in mtk_uart_putc()
150 uart_setreg(bas, UART_TX_REG, c); in mtk_uart_putc()
151 uart_barrier(bas); in mtk_uart_putc()
152 while (!(uart_getreg(bas, UART_LSR_REG) & UART_LSR_THRE)); in mtk_uart_putc()
156 mtk_uart_rxready(struct uart_bas *bas) in mtk_uart_rxready() argument
158 if (uart_getreg(bas, UART_LSR_REG) & UART_LSR_DR) in mtk_uart_rxready()
164 mtk_uart_getc(struct uart_bas *bas, struct mtx *hwmtx) in mtk_uart_getc() argument
170 while (!(uart_getreg(bas, UART_LSR_REG) & UART_LSR_DR)) { in mtk_uart_getc()
176 c = uart_getreg(bas, UART_RX_REG); in mtk_uart_getc()
256 struct uart_bas *bas = &sc->sc_bas; in mtk_uart_disable_txintr() local
259 cr = uart_getreg(bas, UART_IER_REG); in mtk_uart_disable_txintr()
261 uart_setreg(bas, UART_IER_REG, cr); in mtk_uart_disable_txintr()
262 uart_barrier(bas); in mtk_uart_disable_txintr()
271 struct uart_bas *bas = &sc->sc_bas; in mtk_uart_enable_txintr() local
274 cr = uart_getreg(bas, UART_IER_REG); in mtk_uart_enable_txintr()
276 uart_setreg(bas, UART_IER_REG, cr); in mtk_uart_enable_txintr()
277 uart_barrier(bas); in mtk_uart_enable_txintr()
283 struct uart_bas *bas; in mtk_uart_bus_attach() local
287 bas = &sc->sc_bas; in mtk_uart_bus_attach()
289 if (!bas->rclk) { in mtk_uart_bus_attach()
290 bas->rclk = mtk_soc_get_uartclk(); in mtk_uart_bus_attach()
295 mtk_uart_init(bas, di->baudrate, di->databits, di->stopbits, in mtk_uart_bus_attach()
298 mtk_uart_init(bas, 57600, 8, 1, 0); in mtk_uart_bus_attach()
307 uart_setreg(bas, UART_FCR_REG, in mtk_uart_bus_attach()
308 uart_getreg(bas, UART_FCR_REG) | in mtk_uart_bus_attach()
310 uart_barrier(bas); in mtk_uart_bus_attach()
313 uart_setreg(bas, UART_IER_REG, in mtk_uart_bus_attach()
315 uart_barrier(bas); in mtk_uart_bus_attach()
329 struct uart_bas *bas = &sc->sc_bas; in mtk_uart_bus_flush() local
330 uint32_t fcr = uart_getreg(bas, UART_FCR_REG); in mtk_uart_bus_flush()
333 uart_setreg(bas, UART_FCR_REG, fcr|UART_FCR_TXRST); in mtk_uart_bus_flush()
334 uart_barrier(bas); in mtk_uart_bus_flush()
337 uart_setreg(bas, UART_FCR_REG, fcr|UART_FCR_RXRST); in mtk_uart_bus_flush()
338 uart_barrier(bas); in mtk_uart_bus_flush()
340 uart_setreg(bas, UART_FCR_REG, fcr); in mtk_uart_bus_flush()
341 uart_barrier(bas); in mtk_uart_bus_flush()
371 struct uart_bas *bas; in mtk_uart_bus_ioctl() local
374 bas = &sc->sc_bas; in mtk_uart_bus_ioctl()
382 divisor = uart_getreg(bas, UART_CDDL_REG); in mtk_uart_bus_ioctl()
383 baudrate = bas->rclk / (divisor * 16); in mtk_uart_bus_ioctl()
397 struct uart_bas *bas; in mtk_uart_bus_ipend() local
403 bas = &sc->sc_bas; in mtk_uart_bus_ipend()
471 struct uart_bas *bas; in mtk_uart_bus_receive() local
475 bas = &sc->sc_bas; in mtk_uart_bus_receive()
477 lsr = uart_getreg(bas, UART_LSR_REG); in mtk_uart_bus_receive()
484 xc = uart_getreg(bas, UART_RX_REG); in mtk_uart_bus_receive()
491 uart_barrier(bas); in mtk_uart_bus_receive()
493 lsr = uart_getreg(bas, UART_LSR_REG); in mtk_uart_bus_receive()
510 struct uart_bas *bas = &sc->sc_bas; in mtk_uart_bus_transmit() local
515 bas = &sc->sc_bas; in mtk_uart_bus_transmit()
517 while ((uart_getreg(bas, UART_LSR_REG) & UART_LSR_THRE) == 0); in mtk_uart_bus_transmit()
520 uart_setreg(bas, UART_TX_REG, sc->sc_txbuf[i]); in mtk_uart_bus_transmit()
521 uart_barrier(bas); in mtk_uart_bus_transmit()
531 struct uart_bas *bas = &sc->sc_bas; in mtk_uart_bus_grab() local
535 usc->ier = uart_getreg(bas, UART_IER_REG); in mtk_uart_bus_grab()
536 uart_setreg(bas, UART_IER_REG, usc->ier & usc->ier_mask); in mtk_uart_bus_grab()
537 uart_barrier(bas); in mtk_uart_bus_grab()
545 struct uart_bas *bas = &sc->sc_bas; in mtk_uart_bus_ungrab() local
548 uart_setreg(bas, UART_IER_REG, usc->ier); in mtk_uart_bus_ungrab()
549 uart_barrier(bas); in mtk_uart_bus_ungrab()