aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTomoya MORINAGA <tomoya-linux@dsn.okisemi.com>2011-02-22 20:03:19 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-02-22 20:22:05 -0500
commitfec38d1752c01ad72789bac9f1a128f7e933735d (patch)
treef7300a9dcb2c92ff21a3835ab1d6e5dc268c6979 /drivers
parent60d1031e114a3e96e4420421e34ddc0dcd10cbae (diff)
pch_uart: Fix DMA channel miss-setting issue.
Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tty/serial/pch_uart.c59
1 files changed, 47 insertions, 12 deletions
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index da0ba0fa2b99..a5ce9a5c018d 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -235,6 +235,36 @@ struct eg20t_port {
235 dma_addr_t rx_buf_dma; 235 dma_addr_t rx_buf_dma;
236}; 236};
237 237
238/**
239 * struct pch_uart_driver_data - private data structure for UART-DMA
240 * @port_type: The number of DMA channel
241 * @line_no: UART port line number (0, 1, 2...)
242 */
243struct pch_uart_driver_data {
244 int port_type;
245 int line_no;
246};
247
248enum pch_uart_num_t {
249 pch_et20t_uart0 = 0,
250 pch_et20t_uart1,
251 pch_et20t_uart2,
252 pch_et20t_uart3,
253 pch_ml7213_uart0,
254 pch_ml7213_uart1,
255 pch_ml7213_uart2,
256};
257
258static struct pch_uart_driver_data drv_dat[] = {
259 [pch_et20t_uart0] = {PCH_UART_8LINE, 0},
260 [pch_et20t_uart1] = {PCH_UART_2LINE, 1},
261 [pch_et20t_uart2] = {PCH_UART_2LINE, 2},
262 [pch_et20t_uart3] = {PCH_UART_2LINE, 3},
263 [pch_ml7213_uart0] = {PCH_UART_8LINE, 0},
264 [pch_ml7213_uart1] = {PCH_UART_2LINE, 1},
265 [pch_ml7213_uart2] = {PCH_UART_2LINE, 2},
266};
267
238static unsigned int default_baud = 9600; 268static unsigned int default_baud = 9600;
239static const int trigger_level_256[4] = { 1, 64, 128, 224 }; 269static const int trigger_level_256[4] = { 1, 64, 128, 224 };
240static const int trigger_level_64[4] = { 1, 16, 32, 56 }; 270static const int trigger_level_64[4] = { 1, 16, 32, 56 };
@@ -568,7 +598,8 @@ static void pch_request_dma(struct uart_port *port)
568 /* Set Tx DMA */ 598 /* Set Tx DMA */
569 param = &priv->param_tx; 599 param = &priv->param_tx;
570 param->dma_dev = &dma_dev->dev; 600 param->dma_dev = &dma_dev->dev;
571 param->chan_id = priv->port.line; 601 param->chan_id = priv->port.line * 2; /* Tx = 0, 2, 4, ... */
602
572 param->tx_reg = port->mapbase + UART_TX; 603 param->tx_reg = port->mapbase + UART_TX;
573 chan = dma_request_channel(mask, filter, param); 604 chan = dma_request_channel(mask, filter, param);
574 if (!chan) { 605 if (!chan) {
@@ -581,7 +612,8 @@ static void pch_request_dma(struct uart_port *port)
581 /* Set Rx DMA */ 612 /* Set Rx DMA */
582 param = &priv->param_rx; 613 param = &priv->param_rx;
583 param->dma_dev = &dma_dev->dev; 614 param->dma_dev = &dma_dev->dev;
584 param->chan_id = priv->port.line + 1; /* Rx = Tx + 1 */ 615 param->chan_id = priv->port.line * 2 + 1; /* Rx = Tx + 1 */
616
585 param->rx_reg = port->mapbase + UART_RX; 617 param->rx_reg = port->mapbase + UART_RX;
586 chan = dma_request_channel(mask, filter, param); 618 chan = dma_request_channel(mask, filter, param);
587 if (!chan) { 619 if (!chan) {
@@ -1358,8 +1390,11 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
1358 unsigned int mapbase; 1390 unsigned int mapbase;
1359 unsigned char *rxbuf; 1391 unsigned char *rxbuf;
1360 int fifosize, base_baud; 1392 int fifosize, base_baud;
1361 static int num; 1393 int port_type;
1362 int port_type = id->driver_data; 1394 struct pch_uart_driver_data *board;
1395
1396 board = &drv_dat[id->driver_data];
1397 port_type = board->port_type;
1363 1398
1364 priv = kzalloc(sizeof(struct eg20t_port), GFP_KERNEL); 1399 priv = kzalloc(sizeof(struct eg20t_port), GFP_KERNEL);
1365 if (priv == NULL) 1400 if (priv == NULL)
@@ -1404,7 +1439,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
1404 priv->port.ops = &pch_uart_ops; 1439 priv->port.ops = &pch_uart_ops;
1405 priv->port.flags = UPF_BOOT_AUTOCONF; 1440 priv->port.flags = UPF_BOOT_AUTOCONF;
1406 priv->port.fifosize = fifosize; 1441 priv->port.fifosize = fifosize;
1407 priv->port.line = num++; 1442 priv->port.line = board->line_no;
1408 priv->trigger = PCH_UART_HAL_TRIGGER_M; 1443 priv->trigger = PCH_UART_HAL_TRIGGER_M;
1409 1444
1410 spin_lock_init(&priv->port.lock); 1445 spin_lock_init(&priv->port.lock);
@@ -1482,19 +1517,19 @@ static int pch_uart_pci_resume(struct pci_dev *pdev)
1482 1517
1483static DEFINE_PCI_DEVICE_TABLE(pch_uart_pci_id) = { 1518static DEFINE_PCI_DEVICE_TABLE(pch_uart_pci_id) = {
1484 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8811), 1519 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8811),
1485 .driver_data = PCH_UART_8LINE}, 1520 .driver_data = pch_et20t_uart0},
1486 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8812), 1521 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8812),
1487 .driver_data = PCH_UART_2LINE}, 1522 .driver_data = pch_et20t_uart1},
1488 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8813), 1523 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8813),
1489 .driver_data = PCH_UART_2LINE}, 1524 .driver_data = pch_et20t_uart2},
1490 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8814), 1525 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8814),
1491 .driver_data = PCH_UART_2LINE}, 1526 .driver_data = pch_et20t_uart3},
1492 {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8027), 1527 {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8027),
1493 .driver_data = PCH_UART_8LINE}, 1528 .driver_data = pch_ml7213_uart0},
1494 {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8028), 1529 {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8028),
1495 .driver_data = PCH_UART_2LINE}, 1530 .driver_data = pch_ml7213_uart1},
1496 {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8029), 1531 {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8029),
1497 .driver_data = PCH_UART_2LINE}, 1532 .driver_data = pch_ml7213_uart2},
1498 {0,}, 1533 {0,},
1499}; 1534};
1500 1535