drivers/tty/serial/sh-sci-common.h

Source file repositories/reference/linux-study-clean/drivers/tty/serial/sh-sci-common.h

File Facts

System
Linux kernel
Corpus path
drivers/tty/serial/sh-sci-common.h
Extension
.h
Size
4877 bytes
Lines
185
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct plat_sci_reg {
	u8 offset;
	u8 size;
};

struct sci_port_params_bits {
	unsigned int rxtx_enable;
	unsigned int te_clear;
	unsigned int poll_sent_bits;
};

struct sci_common_regs {
	unsigned int status;
	unsigned int control;
};

/* The actual number of needed registers. This is used by sci only */
#define SCI_NR_REGS 20

struct sci_port_params {
	const struct plat_sci_reg regs[SCI_NR_REGS];
	const struct sci_common_regs *common_regs;
	const struct sci_port_params_bits *param_bits;
	unsigned int fifosize;
	unsigned int overrun_reg;
	unsigned int overrun_mask;
	unsigned int sampling_rate_mask;
	unsigned int error_mask;
	unsigned int error_clear;
};

struct sci_port_ops {
	u32 (*read_reg)(struct uart_port *port, int reg);
	void (*write_reg)(struct uart_port *port, int reg, int value);
	void (*clear_SCxSR)(struct uart_port *port, unsigned int mask);

	void (*transmit_chars)(struct uart_port *port);
	void (*receive_chars)(struct uart_port *port);

	void (*poll_put_char)(struct uart_port *port, unsigned char c);

	int (*set_rtrg)(struct uart_port *port, int rx_trig);
	int (*rtrg_enabled)(struct uart_port *port);

	void (*shutdown_complete)(struct uart_port *port);

	void (*prepare_console_write)(struct uart_port *port, u32 ctrl);
	void (*finish_console_write)(struct uart_port *port, u32 ctrl);
	void (*console_save)(struct uart_port *port);
	void (*console_restore)(struct uart_port *port);
	size_t (*suspend_regs_size)(void);
};

struct sci_of_data {
	const struct sci_port_params *params;
	const struct uart_ops *uart_ops;
	const struct sci_port_ops *ops;
	unsigned short regtype;
	unsigned short type;
};

struct sci_port {
	struct uart_port	port;

	/* Platform configuration */
	const struct sci_port_params *params;
	const struct plat_sci_port *cfg;

	unsigned int		sampling_rate_mask;
	resource_size_t		reg_size;
	struct mctrl_gpios	*gpios;

	/* Clocks */
	struct clk		*clks[SCI_NUM_CLKS];
	unsigned long		clk_rates[SCI_NUM_CLKS];

	int			irqs[SCIx_NR_IRQS];
	char			*irqstr[SCIx_NR_IRQS];

	struct dma_chan			*chan_tx;
	struct dma_chan			*chan_rx;

	struct reset_control		*rstc;
	struct sci_suspend_regs		*suspend_regs;

#ifdef CONFIG_SERIAL_SH_SCI_DMA
	struct dma_chan			*chan_tx_saved;
	struct dma_chan			*chan_rx_saved;
	dma_cookie_t			cookie_tx;
	dma_cookie_t			cookie_rx[2];

Annotation

Implementation Notes