Can UBIFS work on SPI Nor Flash with DMA

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can UBIFS work on SPI Nor Flash with DMA

4,046 Views
ivyliu
Contributor IV

Hi All,

I am using customized IMX6 Solo board.

I want to use UBIFS on SPI Nor Flash.

But everytime when I attach UBI after detaching it, it always return error, please see logs below.

I heard there is some problem about DMA when using UBIFS on SPI NOR Flash.

Does anyone know can UBIFS work on SPI Nor Flash with DMA?

root@imx6solo:/# ubidetach -m 5

[ 1030.761164] UBI: detaching mtd5 from ubi0

[ 1030.768306] UBI: mtd5 is detached from ubi0

root@imx6solo:/# ubiattach -m 5

[ 1037.230304] UBI: attaching mtd5 to ubi0

[ 1037.829189] UBI: scanning is finished

[ 1037.868164] UBI error: vtbl_check: bad CRC at record 23: 0x18897488, not 0x000000

[ 1037.884440] Volume table record 23 dump:

[ 1037.888372]  reserved_pebs   0

[ 1037.891430]  alignment       0

[ 1037.913653]  data_pad        0

[ 1037.916719]  vol_type        0

[ 1037.919778]  upd_marker      0

[ 1037.922835]  name_len        0

[ 1037.949252]  name            NULL

[ 1037.952629] UBI error: vtbl_check: bad CRC at record 23: 0x18897488, not 0x000000

[ 1037.976712] Volume table record 23 dump:

[ 1037.980645]  reserved_pebs   0

[ 1037.983891]  alignment       0

[ 1037.986953]  data_pad        0

[ 1037.990011]  vol_type        0

[ 1037.993069]  upd_marker      0

[ 1037.996401]  name_len        0

[ 1037.999462]  name            NULL

[ 1038.002783] UBI error: process_lvol: both volume tables are corrupted

[ 1038.010780] UBI error: ubi_attach_mtd_dev: failed to attach mtd5, error -22

ubiattach: error!: cannot attach mtd5

           error 22 (Invalid argument)

Thanks and Best Regards,

Ivy

0 Kudos
7 Replies

1,782 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi,

The SPI dma problem you mention might be related to a different platform like imx28.

I have to tested it out yet. I wonder if you can share the steps you performed to partition and create the UBIFS.

/Alejandro

0 Kudos

1,782 Views
ivyliu
Contributor IV

Hi Alejandro,

Thank you very much for your reply.

My steps are:

# flash_erase /dev/mtd5 0x0 0x0

# ubiattach /dev/ubi_ctrl -m 5

# ubidetach -m 5

# ubiattach -m 5

The first ubiattach command can be succesfully done, but the second one will have problem.

Thanks and Best Regards,

Ivy

0 Kudos

1,782 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi,

I tested the same way and it failed on my side too. So I disabled the DMAs on the device tree and generated a new dtb. After using that dtb, it seems to be working.

I just commented the next reference to the corresponding ecspi node

/* &ecspi1 {

        dmas = <&sdma 3 7 1>, <&sdma 4 7 2>;

        dma-names = "rx", "tx";

};*/

Please try that out and let me know how it goes.

/Alejandro

0 Kudos

1,782 Views
ivyliu
Contributor IV

Hi Alejandro,

I tried to use DMA with UBIFS.

The first time always works, some time the second time works too, but the third time, the filesystem corrupts during booting.

I am using Linux 3.14.28.

Please see below for details,

UBI: default fastmap pool size: 20

UBI: default fastmap WL pool size: 25

UBI: attaching mtd5 to ubi0

UBI: scanning is finished

UBI: attached mtd5 (name "rootfs", size 26 MiB) to ubi0

UBI: PEB size: 65536 bytes (64 KiB), LEB size: 65408 bytes

UBI: min./max. I/O unit sizes: 1/256, sub-page size 1

UBI: VID header offset: 64 (aligned 64), data offset: 128

UBI: good PEBs: 416, bad PEBs: 0, corrupted PEBs: 0

UBI: user volume: 1, internal volumes: 1, max. volumes count: 128

UBI: max/mean erase counter: 5/2, WL threshold: 4096, image sequence number: 1948250922

UBI: available PEBs: 9, total reserved PEBs: 407, PEBs reserved for bad PEB handling: 0

UBI: background thread "ubi_bgt0d" started, PID 57

UBIFS: background thread "ubifs_bgt0_0" started, PID 58

UBIFS: recovery needed

UBIFS error (pid 1): ubifs_recover_leb: corrupt empty space LEB 209:488, corruption starts at 7704

UBIFS error (pid 1): ubifs_scanned_corruption: corruption at LEB 209:8192

UBIFS error (pid 1): ubifs_scanned_corruption: first 8192 bytes from LEB 209:8192

UBIFS error (pid 1): ubifs_recover_leb: LEB 209 scanning failed

UBIFS: background thread "ubifs_bgt0_0" stops

Thanks and Best Regards,

Ivy

0 Kudos

1,782 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi,

Sorry I have not found any patch for this.

My suggestion is to disable the dma to ensure the correct behavior.

/Alejandro

0 Kudos

1,782 Views
ivyliu
Contributor IV

Hi Alejandro,

I replaced some vmalloc in UBIFS with kmalloc in Linux 3.14.28.

Now UBIFS can work with DMA.

I tested it many times and did not see any problem.

Could you please help me to check is this OK?

Thank you very much!

Best Regards,

Ivy

0 Kudos

1,782 Views
ivyliu
Contributor IV

Hi Alejandro,

Sorry for the late reply.

Yes it works.

But without DMA, the mount/read spead is much slower.

Is there any patch to suppport UBI work with DMA?

Thank you very much!

Best Regards,

Ivy

0 Kudos