1 --- a/drivers/serial/amba-pl010.c
2 +++ b/drivers/serial/amba-pl010.c
9 #define SERIAL_AMBA_MAJOR 204
10 #define SERIAL_AMBA_MINOR 16
11 -#define SERIAL_AMBA_NR UART_NR
12 +#define SERIAL_AMBA_NR CONFIG_SERIAL_AMBA_PL010_NUMPORTS
13 +#define SERIAL_AMBA_NAME CONFIG_SERIAL_AMBA_PL010_PORTNAME
15 #define AMBA_ISR_PASS_LIMIT 256
18 struct uart_amba_port *uap = (struct uart_amba_port *)port;
21 - cr = readb(uap->port.membase + UART010_CR);
22 + cr = readl(uap->port.membase + UART010_CR);
23 cr &= ~UART010_CR_TIE;
24 writel(cr, uap->port.membase + UART010_CR);
27 struct uart_amba_port *uap = (struct uart_amba_port *)port;
30 - cr = readb(uap->port.membase + UART010_CR);
31 + cr = readl(uap->port.membase + UART010_CR);
33 writel(cr, uap->port.membase + UART010_CR);
36 struct uart_amba_port *uap = (struct uart_amba_port *)port;
39 - cr = readb(uap->port.membase + UART010_CR);
40 + cr = readl(uap->port.membase + UART010_CR);
41 cr &= ~(UART010_CR_RIE | UART010_CR_RTIE);
42 writel(cr, uap->port.membase + UART010_CR);
45 struct uart_amba_port *uap = (struct uart_amba_port *)port;
48 - cr = readb(uap->port.membase + UART010_CR);
49 + cr = readl(uap->port.membase + UART010_CR);
50 cr |= UART010_CR_MSIE;
51 writel(cr, uap->port.membase + UART010_CR);
54 struct tty_struct *tty = uap->port.info->tty;
55 unsigned int status, ch, flag, rsr, max_count = 256;
57 - status = readb(uap->port.membase + UART01x_FR);
58 + status = readl(uap->port.membase + UART01x_FR);
59 while (UART_RX_DATA(status) && max_count--) {
60 - ch = readb(uap->port.membase + UART01x_DR);
61 + ch = readl(uap->port.membase + UART01x_DR);
64 uap->port.icount.rx++;
66 * Note that the error handling code is
67 * out of the main execution path
69 - rsr = readb(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX;
70 + rsr = readl(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX;
71 if (unlikely(rsr & UART01x_RSR_ANY)) {
72 writel(0, uap->port.membase + UART01x_ECR);
75 uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag);
78 - status = readb(uap->port.membase + UART01x_FR);
79 + status = readl(uap->port.membase + UART01x_FR);
81 spin_unlock(&uap->port.lock);
82 tty_flip_buffer_push(tty);
85 writel(0, uap->port.membase + UART010_ICR);
87 - status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
88 + status = readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
90 delta = status ^ uap->old_status;
91 uap->old_status = status;
94 spin_lock(&uap->port.lock);
96 - status = readb(uap->port.membase + UART010_IIR);
97 + status = readl(uap->port.membase + UART010_IIR);
100 if (status & (UART010_IIR_RTIS | UART010_IIR_RIS))
102 if (pass_counter-- == 0)
105 - status = readb(uap->port.membase + UART010_IIR);
106 + status = readl(uap->port.membase + UART010_IIR);
107 } while (status & (UART010_IIR_RTIS | UART010_IIR_RIS |
111 static unsigned int pl010_tx_empty(struct uart_port *port)
113 struct uart_amba_port *uap = (struct uart_amba_port *)port;
114 - unsigned int status = readb(uap->port.membase + UART01x_FR);
115 + unsigned int status = readl(uap->port.membase + UART01x_FR);
116 return status & UART01x_FR_BUSY ? 0 : TIOCSER_TEMT;
120 unsigned int result = 0;
123 - status = readb(uap->port.membase + UART01x_FR);
124 + status = readl(uap->port.membase + UART01x_FR);
125 if (status & UART01x_FR_DCD)
127 if (status & UART01x_FR_DSR)
131 spin_lock_irqsave(&uap->port.lock, flags);
132 - lcr_h = readb(uap->port.membase + UART010_LCRH);
133 + lcr_h = readl(uap->port.membase + UART010_LCRH);
134 if (break_state == -1)
135 lcr_h |= UART01x_LCRH_BRK;
139 * initialise the old status of the modem signals
141 - uap->old_status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
142 + uap->old_status = readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
145 * Finally, enable interrupts
147 writel(0, uap->port.membase + UART010_CR);
149 /* disable break condition and fifos */
150 - writel(readb(uap->port.membase + UART010_LCRH) &
151 + writel(readl(uap->port.membase + UART010_LCRH) &
152 ~(UART01x_LCRH_BRK | UART01x_LCRH_FEN),
153 uap->port.membase + UART010_LCRH);
157 * Ask the core to calculate the divisor for us.
159 - baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16);
160 + baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16);
161 quot = uart_get_divisor(port, baud);
163 switch (termios->c_cflag & CSIZE) {
165 uap->port.ignore_status_mask |= UART_DUMMY_RSR_RX;
167 /* first, disable everything */
168 - old_cr = readb(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE;
169 + old_cr = readl(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE;
171 if (UART_ENABLE_MS(port, termios->c_cflag))
172 old_cr |= UART010_CR_MSIE;
174 .verify_port = pl010_verify_port,
177 -static struct uart_amba_port *amba_ports[UART_NR];
178 +static struct uart_amba_port *amba_ports[SERIAL_AMBA_NR];
180 #ifdef CONFIG_SERIAL_AMBA_PL010_CONSOLE
186 - status = readb(uap->port.membase + UART01x_FR);
187 + status = readl(uap->port.membase + UART01x_FR);
189 } while (!UART_TX_READY(status));
190 writel(ch, uap->port.membase + UART01x_DR);
193 * First save the CR then disable the interrupts
195 - old_cr = readb(uap->port.membase + UART010_CR);
196 + old_cr = readl(uap->port.membase + UART010_CR);
197 writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR);
199 uart_console_write(&uap->port, s, count, pl010_console_putchar);
201 * and restore the TCR
204 - status = readb(uap->port.membase + UART01x_FR);
205 + status = readl(uap->port.membase + UART01x_FR);
207 } while (status & UART01x_FR_BUSY);
208 writel(old_cr, uap->port.membase + UART010_CR);
210 pl010_console_get_options(struct uart_amba_port *uap, int *baud,
211 int *parity, int *bits)
213 - if (readb(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) {
214 + if (readl(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) {
215 unsigned int lcr_h, quot;
216 - lcr_h = readb(uap->port.membase + UART010_LCRH);
217 + lcr_h = readl(uap->port.membase + UART010_LCRH);
220 if (lcr_h & UART01x_LCRH_PEN) {
225 - quot = readb(uap->port.membase + UART010_LCRL) |
226 - readb(uap->port.membase + UART010_LCRM) << 8;
227 + quot = readl(uap->port.membase + UART010_LCRL) |
228 + readl(uap->port.membase + UART010_LCRM) << 8;
229 *baud = uap->port.uartclk / (16 * (quot + 1));
233 * if so, search for the first available port that does have
236 - if (co->index >= UART_NR)
237 + if (co->index >= SERIAL_AMBA_NR)
239 uap = amba_ports[co->index];
243 static struct uart_driver amba_reg;
244 static struct console amba_console = {
246 + .name = SERIAL_AMBA_NAME,
247 .write = pl010_console_write,
248 .device = uart_console_device,
249 .setup = pl010_console_setup,
250 @@ -659,11 +658,11 @@
252 static struct uart_driver amba_reg = {
253 .owner = THIS_MODULE,
254 - .driver_name = "ttyAM",
255 - .dev_name = "ttyAM",
256 + .driver_name = SERIAL_AMBA_NAME,
257 + .dev_name = SERIAL_AMBA_NAME,
258 .major = SERIAL_AMBA_MAJOR,
259 .minor = SERIAL_AMBA_MINOR,
261 + .nr = SERIAL_AMBA_NR,
262 .cons = AMBA_CONSOLE,
265 --- a/drivers/serial/Kconfig
266 +++ b/drivers/serial/Kconfig
267 @@ -287,10 +287,25 @@
269 This selects the ARM(R) AMBA(R) PrimeCell PL010 UART. If you have
270 an Integrator/AP or Integrator/PP2 platform, or if you have a
271 - Cirrus Logic EP93xx CPU, say Y or M here.
272 + Cirrus Logic EP93xx CPU or an Infineon ADM5120 SOC, say Y or M here.
276 +config SERIAL_AMBA_PL010_NUMPORTS
277 + int "Maximum number of AMBA PL010 serial ports"
278 + depends on SERIAL_AMBA_PL010
281 + Set this to the number of serial ports you want the AMBA PL010 driver
284 +config SERIAL_AMBA_PL010_PORTNAME
285 + string "Name of the AMBA PL010 serial ports"
286 + depends on SERIAL_AMBA_PL010
289 + ::: To be written :::
291 config SERIAL_AMBA_PL010_CONSOLE
292 bool "Support for console on AMBA serial port"
293 depends on SERIAL_AMBA_PL010=y