Commit 0e604fc9 authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Miquel Raynal

mtd: rawnand: denali: refactor raw page accessors

The Denali IP adopts the syndrome page layout (payload and ECC are
interleaved). The *_page_raw() and *_oob() callbacks are complicated
because they must hide the underlying layout used by the hardware,
and always return contiguous in-band and out-of-band data.

The Denali IP cannot reuse nand_{read,write}_page_raw_syndrome()
in nand_base.c because its hardware ECC engine skips some of first
bytes in OOB. That is why this driver implements specially-crafted
*_page_raw() and *_oob() hooks.

Currently, similar code is duplicated to reorganize the data layout.
For example, denali_read_page_raw() and denali_write_page_raw() look
almost the same. The complexity is partly due to the DMA transfer
used for better performance of *_page_raw() accessors.

On second thought, we do not need to care about their performance
because MTD_OPS_RAW is rarely used.

Let's focus on code cleanups rather than the performance. This commit
removes the internal buffer for DMA, and factors out as much code as
possible.
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent 750f69b8
This diff is collapsed.
...@@ -303,7 +303,6 @@ struct denali_nand_info { ...@@ -303,7 +303,6 @@ struct denali_nand_info {
u32 irq_mask; /* interrupts we are waiting for */ u32 irq_mask; /* interrupts we are waiting for */
u32 irq_status; /* interrupts that have happened */ u32 irq_status; /* interrupts that have happened */
int irq; int irq;
void *buf; /* for syndrome layout conversion */
int dma_avail; /* can support DMA? */ int dma_avail; /* can support DMA? */
int devs_per_cs; /* devices connected in parallel */ int devs_per_cs; /* devices connected in parallel */
int oob_skip_bytes; /* number of bytes reserved for BBM */ int oob_skip_bytes; /* number of bytes reserved for BBM */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment