uart_baudrate = baudrate;
/* Configure baudrate */
- set_reg(UART_REG_DIV, uart_min_clk_divisor(in_freq, baudrate));
+ if (in_freq)
+ set_reg(UART_REG_DIV, uart_min_clk_divisor(in_freq, baudrate));
/* Disable interrupts */
set_reg(UART_REG_IE, 0);
/* Enable TX */
set_reg(UART_IER_OFFSET, 0x00);
/* Enable DLAB */
set_reg(UART_LCR_OFFSET, 0x80);
- /* Set divisor low byte */
- set_reg(UART_DLL_OFFSET, bdiv & 0xff);
- /* Set divisor high byte */
- set_reg(UART_DLM_OFFSET, (bdiv >> 8) & 0xff);
+
+ if (bdiv) {
+ /* Set divisor low byte */
+ set_reg(UART_DLL_OFFSET, bdiv & 0xff);
+ /* Set divisor high byte */
+ set_reg(UART_DLM_OFFSET, (bdiv >> 8) & 0xff);
+ }
+
/* 8 bits, no parity, one stop bit */
set_reg(UART_LCR_OFFSET, 0x03);
/* Enable FIFO */