aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2015-09-04 11:52:41 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-10-04 13:43:06 -0400
commit905c0decad28402aa166975023fb88c8f62f93c8 (patch)
tree28db898fa0944dd8f9de65cad4bfb9f062408ac3
parent184bd70bbc81ff0aa561eb51914c952225e42aab (diff)
serial: imx: don't use idle condition detect for DMA transfers
The reference manual states that idle condition detect should not be used with DMA transfers, as the ROM SDMA scripts don't check those conditions. The RAM SDMA scripts worked around this, but the change broke compatibility with the ROM scripts. The previous commits fixed the DMA burst sizes, so that the aging timer is now working as described in the reference manual. With this fixed we can remove the hack of using the idle condition detect to stop the DMA transfer if there are no new characters incoming. This should work with both the ROM and RAM SDMA scripts. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Acked-by: Jiada Wang <jiada_wang@mentor.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/imx.c31
1 files changed, 5 insertions, 26 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index cfda31a7edd6..f1366cf4e6a9 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -884,14 +884,12 @@ static void imx_rx_dma_done(struct imx_port *sport)
884} 884}
885 885
886/* 886/*
887 * There are three kinds of RX DMA interrupts(such as in the MX6Q): 887 * There are two kinds of RX DMA interrupts(such as in the MX6Q):
888 * [1] the RX DMA buffer is full. 888 * [1] the RX DMA buffer is full.
889 * [2] the Aging timer expires(wait for 8 bytes long) 889 * [2] the aging timer expires
890 * [3] the Idle Condition Detect(enabled the UCR4_IDDMAEN).
891 * 890 *
892 * The [2] is trigger when a character was been sitting in the FIFO 891 * Condition [2] is triggered when a character has been sitting in the FIFO
893 * meanwhile [3] can wait for 32 bytes long when the RX line is 892 * for at least 8 byte durations.
894 * on IDLE state and RxFIFO is empty.
895 */ 893 */
896static void dma_rx_callback(void *data) 894static void dma_rx_callback(void *data)
897{ 895{
@@ -909,13 +907,6 @@ static void dma_rx_callback(void *data)
909 status = dmaengine_tx_status(chan, (dma_cookie_t)0, &state); 907 status = dmaengine_tx_status(chan, (dma_cookie_t)0, &state);
910 count = RX_BUF_SIZE - state.residue; 908 count = RX_BUF_SIZE - state.residue;
911 909
912 if (readl(sport->port.membase + USR2) & USR2_IDLE) {
913 /* In condition [3] the SDMA counted up too early */
914 count--;
915
916 writel(USR2_IDLE, sport->port.membase + USR2);
917 }
918
919 dev_dbg(sport->port.dev, "We get %d bytes.\n", count); 910 dev_dbg(sport->port.dev, "We get %d bytes.\n", count);
920 911
921 if (count) { 912 if (count) {
@@ -1072,20 +1063,13 @@ static void imx_enable_dma(struct imx_port *sport)
1072 1063
1073 /* set UCR1 */ 1064 /* set UCR1 */
1074 temp = readl(sport->port.membase + UCR1); 1065 temp = readl(sport->port.membase + UCR1);
1075 temp |= UCR1_RDMAEN | UCR1_TDMAEN | UCR1_ATDMAEN | 1066 temp |= UCR1_RDMAEN | UCR1_TDMAEN | UCR1_ATDMAEN;
1076 /* wait for 32 idle frames for IDDMA interrupt */
1077 UCR1_ICD_REG(3);
1078 writel(temp, sport->port.membase + UCR1); 1067 writel(temp, sport->port.membase + UCR1);
1079 1068
1080 temp = readl(sport->port.membase + UCR2); 1069 temp = readl(sport->port.membase + UCR2);
1081 temp |= UCR2_ATEN; 1070 temp |= UCR2_ATEN;
1082 writel(temp, sport->port.membase + UCR2); 1071 writel(temp, sport->port.membase + UCR2);
1083 1072
1084 /* set UCR4 */
1085 temp = readl(sport->port.membase + UCR4);
1086 temp |= UCR4_IDDMAEN;
1087 writel(temp, sport->port.membase + UCR4);
1088
1089 imx_setup_ufcr(sport, TXTL_DMA, RXTL_DMA); 1073 imx_setup_ufcr(sport, TXTL_DMA, RXTL_DMA);
1090 1074
1091 sport->dma_is_enabled = 1; 1075 sport->dma_is_enabled = 1;
@@ -1105,11 +1089,6 @@ static void imx_disable_dma(struct imx_port *sport)
1105 temp &= ~(UCR2_CTSC | UCR2_CTS | UCR2_ATEN); 1089 temp &= ~(UCR2_CTSC | UCR2_CTS | UCR2_ATEN);
1106 writel(temp, sport->port.membase + UCR2); 1090 writel(temp, sport->port.membase + UCR2);
1107 1091
1108 /* clear UCR4 */
1109 temp = readl(sport->port.membase + UCR4);
1110 temp &= ~UCR4_IDDMAEN;
1111 writel(temp, sport->port.membase + UCR4);
1112
1113 imx_setup_ufcr(sport, TXTL_DEFAULT, RXTL_DEFAULT); 1092 imx_setup_ufcr(sport, TXTL_DEFAULT, RXTL_DEFAULT);
1114 1093
1115 sport->dma_is_enabled = 0; 1094 sport->dma_is_enabled = 0;