Revert "serial: imx-serial - move DMA buffer configuration to DT"

This reverts commit a3015affdf 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
This commit is contained in:
Greg Kroah-Hartman 2017-07-17 13:48:58 +02:00
parent 4ab3c51e05
commit 351ea50df5
2 changed files with 8 additions and 19 deletions

View File

@ -9,7 +9,6 @@ Optional properties:
- fsl,irda-mode : Indicate the uart supports irda mode - fsl,irda-mode : Indicate the uart supports irda mode
- fsl,dte-mode : Indicate the uart works in DTE mode. The uart works - fsl,dte-mode : Indicate the uart works in DTE mode. The uart works
in DCE mode by default. in DCE mode by default.
- fsl,dma-size : Indicate the size of the DMA buffer and its periods
Please check Documentation/devicetree/bindings/serial/serial.txt Please check Documentation/devicetree/bindings/serial/serial.txt
for the complete list of generic properties. for the complete list of generic properties.
@ -29,5 +28,4 @@ uart1: serial@73fbc000 {
interrupts = <31>; interrupts = <31>;
uart-has-rtscts; uart-has-rtscts;
fsl,dte-mode; fsl,dte-mode;
fsl,dma-size = <1024 4>;
}; };

View File

@ -186,11 +186,6 @@
#define UART_NR 8 #define UART_NR 8
/* RX DMA buffer periods */
#define RX_DMA_PERIODS 4
#define RX_BUF_SIZE (PAGE_SIZE)
/* i.MX21 type uart runs on all i.mx except i.MX1 and i.MX6q */ /* i.MX21 type uart runs on all i.mx except i.MX1 and i.MX6q */
enum imx_uart_type { enum imx_uart_type {
IMX1_UART, IMX1_UART,
@ -226,7 +221,6 @@ struct imx_port {
struct dma_chan *dma_chan_rx, *dma_chan_tx; struct dma_chan *dma_chan_rx, *dma_chan_tx;
struct scatterlist rx_sgl, tx_sgl[2]; struct scatterlist rx_sgl, tx_sgl[2];
void *rx_buf; void *rx_buf;
unsigned int rx_buf_size;
struct circ_buf rx_ring; struct circ_buf rx_ring;
unsigned int rx_periods; unsigned int rx_periods;
dma_cookie_t rx_cookie; dma_cookie_t rx_cookie;
@ -967,6 +961,8 @@ static void imx_timeout(unsigned long data)
} }
} }
#define RX_BUF_SIZE (PAGE_SIZE)
/* /*
* There are two kinds of RX DMA interrupts(such as in the MX6Q): * There are two kinds of RX DMA interrupts(such as in the MX6Q):
* [1] the RX DMA buffer is full. * [1] the RX DMA buffer is full.
@ -1049,6 +1045,9 @@ static void dma_rx_callback(void *data)
} }
} }
/* RX DMA buffer periods */
#define RX_DMA_PERIODS 4
static int start_rx_dma(struct imx_port *sport) static int start_rx_dma(struct imx_port *sport)
{ {
struct scatterlist *sgl = &sport->rx_sgl; struct scatterlist *sgl = &sport->rx_sgl;
@ -1059,8 +1058,9 @@ static int start_rx_dma(struct imx_port *sport)
sport->rx_ring.head = 0; sport->rx_ring.head = 0;
sport->rx_ring.tail = 0; sport->rx_ring.tail = 0;
sport->rx_periods = RX_DMA_PERIODS;
sg_init_one(sgl, sport->rx_buf, sport->rx_buf_size); sg_init_one(sgl, sport->rx_buf, RX_BUF_SIZE);
ret = dma_map_sg(dev, sgl, 1, DMA_FROM_DEVICE); ret = dma_map_sg(dev, sgl, 1, DMA_FROM_DEVICE);
if (ret == 0) { if (ret == 0) {
dev_err(dev, "DMA mapping error for RX.\n"); dev_err(dev, "DMA mapping error for RX.\n");
@ -1171,7 +1171,7 @@ static int imx_uart_dma_init(struct imx_port *sport)
goto err; goto err;
} }
sport->rx_buf = kzalloc(sport->rx_buf_size, GFP_KERNEL); sport->rx_buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
if (!sport->rx_buf) { if (!sport->rx_buf) {
ret = -ENOMEM; ret = -ENOMEM;
goto err; goto err;
@ -2036,7 +2036,6 @@ static int serial_imx_probe_dt(struct imx_port *sport,
{ {
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
int ret; int ret;
u32 dma_buf_size[2];
sport->devdata = of_device_get_match_data(&pdev->dev); sport->devdata = of_device_get_match_data(&pdev->dev);
if (!sport->devdata) if (!sport->devdata)
@ -2060,14 +2059,6 @@ static int serial_imx_probe_dt(struct imx_port *sport,
if (of_get_property(np, "rts-gpios", NULL)) if (of_get_property(np, "rts-gpios", NULL))
sport->have_rtsgpio = 1; sport->have_rtsgpio = 1;
if (!of_property_read_u32_array(np, "fsl,dma-size", dma_buf_size, 2)) {
sport->rx_buf_size = dma_buf_size[0] * dma_buf_size[1];
sport->rx_periods = dma_buf_size[1];
} else {
sport->rx_buf_size = RX_BUF_SIZE;
sport->rx_periods = RX_DMA_PERIODS;
}
return 0; return 0;
} }
#else #else