lpc176x: Fix serial ordering of initialization

The serial device needs to be enabled before setting the DLAB bit.
This prevented UART3 from working.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2022-03-01 12:53:39 -05:00
parent 682d38f590
commit 7ce409d7a5
1 changed files with 1 additions and 1 deletions

View File

@ -75,8 +75,8 @@ void
serial_init(void)
{
// Setup baud
LPC_UARTx->LCR = (1<<7); // set DLAB bit
enable_pclock(PCLK_UARTx);
LPC_UARTx->LCR = (1<<7); // set DLAB bit
uint32_t pclk = get_pclock_frequency(PCLK_UARTx);
uint32_t div = pclk / (CONFIG_SERIAL_BAUD * 16);
LPC_UARTx->DLL = div & 0xff;