aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/blackfin/mach-bf518/include/mach/bfin_serial_5xx.h10
-rw-r--r--arch/blackfin/mach-bf527/include/mach/bfin_serial_5xx.h10
-rw-r--r--arch/blackfin/mach-bf533/include/mach/bfin_serial_5xx.h9
-rw-r--r--arch/blackfin/mach-bf537/include/mach/bfin_serial_5xx.h10
-rw-r--r--arch/blackfin/mach-bf538/include/mach/bfin_serial_5xx.h10
-rw-r--r--arch/blackfin/mach-bf548/include/mach/bfin_serial_5xx.h72
-rw-r--r--arch/blackfin/mach-bf561/include/mach/bfin_serial_5xx.h9
-rw-r--r--drivers/serial/Kconfig26
-rw-r--r--drivers/serial/bfin_5xx.c169
9 files changed, 209 insertions, 116 deletions
diff --git a/arch/blackfin/mach-bf518/include/mach/bfin_serial_5xx.h b/arch/blackfin/mach-bf518/include/mach/bfin_serial_5xx.h
index e21c1c3e4ec7..0fb2ce5d840e 100644
--- a/arch/blackfin/mach-bf518/include/mach/bfin_serial_5xx.h
+++ b/arch/blackfin/mach-bf518/include/mach/bfin_serial_5xx.h
@@ -53,9 +53,9 @@
53#define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0) 53#define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)
54#define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) 54#define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0)
55 55
56#define UART_GET_CTS(x) gpio_get_value(x->cts_pin) 56#define UART_GET_CTS(x) (!gpio_get_value(x->cts_pin))
57#define UART_SET_RTS(x) gpio_set_value(x->rts_pin, 1) 57#define UART_DISABLE_RTS(x) gpio_set_value(x->rts_pin, 1)
58#define UART_CLEAR_RTS(x) gpio_set_value(x->rts_pin, 0) 58#define UART_ENABLE_RTS(x) gpio_set_value(x->rts_pin, 0)
59#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v) 59#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v)
60#define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0) 60#define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0)
61 61
@@ -87,6 +87,7 @@
87struct bfin_serial_port { 87struct bfin_serial_port {
88 struct uart_port port; 88 struct uart_port port;
89 unsigned int old_status; 89 unsigned int old_status;
90 int status_irq;
90 unsigned int lsr; 91 unsigned int lsr;
91#ifdef CONFIG_SERIAL_BFIN_DMA 92#ifdef CONFIG_SERIAL_BFIN_DMA
92 int tx_done; 93 int tx_done;
@@ -125,6 +126,7 @@ static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart)
125struct bfin_serial_res { 126struct bfin_serial_res {
126 unsigned long uart_base_addr; 127 unsigned long uart_base_addr;
127 int uart_irq; 128 int uart_irq;
129 int uart_status_irq;
128#ifdef CONFIG_SERIAL_BFIN_DMA 130#ifdef CONFIG_SERIAL_BFIN_DMA
129 unsigned int uart_tx_dma_channel; 131 unsigned int uart_tx_dma_channel;
130 unsigned int uart_rx_dma_channel; 132 unsigned int uart_rx_dma_channel;
@@ -140,6 +142,7 @@ struct bfin_serial_res bfin_serial_resource[] = {
140 { 142 {
141 0xFFC00400, 143 0xFFC00400,
142 IRQ_UART0_RX, 144 IRQ_UART0_RX,
145 IRQ_UART0_ERROR,
143#ifdef CONFIG_SERIAL_BFIN_DMA 146#ifdef CONFIG_SERIAL_BFIN_DMA
144 CH_UART0_TX, 147 CH_UART0_TX,
145 CH_UART0_RX, 148 CH_UART0_RX,
@@ -154,6 +157,7 @@ struct bfin_serial_res bfin_serial_resource[] = {
154 { 157 {
155 0xFFC02000, 158 0xFFC02000,
156 IRQ_UART1_RX, 159 IRQ_UART1_RX,
160 IRQ_UART1_ERROR,
157#ifdef CONFIG_SERIAL_BFIN_DMA 161#ifdef CONFIG_SERIAL_BFIN_DMA
158 CH_UART1_TX, 162 CH_UART1_TX,
159 CH_UART1_RX, 163 CH_UART1_RX,
diff --git a/arch/blackfin/mach-bf527/include/mach/bfin_serial_5xx.h b/arch/blackfin/mach-bf527/include/mach/bfin_serial_5xx.h
index d2b160c14f04..a625659dd67f 100644
--- a/arch/blackfin/mach-bf527/include/mach/bfin_serial_5xx.h
+++ b/arch/blackfin/mach-bf527/include/mach/bfin_serial_5xx.h
@@ -53,9 +53,9 @@
53#define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0) 53#define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)
54#define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) 54#define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0)
55 55
56#define UART_GET_CTS(x) gpio_get_value(x->cts_pin) 56#define UART_GET_CTS(x) (!gpio_get_value(x->cts_pin))
57#define UART_SET_RTS(x) gpio_set_value(x->rts_pin, 1) 57#define UART_DISABLE_RTS(x) gpio_set_value(x->rts_pin, 1)
58#define UART_CLEAR_RTS(x) gpio_set_value(x->rts_pin, 0) 58#define UART_ENABLE_RTS(x) gpio_set_value(x->rts_pin, 0)
59#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v) 59#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v)
60#define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0) 60#define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0)
61 61
@@ -87,6 +87,7 @@
87struct bfin_serial_port { 87struct bfin_serial_port {
88 struct uart_port port; 88 struct uart_port port;
89 unsigned int old_status; 89 unsigned int old_status;
90 int status_irq;
90 unsigned int lsr; 91 unsigned int lsr;
91#ifdef CONFIG_SERIAL_BFIN_DMA 92#ifdef CONFIG_SERIAL_BFIN_DMA
92 int tx_done; 93 int tx_done;
@@ -125,6 +126,7 @@ static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart)
125struct bfin_serial_res { 126struct bfin_serial_res {
126 unsigned long uart_base_addr; 127 unsigned long uart_base_addr;
127 int uart_irq; 128 int uart_irq;
129 int uart_status_irq;
128#ifdef CONFIG_SERIAL_BFIN_DMA 130#ifdef CONFIG_SERIAL_BFIN_DMA
129 unsigned int uart_tx_dma_channel; 131 unsigned int uart_tx_dma_channel;
130 unsigned int uart_rx_dma_channel; 132 unsigned int uart_rx_dma_channel;
@@ -140,6 +142,7 @@ struct bfin_serial_res bfin_serial_resource[] = {
140 { 142 {
141 0xFFC00400, 143 0xFFC00400,
142 IRQ_UART0_RX, 144 IRQ_UART0_RX,
145 IRQ_UART0_ERROR,
143#ifdef CONFIG_SERIAL_BFIN_DMA 146#ifdef CONFIG_SERIAL_BFIN_DMA
144 CH_UART0_TX, 147 CH_UART0_TX,
145 CH_UART0_RX, 148 CH_UART0_RX,
@@ -154,6 +157,7 @@ struct bfin_serial_res bfin_serial_resource[] = {
154 { 157 {
155 0xFFC02000, 158 0xFFC02000,
156 IRQ_UART1_RX, 159 IRQ_UART1_RX,
160 IRQ_UART1_ERROR,
157#ifdef CONFIG_SERIAL_BFIN_DMA 161#ifdef CONFIG_SERIAL_BFIN_DMA
158 CH_UART1_TX, 162 CH_UART1_TX,
159 CH_UART1_RX, 163 CH_UART1_RX,
diff --git a/arch/blackfin/mach-bf533/include/mach/bfin_serial_5xx.h b/arch/blackfin/mach-bf533/include/mach/bfin_serial_5xx.h
index 70356ddf8509..a3789d7ccf8c 100644
--- a/arch/blackfin/mach-bf533/include/mach/bfin_serial_5xx.h
+++ b/arch/blackfin/mach-bf533/include/mach/bfin_serial_5xx.h
@@ -53,9 +53,9 @@
53#define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0) 53#define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)
54#define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) 54#define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0)
55 55
56#define UART_GET_CTS(x) gpio_get_value(x->cts_pin) 56#define UART_GET_CTS(x) (!gpio_get_value(x->cts_pin))
57#define UART_SET_RTS(x) gpio_set_value(x->rts_pin, 1) 57#define UART_DISABLE_RTS(x) gpio_set_value(x->rts_pin, 1)
58#define UART_CLEAR_RTS(x) gpio_set_value(x->rts_pin, 0) 58#define UART_ENABLE_RTS(x) gpio_set_value(x->rts_pin, 0)
59#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v) 59#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v)
60#define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0) 60#define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0)
61 61
@@ -74,6 +74,7 @@
74struct bfin_serial_port { 74struct bfin_serial_port {
75 struct uart_port port; 75 struct uart_port port;
76 unsigned int old_status; 76 unsigned int old_status;
77 int status_irq;
77 unsigned int lsr; 78 unsigned int lsr;
78#ifdef CONFIG_SERIAL_BFIN_DMA 79#ifdef CONFIG_SERIAL_BFIN_DMA
79 int tx_done; 80 int tx_done;
@@ -116,6 +117,7 @@ static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart)
116struct bfin_serial_res { 117struct bfin_serial_res {
117 unsigned long uart_base_addr; 118 unsigned long uart_base_addr;
118 int uart_irq; 119 int uart_irq;
120 int uart_status_irq;
119#ifdef CONFIG_SERIAL_BFIN_DMA 121#ifdef CONFIG_SERIAL_BFIN_DMA
120 unsigned int uart_tx_dma_channel; 122 unsigned int uart_tx_dma_channel;
121 unsigned int uart_rx_dma_channel; 123 unsigned int uart_rx_dma_channel;
@@ -130,6 +132,7 @@ struct bfin_serial_res bfin_serial_resource[] = {
130 { 132 {
131 0xFFC00400, 133 0xFFC00400,
132 IRQ_UART_RX, 134 IRQ_UART_RX,
135 IRQ_UART_ERROR,
133#ifdef CONFIG_SERIAL_BFIN_DMA 136#ifdef CONFIG_SERIAL_BFIN_DMA
134 CH_UART_TX, 137 CH_UART_TX,
135 CH_UART_RX, 138 CH_UART_RX,
diff --git a/arch/blackfin/mach-bf537/include/mach/bfin_serial_5xx.h b/arch/blackfin/mach-bf537/include/mach/bfin_serial_5xx.h
index d46fc4f50cf2..b86662fb9de7 100644
--- a/arch/blackfin/mach-bf537/include/mach/bfin_serial_5xx.h
+++ b/arch/blackfin/mach-bf537/include/mach/bfin_serial_5xx.h
@@ -53,9 +53,9 @@
53#define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0) 53#define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)
54#define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) 54#define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0)
55 55
56#define UART_GET_CTS(x) gpio_get_value(x->cts_pin) 56#define UART_GET_CTS(x) (!gpio_get_value(x->cts_pin))
57#define UART_SET_RTS(x) gpio_set_value(x->rts_pin, 1) 57#define UART_DISABLE_RTS(x) gpio_set_value(x->rts_pin, 1)
58#define UART_CLEAR_RTS(x) gpio_set_value(x->rts_pin, 0) 58#define UART_ENABLE_RTS(x) gpio_set_value(x->rts_pin, 0)
59#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v) 59#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v)
60#define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0) 60#define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0)
61 61
@@ -87,6 +87,7 @@
87struct bfin_serial_port { 87struct bfin_serial_port {
88 struct uart_port port; 88 struct uart_port port;
89 unsigned int old_status; 89 unsigned int old_status;
90 int status_irq;
90 unsigned int lsr; 91 unsigned int lsr;
91#ifdef CONFIG_SERIAL_BFIN_DMA 92#ifdef CONFIG_SERIAL_BFIN_DMA
92 int tx_done; 93 int tx_done;
@@ -124,6 +125,7 @@ static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart)
124struct bfin_serial_res { 125struct bfin_serial_res {
125 unsigned long uart_base_addr; 126 unsigned long uart_base_addr;
126 int uart_irq; 127 int uart_irq;
128 int uart_status_irq;
127#ifdef CONFIG_SERIAL_BFIN_DMA 129#ifdef CONFIG_SERIAL_BFIN_DMA
128 unsigned int uart_tx_dma_channel; 130 unsigned int uart_tx_dma_channel;
129 unsigned int uart_rx_dma_channel; 131 unsigned int uart_rx_dma_channel;
@@ -139,6 +141,7 @@ struct bfin_serial_res bfin_serial_resource[] = {
139 { 141 {
140 0xFFC00400, 142 0xFFC00400,
141 IRQ_UART0_RX, 143 IRQ_UART0_RX,
144 IRQ_UART0_ERROR,
142#ifdef CONFIG_SERIAL_BFIN_DMA 145#ifdef CONFIG_SERIAL_BFIN_DMA
143 CH_UART0_TX, 146 CH_UART0_TX,
144 CH_UART0_RX, 147 CH_UART0_RX,
@@ -153,6 +156,7 @@ struct bfin_serial_res bfin_serial_resource[] = {
153 { 156 {
154 0xFFC02000, 157 0xFFC02000,
155 IRQ_UART1_RX, 158 IRQ_UART1_RX,
159 IRQ_UART1_ERROR,
156#ifdef CONFIG_SERIAL_BFIN_DMA 160#ifdef CONFIG_SERIAL_BFIN_DMA
157 CH_UART1_TX, 161 CH_UART1_TX,
158 CH_UART1_RX, 162 CH_UART1_RX,
diff --git a/arch/blackfin/mach-bf538/include/mach/bfin_serial_5xx.h b/arch/blackfin/mach-bf538/include/mach/bfin_serial_5xx.h
index 3c2811ebecdd..c536551eb4b8 100644
--- a/arch/blackfin/mach-bf538/include/mach/bfin_serial_5xx.h
+++ b/arch/blackfin/mach-bf538/include/mach/bfin_serial_5xx.h
@@ -53,9 +53,9 @@
53#define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0) 53#define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)
54#define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) 54#define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0)
55 55
56#define UART_GET_CTS(x) gpio_get_value(x->cts_pin) 56#define UART_GET_CTS(x) (!gpio_get_value(x->cts_pin))
57#define UART_SET_RTS(x) gpio_set_value(x->rts_pin, 1) 57#define UART_DISABLE_RTS(x) gpio_set_value(x->rts_pin, 1)
58#define UART_CLEAR_RTS(x) gpio_set_value(x->rts_pin, 0) 58#define UART_ENABLE_RTS(x) gpio_set_value(x->rts_pin, 0)
59#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v) 59#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v)
60#define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0) 60#define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0)
61 61
@@ -87,6 +87,7 @@
87struct bfin_serial_port { 87struct bfin_serial_port {
88 struct uart_port port; 88 struct uart_port port;
89 unsigned int old_status; 89 unsigned int old_status;
90 int status_irq;
90 unsigned int lsr; 91 unsigned int lsr;
91#ifdef CONFIG_SERIAL_BFIN_DMA 92#ifdef CONFIG_SERIAL_BFIN_DMA
92 int tx_done; 93 int tx_done;
@@ -125,6 +126,7 @@ static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart)
125struct bfin_serial_res { 126struct bfin_serial_res {
126 unsigned long uart_base_addr; 127 unsigned long uart_base_addr;
127 int uart_irq; 128 int uart_irq;
129 int uart_status_irq;
128#ifdef CONFIG_SERIAL_BFIN_DMA 130#ifdef CONFIG_SERIAL_BFIN_DMA
129 unsigned int uart_tx_dma_channel; 131 unsigned int uart_tx_dma_channel;
130 unsigned int uart_rx_dma_channel; 132 unsigned int uart_rx_dma_channel;
@@ -140,6 +142,7 @@ struct bfin_serial_res bfin_serial_resource[] = {
140 { 142 {
141 0xFFC00400, 143 0xFFC00400,
142 IRQ_UART0_RX, 144 IRQ_UART0_RX,
145 IRQ_UART0_ERROR,
143#ifdef CONFIG_SERIAL_BFIN_DMA 146#ifdef CONFIG_SERIAL_BFIN_DMA
144 CH_UART0_TX, 147 CH_UART0_TX,
145 CH_UART0_RX, 148 CH_UART0_RX,
@@ -154,6 +157,7 @@ struct bfin_serial_res bfin_serial_resource[] = {
154 { 157 {
155 0xFFC02000, 158 0xFFC02000,
156 IRQ_UART1_RX, 159 IRQ_UART1_RX,
160 IRQ_UART1_ERROR,
157#ifdef CONFIG_SERIAL_BFIN_DMA 161#ifdef CONFIG_SERIAL_BFIN_DMA
158 CH_UART1_TX, 162 CH_UART1_TX,
159 CH_UART1_RX, 163 CH_UART1_RX,
diff --git a/arch/blackfin/mach-bf548/include/mach/bfin_serial_5xx.h b/arch/blackfin/mach-bf548/include/mach/bfin_serial_5xx.h
index 388e2328aeba..2d1b5fa3cca0 100644
--- a/arch/blackfin/mach-bf548/include/mach/bfin_serial_5xx.h
+++ b/arch/blackfin/mach-bf548/include/mach/bfin_serial_5xx.h
@@ -46,41 +46,27 @@
46#define UART_PUT_CHAR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_THR),v) 46#define UART_PUT_CHAR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_THR),v)
47#define UART_PUT_DLL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLL),v) 47#define UART_PUT_DLL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLL),v)
48#define UART_SET_IER(uart,v) bfin_write16(((uart)->port.membase + OFFSET_IER_SET),v) 48#define UART_SET_IER(uart,v) bfin_write16(((uart)->port.membase + OFFSET_IER_SET),v)
49#define UART_CLEAR_IER(uart,v) bfin_write16(((uart)->port.membase + OFFSET_IER_CLEAR),v) 49#define UART_CLEAR_IER(uart,v) bfin_write16(((uart)->port.membase + OFFSET_IER_CLEAR),v)
50#define UART_PUT_DLH(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLH),v) 50#define UART_PUT_DLH(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLH),v)
51#define UART_PUT_LSR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_LSR),v) 51#define UART_PUT_LSR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_LSR),v)
52#define UART_PUT_LCR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_LCR),v) 52#define UART_PUT_LCR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_LCR),v)
53#define UART_CLEAR_LSR(uart) bfin_write16(((uart)->port.membase + OFFSET_LSR), -1) 53#define UART_CLEAR_LSR(uart) bfin_write16(((uart)->port.membase + OFFSET_LSR), -1)
54#define UART_PUT_GCTL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_GCTL),v) 54#define UART_PUT_GCTL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_GCTL),v)
55#define UART_PUT_MCR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_MCR),v) 55#define UART_PUT_MCR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_MCR),v)
56#define UART_CLEAR_SCTS(uart) bfin_write16(((uart)->port.membase + OFFSET_MSR),SCTS)
56 57
57#define UART_SET_DLAB(uart) /* MMRs not muxed on BF54x */ 58#define UART_SET_DLAB(uart) /* MMRs not muxed on BF54x */
58#define UART_CLEAR_DLAB(uart) /* MMRs not muxed on BF54x */ 59#define UART_CLEAR_DLAB(uart) /* MMRs not muxed on BF54x */
59 60
60#define UART_GET_CTS(x) (UART_GET_MSR(x) & CTS) 61#define UART_GET_CTS(x) (UART_GET_MSR(x) & CTS)
61#define UART_SET_RTS(x) (UART_PUT_MCR(x, UART_GET_MCR(x) | MRTS)) 62#define UART_DISABLE_RTS(x) UART_PUT_MCR(x, UART_GET_MCR(x) & ~(ARTS|MRTS))
62#define UART_CLEAR_RTS(x) (UART_PUT_MCR(x, UART_GET_MCR(x) & ~MRTS)) 63#define UART_ENABLE_RTS(x) UART_PUT_MCR(x, UART_GET_MCR(x) | MRTS | ARTS)
63#define UART_ENABLE_INTS(x, v) UART_SET_IER(x, v) 64#define UART_ENABLE_INTS(x, v) UART_SET_IER(x, v)
64#define UART_DISABLE_INTS(x) UART_CLEAR_IER(x, 0xF) 65#define UART_DISABLE_INTS(x) UART_CLEAR_IER(x, 0xF)
65 66
66#if defined(CONFIG_BFIN_UART0_CTSRTS) || defined(CONFIG_BFIN_UART2_CTSRTS) 67#if defined(CONFIG_BFIN_UART0_CTSRTS) || defined(CONFIG_BFIN_UART1_CTSRTS) || \
67# define CONFIG_SERIAL_BFIN_CTSRTS 68 defined(CONFIG_BFIN_UART2_CTSRTS) || defined(CONFIG_BFIN_UART3_CTSRTS)
68 69# define CONFIG_SERIAL_BFIN_HARD_CTSRTS
69# ifndef CONFIG_UART0_CTS_PIN
70# define CONFIG_UART0_CTS_PIN -1
71# endif
72
73# ifndef CONFIG_UART0_RTS_PIN
74# define CONFIG_UART0_RTS_PIN -1
75# endif
76
77# ifndef CONFIG_UART2_CTS_PIN
78# define CONFIG_UART2_CTS_PIN -1
79# endif
80
81# ifndef CONFIG_UART2_RTS_PIN
82# define CONFIG_UART2_RTS_PIN -1
83# endif
84#endif 70#endif
85 71
86#define BFIN_UART_TX_FIFO_SIZE 2 72#define BFIN_UART_TX_FIFO_SIZE 2
@@ -91,6 +77,7 @@
91struct bfin_serial_port { 77struct bfin_serial_port {
92 struct uart_port port; 78 struct uart_port port;
93 unsigned int old_status; 79 unsigned int old_status;
80 int status_irq;
94#ifdef CONFIG_SERIAL_BFIN_DMA 81#ifdef CONFIG_SERIAL_BFIN_DMA
95 int tx_done; 82 int tx_done;
96 int tx_count; 83 int tx_count;
@@ -101,23 +88,24 @@ struct bfin_serial_port {
101 unsigned int rx_dma_channel; 88 unsigned int rx_dma_channel;
102 struct work_struct tx_dma_workqueue; 89 struct work_struct tx_dma_workqueue;
103#endif 90#endif
104#ifdef CONFIG_SERIAL_BFIN_CTSRTS 91#ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
105 struct timer_list cts_timer; 92 int scts;
106 int cts_pin; 93 int cts_pin;
107 int rts_pin; 94 int rts_pin;
108#endif 95#endif
109}; 96};
110 97
111struct bfin_serial_res { 98struct bfin_serial_res {
112 unsigned long uart_base_addr; 99 unsigned long uart_base_addr;
113 int uart_irq; 100 int uart_irq;
101 int uart_status_irq;
114#ifdef CONFIG_SERIAL_BFIN_DMA 102#ifdef CONFIG_SERIAL_BFIN_DMA
115 unsigned int uart_tx_dma_channel; 103 unsigned int uart_tx_dma_channel;
116 unsigned int uart_rx_dma_channel; 104 unsigned int uart_rx_dma_channel;
117#endif 105#endif
118#ifdef CONFIG_SERIAL_BFIN_CTSRTS 106#ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
119 int uart_cts_pin; 107 int uart_cts_pin;
120 int uart_rts_pin; 108 int uart_rts_pin;
121#endif 109#endif
122}; 110};
123 111
@@ -126,13 +114,14 @@ struct bfin_serial_res bfin_serial_resource[] = {
126 { 114 {
127 0xFFC00400, 115 0xFFC00400,
128 IRQ_UART0_RX, 116 IRQ_UART0_RX,
117 IRQ_UART0_ERROR,
129#ifdef CONFIG_SERIAL_BFIN_DMA 118#ifdef CONFIG_SERIAL_BFIN_DMA
130 CH_UART0_TX, 119 CH_UART0_TX,
131 CH_UART0_RX, 120 CH_UART0_RX,
132#endif 121#endif
133#ifdef CONFIG_SERIAL_BFIN_CTSRTS 122#ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
134 CONFIG_UART0_CTS_PIN, 123 0,
135 CONFIG_UART0_RTS_PIN, 124 0,
136#endif 125#endif
137 }, 126 },
138#endif 127#endif
@@ -140,13 +129,14 @@ struct bfin_serial_res bfin_serial_resource[] = {
140 { 129 {
141 0xFFC02000, 130 0xFFC02000,
142 IRQ_UART1_RX, 131 IRQ_UART1_RX,
132 IRQ_UART1_ERROR,
143#ifdef CONFIG_SERIAL_BFIN_DMA 133#ifdef CONFIG_SERIAL_BFIN_DMA
144 CH_UART1_TX, 134 CH_UART1_TX,
145 CH_UART1_RX, 135 CH_UART1_RX,
146#endif 136#endif
147#ifdef CONFIG_SERIAL_BFIN_CTSRTS 137#ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
148 0, 138 GPIO_PE10,
149 0, 139 GPIO_PE9,
150#endif 140#endif
151 }, 141 },
152#endif 142#endif
@@ -154,13 +144,14 @@ struct bfin_serial_res bfin_serial_resource[] = {
154 { 144 {
155 0xFFC02100, 145 0xFFC02100,
156 IRQ_UART2_RX, 146 IRQ_UART2_RX,
147 IRQ_UART2_ERROR,
157#ifdef CONFIG_SERIAL_BFIN_DMA 148#ifdef CONFIG_SERIAL_BFIN_DMA
158 CH_UART2_TX, 149 CH_UART2_TX,
159 CH_UART2_RX, 150 CH_UART2_RX,
160#endif 151#endif
161#ifdef CONFIG_SERIAL_BFIN_CTSRTS 152#ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
162 CONFIG_UART2_CTS_PIN, 153 0,
163 CONFIG_UART2_RTS_PIN, 154 0,
164#endif 155#endif
165 }, 156 },
166#endif 157#endif
@@ -168,13 +159,14 @@ struct bfin_serial_res bfin_serial_resource[] = {
168 { 159 {
169 0xFFC03100, 160 0xFFC03100,
170 IRQ_UART3_RX, 161 IRQ_UART3_RX,
162 IRQ_UART3_ERROR,
171#ifdef CONFIG_SERIAL_BFIN_DMA 163#ifdef CONFIG_SERIAL_BFIN_DMA
172 CH_UART3_TX, 164 CH_UART3_TX,
173 CH_UART3_RX, 165 CH_UART3_RX,
174#endif 166#endif
175#ifdef CONFIG_SERIAL_BFIN_CTSRTS 167#ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
176 0, 168 GPIO_PB3,
177 0, 169 GPIO_PB2,
178#endif 170#endif
179 }, 171 },
180#endif 172#endif
diff --git a/arch/blackfin/mach-bf561/include/mach/bfin_serial_5xx.h b/arch/blackfin/mach-bf561/include/mach/bfin_serial_5xx.h
index d0469e3e16d8..a1b50878553f 100644
--- a/arch/blackfin/mach-bf561/include/mach/bfin_serial_5xx.h
+++ b/arch/blackfin/mach-bf561/include/mach/bfin_serial_5xx.h
@@ -53,9 +53,9 @@
53#define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0) 53#define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)
54#define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) 54#define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0)
55 55
56#define UART_GET_CTS(x) gpio_get_value(x->cts_pin) 56#define UART_GET_CTS(x) (!gpio_get_value(x->cts_pin))
57#define UART_SET_RTS(x) gpio_set_value(x->rts_pin, 1) 57#define UART_DISABLE_RTS(x) gpio_set_value(x->rts_pin, 1)
58#define UART_CLEAR_RTS(x) gpio_set_value(x->rts_pin, 0) 58#define UART_ENABLE_RTS(x) gpio_set_value(x->rts_pin, 0)
59#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v) 59#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v)
60#define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0) 60#define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0)
61 61
@@ -74,6 +74,7 @@
74struct bfin_serial_port { 74struct bfin_serial_port {
75 struct uart_port port; 75 struct uart_port port;
76 unsigned int old_status; 76 unsigned int old_status;
77 int status_irq;
77 unsigned int lsr; 78 unsigned int lsr;
78#ifdef CONFIG_SERIAL_BFIN_DMA 79#ifdef CONFIG_SERIAL_BFIN_DMA
79 int tx_done; 80 int tx_done;
@@ -116,6 +117,7 @@ static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart)
116struct bfin_serial_res { 117struct bfin_serial_res {
117 unsigned long uart_base_addr; 118 unsigned long uart_base_addr;
118 int uart_irq; 119 int uart_irq;
120 int uart_status_irq;
119#ifdef CONFIG_SERIAL_BFIN_DMA 121#ifdef CONFIG_SERIAL_BFIN_DMA
120 unsigned int uart_tx_dma_channel; 122 unsigned int uart_tx_dma_channel;
121 unsigned int uart_rx_dma_channel; 123 unsigned int uart_rx_dma_channel;
@@ -130,6 +132,7 @@ struct bfin_serial_res bfin_serial_resource[] = {
130 { 132 {
131 0xFFC00400, 133 0xFFC00400,
132 IRQ_UART_RX, 134 IRQ_UART_RX,
135 IRQ_UART_ERROR,
133#ifdef CONFIG_SERIAL_BFIN_DMA 136#ifdef CONFIG_SERIAL_BFIN_DMA
134 CH_UART_TX, 137 CH_UART_TX,
135 CH_UART_RX, 138 CH_UART_RX,
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index d89972beb12c..f2e5736ad0c8 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -734,7 +734,7 @@ config BFIN_UART0_CTSRTS
734 734
735config UART0_CTS_PIN 735config UART0_CTS_PIN
736 int "UART0 CTS pin" 736 int "UART0 CTS pin"
737 depends on BFIN_UART0_CTSRTS 737 depends on BFIN_UART0_CTSRTS && !BF548
738 default 23 738 default 23
739 help 739 help
740 The default pin is GPIO_GP7. 740 The default pin is GPIO_GP7.
@@ -742,7 +742,7 @@ config UART0_CTS_PIN
742 742
743config UART0_RTS_PIN 743config UART0_RTS_PIN
744 int "UART0 RTS pin" 744 int "UART0 RTS pin"
745 depends on BFIN_UART0_CTSRTS 745 depends on BFIN_UART0_CTSRTS && !BF548
746 default 22 746 default 22
747 help 747 help
748 The default pin is GPIO_GP6. 748 The default pin is GPIO_GP6.
@@ -763,14 +763,14 @@ config BFIN_UART1_CTSRTS
763 763
764config UART1_CTS_PIN 764config UART1_CTS_PIN
765 int "UART1 CTS pin" 765 int "UART1 CTS pin"
766 depends on BFIN_UART1_CTSRTS && !BF54x 766 depends on BFIN_UART1_CTSRTS && !BF548
767 default -1 767 default -1
768 help 768 help
769 Refer to ./include/asm-blackfin/gpio.h to see the GPIO map. 769 Refer to ./include/asm-blackfin/gpio.h to see the GPIO map.
770 770
771config UART1_RTS_PIN 771config UART1_RTS_PIN
772 int "UART1 RTS pin" 772 int "UART1 RTS pin"
773 depends on BFIN_UART1_CTSRTS && !BF54x 773 depends on BFIN_UART1_CTSRTS && !BF548
774 default -1 774 default -1
775 help 775 help
776 Refer to ./include/asm-blackfin/gpio.h to see the GPIO map. 776 Refer to ./include/asm-blackfin/gpio.h to see the GPIO map.
@@ -790,14 +790,14 @@ config BFIN_UART2_CTSRTS
790 790
791config UART2_CTS_PIN 791config UART2_CTS_PIN
792 int "UART2 CTS pin" 792 int "UART2 CTS pin"
793 depends on BFIN_UART2_CTSRTS 793 depends on BFIN_UART2_CTSRTS && !BF548
794 default -1 794 default -1
795 help 795 help
796 Refer to ./include/asm-blackfin/gpio.h to see the GPIO map. 796 Refer to ./include/asm-blackfin/gpio.h to see the GPIO map.
797 797
798config UART2_RTS_PIN 798config UART2_RTS_PIN
799 int "UART2 RTS pin" 799 int "UART2 RTS pin"
800 depends on BFIN_UART2_CTSRTS 800 depends on BFIN_UART2_CTSRTS && !BF548
801 default -1 801 default -1
802 help 802 help
803 Refer to ./include/asm-blackfin/gpio.h to see the GPIO map. 803 Refer to ./include/asm-blackfin/gpio.h to see the GPIO map.
@@ -815,6 +815,20 @@ config BFIN_UART3_CTSRTS
815 Enable hardware flow control in the driver. Using GPIO emulate the CTS/RTS 815 Enable hardware flow control in the driver. Using GPIO emulate the CTS/RTS
816 signal. 816 signal.
817 817
818config UART3_CTS_PIN
819 int "UART3 CTS pin"
820 depends on BFIN_UART3_CTSRTS && !BF548
821 default -1
822 help
823 Refer to ./include/asm-blackfin/gpio.h to see the GPIO map.
824
825config UART3_RTS_PIN
826 int "UART3 RTS pin"
827 depends on BFIN_UART3_CTSRTS && !BF548
828 default -1
829 help
830 Refer to ./include/asm-blackfin/gpio.h to see the GPIO map.
831
818config SERIAL_IMX 832config SERIAL_IMX
819 bool "IMX serial port support" 833 bool "IMX serial port support"
820 depends on ARM && (ARCH_IMX || ARCH_MXC) 834 depends on ARM && (ARCH_IMX || ARCH_MXC)
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
index fbbddb9e73f6..18ba812a4f84 100644
--- a/drivers/serial/bfin_5xx.c
+++ b/drivers/serial/bfin_5xx.c
@@ -72,6 +72,63 @@ static void bfin_serial_tx_chars(struct bfin_serial_port *uart);
72 72
73static void bfin_serial_reset_irda(struct uart_port *port); 73static void bfin_serial_reset_irda(struct uart_port *port);
74 74
75#if defined(CONFIG_SERIAL_BFIN_CTSRTS) || \
76 defined(CONFIG_SERIAL_BFIN_HARD_CTSRTS)
77static unsigned int bfin_serial_get_mctrl(struct uart_port *port)
78{
79 struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
80 if (uart->cts_pin < 0)
81 return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR;
82
83 /* CTS PIN is negative assertive. */
84 if (UART_GET_CTS(uart))
85 return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR;
86 else
87 return TIOCM_DSR | TIOCM_CAR;
88}
89
90static void bfin_serial_set_mctrl(struct uart_port *port, unsigned int mctrl)
91{
92 struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
93 if (uart->rts_pin < 0)
94 return;
95
96 /* RTS PIN is negative assertive. */
97 if (mctrl & TIOCM_RTS)
98 UART_ENABLE_RTS(uart);
99 else
100 UART_DISABLE_RTS(uart);
101}
102
103/*
104 * Handle any change of modem status signal.
105 */
106static irqreturn_t bfin_serial_mctrl_cts_int(int irq, void *dev_id)
107{
108 struct bfin_serial_port *uart = dev_id;
109 unsigned int status;
110
111 status = bfin_serial_get_mctrl(&uart->port);
112 uart_handle_cts_change(&uart->port, status & TIOCM_CTS);
113#ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
114 uart->scts = 1;
115 UART_CLEAR_SCTS(uart);
116 UART_CLEAR_IER(uart, EDSSI);
117#endif
118
119 return IRQ_HANDLED;
120}
121#else
122static unsigned int bfin_serial_get_mctrl(struct uart_port *port)
123{
124 return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR;
125}
126
127static void bfin_serial_set_mctrl(struct uart_port *port, unsigned int mctrl)
128{
129}
130#endif
131
75/* 132/*
76 * interrupts are disabled on entry 133 * interrupts are disabled on entry
77 */ 134 */
@@ -108,6 +165,13 @@ static void bfin_serial_start_tx(struct uart_port *port)
108 struct bfin_serial_port *uart = (struct bfin_serial_port *)port; 165 struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
109 struct tty_struct *tty = uart->port.info->port.tty; 166 struct tty_struct *tty = uart->port.info->port.tty;
110 167
168#ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
169 if (uart->scts && (!bfin_serial_get_mctrl(&uart->port)&TIOCM_CTS)) {
170 uart->scts = 0;
171 uart_handle_cts_change(&uart->port, uart->scts);
172 }
173#endif
174
111 /* 175 /*
112 * To avoid losting RX interrupt, we reset IR function 176 * To avoid losting RX interrupt, we reset IR function
113 * before sending data. 177 * before sending data.
@@ -303,6 +367,12 @@ static irqreturn_t bfin_serial_tx_int(int irq, void *dev_id)
303{ 367{
304 struct bfin_serial_port *uart = dev_id; 368 struct bfin_serial_port *uart = dev_id;
305 369
370#ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
371 if (uart->scts && (!bfin_serial_get_mctrl(&uart->port)&TIOCM_CTS)) {
372 uart->scts = 0;
373 uart_handle_cts_change(&uart->port, uart->scts);
374 }
375#endif
306 spin_lock(&uart->port.lock); 376 spin_lock(&uart->port.lock);
307 if (UART_GET_LSR(uart) & THRE) 377 if (UART_GET_LSR(uart) & THRE)
308 bfin_serial_tx_chars(uart); 378 bfin_serial_tx_chars(uart);
@@ -433,6 +503,13 @@ static irqreturn_t bfin_serial_dma_tx_int(int irq, void *dev_id)
433 struct bfin_serial_port *uart = dev_id; 503 struct bfin_serial_port *uart = dev_id;
434 struct circ_buf *xmit = &uart->port.info->xmit; 504 struct circ_buf *xmit = &uart->port.info->xmit;
435 505
506#ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
507 if (uart->scts && (!bfin_serial_get_mctrl(&uart->port)&TIOCM_CTS)) {
508 uart->scts = 0;
509 uart_handle_cts_change(&uart->port, uart->scts);
510 }
511#endif
512
436 spin_lock(&uart->port.lock); 513 spin_lock(&uart->port.lock);
437 if (!(get_dma_curr_irqstat(uart->tx_dma_channel)&DMA_RUN)) { 514 if (!(get_dma_curr_irqstat(uart->tx_dma_channel)&DMA_RUN)) {
438 disable_dma(uart->tx_dma_channel); 515 disable_dma(uart->tx_dma_channel);
@@ -481,53 +558,6 @@ static unsigned int bfin_serial_tx_empty(struct uart_port *port)
481 return 0; 558 return 0;
482} 559}
483 560
484static unsigned int bfin_serial_get_mctrl(struct uart_port *port)
485{
486#ifdef CONFIG_SERIAL_BFIN_CTSRTS
487 struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
488 if (uart->cts_pin < 0)
489 return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR;
490
491 if (UART_GET_CTS(uart))
492 return TIOCM_DSR | TIOCM_CAR;
493 else
494#endif
495 return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR;
496}
497
498static void bfin_serial_set_mctrl(struct uart_port *port, unsigned int mctrl)
499{
500#ifdef CONFIG_SERIAL_BFIN_CTSRTS
501 struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
502 if (uart->rts_pin < 0)
503 return;
504
505 if (mctrl & TIOCM_RTS)
506 UART_CLEAR_RTS(uart);
507 else
508 UART_SET_RTS(uart);
509#endif
510}
511
512#ifdef CONFIG_SERIAL_BFIN_CTSRTS
513/*
514 * Handle any change of modem status signal.
515 */
516static irqreturn_t bfin_serial_mctrl_cts_int(int irq, void *dev_id)
517{
518 struct bfin_serial_port *uart = dev_id;
519 unsigned int status;
520
521 status = bfin_serial_get_mctrl(&uart->port);
522 uart_handle_cts_change(&uart->port, status & TIOCM_CTS);
523
524 return IRQ_HANDLED;
525}
526#endif
527
528/*
529 * Interrupts are always disabled.
530 */
531static void bfin_serial_break_ctl(struct uart_port *port, int break_state) 561static void bfin_serial_break_ctl(struct uart_port *port, int break_state)
532{ 562{
533 struct bfin_serial_port *uart = (struct bfin_serial_port *)port; 563 struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
@@ -660,6 +690,28 @@ static int bfin_serial_startup(struct uart_port *port)
660 gpio_direction_output(uart->rts_pin, 0); 690 gpio_direction_output(uart->rts_pin, 0);
661 } 691 }
662#endif 692#endif
693#ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
694 if (request_irq(uart->status_irq,
695 bfin_serial_mctrl_cts_int,
696 IRQF_DISABLED, "BFIN_UART_MODEM_STATUS", uart)) {
697 pr_info("Unable to attach BlackFin UART Modem \
698 Status interrupt.\n");
699 }
700
701 if (uart->cts_pin >= 0) {
702 gpio_request(uart->cts_pin, DRIVER_NAME);
703 gpio_direction_output(uart->cts_pin, 1);
704 }
705 if (uart->rts_pin >= 0) {
706 gpio_request(uart->rts_pin, DRIVER_NAME);
707 gpio_direction_output(uart->rts_pin, 0);
708 }
709
710 /* CTS RTS PINs are negative assertive. */
711 UART_PUT_MCR(uart, ACTS);
712 UART_SET_IER(uart, EDSSI);
713#endif
714
663 UART_SET_IER(uart, ERBFI); 715 UART_SET_IER(uart, ERBFI);
664 return 0; 716 return 0;
665} 717}
@@ -694,12 +746,20 @@ static void bfin_serial_shutdown(struct uart_port *port)
694 free_irq(uart->port.irq+1, uart); 746 free_irq(uart->port.irq+1, uart);
695#endif 747#endif
696 748
697# ifdef CONFIG_SERIAL_BFIN_CTSRTS 749#ifdef CONFIG_SERIAL_BFIN_CTSRTS
698 if (uart->cts_pin >= 0) 750 if (uart->cts_pin >= 0)
699 free_irq(gpio_to_irq(uart->cts_pin), uart); 751 free_irq(gpio_to_irq(uart->cts_pin), uart);
700 if (uart->rts_pin >= 0) 752 if (uart->rts_pin >= 0)
701 gpio_free(uart->rts_pin); 753 gpio_free(uart->rts_pin);
702# endif 754#endif
755#ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
756 if (uart->cts_pin >= 0)
757 gpio_free(uart->cts_pin);
758 if (uart->rts_pin >= 0)
759 gpio_free(uart->rts_pin);
760 if (UART_GET_IER(uart) && EDSSI)
761 free_irq(uart->status_irq, uart);
762#endif
703} 763}
704 764
705static void 765static void
@@ -1009,6 +1069,8 @@ static void __init bfin_serial_init_ports(void)
1009 bfin_serial_resource[i].uart_base_addr; 1069 bfin_serial_resource[i].uart_base_addr;
1010 bfin_serial_ports[i].port.irq = 1070 bfin_serial_ports[i].port.irq =
1011 bfin_serial_resource[i].uart_irq; 1071 bfin_serial_resource[i].uart_irq;
1072 bfin_serial_ports[i].status_irq =
1073 bfin_serial_resource[i].uart_status_irq;
1012 bfin_serial_ports[i].port.flags = UPF_BOOT_AUTOCONF; 1074 bfin_serial_ports[i].port.flags = UPF_BOOT_AUTOCONF;
1013#ifdef CONFIG_SERIAL_BFIN_DMA 1075#ifdef CONFIG_SERIAL_BFIN_DMA
1014 bfin_serial_ports[i].tx_done = 1; 1076 bfin_serial_ports[i].tx_done = 1;
@@ -1019,7 +1081,8 @@ static void __init bfin_serial_init_ports(void)
1019 bfin_serial_resource[i].uart_rx_dma_channel; 1081 bfin_serial_resource[i].uart_rx_dma_channel;
1020 init_timer(&(bfin_serial_ports[i].rx_dma_timer)); 1082 init_timer(&(bfin_serial_ports[i].rx_dma_timer));
1021#endif 1083#endif
1022#ifdef CONFIG_SERIAL_BFIN_CTSRTS 1084#if defined(CONFIG_SERIAL_BFIN_CTSRTS) || \
1085 defined(CONFIG_SERIAL_BFIN_HARD_CTSRTS)
1023 bfin_serial_ports[i].cts_pin = 1086 bfin_serial_ports[i].cts_pin =
1024 bfin_serial_resource[i].uart_cts_pin; 1087 bfin_serial_resource[i].uart_cts_pin;
1025 bfin_serial_ports[i].rts_pin = 1088 bfin_serial_ports[i].rts_pin =
@@ -1082,7 +1145,8 @@ bfin_serial_console_setup(struct console *co, char *options)
1082 int baud = 57600; 1145 int baud = 57600;
1083 int bits = 8; 1146 int bits = 8;
1084 int parity = 'n'; 1147 int parity = 'n';
1085# ifdef CONFIG_SERIAL_BFIN_CTSRTS 1148# if defined(CONFIG_SERIAL_BFIN_CTSRTS) || \
1149 defined(CONFIG_SERIAL_BFIN_HARD_CTSRTS)
1086 int flow = 'r'; 1150 int flow = 'r';
1087# else 1151# else
1088 int flow = 'n'; 1152 int flow = 'n';
@@ -1279,7 +1343,8 @@ static int bfin_serial_remove(struct platform_device *dev)
1279 continue; 1343 continue;
1280 uart_remove_one_port(&bfin_serial_reg, &bfin_serial_ports[i].port); 1344 uart_remove_one_port(&bfin_serial_reg, &bfin_serial_ports[i].port);
1281 bfin_serial_ports[i].port.dev = NULL; 1345 bfin_serial_ports[i].port.dev = NULL;
1282#ifdef CONFIG_SERIAL_BFIN_CTSRTS 1346#if defined(CONFIG_SERIAL_BFIN_CTSRTS) || \
1347 defined(CONFIG_SERIAL_BFIN_HARD_CTSRTS)
1283 gpio_free(bfin_serial_ports[i].cts_pin); 1348 gpio_free(bfin_serial_ports[i].cts_pin);
1284 gpio_free(bfin_serial_ports[i].rts_pin); 1349 gpio_free(bfin_serial_ports[i].rts_pin);
1285#endif 1350#endif