1 Index: linux/drivers/serial/amba-pl010.c
2 ===================================================================
3 --- linux.orig/drivers/serial/amba-pl010.c
4 +++ linux/drivers/serial/amba-pl010.c
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
17 #define AMBA_ISR_PASS_LIMIT 256
19 @@ -82,7 +81,7 @@ static void pl010_stop_tx(struct uart_po
20 struct uart_amba_port *uap = (struct uart_amba_port *)port;
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);
28 @@ -92,7 +91,7 @@ static void pl010_start_tx(struct uart_p
29 struct uart_amba_port *uap = (struct uart_amba_port *)port;
32 - cr = readb(uap->port.membase + UART010_CR);
33 + cr = readl(uap->port.membase + UART010_CR);
35 writel(cr, uap->port.membase + UART010_CR);
37 @@ -102,7 +101,7 @@ static void pl010_stop_rx(struct uart_po
38 struct uart_amba_port *uap = (struct uart_amba_port *)port;
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);
46 @@ -112,7 +111,7 @@ static void pl010_enable_ms(struct uart_
47 struct uart_amba_port *uap = (struct uart_amba_port *)port;
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);
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;
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);
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
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);
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);
80 - status = readb(uap->port.membase + UART01x_FR);
81 + status = readl(uap->port.membase + UART01x_FR);
83 spin_unlock(&uap->port.lock);
84 tty_flip_buffer_push(tty);
85 @@ -210,7 +209,7 @@ static void pl010_modem_status(struct ua
87 writel(0, uap->port.membase + UART010_ICR);
89 - status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
90 + status = readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
92 delta = status ^ uap->old_status;
93 uap->old_status = status;
94 @@ -238,7 +237,7 @@ static irqreturn_t pl010_int(int irq, vo
96 spin_lock(&uap->port.lock);
98 - status = readb(uap->port.membase + UART010_IIR);
99 + status = readl(uap->port.membase + UART010_IIR);
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)
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 |
112 @@ -265,7 +264,7 @@ static irqreturn_t pl010_int(int irq, vo
113 static unsigned int pl010_tx_empty(struct uart_port *port)
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;
121 @@ -275,7 +274,7 @@ static unsigned int pl010_get_mctrl(stru
122 unsigned int result = 0;
125 - status = readb(uap->port.membase + UART01x_FR);
126 + status = readl(uap->port.membase + UART01x_FR);
127 if (status & UART01x_FR_DCD)
129 if (status & UART01x_FR_DSR)
130 @@ -301,7 +300,7 @@ static void pl010_break_ctl(struct uart_
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;
139 @@ -334,7 +333,7 @@ static int pl010_startup(struct uart_por
141 * initialise the old status of the modem signals
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;
147 * Finally, enable interrupts
148 @@ -365,7 +364,7 @@ static void pl010_shutdown(struct uart_p
149 writel(0, uap->port.membase + UART010_CR);
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);
157 @@ -387,7 +386,7 @@ pl010_set_termios(struct uart_port *port
159 * Ask the core to calculate the divisor for us.
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);
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;
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;
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,
179 -static struct uart_amba_port *amba_ports[UART_NR];
180 +static struct uart_amba_port *amba_ports[SERIAL_AMBA_NR];
182 #ifdef CONFIG_SERIAL_AMBA_PL010_CONSOLE
184 @@ -550,7 +549,7 @@ static void pl010_console_putchar(struct
188 - status = readb(uap->port.membase + UART01x_FR);
189 + status = readl(uap->port.membase + UART01x_FR);
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,
195 * First save the CR then disable the interrupts
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);
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
206 - status = readb(uap->port.membase + UART01x_FR);
207 + status = readl(uap->port.membase + UART01x_FR);
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)
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);
222 if (lcr_h & UART01x_LCRH_PEN) {
223 @@ -606,8 +605,8 @@ pl010_console_get_options(struct uart_am
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));
234 @@ -625,7 +624,7 @@ static int __init pl010_console_setup(st
235 * if so, search for the first available port that does have
238 - if (co->index >= UART_NR)
239 + if (co->index >= SERIAL_AMBA_NR)
241 uap = amba_ports[co->index];
243 @@ -643,7 +642,7 @@ static int __init pl010_console_setup(st
245 static struct uart_driver amba_reg;
246 static struct console amba_console = {
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 = {
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,
263 + .nr = SERIAL_AMBA_NR,
264 .cons = AMBA_CONSOLE,
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
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.
280 +config SERIAL_AMBA_PL010_NUMPORTS
281 + int "Maximum number of AMBA PL010 serial ports"
282 + depends on SERIAL_AMBA_PL010
285 + Set this to the number of serial ports you want the AMBA PL010 driver
288 +config SERIAL_AMBA_PL010_PORTNAME
289 + string "Name of the AMBA PL010 serial ports"
290 + depends on SERIAL_AMBA_PL010
293 + ::: To be written :::
295 config SERIAL_AMBA_PL010_CONSOLE
296 bool "Support for console on AMBA serial port"
297 depends on SERIAL_AMBA_PL010=y