]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/serial/bfin_5xx.c
wan/farsync: copy_from_user() to iomem is wrong
[linux-2.6-omap-h63xx.git] / drivers / serial / bfin_5xx.c
index 5039e2675abc70467ab52ff4847b51b760aa048d..ac2a3ef28d55435d3673a8909e01ee27c77ebd82 100644 (file)
@@ -86,10 +86,8 @@ static void bfin_serial_stop_tx(struct uart_port *port)
 {
        struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
 
-#ifdef CONFIG_BF54x
        while (!(UART_GET_LSR(uart) & TEMT))
                continue;
-#endif
 
 #ifdef CONFIG_SERIAL_BFIN_DMA
        disable_dma(uart->tx_dma_channel);
@@ -128,8 +126,8 @@ static void bfin_serial_start_tx(struct uart_port *port)
        ier = UART_GET_IER(uart);
        ier |= ETBEI;
        UART_PUT_IER(uart, ier);
-       bfin_serial_tx_chars(uart);
 #endif
+       bfin_serial_tx_chars(uart);
 #endif
 }
 
@@ -139,18 +137,21 @@ static void bfin_serial_start_tx(struct uart_port *port)
 static void bfin_serial_stop_rx(struct uart_port *port)
 {
        struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
+#ifdef CONFIG_KGDB_UART
+       if (uart->port.line != CONFIG_KGDB_UART_PORT) {
+#endif
 #ifdef CONFIG_BF54x
        UART_CLEAR_IER(uart, ERBFI);
 #else
        unsigned short ier;
 
        ier = UART_GET_IER(uart);
-#ifdef CONFIG_KGDB_UART
-       if (uart->port.line != CONFIG_KGDB_UART_PORT)
-#endif
        ier &= ~ERBFI;
        UART_PUT_IER(uart, ier);
 #endif
+#ifdef CONFIG_KGDB_UART
+       }
+#endif
 }
 
 /*
@@ -175,8 +176,11 @@ void kgdb_put_debug_char(int chr)
        while (!(UART_GET_LSR(uart) & THRE)) {
                SSYNC();
        }
+
+#ifndef CONFIG_BF54x
        UART_PUT_LCR(uart, UART_GET_LCR(uart)&(~DLAB));
        SSYNC();
+#endif
        UART_PUT_CHAR(uart, (unsigned char)chr);
        SSYNC();
 }
@@ -194,8 +198,10 @@ int kgdb_get_debug_char(void)
        while(!(UART_GET_LSR(uart) & DR)) {
                SSYNC();
        }
+#ifndef CONFIG_BF54x
        UART_PUT_LCR(uart, UART_GET_LCR(uart)&(~DLAB));
        SSYNC();
+#endif
        chr = UART_GET_CHAR(uart);
        SSYNC();
 
@@ -225,12 +231,10 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
 {
        struct tty_struct *tty = uart->port.info->tty;
        unsigned int status, ch, flg;
+       static int in_break = 0;
 #ifdef CONFIG_KGDB_UART
        struct pt_regs *regs = get_irq_regs();
 #endif
-#ifdef BF533_FAMILY
-       static int in_break = 0;
-#endif
 
        status = UART_GET_LSR(uart);
        ch = UART_GET_CHAR(uart);
@@ -256,29 +260,30 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
                }
        }
 #endif
-#ifdef BF533_FAMILY
-       /* The BF533 family of processors have a nice misbehavior where
-        * they continuously generate characters for a "single" break.
-        * We have to basically ignore this flood until the "next" valid
-        * character comes across.  All other Blackfin families operate
-        * properly though.
-        */
-       if (in_break) {
-               if (ch != 0) {
-                       in_break = 0;
-                       ch = UART_GET_CHAR(uart);
-                       if (bfin_revid() < 5)
+
+       if (ANOMALY_05000230) {
+               /* The BF533 family of processors have a nice misbehavior where
+                * they continuously generate characters for a "single" break.
+                * We have to basically ignore this flood until the "next" valid
+                * character comes across.  All other Blackfin families operate
+                * properly though.
+                * Note: While Anomaly 05000230 does not directly address this,
+                *       the changes that went in for it also fixed this issue.
+                */
+               if (in_break) {
+                       if (ch != 0) {
+                               in_break = 0;
+                               ch = UART_GET_CHAR(uart);
+                               if (bfin_revid() < 5)
+                                       return;
+                       } else
                                return;
-               } else
-                       return;
+               }
        }
-#endif
 
        if (status & BI) {
-#ifdef BF533_FAMILY
-               in_break = 1;
-#endif
+               if (ANOMALY_05000230)
+                       in_break = 1;
                uart->port.icount.brk++;
                if (uart_handle_break(&uart->port))
                        goto ignore_char;
@@ -437,7 +442,8 @@ static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart)
                set_bfin_dma_config(DIR_READ, DMA_FLOW_STOP,
                        INTR_ON_BUF,
                        DIMENSION_LINEAR,
-                       DATA_SIZE_8));
+                       DATA_SIZE_8,
+                       DMA_SYNC_RESTART));
        set_dma_start_addr(uart->tx_dma_channel, (unsigned long)(xmit->buf+xmit->tail));
        set_dma_x_count(uart->tx_dma_channel, uart->tx_count);
        set_dma_x_modify(uart->tx_dma_channel, 1);
@@ -684,7 +690,8 @@ static int bfin_serial_startup(struct uart_port *port)
        set_dma_config(uart->rx_dma_channel,
                set_bfin_dma_config(DIR_WRITE, DMA_FLOW_AUTO,
                                INTR_ON_ROW, DIMENSION_2D,
-                               DATA_SIZE_8));
+                               DATA_SIZE_8,
+                               DMA_SYNC_RESTART));
        set_dma_x_count(uart->rx_dma_channel, DMA_RX_XCOUNT);
        set_dma_x_modify(uart->rx_dma_channel, 1);
        set_dma_y_count(uart->rx_dma_channel, DMA_RX_YCOUNT);
@@ -697,17 +704,19 @@ static int bfin_serial_startup(struct uart_port *port)
        uart->rx_dma_timer.expires = jiffies + DMA_RX_FLUSH_JIFFIES;
        add_timer(&(uart->rx_dma_timer));
 #else
+       if (request_irq(uart->port.irq, bfin_serial_rx_int, IRQF_DISABLED,
+            "BFIN_UART_RX", uart)) {
 # ifdef        CONFIG_KGDB_UART
-       if (uart->port.line != CONFIG_KGDB_UART_PORT && request_irq
-# else
-       if (request_irq
+               if (uart->port.line != CONFIG_KGDB_UART_PORT) {
 # endif
-           (uart->port.irq, bfin_serial_rx_int, IRQF_DISABLED,
-            "BFIN_UART_RX", uart)) {
                printk(KERN_NOTICE "Unable to attach BlackFin UART RX interrupt\n");
                return -EBUSY;
+# ifdef        CONFIG_KGDB_UART
+               }
+# endif
        }
 
+
        if (request_irq
            (uart->port.irq+1, bfin_serial_tx_int, IRQF_DISABLED,
             "BFIN_UART_TX", uart)) {
@@ -1154,10 +1163,6 @@ struct console __init *bfin_earlyserial_init(unsigned int port,
                port = 0;
        bfin_serial_init_ports();
        bfin_early_serial_console.index = port;
-#ifdef CONFIG_KGDB_UART
-       kgdb_entry_state = 0;
-       init_kgdb_uart();
-#endif
        uart = &bfin_serial_ports[port];
        t.c_cflag = cflag;
        t.c_iflag = 0;
@@ -1255,7 +1260,7 @@ static int __init bfin_serial_init(void)
        int ret;
 #ifdef CONFIG_KGDB_UART
        struct bfin_serial_port *uart = &bfin_serial_ports[CONFIG_KGDB_UART_PORT];
-       struct termios t;
+       struct ktermios t;
 #endif
 
        pr_info("Serial: Blackfin serial driver\n");
@@ -1272,10 +1277,14 @@ static int __init bfin_serial_init(void)
        }
 #ifdef CONFIG_KGDB_UART
        if (uart->port.cons->index != CONFIG_KGDB_UART_PORT) {
-               request_irq(uart->port.irq, bfin_serial_int,
+               request_irq(uart->port.irq, bfin_serial_rx_int,
                        IRQF_DISABLED, "BFIN_UART_RX", uart);
                pr_info("Request irq for kgdb uart port\n");
+#ifdef CONFIG_BF54x
+               UART_SET_IER(uart, ERBFI);
+#else
                UART_PUT_IER(uart, UART_GET_IER(uart) | ERBFI);
+#endif
                SSYNC();
                t.c_cflag = CS8|B57600;
                t.c_iflag = 0;