diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-07-17 07:48:58 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-07-17 07:48:58 -0400 |
commit | 351ea50df545a4acaf8f61784949ceedbe923f03 (patch) | |
tree | 12c8e902625bbbccb3e3e9ac482db3d44398f702 /drivers | |
parent | 4ab3c51e0540ba8464fe34d84cc35821bb77ae92 (diff) |
Revert "serial: imx-serial - move DMA buffer configuration to DT"
This reverts commit a3015affdf76ef279fbbb3710a220bab7e9ea04b as there
are complaints that it is incorrect.
Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Nandor Han <nandor.han@ge.com>
Cc: Romain Perier <romain.perier@collabora.com>
Signed-off-by: Greg Kroah-Hartman gregkh@linuxfoundation.org
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/tty/serial/imx.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 9e3162bf3bd1..e33da75ceac5 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
@@ -186,11 +186,6 @@ | |||
186 | 186 | ||
187 | #define UART_NR 8 | 187 | #define UART_NR 8 |
188 | 188 | ||
189 | /* RX DMA buffer periods */ | ||
190 | #define RX_DMA_PERIODS 4 | ||
191 | #define RX_BUF_SIZE (PAGE_SIZE) | ||
192 | |||
193 | |||
194 | /* i.MX21 type uart runs on all i.mx except i.MX1 and i.MX6q */ | 189 | /* i.MX21 type uart runs on all i.mx except i.MX1 and i.MX6q */ |
195 | enum imx_uart_type { | 190 | enum imx_uart_type { |
196 | IMX1_UART, | 191 | IMX1_UART, |
@@ -226,7 +221,6 @@ struct imx_port { | |||
226 | struct dma_chan *dma_chan_rx, *dma_chan_tx; | 221 | struct dma_chan *dma_chan_rx, *dma_chan_tx; |
227 | struct scatterlist rx_sgl, tx_sgl[2]; | 222 | struct scatterlist rx_sgl, tx_sgl[2]; |
228 | void *rx_buf; | 223 | void *rx_buf; |
229 | unsigned int rx_buf_size; | ||
230 | struct circ_buf rx_ring; | 224 | struct circ_buf rx_ring; |
231 | unsigned int rx_periods; | 225 | unsigned int rx_periods; |
232 | dma_cookie_t rx_cookie; | 226 | dma_cookie_t rx_cookie; |
@@ -967,6 +961,8 @@ static void imx_timeout(unsigned long data) | |||
967 | } | 961 | } |
968 | } | 962 | } |
969 | 963 | ||
964 | #define RX_BUF_SIZE (PAGE_SIZE) | ||
965 | |||
970 | /* | 966 | /* |
971 | * There are two kinds of RX DMA interrupts(such as in the MX6Q): | 967 | * There are two kinds of RX DMA interrupts(such as in the MX6Q): |
972 | * [1] the RX DMA buffer is full. | 968 | * [1] the RX DMA buffer is full. |
@@ -1049,6 +1045,9 @@ static void dma_rx_callback(void *data) | |||
1049 | } | 1045 | } |
1050 | } | 1046 | } |
1051 | 1047 | ||
1048 | /* RX DMA buffer periods */ | ||
1049 | #define RX_DMA_PERIODS 4 | ||
1050 | |||
1052 | static int start_rx_dma(struct imx_port *sport) | 1051 | static int start_rx_dma(struct imx_port *sport) |
1053 | { | 1052 | { |
1054 | struct scatterlist *sgl = &sport->rx_sgl; | 1053 | struct scatterlist *sgl = &sport->rx_sgl; |
@@ -1059,8 +1058,9 @@ static int start_rx_dma(struct imx_port *sport) | |||
1059 | 1058 | ||
1060 | sport->rx_ring.head = 0; | 1059 | sport->rx_ring.head = 0; |
1061 | sport->rx_ring.tail = 0; | 1060 | sport->rx_ring.tail = 0; |
1061 | sport->rx_periods = RX_DMA_PERIODS; | ||
1062 | 1062 | ||
1063 | sg_init_one(sgl, sport->rx_buf, sport->rx_buf_size); | 1063 | sg_init_one(sgl, sport->rx_buf, RX_BUF_SIZE); |
1064 | ret = dma_map_sg(dev, sgl, 1, DMA_FROM_DEVICE); | 1064 | ret = dma_map_sg(dev, sgl, 1, DMA_FROM_DEVICE); |
1065 | if (ret == 0) { | 1065 | if (ret == 0) { |
1066 | dev_err(dev, "DMA mapping error for RX.\n"); | 1066 | dev_err(dev, "DMA mapping error for RX.\n"); |
@@ -1171,7 +1171,7 @@ static int imx_uart_dma_init(struct imx_port *sport) | |||
1171 | goto err; | 1171 | goto err; |
1172 | } | 1172 | } |
1173 | 1173 | ||
1174 | sport->rx_buf = kzalloc(sport->rx_buf_size, GFP_KERNEL); | 1174 | sport->rx_buf = kzalloc(PAGE_SIZE, GFP_KERNEL); |
1175 | if (!sport->rx_buf) { | 1175 | if (!sport->rx_buf) { |
1176 | ret = -ENOMEM; | 1176 | ret = -ENOMEM; |
1177 | goto err; | 1177 | goto err; |
@@ -2036,7 +2036,6 @@ static int serial_imx_probe_dt(struct imx_port *sport, | |||
2036 | { | 2036 | { |
2037 | struct device_node *np = pdev->dev.of_node; | 2037 | struct device_node *np = pdev->dev.of_node; |
2038 | int ret; | 2038 | int ret; |
2039 | u32 dma_buf_size[2]; | ||
2040 | 2039 | ||
2041 | sport->devdata = of_device_get_match_data(&pdev->dev); | 2040 | sport->devdata = of_device_get_match_data(&pdev->dev); |
2042 | if (!sport->devdata) | 2041 | if (!sport->devdata) |
@@ -2060,14 +2059,6 @@ static int serial_imx_probe_dt(struct imx_port *sport, | |||
2060 | if (of_get_property(np, "rts-gpios", NULL)) | 2059 | if (of_get_property(np, "rts-gpios", NULL)) |
2061 | sport->have_rtsgpio = 1; | 2060 | sport->have_rtsgpio = 1; |
2062 | 2061 | ||
2063 | if (!of_property_read_u32_array(np, "fsl,dma-size", dma_buf_size, 2)) { | ||
2064 | sport->rx_buf_size = dma_buf_size[0] * dma_buf_size[1]; | ||
2065 | sport->rx_periods = dma_buf_size[1]; | ||
2066 | } else { | ||
2067 | sport->rx_buf_size = RX_BUF_SIZE; | ||
2068 | sport->rx_periods = RX_DMA_PERIODS; | ||
2069 | } | ||
2070 | |||
2071 | return 0; | 2062 | return 0; |
2072 | } | 2063 | } |
2073 | #else | 2064 | #else |