aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJohn Linn <john.linn@xilinx.com>2010-04-07 11:32:55 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-21 12:34:29 -0400
commite5bbbb18d872cb4e29815a000485c2c5eebcfaca (patch)
treee40141e101700b30c225f487daa2796d42165f91 /drivers
parent972c196266d5982766ca03590d54e6a0d4de5664 (diff)
serial: uartlite: move from byte accesses to word accesses
Byte accesses for I/O devices in Xilinx IP is going to be less desired in the future such that the driver is being changed to use 32 bit accesses. This change facilitates using the uartlite IP over a PCIe bus which only allows 32 bit accesses. Signed-off-by: John Linn <john.linn@xilinx.com> Tested-by: Michal Simek <monstr@monstr.eu> Acked-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/serial/uartlite.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c
index f0a6c61b17f7..e6639a95d276 100644
--- a/drivers/serial/uartlite.c
+++ b/drivers/serial/uartlite.c
@@ -86,7 +86,7 @@ static int ulite_receive(struct uart_port *port, int stat)
86 /* stats */ 86 /* stats */
87 if (stat & ULITE_STATUS_RXVALID) { 87 if (stat & ULITE_STATUS_RXVALID) {
88 port->icount.rx++; 88 port->icount.rx++;
89 ch = readb(port->membase + ULITE_RX); 89 ch = ioread32be(port->membase + ULITE_RX);
90 90
91 if (stat & ULITE_STATUS_PARITY) 91 if (stat & ULITE_STATUS_PARITY)
92 port->icount.parity++; 92 port->icount.parity++;
@@ -131,7 +131,7 @@ static int ulite_transmit(struct uart_port *port, int stat)
131 return 0; 131 return 0;
132 132
133 if (port->x_char) { 133 if (port->x_char) {
134 writeb(port->x_char, port->membase + ULITE_TX); 134 iowrite32be(port->x_char, port->membase + ULITE_TX);
135 port->x_char = 0; 135 port->x_char = 0;
136 port->icount.tx++; 136 port->icount.tx++;
137 return 1; 137 return 1;
@@ -140,7 +140,7 @@ static int ulite_transmit(struct uart_port *port, int stat)
140 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) 140 if (uart_circ_empty(xmit) || uart_tx_stopped(port))
141 return 0; 141 return 0;
142 142
143 writeb(xmit->buf[xmit->tail], port->membase + ULITE_TX); 143 iowrite32be(xmit->buf[xmit->tail], port->membase + ULITE_TX);
144 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE-1); 144 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE-1);
145 port->icount.tx++; 145 port->icount.tx++;
146 146
@@ -157,7 +157,7 @@ static irqreturn_t ulite_isr(int irq, void *dev_id)
157 int busy, n = 0; 157 int busy, n = 0;
158 158
159 do { 159 do {
160 int stat = readb(port->membase + ULITE_STATUS); 160 int stat = ioread32be(port->membase + ULITE_STATUS);
161 busy = ulite_receive(port, stat); 161 busy = ulite_receive(port, stat);
162 busy |= ulite_transmit(port, stat); 162 busy |= ulite_transmit(port, stat);
163 n++; 163 n++;
@@ -178,7 +178,7 @@ static unsigned int ulite_tx_empty(struct uart_port *port)
178 unsigned int ret; 178 unsigned int ret;
179 179
180 spin_lock_irqsave(&port->lock, flags); 180 spin_lock_irqsave(&port->lock, flags);
181 ret = readb(port->membase + ULITE_STATUS); 181 ret = ioread32be(port->membase + ULITE_STATUS);
182 spin_unlock_irqrestore(&port->lock, flags); 182 spin_unlock_irqrestore(&port->lock, flags);
183 183
184 return ret & ULITE_STATUS_TXEMPTY ? TIOCSER_TEMT : 0; 184 return ret & ULITE_STATUS_TXEMPTY ? TIOCSER_TEMT : 0;
@@ -201,7 +201,7 @@ static void ulite_stop_tx(struct uart_port *port)
201 201
202static void ulite_start_tx(struct uart_port *port) 202static void ulite_start_tx(struct uart_port *port)
203{ 203{
204 ulite_transmit(port, readb(port->membase + ULITE_STATUS)); 204 ulite_transmit(port, ioread32be(port->membase + ULITE_STATUS));
205} 205}
206 206
207static void ulite_stop_rx(struct uart_port *port) 207static void ulite_stop_rx(struct uart_port *port)
@@ -230,17 +230,17 @@ static int ulite_startup(struct uart_port *port)
230 if (ret) 230 if (ret)
231 return ret; 231 return ret;
232 232
233 writeb(ULITE_CONTROL_RST_RX | ULITE_CONTROL_RST_TX, 233 iowrite32be(ULITE_CONTROL_RST_RX | ULITE_CONTROL_RST_TX,
234 port->membase + ULITE_CONTROL); 234 port->membase + ULITE_CONTROL);
235 writeb(ULITE_CONTROL_IE, port->membase + ULITE_CONTROL); 235 iowrite32be(ULITE_CONTROL_IE, port->membase + ULITE_CONTROL);
236 236
237 return 0; 237 return 0;
238} 238}
239 239
240static void ulite_shutdown(struct uart_port *port) 240static void ulite_shutdown(struct uart_port *port)
241{ 241{
242 writeb(0, port->membase + ULITE_CONTROL); 242 iowrite32be(0, port->membase + ULITE_CONTROL);
243 readb(port->membase + ULITE_CONTROL); /* dummy */ 243 ioread32be(port->membase + ULITE_CONTROL); /* dummy */
244 free_irq(port->irq, port); 244 free_irq(port->irq, port);
245} 245}
246 246
@@ -352,7 +352,7 @@ static void ulite_console_wait_tx(struct uart_port *port)
352 352
353 /* Spin waiting for TX fifo to have space available */ 353 /* Spin waiting for TX fifo to have space available */
354 for (i = 0; i < 100000; i++) { 354 for (i = 0; i < 100000; i++) {
355 val = readb(port->membase + ULITE_STATUS); 355 val = ioread32be(port->membase + ULITE_STATUS);
356 if ((val & ULITE_STATUS_TXFULL) == 0) 356 if ((val & ULITE_STATUS_TXFULL) == 0)
357 break; 357 break;
358 cpu_relax(); 358 cpu_relax();
@@ -362,7 +362,7 @@ static void ulite_console_wait_tx(struct uart_port *port)
362static void ulite_console_putchar(struct uart_port *port, int ch) 362static void ulite_console_putchar(struct uart_port *port, int ch)
363{ 363{
364 ulite_console_wait_tx(port); 364 ulite_console_wait_tx(port);
365 writeb(ch, port->membase + ULITE_TX); 365 iowrite32be(ch, port->membase + ULITE_TX);
366} 366}
367 367
368static void ulite_console_write(struct console *co, const char *s, 368static void ulite_console_write(struct console *co, const char *s,
@@ -379,8 +379,8 @@ static void ulite_console_write(struct console *co, const char *s,
379 spin_lock_irqsave(&port->lock, flags); 379 spin_lock_irqsave(&port->lock, flags);
380 380
381 /* save and disable interrupt */ 381 /* save and disable interrupt */
382 ier = readb(port->membase + ULITE_STATUS) & ULITE_STATUS_IE; 382 ier = ioread32be(port->membase + ULITE_STATUS) & ULITE_STATUS_IE;
383 writeb(0, port->membase + ULITE_CONTROL); 383 iowrite32be(0, port->membase + ULITE_CONTROL);
384 384
385 uart_console_write(port, s, count, ulite_console_putchar); 385 uart_console_write(port, s, count, ulite_console_putchar);
386 386
@@ -388,7 +388,7 @@ static void ulite_console_write(struct console *co, const char *s,
388 388
389 /* restore interrupt state */ 389 /* restore interrupt state */
390 if (ier) 390 if (ier)
391 writeb(ULITE_CONTROL_IE, port->membase + ULITE_CONTROL); 391 iowrite32be(ULITE_CONTROL_IE, port->membase + ULITE_CONTROL);
392 392
393 if (locked) 393 if (locked)
394 spin_unlock_irqrestore(&port->lock, flags); 394 spin_unlock_irqrestore(&port->lock, flags);
@@ -601,7 +601,7 @@ ulite_of_probe(struct of_device *op, const struct of_device_id *match)
601 601
602 id = of_get_property(op->node, "port-number", NULL); 602 id = of_get_property(op->node, "port-number", NULL);
603 603
604 return ulite_assign(&op->dev, id ? *id : -1, res.start+3, irq); 604 return ulite_assign(&op->dev, id ? *id : -1, res.start, irq);
605} 605}
606 606
607static int __devexit ulite_of_remove(struct of_device *op) 607static int __devexit ulite_of_remove(struct of_device *op)