Blackfin Serial Driver: disable dma rx interrupt only rather than all irqs
[pandora-kernel.git] / drivers / serial / bfin_sport_uart.c
index dd8564d..34b4ae0 100644 (file)
@@ -99,18 +99,19 @@ static void sport_stop_tx(struct uart_port *port);
 
 static inline void tx_one_byte(struct sport_uart_port *up, unsigned int value)
 {
-       pr_debug("%s value:%x\n", __FUNCTION__, value);
+       pr_debug("%s value:%x\n", __func__, value);
        /* Place a Start and Stop bit */
-       __asm__ volatile (
-               "R2 = b#01111111100;\n\t"
-               "R3 = b#10000000001;\n\t"
-               "%0 <<= 2;\n\t"
-               "%0 = %0 & R2;\n\t"
-               "%0 = %0 | R3;\n\t"
-               :"=r"(value)
-               :"0"(value)
-               :"R2", "R3");
-       pr_debug("%s value:%x\n", __FUNCTION__, value);
+       __asm__ __volatile__ (
+               "R2 = b#01111111100;"
+               "R3 = b#10000000001;"
+               "%0 <<= 2;"
+               "%0 = %0 & R2;"
+               "%0 = %0 | R3;"
+               : "=d"(value)
+               : "d"(value)
+               : "ASTAT", "R2", "R3"
+       );
+       pr_debug("%s value:%x\n", __func__, value);
 
        SPORT_PUT_TX(up, value);
 }
@@ -118,27 +119,30 @@ static inline void tx_one_byte(struct sport_uart_port *up, unsigned int value)
 static inline unsigned int rx_one_byte(struct sport_uart_port *up)
 {
        unsigned int value, extract;
+       u32 tmp_mask1, tmp_mask2, tmp_shift, tmp;
 
        value = SPORT_GET_RX32(up);
-       pr_debug("%s value:%x\n", __FUNCTION__, value);
+       pr_debug("%s value:%x\n", __func__, value);
 
        /* Extract 8 bits data */
-       __asm__ volatile (
-               "R5 = 0;\n\t"
-               "P0 = 8;\n\t"
-               "R1 = 0x1801(Z);\n\t"
-               "R3 = 0x0300(Z);\n\t"
-               "R4 = 0;\n\t"
-               "LSETUP(loop_s, loop_e) LC0 = P0;\nloop_s:\t"
-               "R2 = extract(%1, R1.L)(Z);\n\t"
-               "R2 <<= R4;\n\t"
-               "R5 = R5 | R2;\n\t"
-               "R1 = R1 - R3;\nloop_e:\t"
-               "R4 += 1;\n\t"
-               "%0 = R5;\n\t"
-               :"=r"(extract)
-               :"r"(value)
-               :"P0", "R1", "R2","R3","R4", "R5");
+       __asm__ __volatile__ (
+               "%[extr] = 0;"
+               "%[mask1] = 0x1801(Z);"
+               "%[mask2] = 0x0300(Z);"
+               "%[shift] = 0;"
+               "LSETUP(.Lloop_s, .Lloop_e) LC0 = %[lc];"
+               ".Lloop_s:"
+               "%[tmp] = extract(%[val], %[mask1].L)(Z);"
+               "%[tmp] <<= %[shift];"
+               "%[extr] = %[extr] | %[tmp];"
+               "%[mask1] = %[mask1] - %[mask2];"
+               ".Lloop_e:"
+               "%[shift] += 1;"
+               : [val]"=d"(value), [extr]"=d"(extract), [shift]"=d"(tmp_shift), [tmp]"=d"(tmp),
+                 [mask1]"=d"(tmp_mask1), [mask2]"=d"(tmp_mask2)
+               : "d"(value), [lc]"a"(8)
+               : "ASTAT", "LB0", "LC0", "LT0"
+       );
 
        pr_debug("      extract:%x\n", extract);
        return extract;
@@ -149,14 +153,14 @@ static int sport_uart_setup(struct sport_uart_port *up, int sclk, int baud_rate)
        int tclkdiv, tfsdiv, rclkdiv;
 
        /* Set TCR1 and TCR2 */
-       SPORT_PUT_TCR1(up, (LTFS | ITFS | TFSR | TLSBIT | ITCLK));
+       SPORT_PUT_TCR1(up, (LATFS | ITFS | TFSR | TLSBIT | ITCLK));
        SPORT_PUT_TCR2(up, 10);
-       pr_debug("%s TCR1:%x, TCR2:%x\n", __FUNCTION__, SPORT_GET_TCR1(up), SPORT_GET_TCR2(up));
+       pr_debug("%s TCR1:%x, TCR2:%x\n", __func__, SPORT_GET_TCR1(up), SPORT_GET_TCR2(up));
 
        /* Set RCR1 and RCR2 */
        SPORT_PUT_RCR1(up, (RCKFE | LARFS | LRFS | RFSR | IRCLK));
        SPORT_PUT_RCR2(up, 28);
-       pr_debug("%s RCR1:%x, RCR2:%x\n", __FUNCTION__, SPORT_GET_RCR1(up), SPORT_GET_RCR2(up));
+       pr_debug("%s RCR1:%x, RCR2:%x\n", __func__, SPORT_GET_RCR1(up), SPORT_GET_RCR2(up));
 
        tclkdiv = sclk/(2 * baud_rate) - 1;
        tfsdiv = 12;
@@ -166,7 +170,7 @@ static int sport_uart_setup(struct sport_uart_port *up, int sclk, int baud_rate)
        SPORT_PUT_RCLKDIV(up, rclkdiv);
        SSYNC();
        pr_debug("%s sclk:%d, baud_rate:%d, tclkdiv:%d, tfsdiv:%d, rclkdiv:%d\n",
-                       __FUNCTION__, sclk, baud_rate, tclkdiv, tfsdiv, rclkdiv);
+                       __func__, sclk, baud_rate, tclkdiv, tfsdiv, rclkdiv);
 
        return 0;
 }
@@ -231,7 +235,7 @@ static int sport_startup(struct uart_port *port)
        char buffer[20];
        int retval;
 
-       pr_debug("%s enter\n", __FUNCTION__);
+       pr_debug("%s enter\n", __func__);
        memset(buffer, 20, '\0');
        snprintf(buffer, 20, "%s rx", up->name);
        retval = request_irq(up->rx_irq, sport_uart_rx_irq, IRQF_SAMPLE_RANDOM, buffer, up);
@@ -320,7 +324,7 @@ static unsigned int sport_tx_empty(struct uart_port *port)
        unsigned int stat;
 
        stat = SPORT_GET_STAT(up);
-       pr_debug("%s stat:%04x\n", __FUNCTION__, stat);
+       pr_debug("%s stat:%04x\n", __func__, stat);
        if (stat & TXHRE) {
                return TIOCSER_TEMT;
        } else
@@ -329,13 +333,13 @@ static unsigned int sport_tx_empty(struct uart_port *port)
 
 static unsigned int sport_get_mctrl(struct uart_port *port)
 {
-       pr_debug("%s enter\n", __FUNCTION__);
+       pr_debug("%s enter\n", __func__);
        return (TIOCM_CTS | TIOCM_CD | TIOCM_DSR);
 }
 
 static void sport_set_mctrl(struct uart_port *port, unsigned int mctrl)
 {
-       pr_debug("%s enter\n", __FUNCTION__);
+       pr_debug("%s enter\n", __func__);
 }
 
 static void sport_stop_tx(struct uart_port *port)
@@ -343,7 +347,7 @@ static void sport_stop_tx(struct uart_port *port)
        struct sport_uart_port *up = (struct sport_uart_port *)port;
        unsigned int stat;
 
-       pr_debug("%s enter\n", __FUNCTION__);
+       pr_debug("%s enter\n", __func__);
 
        stat = SPORT_GET_STAT(up);
        while(!(stat & TXHRE)) {
@@ -366,21 +370,21 @@ static void sport_start_tx(struct uart_port *port)
 {
        struct sport_uart_port *up = (struct sport_uart_port *)port;
 
-       pr_debug("%s enter\n", __FUNCTION__);
+       pr_debug("%s enter\n", __func__);
        /* Write data into SPORT FIFO before enable SPROT to transmit */
        sport_uart_tx_chars(up);
 
        /* Enable transmit, then an interrupt will generated */
        SPORT_PUT_TCR1(up, (SPORT_GET_TCR1(up) | TSPEN));
        SSYNC();
-       pr_debug("%s exit\n", __FUNCTION__);
+       pr_debug("%s exit\n", __func__);
 }
 
 static void sport_stop_rx(struct uart_port *port)
 {
        struct sport_uart_port *up = (struct sport_uart_port *)port;
 
-       pr_debug("%s enter\n", __FUNCTION__);
+       pr_debug("%s enter\n", __func__);
        /* Disable sport to stop rx */
        SPORT_PUT_RCR1(up, (SPORT_GET_RCR1(up) & ~RSPEN));
        SSYNC();
@@ -388,19 +392,19 @@ static void sport_stop_rx(struct uart_port *port)
 
 static void sport_enable_ms(struct uart_port *port)
 {
-       pr_debug("%s enter\n", __FUNCTION__);
+       pr_debug("%s enter\n", __func__);
 }
 
 static void sport_break_ctl(struct uart_port *port, int break_state)
 {
-       pr_debug("%s enter\n", __FUNCTION__);
+       pr_debug("%s enter\n", __func__);
 }
 
 static void sport_shutdown(struct uart_port *port)
 {
        struct sport_uart_port *up = (struct sport_uart_port *)port;
 
-       pr_debug("%s enter\n", __FUNCTION__);
+       pr_debug("%s enter\n", __func__);
 
        /* Disable sport */
        SPORT_PUT_TCR1(up, (SPORT_GET_TCR1(up) & ~TSPEN));
@@ -419,9 +423,9 @@ static void sport_shutdown(struct uart_port *port)
 }
 
 static void sport_set_termios(struct uart_port *port,
-               struct termios *termios, struct termios *old)
+               struct ktermios *termios, struct ktermios *old)
 {
-       pr_debug("%s enter, c_cflag:%08x\n", __FUNCTION__, termios->c_cflag);
+       pr_debug("%s enter, c_cflag:%08x\n", __func__, termios->c_cflag);
        uart_update_timeout(port, CS8 ,port->uartclk);
 }
 
@@ -429,18 +433,18 @@ static const char *sport_type(struct uart_port *port)
 {
        struct sport_uart_port *up = (struct sport_uart_port *)port;
 
-       pr_debug("%s enter\n", __FUNCTION__);
+       pr_debug("%s enter\n", __func__);
        return up->name;
 }
 
 static void sport_release_port(struct uart_port *port)
 {
-       pr_debug("%s enter\n", __FUNCTION__);
+       pr_debug("%s enter\n", __func__);
 }
 
 static int sport_request_port(struct uart_port *port)
 {
-       pr_debug("%s enter\n", __FUNCTION__);
+       pr_debug("%s enter\n", __func__);
        return 0;
 }
 
@@ -448,13 +452,13 @@ static void sport_config_port(struct uart_port *port, int flags)
 {
        struct sport_uart_port *up = (struct sport_uart_port *)port;
 
-       pr_debug("%s enter\n", __FUNCTION__);
+       pr_debug("%s enter\n", __func__);
        up->port.type = PORT_BFIN_SPORT;
 }
 
 static int sport_verify_port(struct uart_port *port, struct serial_struct *ser)
 {
-       pr_debug("%s enter\n", __FUNCTION__);
+       pr_debug("%s enter\n", __func__);
        return 0;
 }
 
@@ -527,7 +531,7 @@ static int sport_uart_suspend(struct platform_device *dev, pm_message_t state)
 {
        struct sport_uart_port *sport = platform_get_drvdata(dev);
 
-       pr_debug("%s enter\n", __FUNCTION__);
+       pr_debug("%s enter\n", __func__);
        if (sport)
                uart_suspend_port(&sport_uart_reg, &sport->port);
 
@@ -538,7 +542,7 @@ static int sport_uart_resume(struct platform_device *dev)
 {
        struct sport_uart_port *sport = platform_get_drvdata(dev);
 
-       pr_debug("%s enter\n", __FUNCTION__);
+       pr_debug("%s enter\n", __func__);
        if (sport)
                uart_resume_port(&sport_uart_reg, &sport->port);
 
@@ -547,7 +551,7 @@ static int sport_uart_resume(struct platform_device *dev)
 
 static int sport_uart_probe(struct platform_device *dev)
 {
-       pr_debug("%s enter\n", __FUNCTION__);
+       pr_debug("%s enter\n", __func__);
        sport_uart_ports[dev->id].port.dev = &dev->dev;
        uart_add_one_port(&sport_uart_reg, &sport_uart_ports[dev->id].port);
        platform_set_drvdata(dev, &sport_uart_ports[dev->id]);
@@ -559,7 +563,7 @@ static int sport_uart_remove(struct platform_device *dev)
 {
        struct sport_uart_port *sport = platform_get_drvdata(dev);
 
-       pr_debug("%s enter\n", __FUNCTION__);
+       pr_debug("%s enter\n", __func__);
        platform_set_drvdata(dev, NULL);
 
        if (sport)
@@ -582,7 +586,7 @@ static int __init sport_uart_init(void)
 {
        int ret;
 
-       pr_debug("%s enter\n", __FUNCTION__);
+       pr_debug("%s enter\n", __func__);
        ret = uart_register_driver(&sport_uart_reg);
        if (ret != 0) {
                printk(KERN_ERR "Failed to register %s:%d\n",
@@ -597,13 +601,13 @@ static int __init sport_uart_init(void)
        }
 
 
-       pr_debug("%s exit\n", __FUNCTION__);
+       pr_debug("%s exit\n", __func__);
        return ret;
 }
 
 static void __exit sport_uart_exit(void)
 {
-       pr_debug("%s enter\n", __FUNCTION__);
+       pr_debug("%s enter\n", __func__);
        platform_driver_unregister(&sport_uart_driver);
        uart_unregister_driver(&sport_uart_reg);
 }