aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMika Westerberg <ext-mika.1.westerberg@nokia.com>2009-12-11 19:16:35 -0500
committerTony Lindgren <tony@atomide.com>2009-12-11 19:16:35 -0500
commitf62349ee9788b1d94c55eb6c291d74a1f69bdd9e (patch)
tree193154ad405a30910684c5521b797908db4e5dc9
parentedc961a2fa51cf3fceba8df8bb52c7a048e4661b (diff)
OMAP3: serial - allow platforms specify which UARTs to initialize
This patch adds new function: omap_serial_init_port(port) that can be used to initialize only selected UARTs as serial ports. Platforms can then in their board files call this function instead of omap_serial_init() if they don't want to use all UARTs as serial ports. Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r--arch/arm/mach-omap2/serial.c70
-rw-r--r--arch/arm/plat-omap/include/plat/serial.h1
2 files changed, 56 insertions, 15 deletions
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 2e17b57f5b23..6278fe585c05 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -631,24 +631,64 @@ void __init omap_serial_early_init(void)
631 } 631 }
632} 632}
633 633
634void __init omap_serial_init(void) 634/**
635 * omap_serial_init_port() - initialize single serial port
636 * @port: serial port number (0-3)
637 *
638 * This function initialies serial driver for given @port only.
639 * Platforms can call this function instead of omap_serial_init()
640 * if they don't plan to use all available UARTs as serial ports.
641 *
642 * Don't mix calls to omap_serial_init_port() and omap_serial_init(),
643 * use only one of the two.
644 */
645void __init omap_serial_init_port(int port)
635{ 646{
636 int i; 647 struct omap_uart_state *uart;
648 struct platform_device *pdev;
649 struct device *dev;
637 650
638 for (i = 0; i < ARRAY_SIZE(omap_uart); i++) { 651 BUG_ON(port < 0);
639 struct omap_uart_state *uart = &omap_uart[i]; 652 BUG_ON(port >= ARRAY_SIZE(omap_uart));
640 struct platform_device *pdev = &uart->pdev;
641 struct device *dev = &pdev->dev;
642 653
643 omap_uart_reset(uart); 654 uart = &omap_uart[port];
644 omap_uart_idle_init(uart); 655 pdev = &uart->pdev;
656 dev = &pdev->dev;
645 657
646 if (WARN_ON(platform_device_register(pdev))) 658 omap_uart_reset(uart);
647 continue; 659 omap_uart_idle_init(uart);
648 if ((cpu_is_omap34xx() && uart->padconf) || 660
649 (uart->wk_en && uart->wk_mask)) { 661 if (WARN_ON(platform_device_register(pdev)))
650 device_init_wakeup(dev, true); 662 return;
651 DEV_CREATE_FILE(dev, &dev_attr_sleep_timeout); 663
652 } 664 if ((cpu_is_omap34xx() && uart->padconf) ||
665 (uart->wk_en && uart->wk_mask)) {
666 device_init_wakeup(dev, true);
667 DEV_CREATE_FILE(dev, &dev_attr_sleep_timeout);
653 } 668 }
669
670 /* omap44xx: Never read empty UART fifo
671 * omap3xxx: Never read empty UART fifo on UARTs
672 * with IP rev >=0x52
673 */
674 if (cpu_is_omap44xx())
675 uart->p->serial_in = serial_in_override;
676 else if ((serial_read_reg(uart->p, UART_OMAP_MVER) & 0xFF)
677 >= UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV)
678 uart->p->serial_in = serial_in_override;
679}
680
681/**
682 * omap_serial_init() - intialize all supported serial ports
683 *
684 * Initializes all available UARTs as serial ports. Platforms
685 * can call this function when they want to have default behaviour
686 * for serial ports (e.g initialize them all as serial ports).
687 */
688void __init omap_serial_init(void)
689{
690 int i;
691
692 for (i = 0; i < ARRAY_SIZE(omap_uart); i++)
693 omap_serial_init_port(i);
654} 694}
diff --git a/arch/arm/plat-omap/include/plat/serial.h b/arch/arm/plat-omap/include/plat/serial.h
index 9951345a25d6..f5a4a92393ef 100644
--- a/arch/arm/plat-omap/include/plat/serial.h
+++ b/arch/arm/plat-omap/include/plat/serial.h
@@ -53,6 +53,7 @@
53#ifndef __ASSEMBLER__ 53#ifndef __ASSEMBLER__
54extern void __init omap_serial_early_init(void); 54extern void __init omap_serial_early_init(void);
55extern void omap_serial_init(void); 55extern void omap_serial_init(void);
56extern void omap_serial_init_port(int port);
56extern int omap_uart_can_sleep(void); 57extern int omap_uart_can_sleep(void);
57extern void omap_uart_check_wakeup(void); 58extern void omap_uart_check_wakeup(void);
58extern void omap_uart_prepare_suspend(void); 59extern void omap_uart_prepare_suspend(void);