Patchwork mtd/gpmi : fix the wrong DMA command.

login
register
mail settings
Submitter Huang Shijie
Date March 12, 2012, 2:22 a.m.
Message ID <1331518938-24047-1-git-send-email-b32955@freescale.com>
Download mbox | patch
Permalink /patch/146285/
State New
Headers show

Comments

Huang Shijie - March 12, 2012, 2:22 a.m.
The last DMA command of ECC read page is used to disable the BCH module.
But the original code missed to set the pio[2] which is used to set the
GPMI_HW_GPMI_ECCCTRL register. fix it now.

Signed-off-by: Huang Shijie <b32955@freescale.com>
---
 drivers/mtd/nand/gpmi-nand/gpmi-lib.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Huang Shijie - March 12, 2012, 8:35 a.m.
于 2012年03月12日 15:51, Wolfram Sang 写道:
> On Mon, Mar 12, 2012 at 10:22:18AM +0800, Huang Shijie wrote:
>> The last DMA command of ECC read page is used to disable the BCH module.
>> But the original code missed to set the pio[2] which is used to set the
>> GPMI_HW_GPMI_ECCCTRL register. fix it now.
>>
>> Signed-off-by: Huang Shijie <b32955@freescale.com>
> Thanks! What does happen because of this bug? Additional checksum errors? I
> haven't seen many on MX28 IIRC, so I wonder.
>
The MX28 runs well without this patch. I guess the speed of mx28 is too
slow.

The bug only observed in mx6q. A DMA timeout occurs.

But if you apply this patch to mx28's code. A dma timeout occurs too.
This is why i sent the patch
"mxs-dma : rewrite the last parameter of mxs_dma_prep_slave_sg()"

IC guy told me to add a WAIT4END in the middle one of the ECC read page
chain, and disable the BCH in the last
DMA command of the chain. After this patch, the code follows this rule.


BR
Huang Shijie
Bityutskiy, Artem - March 13, 2012, 12:33 p.m.
On Mon, 2012-03-12 at 10:22 +0800, Huang Shijie wrote:
> The last DMA command of ECC read page is used to disable the BCH module.
> But the original code missed to set the pio[2] which is used to set the
> GPMI_HW_GPMI_ECCCTRL register. fix it now.
> 
> Signed-off-by: Huang Shijie <b32955@freescale.com>

Pushed to l2-mtd.git, thanks!

Patch

diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
index 5e3c505..c34dab1 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
@@ -1061,8 +1061,9 @@  int gpmi_read_page(struct gpmi_nand_data *this,
 		| BF_GPMI_CTRL0_ADDRESS(address)
 		| BF_GPMI_CTRL0_XFER_COUNT(geo->page_size);
 	pio[1] = 0;
+	pio[2] = 0; /* clear GPMI_HW_GPMI_ECCCTRL, disable the BCH. */
 	desc = channel->device->device_prep_slave_sg(channel,
-				(struct scatterlist *)pio, 2,
+				(struct scatterlist *)pio, 3,
 				DMA_TRANS_NONE,
 				DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!desc) {