s3c244x hardware ecc

Holger Freyther zecke at openmoko.org
Sat Jul 26 23:23:09 CEST 2008


Hey,

I had a look at using hardware ECC for the s3c244x. I'm in a state that I 
patched uboot to write a ECC for dfu flashed stuff that the kernel likes to 
read it and is happy.

What is left:
	- Flag day? Provide a upgrade path?
	- hardware_ecc=1 into the cmdline and then enable it in the kernel
	- Check if the ECC is useful at all (have to look at the result of the 
hardware register)
	- Is the ECC config useful? We have main memory ECC0 and ECC1 but only write 
in so small chunks that we fill up ECC0? How does this relate to the 2K page
	- I have to learn more about OOB, ECC and NAND. And figure out why we do the 
ECC over 256 bytes for LP...
	- Find out why it is not twice as fast?
	- Wonder why we only have 8-bit flash and if it is matters?
	- Handle hardware_ecc=1 in the kernel and have a default for software.. 
(specially after the revert)...

attached:
	- two uboot patches
	- two kernel patches
	- my primary log... for performance...

have fun
	z.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-s3c2440-Enable-hardware-ECC-for-large-page-NAND-de.patch
Type: text/x-diff
Size: 4604 bytes
Desc: not available
Url : http://lists.openmoko.org/pipermail/openmoko-kernel/attachments/20080726/ac879ade/attachment.patch 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-gta02-Remove-the-code-as-it-is-marked-liked-this.patch
Type: text/x-diff
Size: 1000 bytes
Desc: not available
Url : http://lists.openmoko.org/pipermail/openmoko-kernel/attachments/20080726/ac879ade/attachment-0001.patch 
-------------- next part --------------
Hardware ECC: 256 bytes
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  1.9  0.4   1524   564 ?        Ss   16:16   0:05 init [5]      
root         2  0.0  0.0      0     0 ?        S<   16:16   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S<   16:16   0:00 [ksoftirqd/0]
root         4  0.0  0.0      0     0 ?        S<   16:16   0:00 [watchdog/0]
root         5  0.1  0.0      0     0 ?        S<   16:16   0:00 [events/0]
root         6  0.0  0.0      0     0 ?        S<   16:16   0:00 [khelper]
root        79  0.0  0.0      0     0 ?        S<   16:16   0:00 [kblockd/0]
root        85  0.0  0.0      0     0 ?        S<   16:16   0:00 [ksuspend_usbd]
root        91  0.0  0.0      0     0 ?        S<   16:16   0:00 [khubd]
root        94  0.0  0.0      0     0 ?        S<   16:16   0:00 [kseriod]
root       101  0.0  0.0      0     0 ?        S<   16:16   0:00 [kmmcd]
root       136  0.0  0.0      0     0 ?        S    16:16   0:00 [pdflush]
root       137  0.0  0.0      0     0 ?        S    16:16   0:00 [pdflush]
root       138  0.0  0.0      0     0 ?        S<   16:16   0:00 [kswapd0]
root       139  0.0  0.0      0     0 ?        S<   16:16   0:00 [aio/0]
root       157  0.0  0.0      0     0 ?        S<   16:16   0:00 [kapmd]
root       189  0.0  0.0      0     0 ?        S<   16:16   0:00 [glamo-spi-gpi]
root       199  0.0  0.0      0     0 ?        S<   16:16   0:00 [mtdblockd]
root       228  0.0  0.0      0     0 ?        S<   16:16   0:00 [spi_s3c24xx_g]
root       281  0.0  0.0      0     0 ?        S<   16:16   0:00 [SDIO Helper]
root       285  0.0  0.0      0     0 ?        S<   16:16   0:00 [SDIO Helper]
root       310  0.0  0.0      0     0 ?        S<   16:16   0:00 [krfcommd]
root      1020  8.1  0.0      0     0 ?        SN   16:17   0:21 [jffs2_gcd_mtd]
root      1750  0.1  0.5   2808   684 ?        Ss   16:18   0:00 /sbin/syslogd -
root      1752  0.2  0.4   2744   608 ?        Ss   16:18   0:00 /sbin/klogd -n
root      1819  0.1  0.6   2924   840 ttySAC2  Ss   16:19   0:00 -sh
root      1820  0.0  0.4   1764   540 tty1     Ss+  16:19   0:00 /sbin/getty 384
root      1974  0.0  0.7   2248   884 ttySAC2  R+   16:21   0:00 ps xua
root at om-gta02:~# cat /proc/partitions 
major minor  #blocks  name

  31     0       2048 mtdblock0
  31     1        256 mtdblock1
  31     2        256 mtdblock2
  31     3       8192 mtdblock3
  31     4        640 mtdblock4
  31     5        256 mtdblock5
  31     6     252544 mtdblock6
root at om-gta02:~#  time dd if=/dev/mtdblock6 bs=1024 count=10240 of=/dev/null
10240+0 records in
10240+0 records out
real    0m 2.82s
user    0m 0.03s
sys     0m 0.72s
root at om-gta02:~# cat /proc/partitions 
major minor  #blocks  name

  31     0       2048 mtdblock0
  31     1        256 mtdblock1
  31     2        256 mtdblock2
  31     3       8192 mtdblock3
  31     4        640 mtdblock4
  31     5        256 mtdblock5
  31     6     252544 mtdblock6
root at om-gta02:~#  time dd if=/dev/mtdblock6 bs=1024 count=10240 of=/dev/null
10240+0 records in
10240+0 records out
real    0m 3.10s
user    0m 0.02s
sys     0m 0.76s
root at om-gta02:~#  time dd if=/dev/mtdblock6 bs=1024 count=10240 of=/dev/null
10240+0 records in
10240+0 records out
real    0m 2.90s
user    0m 0.03s
sys     0m 0.70s
root at om-gta02:~#  time dd if=/dev/mtdblock6 bs=1024 count=10240 of=/dev/null
10240+0 records in
10240+0 records out
real    0m 2.88s
user    0m 0.00s
sys     0m 0.72s
root at om-gta02:~#  time dd if=/dev/mtdblock6 bs=1024 count=10240 of=/dev/null
10240+0 records in
10240+0 records out
real    0m 2.65s
user    0m 0.03s
sys     0m 0.68s
root at om-gta02:~#  time dd if=/dev/mtdblock6 bs=1024 count=10240 of=/dev/null
10240+0 records in
10240+0 records out
real    0m 3.14s
user    0m 0.04s
sys     0m 0.76s

Software ECC:
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  1.5  0.4   1524   564 ?        Ss   15:26   0:06 init [5]      
root         2  0.0  0.0      0     0 ?        S<   15:26   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S<   15:26   0:00 [ksoftirqd/0]
root         4  0.0  0.0      0     0 ?        S<   15:26   0:00 [watchdog/0]
root         5  0.1  0.0      0     0 ?        S<   15:26   0:00 [events/0]
root         6  0.0  0.0      0     0 ?        S<   15:26   0:00 [khelper]
root        79  0.0  0.0      0     0 ?        S<   15:26   0:00 [kblockd/0]
root        85  0.0  0.0      0     0 ?        S<   15:26   0:00 [ksuspend_usbd]
root        91  0.0  0.0      0     0 ?        S<   15:26   0:00 [khubd]
root        94  0.0  0.0      0     0 ?        S<   15:26   0:00 [kseriod]
root       101  0.0  0.0      0     0 ?        S<   15:26   0:00 [kmmcd]
root       136  0.0  0.0      0     0 ?        S    15:26   0:00 [pdflush]
root       137  0.0  0.0      0     0 ?        S    15:26   0:00 [pdflush]
root       138  0.0  0.0      0     0 ?        S<   15:26   0:00 [kswapd0]
root       139  0.0  0.0      0     0 ?        S<   15:26   0:00 [aio/0]
root       157  0.0  0.0      0     0 ?        S<   15:26   0:00 [kapmd]
root       189  0.0  0.0      0     0 ?        S<   15:26   0:00 [glamo-spi-gpi]
root       199  0.0  0.0      0     0 ?        S<   15:26   0:00 [mtdblockd]
root       228  0.0  0.0      0     0 ?        S<   15:26   0:00 [spi_s3c24xx_g]
root       283  0.0  0.0      0     0 ?        S<   15:26   0:00 [SDIO Helper]
root       287  0.0  0.0      0     0 ?        S<   15:26   0:00 [SDIO Helper]
root       312  0.0  0.0      0     0 ?        S<   15:26   0:00 [krfcommd]
root      1021  7.4  0.0      0     0 ?        SN   15:27   0:26 [jffs2_gcd_mtd]
root      1755  0.1  0.5   2808   684 ?        Ss   15:29   0:00 /sbin/syslogd -
root      1757  0.2  0.4   2744   608 ?        Ss   15:29   0:00 /sbin/klogd -n
root      1824  0.1  0.6   2924   836 ttySAC2  Ss   15:29   0:00 -sh
root      1825  0.0  0.4   1764   540 tty1     Ss+  15:29   0:00 /sbin/getty 384
root      1981  0.0  0.7   2248   884 ttySAC2  R+   15:33   0:00 ps xua



root at om-gta02:~# time dd if=/dev/mtdblockX bs=1024 count=10240 of=/dev/null
dd: can't open '/dev/mtdblockX': No such file or directory
Command exited with non-zero status 1
real    0m 0.03s
user    0m 0.00s
sys     0m 0.02s
root at om-gta02:~# 
root at om-gta02:~# time dd if=/dev/mtdblockX bs=1024 count=10240 of=/dev/null
root at om-gta02:~# ls /dev/mtd
/dev/mtd0       /dev/mtd2ro     /dev/mtd5       /dev/mtdblock1  /dev/mtdblock6
/dev/mtd0ro     /dev/mtd3       /dev/mtd5ro     /dev/mtdblock2
/dev/mtd1       /dev/mtd3ro     /dev/mtd6       /dev/mtdblock3
/dev/mtd1ro     /dev/mtd4       /dev/mtd6ro     /dev/mtdblock4
/dev/mtd2       /dev/mtd4ro     /dev/mtdblock0  /dev/mtdblock5
root at om-gta02:~# ls /dev/mtd
/dev/mtd0       /dev/mtd2ro     /dev/mtd5       /dev/mtdblock1  /dev/mtdblock6
/dev/mtd0ro     /dev/mtd3       /dev/mtd5ro     /dev/mtdblock2
/dev/mtd1       /dev/mtd3ro     /dev/mtd6       /dev/mtdblock3
/dev/mtd1ro     /dev/mtd4       /dev/mtd6ro     /dev/mtdblock4
/dev/mtd2       /dev/mtd4ro     /dev/mtdblock0  /dev/mtdblock5
root at om-gta02:~# ls /dev/mtdblock1 
root at om-gta02:~# cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 00200000 00010000 "physmap-flash.0"
mtd1: 00040000 00020000 "u-boot"
mtd2: 00040000 00020000 "u-boot_env"
mtd3: 00800000 00020000 "kernel"
mtd4: 000a0000 00020000 "splash"
mtd5: 00040000 00020000 "factory"
mtd6: 0f6a0000 00020000 "rootfs"
root at om-gta02:~# time dd if=/dev/mtdblock2 bs=1024 count=10240 of=/dev/null
256+0 records in
256+0 records out
real    0m 0.11s
user    0m 0.00s
sys     0m 0.04s
root at om-gta02:~# time dd if=/dev/mtdblock6 bs=1024 count=10240 of=/dev/null
10240+0 records in
10240+0 records out
real    0m 3.60s
user    0m 0.02s
sys     0m 0.90s
root at om-gta02:~# time dd if=/dev/mtdblock6 bs=1024 count=10240 of=/dev/null
10240+0 records in
10240+0 records out
real    0m 3.86s
user    0m 0.04s
sys     0m 0.90s
root at om-gta02:~# time dd if=/dev/mtdblock6 bs=1024 count=10240 of=/dev/null
10240+0 records in
10240+0 records out
real    0m 3.94s
user    0m 0.03s
sys     0m 0.93s
root at om-gta02:~# time dd if=/dev/mtdblock6 bs=1024 count=10240 of=/dev/null
10240+0 records in
10240+0 records out
real    0m 3.90s
user    0m 0.02s
sys     0m 0.90s
root at om-gta02:~# time dd if=/dev/mtdblock6 bs=1024 count=10240 of=/dev/null
10240+0 records in
10240+0 records out
real    0m 3.97s
user    0m 0.03s
sys     0m 0.89s
root at om-gta02:~# time dd if=/dev/mtdblock6 bs=1024 count=10240 of=/dev/null
10240+0 records in
10240+0 records out
real    0m 3.96s
user    0m 0.06s
sys     0m 0.88s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Revert-s3c2440-nand-disable-hwecc.patch.patch
Type: text/x-diff
Size: 912 bytes
Desc: not available
Url : http://lists.openmoko.org/pipermail/openmoko-kernel/attachments/20080726/ac879ade/attachment-0002.patch 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-gta02-Disable-the-NAND-debugging-as-it-would-print.patch
Type: text/x-diff
Size: 802 bytes
Desc: not available
Url : http://lists.openmoko.org/pipermail/openmoko-kernel/attachments/20080726/ac879ade/attachment-0003.patch 


More information about the openmoko-kernel mailing list