Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 281908
b: refs/heads/master
c: c86845d
h: refs/heads/master
v: v3
  • Loading branch information
Deepak K authored and Kevin Hilman committed Dec 15, 2011
1 parent 01f5176 commit 2be1213
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 634bd6e4817cd6a7109be8d2eee5c578a283d1ee
refs/heads/master: c86845db77ce220f77e6645b18800744684946ac
6 changes: 3 additions & 3 deletions trunk/arch/arm/mach-omap2/board-n8x0.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,15 +644,15 @@ static inline void board_serial_init(void)
bdata.pads_cnt = 0;

bdata.id = 0;
omap_serial_init_port(&bdata);
omap_serial_init_port(&bdata, NULL);

bdata.id = 1;
omap_serial_init_port(&bdata);
omap_serial_init_port(&bdata, NULL);

bdata.id = 2;
bdata.pads = serial2_pads;
bdata.pads_cnt = ARRAY_SIZE(serial2_pads);
omap_serial_init_port(&bdata);
omap_serial_init_port(&bdata, NULL);
}

#else
Expand Down
56 changes: 45 additions & 11 deletions trunk/arch/arm/mach-omap2/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
#include "mux.h"

/*
* NOTE: By default the serial timeout is disabled as it causes lost characters
* over the serial ports. This means that the UART clocks will stay on until
* disabled via sysfs. This also causes that any deeper omap sleep states are
* blocked.
* NOTE: By default the serial auto_suspend timeout is disabled as it causes
* lost characters over the serial ports. This means that the UART clocks will
* stay on until power/autosuspend_delay is set for the uart from sysfs.
* This also causes that any deeper omap sleep states are blocked.
*/
#define DEFAULT_TIMEOUT 0
#define DEFAULT_AUTOSUSPEND_DELAY -1

#define MAX_UART_HWMOD_NAME_LEN 16

Expand All @@ -64,6 +64,18 @@ struct omap_uart_state {
static LIST_HEAD(uart_list);
static u8 num_uarts;

#define DEFAULT_RXDMA_TIMEOUT 1 /* RX DMA polling rate (us) */
#define DEFAULT_RXDMA_BUFSIZE 4096 /* RX DMA buffer size */

static struct omap_uart_port_info omap_serial_default_info[] __initdata = {
{
.dma_enabled = false,
.dma_rx_buf_size = DEFAULT_RXDMA_BUFSIZE,
.dma_rx_timeout = DEFAULT_RXDMA_TIMEOUT,
.autosuspend_timeout = DEFAULT_AUTOSUSPEND_DELAY,
},
};

#ifdef CONFIG_PM

int omap_uart_can_sleep(void)
Expand Down Expand Up @@ -294,6 +306,7 @@ core_initcall(omap_serial_early_init);
/**
* omap_serial_init_port() - initialize single serial port
* @bdata: port specific board data pointer
* @info: platform specific data pointer
*
* This function initialies serial driver for given port only.
* Platforms can call this function instead of omap_serial_init()
Expand All @@ -302,7 +315,8 @@ core_initcall(omap_serial_early_init);
* Don't mix calls to omap_serial_init_port() and omap_serial_init(),
* use only one of the two.
*/
void __init omap_serial_init_port(struct omap_board_data *bdata)
void __init omap_serial_init_port(struct omap_board_data *bdata,
struct omap_uart_port_info *info)
{
struct omap_uart_state *uart;
struct omap_hwmod *oh;
Expand All @@ -322,17 +336,22 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
list_for_each_entry(uart, &uart_list, node)
if (bdata->id == uart->num)
break;
if (!info)
info = omap_serial_default_info;

oh = uart->oh;
name = DRIVER_NAME;

omap_up.dma_enabled = uart->dma_enabled;
omap_up.dma_enabled = info->dma_enabled;
omap_up.uartclk = OMAP24XX_BASE_BAUD * 16;
omap_up.flags = UPF_BOOT_AUTOCONF;
omap_up.get_context_loss_count = omap_pm_get_dev_context_loss_count;
omap_up.set_forceidle = omap_uart_set_forceidle;
omap_up.set_noidle = omap_uart_set_noidle;
omap_up.enable_wakeup = omap_uart_enable_wakeup;
omap_up.dma_rx_buf_size = info->dma_rx_buf_size;
omap_up.dma_rx_timeout = info->dma_rx_timeout;
omap_up.autosuspend_timeout = info->autosuspend_timeout;

/* Enable the MDR1 Errata i202 for OMAP2430/3xxx/44xx */
if (!cpu_is_omap2420() && !cpu_is_ti816x())
Expand Down Expand Up @@ -379,13 +398,14 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
}

/**
* omap_serial_init() - initialize all supported serial ports
* omap_serial_board_init() - initialize all supported serial ports
* @info: platform specific data pointer
*
* Initializes all available UARTs as serial ports. Platforms
* can call this function when they want to have default behaviour
* for serial ports (e.g initialize them all as serial ports).
*/
void __init omap_serial_init(void)
void __init omap_serial_board_init(struct omap_uart_port_info *info)
{
struct omap_uart_state *uart;
struct omap_board_data bdata;
Expand All @@ -399,7 +419,21 @@ void __init omap_serial_init(void)
if (cpu_is_omap44xx() || cpu_is_omap34xx())
omap_serial_fill_default_pads(&bdata);

omap_serial_init_port(&bdata);

if (!info)
omap_serial_init_port(&bdata, NULL);
else
omap_serial_init_port(&bdata, &info[uart->num]);
}
}

/**
* omap_serial_init() - initialize all supported serial ports
*
* Initializes all available UARTs.
* Platforms can call this function when they want to have default behaviour
* for serial ports (e.g initialize them all as serial ports).
*/
void __init omap_serial_init(void)
{
omap_serial_board_init(NULL);
}
7 changes: 5 additions & 2 deletions trunk/arch/arm/plat-omap/include/plat/omap-serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ struct omap_uart_port_info {
unsigned int uartclk; /* UART clock rate */
upf_t flags; /* UPF_* flags */
u32 errata;
unsigned int dma_rx_buf_size;
unsigned int dma_rx_timeout;
unsigned int autosuspend_timeout;

int (*get_context_loss_count)(struct device *);
void (*set_forceidle)(struct platform_device *);
Expand Down Expand Up @@ -94,8 +97,8 @@ struct uart_omap_dma {
spinlock_t rx_lock;
/* timer to poll activity on rx dma */
struct timer_list rx_timer;
int rx_buf_size;
int rx_timeout;
unsigned int rx_buf_size;
unsigned int rx_timeout;
};

struct uart_omap_port {
Expand Down
5 changes: 4 additions & 1 deletion trunk/arch/arm/plat-omap/include/plat/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,13 @@
#ifndef __ASSEMBLER__

struct omap_board_data;
struct omap_uart_port_info;

extern void omap_serial_init(void);
extern void omap_serial_init_port(struct omap_board_data *bdata);
extern int omap_uart_can_sleep(void);
extern void omap_serial_board_init(struct omap_uart_port_info *platform_data);
extern void omap_serial_init_port(struct omap_board_data *bdata,
struct omap_uart_port_info *platform_data);
#endif

#endif
8 changes: 3 additions & 5 deletions trunk/drivers/tty/serial/omap-serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@
#include <plat/dmtimer.h>
#include <plat/omap-serial.h>

#define OMAP_UART_AUTOSUSPEND_DELAY -1

static struct uart_omap_port *ui[OMAP_MAX_HSUART_PORTS];

/* Forward declaration of functions */
Expand Down Expand Up @@ -1376,8 +1374,8 @@ static int serial_omap_probe(struct platform_device *pdev)
up->uart_dma.uart_dma_tx = dma_tx->start;
up->uart_dma.uart_dma_rx = dma_rx->start;
up->use_dma = 1;
up->uart_dma.rx_buf_size = 4096;
up->uart_dma.rx_timeout = 2;
up->uart_dma.rx_buf_size = omap_up_info->dma_rx_buf_size;
up->uart_dma.rx_timeout = omap_up_info->dma_rx_timeout;
spin_lock_init(&(up->uart_dma.tx_lock));
spin_lock_init(&(up->uart_dma.rx_lock));
up->uart_dma.tx_dma_channel = OMAP_UART_DMA_CH_FREE;
Expand All @@ -1386,7 +1384,7 @@ static int serial_omap_probe(struct platform_device *pdev)

pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_set_autosuspend_delay(&pdev->dev,
OMAP_UART_AUTOSUSPEND_DELAY);
omap_up_info->autosuspend_timeout);

pm_runtime_irq_safe(&pdev->dev);
pm_runtime_enable(&pdev->dev);
Expand Down

0 comments on commit 2be1213

Please sign in to comment.