MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mtk_uart_bus_attach

Function mtk_uart_bus_attach

freebsd/mips/mediatek/uart_dev_mtk.c:280–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278}
279
280static int
281mtk_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
320static int
321mtk_uart_bus_detach(struct uart_softc *sc)

Callers

nothing calls this directly

Calls 3

mtk_soc_get_uartclkFunction · 0.85
mtk_uart_initFunction · 0.85
mtk_uart_bus_getsigFunction · 0.85

Tested by

no test coverage detected