diff options
Diffstat (limited to 'arch/arm/mach-omap2/serial.c')
-rw-r--r-- | arch/arm/mach-omap2/serial.c | 67 |
1 files changed, 63 insertions, 4 deletions
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 292d4aaca068..c1b93c752d70 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c | |||
@@ -57,6 +57,7 @@ struct omap_uart_state { | |||
57 | 57 | ||
58 | struct list_head node; | 58 | struct list_head node; |
59 | struct omap_hwmod *oh; | 59 | struct omap_hwmod *oh; |
60 | struct omap_device_pad default_omap_uart_pads[2]; | ||
60 | }; | 61 | }; |
61 | 62 | ||
62 | static LIST_HEAD(uart_list); | 63 | static LIST_HEAD(uart_list); |
@@ -126,11 +127,70 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} | |||
126 | #endif /* CONFIG_PM */ | 127 | #endif /* CONFIG_PM */ |
127 | 128 | ||
128 | #ifdef CONFIG_OMAP_MUX | 129 | #ifdef CONFIG_OMAP_MUX |
129 | static void omap_serial_fill_default_pads(struct omap_board_data *bdata) | 130 | |
131 | #define OMAP_UART_DEFAULT_PAD_NAME_LEN 28 | ||
132 | static char rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN], | ||
133 | tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN] __initdata; | ||
134 | |||
135 | static void __init | ||
136 | omap_serial_fill_uart_tx_rx_pads(struct omap_board_data *bdata, | ||
137 | struct omap_uart_state *uart) | ||
138 | { | ||
139 | uart->default_omap_uart_pads[0].name = rx_pad_name; | ||
140 | uart->default_omap_uart_pads[0].flags = OMAP_DEVICE_PAD_REMUX | | ||
141 | OMAP_DEVICE_PAD_WAKEUP; | ||
142 | uart->default_omap_uart_pads[0].enable = OMAP_PIN_INPUT | | ||
143 | OMAP_MUX_MODE0; | ||
144 | uart->default_omap_uart_pads[0].idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0; | ||
145 | uart->default_omap_uart_pads[1].name = tx_pad_name; | ||
146 | uart->default_omap_uart_pads[1].enable = OMAP_PIN_OUTPUT | | ||
147 | OMAP_MUX_MODE0; | ||
148 | bdata->pads = uart->default_omap_uart_pads; | ||
149 | bdata->pads_cnt = ARRAY_SIZE(uart->default_omap_uart_pads); | ||
150 | } | ||
151 | |||
152 | static void __init omap_serial_check_wakeup(struct omap_board_data *bdata, | ||
153 | struct omap_uart_state *uart) | ||
130 | { | 154 | { |
155 | struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; | ||
156 | struct omap_mux *rx_mux = NULL, *tx_mux = NULL; | ||
157 | char *rx_fmt, *tx_fmt; | ||
158 | int uart_nr = bdata->id + 1; | ||
159 | |||
160 | if (bdata->id != 2) { | ||
161 | rx_fmt = "uart%d_rx.uart%d_rx"; | ||
162 | tx_fmt = "uart%d_tx.uart%d_tx"; | ||
163 | } else { | ||
164 | rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx"; | ||
165 | tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx"; | ||
166 | } | ||
167 | |||
168 | snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt, | ||
169 | uart_nr, uart_nr); | ||
170 | snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt, | ||
171 | uart_nr, uart_nr); | ||
172 | |||
173 | if (omap_mux_get_by_name(rx_pad_name, &rx_partition, &rx_mux) >= 0 && | ||
174 | omap_mux_get_by_name | ||
175 | (tx_pad_name, &tx_partition, &tx_mux) >= 0) { | ||
176 | u16 tx_mode, rx_mode; | ||
177 | |||
178 | tx_mode = omap_mux_read(tx_partition, tx_mux->reg_offset); | ||
179 | rx_mode = omap_mux_read(rx_partition, rx_mux->reg_offset); | ||
180 | |||
181 | /* | ||
182 | * Check if uart is used in default tx/rx mode i.e. in mux mode0 | ||
183 | * if yes then configure rx pin for wake up capability | ||
184 | */ | ||
185 | if (OMAP_MODE_UART(rx_mode) && OMAP_MODE_UART(tx_mode)) | ||
186 | omap_serial_fill_uart_tx_rx_pads(bdata, uart); | ||
187 | } | ||
131 | } | 188 | } |
132 | #else | 189 | #else |
133 | static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} | 190 | static void __init omap_serial_check_wakeup(struct omap_board_data *bdata, |
191 | struct omap_uart_state *uart) | ||
192 | { | ||
193 | } | ||
134 | #endif | 194 | #endif |
135 | 195 | ||
136 | static char *cmdline_find_option(char *str) | 196 | static char *cmdline_find_option(char *str) |
@@ -287,8 +347,7 @@ void __init omap_serial_board_init(struct omap_uart_port_info *info) | |||
287 | bdata.pads = NULL; | 347 | bdata.pads = NULL; |
288 | bdata.pads_cnt = 0; | 348 | bdata.pads_cnt = 0; |
289 | 349 | ||
290 | if (cpu_is_omap44xx() || cpu_is_omap34xx()) | 350 | omap_serial_check_wakeup(&bdata, uart); |
291 | omap_serial_fill_default_pads(&bdata); | ||
292 | 351 | ||
293 | if (!info) | 352 | if (!info) |
294 | omap_serial_init_port(&bdata, NULL); | 353 | omap_serial_init_port(&bdata, NULL); |