Skip to content

Commit

Permalink
[POWERPC] Uartlite: Revert register io access changes
Browse files Browse the repository at this point in the history
Reverts commit a15da8e

This driver is used by devices other than the xilinx opb-uartlite which
depend on bytewise access to the registers.  The change to 32 bit access
does not work on these devices.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
  • Loading branch information
Grant Likely authored and Josh Boyer committed Oct 3, 2007
1 parent be1b4d3 commit e077b50
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion arch/ppc/syslib/virtex_devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
.num_resources = 2, \
.resource = (struct resource[]) { \
{ \
.start = XPAR_UARTLITE_##num##_BASEADDR, \
.start = XPAR_UARTLITE_##num##_BASEADDR + 3, \
.end = XPAR_UARTLITE_##num##_HIGHADDR, \
.flags = IORESOURCE_MEM, \
}, \
Expand Down
36 changes: 18 additions & 18 deletions drivers/serial/uartlite.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static int ulite_receive(struct uart_port *port, int stat)
/* stats */
if (stat & ULITE_STATUS_RXVALID) {
port->icount.rx++;
ch = in_be32((void*)port->membase + ULITE_RX);
ch = readb(port->membase + ULITE_RX);

if (stat & ULITE_STATUS_PARITY)
port->icount.parity++;
Expand Down Expand Up @@ -120,7 +120,7 @@ static int ulite_transmit(struct uart_port *port, int stat)
return 0;

if (port->x_char) {
out_be32((void*)port->membase + ULITE_TX, port->x_char);
writeb(port->x_char, port->membase + ULITE_TX);
port->x_char = 0;
port->icount.tx++;
return 1;
Expand All @@ -129,7 +129,7 @@ static int ulite_transmit(struct uart_port *port, int stat)
if (uart_circ_empty(xmit) || uart_tx_stopped(port))
return 0;

out_be32((void*)port->membase + ULITE_TX, xmit->buf[xmit->tail]);
writeb(xmit->buf[xmit->tail], port->membase + ULITE_TX);
xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE-1);
port->icount.tx++;

Expand All @@ -146,7 +146,7 @@ static irqreturn_t ulite_isr(int irq, void *dev_id)
int busy;

do {
int stat = in_be32((void*)port->membase + ULITE_STATUS);
int stat = readb(port->membase + ULITE_STATUS);
busy = ulite_receive(port, stat);
busy |= ulite_transmit(port, stat);
} while (busy);
Expand All @@ -162,7 +162,7 @@ static unsigned int ulite_tx_empty(struct uart_port *port)
unsigned int ret;

spin_lock_irqsave(&port->lock, flags);
ret = in_be32((void*)port->membase + ULITE_STATUS);
ret = readb(port->membase + ULITE_STATUS);
spin_unlock_irqrestore(&port->lock, flags);

return ret & ULITE_STATUS_TXEMPTY ? TIOCSER_TEMT : 0;
Expand All @@ -185,7 +185,7 @@ static void ulite_stop_tx(struct uart_port *port)

static void ulite_start_tx(struct uart_port *port)
{
ulite_transmit(port, in_be32((void*)port->membase + ULITE_STATUS));
ulite_transmit(port, readb(port->membase + ULITE_STATUS));
}

static void ulite_stop_rx(struct uart_port *port)
Expand Down Expand Up @@ -214,17 +214,17 @@ static int ulite_startup(struct uart_port *port)
if (ret)
return ret;

out_be32((void*)port->membase + ULITE_CONTROL,
ULITE_CONTROL_RST_RX | ULITE_CONTROL_RST_TX);
out_be32((void*)port->membase + ULITE_CONTROL, ULITE_CONTROL_IE);
writeb(ULITE_CONTROL_RST_RX | ULITE_CONTROL_RST_TX,
port->membase + ULITE_CONTROL);
writeb(ULITE_CONTROL_IE, port->membase + ULITE_CONTROL);

return 0;
}

static void ulite_shutdown(struct uart_port *port)
{
out_be32((void*)port->membase + ULITE_CONTROL, 0);
in_be32((void*)port->membase + ULITE_CONTROL); /* dummy */
writeb(0, port->membase + ULITE_CONTROL);
readb(port->membase + ULITE_CONTROL); /* dummy */
free_irq(port->irq, port);
}

Expand Down Expand Up @@ -332,7 +332,7 @@ static void ulite_console_wait_tx(struct uart_port *port)

/* wait up to 10ms for the character(s) to be sent */
for (i = 0; i < 10000; i++) {
if (in_be32((void*)port->membase + ULITE_STATUS) & ULITE_STATUS_TXEMPTY)
if (readb(port->membase + ULITE_STATUS) & ULITE_STATUS_TXEMPTY)
break;
udelay(1);
}
Expand All @@ -341,7 +341,7 @@ static void ulite_console_wait_tx(struct uart_port *port)
static void ulite_console_putchar(struct uart_port *port, int ch)
{
ulite_console_wait_tx(port);
out_be32((void*)port->membase + ULITE_TX, ch);
writeb(ch, port->membase + ULITE_TX);
}

static void ulite_console_write(struct console *co, const char *s,
Expand All @@ -358,16 +358,16 @@ static void ulite_console_write(struct console *co, const char *s,
spin_lock_irqsave(&port->lock, flags);

/* save and disable interrupt */
ier = in_be32((void*)port->membase + ULITE_STATUS) & ULITE_STATUS_IE;
out_be32((void*)port->membase + ULITE_CONTROL, 0);
ier = readb(port->membase + ULITE_STATUS) & ULITE_STATUS_IE;
writeb(0, port->membase + ULITE_CONTROL);

uart_console_write(port, s, count, ulite_console_putchar);

ulite_console_wait_tx(port);

/* restore interrupt state */
if (ier)
out_be32((void*)port->membase + ULITE_CONTROL, ULITE_CONTROL_IE);
writeb(ULITE_CONTROL_IE, port->membase + ULITE_CONTROL);

if (locked)
spin_unlock_irqrestore(&port->lock, flags);
Expand Down Expand Up @@ -598,15 +598,15 @@ ulite_of_probe(struct of_device *op, const struct of_device_id *match)

rc = of_address_to_resource(op->node, 0, &res);
if (rc) {
dev_err(&op->dev, "invalide address\n");
dev_err(&op->dev, "invalid address\n");
return rc;
}

irq = irq_of_parse_and_map(op->node, 0);

id = of_get_property(op->node, "port-number", NULL);

return ulite_assign(&op->dev, id ? *id : -1, res.start, irq);
return ulite_assign(&op->dev, id ? *id : -1, res.start+3, irq);
}

static int __devexit ulite_of_remove(struct of_device *op)
Expand Down

0 comments on commit e077b50

Please sign in to comment.