Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 184765
b: refs/heads/master
c: e03d37d
h: refs/heads/master
i:
  184763: f99cf69
v: v3
  • Loading branch information
Santosh Shilimkar authored and Tony Lindgren committed Feb 23, 2010
1 parent 7a5b97d commit 7b6a529
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ae46ec77311b550be992339c1e01fc20bc65296e
refs/heads/master: e03d37d85909fd9b09e78087c57b45972a7664ad
31 changes: 28 additions & 3 deletions trunk/arch/arm/mach-omap2/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <linux/serial_reg.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/delay.h>

#include <plat/common.h>
#include <plat/board.h>
Expand Down Expand Up @@ -160,6 +161,13 @@ static inline unsigned int serial_read_reg(struct plat_serial8250_port *up,
return (unsigned int)__raw_readb(up->membase + offset);
}

static inline void __serial_write_reg(struct uart_port *up, int offset,
int value)
{
offset <<= up->regshift;
__raw_writeb(value, up->membase + offset);
}

static inline void serial_write_reg(struct plat_serial8250_port *p, int offset,
int value)
{
Expand Down Expand Up @@ -620,6 +628,20 @@ static unsigned int serial_in_override(struct uart_port *up, int offset)
return __serial_read_reg(up, offset);
}

static void serial_out_override(struct uart_port *up, int offset, int value)
{
unsigned int status, tmout = 10000;

status = __serial_read_reg(up, UART_LSR);
while (!(status & UART_LSR_THRE)) {
/* Wait up to 10ms for the character(s) to be sent. */
if (--tmout == 0)
break;
udelay(1);
status = __serial_read_reg(up, UART_LSR);
}
__serial_write_reg(up, offset, value);
}
void __init omap_serial_early_init(void)
{
int i;
Expand Down Expand Up @@ -721,11 +743,14 @@ void __init omap_serial_init_port(int port)
* omap3xxx: Never read empty UART fifo on UARTs
* with IP rev >=0x52
*/
if (cpu_is_omap44xx())
if (cpu_is_omap44xx()) {
uart->p->serial_in = serial_in_override;
else if ((serial_read_reg(uart->p, UART_OMAP_MVER) & 0xFF)
>= UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV)
uart->p->serial_out = serial_out_override;
} else if ((serial_read_reg(uart->p, UART_OMAP_MVER) & 0xFF)
>= UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV) {
uart->p->serial_in = serial_in_override;
uart->p->serial_out = serial_out_override;
}
}

/**
Expand Down

0 comments on commit 7b6a529

Please sign in to comment.