drivers/tty/serial/8250/8250_fsl.c
Source file repositories/reference/linux-study-clean/drivers/tty/serial/8250/8250_fsl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/tty/serial/8250/8250_fsl.c- Extension
.c- Size
- 5368 bytes
- Lines
- 190
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/acpi.hlinux/serial_reg.hlinux/serial_8250.h8250.h
Detected Declarations
struct fsl8250_datafunction serial8250_default_handle_irqfunction thatfunction fsl8250_acpi_probefunction fsl8250_acpi_removeexport fsl8250_handle_irq
Annotated Snippet
struct fsl8250_data {
int line;
};
static int fsl8250_acpi_probe(struct platform_device *pdev)
{
struct fsl8250_data *data;
struct uart_8250_port port8250;
struct device *dev = &pdev->dev;
struct resource *regs;
int ret, irq;
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!regs) {
dev_err(dev, "no registers defined\n");
return -EINVAL;
}
irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;
memset(&port8250, 0, sizeof(port8250));
ret = device_property_read_u32(dev, "clock-frequency",
&port8250.port.uartclk);
if (ret)
return ret;
spin_lock_init(&port8250.port.lock);
port8250.port.mapbase = regs->start;
port8250.port.irq = irq;
port8250.port.handle_irq = fsl8250_handle_irq;
port8250.port.type = PORT_16550A;
port8250.port.flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF
| UPF_FIXED_PORT | UPF_IOREMAP
| UPF_FIXED_TYPE;
port8250.port.dev = dev;
port8250.port.mapsize = resource_size(regs);
port8250.port.iotype = UPIO_MEM;
port8250.port.irqflags = IRQF_SHARED;
port8250.port.membase = devm_ioremap(dev, port8250.port.mapbase,
port8250.port.mapsize);
if (!port8250.port.membase)
return -ENOMEM;
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;
data->line = serial8250_register_8250_port(&port8250);
if (data->line < 0)
return data->line;
platform_set_drvdata(pdev, data);
return 0;
}
static void fsl8250_acpi_remove(struct platform_device *pdev)
{
struct fsl8250_data *data = platform_get_drvdata(pdev);
serial8250_unregister_port(data->line);
}
static const struct acpi_device_id fsl_8250_acpi_id[] = {
{ "NXP0018", 0 },
{ },
};
MODULE_DEVICE_TABLE(acpi, fsl_8250_acpi_id);
static struct platform_driver fsl8250_platform_driver = {
.driver = {
.name = "fsl-16550-uart",
.acpi_match_table = ACPI_PTR(fsl_8250_acpi_id),
},
.probe = fsl8250_acpi_probe,
.remove = fsl8250_acpi_remove,
};
module_platform_driver(fsl8250_platform_driver);
#endif
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Handling of Freescale specific 8250 variants");
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/serial_reg.h`, `linux/serial_8250.h`, `8250.h`.
- Detected declarations: `struct fsl8250_data`, `function serial8250_default_handle_irq`, `function that`, `function fsl8250_acpi_probe`, `function fsl8250_acpi_remove`, `export fsl8250_handle_irq`.
- Atlas domain: Driver Families / drivers/tty.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.