Ejemplo n.º 1
0
/**
 * \brief Configure line control settings for UART
 */
static void a10_uart_configure(struct a10_uart *uart, u32 baud_rate, u8 data_bits,
			enum uart_parity parity, u8 stop_bits)
{
	u32 reg32;
	u16 div;

	div = (u16) uart_baudrate_divisor(baud_rate,
		uart_platform_refclk(), 16);
	/* Enable access to Divisor Latch register */
	write32(&uart->lcr, UART8250_LCR_DLAB);
	/* Set baudrate */
	write32(&uart->dlh, (div >> 8) & 0xff);
	write32(&uart->dll, div & 0xff);
	/* Set line control */
	reg32 = (data_bits - 5) & UART8250_LCR_WLS_MSK;
	switch (parity) {
	case UART_PARITY_ODD:
		reg32 |= UART8250_LCR_PEN;
		break;
	case UART_PARITY_EVEN:
		reg32 |= UART8250_LCR_PEN;
		reg32 |= UART8250_LCR_EPS;
		break;
	case UART_PARITY_NONE:	/* Fall through */
	default:
		break;
	}
	write32(&uart->lcr, reg32);
}
Ejemplo n.º 2
0
void uart_init(int idx)
{
	unsigned int div;
	div = uart_baudrate_divisor(get_uart_baudrate(),
		uart_platform_refclk(), uart_input_clock_divider());
	sifive_uart_init(uart_platform_baseptr(idx), div);
}
Ejemplo n.º 3
0
void uart_init(int idx)
{
	struct am335x_uart *uart = uart_platform_baseptr(idx);
	uint16_t div = (uint16_t) uart_baudrate_divisor(
		default_baudrate(), uart_platform_refclk(), 16);
	am335x_uart_init(uart, div);
}
Ejemplo n.º 4
0
void uart_init(int idx)
{
	unsigned int div;
	div = uart_baudrate_divisor(default_baudrate(), uart_platform_refclk(),
		uart_input_clock_divider());
	uart8250_init(uart_platform_base(idx), div);
}
Ejemplo n.º 5
0
void uart_init(int idx)
{
	void *base = uart_platform_baseptr(idx);
	if (!base)
		return;

	unsigned int div;
	div = uart_baudrate_divisor(default_baudrate(), uart_platform_refclk(), 16);
	uart8250_mem_init(base, div);
}
Ejemplo n.º 6
0
void uart_init(int idx)
{
	void *base = uart_platform_baseptr(idx);
	if (!base)
		return;

	unsigned int div;
	div = uart_baudrate_divisor(get_uart_baudrate(),
		uart_platform_refclk(), uart_input_clock_divider());
	uart8250_mem_init(base, div);
}
Ejemplo n.º 7
0
void uart_fill_lb(void *data)
{
	struct lb_serial serial;
	serial.type = LB_SERIAL_TYPE_IO_MAPPED;
	serial.baseaddr = uart_platform_base(CONFIG_UART_FOR_CONSOLE);
	serial.baud = default_baudrate();
	serial.regwidth = 1;
	serial.input_hertz = uart_platform_refclk();
	serial.uart_pci_addr = CONFIG_UART_PCI_ADDR;
	lb_add_serial(&serial, data);

	lb_add_console(LB_TAG_CONSOLE_SERIAL8250, data);
}
Ejemplo n.º 8
0
void uart_fill_lb(void *data)
{
	struct lb_serial serial;
	serial.type = LB_SERIAL_TYPE_MEMORY_MAPPED;
	serial.baseaddr = uart_platform_base(CONFIG_UART_FOR_CONSOLE);
	if (!serial.baseaddr)
		return;
	serial.baud = get_uart_baudrate();
	if (IS_ENABLED(CONFIG_DRIVERS_UART_8250MEM_32))
		serial.regwidth = sizeof(uint32_t);
	else
		serial.regwidth = sizeof(uint8_t);
	serial.input_hertz = uart_platform_refclk();
	serial.uart_pci_addr = CONFIG_UART_PCI_ADDR;
	lb_add_serial(&serial, data);

	lb_add_console(LB_TAG_CONSOLE_SERIAL8250MEM, data);
}