diff options
Diffstat (limited to 'drivers/tty/serial/imx.c')
-rw-r--r-- | drivers/tty/serial/imx.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index c2fc6bef7a6f..4e853570ea80 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
@@ -1291,18 +1291,13 @@ static void imx_uart_enable_dma(struct imx_port *sport) | |||
1291 | 1291 | ||
1292 | static void imx_uart_disable_dma(struct imx_port *sport) | 1292 | static void imx_uart_disable_dma(struct imx_port *sport) |
1293 | { | 1293 | { |
1294 | u32 ucr1, ucr2; | 1294 | u32 ucr1; |
1295 | 1295 | ||
1296 | /* clear UCR1 */ | 1296 | /* clear UCR1 */ |
1297 | ucr1 = imx_uart_readl(sport, UCR1); | 1297 | ucr1 = imx_uart_readl(sport, UCR1); |
1298 | ucr1 &= ~(UCR1_RXDMAEN | UCR1_TXDMAEN | UCR1_ATDMAEN); | 1298 | ucr1 &= ~(UCR1_RXDMAEN | UCR1_TXDMAEN | UCR1_ATDMAEN); |
1299 | imx_uart_writel(sport, ucr1, UCR1); | 1299 | imx_uart_writel(sport, ucr1, UCR1); |
1300 | 1300 | ||
1301 | /* clear UCR2 */ | ||
1302 | ucr2 = imx_uart_readl(sport, UCR2); | ||
1303 | ucr2 &= ~(UCR2_CTSC | UCR2_CTS | UCR2_ATEN); | ||
1304 | imx_uart_writel(sport, ucr2, UCR2); | ||
1305 | |||
1306 | imx_uart_setup_ufcr(sport, TXTL_DEFAULT, RXTL_DEFAULT); | 1301 | imx_uart_setup_ufcr(sport, TXTL_DEFAULT, RXTL_DEFAULT); |
1307 | 1302 | ||
1308 | sport->dma_is_enabled = 0; | 1303 | sport->dma_is_enabled = 0; |
@@ -1427,13 +1422,21 @@ static void imx_uart_shutdown(struct uart_port *port) | |||
1427 | { | 1422 | { |
1428 | struct imx_port *sport = (struct imx_port *)port; | 1423 | struct imx_port *sport = (struct imx_port *)port; |
1429 | unsigned long flags; | 1424 | unsigned long flags; |
1430 | u32 ucr1, ucr2; | 1425 | u32 ucr1, ucr2, ucr4; |
1431 | 1426 | ||
1432 | if (sport->dma_is_enabled) { | 1427 | if (sport->dma_is_enabled) { |
1433 | sport->dma_is_rxing = 0; | ||
1434 | sport->dma_is_txing = 0; | ||
1435 | dmaengine_terminate_sync(sport->dma_chan_tx); | 1428 | dmaengine_terminate_sync(sport->dma_chan_tx); |
1429 | if (sport->dma_is_txing) { | ||
1430 | dma_unmap_sg(sport->port.dev, &sport->tx_sgl[0], | ||
1431 | sport->dma_tx_nents, DMA_TO_DEVICE); | ||
1432 | sport->dma_is_txing = 0; | ||
1433 | } | ||
1436 | dmaengine_terminate_sync(sport->dma_chan_rx); | 1434 | dmaengine_terminate_sync(sport->dma_chan_rx); |
1435 | if (sport->dma_is_rxing) { | ||
1436 | dma_unmap_sg(sport->port.dev, &sport->rx_sgl, | ||
1437 | 1, DMA_FROM_DEVICE); | ||
1438 | sport->dma_is_rxing = 0; | ||
1439 | } | ||
1437 | 1440 | ||
1438 | spin_lock_irqsave(&sport->port.lock, flags); | 1441 | spin_lock_irqsave(&sport->port.lock, flags); |
1439 | imx_uart_stop_tx(port); | 1442 | imx_uart_stop_tx(port); |
@@ -1449,6 +1452,10 @@ static void imx_uart_shutdown(struct uart_port *port) | |||
1449 | ucr2 = imx_uart_readl(sport, UCR2); | 1452 | ucr2 = imx_uart_readl(sport, UCR2); |
1450 | ucr2 &= ~(UCR2_TXEN | UCR2_ATEN); | 1453 | ucr2 &= ~(UCR2_TXEN | UCR2_ATEN); |
1451 | imx_uart_writel(sport, ucr2, UCR2); | 1454 | imx_uart_writel(sport, ucr2, UCR2); |
1455 | |||
1456 | ucr4 = imx_uart_readl(sport, UCR4); | ||
1457 | ucr4 &= ~UCR4_OREN; | ||
1458 | imx_uart_writel(sport, ucr4, UCR4); | ||
1452 | spin_unlock_irqrestore(&sport->port.lock, flags); | 1459 | spin_unlock_irqrestore(&sport->port.lock, flags); |
1453 | 1460 | ||
1454 | /* | 1461 | /* |
@@ -2425,8 +2432,7 @@ static void imx_uart_enable_wakeup(struct imx_port *sport, bool on) | |||
2425 | 2432 | ||
2426 | static int imx_uart_suspend_noirq(struct device *dev) | 2433 | static int imx_uart_suspend_noirq(struct device *dev) |
2427 | { | 2434 | { |
2428 | struct platform_device *pdev = to_platform_device(dev); | 2435 | struct imx_port *sport = dev_get_drvdata(dev); |
2429 | struct imx_port *sport = platform_get_drvdata(pdev); | ||
2430 | 2436 | ||
2431 | imx_uart_save_context(sport); | 2437 | imx_uart_save_context(sport); |
2432 | 2438 | ||
@@ -2437,8 +2443,7 @@ static int imx_uart_suspend_noirq(struct device *dev) | |||
2437 | 2443 | ||
2438 | static int imx_uart_resume_noirq(struct device *dev) | 2444 | static int imx_uart_resume_noirq(struct device *dev) |
2439 | { | 2445 | { |
2440 | struct platform_device *pdev = to_platform_device(dev); | 2446 | struct imx_port *sport = dev_get_drvdata(dev); |
2441 | struct imx_port *sport = platform_get_drvdata(pdev); | ||
2442 | int ret; | 2447 | int ret; |
2443 | 2448 | ||
2444 | ret = clk_enable(sport->clk_ipg); | 2449 | ret = clk_enable(sport->clk_ipg); |
@@ -2452,8 +2457,7 @@ static int imx_uart_resume_noirq(struct device *dev) | |||
2452 | 2457 | ||
2453 | static int imx_uart_suspend(struct device *dev) | 2458 | static int imx_uart_suspend(struct device *dev) |
2454 | { | 2459 | { |
2455 | struct platform_device *pdev = to_platform_device(dev); | 2460 | struct imx_port *sport = dev_get_drvdata(dev); |
2456 | struct imx_port *sport = platform_get_drvdata(pdev); | ||
2457 | int ret; | 2461 | int ret; |
2458 | 2462 | ||
2459 | uart_suspend_port(&imx_uart_uart_driver, &sport->port); | 2463 | uart_suspend_port(&imx_uart_uart_driver, &sport->port); |
@@ -2471,8 +2475,7 @@ static int imx_uart_suspend(struct device *dev) | |||
2471 | 2475 | ||
2472 | static int imx_uart_resume(struct device *dev) | 2476 | static int imx_uart_resume(struct device *dev) |
2473 | { | 2477 | { |
2474 | struct platform_device *pdev = to_platform_device(dev); | 2478 | struct imx_port *sport = dev_get_drvdata(dev); |
2475 | struct imx_port *sport = platform_get_drvdata(pdev); | ||
2476 | 2479 | ||
2477 | /* disable wakeup from i.MX UART */ | 2480 | /* disable wakeup from i.MX UART */ |
2478 | imx_uart_enable_wakeup(sport, false); | 2481 | imx_uart_enable_wakeup(sport, false); |
@@ -2487,8 +2490,7 @@ static int imx_uart_resume(struct device *dev) | |||
2487 | 2490 | ||
2488 | static int imx_uart_freeze(struct device *dev) | 2491 | static int imx_uart_freeze(struct device *dev) |
2489 | { | 2492 | { |
2490 | struct platform_device *pdev = to_platform_device(dev); | 2493 | struct imx_port *sport = dev_get_drvdata(dev); |
2491 | struct imx_port *sport = platform_get_drvdata(pdev); | ||
2492 | 2494 | ||
2493 | uart_suspend_port(&imx_uart_uart_driver, &sport->port); | 2495 | uart_suspend_port(&imx_uart_uart_driver, &sport->port); |
2494 | 2496 | ||
@@ -2497,8 +2499,7 @@ static int imx_uart_freeze(struct device *dev) | |||
2497 | 2499 | ||
2498 | static int imx_uart_thaw(struct device *dev) | 2500 | static int imx_uart_thaw(struct device *dev) |
2499 | { | 2501 | { |
2500 | struct platform_device *pdev = to_platform_device(dev); | 2502 | struct imx_port *sport = dev_get_drvdata(dev); |
2501 | struct imx_port *sport = platform_get_drvdata(pdev); | ||
2502 | 2503 | ||
2503 | uart_resume_port(&imx_uart_uart_driver, &sport->port); | 2504 | uart_resume_port(&imx_uart_uart_driver, &sport->port); |
2504 | 2505 | ||