drivers/tty/serial/pch_uart.c

Source file repositories/reference/linux-study-clean/drivers/tty/serial/pch_uart.c

File Facts

System
Linux kernel
Corpus path
drivers/tty/serial/pch_uart.c
Extension
.c
Size
48033 bytes
Lines
1888
Domain
Driver Families
Bucket
drivers/tty
Inferred role
Driver Families: operation-table or driver-model contract
Status
pattern 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

static const struct file_operations port_regs_ops = {
	.owner		= THIS_MODULE,
	.open		= simple_open,
	.read		= port_show_regs,
	.llseek		= default_llseek,
};

static const struct dmi_system_id pch_uart_dmi_table[] = {
	{
		.ident = "CM-iTC",
		{
			DMI_MATCH(DMI_BOARD_NAME, "CM-iTC"),
		},
		(void *)CMITC_UARTCLK,
	},
	{
		.ident = "FRI2",
		{
			DMI_MATCH(DMI_BIOS_VERSION, "FRI2"),
		},
		(void *)FRI2_64_UARTCLK,
	},
	{
		.ident = "Fish River Island II",
		{
			DMI_MATCH(DMI_PRODUCT_NAME, "Fish River Island II"),
		},
		(void *)FRI2_48_UARTCLK,
	},
	{
		.ident = "COMe-mTT",
		{
			DMI_MATCH(DMI_BOARD_NAME, "COMe-mTT"),
		},
		(void *)NTC1_UARTCLK,
	},
	{
		.ident = "nanoETXexpress-TT",
		{
			DMI_MATCH(DMI_BOARD_NAME, "nanoETXexpress-TT"),
		},
		(void *)NTC1_UARTCLK,
	},
	{
		.ident = "MinnowBoard",
		{
			DMI_MATCH(DMI_BOARD_NAME, "MinnowBoard"),
		},
		(void *)MINNOW_UARTCLK,
	},
	{ }
};

/* Return UART clock, checking for board specific clocks. */
static unsigned int pch_uart_get_uartclk(void)
{
	const struct dmi_system_id *d;

	if (user_uartclk)
		return user_uartclk;

	d = dmi_first_match(pch_uart_dmi_table);
	if (d)
		return (unsigned long)d->driver_data;

	return DEFAULT_UARTCLK;
}

static void pch_uart_hal_enable_interrupt(struct eg20t_port *priv,
					  unsigned int flag)
{
	u8 ier = ioread8(priv->membase + UART_IER);
	ier |= flag & PCH_UART_IER_MASK;
	iowrite8(ier, priv->membase + UART_IER);
}

static void pch_uart_hal_disable_interrupt(struct eg20t_port *priv,
					   unsigned int flag)
{
	u8 ier = ioread8(priv->membase + UART_IER);
	ier &= ~(flag & PCH_UART_IER_MASK);
	iowrite8(ier, priv->membase + UART_IER);
}

static int pch_uart_hal_set_line(struct eg20t_port *priv, unsigned int baud,
				 unsigned int parity, unsigned int bits,
				 unsigned int stb)
{
	unsigned int dll, dlm, lcr;
	int div;

Annotation

Implementation Notes