drivers/tty/serial/8250/8250_fintek.c
Source file repositories/reference/linux-study-clean/drivers/tty/serial/8250/8250_fintek.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/tty/serial/8250/8250_fintek.c- Extension
.c- Size
- 11475 bytes
- Lines
- 485
- 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.
- 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/module.hlinux/pci.hlinux/pnp.hlinux/kernel.hlinux/serial_core.hlinux/irq.h8250.h
Detected Declarations
struct fintek_8250function sio_read_regfunction sio_write_regfunction sio_write_mask_regfunction fintek_8250_enter_keyfunction fintek_8250_exit_keyfunction fintek_8250_check_idfunction fintek_8250_get_ldn_rangefunction fintek_8250_rs485_configfunction fintek_8250_set_irq_modefunction fintek_8250_set_max_fifofunction fintek_8250_set_termiosfunction fintek_8250_set_termios_handlerfunction probe_setup_portfunction fintek_8250_set_rs485_handlerfunction fintek_8250_probe
Annotated Snippet
struct fintek_8250 {
u16 pid;
u16 base_port;
u8 index;
u8 key;
};
static u8 sio_read_reg(struct fintek_8250 *pdata, u8 reg)
{
outb(reg, pdata->base_port + ADDR_PORT);
return inb(pdata->base_port + DATA_PORT);
}
static void sio_write_reg(struct fintek_8250 *pdata, u8 reg, u8 data)
{
outb(reg, pdata->base_port + ADDR_PORT);
outb(data, pdata->base_port + DATA_PORT);
}
static void sio_write_mask_reg(struct fintek_8250 *pdata, u8 reg, u8 mask,
u8 data)
{
u8 tmp;
tmp = (sio_read_reg(pdata, reg) & ~mask) | (mask & data);
sio_write_reg(pdata, reg, tmp);
}
static int fintek_8250_enter_key(u16 base_port, u8 key)
{
if (!request_muxed_region(base_port, 2, "8250_fintek"))
return -EBUSY;
/* Force to deactivate all SuperIO in this base_port */
outb(EXIT_KEY, base_port + ADDR_PORT);
outb(key, base_port + ADDR_PORT);
outb(key, base_port + ADDR_PORT);
return 0;
}
static void fintek_8250_exit_key(u16 base_port)
{
outb(EXIT_KEY, base_port + ADDR_PORT);
release_region(base_port + ADDR_PORT, 2);
}
static int fintek_8250_check_id(struct fintek_8250 *pdata)
{
u16 chip;
if (sio_read_reg(pdata, VENDOR_ID1) != VENDOR_ID1_VAL)
return -ENODEV;
if (sio_read_reg(pdata, VENDOR_ID2) != VENDOR_ID2_VAL)
return -ENODEV;
chip = sio_read_reg(pdata, CHIP_ID1);
chip |= sio_read_reg(pdata, CHIP_ID2) << 8;
switch (chip) {
case CHIP_ID_F81865:
case CHIP_ID_F81866:
case CHIP_ID_F81966:
case CHIP_ID_F81216AD:
case CHIP_ID_F81216E:
case CHIP_ID_F81216H:
case CHIP_ID_F81214E:
case CHIP_ID_F81216:
break;
default:
return -ENODEV;
}
pdata->pid = chip;
return 0;
}
static int fintek_8250_get_ldn_range(struct fintek_8250 *pdata, int *min,
int *max)
{
switch (pdata->pid) {
case CHIP_ID_F81966:
case CHIP_ID_F81865:
case CHIP_ID_F81866:
*min = F81866_LDN_LOW;
*max = F81866_LDN_HIGH;
return 0;
Annotation
- Immediate include surface: `linux/module.h`, `linux/pci.h`, `linux/pnp.h`, `linux/kernel.h`, `linux/serial_core.h`, `linux/irq.h`, `8250.h`.
- Detected declarations: `struct fintek_8250`, `function sio_read_reg`, `function sio_write_reg`, `function sio_write_mask_reg`, `function fintek_8250_enter_key`, `function fintek_8250_exit_key`, `function fintek_8250_check_id`, `function fintek_8250_get_ldn_range`, `function fintek_8250_rs485_config`, `function fintek_8250_set_irq_mode`.
- Atlas domain: Driver Families / drivers/tty.
- Implementation status: source implementation candidate.
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.