@@ -572,6 +572,23 @@ static struct omap_uart_state omap_uart[] = {
#endif
};
+/*
+ * Override 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_override(struct uart_port *up, int offset)
+{
+ if (UART_RX == offset) {
+ unsigned int lsr;
+ lsr = serial_read_reg(omap_uart[up->line].p, UART_LSR);
+ if (!(lsr & UART_LSR_DR))
+ return -EPERM;
+ }
+ return serial_read_reg(omap_uart[up->line].p, offset);
+}
+
void __init omap_serial_early_init(void)
{
int i;
@@ -627,6 +644,10 @@ void __init omap_serial_early_init(void)
if (cpu_is_omap44xx())
p->irq += 32;
+ /* Do not read empty UART fifo on omap3630/omap4 */
+ if (omap3_has_uart_no_empty_fifo_read())
+ p->serial_in = serial_in_override;
+
omap_uart_enable_clocks(uart);
}
}