Skip to content

Commit

Permalink
[PATCH] Serial: Convert 8250 revision-based bug fixes to bug bitmask
Browse files Browse the repository at this point in the history
For some 8250 port types, we used to check the type of the port, and
then determine whether the chip revision means the device is buggy.
Instead, introduce a bit array, and set the appropriate bit(s) when
we discover a buggy device.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Russell King committed Jun 23, 2005
1 parent b7c84c6 commit 4ba5e35
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
23 changes: 13 additions & 10 deletions drivers/serial/8250.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ struct uart_8250_port {
struct uart_port port;
struct timer_list timer; /* "no irq" timer */
struct list_head list; /* ports on this IRQ */
unsigned int capabilities; /* port capabilities */
unsigned short capabilities; /* port capabilities */
unsigned short bugs; /* port bugs */
unsigned int tx_loadsz; /* transmit fifo load size */
unsigned short rev;
unsigned char acr;
unsigned char ier;
unsigned char lcr;
Expand Down Expand Up @@ -560,7 +560,14 @@ static void autoconfig_has_efr(struct uart_8250_port *up)
if (id1 == 0x16 && id2 == 0xC9 &&
(id3 == 0x50 || id3 == 0x52 || id3 == 0x54)) {
up->port.type = PORT_16C950;
up->rev = rev | (id3 << 8);

/*
* Enable work around for the Oxford Semiconductor 952 rev B
* chip which causes it to seriously miscalculate baud rates
* when DLL is 0.
*/
if (id3 == 0x52 && rev == 0x01)
up->bugs |= UART_BUG_QUOT;
return;
}

Expand All @@ -577,8 +584,6 @@ static void autoconfig_has_efr(struct uart_8250_port *up)

id2 = id1 >> 8;
if (id2 == 0x10 || id2 == 0x12 || id2 == 0x14) {
if (id2 == 0x10)
up->rev = id1 & 255;
up->port.type = PORT_16850;
return;
}
Expand Down Expand Up @@ -809,6 +814,7 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
// save_flags(flags); cli();

up->capabilities = 0;
up->bugs = 0;

if (!(up->port.flags & UPF_BUGGY_UART)) {
/*
Expand Down Expand Up @@ -1677,12 +1683,9 @@ serial8250_set_termios(struct uart_port *port, struct termios *termios,
quot = serial8250_get_divisor(port, baud);

/*
* Work around a bug in the Oxford Semiconductor 952 rev B
* chip which causes it to seriously miscalculate baud rates
* when DLL is 0.
* Oxford Semi 952 rev B workaround
*/
if ((quot & 0xff) == 0 && up->port.type == PORT_16C950 &&
up->rev == 0x5201)
if (up->bugs & UART_BUG_QUOT && (quot & 0xff) == 0)
quot ++;

if (up->capabilities & UART_CAP_FIFO && up->port.fifosize > 1) {
Expand Down
2 changes: 2 additions & 0 deletions drivers/serial/8250.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ struct serial8250_config {
#define UART_CAP_AFE (1 << 11) /* MCR-based hw flow control */
#define UART_CAP_UUE (1 << 12) /* UART needs IER bit 6 set (Xscale) */

#define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */

#if defined(__i386__) && (defined(CONFIG_M386) || defined(CONFIG_M486))
#define _INLINE_ inline
#else
Expand Down

0 comments on commit 4ba5e35

Please sign in to comment.