drivers/tty/serial/8250/8250_rsa.c

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

File Facts

System
Linux kernel
Corpus path
drivers/tty/serial/8250/8250_rsa.c
Extension
.c
Size
5248 bytes
Lines
212
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.

Dependency Surface

Detected Declarations

Annotated Snippet

if (probe_rsa[i] == up->port.iobase) {
				if (rsa8250_request_resource(up) == 0)
					up->probe |= UART_PROBE_RSA;
				break;
			}
		}
	}

	core_port_base_ops->config_port(port, flags);

	if (port->type != PORT_RSA && up->probe & UART_PROBE_RSA)
		rsa8250_release_resource(up);
}

static int univ8250_request_port(struct uart_port *port)
{
	struct uart_8250_port *up = up_to_u8250p(port);
	int ret;

	ret = core_port_base_ops->request_port(port);
	if (ret == 0 && port->type == PORT_RSA) {
		ret = rsa8250_request_resource(up);
		if (ret < 0)
			core_port_base_ops->release_port(port);
	}

	return ret;
}

static void univ8250_release_port(struct uart_port *port)
{
	struct uart_8250_port *up = up_to_u8250p(port);

	if (port->type == PORT_RSA)
		rsa8250_release_resource(up);
	core_port_base_ops->release_port(port);
}

/*
 * It is not allowed to directly reference any symbols from 8250.ko here as
 * that would result in a dependency loop between the 8250.ko and
 * 8250_base.ko modules. This function is called from 8250.ko and is used to
 * break the symbolic dependency cycle. Anything that is needed from 8250.ko
 * has to be passed as pointers to this function which then can adjust those
 * variables on 8250.ko side or store them locally as needed.
 */
void univ8250_rsa_support(struct uart_ops *ops, const struct uart_ops *core_ops)
{
	core_port_base_ops = core_ops;
	ops->config_port  = univ8250_config_port;
	ops->request_port = univ8250_request_port;
	ops->release_port = univ8250_release_port;
}
EXPORT_SYMBOL_FOR_MODULES(univ8250_rsa_support, "8250");

module_param_hw_array(probe_rsa, ulong, ioport, &probe_rsa_count, 0444);
MODULE_PARM_DESC(probe_rsa, "Probe I/O ports for RSA");

/*
 * Attempts to turn on the RSA FIFO.  Returns zero on failure.
 * We set the port uart clock rate if we succeed.
 */
static int __rsa_enable(struct uart_8250_port *up)
{
	unsigned char mode;
	int result;

	mode = serial_in(up, UART_RSA_MSR);
	result = mode & UART_RSA_MSR_FIFO;

	if (!result) {
		serial_out(up, UART_RSA_MSR, mode | UART_RSA_MSR_FIFO);
		mode = serial_in(up, UART_RSA_MSR);
		result = mode & UART_RSA_MSR_FIFO;
	}

	if (result)
		up->port.uartclk = SERIAL_RSA_BAUD_BASE * 16;

	return result;
}

/*
 * If this is an RSA port, see if we can kick it up to the higher speed clock.
 */
void rsa_enable(struct uart_8250_port *up)
{
	if (up->port.type != PORT_RSA)
		return;

Annotation

Implementation Notes