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