Lines Matching +full:enable +full:- +full:modem +full:- +full:interrupt

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
31 /* A driver for the Cadence AMBA UART as used by the Xilinx Zynq-7000.
33 * Reference: Zynq-7000 All Programmable SoC Technical Reference Manual.
55 bus_space_read_4((bas)->bst, (bas)->bsh, uart_regofs((bas), (reg)))
57 bus_space_write_4((bas)->bst, (bas)->bsh, uart_regofs((bas), (reg)), \
74 #define CDNC_UART_MODE_REG_CHMOD_R_LOOP (3<<8) /* [9:8] - channel mode */
77 #define CDNC_UART_MODE_REG_STOP2 (2<<6) /* [7:6] - stop bits */
78 #define CDNC_UART_MODE_REG_PAR_NONE (4<<3) /* [5:3] - parity type */
83 #define CDNC_UART_MODE_REG_6BIT (3<<1) /* [2:1] - character len */
88 #define CDNC_UART_IEN_REG 0x08 /* Interrupt registers. */
95 #define CDNC_UART_INT_DMSI (1<<9) /* delta modem status */
144 * Low-level UART interface.
191 baudgen = (bas->rclk + (baudrate * (bauddiv + 1)) / 2) / in cdnc_uart_set_baud()
196 baud_out = bas->rclk / (baudgen * (bauddiv + 1)); in cdnc_uart_set_baud()
198 baud_out - baudrate : baudrate - baud_out; in cdnc_uart_set_baud()
212 return (-1); /* out of range */ in cdnc_uart_set_baud()
326 * interrupt driven).
382 * High-level UART interface.
419 sc->sc_txfifosz = UART_FIFO_SIZE; in cdnc_uart_bus_probe()
420 sc->sc_rxfifosz = UART_FIFO_SIZE; in cdnc_uart_bus_probe()
421 sc->sc_hwiflow = 0; in cdnc_uart_bus_probe()
422 sc->sc_hwoflow = 0; in cdnc_uart_bus_probe()
424 device_set_desc(sc->sc_dev, "Cadence UART"); in cdnc_uart_bus_probe()
432 struct uart_bas *bas = &sc->sc_bas; in cdnc_uart_bus_attach()
435 if (sc->sc_sysdev != NULL) { in cdnc_uart_bus_attach()
436 di = sc->sc_sysdev; in cdnc_uart_bus_attach()
437 (void)cdnc_uart_set_params(bas, di->baudrate, di->databits, in cdnc_uart_bus_attach()
438 di->stopbits, di->parity); in cdnc_uart_bus_attach()
444 /* Enable interrupts. */ in cdnc_uart_bus_attach()
457 struct uart_bas *bas = &sc->sc_bas; in cdnc_uart_bus_transmit()
459 uart_lock(sc->sc_hwmtx); in cdnc_uart_bus_transmit()
464 for (i = 0; i < sc->sc_txdatasz; i++) in cdnc_uart_bus_transmit()
465 WR4(bas, CDNC_UART_FIFO, sc->sc_txbuf[i]); in cdnc_uart_bus_transmit()
467 /* Enable TX empty interrupt. */ in cdnc_uart_bus_transmit()
469 sc->sc_txbusy = 1; in cdnc_uart_bus_transmit()
471 uart_unlock(sc->sc_hwmtx); in cdnc_uart_bus_transmit()
479 struct uart_bas *bas = &sc->sc_bas; in cdnc_uart_bus_setsig()
483 old = sc->sc_hwsig; in cdnc_uart_bus_setsig()
491 } while (!atomic_cmpset_32(&sc->sc_hwsig, old, new)); in cdnc_uart_bus_setsig()
492 uart_lock(sc->sc_hwmtx); in cdnc_uart_bus_setsig()
501 uart_unlock(sc->sc_hwmtx); in cdnc_uart_bus_setsig()
508 struct uart_bas *bas = &sc->sc_bas; in cdnc_uart_bus_receive()
512 uart_lock(sc->sc_hwmtx); in cdnc_uart_bus_receive()
531 sc->sc_sysdev != NULL && in cdnc_uart_bus_receive()
532 sc->sc_sysdev->type == UART_DEV_CONSOLE) { in cdnc_uart_bus_receive()
540 uart_unlock(sc->sc_hwmtx); in cdnc_uart_bus_receive()
550 return (cdnc_uart_set_params(&sc->sc_bas, baudrate, in cdnc_uart_bus_param()
558 struct uart_bas *bas = &sc->sc_bas; in cdnc_uart_bus_ipend()
561 uart_lock(sc->sc_hwmtx); in cdnc_uart_bus_ipend()
565 /* Clear interrupt bits. */ in cdnc_uart_bus_ipend()
576 if (sc->sc_txbusy && (istatus & CDNC_UART_INT_TXEMPTY) != 0) { in cdnc_uart_bus_ipend()
577 /* disable txempty interrupt. */ in cdnc_uart_bus_ipend()
590 /* Modem signal change. */ in cdnc_uart_bus_ipend()
600 uart_unlock(sc->sc_hwmtx); in cdnc_uart_bus_ipend()
614 struct uart_bas *bas = &sc->sc_bas; in cdnc_uart_bus_getsig()
619 old = sc->sc_hwsig; in cdnc_uart_bus_getsig()
621 uart_lock(sc->sc_hwmtx); in cdnc_uart_bus_getsig()
623 uart_unlock(sc->sc_hwmtx); in cdnc_uart_bus_getsig()
633 } while (!atomic_cmpset_32(&sc->sc_hwsig, old, new)); in cdnc_uart_bus_getsig()
640 struct uart_bas *bas = &sc->sc_bas; in cdnc_uart_bus_ioctl()
644 uart_lock(sc->sc_hwmtx); in cdnc_uart_bus_ioctl()
671 uart_unlock(sc->sc_hwmtx); in cdnc_uart_bus_ioctl()
680 /* Enable interrupts. */ in cdnc_uart_bus_grab()
681 WR4(&sc->sc_bas, CDNC_UART_IEN_REG, in cdnc_uart_bus_grab()
690 /* Enable interrupts. */ in cdnc_uart_bus_ungrab()
691 WR4(&sc->sc_bas, CDNC_UART_IEN_REG, in cdnc_uart_bus_ungrab()
707 {"cdns,uart-r1p12", (uintptr_t)&uart_cdnc_class},