Lines Matching +full:uart +full:- +full:tx
1 /*-
37 #include <dev/uart/uart.h>
38 #include <dev/uart/uart_bus.h>
39 #include <dev/uart/uart_cpu.h>
40 #include <dev/uart/uart_cpu_fdt.h>
54 #define CTRL_TX_FIFO_RST (1 << 15) /* TX FIFO Reset */
61 #define CTRL_TX_HALF_INT (1 << 8) /* TX Half-Full Interrupt Enable */
62 #define CTRL_RX_HALF_INT (1 << 7) /* RX Half-Full Interrupt Enable */
63 #define CTRL_TX_EMPT_INT (1 << 6) /* TX Empty Interrupt Enable */
64 #define CTRL_TX_RDY_INT (1 << 5) /* TX Ready Interrupt Enable */
76 #define STAT_TX_FIFO_EMPT (1 << 13) /* TX FIFO Empty */
78 #define STAT_TX_FIFO_FULL (1 << 11) /* TX FIFO Full */
79 #define STAT_TX_FIFO_HALF (1 << 10) /* TX FIFO Half Full */
83 #define STAT_TX_EMPT (1 << 6) /* TX Empty */
84 #define STAT_TX_RDY (1 << 5) /* TX Ready */
127 * Low-level UART interface.
174 /* Reset UART */ in uart_mvebu_param()
199 divisor = uart_mvebu_divisor(bas->rclk, baudrate); in uart_mvebu_param()
225 bas->rclk = DEFAULT_RCLK; in uart_mvebu_init()
267 * UART driver methods implementation.
306 "mvebu-uart",
317 {"marvell,armada-3700-uart", (uintptr_t)&uart_mvebu_class},
328 bas = &sc->sc_bas; in uart_mvebu_bus_attach()
329 uart_lock(sc->sc_hwmtx); in uart_mvebu_bus_attach()
341 uart_unlock(sc->sc_hwmtx); in uart_mvebu_bus_attach()
359 bas = &sc->sc_bas; in uart_mvebu_bus_flush()
360 uart_lock(sc->sc_hwmtx); in uart_mvebu_bus_flush()
385 uart_unlock(sc->sc_hwmtx); in uart_mvebu_bus_flush()
403 bas = &sc->sc_bas; in uart_mvebu_bus_ioctl()
404 uart_lock(sc->sc_hwmtx); in uart_mvebu_bus_ioctl()
418 baudrate = bas->rclk/(divisor * 16); in uart_mvebu_bus_ioctl()
426 uart_unlock(sc->sc_hwmtx); in uart_mvebu_bus_ioctl()
437 bas = &sc->sc_bas; in uart_mvebu_bus_ipend()
438 uart_lock(sc->sc_hwmtx); in uart_mvebu_bus_ipend()
444 /* Disable TX IDLE Interrupt generation */ in uart_mvebu_bus_ipend()
448 /* SER_INT_TXIDLE means empty TX FIFO. Wait until it cleans */ in uart_mvebu_bus_ipend()
457 uart_unlock(sc->sc_hwmtx); in uart_mvebu_bus_ipend()
468 uart_lock(sc->sc_hwmtx); in uart_mvebu_bus_param()
469 ret = uart_mvebu_param(&sc->sc_bas, baudrate, databits, stopbits, parity); in uart_mvebu_bus_param()
470 uart_unlock(sc->sc_hwmtx); in uart_mvebu_bus_param()
478 if (!ofw_bus_status_okay(sc->sc_dev)) in uart_mvebu_bus_probe()
481 if (!ofw_bus_search_compatible(sc->sc_dev, compat_data)->ocd_data) in uart_mvebu_bus_probe()
484 device_set_desc(sc->sc_dev, "Marvell Armada 3700 UART"); in uart_mvebu_bus_probe()
486 sc->sc_txfifosz = 32; in uart_mvebu_bus_probe()
487 sc->sc_rxfifosz = 64; in uart_mvebu_bus_probe()
488 sc->sc_hwiflow = 0; in uart_mvebu_bus_probe()
489 sc->sc_hwoflow = 0; in uart_mvebu_bus_probe()
501 bas = &sc->sc_bas; in uart_mvebu_bus_receive()
502 uart_lock(sc->sc_hwmtx); in uart_mvebu_bus_receive()
506 sc->sc_rxbuf[sc->sc_rxput] = UART_STAT_OVERRUN; in uart_mvebu_bus_receive()
535 uart_unlock(sc->sc_hwmtx); in uart_mvebu_bus_receive()
552 bas = &sc->sc_bas; in uart_mvebu_bus_transmit()
553 uart_lock(sc->sc_hwmtx); in uart_mvebu_bus_transmit()
560 for (i = 0; i < sc->sc_txdatasz; i++) { in uart_mvebu_bus_transmit()
561 uart_setreg(bas, UART_TSH, sc->sc_txbuf[i] & 0xff); in uart_mvebu_bus_transmit()
573 sc->sc_txbusy = 1; in uart_mvebu_bus_transmit()
575 uart_unlock(sc->sc_hwmtx); in uart_mvebu_bus_transmit()
583 struct uart_bas *bas = &sc->sc_bas; in uart_mvebu_bus_grab()
587 uart_lock(sc->sc_hwmtx); in uart_mvebu_bus_grab()
589 msc->intrm = ctrl & CTRL_INTR_MASK; in uart_mvebu_bus_grab()
592 uart_unlock(sc->sc_hwmtx); in uart_mvebu_bus_grab()
599 struct uart_bas *bas = &sc->sc_bas; in uart_mvebu_bus_ungrab()
603 uart_lock(sc->sc_hwmtx); in uart_mvebu_bus_ungrab()
605 uart_setreg(bas, UART_CTRL, ctrl | msc->intrm); in uart_mvebu_bus_ungrab()
607 uart_unlock(sc->sc_hwmtx); in uart_mvebu_bus_ungrab()