drivers/tty/serial/sunplus-uart.c
Source file repositories/reference/linux-study-clean/drivers/tty/serial/sunplus-uart.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/tty/serial/sunplus-uart.c- Extension
.c- Size
- 18721 bytes
- Lines
- 768
- Domain
- Driver Families
- Bucket
- drivers/tty
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/clk.hlinux/console.hlinux/interrupt.hlinux/io.hlinux/iopoll.hlinux/module.hlinux/of.hlinux/of_platform.hlinux/platform_device.hlinux/reset.hlinux/serial_core.hlinux/serial_reg.hlinux/sysrq.hlinux/tty.hlinux/tty_flip.hasm/irq.h
Detected Declarations
struct sunplus_uart_portfunction sp_uart_put_charfunction sunplus_tx_buf_not_fullfunction sunplus_tx_emptyfunction sunplus_set_mctrlfunction sunplus_get_mctrlfunction sunplus_stop_txfunction sunplus_start_txfunction sunplus_stop_rxfunction sunplus_break_ctlfunction transmit_charsfunction receive_charsfunction sunplus_uart_irqfunction sunplus_startupfunction sunplus_shutdownfunction sunplus_set_termiosfunction sunplus_set_ldiscfunction sunplus_config_portfunction sunplus_verify_portfunction wait_for_xmitrfunction sunplus_poll_put_charfunction sunplus_poll_get_charfunction sunplus_uart_console_putcharfunction sunplus_console_writefunction sunplus_console_setupfunction sunplus_uart_disable_unpreparefunction sunplus_uart_reset_control_assertfunction sunplus_uart_probefunction sunplus_uart_removefunction sunplus_uart_suspendfunction sunplus_uart_resumefunction sunplus_uart_initfunction sunplus_uart_exitfunction sunplus_uart_putcfunction sunplus_uart_early_writefunction sunplus_uart_early_setupmodule init sunplus_uart_init
Annotated Snippet
module_init(sunplus_uart_init);
static void __exit sunplus_uart_exit(void)
{
platform_driver_unregister(&sunplus_uart_platform_driver);
uart_unregister_driver(&sunplus_uart_driver);
}
module_exit(sunplus_uart_exit);
#ifdef CONFIG_SERIAL_EARLYCON
static void sunplus_uart_putc(struct uart_port *port, unsigned char c)
{
unsigned int val;
int ret;
ret = readl_poll_timeout_atomic(port->membase + SUP_UART_LSR, val,
(val & UART_LSR_TEMT), 1, 10000);
if (ret)
return;
writel(c, port->membase + SUP_UART_DATA);
}
static void sunplus_uart_early_write(struct console *con, const char *s, unsigned int n)
{
struct earlycon_device *dev = con->data;
uart_console_write(&dev->port, s, n, sunplus_uart_putc);
}
static int __init
sunplus_uart_early_setup(struct earlycon_device *dev, const char *opt)
{
if (!(dev->port.membase || dev->port.iobase))
return -ENODEV;
dev->con->write = sunplus_uart_early_write;
return 0;
}
OF_EARLYCON_DECLARE(sunplus_uart, "sunplus,sp7021-uart", sunplus_uart_early_setup);
#endif
MODULE_DESCRIPTION("Sunplus UART driver");
MODULE_AUTHOR("Hammer Hsieh <hammerh0314@gmail.com>");
MODULE_LICENSE("GPL v2");
Annotation
- Immediate include surface: `linux/clk.h`, `linux/console.h`, `linux/interrupt.h`, `linux/io.h`, `linux/iopoll.h`, `linux/module.h`, `linux/of.h`, `linux/of_platform.h`.
- Detected declarations: `struct sunplus_uart_port`, `function sp_uart_put_char`, `function sunplus_tx_buf_not_full`, `function sunplus_tx_empty`, `function sunplus_set_mctrl`, `function sunplus_get_mctrl`, `function sunplus_stop_tx`, `function sunplus_start_tx`, `function sunplus_stop_rx`, `function sunplus_break_ctl`.
- Atlas domain: Driver Families / drivers/tty.
- Implementation status: integration implementation candidate.
- 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.