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.

Dependency Surface

Detected Declarations

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

Implementation Notes