IMX/SDMA : save the real count for one DMA transaction.
Subsystems (2)
PATCH 1/1 IMX/SDMA : save the real count for one DMA transaction.
When we use the SDMA in the UART driver(such as imx6q), we will meet one situation:
Assume we set 64 bytes for the RX DMA buffer.
The receiving DMA buffer is not full, but the an Aging DMA request will be received by the SDMA controller if we enable the IDDMAEN(UCR4[6]).
The UART driver needs to know the count of the real received bytes,
and push them to upper layer.
So reuse the private field of dma_chan{}. Store the count of received bytes
to it, and use it in the UART driver.
--- drivers/dma/imx-sdma.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/dma/imx-sdma.c +6 -0
@@ -501,6 +501,8 @@ static void sdma_handle_channel_loop(struct sdma_channel *sdmac)static void mxc_sdma_handle_channel_normal (struct sdma_channel *sdmac) {struct sdma_buffer_descriptor *bd; +struct dma_chan *chan = &sdmac->chan; +unsigned int count;int i, error =0 ;/*
@@ -512,8 +514,12 @@ static void mxc_sdma_handle_channel_normal(struct sdma_channel *sdmac)if (bd->mode.status & (BD_DONE |BD_RROR )) error = -EIO ; + count += bd->mode.count; } +/* save the real count we received or transmitted. */ + chan->private = (void *)count; +if (error) sdmac->status =DMA_ERROR ;else
Signature · 1 line
1.7.3.2
PATCH 1/1 IMX/SDMA : save the real count for one DMA transaction.
drivers/dma/imx-sdma.c static void mxc_sdma_handle_channel_normal(struct sdma_channel *sdmac) · line 521
Quoted 3 lines
drivers/dma/imx-sdma.c +2
-0+/* save the real count we received or transmitted. */ + chan->private = (void *)count;
And if someone later needs another variable which is private?
Signature · 9 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20111123/f7f9bd81/attachment.sig>
PATCH 1/1 IMX/SDMA : save the real count for one DMA transaction.
Hi,
Quoted 4 lines
drivers/dma/imx-sdma.c static void mxc_sdma_handle_channel_normal(struct sdma_channel *sdmac) · line 521
Quoted 2 lines
drivers/dma/imx-sdma.c +2
-0+/* save the real count we received or transmitted. */ + chan->private = (void *)count;And if someone later needs another variable which is private?
I ever wanted to add an new parameter void * to dma_aync_tx_callback, but it seemed i have
to change a lot of files.
Do you have any better suggestion?
thanks
Huang Shijie
PATCH 1/1 IMX/SDMA : save the real count for one DMA transaction.
Quoted 10 lines
Quoted 5 lines
drivers/dma/imx-sdma.c static void mxc_sdma_handle_channel_normal(struct sdma_channel *sdmac) · line 521
Quoted 3 lines
drivers/dma/imx-sdma.c +2
-0+/* save the real count we received or transmitted. */ + chan->private = (void *)count;And if someone later needs another variable which is private?
I ever wanted to add an new parameter
void *todma_aync_tx_callback, but it seemed i have
to change a lot of files.Do you have any better suggestion?
Use a private struct and put count in there.
Signature · 9 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20111123/79e7a6d7/attachment.sig>
PATCH 1/1 IMX/SDMA : save the real count for one DMA transaction.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/dma/imx-sdma.c static void mxc_sdma_handle_channel_normal(struct sdma_channel *sdmac) · line 521
Quoted 3 lines
drivers/dma/imx-sdma.c +2
-0+/* save the real count we received or transmitted. */ + chan->private = (void *)count;And if someone later needs another variable which is private?
Quoted 7 lines
Quoted 5 lines
I ever wanted to add an new parameter
void *todma_aync_tx_callback, but it seemed i have
to change a lot of files.Do you have any better suggestion?
Use a private struct and put count in there.
Where to put the private struct? in the imx-sdma.c ?
If i put it there, how can i get it in the UART driver with the current DMA API?
thanks
Huang Shijie
PATCH 1/1 IMX/SDMA : save the real count for one DMA transaction.
Quoted 9 lines · Huang Shijie
Quoted 9 lines
Quoted 9 lines
Quoted 5 lines
drivers/dma/imx-sdma.c static void mxc_sdma_handle_channel_normal(struct sdma_channel *sdmac) · line 521
Quoted 3 lines
drivers/dma/imx-sdma.c +2
-0+/* save the real count we received or transmitted. */ + chan->private = (void *)count;And if someone later needs another variable which is private?
I ever wanted to add an new parameter
void *todma_aync_tx_callback, but it seemed i have
to change a lot of files.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Do you have any better suggestion?
Use a private struct and put count in there.
Where to put the private struct? in the
imx-sdma.c?
If i put it there, how can i get it in the UART driver with the current DMA API?
So, in the UART driver you assume that void* is an int? Or how do you currently use count?
Signature · 9 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20111123/ad9bf81d/attachment.sig>
PATCH 1/1 IMX/SDMA : save the real count for one DMA transaction.
Quoted 10 lines · Huang Shijie
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
drivers/dma/imx-sdma.c static void mxc_sdma_handle_channel_normal(struct sdma_channel *sdmac) · line 521
Quoted 2 lines
drivers/dma/imx-sdma.c +2
-0+/* save the real count we received or transmitted. */ + chan->private = (void *)count;And if someone later needs another variable which is private?
I ever wanted to add an new parameter
void *todma_aync_tx_callback, but it seemed i have
to change a lot of files.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Do you have any better suggestion?
Use a private struct and put count in there.
Where to put the private struct? in the
imx-sdma.c?
If i put it there, how can i get it in the UART driver with the current DMA API?So, in the UART driver you assume that void* is an int? Or how do you currently use count?
In the UART driver, I use the following lines:
-------------------------------------------------------
+ struct dma_chan *chan = sport->dma_chan_rx;
+ unsigned int count = (unsigned int)chan->private;
-------------------------------------------------------
Best Regards
Huang Shijie
PATCH 1/1 IMX/SDMA : save the real count for one DMA transaction.
Quoted 16 lines · Huang Shijie
Quoted 16 lines · Huang Shijie
Quoted 14 lines
Quoted 11 lines
Quoted 9 lines
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ /* save the real count we received or transmitted. */ + chan->private = (void *)count;And if someone later needs another variable which is private?
I ever wanted to add an new parameter
void *todma_aync_tx_callback, but it seemed i have
to change a lot of files.Do you have any better suggestion?
Use a private struct and put count in there.
Where to put the private struct? in the
imx-sdma.c?
If i put it there, how can i get it in the UART driver with the current DMA API?
Quoted 8 lines
Quoted 3 lines
So, in the UART driver you assume that void* is an int? Or how do you currently use count?
In the UART driver, I use the following lines:
-------------------------------------------------------
+ structdma_chan*chan =sport->dma_chan_rx;
+ unsigned int count = (unsigned int)chan->private;
-------------------------------------------------------
And why can't you use a struct here? chan->private->count?
Even then, I doubt if you can get this into mainline. But when you try, please always post a user for this change (or a reference to it), that is, the uart-driver. Otherwise there is no reason to include a change.
Regards,
Wolfram
Signature · 9 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20111123/76eabb09/attachment.sig>
PATCH 1/1 IMX/SDMA : save the real count for one DMA transaction.
? 2011?11?23? 19:36, Wolfram Sang ??:
Quoted 19 lines · Huang Shijie
Quoted 18 lines
Quoted 18 lines · Huang Shijie
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ /* save the real count we received or transmitted. */ + chan->private = (void *)count;And if someone later needs another variable which is private?
I ever wanted to add an new parameter
void *todma_aync_tx_callback, but it seemed i have
to change a lot of files.Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Do you have any better suggestion?
Use a private struct and put count in there.
Where to put the private struct? in the
imx-sdma.c?
If i put it there, how can i get it in the UART driver with the current DMA API?So, in the UART driver you assume that void* is an int? Or how do you currently use count?
Quoted 8 lines
Quoted 5 lines
In the UART driver, I use the following lines:
-------------------------------------------------------
+ structdma_chan*chan =sport->dma_chan_rx;
+ unsigned int count = (unsigned int)chan->private;
-------------------------------------------------------And why can't you use a struct here?
chan->private->count?Even then, I doubt if you can get this into mainline. But when you try,
I wish to post the UART code as well as this patch.
But the PINMUX driver of mx6q is not ready now(so do the mx23/28). I have to send out this single patch now.
thanks.
Huang Shijie
Quoted 8 lines
please always post a user for this change (or a reference to it), that is, the uart-driver. Otherwise there is no reason to include a change.
Regards,
Wolfram
PATCH 1/1 IMX/SDMA : save the real count for one DMA transaction.
In reply to Huang ShijieQuoted 15 lines · Huang Shijie
Quoted 15 lines · Huang Shijie
Quoted 14 lines
Quoted 11 lines
Quoted 9 lines
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ /* save the real count we received or transmitted. */ + chan->private = (void *)count;And if someone later needs another variable which is private?
I ever wanted to add an new parameter
void *todma_aync_tx_callback, but it seemed i have
to change a lot of files.Do you have any better suggestion?
Use a private struct and put count in there.
Where to put the private struct? in the
imx-sdma.c?
If i put it there, how can i get it in the UART driver with the current DMA API?
Quoted 8 lines
Quoted 3 lines
So, in the UART driver you assume that void* is an int? Or how do you currently use count?
In the UART driver, I use the following lines:
-------------------------------------------------------
+ structdma_chan*chan =sport->dma_chan_rx;
+ unsigned int count = (unsigned int)chan->private;
-------------------------------------------------------
Chan->private is a depreciated field, and will be removed soon... possibly 3.3, so obviosly any usage of it is incorrect
Why dont you use .device_tx_status callback and return the number of bytes remaining to be transmitted in residue value of the struct dma_tx_state. That should be size - count.
Signature · 1 line
~Vinod
PATCH 1/1 IMX/SDMA : save the real count for one DMA transaction.
? 2011?11?23? 19:40, Vinod Koul ??:
Quoted 24 lines · Huang Shijie
Quoted 15 lines
Quoted 15 lines · Huang Shijie
Quoted 14 lines
Quoted 11 lines
Quoted 9 lines
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ /* save the real count we received or transmitted. */ + chan->private = (void *)count;And if someone later needs another variable which is private?
I ever wanted to add an new parameter
void *todma_aync_tx_callback, but it seemed i have
to change a lot of files.Do you have any better suggestion?
Use a private struct and put count in there.
Where to put the private struct? in the
imx-sdma.c?
If i put it there, how can i get it in the UART driver with the current DMA API?Quoted 8 lines
Quoted 3 lines
So, in the UART driver you assume that void* is an int? Or how do you currently use count?
In the UART driver, I use the following lines:
-------------------------------------------------------
+ structdma_chan*chan =sport->dma_chan_rx;
+ unsigned int count = (unsigned int)chan->private;
-------------------------------------------------------
Quoted 7 lines
Chan->privateis a depreciated field, and will be removed soon... possibly 3.3, so obviosly any usage of it is incorrectWhy dont you use .device_tx_status callback and return the number of bytes remaining to be transmitted in residue value of the struct
dma_tx_state. That should be size - count.
Thanks a lot.
Huang Shijie