20 #include <linux/kernel.h>
26 #include <linux/slab.h>
51 #define DEFAULT_AUTOSUSPEND_DELAY -1
53 #define MAX_UART_HWMOD_NAME_LEN 16
65 static u8 console_uart_id = -1;
66 static u8 no_console_suspend;
69 #define DEFAULT_RXDMA_POLLRATE 1
70 #define DEFAULT_RXDMA_BUFSIZE 4096
71 #define DEFAULT_RXDMA_TIMEOUT (3 * HZ)
103 static void omap_uart_set_noidle(
struct device *dev)
111 static void omap_uart_set_smartidle(
struct device *dev)
126 static void omap_uart_enable_wakeup(
struct device *dev,
bool enable)
128 static void omap_uart_set_noidle(
struct device *dev) {}
129 static void omap_uart_set_smartidle(
struct device *dev) {}
132 #ifdef CONFIG_OMAP_MUX
134 #define OMAP_UART_DEFAULT_PAD_NAME_LEN 28
135 static char rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN],
136 tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN]
__initdata;
160 char *rx_fmt, *tx_fmt;
161 int uart_nr = bdata->
id + 1;
163 if (bdata->
id != 2) {
164 rx_fmt =
"uart%d_rx.uart%d_rx";
165 tx_fmt =
"uart%d_tx.uart%d_tx";
167 rx_fmt =
"uart%d_rx_irrx.uart%d_rx_irrx";
168 tx_fmt =
"uart%d_tx_irtx.uart%d_tx_irtx";
171 snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt,
173 snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt,
176 if (omap_mux_get_by_name(rx_pad_name, &rx_partition, &rx_mux) >= 0 &&
178 (tx_pad_name, &tx_partition, &tx_mux) >= 0) {
189 omap_serial_fill_uart_tx_rx_pads(bdata, uart);
199 static char *cmdline_find_option(
char *
str)
203 return strstr(saved_command_line, str);
206 static int __init omap_serial_early_init(
void)
230 if (cmdline_find_option(uart_name)) {
231 console_uart_id = uart->
num;
235 pr_info(
"%s used as console in debug mode: uart%d clocks will not be gated",
236 uart_name, uart->
num);
239 if (cmdline_find_option(
"no_console_suspend"))
240 no_console_suspend =
true;
290 if (bdata->
id == uart->
num)
293 info = omap_serial_default_info;
322 WARN(1,
"Could not build omap_device for %s: %s.\n", name,
327 if ((console_uart_id == bdata->
id) && no_console_suspend)
328 omap_device_disable_idle_on_suspend(pdev);
332 if (console_uart_id == bdata->
id) {
334 pm_runtime_set_active(&pdev->
dev);
358 bdata.
id = uart->
num;
363 omap_serial_check_wakeup(&bdata, uart);