Patchwork mtd: OneNAND: OMAP3: unmap correct DMA buffer

login
register
mail settings
Submitter Mika Westerberg
Date March 23, 2010, 1:33 p.m.
Message ID <1269351224-10637-1-git-send-email-ext-mika.1.westerberg@nokia.com>
Download mbox | patch
Permalink /patch/48337/
State New
Headers show

Comments

Mika Westerberg - March 23, 2010, 1:33 p.m.
Function omap3_onenand_write_bufferram() maps the write buffer and stores the
returned handle in dma_src. However, when it does the DMA unmap, it uses wrong
DMA handle (dma_dst).

This patch fixes it to use the correct DMA handle.

Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
---
 drivers/mtd/onenand/omap2.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Adrian Hunter - March 23, 2010, 1:41 p.m.
Westerberg Mika.1 (EXT-Nixu/Helsinki) wrote:
> Function omap3_onenand_write_bufferram() maps the write buffer and stores the
> returned handle in dma_src. However, when it does the DMA unmap, it uses wrong
> DMA handle (dma_dst).
> 
> This patch fixes it to use the correct DMA handle.
> 
> Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
> ---
>  drivers/mtd/onenand/omap2.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
> index 75f38b9..2d81a3a 100644
> --- a/drivers/mtd/onenand/omap2.c
> +++ b/drivers/mtd/onenand/omap2.c
> @@ -402,7 +402,7 @@ static int omap3_onenand_write_bufferram(struct mtd_info *mtd, int area,
>  
>  	dma_src = dma_map_single(&c->pdev->dev, buf, count, DMA_TO_DEVICE);
>  	dma_dst = c->phys_base + bram_offset;
> -	if (dma_mapping_error(&c->pdev->dev, dma_dst)) {
> +	if (dma_mapping_error(&c->pdev->dev, dma_src)) {
>  		dev_err(&c->pdev->dev,
>  			"Couldn't DMA map a %d byte buffer\n",
>  			count);
> @@ -425,7 +425,7 @@ static int omap3_onenand_write_bufferram(struct mtd_info *mtd, int area,
>  		if (*done)
>  			break;
>  
> -	dma_unmap_single(&c->pdev->dev, dma_dst, count, DMA_TO_DEVICE);
> +	dma_unmap_single(&c->pdev->dev, dma_src, count, DMA_TO_DEVICE);
>  
>  	if (!*done) {
>  		dev_err(&c->pdev->dev, "timeout waiting for DMA\n");

What about omap2_onenand_write_bufferram()
Arnaud Ebalard - April 6, 2010, 7:58 a.m.
Hi,

Mika Westerberg <ext-mika.1.westerberg@nokia.com> writes:

> Function omap3_onenand_write_bufferram() maps the write buffer and stores the
> returned handle in dma_src. However, when it does the DMA unmap, it uses wrong
> DMA handle (dma_dst).
>
> This patch fixes it to use the correct DMA handle.
>
> Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
> ---
>  drivers/mtd/onenand/omap2.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
> index 75f38b9..2d81a3a 100644
> --- a/drivers/mtd/onenand/omap2.c
> +++ b/drivers/mtd/onenand/omap2.c
> @@ -402,7 +402,7 @@ static int omap3_onenand_write_bufferram(struct mtd_info *mtd, int area,
>  
>  	dma_src = dma_map_single(&c->pdev->dev, buf, count, DMA_TO_DEVICE);
>  	dma_dst = c->phys_base + bram_offset;
> -	if (dma_mapping_error(&c->pdev->dev, dma_dst)) {
> +	if (dma_mapping_error(&c->pdev->dev, dma_src)) {
>  		dev_err(&c->pdev->dev,
>  			"Couldn't DMA map a %d byte buffer\n",
>  			count);
> @@ -425,7 +425,7 @@ static int omap3_onenand_write_bufferram(struct mtd_info *mtd, int area,
>  		if (*done)
>  			break;
>  
> -	dma_unmap_single(&c->pdev->dev, dma_dst, count, DMA_TO_DEVICE);
> +	dma_unmap_single(&c->pdev->dev, dma_src, count, DMA_TO_DEVICE);
>  
>  	if (!*done) {
>  		dev_err(&c->pdev->dev, "timeout waiting for DMA\n");

That patch removes the kernel panic I get when booting current l-o
kernel on my N900.

Tested-by: Arnaud Ebalard <arno@natisbad.org>

Cheers,

a+
Adrian Hunter - April 6, 2010, 8:55 a.m.
ext Arnaud Ebalard wrote:
> Hi,
> 
> Mika Westerberg <ext-mika.1.westerberg@nokia.com> writes:
> 
>> Function omap3_onenand_write_bufferram() maps the write buffer and stores the
>> returned handle in dma_src. However, when it does the DMA unmap, it uses wrong
>> DMA handle (dma_dst).
>>
>> This patch fixes it to use the correct DMA handle.
>>
>> Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
>> ---
>>  drivers/mtd/onenand/omap2.c |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
>> index 75f38b9..2d81a3a 100644
>> --- a/drivers/mtd/onenand/omap2.c
>> +++ b/drivers/mtd/onenand/omap2.c
>> @@ -402,7 +402,7 @@ static int omap3_onenand_write_bufferram(struct mtd_info *mtd, int area,
>>  
>>  	dma_src = dma_map_single(&c->pdev->dev, buf, count, DMA_TO_DEVICE);
>>  	dma_dst = c->phys_base + bram_offset;
>> -	if (dma_mapping_error(&c->pdev->dev, dma_dst)) {
>> +	if (dma_mapping_error(&c->pdev->dev, dma_src)) {
>>  		dev_err(&c->pdev->dev,
>>  			"Couldn't DMA map a %d byte buffer\n",
>>  			count);
>> @@ -425,7 +425,7 @@ static int omap3_onenand_write_bufferram(struct mtd_info *mtd, int area,
>>  		if (*done)
>>  			break;
>>  
>> -	dma_unmap_single(&c->pdev->dev, dma_dst, count, DMA_TO_DEVICE);
>> +	dma_unmap_single(&c->pdev->dev, dma_src, count, DMA_TO_DEVICE);
>>  
>>  	if (!*done) {
>>  		dev_err(&c->pdev->dev, "timeout waiting for DMA\n");
> 
> That patch removes the kernel panic I get when booting current l-o
> kernel on my N900.
> 
> Tested-by: Arnaud Ebalard <arno@natisbad.org>
> 
> Cheers,
> 
> a+
> 

Acked-by: Adrian Hunter <adrian.hunter@nokia.com>
Artem Bityutskiy - April 8, 2010, 8:25 a.m.
On Tue, 2010-03-23 at 15:33 +0200, Mika Westerberg wrote:
> Function omap3_onenand_write_bufferram() maps the write buffer and stores the
> returned handle in dma_src. However, when it does the DMA unmap, it uses wrong
> DMA handle (dma_dst).
> 
> This patch fixes it to use the correct DMA handle.
> 
> Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>

Pushed to l2-mtd-2.6.git / master, thanks.

Patch

diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
index 75f38b9..2d81a3a 100644
--- a/drivers/mtd/onenand/omap2.c
+++ b/drivers/mtd/onenand/omap2.c
@@ -402,7 +402,7 @@  static int omap3_onenand_write_bufferram(struct mtd_info *mtd, int area,
 
 	dma_src = dma_map_single(&c->pdev->dev, buf, count, DMA_TO_DEVICE);
 	dma_dst = c->phys_base + bram_offset;
-	if (dma_mapping_error(&c->pdev->dev, dma_dst)) {
+	if (dma_mapping_error(&c->pdev->dev, dma_src)) {
 		dev_err(&c->pdev->dev,
 			"Couldn't DMA map a %d byte buffer\n",
 			count);
@@ -425,7 +425,7 @@  static int omap3_onenand_write_bufferram(struct mtd_info *mtd, int area,
 		if (*done)
 			break;
 
-	dma_unmap_single(&c->pdev->dev, dma_dst, count, DMA_TO_DEVICE);
+	dma_unmap_single(&c->pdev->dev, dma_src, count, DMA_TO_DEVICE);
 
 	if (!*done) {
 		dev_err(&c->pdev->dev, "timeout waiting for DMA\n");