diff options
author | Sonic Zhang <sonic.zhang@analog.com> | 2008-10-13 05:33:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 12:51:38 -0400 |
commit | ab2375f2fe256358a982e357d298801cf1adbd00 (patch) | |
tree | f64dc27aa9756dd951da6a9453db7a75f437d083 | |
parent | b3ef5aba64aed5be0fccca3ff39c8f2282111ce5 (diff) |
Blackfin Serial Driver: Fix bug - request UART2/3 peripheral mapped interrupts in PIO mode
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/blackfin/kernel/bfin_dma_5xx.c | 13 | ||||
-rw-r--r-- | drivers/serial/bfin_5xx.c | 50 |
2 files changed, 56 insertions, 7 deletions
diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c index 93229b3d6e3e..339293d677cc 100644 --- a/arch/blackfin/kernel/bfin_dma_5xx.c +++ b/arch/blackfin/kernel/bfin_dma_5xx.c | |||
@@ -117,15 +117,14 @@ int request_dma(unsigned int channel, char *device_id) | |||
117 | 117 | ||
118 | #ifdef CONFIG_BF54x | 118 | #ifdef CONFIG_BF54x |
119 | if (channel >= CH_UART2_RX && channel <= CH_UART3_TX) { | 119 | if (channel >= CH_UART2_RX && channel <= CH_UART3_TX) { |
120 | if (strncmp(device_id, "BFIN_UART", 9) == 0) { | 120 | unsigned int per_map; |
121 | dma_ch[channel].regs->peripheral_map &= 0x0FFF; | 121 | per_map = dma_ch[channel].regs->peripheral_map & 0xFFF; |
122 | dma_ch[channel].regs->peripheral_map |= | 122 | if (strncmp(device_id, "BFIN_UART", 9) == 0) |
123 | dma_ch[channel].regs->peripheral_map = per_map | | ||
123 | ((channel - CH_UART2_RX + 0xC)<<12); | 124 | ((channel - CH_UART2_RX + 0xC)<<12); |
124 | } else { | 125 | else |
125 | dma_ch[channel].regs->peripheral_map &= 0x0FFF; | 126 | dma_ch[channel].regs->peripheral_map = per_map | |
126 | dma_ch[channel].regs->peripheral_map |= | ||
127 | ((channel - CH_UART2_RX + 0x6)<<12); | 127 | ((channel - CH_UART2_RX + 0x6)<<12); |
128 | } | ||
129 | } | 128 | } |
130 | #endif | 129 | #endif |
131 | 130 | ||
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c index a5cf0e70b3f6..569f0e2476c6 100644 --- a/drivers/serial/bfin_5xx.c +++ b/drivers/serial/bfin_5xx.c | |||
@@ -649,6 +649,42 @@ static int bfin_serial_startup(struct uart_port *port) | |||
649 | free_irq(uart->port.irq, uart); | 649 | free_irq(uart->port.irq, uart); |
650 | return -EBUSY; | 650 | return -EBUSY; |
651 | } | 651 | } |
652 | |||
653 | # ifdef CONFIG_BF54x | ||
654 | { | ||
655 | unsigned uart_dma_ch_rx, uart_dma_ch_tx; | ||
656 | |||
657 | switch (uart->port.irq) { | ||
658 | case IRQ_UART3_RX: | ||
659 | uart_dma_ch_rx = CH_UART3_RX; | ||
660 | uart_dma_ch_tx = CH_UART3_TX; | ||
661 | break; | ||
662 | case IRQ_UART2_RX: | ||
663 | uart_dma_ch_rx = CH_UART2_RX; | ||
664 | uart_dma_ch_tx = CH_UART2_TX; | ||
665 | break; | ||
666 | default: | ||
667 | uart_dma_ch_rx = uart_dma_ch_tx = 0; | ||
668 | break; | ||
669 | }; | ||
670 | |||
671 | if (uart_dma_ch_rx && | ||
672 | request_dma(uart_dma_ch_rx, "BFIN_UART_RX") < 0) { | ||
673 | printk(KERN_NOTICE"Fail to attach UART interrupt\n"); | ||
674 | free_irq(uart->port.irq, uart); | ||
675 | free_irq(uart->port.irq + 1, uart); | ||
676 | return -EBUSY; | ||
677 | } | ||
678 | if (uart_dma_ch_tx && | ||
679 | request_dma(uart_dma_ch_tx, "BFIN_UART_TX") < 0) { | ||
680 | printk(KERN_NOTICE "Fail to attach UART interrupt\n"); | ||
681 | free_dma(uart_dma_ch_rx); | ||
682 | free_irq(uart->port.irq, uart); | ||
683 | free_irq(uart->port.irq + 1, uart); | ||
684 | return -EBUSY; | ||
685 | } | ||
686 | } | ||
687 | # endif | ||
652 | #endif | 688 | #endif |
653 | UART_SET_IER(uart, ERBFI); | 689 | UART_SET_IER(uart, ERBFI); |
654 | return 0; | 690 | return 0; |
@@ -666,6 +702,20 @@ static void bfin_serial_shutdown(struct uart_port *port) | |||
666 | del_timer(&(uart->rx_dma_timer)); | 702 | del_timer(&(uart->rx_dma_timer)); |
667 | dma_free_coherent(NULL, PAGE_SIZE, uart->rx_dma_buf.buf, 0); | 703 | dma_free_coherent(NULL, PAGE_SIZE, uart->rx_dma_buf.buf, 0); |
668 | #else | 704 | #else |
705 | #ifdef CONFIG_BF54x | ||
706 | switch (uart->port.irq) { | ||
707 | case IRQ_UART3_RX: | ||
708 | free_dma(CH_UART3_RX); | ||
709 | free_dma(CH_UART3_TX); | ||
710 | break; | ||
711 | case IRQ_UART2_RX: | ||
712 | free_dma(CH_UART2_RX); | ||
713 | free_dma(CH_UART2_TX); | ||
714 | break; | ||
715 | default: | ||
716 | break; | ||
717 | }; | ||
718 | #endif | ||
669 | #ifdef CONFIG_KGDB_UART | 719 | #ifdef CONFIG_KGDB_UART |
670 | if (uart->port.line != CONFIG_KGDB_UART_PORT) | 720 | if (uart->port.line != CONFIG_KGDB_UART_PORT) |
671 | #endif | 721 | #endif |