* [PATCH] serial: tegra: read DMA status before terminating
@ 2022-10-18 6:25 Kartik
2022-10-18 6:25 ` Kartik
2022-10-18 13:18 ` Jon Hunter
0 siblings, 2 replies; 8+ messages in thread
From: Kartik @ 2022-10-18 6:25 UTC (permalink / raw)
To: ldewangan, gregkh, jirislaby, thierry.reding, jonathanh, swarren,
akhilrajeev, linux-serial, linux-tegra, linux-kernel
To get the valid data, read DMA status before terminating the DMA. As
dmaengine_terminate_all() deletes the DMA desc.
Fixes: e9ea096dd225 ("serial: tegra: add serial driver")
Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
Signed-off-by: Kartik <kkartik@nvidia.com>
---
drivers/tty/serial/serial-tegra.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c
index b7170cb9a544..2779b4491f02 100644
--- a/drivers/tty/serial/serial-tegra.c
+++ b/drivers/tty/serial/serial-tegra.c
@@ -619,8 +619,8 @@ static void tegra_uart_stop_tx(struct uart_port *u)
if (tup->tx_in_progress != TEGRA_UART_TX_DMA)
return;
- dmaengine_terminate_all(tup->tx_dma_chan);
dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state);
+ dmaengine_terminate_all(tup->tx_dma_chan);
count = tup->tx_bytes_requested - state.residue;
async_tx_ack(tup->tx_dma_desc);
uart_xmit_advance(&tup->uport, count);
@@ -763,8 +763,8 @@ static void tegra_uart_terminate_rx_dma(struct tegra_uart_port *tup)
return;
}
- dmaengine_terminate_all(tup->rx_dma_chan);
dmaengine_tx_status(tup->rx_dma_chan, tup->rx_cookie, &state);
+ dmaengine_terminate_all(tup->rx_dma_chan);
tegra_uart_rx_buffer_push(tup, state.residue);
tup->rx_dma_active = false;
--
2.17.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] serial: tegra: read DMA status before terminating
2022-10-18 6:25 [PATCH] serial: tegra: read DMA status before terminating Kartik
@ 2022-10-18 6:25 ` Kartik
2022-10-18 6:38 ` Greg KH
2022-10-18 13:18 ` Jon Hunter
1 sibling, 1 reply; 8+ messages in thread
From: Kartik @ 2022-10-18 6:25 UTC (permalink / raw)
To: ldewangan, gregkh, jirislaby, thierry.reding, jonathanh, swarren,
akhilrajeev, linux-serial, linux-tegra, linux-kernel
To get the valid data, read DMA status before terminating the DMA. As
dmaengine_terminate_all() deletes the DMA desc.
Fixes: e9ea096dd225 ("serial: tegra: add serial driver")
Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
Signed-off-by: Kartik <kkartik@nvidia.com>
---
drivers/tty/serial/serial-tegra.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c
index b7170cb9a544..2779b4491f02 100644
--- a/drivers/tty/serial/serial-tegra.c
+++ b/drivers/tty/serial/serial-tegra.c
@@ -619,8 +619,8 @@ static void tegra_uart_stop_tx(struct uart_port *u)
if (tup->tx_in_progress != TEGRA_UART_TX_DMA)
return;
- dmaengine_terminate_all(tup->tx_dma_chan);
dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state);
+ dmaengine_terminate_all(tup->tx_dma_chan);
count = tup->tx_bytes_requested - state.residue;
async_tx_ack(tup->tx_dma_desc);
uart_xmit_advance(&tup->uport, count);
@@ -763,8 +763,8 @@ static void tegra_uart_terminate_rx_dma(struct tegra_uart_port *tup)
return;
}
- dmaengine_terminate_all(tup->rx_dma_chan);
dmaengine_tx_status(tup->rx_dma_chan, tup->rx_cookie, &state);
+ dmaengine_terminate_all(tup->rx_dma_chan);
tegra_uart_rx_buffer_push(tup, state.residue);
tup->rx_dma_active = false;
--
2.17.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] serial: tegra: read DMA status before terminating
2022-10-18 6:25 ` Kartik
@ 2022-10-18 6:38 ` Greg KH
2022-10-18 6:55 ` Kartik
0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2022-10-18 6:38 UTC (permalink / raw)
To: Kartik
Cc: ldewangan, jirislaby, thierry.reding, jonathanh, swarren,
akhilrajeev, linux-serial, linux-tegra, linux-kernel
On Tue, Oct 18, 2022 at 11:55:11AM +0530, Kartik wrote:
> To get the valid data, read DMA status before terminating the DMA. As
> dmaengine_terminate_all() deletes the DMA desc.
>
> Fixes: e9ea096dd225 ("serial: tegra: add serial driver")
>
> Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
> Signed-off-by: Kartik <kkartik@nvidia.com>
> ---
> drivers/tty/serial/serial-tegra.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Why send this twice?
confused,
greg k-h
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] serial: tegra: read DMA status before terminating
2022-10-18 6:38 ` Greg KH
@ 2022-10-18 6:55 ` Kartik
2022-10-18 7:02 ` Greg KH
0 siblings, 1 reply; 8+ messages in thread
From: Kartik @ 2022-10-18 6:55 UTC (permalink / raw)
To: gregkh
Cc: akhilrajeev, jirislaby, jonathanh, kkartik, ldewangan,
linux-kernel, linux-serial, linux-tegra, swarren, thierry.reding
On Tue, Oct 18, 2022 at 12:08, Greg KH wrote:
> Why send this twice?
>
> confused,
Hi Greg,
I made a mistake in my "git send-email" and the patch got posted twice.
Regards,
Kartik
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] serial: tegra: read DMA status before terminating
2022-10-18 6:55 ` Kartik
@ 2022-10-18 7:02 ` Greg KH
2022-10-18 7:21 ` Kartik
0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2022-10-18 7:02 UTC (permalink / raw)
To: Kartik
Cc: akhilrajeev, jirislaby, jonathanh, ldewangan, linux-kernel,
linux-serial, linux-tegra, swarren, thierry.reding
On Tue, Oct 18, 2022 at 12:25:16PM +0530, Kartik wrote:
> On Tue, Oct 18, 2022 at 12:08, Greg KH wrote:
> > Why send this twice?
> >
> > confused,
>
> Hi Greg,
>
> I made a mistake in my "git send-email" and the patch got posted twice.
So which one is correct?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] serial: tegra: read DMA status before terminating
2022-10-18 7:02 ` Greg KH
@ 2022-10-18 7:21 ` Kartik
0 siblings, 0 replies; 8+ messages in thread
From: Kartik @ 2022-10-18 7:21 UTC (permalink / raw)
To: gregkh
Cc: akhilrajeev, jirislaby, jonathanh, kkartik, ldewangan,
linux-kernel, linux-serial, linux-tegra, swarren, thierry.reding
On Tue, Oct 18, 2022 at 12:32, Greg KH wrote:
> So which one is correct?
They are basically the same patch. I goofed up while sending it.
Please ignore the previous patch.
Regards,
Kartik
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] serial: tegra: read DMA status before terminating
2022-10-18 6:25 [PATCH] serial: tegra: read DMA status before terminating Kartik
2022-10-18 6:25 ` Kartik
@ 2022-10-18 13:18 ` Jon Hunter
2022-10-18 13:33 ` Kartik
1 sibling, 1 reply; 8+ messages in thread
From: Jon Hunter @ 2022-10-18 13:18 UTC (permalink / raw)
To: Kartik, ldewangan, gregkh, jirislaby, thierry.reding, swarren,
akhilrajeev, linux-serial, linux-tegra, linux-kernel
On 18/10/2022 07:25, Kartik wrote:
> To get the valid data, read DMA status before terminating the DMA. As
> dmaengine_terminate_all() deletes the DMA desc.
>
> Fixes: e9ea096dd225 ("serial: tegra: add serial driver")
>
> Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
> Signed-off-by: Kartik <kkartik@nvidia.com>
> ---
> drivers/tty/serial/serial-tegra.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c
> index b7170cb9a544..2779b4491f02 100644
> --- a/drivers/tty/serial/serial-tegra.c
> +++ b/drivers/tty/serial/serial-tegra.c
> @@ -619,8 +619,8 @@ static void tegra_uart_stop_tx(struct uart_port *u)
> if (tup->tx_in_progress != TEGRA_UART_TX_DMA)
> return;
>
> - dmaengine_terminate_all(tup->tx_dma_chan);
> dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state);
> + dmaengine_terminate_all(tup->tx_dma_chan);
The change looks fine to me, but on further review of other similar
drivers I see that they pause first ...
dmaengine_pause(tup->tx_dma_chan);
dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state);
dmaengine_terminate_all(tup->tx_dma_chan);
This makes sense so that when we calculate the amount of the data
transferred we get the exact amount. Can we add a pause while we are at it?
Thanks!
Jon
--
nvpublic
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] serial: tegra: read DMA status before terminating
2022-10-18 13:18 ` Jon Hunter
@ 2022-10-18 13:33 ` Kartik
0 siblings, 0 replies; 8+ messages in thread
From: Kartik @ 2022-10-18 13:33 UTC (permalink / raw)
To: jonathanh
Cc: akhilrajeev, gregkh, jirislaby, kkartik, ldewangan, linux-kernel,
linux-serial, linux-tegra, swarren, thierry.reding
> The change looks fine to me, but on further review of other similar
> drivers I see that they pause first ...
>
> dmaengine_pause(tup->tx_dma_chan);
> dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state);
> dmaengine_terminate_all(tup->tx_dma_chan);
>
> This makes sense so that when we calculate the amount of the data
> transferred we get the exact amount. Can we add a pause while we are at it?
>
> Thanks!
> Jon
I agree.. I will include this in v2.
Regards,
Kartik
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-10-18 13:34 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-18 6:25 [PATCH] serial: tegra: read DMA status before terminating Kartik
2022-10-18 6:25 ` Kartik
2022-10-18 6:38 ` Greg KH
2022-10-18 6:55 ` Kartik
2022-10-18 7:02 ` Greg KH
2022-10-18 7:21 ` Kartik
2022-10-18 13:18 ` Jon Hunter
2022-10-18 13:33 ` Kartik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).