1 Index: linux-2.6.21.7/drivers/serial/atmel_serial.c
2 ===================================================================
3 --- linux-2.6.21.7.orig/drivers/serial/atmel_serial.c
4 +++ linux-2.6.21.7/drivers/serial/atmel_serial.c
5 @@ -174,7 +174,35 @@ static void atmel_set_mctrl(struct uart_
6 at91_set_gpio_value(AT91_PIN_PA21, 0);
8 at91_set_gpio_value(AT91_PIN_PA21, 1);
11 + * FDL VersaLink adds GPIOS to provide full modem control on
12 + * USART 0 - Drive DTR and RI pins manually
14 + if (mctrl & TIOCM_DTR)
15 + at91_set_gpio_value(AT91_PIN_PB6, 0);
17 + at91_set_gpio_value(AT91_PIN_PB6, 1);
18 + if (mctrl & TIOCM_RI)
19 + at91_set_gpio_value(AT91_PIN_PB7, 0);
21 + at91_set_gpio_value(AT91_PIN_PB7, 1);
25 + * FDL VersaLink adds GPIOS to provide full modem control on
26 + * USART 3 - Drive DTR and RI pins manually
28 + if (port->mapbase == AT91RM9200_BASE_US3) {
29 + if (mctrl & TIOCM_DTR)
30 + at91_set_gpio_value(AT91_PIN_PB29, 0);
32 + at91_set_gpio_value(AT91_PIN_PB29, 1);
33 + if (mctrl & TIOCM_RI)
34 + at91_set_gpio_value(AT91_PIN_PB2, 0);
36 + at91_set_gpio_value(AT91_PIN_PB2, 1);
41 @@ -211,8 +239,10 @@ static u_int atmel_get_mctrl(struct uart
43 * The control signals are active low.
45 - if (!(status & ATMEL_US_DCD))
48 + if (!(port->mapbase == AT91RM9200_BASE_US0 || port->mapbase == AT91RM9200_BASE_US3))
49 + if (!(status & ATMEL_US_DCD))
51 if (!(status & ATMEL_US_CTS))
53 if (!(status & ATMEL_US_DSR))
54 @@ -220,6 +250,16 @@ static u_int atmel_get_mctrl(struct uart
55 if (!(status & ATMEL_US_RI))
59 + * Read the GPIO's for the FDL VersaLink special case
61 + if (port->mapbase == AT91RM9200_BASE_US0)
62 + if (!(at91_get_gpio_value(AT91_PIN_PA19)))
64 + if (port->mapbase == AT91RM9200_BASE_US3)
65 + if (!(at91_get_gpio_value(AT91_PIN_PA24)))
71 @@ -511,6 +551,34 @@ static void atmel_tx_chars(struct uart_p
75 + * USART0 DCD Interrupt handler
78 +static irqreturn_t atmel_u0_DCD_interrupt(int irq, void *dev_id)
80 + struct uart_port *port = dev_id;
81 + int status = at91_get_gpio_value(irq);
83 + uart_handle_dcd_change(port, !(status));
89 + * USART3 DCD Interrupt handler
92 +static irqreturn_t atmel_u3_DCD_interrupt(int irq, void *dev_id)
94 + struct uart_port *port = dev_id;
95 + int status = at91_get_gpio_value(irq);
97 + uart_handle_dcd_change(port, !(status));
105 static irqreturn_t atmel_interrupt(int irq, void *dev_id)
106 @@ -587,6 +655,23 @@ static int atmel_startup(struct uart_por
110 + if (port->mapbase == AT91RM9200_BASE_US0) {
111 + retval = request_irq(AT91_PIN_PA19, atmel_u0_DCD_interrupt, 0, "atmel_serial", port);
113 + printk("atmel_serial: atmel_startup - Can't get u0DCD irq\n");
114 + free_irq(port->irq, port);
118 + if (port->mapbase == AT91RM9200_BASE_US3) {
119 + retval = request_irq(AT91_PIN_PA24, atmel_u3_DCD_interrupt, 0, "atmel_serial", port);
121 + printk("atmel_serial: atmel_startup - Can't get u3DCD irq\n");
122 + free_irq(port->irq, port);
128 * Initialize DMA (if necessary)
130 @@ -603,6 +688,10 @@ static int atmel_startup(struct uart_por
131 kfree(atmel_port->pdc_rx[0].buf);
133 free_irq(port->irq, port);
134 + if (port->mapbase == AT91RM9200_BASE_US0)
135 + free_irq(AT91_PIN_PA19, port);
136 + if (port->mapbase == AT91RM9200_BASE_US3)
137 + free_irq(AT91_PIN_PA24, port);
140 pdc->dma_addr = dma_map_single(port->dev, pdc->buf, PDC_BUFFER_SIZE, DMA_FROM_DEVICE);
141 @@ -636,6 +725,10 @@ static int atmel_startup(struct uart_por
142 retval = atmel_open_hook(port);
144 free_irq(port->irq, port);
145 + if (port->mapbase == AT91RM9200_BASE_US0)
146 + free_irq(AT91_PIN_PA19, port);
147 + if (port->mapbase == AT91RM9200_BASE_US3)
148 + free_irq(AT91_PIN_PA24, port);
152 @@ -701,6 +794,10 @@ static void atmel_shutdown(struct uart_p
155 free_irq(port->irq, port);
156 + if (port->mapbase == AT91RM9200_BASE_US0)
157 + free_irq(AT91_PIN_PA19, port);
158 + if (port->mapbase == AT91RM9200_BASE_US3)
159 + free_irq(AT91_PIN_PA24, port);
162 * If there is a specific "close" function (to unregister