linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: add support for Samsung K9LCG08U0B
@ 2013-12-25  9:18 Huang Shijie
  2014-01-16 21:36 ` Brian Norris
  0 siblings, 1 reply; 7+ messages in thread
From: Huang Shijie @ 2013-12-25  9:18 UTC (permalink / raw)
  To: dwmw2; +Cc: Huang Shijie, computersforpeace, linux-mtd

Assume that:
          tmp = ((extid >> 2) & 0x04) | (extid & 0x03));

>From the K9LCG08U0B's datasheet, we know that:
  the oob size is 640 when tmp is 6;
  the oob size is 1024 when tmp is 7;

Signed-off-by: Huang Shijie <b32955@freescale.com>
---
 drivers/mtd/nand/nand_base.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index ce4dec7..0d113cc 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3242,9 +3242,11 @@ static void nand_decode_ext_id(struct mtd_info *mtd, struct nand_chip *chip,
 			mtd->oobsize = 512;
 			break;
 		case 6:
-		default: /* Other cases are "reserved" (unknown) */
 			mtd->oobsize = 640;
 			break;
+		case 7:
+			mtd->oobsize = SZ_1K;
+			break;
 		}
 		extid >>= 2;
 		/* Calc blocksize */
-- 
1.7.2.rc3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] mtd: nand: add support for Samsung K9LCG08U0B
  2013-12-25  9:18 [PATCH] mtd: nand: add support for Samsung K9LCG08U0B Huang Shijie
@ 2014-01-16 21:36 ` Brian Norris
  2014-01-17  1:40   ` Huang Shijie
  0 siblings, 1 reply; 7+ messages in thread
From: Brian Norris @ 2014-01-16 21:36 UTC (permalink / raw)
  To: Huang Shijie; +Cc: linux-mtd, dwmw2

On Wed, Dec 25, 2013 at 05:18:55PM +0800, Huang Shijie wrote:
> Assume that:
>           tmp = ((extid >> 2) & 0x04) | (extid & 0x03));
> 
> From the K9LCG08U0B's datasheet, we know that:
>   the oob size is 640 when tmp is 6;
>   the oob size is 1024 when tmp is 7;
> 
> Signed-off-by: Huang Shijie <b32955@freescale.com>
> ---
>  drivers/mtd/nand/nand_base.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index ce4dec7..0d113cc 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -3242,9 +3242,11 @@ static void nand_decode_ext_id(struct mtd_info *mtd, struct nand_chip *chip,
>  			mtd->oobsize = 512;
>  			break;
>  		case 6:
> -		default: /* Other cases are "reserved" (unknown) */
>  			mtd->oobsize = 640;
>  			break;
> +		case 7:
> +			mtd->oobsize = SZ_1K;

#include <linux/sizes.h>

Did you compile this?

Anyway, I think just using the literal 1024 is better. I can fix it up
and push myself in a bit.

> +			break;
>  		}
>  		extid >>= 2;
>  		/* Calc blocksize */

Brian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mtd: nand: add support for Samsung K9LCG08U0B
  2014-01-16 21:36 ` Brian Norris
@ 2014-01-17  1:40   ` Huang Shijie
  2014-01-17  5:41     ` Brian Norris
  0 siblings, 1 reply; 7+ messages in thread
From: Huang Shijie @ 2014-01-17  1:40 UTC (permalink / raw)
  To: Brian Norris; +Cc: linux-mtd, dwmw2

On Thu, Jan 16, 2014 at 01:36:37PM -0800, Brian Norris wrote:
> > +		case 7:
> > +			mtd->oobsize = SZ_1K;
> 
> #include <linux/sizes.h>
> 
> Did you compile this?
we do not need this header.
I had already tested this patch with the l2-mtd tree.

> 
> Anyway, I think just using the literal 1024 is better. I can fix it up
> and push myself in a bit.
Different person has different taste. :)

It is okay to me if you the literal 1024.

thanks
Huang Shijie

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mtd: nand: add support for Samsung K9LCG08U0B
  2014-01-17  5:41     ` Brian Norris
@ 2014-01-17  5:14       ` Huang Shijie
  2014-01-17  6:17       ` [PATCH fix] " Huang Shijie
  1 sibling, 0 replies; 7+ messages in thread
From: Huang Shijie @ 2014-01-17  5:14 UTC (permalink / raw)
  To: Brian Norris; +Cc: linux-mtd@lists.infradead.org, David Woodhouse

On Thu, Jan 16, 2014 at 09:41:38PM -0800, Brian Norris wrote:
> On Thu, Jan 16, 2014 at 5:40 PM, Huang Shijie <b32955@freescale.com> wrote:
> > On Thu, Jan 16, 2014 at 01:36:37PM -0800, Brian Norris wrote:
> >> > +           case 7:
> >> > +                   mtd->oobsize = SZ_1K;
> >>
> >> #include <linux/sizes.h>
> >>
> >> Did you compile this?
> > we do not need this header.
> 
> My compiler begs to differ :)
> 
>   CC [M]  drivers/mtd/nand/nand_base.o
> drivers/mtd/nand/nand_base.c: In function ‘nand_decode_ext_id’:
> drivers/mtd/nand/nand_base.c:3159:19: error: ‘SZ_1K’ undeclared (first
> use in this function)
>     mtd->oobsize = SZ_1K;
>                    ^
> drivers/mtd/nand/nand_base.c:3159:19: note: each undeclared identifier
> is reported only once for each function it appears in
> make[3]: *** [drivers/mtd/nand/nand_base.o] Error 1
> make[2]: *** [drivers/mtd/nand] Error 2
> make[1]: *** [drivers/mtd] Error 2
> make: *** [drivers] Error 2
> 
> Maybe different ARCH's have implicit includes. But in any case, it's

yes. i only tested in my imx6 board. 
> standard practice to explicitly include the headers you're using.
got it.


> 
> > I had already tested this patch with the l2-mtd tree.
> >
> >>
> >> Anyway, I think just using the literal 1024 is better. I can fix it up
> >> and push myself in a bit.
> > Different person has different taste. :)
> 
> Well, all the other sizes are literals.
> 
> > It is okay to me if you the literal 1024.
> 
> You also dropped the 'default' case, which leaves out the 0 case. I'll
> reintroduce the default, to go along with case 7. I'll post the
> complete patch here when/if I push it.
should i resend a new patch? or you fix it yourself?

thanks
Huang Shijie

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mtd: nand: add support for Samsung K9LCG08U0B
  2014-01-17  1:40   ` Huang Shijie
@ 2014-01-17  5:41     ` Brian Norris
  2014-01-17  5:14       ` Huang Shijie
  2014-01-17  6:17       ` [PATCH fix] " Huang Shijie
  0 siblings, 2 replies; 7+ messages in thread
From: Brian Norris @ 2014-01-17  5:41 UTC (permalink / raw)
  To: Huang Shijie; +Cc: linux-mtd@lists.infradead.org, David Woodhouse

On Thu, Jan 16, 2014 at 5:40 PM, Huang Shijie <b32955@freescale.com> wrote:
> On Thu, Jan 16, 2014 at 01:36:37PM -0800, Brian Norris wrote:
>> > +           case 7:
>> > +                   mtd->oobsize = SZ_1K;
>>
>> #include <linux/sizes.h>
>>
>> Did you compile this?
> we do not need this header.

My compiler begs to differ :)

  CC [M]  drivers/mtd/nand/nand_base.o
drivers/mtd/nand/nand_base.c: In function ‘nand_decode_ext_id’:
drivers/mtd/nand/nand_base.c:3159:19: error: ‘SZ_1K’ undeclared (first
use in this function)
    mtd->oobsize = SZ_1K;
                   ^
drivers/mtd/nand/nand_base.c:3159:19: note: each undeclared identifier
is reported only once for each function it appears in
make[3]: *** [drivers/mtd/nand/nand_base.o] Error 1
make[2]: *** [drivers/mtd/nand] Error 2
make[1]: *** [drivers/mtd] Error 2
make: *** [drivers] Error 2

Maybe different ARCH's have implicit includes. But in any case, it's
standard practice to explicitly include the headers you're using.

> I had already tested this patch with the l2-mtd tree.
>
>>
>> Anyway, I think just using the literal 1024 is better. I can fix it up
>> and push myself in a bit.
> Different person has different taste. :)

Well, all the other sizes are literals.

> It is okay to me if you the literal 1024.

You also dropped the 'default' case, which leaves out the 0 case. I'll
reintroduce the default, to go along with case 7. I'll post the
complete patch here when/if I push it.

Brian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH fix] mtd: nand: add support for Samsung K9LCG08U0B
  2014-01-17  5:41     ` Brian Norris
  2014-01-17  5:14       ` Huang Shijie
@ 2014-01-17  6:17       ` Huang Shijie
  2014-01-20 19:27         ` Brian Norris
  1 sibling, 1 reply; 7+ messages in thread
From: Huang Shijie @ 2014-01-17  6:17 UTC (permalink / raw)
  To: dwmw2; +Cc: Huang Shijie, computersforpeace, linux-mtd

Assume that:
          tmp = ((extid >> 2) & 0x04) | (extid & 0x03));

>From the K9LCG08U0B's datasheet, we know that:
  the oob size is 640 when tmp is 6;
  the oob size is 1024 when tmp is 7;

Signed-off-by: Huang Shijie <b32955@freescale.com>
---

[1] use the 1024, not the SZ_1k
[2] add back the default case for case 0.

---
 drivers/mtd/nand/nand_base.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index d388c7f..537afe0 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3285,9 +3285,12 @@ static void nand_decode_ext_id(struct mtd_info *mtd, struct nand_chip *chip,
 			mtd->oobsize = 512;
 			break;
 		case 6:
-		default: /* Other cases are "reserved" (unknown) */
 			mtd->oobsize = 640;
 			break;
+		default: /* Other cases are "reserved" (unknown) */
+		case 7:
+			mtd->oobsize = 1024;
+			break;
 		}
 		extid >>= 2;
 		/* Calc blocksize */
-- 
1.7.2.rc3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH fix] mtd: nand: add support for Samsung K9LCG08U0B
  2014-01-17  6:17       ` [PATCH fix] " Huang Shijie
@ 2014-01-20 19:27         ` Brian Norris
  0 siblings, 0 replies; 7+ messages in thread
From: Brian Norris @ 2014-01-20 19:27 UTC (permalink / raw)
  To: Huang Shijie; +Cc: linux-mtd, dwmw2

On Fri, Jan 17, 2014 at 02:17:26PM +0800, Huang Shijie wrote:
> Assume that:
>           tmp = ((extid >> 2) & 0x04) | (extid & 0x03));
> 
> From the K9LCG08U0B's datasheet, we know that:
>   the oob size is 640 when tmp is 6;
>   the oob size is 1024 when tmp is 7;
> 
> Signed-off-by: Huang Shijie <b32955@freescale.com>
> ---
> 
> [1] use the 1024, not the SZ_1k
> [2] add back the default case for case 0.

I was already running a modified version of your previous patch through
some tests, so I have pushed it to l2-mtd.git. It's nearly identical to
this version.

Thanks,
Brian

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-01-20 19:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-25  9:18 [PATCH] mtd: nand: add support for Samsung K9LCG08U0B Huang Shijie
2014-01-16 21:36 ` Brian Norris
2014-01-17  1:40   ` Huang Shijie
2014-01-17  5:41     ` Brian Norris
2014-01-17  5:14       ` Huang Shijie
2014-01-17  6:17       ` [PATCH fix] " Huang Shijie
2014-01-20 19:27         ` Brian Norris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).