Re: Garbage on serial console after serial driver loads

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2005-03-28 at 20:02 +0100, Russell King wrote:
> Is this patch ok for you?

Not really; it's just a quick hack applied without any real
consideration of the problem. If we're messing up the baud rate when we
change the master clock, then just make it change the divisor
accordingly at the same time. We don't seem to store the active
parameters of the serial console anywhere useful; we can do it just by
reading back the divisor and multiplying by eight though...

Tom, does this also mean you don't need the 'ifndef ppc'?

--- linux/drivers/serial/8250.c~	2004-10-18 22:53:08.000000000 +0100
+++ linux/drivers/serial/8250.c	2005-05-03 13:54:39.394011032 +0100
@@ -567,13 +567,25 @@ static void autoconfig_16550a(struct uar
 
 		if ((status2 ^ status1) & UART_MCR_LOOP) {
 #ifndef CONFIG_PPC
+			unsigned short quot;
+
 			serial_outp(up, UART_LCR, 0xE0);
 			status1 = serial_in(up, 0x04); /* EXCR1 */
 			status1 &= ~0xB0; /* Disable LOCK, mask out PRESL[01] */
 			status1 |= 0x10;  /* 1.625 divisor for baud_base --> 921600 */
 			serial_outp(up, 0x04, status1);
-			serial_outp(up, UART_LCR, 0);
 			up->port.uartclk = 921600*16;
+			
+			/* Adjust the baud rate to match, in case we're
+			   already using the port */
+			quot = serial_inp(up, UART_DLM) << 8;
+			quot += serial_inp(up, UART_DLL);
+			quot <<= 3;
+			serial_outp(up, UART_DLL, quot & 0xff);
+			serial_outp(up, UART_DLM, quot >> 8);
+
+			serial_outp(up, UART_LCR, 0);
+
 #endif
 
 			up->port.type = PORT_NS16550A;


-- 
dwmw2

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux