UBIFS/U-Boot and UBIFS/Linux not compatible

Hi!

I am working on BeagleBone variant board using Ångström distribution. Main difference is that NAND flash is installed on board. In fact my set-up sounds pretty much same as in “NAND flash with BeagleBone variant” case.

Short story:

UBIFS partition/volume formatted/created in Linux does not work in U-Boot. UBI part command in U-boot fails. Later on Linux finds this UBIFS corrupted. I don’t have any problems if this UBIFS is accessed purely from Linux. I have made NAND flash additions from am335x-evm.dts to BeagleBone device tree. I have tried with ti,nand-ecc-opt = “bch8” (with kernel options CONFIG_MTD_NAND_OMAP_BCH and
OMAP_ECC_BCH8_CODE_HW) and without. In the latter case those kernel options were not active.

Longer story = operations and results:

I think that at least part of the answer is that you need to enable CONFIG_SYS_NAND_ONFI_DETECTION. You may also need to apply some of Pekon’s patches from http://patchwork.ozlabs.org/project/uboot/list/?submitter=17320&state=* (there are 3 series there as of this writing, 2 v2’s and a v8, you should apply all 3 series, and in the right order, saving each series to an mbox, and using git am -3 / git am --abort when they fail should help get the right order sorted out quickly).

Hi Tom,
Somehow I had missed your answer. I’ll try with your advices as soon as I get time for it. Unfortunately something still more urgent came up.
I’ll let you know how it works out then.
Thanks,
Matti

torstai, 24. lokakuuta 2013 13.23.24 UTC+3 matti.k...@gmail.com kirjoitti:

Hi Tom,
I had a look on those patch series. Just to check: I found 3 of v2 (2013-08-14 x 3, 2013-09-10 x 3, 2013-09-30 x 4) and one v8 (2013-10-10 x 5). Do your mean these series I should apply?
-Matti

torstai, 24. lokakuuta 2013 17.42.03 UTC+3 Tom Rini kirjoitti:

If you want compatibility then use u-boot from ezsdk because ti guys added “ecc hw” command to set the ecc mode to software correction or hardware mode. U-boot uses the software mode for all writes, but the kernel uses the hardware correction mode. To swith back and forth you will u-boot from ti

Tom,
one more question:
What tag I should use as base for those patches?
I checked the first patch of the first v2 patch sets (http://patchwork.ozlabs.org/patch/266966/) against u-boot-denx 2013.04 git tree that Ångström distribution u-boot-denx recipe provides. It seems that last patch operation applied to …/drivers/mtd/nand/omap_gpmc.c must fail as there is no matching pattern in that file. So, should I use more up-to-date tag like 2013.10 as a base for those patches and try to apply beaglebone patches over them?

Best regards,
Matti

lauantai, 2. marraskuuta 2013 18.55.50 UTC+2 matti.k...@gmail.com kirjoitti:

That is not true for am335x parts, ever, nor true now for omap3-based beagles now. Things are back in sync, HW/SW mode wise now.

You should use current mainline or v2013.10 release for those patches, yes.

Hi Tom,
I'm terribly sorry annoying you for once more time with this issue. I have
tried to figure out what patch sets you are suggesting below.

I think that at least part of the answer is that you need to enable
CONFIG_SYS_NAND_ONFI_DETECTION. You may also need to apply some of
Pekon's patches from http://patchwork.ozlabs.org/
project/uboot/list/?submitter=17320&state=* (there are 3 series there as
of this writing, 2 v2's and a v8, you should apply all 3 series, and in the
right order, saving each series to an mbox, and using git am -3 / git am
--abort when they fail should help get the right order sorted out quickly).

So, to make it clear as crystal even for me, let's list what I found
matching with your message:
2013-08-14
[U-Boot,v2,1/4] mtd: nand: omap: enable BCH ECC scheme using ELM for
generic platform
[U-Boot,v2,2/4] mtd: nand: omap: optimize chip->ecc.hwctl() for H/W ECC
schemes
[U-Boot,v2,3/4] mtd: nand: omap: optimize chip->ecc.calculate() for H/W ECC
schemes
[U-Boot,v2,4/4] mtd: nand: omap: optimized chip->ecc.correct() for H/W ECC
schemes

2013-09-06
[U-Boot,v2,1/3] am33xx: elm: add support for BCH16_ECC - ELM driver updates
[U-Boot,v2,2/3] mtd: nand: omap: add support for BCH16_ECC - NAND driver
updates
[U-Boot,v2,3/3] am335x: update README for BCH16

2013-09-30
[U-Boot,v2,1/4] mtd: nand: add NAND_BUSWIDTH_AUTO to autodetect bus width
[U-Boot,v2,2/4] am33xx: add CONFIG_SYS_NAND_DEVICE_WIDTH to determine NAND
device bus-width
[U-Boot,v2,3/4] am335x: fix GPMC config for NAND and NOR SPL boot
[U-Boot,v2,4/4] am33xx: add support for beaglebone x16 NAND cape

2013-10-10
[U-Boot,v8,1/5] mtd: nand: omap: enable BCH ECC scheme using ELM for
generic platform
[U-Boot,v8,2/5] mtd: nand: omap: optimize chip->ecc.hwctl() for H/W ECC
schemes
[U-Boot,v8,3/5] mtd: nand: omap: optimize chip->ecc.calculate() for H/W ECC
schemes
[U-Boot,v8,4/5] mtd: nand: omap: optimized chip->ecc.correct() for H/W ECC
schemes
[U-Boot,v8,5/5] board/ti/am335x/README: update for NAND boot

It seems to me that 2013-08-14 and 2013-10-10 are providing (more or less)
same patch set
=> My choice is 2013-10-10
2013-09-06 and 2013-09-30 seem different to me
=> these are the 2v2's your mentioned above

My guess for patching order would be:
1) 2013-10-10
2) 2013-09-06
3) 2013-09-30
-Matti

Wrong date: should be 2013-09-10 instead of 2013-09-06.
-Matti

Hi Tom!
I don’t seem to find proper order using below patch sets.

tiistai, 5. marraskuuta 2013 10.35.25 UTC+2 matti kaasinen kirjoitti:

Hi Tom,

I’m terribly sorry annoying you for once more time with this issue. I have tried to figure out what patch sets you are suggesting below.

2013/11/2 <matti.kaasinen@gmail.com>

I think that at least part of the answer is that you need to enable CONFIG_SYS_NAND_ONFI_DETECTION. You may also need to apply some of Pekon’s patches from http://patchwork.ozlabs.org/project/uboot/list/?submitter=17320&state=* (there are 3 series there as of this writing, 2 v2’s and a v8, you should apply all 3 series, and in the right order, saving each series to an mbox, and using git am -3 / git am --abort when they fail should help get the right order sorted out quickly).

So, to make it clear as crystal even for me, let’s list what I found matching with your message:
2013-08-14
[U-Boot,v2,1/4] mtd: nand: omap: enable BCH ECC scheme using ELM for generic platform
[U-Boot,v2,2/4] mtd: nand: omap: optimize chip->ecc.hwctl() for H/W ECC schemes
[U-Boot,v2,3/4] mtd: nand: omap: optimize chip->ecc.calculate() for H/W ECC schemes
[U-Boot,v2,4/4] mtd: nand: omap: optimized chip->ecc.correct() for H/W ECC schemes

2013-09-06

2013-09-10

[U-Boot,v2,1/3] am33xx: elm: add support for BCH16_ECC - ELM driver updates
[U-Boot,v2,2/3] mtd: nand: omap: add support for BCH16_ECC - NAND driver updates
[U-Boot,v2,3/3] am335x: update README for BCH16

2013-09-30
[U-Boot,v2,1/4] mtd: nand: add NAND_BUSWIDTH_AUTO to autodetect bus width
[U-Boot,v2,2/4] am33xx: add CONFIG_SYS_NAND_DEVICE_WIDTH to determine NAND device bus-width
[U-Boot,v2,3/4] am335x: fix GPMC config for NAND and NOR SPL boot
[U-Boot,v2,4/4] am33xx: add support for beaglebone x16 NAND cape

2013-10-10
[U-Boot,v8,1/5] mtd: nand: omap: enable BCH ECC scheme using ELM for generic platform
[U-Boot,v8,2/5] mtd: nand: omap: optimize chip->ecc.hwctl() for H/W ECC schemes
[U-Boot,v8,3/5] mtd: nand: omap: optimize chip->ecc.calculate() for H/W ECC schemes
[U-Boot,v8,4/5] mtd: nand: omap: optimized chip->ecc.correct() for H/W ECC schemes
[U-Boot,v8,5/5] board/ti/am335x/README: update for NAND boot

It seems to me that 2013-08-14 and 2013-10-10 are providing (more or less) same patch set
=> My choice is 2013-10-10

2013-09-06 and 2013-09-30 seem different to me

=> these are the 2v2’s your mentioned above

My guess for patching order would be:

  1. 2013-10-10
  2. 2013-09-06
  1. 2013-09-10
  1. 2013-09-30

Patch sets 1) 2013-10-10 and 3) 2013-09-30 work fine if 1) is executed first. However, 2) 2013-09-10 fails in every position. In particular:
“[U-Boot,v2,2/3] mtd: nand: omap: add support for BCH16_ECC - NAND driver updates”
fails in several places. Firs one takes place when appending

arch/arm/include/asm/arch-am33xx/omap_gpmc.h.
It tries to make following replacement:
-	OMAP_ECC_BCH8_CODE_HW
+	OMAP_ECC_BCH8_CODE_HW,

even though that comma was already provided by:
"[U-Boot,v8,1/5] mtd: nand: omap: enable BCH ECC scheme using ELM for generic platform"
while creating the stuct including that line.
So, somehow it seems that some more patches are required in order to get these patches run.

Best regards,
Matti

Hi Tom,
I’m sorry I’m teasing you again. Unfortunately now it really looks that this is hitting quite close to your backyard.
I fixed that particular patch problem (below) manually an as you can guess it did not help fixing whole patching process.

“[U-Boot,v2,2/3] mtd: nand: omap: add support for BCH16_ECC - NAND driver updates”
fails in several places. Firs one takes place when appending

arch/arm/include/asm/arch-am33xx/omap_gpmc.h.
It tries to make following replacement:
-	OMAP_ECC_BCH8_CODE_HW
+	OMAP_ECC_BCH8_CODE_HW,

even though that comma was already provided by:
"[U-Boot,v8,1/5] mtd: nand: omap: enable BCH ECC scheme using ELM for generic platform"
while creating the stuct including that line.

Next problem hits when:
“[U-Boot,v2,2/3] mtd: nand: omap: add support for BCH16_ECC - NAND driver updates”
patch tries to execute following chunk over drivers/mtd/nand/omap_gpmc.c: