Skip to contentSkip to conversation

Correct corrupted NAND Flash access on KARO TX25 modules

PATCH New Gachet Daniel 3 participants 9 messages Mar 31, 2012 – Apr 2, 2012 2 messages not in the archive Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Correct corrupted NAND Flash access on KARO TX25 modules

This short patch correct corrupted data while reading NAND flash modules on the KARO TX25 module.

The current version of the mxc_nand driver uses the symmetric mode to access the NAND flash, but the devices populated on the KARO TX25 only support an asymmetric mode (i.MX25: bit 8 within NAND_FLASH_CONFIG1 register cleared).

mtd/nand/mxc_nand.c +2 -0
diff -upr drivers/mtd/nand/mxc_nand.c drivers/mtd/nand/mxc_nand.c
@@ -1290,7 +1290,9 @@ static void mxc_setup_config1(void)
 	uint16_t tmp;
 
 	tmp = readw(&host->regs->nfc_config1);
+#ifndef MACH_TYPE_TX25
 	tmp |= NFC_ONE_CYCLE;
+#endif
 	tmp |= NFC_4_8N_ECC;
 	writew(tmp, &host->regs->nfc_config1);
 	if (host->pagesize_2k)
#1 lore raw

PATCH 1/1 Correct corrupted NAND Flash access on KARO TX25 modules

Dear Gachet Daniel,

Quoted 16 lines

This short patch correct corrupted data while reading NAND flash modules on the KARO TX25 module.

The current version of the mxc_nand driver uses the symmetric mode to access the NAND flash, but the devices populated on the KARO TX25 only support an asymmetric mode (i.MX25: bit 8 within NAND_FLASH_CONFIG1 register cleared).

diff -upr drivers/mtd/nand/mxc_nand.c drivers/mtd/nand/mxc_nand.c

mtd/nand/mxc_nand.c static void mxc_setup_config1(void) · line 1298

Quoted 9 lines
mtd/nand/mxc_nand.c +2 -0
@@ -1290,7 +1290,9 @@ static void mxc_setup_config1(void)
 	uint16_t tmp;
 
 	tmp = readw(&host->regs->nfc_config1);
+#ifndef MACH_TYPE_TX25
 	tmp |= NFC_ONE_CYCLE;
+#endif
 	tmp |= NFC_4_8N_ECC;
 	writew(tmp, &host->regs->nfc_config1);
 	if (host->pagesize_2k)

Won't it be better to make this more generic rather then adding more machine- specific hacks please?

Best regards,
Marek Vasut

#2 lore raw

PATCH 1/1 Correct corrupted NAND Flash access on KARO TX25 modules

Dear Marek,

Quoted 31 lines

Dear Gachet Daniel,

Quoted 16 lines

This short patch correct corrupted data while reading NAND flash modules on the KARO TX25 module.

The current version of the mxc_nand driver uses the symmetric mode to access the NAND flash, but the devices populated on the KARO TX25 only support an asymmetric mode (i.MX25: bit 8 within NAND_FLASH_CONFIG1 register cleared).

diff -upr drivers/mtd/nand/mxc_nand.c drivers/mtd/nand/mxc_nand.c

mtd/nand/mxc_nand.c static void mxc_setup_config1(void) · line 1298

Quoted 9 lines
mtd/nand/mxc_nand.c +2 -0
@@ -1290,7 +1290,9 @@ static void mxc_setup_config1(void)
 	uint16_t tmp;
 
 	tmp = readw(&host->>regs->>nfc_config1);
+#ifndef MACH_TYPE_TX25
 	tmp |= NFC_ONE_CYCLE;
+#endif
 	tmp |= NFC_4_8N_ECC;
 	writew(tmp, &host->>regs->>nfc_config1);
 	if (host->>pagesize_2k)

Won't it be better to make this more generic rather then adding more machine- specific hacks please?

Quoted 2 lines

Best regards,
Marek Vasut

It's really a good question.

This modification should probably work on other i.MX25 boards, because it relaxes the timing while accessing the NAND flash. But unfortunately I haven't other i.MX25 boards on which I can verify this modification. Do you have other modules to validate this modification?

Cordially,

Daniel

#3 lore raw

PATCH 1/1 Correct corrupted NAND Flash access on KARO TX25 modules

Dear Gachet Daniel,

Quoted 40 lines

Dear Marek,

Quoted 35 lines

Dear Gachet Daniel,

Quoted 19 lines

This short patch correct corrupted data while reading NAND flash modules on the KARO TX25 module.

The current version of the mxc_nand driver uses the symmetric mode to access the NAND flash, but the devices populated on the KARO TX25 only support an asymmetric mode (i.MX25: bit 8 within NAND_FLASH_CONFIG1 register cleared).

diff -upr drivers/mtd/nand/mxc_nand.c drivers/mtd/nand/mxc_nand.c

mtd/nand/mxc_nand.c +0 -0
@@ -1290,7 +1290,9 @@ static void mxc_setup_config1(void)
 
 	uint16_t tmp;
 
 	tmp = readw(&host->>regs->>nfc_config1);

mtd/nand/mxc_nand.c static void mxc_setup_config1(void)

Quoted 10 lines
mtd/nand/mxc_nand.c +2 -0
 
+#ifndef MACH_TYPE_TX25
 
 	tmp |= NFC_ONE_CYCLE;
 
+#endif
 
 	tmp |= NFC_4_8N_ECC;
 	writew(tmp, &host->>regs->>nfc_config1);
 	if (host->>pagesize_2k)

Won't it be better to make this more generic rather then adding more machine- specific hacks please?

Quoted 2 lines

Best regards,
Marek Vasut

Quoted 6 lines

It's really a good question.

This modification should probably work on other i.MX25 boards, because it relaxes the timing while accessing the NAND flash. But unfortunately I haven't other i.MX25 boards on which I can verify this modification. Do you have other modules to validate this modification?

Not yet, but if you have one, you can do it in a generic way and if another one pops up, we can simply use it :)

Quoted 3 lines

Cordially,

Daniel

Best regards,
Marek Vasut

#4 lore raw

PATCH 1/1 Correct corrupted NAND Flash access on KARO TX25 modules

In reply to Gachet Daniel

Am 31/03/2012 09:31, schrieb Gachet Daniel:

Quoted 11 lines

This short patch correct corrupted data while reading NAND flash modules on the KARO TX25 module.

The current version of the mxc_nand driver uses the symmetric mode to access the NAND flash, but the devices populated on the KARO TX25 only support an asymmetric mode (i.MX25: bit 8 within NAND_FLASH_CONFIG1 register cleared).

diff -upr drivers/mtd/nand/mxc_nand.c drivers/mtd/nand/mxc_nand.c

mtd/nand/mxc_nand.c static void mxc_setup_config1(void) · line 1295

Quoted 6 lines
mtd/nand/mxc_nand.c +2 -0
@@ -1290,7 +1290,9 @@ static void mxc_setup_config1(void)
 	uint16_t tmp;
 
 	tmp = readw(&host->regs->nfc_config1);
+#ifndef MACH_TYPE_TX25
 	tmp |= NFC_ONE_CYCLE;
+#endif

NAK. We cleaned up all u-boot occurrencies of machine id, except the machid passed to the kernel. And when the device tree will be effective, also the machid will be obsolete.

This change seems not strictly related to the Karo's SOM, but it it a configuration of the mxc_nand driver, such as CONFIG_NAND_MXC_V1_1. You can add a CONFIG_NAND_MXC_* value (please add documentation, too) and use it in the driver code.

Can I also ask you if the same setup is used in the Linux driver (this SOM is not mainlined, I suppose you have a porting from the manufacturer) ? As far as I can see, this setup is not used for the Freescale's mx25pdk (the only MX25 board in mainline kernel).

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#5 lore raw

PATCH 1/1 Correct corrupted NAND Flash access on KARO TX25 modules

Hi Stefano and Marek,

-----Original Message-----
From: stefano babic [mailto:sbabic at denx.de]
Sent: dimanche 1 avril 2012 12:33
To: Gachet Daniel
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH] Correct corrupted NAND Flash access on KARO TX25 modules

Quoted 32 lines

Am 31/03/2012 09:31, schrieb Gachet Daniel:

Quoted 12 lines

This short patch correct corrupted data while reading NAND flash modules on the KARO TX25 module.

The current version of the mxc_nand driver uses the symmetric mode to access the NAND flash, but the devices populated on the KARO TX25 only support an asymmetric mode (i.MX25: bit 8 within NAND_FLASH_CONFIG1 register cleared).

diff -upr drivers/mtd/nand/mxc_nand.c drivers/mtd/nand/mxc_nand.c

mtd/nand/mxc_nand.c static void mxc_setup_config1(void) · line 1295

Quoted 6 lines
mtd/nand/mxc_nand.c +2 -0
@@ -1290,7 +1290,9 @@ static void mxc_setup_config1(void)
 	uint16_t tmp;
 
 	tmp = readw(&host->regs->nfc_config1);
+#ifndef MACH_TYPE_TX25
 	tmp |= NFC_ONE_CYCLE;
+#endif

NAK. We cleaned up all u-boot occurrencies of machine id, except the machid passed to the kernel. And when the device tree will be effective, also the machid will be obsolete.

This change seems not strictly related to the Karo's SOM, but it it a configuration of the mxc_nand driver, such as CONFIG_NAND_MXC_V1_1. You can add a CONFIG_NAND_MXC_* value (please add documentation, too) and use it in the driver code.

Can I also ask you if the same setup is used in the Linux driver (this SOM is not mainlined, I suppose you have a porting from the manufacturer) ? As far as I can see, this setup is not used for the Freescale's mx25pdk (the only MX25 board in mainline kernel).

Best regards,
Stefano Babic

Quoted 6 lines

--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

I found the proposition of Stefano very interesting. My proposition will be to define a specific value for that bit, for instance CONFIG_NAND_MXC_V1_1_NFC_ONE_CYCLE. If this value is defined, the NFC_ONE_CYCLE bit will be set, otherwise not. This value could be defined in the specific board configuration file (./include/configs/...).

The patch will be the following:

mtd/nand/mxc_nand.c +2 -0
diff -upr drivers/mtd/nand/mxc_nand.c drivers/mtd/nand/mxc_nand.c
@@ -1290,7 +1290,9 @@ static void mxc_setup_config1(void)
 	uint16_t tmp;
 
 	tmp = readw(&host->regs->nfc_config1);
+#ifdef CONFIG_NAND_MXC_V1_1_NFC_ONE_CYCLE
 	tmp |= NFC_ONE_CYCLE;
+#endif
 	tmp |= NFC_4_8N_ECC;
 	writew(tmp, &host->regs->nfc_config1);
 	if (host->pagesize_2k)

Is that a valuable solution for you?

Cordially,

Daniel

#6 lore raw

PATCH 1/1 Correct corrupted NAND Flash access on KARO TX25 modules

Dear Gachet Daniel,

Quoted 83 lines

Hi Stefano and Marek,

-----Original Message-----
From: stefano babic [mailto:sbabic at denx.de]
Sent: dimanche 1 avril 2012 12:33
To: Gachet Daniel
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH] Correct corrupted NAND Flash access on KARO TX25 modules

Quoted 45 lines

Am 31/03/2012 09:31, schrieb Gachet Daniel:

Quoted 16 lines

This short patch correct corrupted data while reading NAND flash modules on the KARO TX25 module.

The current version of the mxc_nand driver uses the symmetric mode to access the NAND flash, but the devices

populated on the KARO TX25 only support an asymmetric mode (i.MX25: bit 8 within NAND_FLASH_CONFIG1 register cleared).

diff -upr drivers/mtd/nand/mxc_nand.c drivers/mtd/nand/mxc_nand.c

mtd/nand/mxc_nand.c static void mxc_setup_config1(void) · line 1295

Quoted 10 lines
mtd/nand/mxc_nand.c +2 -0
@@ -1290,7 +1290,9 @@ static void mxc_setup_config1(void)
 
 	uint16_t tmp;
 
 	tmp = readw(&host->regs->nfc_config1);
 
+#ifndef MACH_TYPE_TX25
 
 	tmp |= NFC_ONE_CYCLE;
 
+#endif

NAK. We cleaned up all u-boot occurrencies of machine id, except the machid passed to the kernel. And when the device tree will be effective, also the machid will be obsolete.

This change seems not strictly related to the Karo's SOM, but it it a configuration of the mxc_nand driver, such as CONFIG_NAND_MXC_V1_1. You can add a CONFIG_NAND_MXC_* value (please add documentation, too) and use it in the driver code.

Can I also ask you if the same setup is used in the Linux driver (this SOM is not mainlined, I suppose you have a porting from the manufacturer) ? As far as I can see, this setup is not used for the Freescale's mx25pdk (the only MX25 board in mainline kernel).

Best regards,
Stefano Babic

Quoted 6 lines

--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

I found the proposition of Stefano very interesting. My proposition will be to define a specific value for that bit, for instance CONFIG_NAND_MXC_V1_1_NFC_ONE_CYCLE. If this value is defined, the NFC_ONE_CYCLE bit will be set, otherwise not. This value could be defined in the specific board configuration file (./include/configs/...).

The patch will be the following:
diff -upr drivers/mtd/nand/mxc_nand.c drivers/mtd/nand/mxc_nand.c

mtd/nand/mxc_nand.c +2 -0
@@ -1290,7 +1290,9 @@ static void mxc_setup_config1(void)
 	uint16_t tmp;
 
 	tmp = readw(&host->regs->nfc_config1);
+#ifdef CONFIG_NAND_MXC_V1_1_NFC_ONE_CYCLE
 	tmp |= NFC_ONE_CYCLE;
+#endif
 	tmp |= NFC_4_8N_ECC;
 	writew(tmp, &host->regs->nfc_config1);
 	if (host->pagesize_2k)
Quoted 1 line

Is that a valuable solution for you?

Ain't that basically what I said? Though, I might have not been clear enough ;-) Yes, that's it. Thanks!

Quoted 4 lines

Cordially,

Daniel

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw

PATCH 1/1 Correct corrupted NAND Flash access on KARO TX25 modules

Dear Gachet Daniel,

Quoted 3 lines

Hi Marek,

Thanks for your answer. Have I to do more?

Did you submit the new patch into the ML? If so, did you CC sbabic at denx.de? If so, the patch will be picked by him and applied :)

Thanks for your patch!

Quoted 102 lines

Have a good day.

Cordially,

Daniel

-----Original Message-----
From: Marek Vasut [mailto:marex at denx.de]
Sent: dimanche 1 avril 2012 23:02
To: u-boot at lists.denx.de
Cc: Gachet Daniel
Subject: Re: [U-Boot] [PATCH] Correct corrupted NAND Flash access on KARO TX25 modules

Dear Gachet Daniel,

Quoted 85 lines

Hi Stefano and Marek,

-----Original Message-----
From: stefano babic [mailto:sbabic at denx.de]
Sent: dimanche 1 avril 2012 12:33
To: Gachet Daniel
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH] Correct corrupted NAND Flash access on KARO
TX25 modules

Quoted 45 lines

Am 31/03/2012 09:31, schrieb Gachet Daniel:

Quoted 16 lines

This short patch correct corrupted data while reading NAND flash modules on the KARO TX25 module.

The current version of the mxc_nand driver uses the symmetric mode to access the NAND flash, but the devices

populated on the KARO TX25 only support an asymmetric mode (i.MX25:
bit 8 within NAND_FLASH_CONFIG1 register cleared).

diff -upr drivers/mtd/nand/mxc_nand.c drivers/mtd/nand/mxc_nand.c

mtd/nand/mxc_nand.c static void mxc_setup_config1(void) · line 1295

Quoted 10 lines
mtd/nand/mxc_nand.c +2 -0
@@ -1290,7 +1290,9 @@ static void mxc_setup_config1(void)
 
 	uint16_t tmp;
 
 	tmp = readw(&host->regs->nfc_config1);
 
+#ifndef MACH_TYPE_TX25
 
 	tmp |= NFC_ONE_CYCLE;
 
+#endif

NAK. We cleaned up all u-boot occurrencies of machine id, except the machid passed to the kernel. And when the device tree will be effective, also the machid will be obsolete.

This change seems not strictly related to the Karo's SOM, but it it a configuration of the mxc_nand driver, such as CONFIG_NAND_MXC_V1_1. You can add a CONFIG_NAND_MXC_* value (please add documentation, too) and use it in the driver code.

Can I also ask you if the same setup is used in the Linux driver (this SOM is not mainlined, I suppose you have a porting from the manufacturer) ? As far as I can see, this setup is not used for the Freescale's mx25pdk (the only MX25 board in mainline kernel).

Best regards,
Stefano Babic

Quoted 6 lines

--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

I found the proposition of Stefano very interesting. My proposition will be to define a specific value for that bit, for instance CONFIG_NAND_MXC_V1_1_NFC_ONE_CYCLE. If this value is defined, the NFC_ONE_CYCLE bit will be set, otherwise not. This value could be defined in the specific board configuration file (./include/configs/...).

The patch will be the following:
diff -upr drivers/mtd/nand/mxc_nand.c drivers/mtd/nand/mxc_nand.c

mtd/nand/mxc_nand.c +2 -0
@@ -1290,7 +1290,9 @@ static void mxc_setup_config1(void)
 
 	uint16_t tmp;
 
 	tmp = readw(&host->regs->nfc_config1);
 
+#ifdef CONFIG_NAND_MXC_V1_1_NFC_ONE_CYCLE
 
 	tmp |= NFC_ONE_CYCLE;
 
+#endif
Quoted 12 lines
Quoted 5 lines
mtd/nand/mxc_nand.c +0 -0
 	tmp |= NFC_4_8N_ECC;
 	writew(tmp, &host->regs->nfc_config1);
 	if (host->pagesize_2k)

Is that a valuable solution for you?

Ain't that basically what I said? Though, I might have not been clear enough ;-) Yes, that's it. Thanks!

Quoted 3 lines

Cordially,

Daniel

Best regards,
Marek Vasut

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw

PATCH 1/1 Correct corrupted NAND Flash access on KARO TX25 modules

Am 02/04/2012 19:47, schrieb Gachet Daniel:

Quoted 4 lines

Hi Stefano,

Have I to do more for the patch? Are you ok with the proposal?

That is ok. Please use a shorter name: the function you patch is already surrounded by #ifdef MXC_NFC_V1_1, so it is not required to repeat it in the name (we have a lot of long names, but CONFIG_NAND_MXC_V1_1_NFC_ONE_CYCLE is really quite long). The name suggest also that you want to set ONE_CYCLE, but really you want the opposite. Something like CONFIG_NAND_MXC_NO_ONE_CYLE is still long, but maybe more correct.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================