Message ID | 1323161655-19050-2-git-send-email-Shengzhou.Liu@freescale.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
On 12/06/2011 02:54 AM, Shengzhou Liu wrote: > diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c > index 4f405a0..b4db407 100644 > --- a/drivers/mtd/nand/fsl_elbc_nand.c > +++ b/drivers/mtd/nand/fsl_elbc_nand.c > @@ -349,19 +349,24 @@ static void fsl_elbc_cmdfunc(struct mtd_info *mtd, unsigned int command, > fsl_elbc_run_command(mtd); > return; > > - /* READID must read all 5 possible bytes while CEB is active */ > case NAND_CMD_READID: > - dev_vdbg(priv->dev, "fsl_elbc_cmdfunc: NAND_CMD_READID.\n"); > + case NAND_CMD_PARAM: > + dev_vdbg(priv->dev, "fsl_elbc_cmdfunc: NAND_CMD %x\n", command); > > out_be32(&lbc->fir, (FIR_OP_CM0 << FIR_OP0_SHIFT) | > (FIR_OP_UA << FIR_OP1_SHIFT) | > (FIR_OP_RBW << FIR_OP2_SHIFT)); > - out_be32(&lbc->fcr, NAND_CMD_READID << FCR_CMD0_SHIFT); > - /* nand_get_flash_type() reads 8 bytes of entire ID string */ > - out_be32(&lbc->fbcr, 8); > - elbc_fcm_ctrl->read_bytes = 8; > + out_be32(&lbc->fcr, command << FCR_CMD0_SHIFT); > + /* reads 8 bytes of entire ID string */ > + if (NAND_CMD_READID == command) { if (command == NAND_CMD_READID) { > + out_be32(&lbc->fbcr, 8); > + elbc_fcm_ctrl->read_bytes = 8; > + } else { > + out_be32(&lbc->fbcr, 256); > + elbc_fcm_ctrl->read_bytes = 256; > + } Any harm in always using 256? -Scott
> -----Original Message----- > From: Wood Scott-B07421 > Sent: Wednesday, December 07, 2011 1:17 AM > To: Liu Shengzhou-B36685 > Cc: linuxppc-dev@lists.ozlabs.org; linux-mtd@lists.infradead.org; > dwmw2@infradead.org; Gala Kumar-B11780 > Subject: Re: [PATCH 2/2 v2] mtd/nand: Add ONFI support for FSL NAND > controller > > On 12/06/2011 02:54 AM, Shengzhou Liu wrote: > > diff --git a/drivers/mtd/nand/fsl_elbc_nand.c > b/drivers/mtd/nand/fsl_elbc_nand.c > > index 4f405a0..b4db407 100644 > > --- a/drivers/mtd/nand/fsl_elbc_nand.c > > +++ b/drivers/mtd/nand/fsl_elbc_nand.c > > @@ -349,19 +349,24 @@ static void fsl_elbc_cmdfunc(struct mtd_info *mtd, > unsigned int command, > > fsl_elbc_run_command(mtd); > > return; > > > > - /* READID must read all 5 possible bytes while CEB is active */ > > case NAND_CMD_READID: > > - dev_vdbg(priv->dev, "fsl_elbc_cmdfunc: NAND_CMD_READID.\n"); > > + case NAND_CMD_PARAM: > > + dev_vdbg(priv->dev, "fsl_elbc_cmdfunc: NAND_CMD %x\n", > command); > > > > out_be32(&lbc->fir, (FIR_OP_CM0 << FIR_OP0_SHIFT) | > > (FIR_OP_UA << FIR_OP1_SHIFT) | > > (FIR_OP_RBW << FIR_OP2_SHIFT)); > > - out_be32(&lbc->fcr, NAND_CMD_READID << FCR_CMD0_SHIFT); > > - /* nand_get_flash_type() reads 8 bytes of entire ID string */ > > - out_be32(&lbc->fbcr, 8); > > - elbc_fcm_ctrl->read_bytes = 8; > > + out_be32(&lbc->fcr, command << FCR_CMD0_SHIFT); > > + /* reads 8 bytes of entire ID string */ > > + if (NAND_CMD_READID == command) { > > if (command == NAND_CMD_READID) { > > > + out_be32(&lbc->fbcr, 8); > > + elbc_fcm_ctrl->read_bytes = 8; > > + } else { > > + out_be32(&lbc->fbcr, 256); > > + elbc_fcm_ctrl->read_bytes = 256; > > + } > > Any harm in always using 256? > > -Scott [Shengzhou] For NAND_CMD_READID command, the total bytes of entire ID string are 8, there are not 256 bytes so many, it's unnecessary and looks not so well logically to always using 256, though it works.
On 12/06/2011 09:16 PM, Liu Shengzhou-B36685 wrote: >>> + out_be32(&lbc->fbcr, 8); >>> + elbc_fcm_ctrl->read_bytes = 8; >>> + } else { >>> + out_be32(&lbc->fbcr, 256); >>> + elbc_fcm_ctrl->read_bytes = 256; >>> + } >> >> Any harm in always using 256? >> >> -Scott > [Shengzhou] For NAND_CMD_READID command, the total bytes of entire ID string are 8, there are not 256 bytes so many, it's unnecessary and looks not so well logically to always using 256, though it works. It's not performance critical, and always using 256 keeps things simpler, and more robust if the length of the ID string grows in the future (we used to assume it was 5 bytes...). -Scott
Best Regards, Shengzhou Liu > -----Original Message----- > From: Wood Scott-B07421 > Sent: Thursday, December 08, 2011 1:16 AM > To: Liu Shengzhou-B36685 > Cc: Wood Scott-B07421; linuxppc-dev@lists.ozlabs.org; linux- > mtd@lists.infradead.org; dwmw2@infradead.org; Gala Kumar-B11780 > Subject: Re: [PATCH 2/2 v2] mtd/nand: Add ONFI support for FSL NAND > controller > > On 12/06/2011 09:16 PM, Liu Shengzhou-B36685 wrote: > >>> + out_be32(&lbc->fbcr, 8); > >>> + elbc_fcm_ctrl->read_bytes = 8; > >>> + } else { > >>> + out_be32(&lbc->fbcr, 256); > >>> + elbc_fcm_ctrl->read_bytes = 256; > >>> + } > >> > >> Any harm in always using 256? > >> > >> -Scott > > [Shengzhou] For NAND_CMD_READID command, the total bytes of entire ID > string are 8, there are not 256 bytes so many, it's unnecessary and looks > not so well logically to always using 256, though it works. > > It's not performance critical, and always using 256 keeps things simpler, > and more robust if the length of the ID string grows in the future (we > used to assume it was 5 bytes...). > > -Scott [Shengzhou] OK.
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c index 4f405a0..b4db407 100644 --- a/drivers/mtd/nand/fsl_elbc_nand.c +++ b/drivers/mtd/nand/fsl_elbc_nand.c @@ -349,19 +349,24 @@ static void fsl_elbc_cmdfunc(struct mtd_info *mtd, unsigned int command, fsl_elbc_run_command(mtd); return; - /* READID must read all 5 possible bytes while CEB is active */ case NAND_CMD_READID: - dev_vdbg(priv->dev, "fsl_elbc_cmdfunc: NAND_CMD_READID.\n"); + case NAND_CMD_PARAM: + dev_vdbg(priv->dev, "fsl_elbc_cmdfunc: NAND_CMD %x\n", command); out_be32(&lbc->fir, (FIR_OP_CM0 << FIR_OP0_SHIFT) | (FIR_OP_UA << FIR_OP1_SHIFT) | (FIR_OP_RBW << FIR_OP2_SHIFT)); - out_be32(&lbc->fcr, NAND_CMD_READID << FCR_CMD0_SHIFT); - /* nand_get_flash_type() reads 8 bytes of entire ID string */ - out_be32(&lbc->fbcr, 8); - elbc_fcm_ctrl->read_bytes = 8; + out_be32(&lbc->fcr, command << FCR_CMD0_SHIFT); + /* reads 8 bytes of entire ID string */ + if (NAND_CMD_READID == command) { + out_be32(&lbc->fbcr, 8); + elbc_fcm_ctrl->read_bytes = 8; + } else { + out_be32(&lbc->fbcr, 256); + elbc_fcm_ctrl->read_bytes = 256; + } elbc_fcm_ctrl->use_mdr = 1; - elbc_fcm_ctrl->mdr = 0; + elbc_fcm_ctrl->mdr = column; set_addr(mtd, 0, 0, 0); fsl_elbc_run_command(mtd);
- fix NAND_CMD_READID command for ONFI detect. - add NAND_CMD_PARAM command to read the ONFI parameter page. Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com> --- v2: no changes drivers/mtd/nand/fsl_elbc_nand.c | 19 ++++++++++++------- 1 files changed, 12 insertions(+), 7 deletions(-)