Lines Matching +full:rx +full:- +full:input
1 // SPDX-License-Identifier: GPL-2.0+
12 #include <dt-bindings/clock/microchip,clock.h>
64 writel(div - 1, base + U_BRG); in pic32_serial_init()
66 /* enable the UART for TX and RX */ in pic32_serial_init()
74 /* Check whether any char pending in RX fifo */
77 /* check if rx buffer overrun error has occurred */ in pic32_uart_pending_input()
86 * chars in rx-fifo. Only it can be known whether there is any. in pic32_uart_pending_input()
91 static int pic32_uart_pending(struct udevice *dev, bool input) in pic32_uart_pending() argument
95 if (input) in pic32_uart_pending()
96 return pic32_uart_pending_input(priv->base); in pic32_uart_pending()
98 return !(readl(priv->base + U_STA) & UART_TX_EMPTY); in pic32_uart_pending()
105 return pic32_serial_init(priv->base, priv->uartclk, baudrate); in pic32_uart_setbrg()
113 if (readl(priv->base + U_STA) & UART_TX_FULL) in pic32_uart_putc()
114 return -EAGAIN; in pic32_uart_putc()
117 writel(ch, priv->base + U_TXR); in pic32_uart_putc()
126 /* return error if RX fifo is empty */ in pic32_uart_getc()
127 if (!pic32_uart_pending_input(priv->base)) in pic32_uart_getc()
128 return -EAGAIN; in pic32_uart_getc()
130 /* read the character from rx buffer */ in pic32_uart_getc()
131 return readl(priv->base + U_RXR) & 0xff; in pic32_uart_getc()
143 addr = fdtdec_get_addr_size(gd->fdt_blob, dev_of_offset(dev), "reg", in pic32_uart_probe()
146 return -EINVAL; in pic32_uart_probe()
148 priv->base = ioremap(addr, size); in pic32_uart_probe()
154 priv->uartclk = clk_get_rate(&clk); in pic32_uart_probe()
158 return pic32_serial_init(priv->base, priv->uartclk, CONFIG_BAUDRATE); in pic32_uart_probe()
169 { .compatible = "microchip,pic32mzda-uart" },
174 .name = "pic32-uart",