Don't double the divisor on Geode UART, it runs at normal speed

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-01-18 14:00:55 +01:00
parent 01b08a0f15
commit edf9d1f7eb

View file

@ -37,7 +37,8 @@ static const grub_port_t serial_hw_io_addr[] = GRUB_MACHINE_SERIAL_PORTS;
/* Convert speed to divisor. */ /* Convert speed to divisor. */
static unsigned short static unsigned short
serial_get_divisor (unsigned int speed) serial_get_divisor (const struct grub_serial_port *port,
const struct grub_serial_config *config)
{ {
unsigned int i; unsigned int i;
@ -63,13 +64,16 @@ serial_get_divisor (unsigned int speed)
/* Set the baud rate. */ /* Set the baud rate. */
for (i = 0; i < ARRAY_SIZE (divisor_tab); i++) for (i = 0; i < ARRAY_SIZE (divisor_tab); i++)
if (divisor_tab[i].speed == speed) if (divisor_tab[i].speed == config->speed)
/* UART in Yeeloong runs twice the usual rate. */ {
/* internal UART in Yeeloong runs twice the usual rate. */
#ifdef GRUB_MACHINE_MIPS_YEELOONG #ifdef GRUB_MACHINE_MIPS_YEELOONG
return 2 * divisor_tab[i].div; if (port->port == 0xbff003f8)
#else return 2 * divisor_tab[i].div;
return divisor_tab[i].div; else
#endif #endif
return divisor_tab[i].div;
}
return 0; return 0;
} }
@ -93,7 +97,7 @@ do_real_config (struct grub_serial_port *port)
port->broken = 0; port->broken = 0;
divisor = serial_get_divisor (port->config.speed); divisor = serial_get_divisor (port, &port->config);
/* Turn off the interrupt. */ /* Turn off the interrupt. */
grub_outb (0, port->port + UART_IER); grub_outb (0, port->port + UART_IER);
@ -188,7 +192,7 @@ serial_hw_configure (struct grub_serial_port *port,
{ {
unsigned short divisor; unsigned short divisor;
divisor = serial_get_divisor (config->speed); divisor = serial_get_divisor (port, config);
if (divisor == 0) if (divisor == 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad speed"); return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad speed");