aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/serial.c
diff options
context:
space:
mode:
authorGovindraj.R <govindraj.raja@ti.com>2011-09-13 04:02:32 -0400
committerKevin Hilman <khilman@ti.com>2011-12-14 18:49:01 -0500
commit8a60585159067f110075ef8ffda13abd94826daf (patch)
treefc5357883845fd81bcadbcd7976e42d73e37ce11 /arch/arm/mach-omap2/serial.c
parent8384c9749f8c31c6e1e64a63c8d50af7863ce657 (diff)
ARM: OMAP2+: UART: cleanup 8250 console driver support
We had been using traditional 8250 driver as uart console driver prior to omap-serial driver. Since we have omap-serial driver in mainline kernel for some time now it has been used as default uart console driver on omap2+ platforms. Remove 8250 support for omap-uarts. Serial_in and serial_out override for 8250 serial driver is also removed. Empty fifo read fix is already taken care with omap-serial driver with data ready bit check from LSR reg before reading RX fifo. Also waiting for THRE(transmit hold reg empty) is done with wait_for_xmitr in omap-serial driver. Serial_in/out overrides are not neceesary for omap-serial driver and things that are taken with omap-serial driver are removed here. Remove headers that were necessary to support 8250 support and remove all config bindings done to keep 8250 backward compatibility while adding omap-serial driver. Remove omap_uart_reset needed for 8250 autoconf. Signed-off-by: Govindraj.R <govindraj.raja@ti.com> Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/serial.c')
-rw-r--r--arch/arm/mach-omap2/serial.c97
1 files changed, 0 insertions, 97 deletions
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 6378a2a5d6b1..e027bc99251c 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -19,23 +19,17 @@
19 */ 19 */
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/serial_reg.h>
23#include <linux/clk.h> 22#include <linux/clk.h>
24#include <linux/io.h> 23#include <linux/io.h>
25#include <linux/delay.h> 24#include <linux/delay.h>
26#include <linux/platform_device.h> 25#include <linux/platform_device.h>
27#include <linux/slab.h> 26#include <linux/slab.h>
28#include <linux/serial_8250.h>
29#include <linux/pm_runtime.h> 27#include <linux/pm_runtime.h>
30#include <linux/console.h> 28#include <linux/console.h>
31 29
32#ifdef CONFIG_SERIAL_OMAP
33#include <plat/omap-serial.h> 30#include <plat/omap-serial.h>
34#endif
35
36#include "common.h" 31#include "common.h"
37#include <plat/board.h> 32#include <plat/board.h>
38#include <plat/clock.h>
39#include <plat/dma.h> 33#include <plat/dma.h>
40#include <plat/omap_hwmod.h> 34#include <plat/omap_hwmod.h>
41#include <plat/omap_device.h> 35#include <plat/omap_device.h>
@@ -47,10 +41,8 @@
47#include "control.h" 41#include "control.h"
48#include "mux.h" 42#include "mux.h"
49 43
50#define UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV 0x52
51#define UART_OMAP_WER 0x17 /* Wake-up enable register */ 44#define UART_OMAP_WER 0x17 /* Wake-up enable register */
52 45
53#define UART_ERRATA_FIFO_FULL_ABORT (0x1 << 0)
54#define UART_ERRATA_i202_MDR1_ACCESS (0x1 << 1) 46#define UART_ERRATA_i202_MDR1_ACCESS (0x1 << 1)
55 47
56/* 48/*
@@ -533,41 +525,6 @@ static void omap_uart_block_sleep(struct omap_uart_state *uart)
533#define DEV_CREATE_FILE(dev, attr) 525#define DEV_CREATE_FILE(dev, attr)
534#endif /* CONFIG_PM */ 526#endif /* CONFIG_PM */
535 527
536#ifndef CONFIG_SERIAL_OMAP
537/*
538 * Override the default 8250 read handler: mem_serial_in()
539 * Empty RX fifo read causes an abort on omap3630 and omap4
540 * This function makes sure that an empty rx fifo is not read on these silicons
541 * (OMAP1/2/3430 are not affected)
542 */
543static unsigned int serial_in_override(struct uart_port *up, int offset)
544{
545 if (UART_RX == offset) {
546 unsigned int lsr;
547 lsr = __serial_read_reg(up, UART_LSR);
548 if (!(lsr & UART_LSR_DR))
549 return -EPERM;
550 }
551
552 return __serial_read_reg(up, offset);
553}
554
555static void serial_out_override(struct uart_port *up, int offset, int value)
556{
557 unsigned int status, tmout = 10000;
558
559 status = __serial_read_reg(up, UART_LSR);
560 while (!(status & UART_LSR_THRE)) {
561 /* Wait up to 10ms for the character(s) to be sent. */
562 if (--tmout == 0)
563 break;
564 udelay(1);
565 status = __serial_read_reg(up, UART_LSR);
566 }
567 __serial_write_reg(up, offset, value);
568}
569#endif
570
571static int __init omap_serial_early_init(void) 528static int __init omap_serial_early_init(void)
572{ 529{
573 int i = 0; 530 int i = 0;
@@ -628,15 +585,7 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
628 void *pdata = NULL; 585 void *pdata = NULL;
629 u32 pdata_size = 0; 586 u32 pdata_size = 0;
630 char *name; 587 char *name;
631#ifndef CONFIG_SERIAL_OMAP
632 struct plat_serial8250_port ports[2] = {
633 {},
634 {.flags = 0},
635 };
636 struct plat_serial8250_port *p = &ports[0];
637#else
638 struct omap_uart_port_info omap_up; 588 struct omap_uart_port_info omap_up;
639#endif
640 589
641 if (WARN_ON(!bdata)) 590 if (WARN_ON(!bdata))
642 return; 591 return;
@@ -651,51 +600,6 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
651 600
652 oh = uart->oh; 601 oh = uart->oh;
653 uart->dma_enabled = 0; 602 uart->dma_enabled = 0;
654#ifndef CONFIG_SERIAL_OMAP
655 name = "serial8250";
656
657 /*
658 * !! 8250 driver does not use standard IORESOURCE* It
659 * has it's own custom pdata that can be taken from
660 * the hwmod resource data. But, this needs to be
661 * done after the build.
662 *
663 * ?? does it have to be done before the register ??
664 * YES, because platform_device_data_add() copies
665 * pdata, it does not use a pointer.
666 */
667 p->flags = UPF_BOOT_AUTOCONF;
668 p->iotype = UPIO_MEM;
669 p->regshift = 2;
670 p->uartclk = OMAP24XX_BASE_BAUD * 16;
671 p->irq = oh->mpu_irqs[0].irq;
672 p->mapbase = oh->slaves[0]->addr->pa_start;
673 p->membase = omap_hwmod_get_mpu_rt_va(oh);
674 p->irqflags = IRQF_SHARED;
675 p->private_data = uart;
676
677 /*
678 * omap44xx, ti816x: Never read empty UART fifo
679 * omap3xxx: Never read empty UART fifo on UARTs
680 * with IP rev >=0x52
681 */
682 uart->regshift = p->regshift;
683 uart->membase = p->membase;
684 if (cpu_is_omap44xx() || cpu_is_ti81xx())
685 uart->errata |= UART_ERRATA_FIFO_FULL_ABORT;
686 else if ((serial_read_reg(uart, UART_OMAP_MVER) & 0xFF)
687 >= UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV)
688 uart->errata |= UART_ERRATA_FIFO_FULL_ABORT;
689
690 if (uart->errata & UART_ERRATA_FIFO_FULL_ABORT) {
691 p->serial_in = serial_in_override;
692 p->serial_out = serial_out_override;
693 }
694
695 pdata = &ports[0];
696 pdata_size = 2 * sizeof(struct plat_serial8250_port);
697#else
698
699 name = DRIVER_NAME; 603 name = DRIVER_NAME;
700 604
701 omap_up.dma_enabled = uart->dma_enabled; 605 omap_up.dma_enabled = uart->dma_enabled;
@@ -707,7 +611,6 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
707 611
708 pdata = &omap_up; 612 pdata = &omap_up;
709 pdata_size = sizeof(struct omap_uart_port_info); 613 pdata_size = sizeof(struct omap_uart_port_info);
710#endif
711 614
712 if (WARN_ON(!oh)) 615 if (WARN_ON(!oh))
713 return; 616 return;