[adm5120] convert Cellvision board structures
[openwrt.git] / target / linux / at91 / patches-2.6.22 / 008-fdl-serial.patch
1 --- linux-2.6.21.1.orig/drivers/serial/atmel_serial.c 2007-05-28 12:22:29.000000000 +0200
2 +++ linux-2.6.21.1/drivers/serial/atmel_serial.c 2007-05-28 16:39:09.000000000 +0200
3 @@ -174,7 +174,35 @@
4 at91_set_gpio_value(AT91_PIN_PA21, 0);
5 else
6 at91_set_gpio_value(AT91_PIN_PA21, 1);
7 +
8 + /*
9 + * FDL VersaLink adds GPIOS to provide full modem control on
10 + * USART 0 - Drive DTR and RI pins manually
11 + */
12 + if (mctrl & TIOCM_DTR)
13 + at91_set_gpio_value(AT91_PIN_PB6, 0);
14 + else
15 + at91_set_gpio_value(AT91_PIN_PB6, 1);
16 + if (mctrl & TIOCM_RI)
17 + at91_set_gpio_value(AT91_PIN_PB7, 0);
18 + else
19 + at91_set_gpio_value(AT91_PIN_PB7, 1);
20 }
21 +
22 + /*
23 + * FDL VersaLink adds GPIOS to provide full modem control on
24 + * USART 3 - Drive DTR and RI pins manually
25 + */
26 + if (port->mapbase == AT91RM9200_BASE_US3) {
27 + if (mctrl & TIOCM_DTR)
28 + at91_set_gpio_value(AT91_PIN_PB29, 0);
29 + else
30 + at91_set_gpio_value(AT91_PIN_PB29, 1);
31 + if (mctrl & TIOCM_RI)
32 + at91_set_gpio_value(AT91_PIN_PB2, 0);
33 + else
34 + at91_set_gpio_value(AT91_PIN_PB2, 1);
35 + }
36 }
37 #endif
38
39 @@ -211,8 +239,10 @@
40 /*
41 * The control signals are active low.
42 */
43 - if (!(status & ATMEL_US_DCD))
44 - ret |= TIOCM_CD;
45 +
46 + if (!(port->mapbase == AT91RM9200_BASE_US0 || port->mapbase == AT91RM9200_BASE_US3))
47 + if (!(status & ATMEL_US_DCD))
48 + ret |= TIOCM_CD;
49 if (!(status & ATMEL_US_CTS))
50 ret |= TIOCM_CTS;
51 if (!(status & ATMEL_US_DSR))
52 @@ -220,6 +250,16 @@
53 if (!(status & ATMEL_US_RI))
54 ret |= TIOCM_RI;
55
56 + /*
57 + * Read the GPIO's for the FDL VersaLink special case
58 + */
59 + if (port->mapbase == AT91RM9200_BASE_US0)
60 + if (!(at91_get_gpio_value(AT91_PIN_PA19)))
61 + ret |= TIOCM_CD;
62 + if (port->mapbase == AT91RM9200_BASE_US3)
63 + if (!(at91_get_gpio_value(AT91_PIN_PA24)))
64 + ret |= TIOCM_CD;
65 +
66 return ret;
67 }
68
69 @@ -511,6 +551,34 @@
70 }
71
72 /*
73 + * USART0 DCD Interrupt handler
74 + */
75 +
76 +static irqreturn_t atmel_u0_DCD_interrupt(int irq, void *dev_id)
77 +{
78 + struct uart_port *port = dev_id;
79 + int status = at91_get_gpio_value(irq);
80 +
81 + uart_handle_dcd_change(port, !(status));
82 +
83 + return IRQ_HANDLED;
84 +}
85 +
86 +/*
87 + * USART3 DCD Interrupt handler
88 + */
89 +
90 +static irqreturn_t atmel_u3_DCD_interrupt(int irq, void *dev_id)
91 +{
92 + struct uart_port *port = dev_id;
93 + int status = at91_get_gpio_value(irq);
94 +
95 + uart_handle_dcd_change(port, !(status));
96 +
97 + return IRQ_HANDLED;
98 +}
99 +
100 +/*
101 * Interrupt handler
102 */
103 static irqreturn_t atmel_interrupt(int irq, void *dev_id)
104 @@ -587,6 +655,23 @@
105 return retval;
106 }
107
108 + if (port->mapbase == AT91RM9200_BASE_US0) {
109 + retval = request_irq(AT91_PIN_PA19, atmel_u0_DCD_interrupt, 0, "atmel_serial", port);
110 + if (retval) {
111 + printk("atmel_serial: atmel_startup - Can't get u0DCD irq\n");
112 + free_irq(port->irq, port);
113 + return retval;
114 + }
115 + }
116 + if (port->mapbase == AT91RM9200_BASE_US3) {
117 + retval = request_irq(AT91_PIN_PA24, atmel_u3_DCD_interrupt, 0, "atmel_serial", port);
118 + if (retval) {
119 + printk("atmel_serial: atmel_startup - Can't get u3DCD irq\n");
120 + free_irq(port->irq, port);
121 + return retval;
122 + }
123 + }
124 +
125 /*
126 * Initialize DMA (if necessary)
127 */
128 @@ -603,6 +688,10 @@
129 kfree(atmel_port->pdc_rx[0].buf);
130 }
131 free_irq(port->irq, port);
132 + if (port->mapbase == AT91RM9200_BASE_US0)
133 + free_irq(AT91_PIN_PA19, port);
134 + if (port->mapbase == AT91RM9200_BASE_US3)
135 + free_irq(AT91_PIN_PA24, port);
136 return -ENOMEM;
137 }
138 pdc->dma_addr = dma_map_single(port->dev, pdc->buf, PDC_BUFFER_SIZE, DMA_FROM_DEVICE);
139 @@ -636,6 +725,10 @@
140 retval = atmel_open_hook(port);
141 if (retval) {
142 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);
147 return retval;
148 }
149 }
150 @@ -701,6 +794,10 @@
151 * Free the interrupt
152 */
153 free_irq(port->irq, port);
154 + if (port->mapbase == AT91RM9200_BASE_US0)
155 + free_irq(AT91_PIN_PA19, port);
156 + if (port->mapbase == AT91RM9200_BASE_US3)
157 + free_irq(AT91_PIN_PA24, port);
158
159 /*
160 * If there is a specific "close" function (to unregister
This page took 0.065552 seconds and 5 git commands to generate.