Example #1
0
static inline void _debug_uart_putc(int ch)
{
	struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE;

	while (!(serial_in_shift(&com_port->lsr, 0) & UART_LSR_THRE))
		;
	serial_out_shift(&com_port->thr, 0, ch);
}
Example #2
0
void debug_uart_init(void)
{
	struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE;
	int baud_divisor;

	/*
	 * We copy the code from above because it is already horribly messy.
	 * Trying to refactor to nicely remove the duplication doesn't seem
	 * feasible. The better fix is to move all users of this driver to
	 * driver model.
	 */
	baud_divisor = calc_divisor(com_port, CONFIG_DEBUG_UART_CLOCK,
				    CONFIG_BAUDRATE);
	serial_out_shift(&com_port->ier, CONFIG_DEBUG_UART_SHIFT,
			 CONFIG_SYS_NS16550_IER);
	serial_out_shift(&com_port->mcr, CONFIG_DEBUG_UART_SHIFT, UART_MCRVAL);
	serial_out_shift(&com_port->fcr, CONFIG_DEBUG_UART_SHIFT, UART_FCRVAL);

	serial_out_shift(&com_port->lcr, CONFIG_DEBUG_UART_SHIFT,
			 UART_LCR_BKSE | UART_LCRVAL);
	serial_out_shift(&com_port->dll, CONFIG_DEBUG_UART_SHIFT,
			 baud_divisor & 0xff);
	serial_out_shift(&com_port->dlm, CONFIG_DEBUG_UART_SHIFT,
			 (baud_divisor >> 8) & 0xff);
	serial_out_shift(&com_port->lcr, CONFIG_DEBUG_UART_SHIFT,
			 UART_LCRVAL);
}
Example #3
0
static void ns16550_writeb(NS16550_t port, int offset, int value)
{
	struct ns16550_platdata *plat = port->plat;
	unsigned char *addr;

	offset *= 1 << plat->reg_shift;
	addr = map_sysmem(plat->base, 0) + offset;
	/*
	 * As far as we know it doesn't make sense to support selection of
	 * these options at run-time, so use the existing CONFIG options.
	 */
	serial_out_shift(addr, plat->reg_shift, value);
}