aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-omap2/board-n8x0.c6
-rw-r--r--arch/arm/mach-omap2/serial.c56
-rw-r--r--arch/arm/plat-omap/include/plat/omap-serial.h7
-rw-r--r--arch/arm/plat-omap/include/plat/serial.h5
-rw-r--r--drivers/tty/serial/omap-serial.c8
5 files changed, 60 insertions, 22 deletions
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index bebd3d84365e..118f38c4b37d 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -644,15 +644,15 @@ static inline void board_serial_init(void)
644 bdata.pads_cnt = 0; 644 bdata.pads_cnt = 0;
645 645
646 bdata.id = 0; 646 bdata.id = 0;
647 omap_serial_init_port(&bdata); 647 omap_serial_init_port(&bdata, NULL);
648 648
649 bdata.id = 1; 649 bdata.id = 1;
650 omap_serial_init_port(&bdata); 650 omap_serial_init_port(&bdata, NULL);
651 651
652 bdata.id = 2; 652 bdata.id = 2;
653 bdata.pads = serial2_pads; 653 bdata.pads = serial2_pads;
654 bdata.pads_cnt = ARRAY_SIZE(serial2_pads); 654 bdata.pads_cnt = ARRAY_SIZE(serial2_pads);
655 omap_serial_init_port(&bdata); 655 omap_serial_init_port(&bdata, NULL);
656} 656}
657 657
658#else 658#else
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index f94394fe5b16..5b1b36a45e9c 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -43,12 +43,12 @@
43#include "mux.h" 43#include "mux.h"
44 44
45/* 45/*
46 * NOTE: By default the serial timeout is disabled as it causes lost characters 46 * NOTE: By default the serial auto_suspend timeout is disabled as it causes
47 * over the serial ports. This means that the UART clocks will stay on until 47 * lost characters over the serial ports. This means that the UART clocks will
48 * disabled via sysfs. This also causes that any deeper omap sleep states are 48 * stay on until power/autosuspend_delay is set for the uart from sysfs.
49 * blocked. 49 * This also causes that any deeper omap sleep states are blocked.
50 */ 50 */
51#define DEFAULT_TIMEOUT 0 51#define DEFAULT_AUTOSUSPEND_DELAY -1
52 52
53#define MAX_UART_HWMOD_NAME_LEN 16 53#define MAX_UART_HWMOD_NAME_LEN 16
54 54
@@ -64,6 +64,18 @@ struct omap_uart_state {
64static LIST_HEAD(uart_list); 64static LIST_HEAD(uart_list);
65static u8 num_uarts; 65static u8 num_uarts;
66 66
67#define DEFAULT_RXDMA_TIMEOUT 1 /* RX DMA polling rate (us) */
68#define DEFAULT_RXDMA_BUFSIZE 4096 /* RX DMA buffer size */
69
70static struct omap_uart_port_info omap_serial_default_info[] __initdata = {
71 {
72 .dma_enabled = false,
73 .dma_rx_buf_size = DEFAULT_RXDMA_BUFSIZE,
74 .dma_rx_timeout = DEFAULT_RXDMA_TIMEOUT,
75 .autosuspend_timeout = DEFAULT_AUTOSUSPEND_DELAY,
76 },
77};
78
67#ifdef CONFIG_PM 79#ifdef CONFIG_PM
68 80
69int omap_uart_can_sleep(void) 81int omap_uart_can_sleep(void)
@@ -294,6 +306,7 @@ core_initcall(omap_serial_early_init);
294/** 306/**
295 * omap_serial_init_port() - initialize single serial port 307 * omap_serial_init_port() - initialize single serial port
296 * @bdata: port specific board data pointer 308 * @bdata: port specific board data pointer
309 * @info: platform specific data pointer
297 * 310 *
298 * This function initialies serial driver for given port only. 311 * This function initialies serial driver for given port only.
299 * Platforms can call this function instead of omap_serial_init() 312 * Platforms can call this function instead of omap_serial_init()
@@ -302,7 +315,8 @@ core_initcall(omap_serial_early_init);
302 * Don't mix calls to omap_serial_init_port() and omap_serial_init(), 315 * Don't mix calls to omap_serial_init_port() and omap_serial_init(),
303 * use only one of the two. 316 * use only one of the two.
304 */ 317 */
305void __init omap_serial_init_port(struct omap_board_data *bdata) 318void __init omap_serial_init_port(struct omap_board_data *bdata,
319 struct omap_uart_port_info *info)
306{ 320{
307 struct omap_uart_state *uart; 321 struct omap_uart_state *uart;
308 struct omap_hwmod *oh; 322 struct omap_hwmod *oh;
@@ -322,17 +336,22 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
322 list_for_each_entry(uart, &uart_list, node) 336 list_for_each_entry(uart, &uart_list, node)
323 if (bdata->id == uart->num) 337 if (bdata->id == uart->num)
324 break; 338 break;
339 if (!info)
340 info = omap_serial_default_info;
325 341
326 oh = uart->oh; 342 oh = uart->oh;
327 name = DRIVER_NAME; 343 name = DRIVER_NAME;
328 344
329 omap_up.dma_enabled = uart->dma_enabled; 345 omap_up.dma_enabled = info->dma_enabled;
330 omap_up.uartclk = OMAP24XX_BASE_BAUD * 16; 346 omap_up.uartclk = OMAP24XX_BASE_BAUD * 16;
331 omap_up.flags = UPF_BOOT_AUTOCONF; 347 omap_up.flags = UPF_BOOT_AUTOCONF;
332 omap_up.get_context_loss_count = omap_pm_get_dev_context_loss_count; 348 omap_up.get_context_loss_count = omap_pm_get_dev_context_loss_count;
333 omap_up.set_forceidle = omap_uart_set_forceidle; 349 omap_up.set_forceidle = omap_uart_set_forceidle;
334 omap_up.set_noidle = omap_uart_set_noidle; 350 omap_up.set_noidle = omap_uart_set_noidle;
335 omap_up.enable_wakeup = omap_uart_enable_wakeup; 351 omap_up.enable_wakeup = omap_uart_enable_wakeup;
352 omap_up.dma_rx_buf_size = info->dma_rx_buf_size;
353 omap_up.dma_rx_timeout = info->dma_rx_timeout;
354 omap_up.autosuspend_timeout = info->autosuspend_timeout;
336 355
337 /* Enable the MDR1 Errata i202 for OMAP2430/3xxx/44xx */ 356 /* Enable the MDR1 Errata i202 for OMAP2430/3xxx/44xx */
338 if (!cpu_is_omap2420() && !cpu_is_ti816x()) 357 if (!cpu_is_omap2420() && !cpu_is_ti816x())
@@ -379,13 +398,14 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
379} 398}
380 399
381/** 400/**
382 * omap_serial_init() - initialize all supported serial ports 401 * omap_serial_board_init() - initialize all supported serial ports
402 * @info: platform specific data pointer
383 * 403 *
384 * Initializes all available UARTs as serial ports. Platforms 404 * Initializes all available UARTs as serial ports. Platforms
385 * can call this function when they want to have default behaviour 405 * can call this function when they want to have default behaviour
386 * for serial ports (e.g initialize them all as serial ports). 406 * for serial ports (e.g initialize them all as serial ports).
387 */ 407 */
388void __init omap_serial_init(void) 408void __init omap_serial_board_init(struct omap_uart_port_info *info)
389{ 409{
390 struct omap_uart_state *uart; 410 struct omap_uart_state *uart;
391 struct omap_board_data bdata; 411 struct omap_board_data bdata;
@@ -399,7 +419,21 @@ void __init omap_serial_init(void)
399 if (cpu_is_omap44xx() || cpu_is_omap34xx()) 419 if (cpu_is_omap44xx() || cpu_is_omap34xx())
400 omap_serial_fill_default_pads(&bdata); 420 omap_serial_fill_default_pads(&bdata);
401 421
402 omap_serial_init_port(&bdata); 422 if (!info)
403 423 omap_serial_init_port(&bdata, NULL);
424 else
425 omap_serial_init_port(&bdata, &info[uart->num]);
404 } 426 }
405} 427}
428
429/**
430 * omap_serial_init() - initialize all supported serial ports
431 *
432 * Initializes all available UARTs.
433 * Platforms can call this function when they want to have default behaviour
434 * for serial ports (e.g initialize them all as serial ports).
435 */
436void __init omap_serial_init(void)
437{
438 omap_serial_board_init(NULL);
439}
diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h
index 39709ecfd58f..a740a6c0e104 100644
--- a/arch/arm/plat-omap/include/plat/omap-serial.h
+++ b/arch/arm/plat-omap/include/plat/omap-serial.h
@@ -66,6 +66,9 @@ struct omap_uart_port_info {
66 unsigned int uartclk; /* UART clock rate */ 66 unsigned int uartclk; /* UART clock rate */
67 upf_t flags; /* UPF_* flags */ 67 upf_t flags; /* UPF_* flags */
68 u32 errata; 68 u32 errata;
69 unsigned int dma_rx_buf_size;
70 unsigned int dma_rx_timeout;
71 unsigned int autosuspend_timeout;
69 72
70 int (*get_context_loss_count)(struct device *); 73 int (*get_context_loss_count)(struct device *);
71 void (*set_forceidle)(struct platform_device *); 74 void (*set_forceidle)(struct platform_device *);
@@ -94,8 +97,8 @@ struct uart_omap_dma {
94 spinlock_t rx_lock; 97 spinlock_t rx_lock;
95 /* timer to poll activity on rx dma */ 98 /* timer to poll activity on rx dma */
96 struct timer_list rx_timer; 99 struct timer_list rx_timer;
97 int rx_buf_size; 100 unsigned int rx_buf_size;
98 int rx_timeout; 101 unsigned int rx_timeout;
99}; 102};
100 103
101struct uart_omap_port { 104struct uart_omap_port {
diff --git a/arch/arm/plat-omap/include/plat/serial.h b/arch/arm/plat-omap/include/plat/serial.h
index 152500b558a2..38b3e38df2a0 100644
--- a/arch/arm/plat-omap/include/plat/serial.h
+++ b/arch/arm/plat-omap/include/plat/serial.h
@@ -106,10 +106,13 @@
106#ifndef __ASSEMBLER__ 106#ifndef __ASSEMBLER__
107 107
108struct omap_board_data; 108struct omap_board_data;
109struct omap_uart_port_info;
109 110
110extern void omap_serial_init(void); 111extern void omap_serial_init(void);
111extern void omap_serial_init_port(struct omap_board_data *bdata);
112extern int omap_uart_can_sleep(void); 112extern int omap_uart_can_sleep(void);
113extern void omap_serial_board_init(struct omap_uart_port_info *platform_data);
114extern void omap_serial_init_port(struct omap_board_data *bdata,
115 struct omap_uart_port_info *platform_data);
113#endif 116#endif
114 117
115#endif 118#endif
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 45a25a01c44d..d60e001cf60f 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -43,8 +43,6 @@
43#include <plat/dmtimer.h> 43#include <plat/dmtimer.h>
44#include <plat/omap-serial.h> 44#include <plat/omap-serial.h>
45 45
46#define OMAP_UART_AUTOSUSPEND_DELAY -1
47
48static struct uart_omap_port *ui[OMAP_MAX_HSUART_PORTS]; 46static struct uart_omap_port *ui[OMAP_MAX_HSUART_PORTS];
49 47
50/* Forward declaration of functions */ 48/* Forward declaration of functions */
@@ -1376,8 +1374,8 @@ static int serial_omap_probe(struct platform_device *pdev)
1376 up->uart_dma.uart_dma_tx = dma_tx->start; 1374 up->uart_dma.uart_dma_tx = dma_tx->start;
1377 up->uart_dma.uart_dma_rx = dma_rx->start; 1375 up->uart_dma.uart_dma_rx = dma_rx->start;
1378 up->use_dma = 1; 1376 up->use_dma = 1;
1379 up->uart_dma.rx_buf_size = 4096; 1377 up->uart_dma.rx_buf_size = omap_up_info->dma_rx_buf_size;
1380 up->uart_dma.rx_timeout = 2; 1378 up->uart_dma.rx_timeout = omap_up_info->dma_rx_timeout;
1381 spin_lock_init(&(up->uart_dma.tx_lock)); 1379 spin_lock_init(&(up->uart_dma.tx_lock));
1382 spin_lock_init(&(up->uart_dma.rx_lock)); 1380 spin_lock_init(&(up->uart_dma.rx_lock));
1383 up->uart_dma.tx_dma_channel = OMAP_UART_DMA_CH_FREE; 1381 up->uart_dma.tx_dma_channel = OMAP_UART_DMA_CH_FREE;
@@ -1386,7 +1384,7 @@ static int serial_omap_probe(struct platform_device *pdev)
1386 1384
1387 pm_runtime_use_autosuspend(&pdev->dev); 1385 pm_runtime_use_autosuspend(&pdev->dev);
1388 pm_runtime_set_autosuspend_delay(&pdev->dev, 1386 pm_runtime_set_autosuspend_delay(&pdev->dev,
1389 OMAP_UART_AUTOSUSPEND_DELAY); 1387 omap_up_info->autosuspend_timeout);
1390 1388
1391 pm_runtime_irq_safe(&pdev->dev); 1389 pm_runtime_irq_safe(&pdev->dev);
1392 pm_runtime_enable(&pdev->dev); 1390 pm_runtime_enable(&pdev->dev);