1 --- a/drivers/serial/atmel_serial.c
2 +++ b/drivers/serial/atmel_serial.c
3 @@ -214,6 +214,34 @@ static void atmel_set_mctrl(struct uart_
4 at91_set_gpio_value(AT91_PIN_PA21, 0);
6 at91_set_gpio_value(AT91_PIN_PA21, 1);
9 + * FDL VersaLink adds GPIOS to provide full modem
10 + * control on USART 0 - Drive DTR and RI pins manually
12 + if (mctrl & TIOCM_DTR)
13 + at91_set_gpio_value(AT91_PIN_PB6, 0);
15 + at91_set_gpio_value(AT91_PIN_PB6, 1);
16 + if (mctrl & TIOCM_RI)
17 + at91_set_gpio_value(AT91_PIN_PB7, 0);
19 + at91_set_gpio_value(AT91_PIN_PB7, 1);
23 + * FDL VersaLink adds GPIOS to provide full modem control on
24 + * USART 3 - Drive DTR and RI pins manually
26 + if (port->mapbase == AT91RM9200_BASE_US3) {
27 + if (mctrl & TIOCM_DTR)
28 + at91_set_gpio_value(AT91_PIN_PB29, 0);
30 + at91_set_gpio_value(AT91_PIN_PB29, 1);
31 + if (mctrl & TIOCM_RI)
32 + at91_set_gpio_value(AT91_PIN_PB2, 0);
34 + at91_set_gpio_value(AT91_PIN_PB2, 1);
38 @@ -251,8 +279,10 @@ static u_int atmel_get_mctrl(struct uart
40 * The control signals are active low.
42 - if (!(status & ATMEL_US_DCD))
45 + if (!(port->mapbase == AT91RM9200_BASE_US0 || port->mapbase == AT91RM9200_BASE_US3))
46 + if (!(status & ATMEL_US_DCD))
48 if (!(status & ATMEL_US_CTS))
50 if (!(status & ATMEL_US_DSR))
51 @@ -260,6 +290,16 @@ static u_int atmel_get_mctrl(struct uart
52 if (!(status & ATMEL_US_RI))
56 + * Read the GPIO's for the FDL VersaLink special case
58 + if (port->mapbase == AT91RM9200_BASE_US0)
59 + if (!(at91_get_gpio_value(AT91_PIN_PA19)))
61 + if (port->mapbase == AT91RM9200_BASE_US3)
62 + if (!(at91_get_gpio_value(AT91_PIN_PA24)))
68 @@ -453,6 +493,34 @@ static void atmel_tx_chars(struct uart_p
72 + * USART0 DCD Interrupt handler
75 +static irqreturn_t atmel_u0_DCD_interrupt(int irq, void *dev_id)
77 + struct uart_port *port = dev_id;
78 + int status = at91_get_gpio_value(irq);
80 + uart_handle_dcd_change(port, !(status));
86 + * USART3 DCD Interrupt handler
89 +static irqreturn_t atmel_u3_DCD_interrupt(int irq, void *dev_id)
91 + struct uart_port *port = dev_id;
92 + int status = at91_get_gpio_value(irq);
94 + uart_handle_dcd_change(port, !(status));
100 * receive interrupt handler.
103 @@ -815,6 +883,23 @@ static int atmel_startup(struct uart_por
107 + if (port->mapbase == AT91RM9200_BASE_US0) {
108 + retval = request_irq(AT91_PIN_PA19, atmel_u0_DCD_interrupt, 0, "atmel_serial", port);
110 + printk("atmel_serial: atmel_startup - Can't get u0DCD irq\n");
111 + free_irq(port->irq, port);
115 + if (port->mapbase == AT91RM9200_BASE_US3) {
116 + retval = request_irq(AT91_PIN_PA24, atmel_u3_DCD_interrupt, 0, "atmel_serial", port);
118 + printk("atmel_serial: atmel_startup - Can't get u3DCD irq\n");
119 + free_irq(port->irq, port);
125 * Initialize DMA (if necessary)
127 @@ -834,6 +919,10 @@ static int atmel_startup(struct uart_por
128 kfree(atmel_port->pdc_rx[0].buf);
130 free_irq(port->irq, port);
131 + if (port->mapbase == AT91RM9200_BASE_US0)
132 + free_irq(AT91_PIN_PA19, port);
133 + if (port->mapbase == AT91RM9200_BASE_US3)
134 + free_irq(AT91_PIN_PA24, port);
137 pdc->dma_addr = dma_map_single(port->dev,
138 @@ -873,7 +962,11 @@ static int atmel_startup(struct uart_por
139 retval = atmel_open_hook(port);
141 free_irq(port->irq, port);
143 + if (port->mapbase == AT91RM9200_BASE_US0)
144 + free_irq(AT91_PIN_PA19, port);
145 + if (port->mapbase == AT91RM9200_BASE_US3)
146 + free_irq(AT91_PIN_PA24, port);
151 @@ -947,6 +1040,10 @@ static void atmel_shutdown(struct uart_p
154 free_irq(port->irq, port);
155 + if (port->mapbase == AT91RM9200_BASE_US0)
156 + free_irq(AT91_PIN_PA19, port);
157 + if (port->mapbase == AT91RM9200_BASE_US3)
158 + free_irq(AT91_PIN_PA24, port);
161 * If there is a specific "close" function (to unregister