diff options
author | Tony Lindgren <tony@atomide.com> | 2010-12-22 21:42:35 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2010-12-22 21:42:35 -0500 |
commit | 40e44399301b6dbd997408a184140b79b77f632d (patch) | |
tree | 0daf60d3c9f49fd1b5e7b34811a519ded2a89927 /arch/arm/mach-omap2/serial.c | |
parent | 8d9af88f55be89fa4c897ded3204ef12c947731e (diff) |
omap2+: Add struct omap_board_data and use it for platform level serial init
This is needed to pass board specific data such as pads used to the
platform level driver init code.
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/serial.c')
-rw-r--r-- | arch/arm/mach-omap2/serial.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index c8740ba4fba5..c64578853a8d 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include "cm2xxx_3xxx.h" | 45 | #include "cm2xxx_3xxx.h" |
46 | #include "prm-regbits-34xx.h" | 46 | #include "prm-regbits-34xx.h" |
47 | #include "control.h" | 47 | #include "control.h" |
48 | #include "mux.h" | ||
48 | 49 | ||
49 | #define UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV 0x52 | 50 | #define UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV 0x52 |
50 | #define UART_OMAP_WER 0x17 /* Wake-up enable register */ | 51 | #define UART_OMAP_WER 0x17 /* Wake-up enable register */ |
@@ -694,16 +695,16 @@ void __init omap_serial_early_init(void) | |||
694 | 695 | ||
695 | /** | 696 | /** |
696 | * omap_serial_init_port() - initialize single serial port | 697 | * omap_serial_init_port() - initialize single serial port |
697 | * @port: serial port number (0-3) | 698 | * @bdata: port specific board data pointer |
698 | * | 699 | * |
699 | * This function initialies serial driver for given @port only. | 700 | * This function initialies serial driver for given port only. |
700 | * Platforms can call this function instead of omap_serial_init() | 701 | * Platforms can call this function instead of omap_serial_init() |
701 | * if they don't plan to use all available UARTs as serial ports. | 702 | * if they don't plan to use all available UARTs as serial ports. |
702 | * | 703 | * |
703 | * Don't mix calls to omap_serial_init_port() and omap_serial_init(), | 704 | * Don't mix calls to omap_serial_init_port() and omap_serial_init(), |
704 | * use only one of the two. | 705 | * use only one of the two. |
705 | */ | 706 | */ |
706 | void __init omap_serial_init_port(int port) | 707 | void __init omap_serial_init_port(struct omap_board_data *bdata) |
707 | { | 708 | { |
708 | struct omap_uart_state *uart; | 709 | struct omap_uart_state *uart; |
709 | struct omap_hwmod *oh; | 710 | struct omap_hwmod *oh; |
@@ -721,13 +722,15 @@ void __init omap_serial_init_port(int port) | |||
721 | struct omap_uart_port_info omap_up; | 722 | struct omap_uart_port_info omap_up; |
722 | #endif | 723 | #endif |
723 | 724 | ||
724 | if (WARN_ON(port < 0)) | 725 | if (WARN_ON(!bdata)) |
725 | return; | 726 | return; |
726 | if (WARN_ON(port >= num_uarts)) | 727 | if (WARN_ON(bdata->id < 0)) |
728 | return; | ||
729 | if (WARN_ON(bdata->id >= num_uarts)) | ||
727 | return; | 730 | return; |
728 | 731 | ||
729 | list_for_each_entry(uart, &uart_list, node) | 732 | list_for_each_entry(uart, &uart_list, node) |
730 | if (port == uart->num) | 733 | if (bdata->id == uart->num) |
731 | break; | 734 | break; |
732 | 735 | ||
733 | oh = uart->oh; | 736 | oh = uart->oh; |
@@ -799,6 +802,8 @@ void __init omap_serial_init_port(int port) | |||
799 | WARN(IS_ERR(od), "Could not build omap_device for %s: %s.\n", | 802 | WARN(IS_ERR(od), "Could not build omap_device for %s: %s.\n", |
800 | name, oh->name); | 803 | name, oh->name); |
801 | 804 | ||
805 | oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt); | ||
806 | |||
802 | uart->irq = oh->mpu_irqs[0].irq; | 807 | uart->irq = oh->mpu_irqs[0].irq; |
803 | uart->regshift = 2; | 808 | uart->regshift = 2; |
804 | uart->mapbase = oh->slaves[0]->addr->pa_start; | 809 | uart->mapbase = oh->slaves[0]->addr->pa_start; |
@@ -856,7 +861,14 @@ void __init omap_serial_init_port(int port) | |||
856 | void __init omap_serial_init(void) | 861 | void __init omap_serial_init(void) |
857 | { | 862 | { |
858 | struct omap_uart_state *uart; | 863 | struct omap_uart_state *uart; |
864 | struct omap_board_data bdata; | ||
859 | 865 | ||
860 | list_for_each_entry(uart, &uart_list, node) | 866 | list_for_each_entry(uart, &uart_list, node) { |
861 | omap_serial_init_port(uart->num); | 867 | bdata.id = uart->num; |
868 | bdata.flags = 0; | ||
869 | bdata.pads = NULL; | ||
870 | bdata.pads_cnt = 0; | ||
871 | omap_serial_init_port(&bdata); | ||
872 | |||
873 | } | ||
862 | } | 874 | } |