mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* nand_imx 4k support ?
@ 2012-04-01  9:58 Gabriel Tisan
  2012-04-01 10:49 ` Baruch Siach
  0 siblings, 1 reply; 10+ messages in thread
From: Gabriel Tisan @ 2012-04-01  9:58 UTC (permalink / raw)
  To: barebox

Hi !

Has anybody started to implement support for flashes with 4k page size
on nand_imx driver ?

Regards,
Gabriel

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: nand_imx 4k support ?
  2012-04-01  9:58 nand_imx 4k support ? Gabriel Tisan
@ 2012-04-01 10:49 ` Baruch Siach
  2012-04-01 12:45   ` Eric Bénard
  0 siblings, 1 reply; 10+ messages in thread
From: Baruch Siach @ 2012-04-01 10:49 UTC (permalink / raw)
  To: Gabriel Tisan; +Cc: barebox

Hi Gabriel,

On Sun, Apr 01, 2012 at 11:58:53AM +0200, Gabriel Tisan wrote:
> Has anybody started to implement support for flashes with 4k page size
> on nand_imx driver ?

4k flashes should be supported in nand_imx since version v2011.05. See commit 
4b4958dbb73e6fb553aaf91d539ff3e22bfe9e40 (mtd/nand_imx: add support for page 
size of 4k). I've tested it on i.MX25.

baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: nand_imx 4k support ?
  2012-04-01 10:49 ` Baruch Siach
@ 2012-04-01 12:45   ` Eric Bénard
  2012-04-01 12:52     ` Baruch Siach
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Bénard @ 2012-04-01 12:45 UTC (permalink / raw)
  To: Baruch Siach; +Cc: barebox

Hi Baruch and Gabriel,

Le Sun, 1 Apr 2012 13:49:35 +0300,
Baruch Siach <baruch@tkos.co.il> a écrit :
> On Sun, Apr 01, 2012 at 11:58:53AM +0200, Gabriel Tisan wrote:
> > Has anybody started to implement support for flashes with 4k page size
> > on nand_imx driver ?
> 
> 4k flashes should be supported in nand_imx since version v2011.05. See commit 
> 4b4958dbb73e6fb553aaf91d539ff3e22bfe9e40 (mtd/nand_imx: add support for page 
> size of 4k). I've tested it on i.MX25.
> 
newer flashs are using ONFI and thus some 4k flashes are not properly
detected actually in barebox which may be the problem that Gabriel
actually have.
http://en.wikipedia.org/wiki/Open_NAND_Flash_Interface_Working_Group
http://onfi.org/specifications/

I have the same requirement on an i.MX53 board (for the moment I
hard coded the right values to bypass the flash detection which
returned wrong results, the 4k falsh being detected as a 2k one) and
plan to work on this during april but hard to say when so that may be
beginiong of may.

Eric

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: nand_imx 4k support ?
  2012-04-01 12:45   ` Eric Bénard
@ 2012-04-01 12:52     ` Baruch Siach
  2012-04-01 13:05       ` Eric Bénard
  0 siblings, 1 reply; 10+ messages in thread
From: Baruch Siach @ 2012-04-01 12:52 UTC (permalink / raw)
  To: Eric Bénard; +Cc: barebox

Hi Eric,

On Sun, Apr 01, 2012 at 02:45:18PM +0200, Eric Bénard wrote:
> Le Sun, 1 Apr 2012 13:49:35 +0300,
> Baruch Siach <baruch@tkos.co.il> a écrit :
> > On Sun, Apr 01, 2012 at 11:58:53AM +0200, Gabriel Tisan wrote:
> > > Has anybody started to implement support for flashes with 4k page size
> > > on nand_imx driver ?
> > 
> > 4k flashes should be supported in nand_imx since version v2011.05. See commit 
> > 4b4958dbb73e6fb553aaf91d539ff3e22bfe9e40 (mtd/nand_imx: add support for page 
> > size of 4k). I've tested it on i.MX25.
> > 
> newer flashs are using ONFI and thus some 4k flashes are not properly
> detected actually in barebox which may be the problem that Gabriel
> actually have.
> http://en.wikipedia.org/wiki/Open_NAND_Flash_Interface_Working_Group
> http://onfi.org/specifications/
> 
> I have the same requirement on an i.MX53 board (for the moment I
> hard coded the right values to bypass the flash detection which
> returned wrong results, the 4k falsh being detected as a 2k one) and
> plan to work on this during april but hard to say when so that may be
> beginiong of may.

Does the Linux kernel detect your flash correctly?

Write support for 4k flashes may require a patch similar to the kernel's 
2c1c5f19 (mtd: mxc_nand: fix OOB corruption when page size > 2KiB), i.e.  
extended ECC layout for OOB.

baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: nand_imx 4k support ?
  2012-04-01 12:52     ` Baruch Siach
@ 2012-04-01 13:05       ` Eric Bénard
  2012-04-02  9:03         ` Gabriel Tisan
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Bénard @ 2012-04-01 13:05 UTC (permalink / raw)
  To: Baruch Siach; +Cc: barebox

Le Sun, 1 Apr 2012 15:52:09 +0300,
Baruch Siach <baruch@tkos.co.il> a écrit :
> Does the Linux kernel detect your flash correctly?
> 
I'm not at this stage for the moment as I'm using a SDcard rootfs to
validate the hardware for the moment, but I'm sure the actual problem
(in my case at least) in barebox is a detection problem as I get the
right values from the flash but these value are ONFI and thus are not
right with he actual flash detection code which leads to a wrong
configuration of the NFC. Once I hardcode the NFC settings I manage to
read/write in the 4k NAND Flash from barebox (environment & kernel
are in the flash for the moment).

Eric

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: nand_imx 4k support ?
  2012-04-01 13:05       ` Eric Bénard
@ 2012-04-02  9:03         ` Gabriel Tisan
  2012-04-02  9:08           ` Eric Bénard
  2012-04-02 11:30           ` Baruch Siach
  0 siblings, 2 replies; 10+ messages in thread
From: Gabriel Tisan @ 2012-04-02  9:03 UTC (permalink / raw)
  To: Eric Bénard; +Cc: barebox

Yes, Baruch I meant write support, especially ECC layout for 4K flashes.

Actually the 4k flashes could have 128 or 218 bytes OOB.

Could you point me to some docs about this layout ? I use a flash with
218 bytes spare.

Gabriel

On Sun, Apr 1, 2012 at 3:05 PM, Eric Bénard <eric@eukrea.com> wrote:
> Le Sun, 1 Apr 2012 15:52:09 +0300,
> Baruch Siach <baruch@tkos.co.il> a écrit :
>> Does the Linux kernel detect your flash correctly?
>>
> I'm not at this stage for the moment as I'm using a SDcard rootfs to
> validate the hardware for the moment, but I'm sure the actual problem
> (in my case at least) in barebox is a detection problem as I get the
> right values from the flash but these value are ONFI and thus are not
> right with he actual flash detection code which leads to a wrong
> configuration of the NFC. Once I hardcode the NFC settings I manage to
> read/write in the 4k NAND Flash from barebox (environment & kernel
> are in the flash for the moment).
>
> Eric

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: nand_imx 4k support ?
  2012-04-02  9:03         ` Gabriel Tisan
@ 2012-04-02  9:08           ` Eric Bénard
  2012-04-02 11:30           ` Baruch Siach
  1 sibling, 0 replies; 10+ messages in thread
From: Eric Bénard @ 2012-04-02  9:08 UTC (permalink / raw)
  To: Gabriel Tisan; +Cc: barebox

Le Mon, 2 Apr 2012 11:03:06 +0200,
Gabriel Tisan <gabriel.tisan@gmail.com> a écrit :

> Yes, Baruch I meant write support, especially ECC layout for 4K flashes.
> 
> Actually the 4k flashes could have 128 or 218 bytes OOB.
> 
> Could you point me to some docs about this layout ? I use a flash with
> 218 bytes spare.
> 
here is a (dirty) patch which force the NFC configuration :

diff --git a/drivers/mtd/nand/nand_imx.c b/drivers/mtd/nand/nand_imx.c
index 85cfbed..182a7ff 100644
--- a/drivers/mtd/nand/nand_imx.c
+++ b/drivers/mtd/nand/nand_imx.c
@@ -805,7 +812,7 @@ static void preset_v3(struct mtd_info *mtd)
 		config2 |= NFC_V3_CONFIG2_PS_2048;
 		config2 |= NFC_V3_CONFIG2_NUM_ADDR_PHASE1(addr_phases);
 	} else if (mtd->writesize == 4096) {
-		config2 |= NFC_V3_CONFIG2_PS_4096;
+		config2 |= NFC_V3_CONFIG2_PS_4096 | 1;
 		config2 |= NFC_V3_CONFIG2_NUM_ADDR_PHASE1(addr_phases);
 	} else {
 		config2 |= NFC_V3_CONFIG2_PS_512;
@@ -817,13 +824,14 @@ static void preset_v3(struct mtd_info *mtd)
 			config2 |= NFC_V3_MX51_CONFIG2_PPB(
 					ffs(mtd->erasesize /
mtd->writesize) - 6); else
-			config2 |= NFC_V3_MX53_CONFIG2_PPB(
-					ffs(mtd->erasesize /
mtd->writesize) - 6);
+			config2 |= 0x200; /*NFC_V3_MX53_CONFIG2_PPB(
+					ffs(mtd->erasesize /
mtd->writesize) - 6);*/ host->eccsize = get_eccsize(mtd);
-		if (host->eccsize == 8)
+//		if (host->eccsize == 8)
 			config2 |= NFC_V3_CONFIG2_ECC_MODE_8;
 	}
-
+	printf("config2 : %x\n", config2);
+	config2 = 0x706da17A;
 	writel(config2, NFC_V3_CONFIG2);
 
 	config3 = NFC_V3_CONFIG3_NUM_OF_DEVICES(0) |
@@ -835,6 +843,8 @@ static void preset_v3(struct mtd_info *mtd)
 	if (!(chip->options & NAND_BUSWIDTH_16))
 		config3 |= NFC_V3_CONFIG3_FW8;
 
+	printf("config3 : %x\n", config3);
+	config3= 0x1a8608;
 	writel(config3, NFC_V3_CONFIG3);
 
 	writel(0, NFC_V3_DELAY_LINE);
@@ -1064,7 +1074,7 @@ static int __init imxnd_probe(struct device_d
*dev) host->main_area0 = host->base;
 		host->regs = host->base + 0xe00;
 		host->spare0 = host->base + 0x800;
-		host->spare_len = 16;
+		host->spare_len = 64;
 		oob_smallpage = &nandv1_hw_eccoob_smallpage;
 		oob_largepage = &nandv1_hw_eccoob_largepage;
 	} else if (nfc_is_v3_2()) {

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: nand_imx 4k support ?
  2012-04-02  9:03         ` Gabriel Tisan
  2012-04-02  9:08           ` Eric Bénard
@ 2012-04-02 11:30           ` Baruch Siach
  2012-04-02 11:39             ` Gabriel Tisan
  1 sibling, 1 reply; 10+ messages in thread
From: Baruch Siach @ 2012-04-02 11:30 UTC (permalink / raw)
  To: Gabriel Tisan; +Cc: barebox

Hi Gabriel,

On Mon, Apr 02, 2012 at 11:03:06AM +0200, Gabriel Tisan wrote:
> Yes, Baruch I meant write support, especially ECC layout for 4K flashes.
> 
> Actually the 4k flashes could have 128 or 218 bytes OOB.
> 
> Could you point me to some docs about this layout ? I use a flash with
> 218 bytes spare.

See commit 2c1c5f199 of the Linux kernel at 
http://git.kernel.org/linus/2c1c5f199.

As Eric has pointed out, this may not be necessary for Barebox.

baruch

> On Sun, Apr 1, 2012 at 3:05 PM, Eric Bénard <eric@eukrea.com> wrote:
> > Le Sun, 1 Apr 2012 15:52:09 +0300,
> > Baruch Siach <baruch@tkos.co.il> a écrit :
> >> Does the Linux kernel detect your flash correctly?
> >>
> > I'm not at this stage for the moment as I'm using a SDcard rootfs to
> > validate the hardware for the moment, but I'm sure the actual problem
> > (in my case at least) in barebox is a detection problem as I get the
> > right values from the flash but these value are ONFI and thus are not
> > right with he actual flash detection code which leads to a wrong
> > configuration of the NFC. Once I hardcode the NFC settings I manage to
> > read/write in the 4k NAND Flash from barebox (environment & kernel
> > are in the flash for the moment).

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: nand_imx 4k support ?
  2012-04-02 11:30           ` Baruch Siach
@ 2012-04-02 11:39             ` Gabriel Tisan
  2012-04-02 11:47               ` Baruch Siach
  0 siblings, 1 reply; 10+ messages in thread
From: Gabriel Tisan @ 2012-04-02 11:39 UTC (permalink / raw)
  To: Baruch Siach; +Cc: barebox

Hi Baruch !

Sorry, but I didn't catch it.
Do you mean that I don't need an OOB description for 218 byte OOB ?

Regards,
Gabriel

On Mon, Apr 2, 2012 at 1:30 PM, Baruch Siach <baruch@tkos.co.il> wrote:
> Hi Gabriel,
>
> On Mon, Apr 02, 2012 at 11:03:06AM +0200, Gabriel Tisan wrote:
>> Yes, Baruch I meant write support, especially ECC layout for 4K flashes.
>>
>> Actually the 4k flashes could have 128 or 218 bytes OOB.
>>
>> Could you point me to some docs about this layout ? I use a flash with
>> 218 bytes spare.
>
> See commit 2c1c5f199 of the Linux kernel at
> http://git.kernel.org/linus/2c1c5f199.
>
> As Eric has pointed out, this may not be necessary for Barebox.
>
> baruch
>
>> On Sun, Apr 1, 2012 at 3:05 PM, Eric Bénard <eric@eukrea.com> wrote:
>> > Le Sun, 1 Apr 2012 15:52:09 +0300,
>> > Baruch Siach <baruch@tkos.co.il> a écrit :
>> >> Does the Linux kernel detect your flash correctly?
>> >>
>> > I'm not at this stage for the moment as I'm using a SDcard rootfs to
>> > validate the hardware for the moment, but I'm sure the actual problem
>> > (in my case at least) in barebox is a detection problem as I get the
>> > right values from the flash but these value are ONFI and thus are not
>> > right with he actual flash detection code which leads to a wrong
>> > configuration of the NFC. Once I hardcode the NFC settings I manage to
>> > read/write in the 4k NAND Flash from barebox (environment & kernel
>> > are in the flash for the moment).
>
> --
>     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
> =}------------------------------------------------ooO--U--Ooo------------{=
>   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: nand_imx 4k support ?
  2012-04-02 11:39             ` Gabriel Tisan
@ 2012-04-02 11:47               ` Baruch Siach
  0 siblings, 0 replies; 10+ messages in thread
From: Baruch Siach @ 2012-04-02 11:47 UTC (permalink / raw)
  To: Gabriel Tisan; +Cc: barebox

Hi Gabriel,

On Mon, Apr 02, 2012 at 01:39:42PM +0200, Gabriel Tisan wrote:
> Sorry, but I didn't catch it.
> Do you mean that I don't need an OOB description for 218 byte OOB ?

If the software doing the flash write operation does not touch the OOB area in 
any way, than OOB layout description is not needed. The Linux kernel needs 
this layout information for the reasons stated in the 2c1c5f199 commit log.  
This reason apparently, is not applicable to Barebox as is evident from the 
experience of Eric.

However, since OOB layout description tables for 512B and 2k page sizes, it 
seems that this information is useful in some scenarios.

baruch

> On Mon, Apr 2, 2012 at 1:30 PM, Baruch Siach <baruch@tkos.co.il> wrote:
> > Hi Gabriel,
> >
> > On Mon, Apr 02, 2012 at 11:03:06AM +0200, Gabriel Tisan wrote:
> >> Yes, Baruch I meant write support, especially ECC layout for 4K flashes.
> >>
> >> Actually the 4k flashes could have 128 or 218 bytes OOB.
> >>
> >> Could you point me to some docs about this layout ? I use a flash with
> >> 218 bytes spare.
> >
> > See commit 2c1c5f199 of the Linux kernel at
> > http://git.kernel.org/linus/2c1c5f199.
> >
> > As Eric has pointed out, this may not be necessary for Barebox.
> >
> > baruch
> >
> >> On Sun, Apr 1, 2012 at 3:05 PM, Eric Bénard <eric@eukrea.com> wrote:
> >> > Le Sun, 1 Apr 2012 15:52:09 +0300,
> >> > Baruch Siach <baruch@tkos.co.il> a écrit :
> >> >> Does the Linux kernel detect your flash correctly?
> >> >>
> >> > I'm not at this stage for the moment as I'm using a SDcard rootfs to
> >> > validate the hardware for the moment, but I'm sure the actual problem
> >> > (in my case at least) in barebox is a detection problem as I get the
> >> > right values from the flash but these value are ONFI and thus are not
> >> > right with he actual flash detection code which leads to a wrong
> >> > configuration of the NFC. Once I hardcode the NFC settings I manage to
> >> > read/write in the 4k NAND Flash from barebox (environment & kernel
> >> > are in the flash for the moment).

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2012-04-02 11:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-01  9:58 nand_imx 4k support ? Gabriel Tisan
2012-04-01 10:49 ` Baruch Siach
2012-04-01 12:45   ` Eric Bénard
2012-04-01 12:52     ` Baruch Siach
2012-04-01 13:05       ` Eric Bénard
2012-04-02  9:03         ` Gabriel Tisan
2012-04-02  9:08           ` Eric Bénard
2012-04-02 11:30           ` Baruch Siach
2012-04-02 11:39             ` Gabriel Tisan
2012-04-02 11:47               ` Baruch Siach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox