@@ -71,6 +71,30 @@ struct omap_uart_state {
static LIST_HEAD(uart_list);
+static struct omap_uart_state omap_uart[];
+static inline unsigned int serial_read_reg(struct plat_serial8250_port *, int);
+
+/*
+ * Overrigt the default 8250 read handler: mem_serial_in()
+ * Empty RX fifo read causes an abort on omap3630 and omap4
+ * This function makes sure that an empty rx fifo is not read on these silicons
+ * (OMAP1/2/3 are not affected)
+ */
+static unsigned int serial_in_8250(struct uart_port *up, int offset)
+{
+ /* Do not read empty UART fifo on omap3630/44xx */
+ if ((UART_RX == offset) &&
+ (cpu_is_omap3630() || cpu_is_omap44xx())) {
+
+ unsigned int lsr;
+
+ lsr = serial_read_reg(omap_uart[up->line].p, UART_LSR);
+ if (!(lsr & UART_LSR_DR))
+ return 0;
+ }
+ return serial_read_reg(omap_uart[up->line].p, offset);
+}
+
static struct plat_serial8250_port serial_platform_data0[] = {
{
.mapbase = OMAP_UART1_BASE,
@@ -79,6 +103,7 @@ static struct plat_serial8250_port serial_platform_data0[] = {
.iotype = UPIO_MEM,
.regshift = 2,
.uartclk = OMAP24XX_BASE_BAUD * 16,
+ .serial_in = serial_in_8250,
}, {
.flags = 0
}
@@ -92,6 +117,7 @@ static struct plat_serial8250_port serial_platform_data1[] = {
.iotype = UPIO_MEM,
.regshift = 2,
.uartclk = OMAP24XX_BASE_BAUD * 16,
+ .serial_in = serial_in_8250,
}, {
.flags = 0
}
@@ -105,6 +131,7 @@ static struct plat_serial8250_port serial_platform_data2[] = {
.iotype = UPIO_MEM,
.regshift = 2,
.uartclk = OMAP24XX_BASE_BAUD * 16,
+ .serial_in = serial_in_8250,
}, {
.flags = 0
}
@@ -119,6 +146,7 @@ static struct plat_serial8250_port serial_platform_data3[] = {
.iotype = UPIO_MEM,
.regshift = 2,
.uartclk = OMAP24XX_BASE_BAUD * 16,
+ .serial_in = serial_in_8250,
}, {
.flags = 0
}