| 278 | } |
| 279 | |
| 280 | static int |
| 281 | mtk_uart_bus_attach(struct uart_softc *sc) |
| 282 | { |
| 283 | struct uart_bas *bas; |
| 284 | struct uart_devinfo *di; |
| 285 | struct uart_mtk_softc *usc = (struct uart_mtk_softc *)sc; |
| 286 | |
| 287 | bas = &sc->sc_bas; |
| 288 | |
| 289 | if (!bas->rclk) { |
| 290 | bas->rclk = mtk_soc_get_uartclk(); |
| 291 | } |
| 292 | |
| 293 | if (sc->sc_sysdev != NULL) { |
| 294 | di = sc->sc_sysdev; |
| 295 | mtk_uart_init(bas, di->baudrate, di->databits, di->stopbits, |
| 296 | di->parity); |
| 297 | } else { |
| 298 | mtk_uart_init(bas, 57600, 8, 1, 0); |
| 299 | } |
| 300 | |
| 301 | sc->sc_rxfifosz = 16; |
| 302 | sc->sc_txfifosz = 16; |
| 303 | |
| 304 | (void)mtk_uart_bus_getsig(sc); |
| 305 | |
| 306 | /* Enable FIFO */ |
| 307 | uart_setreg(bas, UART_FCR_REG, |
| 308 | uart_getreg(bas, UART_FCR_REG) | |
| 309 | UART_FCR_FIFOEN | UART_FCR_TXTGR_1 | UART_FCR_RXTGR_1); |
| 310 | uart_barrier(bas); |
| 311 | /* Enable interrupts */ |
| 312 | usc->ier_mask = 0xf0; |
| 313 | uart_setreg(bas, UART_IER_REG, |
| 314 | UART_IER_EDSSI | UART_IER_ELSI | UART_IER_ERBFI); |
| 315 | uart_barrier(bas); |
| 316 | |
| 317 | return (0); |
| 318 | } |
| 319 | |
| 320 | static int |
| 321 | mtk_uart_bus_detach(struct uart_softc *sc) |
nothing calls this directly
no test coverage detected