diff mbox

[v2,11/27] mtd: nand: pxa3xx: Disable OOB on arbitrary length commands

Message ID 1382137374-21251-12-git-send-email-ezequiel.garcia@free-electrons.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ezequiel Garcia Oct. 18, 2013, 11:02 p.m. UTC
READID, STATUS and PARAM (aka ONFI read paramater page) don't read
the OOB area. Set the oob_size to zero and prevent it.
Also, add a comment clarifying the use of pxa3xx_set_datasize()
which is only applicable on data read/write commands.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
 drivers/mtd/nand/pxa3xx_nand.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Huang Shijie Nov. 3, 2013, 10:59 p.m. UTC | #1
On Fri, Oct 18, 2013 at 08:02:38PM -0300, Ezequiel Garcia wrote:
> READID, STATUS and PARAM (aka ONFI read paramater page) don't read
> the OOB area. Set the oob_size to zero and prevent it.
The ERASE, RESET also donot need to read the OOB,
   why not zero the oob_size for these commands?

  thanks
 Huang Shiji
Ezequiel Garcia Nov. 4, 2013, 12:41 p.m. UTC | #2
On Sun, Nov 03, 2013 at 05:59:05PM -0500, Huang Shijie wrote:
> On Fri, Oct 18, 2013 at 08:02:38PM -0300, Ezequiel Garcia wrote:
> > READID, STATUS and PARAM (aka ONFI read paramater page) don't read
> > the OOB area. Set the oob_size to zero and prevent it.
> The ERASE, RESET also donot need to read the OOB,
>    why not zero the oob_size for these commands?
> 

Because this only matters for commands that will use the oob_size field
when doing some I/O operation. Both ERASE and RESET commands have no data
cycle, so it makes no sense to haev a non-zero oob_size field.

On the other side, this patch is rather stupid, as oob_size is already
cleared at the beggining of a command sequence. So, I'll either rework
this or drop it entirely.

Thanks,
diff mbox

Patch

diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index 83ba036..95e2ce3 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -302,6 +302,11 @@  static void pxa3xx_nand_set_timing(struct pxa3xx_nand_host *host,
 	nand_writel(info, NDTR1CS0, ndtr1);
 }
 
+/*
+ * Set the data and OOB size, depending on the selected
+ * spare and ECC configuration.
+ * Only applicable to READ0, READOOB and PAGEPROG commands.
+ */
 static void pxa3xx_set_datasize(struct pxa3xx_nand_info *info)
 {
 	int oob_enable = info->reg_ndcr & NDCR_SPARE_EN;
@@ -661,6 +666,7 @@  static int prepare_command_pool(struct pxa3xx_nand_info *info, int command,
 		info->ndcb1 = (column & 0xFF);
 		info->ndcb3 = 256;
 		info->data_size = 256;
+		info->oob_size = 0;
 		break;
 
 	case NAND_CMD_READID:
@@ -671,6 +677,7 @@  static int prepare_command_pool(struct pxa3xx_nand_info *info, int command,
 		info->ndcb1 = (column & 0xFF);
 
 		info->data_size = 8;
+		info->oob_size = 0;
 		break;
 	case NAND_CMD_STATUS:
 		info->buf_count = 1;
@@ -679,6 +686,7 @@  static int prepare_command_pool(struct pxa3xx_nand_info *info, int command,
 				| command;
 
 		info->data_size = 8;
+		info->oob_size = 0;
 		break;
 
 	case NAND_CMD_ERASE1: