Automatic merge of /spare/repo/netdev-2.6 branch viro
[powerpc.git] / drivers / serial / 8250.c
index 201c3b9..30e8beb 100644 (file)
@@ -51,7 +51,7 @@
  *   share_irqs - whether we pass SA_SHIRQ to request_irq().  This option
  *                is unsafe when used on edge-triggered interrupts.
  */
-unsigned int share_irqs = SERIAL8250_SHARE_IRQS;
+static unsigned int share_irqs = SERIAL8250_SHARE_IRQS;
 
 /*
  * Debugging.
@@ -682,8 +682,6 @@ static void autoconfig_16550a(struct uart_8250_port *up)
         * from EXCR1. Switch back to bank 0, change it in MCR. Then
         * switch back to bank 2, read it from EXCR1 again and check
         * it's changed. If so, set baud_base in EXCR2 to 921600. -- dwmw2
-        * On PowerPC we don't want to change baud_base, as we have
-        * a number of different divisors.  -- Tom Rini
         */
        serial_outp(up, UART_LCR, 0);
        status1 = serial_in(up, UART_MCR);
@@ -699,16 +697,25 @@ static void autoconfig_16550a(struct uart_8250_port *up)
                serial_outp(up, UART_MCR, status1);
 
                if ((status2 ^ status1) & UART_MCR_LOOP) {
-#ifndef CONFIG_PPC
+                       unsigned short quot;
+
                        serial_outp(up, UART_LCR, 0xE0);
+
+                       quot = serial_inp(up, UART_DLM) << 8;
+                       quot += serial_inp(up, UART_DLL);
+                       quot <<= 3;
+
                        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_DLL, quot & 0xff);
+                       serial_outp(up, UART_DLM, quot >> 8);
+
                        serial_outp(up, UART_LCR, 0);
-                       up->port.uartclk = 921600*16;
-#endif
 
+                       up->port.uartclk = 921600*16;
                        up->port.type = PORT_NS16550A;
                        up->capabilities |= UART_NATSEMI;
                        return;
@@ -1065,8 +1072,10 @@ receive_chars(struct uart_8250_port *up, int *status, struct pt_regs *regs)
                                tty_flip_buffer_push(tty);
                                spin_lock(&up->port.lock);
                        }
-                       /* If this failed then we will throw away the
-                          bytes but must do so to clear interrupts */
+                       /*
+                        * If this failed then we will throw away the
+                        * bytes but must do so to clear interrupts
+                        */
                }
                ch = serial_inp(up, UART_RX);
                flag = TTY_NORMAL;
@@ -1106,7 +1115,7 @@ receive_chars(struct uart_8250_port *up, int *status, struct pt_regs *regs)
                                up->port.icount.overrun++;
 
                        /*
-                        * Mask off conditions which should be ingored.
+                        * Mask off conditions which should be ignored.
                         */
                        lsr &= up->port.read_status_mask;
 
@@ -1120,18 +1129,9 @@ receive_chars(struct uart_8250_port *up, int *status, struct pt_regs *regs)
                }
                if (uart_handle_sysrq_char(&up->port, ch, regs))
                        goto ignore_char;
-               if ((lsr & up->port.ignore_status_mask) == 0) {
-                       tty_insert_flip_char(tty, ch, flag);
-               }
-               if ((lsr & UART_LSR_OE) &&
-                   tty->flip.count < TTY_FLIPBUF_SIZE) {
-                       /*
-                        * Overrun is special, since it's reported
-                        * immediately, and doesn't affect the current
-                        * character.
-                        */
-                       tty_insert_flip_char(tty, 0, TTY_OVERRUN);
-               }
+
+               uart_insert_char(&up->port, lsr, UART_LSR_OE, ch, flag);
+
        ignore_char:
                lsr = serial_inp(up, UART_LSR);
        } while ((lsr & UART_LSR_DR) && (max_count-- > 0));
@@ -2570,6 +2570,9 @@ MODULE_ALIAS_CHARDEV_MAJOR(TTY_MAJOR);
  *     If this fails an error is returned.
  *
  *     On success the port is ready to use and the line number is returned.
+ *
+ *     Note: this function is deprecated - use serial8250_register_port
+ *     instead.
  */
 int register_serial(struct serial_struct *req)
 {
@@ -2624,6 +2627,9 @@ EXPORT_SYMBOL(register_serial);
  *
  *     Remove one serial port.  This may not be called from interrupt
  *     context.  We hand the port back to our local PM control.
+ *
+ *     Note: this function is deprecated - use serial8250_unregister_port
+ *     instead.
  */
 void unregister_serial(int line)
 {