aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/serial.c
diff options
context:
space:
mode:
authorDeepak K <deepak.k@ti.com>2011-11-09 07:03:38 -0500
committerKevin Hilman <khilman@ti.com>2011-12-14 19:05:24 -0500
commitc86845db77ce220f77e6645b18800744684946ac (patch)
treef110531ca7ae25eb8193bd47f5ad78254eee92cc /arch/arm/mach-omap2/serial.c
parent634bd6e4817cd6a7109be8d2eee5c578a283d1ee (diff)
ARM: OMAP2+: UART: Allow UART parameters to be configured from board file.
The following UART parameters are defined within the UART driver: 1). Whether the UART uses DMA (dma_enabled), by default set to 0 2). The size of dma buffer (set to 4096 bytes) 3). The time after which the dma should stop if no more data is received. 4). The auto suspend delay that will be passed for pm_runtime_autosuspend where uart will be disabled after timeout Different UARTs may be used for different purpose such as the console, for interfacing bluetooth chip, for interfacing to a modem chip, etc. Therefore, it is necessary to be able to customize the above settings for a given board on a per UART basis. This change allows these parameters to be configured from the board file and allows the parameters to be configured for each UART independently. If a board does not define its own custom parameters for the UARTs, then use the default parameters in the structure "omap_serial_default_info". The default parameters are defined to be the same as the current settings in the UART driver to avoid breaking the UART for any cuurnelty supported boards. By default, make all boards use the default UART parameters. Signed-off-by: Deepak K <deepak.k@ti.com> Signed-off-by: Jon Hunter <jon-hunter@ti.com> Signed-off-by: Govindraj.R <govindraj.raja@ti.com> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> (for drivers/tty changes) Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/serial.c')
-rw-r--r--arch/arm/mach-omap2/serial.c56
1 files changed, 45 insertions, 11 deletions
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}