drivers/tty/serial/8250/8250_dw.c
Source file repositories/reference/linux-study-clean/drivers/tty/serial/8250/8250_dw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/tty/serial/8250/8250_dw.c- Extension
.c- Size
- 27207 bytes
- Lines
- 1017
- 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.
- 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/bitfield.hlinux/bits.hlinux/cleanup.hlinux/clk.hlinux/delay.hlinux/device.hlinux/io.hlinux/lockdep.hlinux/mod_devicetable.hlinux/module.hlinux/notifier.hlinux/platform_device.hlinux/pm_runtime.hlinux/property.hlinux/reset.hlinux/slab.hlinux/workqueue.hasm/byteorder.hlinux/serial_8250.hlinux/serial_reg.h8250_dwlib.h
Detected Declarations
struct dw8250_platform_datastruct dw8250_datafunction dw8250_modify_msrfunction dw8250_idle_exitfunction dw8250_idle_enterfunction dw8250_set_divisorfunction serial_outfunction dw8250_can_skip_reg_writefunction dw8250_tx_wait_emptyfunction dw8250_serial_outfunction dw8250_serial_out38xfunction dw8250_serial_infunction dw8250_serial_inqfunction dw8250_serial_outqfunction dw8250_serial_out32function dw8250_serial_in32function dw8250_serial_out32befunction dw8250_serial_in32befunction emptyfunction dw8250_handle_irqfunction dw8250_clk_work_cbfunction dw8250_clk_notifier_cbfunction clk_set_ratefunction dw8250_do_pmfunction dw8250_set_termiosfunction dw8250_set_ldiscfunction dw8250_fallback_dma_filterfunction dw8250_idma_filterfunction dw8250_setup_dma_filterfunction dw8250_rzn1_get_dmacr_burstfunction dw8250_prepare_tx_dmafunction dw8250_prepare_rx_dmafunction dw8250_quirksfunction dw8250_reset_control_assertfunction dw8250_shutdownfunction dw8250_probefunction dw8250_removefunction dw8250_suspendfunction dw8250_resumefunction dw8250_runtime_suspendfunction dw8250_runtime_resume
Annotated Snippet
struct dw8250_platform_data {
u8 usr_reg;
u32 cpr_value;
unsigned int quirks;
};
struct dw8250_data {
struct dw8250_port_data data;
const struct dw8250_platform_data *pdata;
u32 msr_mask_on;
u32 msr_mask_off;
struct clk *clk;
struct clk *pclk;
struct notifier_block clk_notifier;
struct work_struct clk_work;
struct reset_control *rst;
unsigned int skip_autocfg:1;
unsigned int uart_16550_compatible:1;
unsigned int in_idle:1;
u8 no_int_count;
};
static inline struct dw8250_data *to_dw8250_data(struct dw8250_port_data *data)
{
return container_of(data, struct dw8250_data, data);
}
static inline struct dw8250_data *clk_to_dw8250_data(struct notifier_block *nb)
{
return container_of(nb, struct dw8250_data, clk_notifier);
}
static inline struct dw8250_data *work_to_dw8250_data(struct work_struct *work)
{
return container_of(work, struct dw8250_data, clk_work);
}
static inline u32 dw8250_modify_msr(struct uart_port *p, unsigned int offset, u32 value)
{
struct dw8250_data *d = to_dw8250_data(p->private_data);
/* Override any modem control signals if needed */
if (offset == UART_MSR) {
value |= d->msr_mask_on;
value &= ~d->msr_mask_off;
}
return value;
}
static void dw8250_idle_exit(struct uart_port *p)
{
struct dw8250_data *d = to_dw8250_data(p->private_data);
struct uart_8250_port *up = up_to_u8250p(p);
if (d->uart_16550_compatible)
return;
if (up->capabilities & UART_CAP_FIFO)
serial_port_out(p, UART_FCR, up->fcr);
serial_port_out(p, UART_MCR, up->mcr);
serial_port_out(p, UART_IER, up->ier);
/* DMA Rx is restarted by IRQ handler as needed. */
if (up->dma)
serial8250_tx_dma_resume(up);
d->in_idle = 0;
}
/*
* Ensure BUSY is not asserted. If DW UART is configured with
* !uart_16550_compatible, the writes to LCR, DLL, and DLH fail while
* BUSY is asserted.
*
* Context: port's lock must be held
*/
static int dw8250_idle_enter(struct uart_port *p)
{
struct dw8250_data *d = to_dw8250_data(p->private_data);
unsigned int usr_reg = d->pdata ? d->pdata->usr_reg : DW_UART_USR;
struct uart_8250_port *up = up_to_u8250p(p);
int retries;
u32 lsr;
lockdep_assert_held_once(&p->lock);
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bits.h`, `linux/cleanup.h`, `linux/clk.h`, `linux/delay.h`, `linux/device.h`, `linux/io.h`, `linux/lockdep.h`.
- Detected declarations: `struct dw8250_platform_data`, `struct dw8250_data`, `function dw8250_modify_msr`, `function dw8250_idle_exit`, `function dw8250_idle_enter`, `function dw8250_set_divisor`, `function serial_out`, `function dw8250_can_skip_reg_write`, `function dw8250_tx_wait_empty`, `function dw8250_serial_out`.
- Atlas domain: Driver Families / drivers/tty.
- Implementation status: source 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.