diff options
| -rw-r--r-- | arch/arm/mach-omap2/serial.c | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 6278fe585c05..39b797bc14d6 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | #include "pm.h" | 33 | #include "pm.h" |
| 34 | #include "prm-regbits-34xx.h" | 34 | #include "prm-regbits-34xx.h" |
| 35 | 35 | ||
| 36 | #define UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV 0x52 | ||
| 36 | #define UART_OMAP_WER 0x17 /* Wake-up enable register */ | 37 | #define UART_OMAP_WER 0x17 /* Wake-up enable register */ |
| 37 | 38 | ||
| 38 | #define DEFAULT_TIMEOUT (5 * HZ) | 39 | #define DEFAULT_TIMEOUT (5 * HZ) |
| @@ -572,6 +573,23 @@ static struct omap_uart_state omap_uart[] = { | |||
| 572 | #endif | 573 | #endif |
| 573 | }; | 574 | }; |
| 574 | 575 | ||
| 576 | /* | ||
| 577 | * Override the default 8250 read handler: mem_serial_in() | ||
| 578 | * Empty RX fifo read causes an abort on omap3630 and omap4 | ||
| 579 | * This function makes sure that an empty rx fifo is not read on these silicons | ||
| 580 | * (OMAP1/2/3430 are not affected) | ||
| 581 | */ | ||
| 582 | static unsigned int serial_in_override(struct uart_port *up, int offset) | ||
| 583 | { | ||
| 584 | if (UART_RX == offset) { | ||
| 585 | unsigned int lsr; | ||
| 586 | lsr = serial_read_reg(omap_uart[up->line].p, UART_LSR); | ||
| 587 | if (!(lsr & UART_LSR_DR)) | ||
| 588 | return -EPERM; | ||
| 589 | } | ||
| 590 | return serial_read_reg(omap_uart[up->line].p, offset); | ||
| 591 | } | ||
| 592 | |||
| 575 | void __init omap_serial_early_init(void) | 593 | void __init omap_serial_early_init(void) |
| 576 | { | 594 | { |
| 577 | int i; | 595 | int i; |
| @@ -667,15 +685,15 @@ void __init omap_serial_init_port(int port) | |||
| 667 | DEV_CREATE_FILE(dev, &dev_attr_sleep_timeout); | 685 | DEV_CREATE_FILE(dev, &dev_attr_sleep_timeout); |
| 668 | } | 686 | } |
| 669 | 687 | ||
| 670 | /* omap44xx: Never read empty UART fifo | 688 | /* omap44xx: Never read empty UART fifo |
| 671 | * omap3xxx: Never read empty UART fifo on UARTs | 689 | * omap3xxx: Never read empty UART fifo on UARTs |
| 672 | * with IP rev >=0x52 | 690 | * with IP rev >=0x52 |
| 673 | */ | 691 | */ |
| 674 | if (cpu_is_omap44xx()) | 692 | if (cpu_is_omap44xx()) |
| 675 | uart->p->serial_in = serial_in_override; | 693 | uart->p->serial_in = serial_in_override; |
| 676 | else if ((serial_read_reg(uart->p, UART_OMAP_MVER) & 0xFF) | 694 | else if ((serial_read_reg(uart->p, UART_OMAP_MVER) & 0xFF) |
| 677 | >= UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV) | 695 | >= UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV) |
| 678 | uart->p->serial_in = serial_in_override; | 696 | uart->p->serial_in = serial_in_override; |
| 679 | } | 697 | } |
| 680 | 698 | ||
| 681 | /** | 699 | /** |
