Patchwork [v4,4/6] mtd: set ONFI nand's default hooks in nand_set_defaults()

login
register
mail settings
Submitter Huang Shijie
Date Aug. 16, 2013, 2:10 a.m.
Message ID <1376619009-8622-5-git-send-email-b32955@freescale.com>
Download mbox | patch
Permalink /patch/267536/
State New
Headers show

Comments

Huang Shijie - Aug. 16, 2013, 2:10 a.m.
We may do some ONFI get/set features operations before we call the
nand_scan_tail().

So move the default ONFI nand hooks into nand_set_defaults().

Signed-off-by: Huang Shijie <b32955@freescale.com>
---
 drivers/mtd/nand/nand_base.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
Brian Norris - Aug. 17, 2013, 5:55 p.m.
On Fri, Aug 16, 2013 at 10:10:07AM +0800, Huang Shijie wrote:
> We may do some ONFI get/set features operations before we call the
> nand_scan_tail().
> 
> So move the default ONFI nand hooks into nand_set_defaults().
> 
> Signed-off-by: Huang Shijie <b32955@freescale.com>

This patch looks similar to a one forwarded by Brian Foster/Florian
Fainelli a while back. But since I don't have a good copy of the other
one, I'll take this.

(BTW, this patch is new for the v4 series, but I don't mind this time)

> ---
>  drivers/mtd/nand/nand_base.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index fa35699..61a7d14 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -2794,6 +2794,12 @@ static void nand_set_defaults(struct nand_chip *chip, int busw)
>  	if (!chip->select_chip)
>  		chip->select_chip = nand_select_chip;
>  
> +	/* set for ONFI nand */
> +	if (!chip->onfi_set_features)
> +		chip->onfi_set_features = nand_onfi_set_features;
> +	if (!chip->onfi_get_features)
> +		chip->onfi_get_features = nand_onfi_get_features;
> +
>  	/* If called twice, pointers that depend on busw may need to be reset */
>  	if (!chip->read_byte || chip->read_byte == nand_read_byte)
>  		chip->read_byte = busw ? nand_read_byte16 : nand_read_byte;
> @@ -3560,12 +3566,6 @@ int nand_scan_tail(struct mtd_info *mtd)
>  	if (!chip->write_page)
>  		chip->write_page = nand_write_page;
>  
> -	/* set for ONFI nand */
> -	if (!chip->onfi_set_features)
> -		chip->onfi_set_features = nand_onfi_set_features;
> -	if (!chip->onfi_get_features)
> -		chip->onfi_get_features = nand_onfi_get_features;
> -
>  	/*
>  	 * Check ECC mode, default to software if 3byte/512byte hardware ECC is
>  	 * selected and we have 256 byte pagesize fallback to software ECC

Brian
Brian Foster - Aug. 19, 2013, 8:06 a.m.
On Saturday 17-August-2013 10:55:07 Brian Norris wrote:
> On Fri, Aug 16, 2013 at 10:10:07AM +0800, Huang Shijie wrote:
> > We may do some ONFI get/set features operations before we call the
> > nand_scan_tail().
> > 
> > So move the default ONFI nand hooks into nand_set_defaults().
> > 
> > Signed-off-by: Huang Shijie <b32955@freescale.com>
> 
> This patch looks similar to a one forwarded by Brian Foster/Florian
> Fainelli a while back. But since I don't have a good copy of the other
> one, I'll take this.

 This looks Ok to me.
 Apologies for not sending a “good copy”
 of the earlier one.  Sorry!

cheers!
	-blf-
Brian Norris - Aug. 20, 2013, 12:41 a.m.
On Mon, Aug 19, 2013 at 1:06 AM, Brian Foster
<brian.foster@maximintegrated.com> wrote:
> On Saturday 17-August-2013 10:55:07 Brian Norris wrote:
>> On Fri, Aug 16, 2013 at 10:10:07AM +0800, Huang Shijie wrote:
>> > We may do some ONFI get/set features operations before we call the
>> > nand_scan_tail().
>> >
>> > So move the default ONFI nand hooks into nand_set_defaults().
>> >
>> > Signed-off-by: Huang Shijie <b32955@freescale.com>
>>
>> This patch looks similar to a one forwarded by Brian Foster/Florian
>> Fainelli a while back. But since I don't have a good copy of the other
>> one, I'll take this.
>
>  This looks Ok to me.
>  Apologies for not sending a “good copy”
>  of the earlier one.  Sorry!

No problem. Artem had replied about resending it inline (that is the
typical way to review patches), but I was going to get around to
applying it anyway.

Regards,
Brian
Brian Foster - Aug. 20, 2013, 7:09 a.m.
On Monday 19-August-2013 17:41:17 Brian Norris wrote:
> On Mon, Aug 19, 2013 at 1:06 AM, Brian Foster
> <brian.foster@maximintegrated.com> wrote:
> > On Saturday 17-August-2013 10:55:07 Brian Norris wrote:
> >> On Fri, Aug 16, 2013 at 10:10:07AM +0800, Huang Shijie wrote:
> >> > We may do some ONFI get/set features operations before we call the
> >> > nand_scan_tail().
>[...]
> >  Apologies for not sending a “good copy”
> >  of the earlier one.  Sorry!
> 
> No problem. Artem had replied about resending it inline (that is the
> typical way to review patches), but I was going to get around to
> applying it anyway.

 Yes, I saw Artem's reply, and I also know Patches are
 normally sent inline.  However, to do that without it
 being corrupted (and other silly problems) from $work
 is tedious and error-prone (I omit the gory details),
 plus I wasn't available (holidays, &tc).  In any case
 the improvement is now progressing, despite the route
 to get to this point being rather strange!

cheers,
	-blf-

Patch

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index fa35699..61a7d14 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2794,6 +2794,12 @@  static void nand_set_defaults(struct nand_chip *chip, int busw)
 	if (!chip->select_chip)
 		chip->select_chip = nand_select_chip;
 
+	/* set for ONFI nand */
+	if (!chip->onfi_set_features)
+		chip->onfi_set_features = nand_onfi_set_features;
+	if (!chip->onfi_get_features)
+		chip->onfi_get_features = nand_onfi_get_features;
+
 	/* If called twice, pointers that depend on busw may need to be reset */
 	if (!chip->read_byte || chip->read_byte == nand_read_byte)
 		chip->read_byte = busw ? nand_read_byte16 : nand_read_byte;
@@ -3560,12 +3566,6 @@  int nand_scan_tail(struct mtd_info *mtd)
 	if (!chip->write_page)
 		chip->write_page = nand_write_page;
 
-	/* set for ONFI nand */
-	if (!chip->onfi_set_features)
-		chip->onfi_set_features = nand_onfi_set_features;
-	if (!chip->onfi_get_features)
-		chip->onfi_get_features = nand_onfi_get_features;
-
 	/*
 	 * Check ECC mode, default to software if 3byte/512byte hardware ECC is
 	 * selected and we have 256 byte pagesize fallback to software ECC