aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJon Hunter <jon-hunter@ti.com>2011-11-09 07:04:49 -0500
committerKevin Hilman <khilman@ti.com>2011-12-14 19:05:24 -0500
commita9e210e0b7a344c0e44aa6bf6888176bbc635c42 (patch)
treee24466ff2fd9c2f10979d5fce32a870c451448ff /drivers
parentc86845db77ce220f77e6645b18800744684946ac (diff)
ARM: OMAP2+: UART: Make the RX_TIMEOUT for DMA configurable for each UART
When using DMA there are two timeouts defined. The first timeout, rx_timeout, is really a polling rate in which software polls the DMA status to see if the DMA has finished. This is necessary for the RX side because we do not know how much data we will receive. The secound timeout, RX_TIMEOUT, is a timeout after which the DMA will be stopped if no more data is received. To make this clearer, rename rx_timeout as rx_poll_rate and rename the function serial_omap_rx_timeout() to serial_omap_rxdma_poll(). The OMAP-Serial driver defines an RX_TIMEOUT of 3 seconds that is used to indicate when the DMA for UART can be stopped if no more data is received. The value is a global definition that is applied to all instances of the UART. Each UART may be used for a different purpose and so the timeout required may differ. Make this value configurable for each UART so that this value can be optimised for power savings. 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 'drivers')
-rw-r--r--drivers/tty/serial/omap-serial.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index d60e001cf60f..e1eaa66c047b 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -47,7 +47,7 @@ static struct uart_omap_port *ui[OMAP_MAX_HSUART_PORTS];
47 47
48/* Forward declaration of functions */ 48/* Forward declaration of functions */
49static void uart_tx_dma_callback(int lch, u16 ch_status, void *data); 49static void uart_tx_dma_callback(int lch, u16 ch_status, void *data);
50static void serial_omap_rx_timeout(unsigned long uart_no); 50static void serial_omap_rxdma_poll(unsigned long uart_no);
51static int serial_omap_start_rxdma(struct uart_omap_port *up); 51static int serial_omap_start_rxdma(struct uart_omap_port *up);
52static void serial_omap_mdr1_errataset(struct uart_omap_port *up, u8 mdr1); 52static void serial_omap_mdr1_errataset(struct uart_omap_port *up, u8 mdr1);
53 53
@@ -542,7 +542,7 @@ static int serial_omap_startup(struct uart_port *port)
542 (dma_addr_t *)&(up->uart_dma.tx_buf_dma_phys), 542 (dma_addr_t *)&(up->uart_dma.tx_buf_dma_phys),
543 0); 543 0);
544 init_timer(&(up->uart_dma.rx_timer)); 544 init_timer(&(up->uart_dma.rx_timer));
545 up->uart_dma.rx_timer.function = serial_omap_rx_timeout; 545 up->uart_dma.rx_timer.function = serial_omap_rxdma_poll;
546 up->uart_dma.rx_timer.data = up->pdev->id; 546 up->uart_dma.rx_timer.data = up->pdev->id;
547 /* Currently the buffer size is 4KB. Can increase it */ 547 /* Currently the buffer size is 4KB. Can increase it */
548 up->uart_dma.rx_buf = dma_alloc_coherent(NULL, 548 up->uart_dma.rx_buf = dma_alloc_coherent(NULL,
@@ -1160,7 +1160,7 @@ static int serial_omap_resume(struct device *dev)
1160} 1160}
1161#endif 1161#endif
1162 1162
1163static void serial_omap_rx_timeout(unsigned long uart_no) 1163static void serial_omap_rxdma_poll(unsigned long uart_no)
1164{ 1164{
1165 struct uart_omap_port *up = ui[uart_no]; 1165 struct uart_omap_port *up = ui[uart_no];
1166 unsigned int curr_dma_pos, curr_transmitted_size; 1166 unsigned int curr_dma_pos, curr_transmitted_size;
@@ -1170,9 +1170,9 @@ static void serial_omap_rx_timeout(unsigned long uart_no)
1170 if ((curr_dma_pos == up->uart_dma.prev_rx_dma_pos) || 1170 if ((curr_dma_pos == up->uart_dma.prev_rx_dma_pos) ||
1171 (curr_dma_pos == 0)) { 1171 (curr_dma_pos == 0)) {
1172 if (jiffies_to_msecs(jiffies - up->port_activity) < 1172 if (jiffies_to_msecs(jiffies - up->port_activity) <
1173 RX_TIMEOUT) { 1173 up->uart_dma.rx_timeout) {
1174 mod_timer(&up->uart_dma.rx_timer, jiffies + 1174 mod_timer(&up->uart_dma.rx_timer, jiffies +
1175 usecs_to_jiffies(up->uart_dma.rx_timeout)); 1175 usecs_to_jiffies(up->uart_dma.rx_poll_rate));
1176 } else { 1176 } else {
1177 serial_omap_stop_rxdma(up); 1177 serial_omap_stop_rxdma(up);
1178 up->ier |= (UART_IER_RDI | UART_IER_RLSI); 1178 up->ier |= (UART_IER_RDI | UART_IER_RLSI);
@@ -1201,7 +1201,7 @@ static void serial_omap_rx_timeout(unsigned long uart_no)
1201 } 1201 }
1202 } else { 1202 } else {
1203 mod_timer(&up->uart_dma.rx_timer, jiffies + 1203 mod_timer(&up->uart_dma.rx_timer, jiffies +
1204 usecs_to_jiffies(up->uart_dma.rx_timeout)); 1204 usecs_to_jiffies(up->uart_dma.rx_poll_rate));
1205 } 1205 }
1206 up->port_activity = jiffies; 1206 up->port_activity = jiffies;
1207} 1207}
@@ -1240,7 +1240,7 @@ static int serial_omap_start_rxdma(struct uart_omap_port *up)
1240 /* FIXME: Cache maintenance needed here? */ 1240 /* FIXME: Cache maintenance needed here? */
1241 omap_start_dma(up->uart_dma.rx_dma_channel); 1241 omap_start_dma(up->uart_dma.rx_dma_channel);
1242 mod_timer(&up->uart_dma.rx_timer, jiffies + 1242 mod_timer(&up->uart_dma.rx_timer, jiffies +
1243 usecs_to_jiffies(up->uart_dma.rx_timeout)); 1243 usecs_to_jiffies(up->uart_dma.rx_poll_rate));
1244 up->uart_dma.rx_dma_used = true; 1244 up->uart_dma.rx_dma_used = true;
1245 return ret; 1245 return ret;
1246} 1246}
@@ -1376,6 +1376,7 @@ static int serial_omap_probe(struct platform_device *pdev)
1376 up->use_dma = 1; 1376 up->use_dma = 1;
1377 up->uart_dma.rx_buf_size = omap_up_info->dma_rx_buf_size; 1377 up->uart_dma.rx_buf_size = omap_up_info->dma_rx_buf_size;
1378 up->uart_dma.rx_timeout = omap_up_info->dma_rx_timeout; 1378 up->uart_dma.rx_timeout = omap_up_info->dma_rx_timeout;
1379 up->uart_dma.rx_poll_rate = omap_up_info->dma_rx_poll_rate;
1379 spin_lock_init(&(up->uart_dma.tx_lock)); 1380 spin_lock_init(&(up->uart_dma.tx_lock));
1380 spin_lock_init(&(up->uart_dma.rx_lock)); 1381 spin_lock_init(&(up->uart_dma.rx_lock));
1381 up->uart_dma.tx_dma_channel = OMAP_UART_DMA_CH_FREE; 1382 up->uart_dma.tx_dma_channel = OMAP_UART_DMA_CH_FREE;