drivers/tty/serial/xilinx_uartps.c
Source file repositories/reference/linux-study-clean/drivers/tty/serial/xilinx_uartps.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/tty/serial/xilinx_uartps.c- Extension
.c- Size
- 55857 bytes
- Lines
- 1925
- Domain
- Driver Families
- Bucket
- drivers/tty
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/platform_device.hlinux/serial.hlinux/console.hlinux/serial_core.hlinux/slab.hlinux/tty.hlinux/tty_flip.hlinux/clk.hlinux/irq.hlinux/io.hlinux/of.hlinux/module.hlinux/pm_runtime.hlinux/gpio/consumer.hlinux/delay.hlinux/reset.h
Detected Declarations
struct cdns_uartstruct cdns_platform_datafunction cdns_uart_handle_rxfunction cdns_rts_gpio_enablefunction cdns_rs485_tx_setupfunction cdns_rs485_rx_setupfunction cdns_uart_tx_emptyfunction cdns_rs485_rx_callbackfunction cdns_calc_after_tx_delayfunction cdns_uart_handle_txfunction uart_fifo_getfunction cdns_uart_isrfunction cdns_uart_calc_baud_divsfunction cdns_uart_set_baud_ratefunction cdns_uart_clk_notifier_cbfunction cdns_rs485_tx_callbackfunction cdns_uart_start_txfunction cdns_uart_stop_txfunction cdns_uart_stop_rxfunction cdns_uart_break_ctlfunction cdns_uart_set_termiosfunction cdns_uart_startupfunction cdns_uart_shutdownfunction cdns_uart_verify_portfunction uart_add_one_portfunction uart_remove_one_portfunction cdns_uart_config_portfunction cdns_uart_get_mctrlfunction cdns_uart_set_mctrlfunction cdns_uart_poll_get_charfunction cdns_uart_poll_put_charfunction cdns_uart_pmfunction cdns_uart_console_putcharfunction cdns_early_writefunction cdns_early_console_setupfunction cdns_uart_console_writefunction cdns_uart_console_setupfunction cdns_uart_suspendfunction cdns_uart_resumefunction cdns_runtime_suspendfunction cdns_runtime_resumefunction cdns_rs485_configfunction cdns_uart_probefunction register_consolefunction cdns_uart_removefunction cdns_uart_initfunction cdns_uart_exit
Annotated Snippet
struct cdns_uart {
struct uart_port *port;
struct clk *uartclk;
struct clk *pclk;
unsigned int baud;
struct notifier_block clk_rate_change_nb;
u32 quirks;
bool cts_override;
struct gpio_desc *gpiod_rts;
bool rs485_tx_started;
struct hrtimer tx_timer;
struct reset_control *rstc;
};
struct cdns_platform_data {
u32 quirks;
};
static struct serial_rs485 cdns_rs485_supported = {
.flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND |
SER_RS485_RTS_AFTER_SEND,
.delay_rts_before_send = 1,
.delay_rts_after_send = 1,
};
#define to_cdns_uart(_nb) container_of(_nb, struct cdns_uart, \
clk_rate_change_nb)
/**
* cdns_uart_handle_rx - Handle the received bytes along with Rx errors.
* @dev_id: Id of the UART port
* @isrstatus: The interrupt status register value as read
* Return: None
*/
static void cdns_uart_handle_rx(void *dev_id, unsigned int isrstatus)
{
struct uart_port *port = (struct uart_port *)dev_id;
struct cdns_uart *cdns_uart = port->private_data;
unsigned int data;
unsigned int rxbs_status = 0;
unsigned int status_mask;
unsigned int framerrprocessed = 0;
char status = TTY_NORMAL;
bool is_rxbs_support;
is_rxbs_support = cdns_uart->quirks & CDNS_UART_RXBS_SUPPORT;
while ((readl(port->membase + CDNS_UART_SR) &
CDNS_UART_SR_RXEMPTY) != CDNS_UART_SR_RXEMPTY) {
if (is_rxbs_support)
rxbs_status = readl(port->membase + CDNS_UART_RXBS);
data = readl(port->membase + CDNS_UART_FIFO);
port->icount.rx++;
/*
* There is no hardware break detection in Zynq, so we interpret
* framing error with all-zeros data as a break sequence.
* Most of the time, there's another non-zero byte at the
* end of the sequence.
*/
if (!is_rxbs_support && (isrstatus & CDNS_UART_IXR_FRAMING)) {
if (!data) {
port->read_status_mask |= CDNS_UART_IXR_BRK;
framerrprocessed = 1;
continue;
}
}
if (is_rxbs_support && (rxbs_status & CDNS_UART_RXBS_BRK)) {
port->icount.brk++;
status = TTY_BREAK;
if (uart_handle_break(port))
continue;
}
isrstatus &= port->read_status_mask;
isrstatus &= ~port->ignore_status_mask;
status_mask = port->read_status_mask;
status_mask &= ~port->ignore_status_mask;
if (data &&
(port->read_status_mask & CDNS_UART_IXR_BRK)) {
port->read_status_mask &= ~CDNS_UART_IXR_BRK;
port->icount.brk++;
if (uart_handle_break(port))
continue;
}
if (uart_prepare_sysrq_char(port, data))
continue;
if (is_rxbs_support) {
if ((rxbs_status & CDNS_UART_RXBS_PARITY)
Annotation
- Immediate include surface: `linux/platform_device.h`, `linux/serial.h`, `linux/console.h`, `linux/serial_core.h`, `linux/slab.h`, `linux/tty.h`, `linux/tty_flip.h`, `linux/clk.h`.
- Detected declarations: `struct cdns_uart`, `struct cdns_platform_data`, `function cdns_uart_handle_rx`, `function cdns_rts_gpio_enable`, `function cdns_rs485_tx_setup`, `function cdns_rs485_rx_setup`, `function cdns_uart_tx_empty`, `function cdns_rs485_rx_callback`, `function cdns_calc_after_tx_delay`, `function cdns_uart_handle_tx`.
- Atlas domain: Driver Families / drivers/tty.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.