aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-03-25 23:31:32 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-25 23:31:32 -0500
commit36ddf5bbdea7ba4582abc62f106f0f0e9f0b6b91 (patch)
tree163d637dfda12eba3f8822d3b2941869b2d0ba00 /drivers/serial
parenta41622eaa97e40c811fb7756f403c0d4caa65654 (diff)
parent104c7b03ea0913a24be103db66d8cf1f1f99a49a (diff)
Merge master.kernel.org:/home/rmk/linux-2.6-serial
* master.kernel.org:/home/rmk/linux-2.6-serial: [ARM] 3383/3: ixp2000: ixdp2x01 platform serial conversion [SERIAL] amba-pl010: Remove accessor macros [SERIAL] remove 8250_acpi (replaced by 8250_pnp and PNPACPI) [SERIAL] icom: select FW_LOADER
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/8250_acpi.c183
-rw-r--r--drivers/serial/Kconfig9
-rw-r--r--drivers/serial/Makefile1
-rw-r--r--drivers/serial/amba-pl010.c110
4 files changed, 50 insertions, 253 deletions
diff --git a/drivers/serial/8250_acpi.c b/drivers/serial/8250_acpi.c
deleted file mode 100644
index 809f89ab965c..000000000000
--- a/drivers/serial/8250_acpi.c
+++ /dev/null
@@ -1,183 +0,0 @@
1/*
2 * Copyright (c) 2002-2003 Matthew Wilcox for Hewlett-Packard
3 * Copyright (C) 2004 Hewlett-Packard Co
4 * Bjorn Helgaas <bjorn.helgaas@hp.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#include <linux/acpi.h>
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/serial_core.h>
16
17#include <acpi/acpi_bus.h>
18
19#include <asm/io.h>
20
21#include "8250.h"
22
23struct serial_private {
24 int line;
25};
26
27static acpi_status acpi_serial_mmio(struct uart_port *port,
28 struct acpi_resource_address64 *addr)
29{
30 port->mapbase = addr->minimum;
31 port->iotype = UPIO_MEM;
32 port->flags |= UPF_IOREMAP;
33 return AE_OK;
34}
35
36static acpi_status acpi_serial_port(struct uart_port *port,
37 struct acpi_resource_io *io)
38{
39 if (io->address_length) {
40 port->iobase = io->minimum;
41 port->iotype = UPIO_PORT;
42 } else
43 printk(KERN_ERR "%s: zero-length IO port range?\n", __FUNCTION__);
44 return AE_OK;
45}
46
47static acpi_status acpi_serial_ext_irq(struct uart_port *port,
48 struct acpi_resource_extended_irq *ext_irq)
49{
50 int rc;
51
52 if (ext_irq->interrupt_count > 0) {
53 rc = acpi_register_gsi(ext_irq->interrupts[0],
54 ext_irq->triggering, ext_irq->polarity);
55 if (rc < 0)
56 return AE_ERROR;
57 port->irq = rc;
58 }
59 return AE_OK;
60}
61
62static acpi_status acpi_serial_irq(struct uart_port *port,
63 struct acpi_resource_irq *irq)
64{
65 int rc;
66
67 if (irq->interrupt_count > 0) {
68 rc = acpi_register_gsi(irq->interrupts[0],
69 irq->triggering, irq->polarity);
70 if (rc < 0)
71 return AE_ERROR;
72 port->irq = rc;
73 }
74 return AE_OK;
75}
76
77static acpi_status acpi_serial_resource(struct acpi_resource *res, void *data)
78{
79 struct uart_port *port = (struct uart_port *) data;
80 struct acpi_resource_address64 addr;
81 acpi_status status;
82
83 status = acpi_resource_to_address64(res, &addr);
84 if (ACPI_SUCCESS(status))
85 return acpi_serial_mmio(port, &addr);
86 else if (res->type == ACPI_RESOURCE_TYPE_IO)
87 return acpi_serial_port(port, &res->data.io);
88 else if (res->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ)
89 return acpi_serial_ext_irq(port, &res->data.extended_irq);
90 else if (res->type == ACPI_RESOURCE_TYPE_IRQ)
91 return acpi_serial_irq(port, &res->data.irq);
92 return AE_OK;
93}
94
95static int acpi_serial_add(struct acpi_device *device)
96{
97 struct serial_private *priv;
98 acpi_status status;
99 struct uart_port port;
100 int result;
101
102 memset(&port, 0, sizeof(struct uart_port));
103
104 port.uartclk = 1843200;
105 port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF;
106
107 priv = kmalloc(sizeof(struct serial_private), GFP_KERNEL);
108 if (!priv) {
109 result = -ENOMEM;
110 goto fail;
111 }
112 memset(priv, 0, sizeof(*priv));
113
114 status = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
115 acpi_serial_resource, &port);
116 if (ACPI_FAILURE(status)) {
117 result = -ENODEV;
118 goto fail;
119 }
120
121 if (!port.mapbase && !port.iobase) {
122 printk(KERN_ERR "%s: no iomem or port address in %s _CRS\n",
123 __FUNCTION__, device->pnp.bus_id);
124 result = -ENODEV;
125 goto fail;
126 }
127
128 priv->line = serial8250_register_port(&port);
129 if (priv->line < 0) {
130 printk(KERN_WARNING "Couldn't register serial port %s: %d\n",
131 device->pnp.bus_id, priv->line);
132 result = -ENODEV;
133 goto fail;
134 }
135
136 acpi_driver_data(device) = priv;
137 return 0;
138
139fail:
140 kfree(priv);
141
142 return result;
143}
144
145static int acpi_serial_remove(struct acpi_device *device, int type)
146{
147 struct serial_private *priv;
148
149 if (!device || !acpi_driver_data(device))
150 return -EINVAL;
151
152 priv = acpi_driver_data(device);
153 serial8250_unregister_port(priv->line);
154 kfree(priv);
155
156 return 0;
157}
158
159static struct acpi_driver acpi_serial_driver = {
160 .name = "serial",
161 .class = "",
162 .ids = "PNP0501",
163 .ops = {
164 .add = acpi_serial_add,
165 .remove = acpi_serial_remove,
166 },
167};
168
169static int __init acpi_serial_init(void)
170{
171 return acpi_bus_register_driver(&acpi_serial_driver);
172}
173
174static void __exit acpi_serial_exit(void)
175{
176 acpi_bus_unregister_driver(&acpi_serial_driver);
177}
178
179module_init(acpi_serial_init);
180module_exit(acpi_serial_exit);
181
182MODULE_LICENSE("GPL");
183MODULE_DESCRIPTION("Generic 8250/16x50 ACPI serial driver");
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index c66ef96c71b4..ceb3697bf84d 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -77,14 +77,6 @@ config SERIAL_8250_CS
77 77
78 If unsure, say N. 78 If unsure, say N.
79 79
80config SERIAL_8250_ACPI
81 bool "8250/16550 device discovery via ACPI namespace"
82 default y if IA64
83 depends on ACPI && SERIAL_8250
84 ---help---
85 If you wish to enable serial port discovery via the ACPI
86 namespace, say Y here. If unsure, say N.
87
88config SERIAL_8250_NR_UARTS 80config SERIAL_8250_NR_UARTS
89 int "Maximum number of 8250/16550 serial ports" 81 int "Maximum number of 8250/16550 serial ports"
90 depends on SERIAL_8250 82 depends on SERIAL_8250
@@ -827,6 +819,7 @@ config SERIAL_ICOM
827 tristate "IBM Multiport Serial Adapter" 819 tristate "IBM Multiport Serial Adapter"
828 depends on PCI && (PPC_ISERIES || PPC_PSERIES) 820 depends on PCI && (PPC_ISERIES || PPC_PSERIES)
829 select SERIAL_CORE 821 select SERIAL_CORE
822 select FW_LOADER
830 help 823 help
831 This driver is for a family of multiport serial adapters 824 This driver is for a family of multiport serial adapters
832 including 2 port RVX, 2 port internal modem, 4 port internal 825 including 2 port RVX, 2 port internal modem, 4 port internal
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index 50c221af9e6d..a3a4323d9c86 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -5,7 +5,6 @@
5# 5#
6 6
7serial-8250-y := 7serial-8250-y :=
8serial-8250-$(CONFIG_SERIAL_8250_ACPI) += 8250_acpi.o
9serial-8250-$(CONFIG_PNP) += 8250_pnp.o 8serial-8250-$(CONFIG_PNP) += 8250_pnp.o
10serial-8250-$(CONFIG_GSC) += 8250_gsc.o 9serial-8250-$(CONFIG_GSC) += 8250_gsc.o
11serial-8250-$(CONFIG_PCI) += 8250_pci.o 10serial-8250-$(CONFIG_PCI) += 8250_pci.o
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c
index e04d5e82d9ae..127d6cd5de7f 100644
--- a/drivers/serial/amba-pl010.c
+++ b/drivers/serial/amba-pl010.c
@@ -62,26 +62,8 @@
62 62
63#define AMBA_ISR_PASS_LIMIT 256 63#define AMBA_ISR_PASS_LIMIT 256
64 64
65/*
66 * Access macros for the AMBA UARTs
67 */
68#define UART_GET_INT_STATUS(p) readb((p)->membase + UART010_IIR)
69#define UART_PUT_ICR(p, c) writel((c), (p)->membase + UART010_ICR)
70#define UART_GET_FR(p) readb((p)->membase + UART01x_FR)
71#define UART_GET_CHAR(p) readb((p)->membase + UART01x_DR)
72#define UART_PUT_CHAR(p, c) writel((c), (p)->membase + UART01x_DR)
73#define UART_GET_RSR(p) readb((p)->membase + UART01x_RSR)
74#define UART_GET_CR(p) readb((p)->membase + UART010_CR)
75#define UART_PUT_CR(p,c) writel((c), (p)->membase + UART010_CR)
76#define UART_GET_LCRL(p) readb((p)->membase + UART010_LCRL)
77#define UART_PUT_LCRL(p,c) writel((c), (p)->membase + UART010_LCRL)
78#define UART_GET_LCRM(p) readb((p)->membase + UART010_LCRM)
79#define UART_PUT_LCRM(p,c) writel((c), (p)->membase + UART010_LCRM)
80#define UART_GET_LCRH(p) readb((p)->membase + UART010_LCRH)
81#define UART_PUT_LCRH(p,c) writel((c), (p)->membase + UART010_LCRH)
82#define UART_RX_DATA(s) (((s) & UART01x_FR_RXFE) == 0) 65#define UART_RX_DATA(s) (((s) & UART01x_FR_RXFE) == 0)
83#define UART_TX_READY(s) (((s) & UART01x_FR_TXFF) == 0) 66#define UART_TX_READY(s) (((s) & UART01x_FR_TXFF) == 0)
84#define UART_TX_EMPTY(p) ((UART_GET_FR(p) & UART01x_FR_TMSK) == 0)
85 67
86#define UART_DUMMY_RSR_RX /*256*/0 68#define UART_DUMMY_RSR_RX /*256*/0
87#define UART_PORT_SIZE 64 69#define UART_PORT_SIZE 64
@@ -110,36 +92,36 @@ static void pl010_stop_tx(struct uart_port *port)
110{ 92{
111 unsigned int cr; 93 unsigned int cr;
112 94
113 cr = UART_GET_CR(port); 95 cr = readb(port->membase + UART010_CR);
114 cr &= ~UART010_CR_TIE; 96 cr &= ~UART010_CR_TIE;
115 UART_PUT_CR(port, cr); 97 writel(cr, port->membase + UART010_CR);
116} 98}
117 99
118static void pl010_start_tx(struct uart_port *port) 100static void pl010_start_tx(struct uart_port *port)
119{ 101{
120 unsigned int cr; 102 unsigned int cr;
121 103
122 cr = UART_GET_CR(port); 104 cr = readb(port->membase + UART010_CR);
123 cr |= UART010_CR_TIE; 105 cr |= UART010_CR_TIE;
124 UART_PUT_CR(port, cr); 106 writel(cr, port->membase + UART010_CR);
125} 107}
126 108
127static void pl010_stop_rx(struct uart_port *port) 109static void pl010_stop_rx(struct uart_port *port)
128{ 110{
129 unsigned int cr; 111 unsigned int cr;
130 112
131 cr = UART_GET_CR(port); 113 cr = readb(port->membase + UART010_CR);
132 cr &= ~(UART010_CR_RIE | UART010_CR_RTIE); 114 cr &= ~(UART010_CR_RIE | UART010_CR_RTIE);
133 UART_PUT_CR(port, cr); 115 writel(cr, port->membase + UART010_CR);
134} 116}
135 117
136static void pl010_enable_ms(struct uart_port *port) 118static void pl010_enable_ms(struct uart_port *port)
137{ 119{
138 unsigned int cr; 120 unsigned int cr;
139 121
140 cr = UART_GET_CR(port); 122 cr = readb(port->membase + UART010_CR);
141 cr |= UART010_CR_MSIE; 123 cr |= UART010_CR_MSIE;
142 UART_PUT_CR(port, cr); 124 writel(cr, port->membase + UART010_CR);
143} 125}
144 126
145static void 127static void
@@ -152,9 +134,9 @@ pl010_rx_chars(struct uart_port *port)
152 struct tty_struct *tty = port->info->tty; 134 struct tty_struct *tty = port->info->tty;
153 unsigned int status, ch, flag, rsr, max_count = 256; 135 unsigned int status, ch, flag, rsr, max_count = 256;
154 136
155 status = UART_GET_FR(port); 137 status = readb(port->membase + UART01x_FR);
156 while (UART_RX_DATA(status) && max_count--) { 138 while (UART_RX_DATA(status) && max_count--) {
157 ch = UART_GET_CHAR(port); 139 ch = readb(port->membase + UART01x_DR);
158 flag = TTY_NORMAL; 140 flag = TTY_NORMAL;
159 141
160 port->icount.rx++; 142 port->icount.rx++;
@@ -163,7 +145,7 @@ pl010_rx_chars(struct uart_port *port)
163 * Note that the error handling code is 145 * Note that the error handling code is
164 * out of the main execution path 146 * out of the main execution path
165 */ 147 */
166 rsr = UART_GET_RSR(port) | UART_DUMMY_RSR_RX; 148 rsr = readb(port->membase + UART01x_RSR) | UART_DUMMY_RSR_RX;
167 if (unlikely(rsr & UART01x_RSR_ANY)) { 149 if (unlikely(rsr & UART01x_RSR_ANY)) {
168 if (rsr & UART01x_RSR_BE) { 150 if (rsr & UART01x_RSR_BE) {
169 rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE); 151 rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE);
@@ -193,7 +175,7 @@ pl010_rx_chars(struct uart_port *port)
193 uart_insert_char(port, rsr, UART01x_RSR_OE, ch, flag); 175 uart_insert_char(port, rsr, UART01x_RSR_OE, ch, flag);
194 176
195 ignore_char: 177 ignore_char:
196 status = UART_GET_FR(port); 178 status = readb(port->membase + UART01x_FR);
197 } 179 }
198 tty_flip_buffer_push(tty); 180 tty_flip_buffer_push(tty);
199 return; 181 return;
@@ -205,7 +187,7 @@ static void pl010_tx_chars(struct uart_port *port)
205 int count; 187 int count;
206 188
207 if (port->x_char) { 189 if (port->x_char) {
208 UART_PUT_CHAR(port, port->x_char); 190 writel(port->x_char, port->membase + UART01x_DR);
209 port->icount.tx++; 191 port->icount.tx++;
210 port->x_char = 0; 192 port->x_char = 0;
211 return; 193 return;
@@ -217,7 +199,7 @@ static void pl010_tx_chars(struct uart_port *port)
217 199
218 count = port->fifosize >> 1; 200 count = port->fifosize >> 1;
219 do { 201 do {
220 UART_PUT_CHAR(port, xmit->buf[xmit->tail]); 202 writel(xmit->buf[xmit->tail], port->membase + UART01x_DR);
221 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); 203 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
222 port->icount.tx++; 204 port->icount.tx++;
223 if (uart_circ_empty(xmit)) 205 if (uart_circ_empty(xmit))
@@ -236,9 +218,9 @@ static void pl010_modem_status(struct uart_port *port)
236 struct uart_amba_port *uap = (struct uart_amba_port *)port; 218 struct uart_amba_port *uap = (struct uart_amba_port *)port;
237 unsigned int status, delta; 219 unsigned int status, delta;
238 220
239 UART_PUT_ICR(&uap->port, 0); 221 writel(0, uap->port.membase + UART010_ICR);
240 222
241 status = UART_GET_FR(&uap->port) & UART01x_FR_MODEM_ANY; 223 status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
242 224
243 delta = status ^ uap->old_status; 225 delta = status ^ uap->old_status;
244 uap->old_status = status; 226 uap->old_status = status;
@@ -266,7 +248,7 @@ static irqreturn_t pl010_int(int irq, void *dev_id, struct pt_regs *regs)
266 248
267 spin_lock(&port->lock); 249 spin_lock(&port->lock);
268 250
269 status = UART_GET_INT_STATUS(port); 251 status = readb(port->membase + UART010_IIR);
270 if (status) { 252 if (status) {
271 do { 253 do {
272 if (status & (UART010_IIR_RTIS | UART010_IIR_RIS)) 254 if (status & (UART010_IIR_RTIS | UART010_IIR_RIS))
@@ -283,7 +265,7 @@ static irqreturn_t pl010_int(int irq, void *dev_id, struct pt_regs *regs)
283 if (pass_counter-- == 0) 265 if (pass_counter-- == 0)
284 break; 266 break;
285 267
286 status = UART_GET_INT_STATUS(port); 268 status = readb(port->membase + UART010_IIR);
287 } while (status & (UART010_IIR_RTIS | UART010_IIR_RIS | 269 } while (status & (UART010_IIR_RTIS | UART010_IIR_RIS |
288 UART010_IIR_TIS)); 270 UART010_IIR_TIS));
289 handled = 1; 271 handled = 1;
@@ -296,7 +278,7 @@ static irqreturn_t pl010_int(int irq, void *dev_id, struct pt_regs *regs)
296 278
297static unsigned int pl010_tx_empty(struct uart_port *port) 279static unsigned int pl010_tx_empty(struct uart_port *port)
298{ 280{
299 return UART_GET_FR(port) & UART01x_FR_BUSY ? 0 : TIOCSER_TEMT; 281 return readb(port->membase + UART01x_FR) & UART01x_FR_BUSY ? 0 : TIOCSER_TEMT;
300} 282}
301 283
302static unsigned int pl010_get_mctrl(struct uart_port *port) 284static unsigned int pl010_get_mctrl(struct uart_port *port)
@@ -304,7 +286,7 @@ static unsigned int pl010_get_mctrl(struct uart_port *port)
304 unsigned int result = 0; 286 unsigned int result = 0;
305 unsigned int status; 287 unsigned int status;
306 288
307 status = UART_GET_FR(port); 289 status = readb(port->membase + UART01x_FR);
308 if (status & UART01x_FR_DCD) 290 if (status & UART01x_FR_DCD)
309 result |= TIOCM_CAR; 291 result |= TIOCM_CAR;
310 if (status & UART01x_FR_DSR) 292 if (status & UART01x_FR_DSR)
@@ -340,12 +322,12 @@ static void pl010_break_ctl(struct uart_port *port, int break_state)
340 unsigned int lcr_h; 322 unsigned int lcr_h;
341 323
342 spin_lock_irqsave(&port->lock, flags); 324 spin_lock_irqsave(&port->lock, flags);
343 lcr_h = UART_GET_LCRH(port); 325 lcr_h = readb(port->membase + UART010_LCRH);
344 if (break_state == -1) 326 if (break_state == -1)
345 lcr_h |= UART01x_LCRH_BRK; 327 lcr_h |= UART01x_LCRH_BRK;
346 else 328 else
347 lcr_h &= ~UART01x_LCRH_BRK; 329 lcr_h &= ~UART01x_LCRH_BRK;
348 UART_PUT_LCRH(port, lcr_h); 330 writel(lcr_h, port->membase + UART010_LCRH);
349 spin_unlock_irqrestore(&port->lock, flags); 331 spin_unlock_irqrestore(&port->lock, flags);
350} 332}
351 333
@@ -364,13 +346,13 @@ static int pl010_startup(struct uart_port *port)
364 /* 346 /*
365 * initialise the old status of the modem signals 347 * initialise the old status of the modem signals
366 */ 348 */
367 uap->old_status = UART_GET_FR(port) & UART01x_FR_MODEM_ANY; 349 uap->old_status = readb(port->membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
368 350
369 /* 351 /*
370 * Finally, enable interrupts 352 * Finally, enable interrupts
371 */ 353 */
372 UART_PUT_CR(port, UART01x_CR_UARTEN | UART010_CR_RIE | 354 writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE,
373 UART010_CR_RTIE); 355 port->membase + UART010_CR);
374 356
375 return 0; 357 return 0;
376} 358}
@@ -385,11 +367,12 @@ static void pl010_shutdown(struct uart_port *port)
385 /* 367 /*
386 * disable all interrupts, disable the port 368 * disable all interrupts, disable the port
387 */ 369 */
388 UART_PUT_CR(port, 0); 370 writel(0, port->membase + UART010_CR);
389 371
390 /* disable break condition and fifos */ 372 /* disable break condition and fifos */
391 UART_PUT_LCRH(port, UART_GET_LCRH(port) & 373 writel(readb(port->membase + UART010_LCRH) &
392 ~(UART01x_LCRH_BRK | UART01x_LCRH_FEN)); 374 ~(UART01x_LCRH_BRK | UART01x_LCRH_FEN),
375 port->membase + UART010_LCRH);
393} 376}
394 377
395static void 378static void
@@ -466,25 +449,25 @@ pl010_set_termios(struct uart_port *port, struct termios *termios,
466 port->ignore_status_mask |= UART_DUMMY_RSR_RX; 449 port->ignore_status_mask |= UART_DUMMY_RSR_RX;
467 450
468 /* first, disable everything */ 451 /* first, disable everything */
469 old_cr = UART_GET_CR(port) & ~UART010_CR_MSIE; 452 old_cr = readb(port->membase + UART010_CR) & ~UART010_CR_MSIE;
470 453
471 if (UART_ENABLE_MS(port, termios->c_cflag)) 454 if (UART_ENABLE_MS(port, termios->c_cflag))
472 old_cr |= UART010_CR_MSIE; 455 old_cr |= UART010_CR_MSIE;
473 456
474 UART_PUT_CR(port, 0); 457 writel(0, port->membase + UART010_CR);
475 458
476 /* Set baud rate */ 459 /* Set baud rate */
477 quot -= 1; 460 quot -= 1;
478 UART_PUT_LCRM(port, ((quot & 0xf00) >> 8)); 461 writel((quot & 0xf00) >> 8, port->membase + UART010_LCRM);
479 UART_PUT_LCRL(port, (quot & 0xff)); 462 writel(quot & 0xff, port->membase + UART010_LCRL);
480 463
481 /* 464 /*
482 * ----------v----------v----------v----------v----- 465 * ----------v----------v----------v----------v-----
483 * NOTE: MUST BE WRITTEN AFTER UARTLCR_M & UARTLCR_L 466 * NOTE: MUST BE WRITTEN AFTER UARTLCR_M & UARTLCR_L
484 * ----------^----------^----------^----------^----- 467 * ----------^----------^----------^----------^-----
485 */ 468 */
486 UART_PUT_LCRH(port, lcr_h); 469 writel(lcr_h, port->membase + UART010_LCRH);
487 UART_PUT_CR(port, old_cr); 470 writel(old_cr, port->membase + UART010_CR);
488 471
489 spin_unlock_irqrestore(&port->lock, flags); 472 spin_unlock_irqrestore(&port->lock, flags);
490} 473}
@@ -593,9 +576,13 @@ static struct uart_amba_port amba_ports[UART_NR] = {
593 576
594static void pl010_console_putchar(struct uart_port *port, int ch) 577static void pl010_console_putchar(struct uart_port *port, int ch)
595{ 578{
596 while (!UART_TX_READY(UART_GET_FR(port))) 579 unsigned int status;
580
581 do {
582 status = readb(port->membase + UART01x_FR);
597 barrier(); 583 barrier();
598 UART_PUT_CHAR(port, ch); 584 } while (!UART_TX_READY(status));
585 writel(ch, port->membase + UART01x_DR);
599} 586}
600 587
601static void 588static void
@@ -607,8 +594,8 @@ pl010_console_write(struct console *co, const char *s, unsigned int count)
607 /* 594 /*
608 * First save the CR then disable the interrupts 595 * First save the CR then disable the interrupts
609 */ 596 */
610 old_cr = UART_GET_CR(port); 597 old_cr = readb(port->membase + UART010_CR);
611 UART_PUT_CR(port, UART01x_CR_UARTEN); 598 writel(UART01x_CR_UARTEN, port->membase + UART010_CR);
612 599
613 uart_console_write(port, s, count, pl010_console_putchar); 600 uart_console_write(port, s, count, pl010_console_putchar);
614 601
@@ -617,18 +604,19 @@ pl010_console_write(struct console *co, const char *s, unsigned int count)
617 * and restore the TCR 604 * and restore the TCR
618 */ 605 */
619 do { 606 do {
620 status = UART_GET_FR(port); 607 status = readb(port->membase + UART01x_FR);
608 barrier();
621 } while (status & UART01x_FR_BUSY); 609 } while (status & UART01x_FR_BUSY);
622 UART_PUT_CR(port, old_cr); 610 writel(old_cr, port->membase + UART010_CR);
623} 611}
624 612
625static void __init 613static void __init
626pl010_console_get_options(struct uart_port *port, int *baud, 614pl010_console_get_options(struct uart_port *port, int *baud,
627 int *parity, int *bits) 615 int *parity, int *bits)
628{ 616{
629 if (UART_GET_CR(port) & UART01x_CR_UARTEN) { 617 if (readb(port->membase + UART010_CR) & UART01x_CR_UARTEN) {
630 unsigned int lcr_h, quot; 618 unsigned int lcr_h, quot;
631 lcr_h = UART_GET_LCRH(port); 619 lcr_h = readb(port->membase + UART010_LCRH);
632 620
633 *parity = 'n'; 621 *parity = 'n';
634 if (lcr_h & UART01x_LCRH_PEN) { 622 if (lcr_h & UART01x_LCRH_PEN) {
@@ -643,7 +631,7 @@ pl010_console_get_options(struct uart_port *port, int *baud,
643 else 631 else
644 *bits = 8; 632 *bits = 8;
645 633
646 quot = UART_GET_LCRL(port) | UART_GET_LCRM(port) << 8; 634 quot = readb(port->membase + UART010_LCRL) | readb(port->membase + UART010_LCRM) << 8;
647 *baud = port->uartclk / (16 * (quot + 1)); 635 *baud = port->uartclk / (16 * (quot + 1));
648 } 636 }
649} 637}