Modifies serial_init to get base baud rate from the rs_table entry instead of BAUD_BASE. Will default back to BAUD_BASE if base_baud is not set.
This patch eliminates duplication between the SERIAL_PORT_DFNS macro and BAUD_BASE. Without the patch, if a port set the baud rate in SERIAL_PORT_DFNS, but did not update BASE_BAUD, the BASE_BAUD value would still be used. Rather; serial_init() should look first in SERIAL_PORT_DFNS and use BASE_BAUD as a backup. Signed-off-by: Grant Likely <grant.likely at gdcanada.com> --- arch/ppc/boot/common/ns16550.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) 8ef971164affa27492e0f4abe73baf9b438575db diff --git a/arch/ppc/boot/common/ns16550.c b/arch/ppc/boot/common/ns16550.c --- a/arch/ppc/boot/common/ns16550.c +++ b/arch/ppc/boot/common/ns16550.c @@ -25,6 +25,7 @@ unsigned long serial_init(int chan, void { |------unsigned long com_port; |------unsigned char lcr, dlm; +|------unsigned long baud_base; |------/* We need to find out which type io we're expecting. If it's |------ * 'SERIAL_IO_PORT', we get an offset from the isa_io_base. @@ -43,6 +44,12 @@ unsigned long serial_init(int chan, void |------/* How far apart the registers are. */ |------shift = rs_table[chan].iomem_reg_shift; +|------baud_base = rs_table[chan].baud_base; +#if defined(BASE_BAUD) +|------if (!baud_base) +|------|-------baud_base = BASE_BAUD; +#endif + |------ |------/* save the LCR */ |------lcr = inb(com_port + (UART_LCR << shift)); @@ -62,9 +69,9 @@ unsigned long serial_init(int chan, void |------else { |------|-------/* Input clock. */ |------|-------outb(com_port + (UART_DLL << shift), -|------|------- (BASE_BAUD / SERIAL_BAUD) & 0xFF); +|------|------- (baud_base / SERIAL_BAUD) & 0xFF); |------|-------outb(com_port + (UART_DLM << shift), -|------|------- (BASE_BAUD / SERIAL_BAUD) >> 8); +|------|------- (baud_base / SERIAL_BAUD) >> 8); |------|-------/* 8 data, 1 stop, no parity */ |------|-------outb(com_port + (UART_LCR << shift), 0x03); |------|-------/* RTS/DTR */