aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2010-12-22 21:42:35 -0500
committerTony Lindgren <tony@atomide.com>2010-12-22 21:42:35 -0500
commit40e44399301b6dbd997408a184140b79b77f632d (patch)
tree0daf60d3c9f49fd1b5e7b34811a519ded2a89927 /arch/arm
parent8d9af88f55be89fa4c897ded3204ef12c947731e (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')
-rw-r--r--arch/arm/mach-omap2/mux.h14
-rw-r--r--arch/arm/mach-omap2/serial.c28
-rw-r--r--arch/arm/plat-omap/include/plat/serial.h5
3 files changed, 38 insertions, 9 deletions
diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h
index c9ec50de99c9..a4ab17a737a6 100644
--- a/arch/arm/mach-omap2/mux.h
+++ b/arch/arm/mach-omap2/mux.h
@@ -87,6 +87,20 @@
87#define OMAP_MUX_GPIO_IN_MODE3 (1 << 1) 87#define OMAP_MUX_GPIO_IN_MODE3 (1 << 1)
88 88
89/** 89/**
90 * struct omap_board_data - board specific device data
91 * @id: instance id
92 * @flags: additional flags for platform init code
93 * @pads: array of device specific pads
94 * @pads_cnt: ARRAY_SIZE() of pads
95 */
96struct omap_board_data {
97 int id;
98 u32 flags;
99 struct omap_device_pad *pads;
100 int pads_cnt;
101};
102
103/**
90 * struct mux_partition - contain partition related information 104 * struct mux_partition - contain partition related information
91 * @name: name of the current partition 105 * @name: name of the current partition
92 * @flags: flags specific to this partition 106 * @flags: flags specific to this partition
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 */
706void __init omap_serial_init_port(int port) 707void __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)
856void __init omap_serial_init(void) 861void __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}
diff --git a/arch/arm/plat-omap/include/plat/serial.h b/arch/arm/plat-omap/include/plat/serial.h
index 19145f5c32ba..cec5d56db2eb 100644
--- a/arch/arm/plat-omap/include/plat/serial.h
+++ b/arch/arm/plat-omap/include/plat/serial.h
@@ -93,9 +93,12 @@
93 }) 93 })
94 94
95#ifndef __ASSEMBLER__ 95#ifndef __ASSEMBLER__
96
97struct omap_board_data;
98
96extern void __init omap_serial_early_init(void); 99extern void __init omap_serial_early_init(void);
97extern void omap_serial_init(void); 100extern void omap_serial_init(void);
98extern void omap_serial_init_port(int port); 101extern void omap_serial_init_port(struct omap_board_data *bdata);
99extern int omap_uart_can_sleep(void); 102extern int omap_uart_can_sleep(void);
100extern void omap_uart_check_wakeup(void); 103extern void omap_uart_check_wakeup(void);
101extern void omap_uart_prepare_suspend(void); 104extern void omap_uart_prepare_suspend(void);