Add a zyxel prestige profile for the adm5120eb target, build the hcd driver as a...
[openwrt.git] / target / linux / adm5120-2.6 / patches-2.6.22 / 200-amba_pl010_hacks.patch
1 Index: linux/drivers/serial/amba-pl010.c
2 ===================================================================
3 --- linux.orig/drivers/serial/amba-pl010.c
4 +++ linux/drivers/serial/amba-pl010.c
5 @@ -52,11 +52,10 @@
6
7 #include <asm/io.h>
8
9 -#define UART_NR 8
10 -
11 #define SERIAL_AMBA_MAJOR 204
12 #define SERIAL_AMBA_MINOR 16
13 -#define SERIAL_AMBA_NR UART_NR
14 +#define SERIAL_AMBA_NR CONFIG_SERIAL_AMBA_PL010_NUMPORTS
15 +#define SERIAL_AMBA_NAME CONFIG_SERIAL_AMBA_PL010_PORTNAME
16
17 #define AMBA_ISR_PASS_LIMIT 256
18
19 @@ -82,7 +81,7 @@ static void pl010_stop_tx(struct uart_po
20 struct uart_amba_port *uap = (struct uart_amba_port *)port;
21 unsigned int cr;
22
23 - cr = readb(uap->port.membase + UART010_CR);
24 + cr = readl(uap->port.membase + UART010_CR);
25 cr &= ~UART010_CR_TIE;
26 writel(cr, uap->port.membase + UART010_CR);
27 }
28 @@ -92,7 +91,7 @@ static void pl010_start_tx(struct uart_p
29 struct uart_amba_port *uap = (struct uart_amba_port *)port;
30 unsigned int cr;
31
32 - cr = readb(uap->port.membase + UART010_CR);
33 + cr = readl(uap->port.membase + UART010_CR);
34 cr |= UART010_CR_TIE;
35 writel(cr, uap->port.membase + UART010_CR);
36 }
37 @@ -102,7 +101,7 @@ static void pl010_stop_rx(struct uart_po
38 struct uart_amba_port *uap = (struct uart_amba_port *)port;
39 unsigned int cr;
40
41 - cr = readb(uap->port.membase + UART010_CR);
42 + cr = readl(uap->port.membase + UART010_CR);
43 cr &= ~(UART010_CR_RIE | UART010_CR_RTIE);
44 writel(cr, uap->port.membase + UART010_CR);
45 }
46 @@ -112,7 +111,7 @@ static void pl010_enable_ms(struct uart_
47 struct uart_amba_port *uap = (struct uart_amba_port *)port;
48 unsigned int cr;
49
50 - cr = readb(uap->port.membase + UART010_CR);
51 + cr = readl(uap->port.membase + UART010_CR);
52 cr |= UART010_CR_MSIE;
53 writel(cr, uap->port.membase + UART010_CR);
54 }
55 @@ -122,9 +121,9 @@ static void pl010_rx_chars(struct uart_a
56 struct tty_struct *tty = uap->port.info->tty;
57 unsigned int status, ch, flag, rsr, max_count = 256;
58
59 - status = readb(uap->port.membase + UART01x_FR);
60 + status = readl(uap->port.membase + UART01x_FR);
61 while (UART_RX_DATA(status) && max_count--) {
62 - ch = readb(uap->port.membase + UART01x_DR);
63 + ch = readl(uap->port.membase + UART01x_DR);
64 flag = TTY_NORMAL;
65
66 uap->port.icount.rx++;
67 @@ -133,7 +132,7 @@ static void pl010_rx_chars(struct uart_a
68 * Note that the error handling code is
69 * out of the main execution path
70 */
71 - rsr = readb(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX;
72 + rsr = readl(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX;
73 if (unlikely(rsr & UART01x_RSR_ANY)) {
74 writel(0, uap->port.membase + UART01x_ECR);
75
76 @@ -165,7 +164,7 @@ static void pl010_rx_chars(struct uart_a
77 uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag);
78
79 ignore_char:
80 - status = readb(uap->port.membase + UART01x_FR);
81 + status = readl(uap->port.membase + UART01x_FR);
82 }
83 spin_unlock(&uap->port.lock);
84 tty_flip_buffer_push(tty);
85 @@ -210,7 +209,7 @@ static void pl010_modem_status(struct ua
86
87 writel(0, uap->port.membase + UART010_ICR);
88
89 - status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
90 + status = readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
91
92 delta = status ^ uap->old_status;
93 uap->old_status = status;
94 @@ -238,7 +237,7 @@ static irqreturn_t pl010_int(int irq, vo
95
96 spin_lock(&uap->port.lock);
97
98 - status = readb(uap->port.membase + UART010_IIR);
99 + status = readl(uap->port.membase + UART010_IIR);
100 if (status) {
101 do {
102 if (status & (UART010_IIR_RTIS | UART010_IIR_RIS))
103 @@ -251,7 +250,7 @@ static irqreturn_t pl010_int(int irq, vo
104 if (pass_counter-- == 0)
105 break;
106
107 - status = readb(uap->port.membase + UART010_IIR);
108 + status = readl(uap->port.membase + UART010_IIR);
109 } while (status & (UART010_IIR_RTIS | UART010_IIR_RIS |
110 UART010_IIR_TIS));
111 handled = 1;
112 @@ -265,7 +264,7 @@ static irqreturn_t pl010_int(int irq, vo
113 static unsigned int pl010_tx_empty(struct uart_port *port)
114 {
115 struct uart_amba_port *uap = (struct uart_amba_port *)port;
116 - unsigned int status = readb(uap->port.membase + UART01x_FR);
117 + unsigned int status = readl(uap->port.membase + UART01x_FR);
118 return status & UART01x_FR_BUSY ? 0 : TIOCSER_TEMT;
119 }
120
121 @@ -275,7 +274,7 @@ static unsigned int pl010_get_mctrl(stru
122 unsigned int result = 0;
123 unsigned int status;
124
125 - status = readb(uap->port.membase + UART01x_FR);
126 + status = readl(uap->port.membase + UART01x_FR);
127 if (status & UART01x_FR_DCD)
128 result |= TIOCM_CAR;
129 if (status & UART01x_FR_DSR)
130 @@ -301,7 +300,7 @@ static void pl010_break_ctl(struct uart_
131 unsigned int lcr_h;
132
133 spin_lock_irqsave(&uap->port.lock, flags);
134 - lcr_h = readb(uap->port.membase + UART010_LCRH);
135 + lcr_h = readl(uap->port.membase + UART010_LCRH);
136 if (break_state == -1)
137 lcr_h |= UART01x_LCRH_BRK;
138 else
139 @@ -334,7 +333,7 @@ static int pl010_startup(struct uart_por
140 /*
141 * initialise the old status of the modem signals
142 */
143 - uap->old_status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
144 + uap->old_status = readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
145
146 /*
147 * Finally, enable interrupts
148 @@ -365,7 +364,7 @@ static void pl010_shutdown(struct uart_p
149 writel(0, uap->port.membase + UART010_CR);
150
151 /* disable break condition and fifos */
152 - writel(readb(uap->port.membase + UART010_LCRH) &
153 + writel(readl(uap->port.membase + UART010_LCRH) &
154 ~(UART01x_LCRH_BRK | UART01x_LCRH_FEN),
155 uap->port.membase + UART010_LCRH);
156
157 @@ -387,7 +386,7 @@ pl010_set_termios(struct uart_port *port
158 /*
159 * Ask the core to calculate the divisor for us.
160 */
161 - baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16);
162 + baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16);
163 quot = uart_get_divisor(port, baud);
164
165 switch (termios->c_cflag & CSIZE) {
166 @@ -450,7 +449,7 @@ pl010_set_termios(struct uart_port *port
167 uap->port.ignore_status_mask |= UART_DUMMY_RSR_RX;
168
169 /* first, disable everything */
170 - old_cr = readb(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE;
171 + old_cr = readl(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE;
172
173 if (UART_ENABLE_MS(port, termios->c_cflag))
174 old_cr |= UART010_CR_MSIE;
175 @@ -540,7 +539,7 @@ static struct uart_ops amba_pl010_pops =
176 .verify_port = pl010_verify_port,
177 };
178
179 -static struct uart_amba_port *amba_ports[UART_NR];
180 +static struct uart_amba_port *amba_ports[SERIAL_AMBA_NR];
181
182 #ifdef CONFIG_SERIAL_AMBA_PL010_CONSOLE
183
184 @@ -550,7 +549,7 @@ static void pl010_console_putchar(struct
185 unsigned int status;
186
187 do {
188 - status = readb(uap->port.membase + UART01x_FR);
189 + status = readl(uap->port.membase + UART01x_FR);
190 barrier();
191 } while (!UART_TX_READY(status));
192 writel(ch, uap->port.membase + UART01x_DR);
193 @@ -567,7 +566,7 @@ pl010_console_write(struct console *co,
194 /*
195 * First save the CR then disable the interrupts
196 */
197 - old_cr = readb(uap->port.membase + UART010_CR);
198 + old_cr = readl(uap->port.membase + UART010_CR);
199 writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR);
200
201 uart_console_write(&uap->port, s, count, pl010_console_putchar);
202 @@ -577,7 +576,7 @@ pl010_console_write(struct console *co,
203 * and restore the TCR
204 */
205 do {
206 - status = readb(uap->port.membase + UART01x_FR);
207 + status = readl(uap->port.membase + UART01x_FR);
208 barrier();
209 } while (status & UART01x_FR_BUSY);
210 writel(old_cr, uap->port.membase + UART010_CR);
211 @@ -589,9 +588,9 @@ static void __init
212 pl010_console_get_options(struct uart_amba_port *uap, int *baud,
213 int *parity, int *bits)
214 {
215 - if (readb(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) {
216 + if (readl(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) {
217 unsigned int lcr_h, quot;
218 - lcr_h = readb(uap->port.membase + UART010_LCRH);
219 + lcr_h = readl(uap->port.membase + UART010_LCRH);
220
221 *parity = 'n';
222 if (lcr_h & UART01x_LCRH_PEN) {
223 @@ -606,8 +605,8 @@ pl010_console_get_options(struct uart_am
224 else
225 *bits = 8;
226
227 - quot = readb(uap->port.membase + UART010_LCRL) |
228 - readb(uap->port.membase + UART010_LCRM) << 8;
229 + quot = readl(uap->port.membase + UART010_LCRL) |
230 + readl(uap->port.membase + UART010_LCRM) << 8;
231 *baud = uap->port.uartclk / (16 * (quot + 1));
232 }
233 }
234 @@ -625,7 +624,7 @@ static int __init pl010_console_setup(st
235 * if so, search for the first available port that does have
236 * console support.
237 */
238 - if (co->index >= UART_NR)
239 + if (co->index >= SERIAL_AMBA_NR)
240 co->index = 0;
241 uap = amba_ports[co->index];
242 if (!uap)
243 @@ -643,7 +642,7 @@ static int __init pl010_console_setup(st
244
245 static struct uart_driver amba_reg;
246 static struct console amba_console = {
247 - .name = "ttyAM",
248 + .name = SERIAL_AMBA_NAME,
249 .write = pl010_console_write,
250 .device = uart_console_device,
251 .setup = pl010_console_setup,
252 @@ -659,11 +658,11 @@ static struct console amba_console = {
253
254 static struct uart_driver amba_reg = {
255 .owner = THIS_MODULE,
256 - .driver_name = "ttyAM",
257 - .dev_name = "ttyAM",
258 + .driver_name = SERIAL_AMBA_NAME,
259 + .dev_name = SERIAL_AMBA_NAME,
260 .major = SERIAL_AMBA_MAJOR,
261 .minor = SERIAL_AMBA_MINOR,
262 - .nr = UART_NR,
263 + .nr = SERIAL_AMBA_NR,
264 .cons = AMBA_CONSOLE,
265 };
266
267 Index: linux/drivers/serial/Kconfig
268 ===================================================================
269 --- linux.orig/drivers/serial/Kconfig
270 +++ linux/drivers/serial/Kconfig
271 @@ -293,10 +293,25 @@ config SERIAL_AMBA_PL010
272 help
273 This selects the ARM(R) AMBA(R) PrimeCell PL010 UART. If you have
274 an Integrator/AP or Integrator/PP2 platform, or if you have a
275 - Cirrus Logic EP93xx CPU, say Y or M here.
276 + Cirrus Logic EP93xx CPU or an Infineon ADM5120 SOC, say Y or M here.
277
278 If unsure, say N.
279
280 +config SERIAL_AMBA_PL010_NUMPORTS
281 + int "Maximum number of AMBA PL010 serial ports"
282 + depends on SERIAL_AMBA_PL010
283 + default "8"
284 + ---help---
285 + Set this to the number of serial ports you want the AMBA PL010 driver
286 + to support.
287 +
288 +config SERIAL_AMBA_PL010_PORTNAME
289 + string "Name of the AMBA PL010 serial ports"
290 + depends on SERIAL_AMBA_PL010
291 + default "ttyAM"
292 + ---help---
293 + ::: To be written :::
294 +
295 config SERIAL_AMBA_PL010_CONSOLE
296 bool "Support for console on AMBA serial port"
297 depends on SERIAL_AMBA_PL010=y
This page took 0.059362 seconds and 5 git commands to generate.