[U-Boot] Antw: [PATCH v11 3/4] mtd: nand: omap: add CONFIG_NAND_OMAP_ECCSCHEME for selection of ecc-scheme

Steffen Arendt s.arendt at sensopart.de
Fri Jul 11 10:27:09 CEST 2014


Dear Pekon,

thanks for your mail.  This ECC topic is of some complexity. :(

I am close to solve a huge problem here, switching boards from
1bit-SW-ECC to BCH4.
The only missing part is, that OMAP xloader and uboot calculates the
BCH4 ECC values than Sitara XLoader
(although the x-loader binaries are identical).  
Main problem is not that this is different to Linux - this is not nice,
but not a problem. I solved this by implementing a
second linux compatible BCH4 in uboot (which works on both platforms).
Problem is, that BCH4 (as it is implemented in aragos xloader) seems
not to work on OMAP3503.
And it is not understood by me, why this is not working, or what can
the reason for this.

You suggestions address kernel/uboot changes.  For this I have already
a solution.
I am running into other troubles if I shift to your suggestions, and I
can't see an improvement for 
the xloader problem. 
I know, nowadays the xloader is SPL and is derived from uboot. But I
haven't the power to completely change everything again.
Frankly speaking, I afraid another nightmare here.
Unfortunatly TI doesn't have an newer SDK for OMAP3503/AM3703.
Is it true, that in this Arago or TI SDK the only functional ECC scheme
are 1 bit SW and 1 bit HW (for xloader)?

For me it seems (if you check my logs) that in xloader the
omap_calculate_ecc_bch4() uses hardware GPMC registers.
Main question: why this doens't work or give different results in
OMAP?

The version I take over for uboot and kernel (according to Technical
Note from Micron tn2971_software_bch_ecc_on_linux.pdf),
this functions. The counterpart for this seems to me in bch.c 
encode_bch(), which seems to run completly independent on hardware.

Please understand my situation. At TI forum I asked since monthes with
no real help. So I started my work and succeeded 90%.

Best regards
Steffen  





 >>>"Gupta, Pekon" <pekon at ti.com> schrieb am 21.11.13 um 06:12:
> This patch adds new CONFIG_NAND_OMAP_ECCSCHEME, replacing other
distributed
> CONFIG_xx used for selecting NAND ecc-schemes.
> This patch aims at solving following issues.
> 
> 1) Currently ecc-scheme is tied to SoC platform, which prevents user
to 
> select
>    other ecc-schemes also supported in hardware. like;
>  - most of OMAP3 SoC platforms use only 1-bit Hamming ecc-scheme,
inspite
>    the fact that they can use higher ecc-schemes like 8-bit
ecc-schemes with
>    software based error detection
(OMAP_ECC_BCH4_CODE_HW_DETECTION_SW).
>  - most of AM33xx SoC plaforms use 8-bit BCH ecc-scheme for now, but
hardware
>    supports BCH16 ecc-scheme also.
> 
> 2) Different platforms use different CONFIG_xx to select ecc-schemes,
which
>    adds confusion for user while migrating platforms.
>  - *CONFIG_NAND_OMAP_ELM* which enables ELM hardware engine, selects
only
>     8-bit BCH ecc-scheme with h/w based error-correction 
> (OMAP_ECC_BCH8_CODE_HW)
>     whereas ELM hardware engine supports other ecc-schemes also like;
BCH4,
>     and BCH16 (in future).
>  - *CONFIG_NAND_OMAP_BCH8* selects 8-bit BCH ecc-scheme with s/w
based error
>     correction (OMAP_ECC_BCH8_CODE_HW_DETECTION_SW).
>  - *CONFIG_SPL_NAND_SOFTECC* selects 1-bit Hamming ecc-scheme using
s/w library
> 
> Thus adding new *CONFIG_NAND_OMAP_ECCSCHEME* de-couples ecc-scheme
dependency
> on SoC platform and NAND driver. And user can select ecc-scheme
independently
> foreach board.
> However, selection some hardware based ecc-schemes
(OMAP_ECC_BCHx_CODE_HW) 
> still
> depends on presence of ELM hardware engine on SoC. (Refer
doc/README.nand)
> 
> Signed-off-by: Pekon Gupta <pekon at ti.com>
> ---
>  doc/README.nand                        | 23 +++++++++++++++++++++++
>  doc/README.omap3                       |  3 +--
>  drivers/mtd/nand/omap_gpmc.c           | 13 ++++---------
>  include/configs/am335x_evm.h           |  3 ++-
>  include/configs/am335x_igep0033.h      |  1 +
>  include/configs/am3517_crane.h         |  1 +
>  include/configs/am3517_evm.h           |  1 +
>  include/configs/devkit8000.h           |  1 +
>  include/configs/mcx.h                  |  2 +-
>  include/configs/omap3_beagle.h         |  1 +
>  include/configs/omap3_evm.h            |  1 +
>  include/configs/omap3_evm_quick_nand.h |  1 +
>  include/configs/omap3_igep00x0.h       |  1 +
>  include/configs/omap3_overo.h          |  1 +
>  include/configs/siemens-am33x-common.h |  1 +
>  include/configs/tam3517-common.h       |  2 +-
>  include/configs/tricorder.h            |  2 +-
>  17 files changed, 43 insertions(+), 15 deletions(-)
> 
> diff --git a/doc/README.nand b/doc/README.nand
> index 8a4252b..25a4412 100644
> --- a/doc/README.nand
> +++ b/doc/README.nand
> @@ -198,6 +198,29 @@ Platform specific options
>         detection. However ECC calculation on such plaforms would
still be
>         done by GPMC controller.
> 
> +   CONFIG_NAND_OMAP_ECCSCHEME
> +       On OMAP platforms, this CONFIG specifies NAND ECC scheme.
> +       It can take following values:
> +       OMAP_ECC_HAM1_CODE_SW
> +               1-bit Hamming code using software lib.
> +               (for legacy devices only)
> +       OMAP_ECC_HAM1_CODE_HW
> +               1-bit Hamming code using GPMC hardware.
> +               (for legacy devices only)
> +       OMAP_ECC_BCH4_CODE_HW_DETECTION_SW
> +               4-bit BCH code (unsupported)
> +       OMAP_ECC_BCH4_CODE_HW
> +               4-bit BCH code (unsupported)
> +       OMAP_ECC_BCH8_CODE_HW_DETECTION_SW
> +               8-bit BCH code with
> +               - ecc calculation using GPMC hardware engine,
> +               - error detection using software library.
> +               - requires CONFIG_BCH to enable software BCH library
> +               (For legacy device which do not have ELM h/w engine)
> +       OMAP_ECC_BCH8_CODE_HW
> +               8-bit BCH code with
> +               - ecc calculation using GPMC hardware engine,
> +               - error detection using ELM hardware engine.
> 
>  NOTE:
>  =====
> diff --git a/doc/README.omap3 b/doc/README.omap3
> index 1fbe79d..a62c357 100644
> --- a/doc/README.omap3
> +++ b/doc/README.omap3
> @@ -161,8 +161,7 @@ BCH8
> 
>  To enable hardware assisted BCH8 (8-bit BCH [Bose, Chaudhuri,
Hocquenghem]) 
> on
>  OMAP3 devices we can use the BCH library in lib/bch.c. To do so add

> CONFIG_BCH
> -to enable the library and CONFIG_NAND_OMAP_BCH8 to to enable
hardware 
> assisted
> -syndrom generation to your board config.
> +and set CONFIG_NAND_OMAP_ECCSCHEME=5 (refer README.nand) for
selecting 
> BCH8_SW.
>  The NAND OOB layout is the same as in linux kernel, if the linux
kernel 
> BCH8
>  implementation for OMAP3 works for you so the u-boot version should
also.
>  When you require the SPL to read with BCH8 there are two more
configs to
> diff --git a/drivers/mtd/nand/omap_gpmc.c
b/drivers/mtd/nand/omap_gpmc.c
> index e6b289d..5e7e6b3 100644
> --- a/drivers/mtd/nand/omap_gpmc.c
> +++ b/drivers/mtd/nand/omap_gpmc.c
> @@ -1004,18 +1004,13 @@ int board_nand_init(struct nand_chip *nand)
>         nand->ecc.layout = &omap_ecclayout;
> 
>         /* select ECC scheme */
> -#if defined(CONFIG_NAND_OMAP_ELM)
> -       err = omap_select_ecc_scheme(nand, OMAP_ECC_BCH8_CODE_HW,
> +#if defined(CONFIG_NAND_OMAP_ECCSCHEME)
> +       err = omap_select_ecc_scheme(nand,
CONFIG_NAND_OMAP_ECCSCHEME,
>                         CONFIG_SYS_NAND_PAGE_SIZE,
CONFIG_SYS_NAND_OOBSIZE);
> -#elif defined(CONFIG_NAND_OMAP_BCH8)
> -       err = omap_select_ecc_scheme(nand, 
> OMAP_ECC_BCH8_CODE_HW_DETECTION_SW,
> -                       CONFIG_SYS_NAND_PAGE_SIZE,
CONFIG_SYS_NAND_OOBSIZE);
> -#elif !defined(CONFIG_SPL_BUILD) ||
defined(CONFIG_SPL_NAND_SOFTECC)
> +#else
> +       /* pagesize and oobsize are not required to configure sw
ecc-scheme 
> */
>         err = omap_select_ecc_scheme(nand, OMAP_ECC_HAM1_CODE_SW,
>                         0, 0);
> -#else
> -       err = omap_select_ecc_scheme(nand, OMAP_ECC_HAM1_CODE_HW,
> -                       CONFIG_SYS_NAND_PAGE_SIZE,
CONFIG_SYS_NAND_OOBSIZE);
>  #endif
>         if (err)
>                 return err;
> diff --git a/include/configs/am335x_evm.h
b/include/configs/am335x_evm.h
> index 4c79ddb..d75df92 100644
> --- a/include/configs/am335x_evm.h
> +++ b/include/configs/am335x_evm.h
> @@ -239,7 +239,8 @@
> 
>  #define CONFIG_SYS_NAND_ECCSIZE                512
>  #define CONFIG_SYS_NAND_ECCBYTES       14
> -
> +#define CONFIG_SYS_NAND_ONFI_DETECTION
> +#define CONFIG_NAND_OMAP_ECCSCHEME     OMAP_ECC_BCH8_CODE_HW
>  #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
>  #define CONFIG_SYS_NAND_U_BOOT_OFFS    0x80000
>  #endif
> diff --git a/include/configs/am335x_igep0033.h 
> b/include/configs/am335x_igep0033.h
> index 88ced73..115d1b3 100644
> --- a/include/configs/am335x_igep0033.h
> +++ b/include/configs/am335x_igep0033.h
> @@ -264,6 +264,7 @@
> 
>  #define CONFIG_SYS_NAND_ECCSIZE                512
>  #define CONFIG_SYS_NAND_ECCBYTES       14
> +#define CONFIG_NAND_OMAP_ECCSCHEME     OMAP_ECC_BCH8_CODE_HW
> 
>  #define        CONFIG_SYS_NAND_U_BOOT_START    CONFIG_SYS_TEXT_BASE
> 
> diff --git a/include/configs/am3517_crane.h
b/include/configs/am3517_crane.h
> index 6fd3fb9..468fb43 100644
> --- a/include/configs/am3517_crane.h
> +++ b/include/configs/am3517_crane.h
> @@ -340,6 +340,7 @@
>                                                 10, 11, 12, 13}
>  #define CONFIG_SYS_NAND_ECCSIZE                512
>  #define CONFIG_SYS_NAND_ECCBYTES       3
> +#define CONFIG_NAND_OMAP_ECCSCHEME     OMAP_ECC_HAM1_CODE_HW
>  #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
>  #define CONFIG_SYS_NAND_U_BOOT_OFFS    0x80000
> 
> diff --git a/include/configs/am3517_evm.h
b/include/configs/am3517_evm.h
> index 7e9c55e..a3473b5 100644
> --- a/include/configs/am3517_evm.h
> +++ b/include/configs/am3517_evm.h
> @@ -334,6 +334,7 @@
>                                                 10, 11, 12, 13}
>  #define CONFIG_SYS_NAND_ECCSIZE                512
>  #define CONFIG_SYS_NAND_ECCBYTES       3
> +#define CONFIG_NAND_OMAP_ECCSCHEME     OMAP_ECC_HAM1_CODE_HW
>  #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
>  #define CONFIG_SYS_NAND_U_BOOT_OFFS    0x80000
> 
> diff --git a/include/configs/devkit8000.h
b/include/configs/devkit8000.h
> index 474a568..4f43ba9 100644
> --- a/include/configs/devkit8000.h
> +++ b/include/configs/devkit8000.h
> @@ -327,6 +327,7 @@
> 
>  #define CONFIG_SYS_NAND_ECCSIZE                512
>  #define CONFIG_SYS_NAND_ECCBYTES       3
> +#define CONFIG_NAND_OMAP_ECCSCHEME     OMAP_ECC_HAM1_CODE_HW
> 
>  #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
> 
> diff --git a/include/configs/mcx.h b/include/configs/mcx.h
> index a2f7cf7..dcd29ce 100644
> --- a/include/configs/mcx.h
> +++ b/include/configs/mcx.h
> @@ -353,7 +353,6 @@
>  #define CONFIG_SPL_FRAMEWORK
>  #define CONFIG_SPL_BOARD_INIT
>  #define CONFIG_SPL_NAND_SIMPLE
> -#define CONFIG_SPL_NAND_SOFTECC
> 
>  #define CONFIG_SPL_LIBCOMMON_SUPPORT
>  #define CONFIG_SPL_LIBDISK_SUPPORT
> @@ -395,6 +394,7 @@
>                                          56, 57, 58, 59, 60, 61, 62,
63}
>  #define CONFIG_SYS_NAND_ECCSIZE                256
>  #define CONFIG_SYS_NAND_ECCBYTES       3
> +#define CONFIG_NAND_OMAP_ECCSCHEME     OMAP_ECC_HAM1_CODE_SW
> 
>  #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
> 
> diff --git a/include/configs/omap3_beagle.h
b/include/configs/omap3_beagle.h
> index bba39d4..9eab190 100644
> --- a/include/configs/omap3_beagle.h
> +++ b/include/configs/omap3_beagle.h
> @@ -431,6 +431,7 @@
>                                                 10, 11, 12, 13}
>  #define CONFIG_SYS_NAND_ECCSIZE                512
>  #define CONFIG_SYS_NAND_ECCBYTES       3
> +#define CONFIG_NAND_OMAP_ECCSCHEME     OMAP_ECC_HAM1_CODE_HW
>  #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
>  #define CONFIG_SYS_NAND_U_BOOT_OFFS    0x80000
> 
> diff --git a/include/configs/omap3_evm.h
b/include/configs/omap3_evm.h
> index 3ace8bb..b7638fb 100644
> --- a/include/configs/omap3_evm.h
> +++ b/include/configs/omap3_evm.h
> @@ -107,6 +107,7 @@
>                                                 10, 11, 12, 13}
>  #define CONFIG_SYS_NAND_ECCSIZE                512
>  #define CONFIG_SYS_NAND_ECCBYTES       3
> +#define CONFIG_NAND_OMAP_ECCSCHEME     OMAP_ECC_HAM1_CODE_HW
>  #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
>  #define CONFIG_SYS_NAND_U_BOOT_OFFS    0x80000
> 
> diff --git a/include/configs/omap3_evm_quick_nand.h 
> b/include/configs/omap3_evm_quick_nand.h
> index 9ecd70d..4427e88 100644
> --- a/include/configs/omap3_evm_quick_nand.h
> +++ b/include/configs/omap3_evm_quick_nand.h
> @@ -86,6 +86,7 @@
>                                                 10, 11, 12, 13}
>  #define CONFIG_SYS_NAND_ECCSIZE                512
>  #define CONFIG_SYS_NAND_ECCBYTES       3
> +#define CONFIG_NAND_OMAP_ECCSCHEME     OMAP_ECC_HAM1_CODE_HW
>  #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
>  #define CONFIG_SYS_NAND_U_BOOT_OFFS    0x80000
> 
> diff --git a/include/configs/omap3_igep00x0.h 
> b/include/configs/omap3_igep00x0.h
> index 75d7d70..71062a6 100644
> --- a/include/configs/omap3_igep00x0.h
> +++ b/include/configs/omap3_igep00x0.h
> @@ -362,6 +362,7 @@
>                                                 10, 11, 12, 13}
>  #define CONFIG_SYS_NAND_ECCSIZE                512
>  #define CONFIG_SYS_NAND_ECCBYTES       3
> +#define CONFIG_NAND_OMAP_ECCSCHEME     OMAP_ECC_HAM1_CODE_HW
>  #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
>  #define CONFIG_SYS_NAND_U_BOOT_OFFS    0x80000
>  #endif
> diff --git a/include/configs/omap3_overo.h
b/include/configs/omap3_overo.h
> index 84b4aee..e0f0262 100644
> --- a/include/configs/omap3_overo.h
> +++ b/include/configs/omap3_overo.h
> @@ -324,6 +324,7 @@
>                                                 10, 11, 12, 13}
>  #define CONFIG_SYS_NAND_ECCSIZE                512
>  #define CONFIG_SYS_NAND_ECCBYTES       3
> +#define CONFIG_NAND_OMAP_ECCSCHEME     OMAP_ECC_HAM1_CODE_HW
>  #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
>  #define CONFIG_SYS_NAND_U_BOOT_OFFS    0x80000
> 
> diff --git a/include/configs/siemens-am33x-common.h 
> b/include/configs/siemens-am33x-common.h
> index 85d6dc2..f37653f 100644
> --- a/include/configs/siemens-am33x-common.h
> +++ b/include/configs/siemens-am33x-common.h
> @@ -195,6 +195,7 @@
> 
>  #define CONFIG_SYS_NAND_ECCSIZE                512
>  #define CONFIG_SYS_NAND_ECCBYTES       14
> +#define CONFIG_NAND_OMAP_ECCSCHEME     OMAP_ECC_BCH8_CODE_HW
> 
>  #define CONFIG_SYS_NAND_ECCSTEPS       4
>  #define        CONFIG_SYS_NAND_ECCTOTAL       
(CONFIG_SYS_NAND_ECCBYTES * 
> \
> diff --git a/include/configs/tam3517-common.h
b/include/configs/tam3517-common.h
> index 6112c1b..439fc47 100644
> --- a/include/configs/tam3517-common.h
> +++ b/include/configs/tam3517-common.h
> @@ -224,7 +224,6 @@
>  #define CONFIG_SPL_BOARD_INIT
>  #define CONFIG_SPL_CONSOLE
>  #define CONFIG_SPL_NAND_SIMPLE
> -#define CONFIG_SPL_NAND_SOFTECC
>  #define CONFIG_SPL_NAND_WORKSPACE      0x8f07f000 /* below BSS */
> 
>  #define CONFIG_SPL_LIBCOMMON_SUPPORT
> @@ -261,6 +260,7 @@
>                                          56, 57, 58, 59, 60, 61, 62,
63}
>  #define CONFIG_SYS_NAND_ECCSIZE                256
>  #define CONFIG_SYS_NAND_ECCBYTES       3
> +#define CONFIG_NAND_OMAP_ECCSCHEME     OMAP_ECC_HAM1_CODE_SW
> 
>  #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
> 
> diff --git a/include/configs/tricorder.h
b/include/configs/tricorder.h
> index afd8707..b38b955 100644
> --- a/include/configs/tricorder.h
> +++ b/include/configs/tricorder.h
> @@ -138,7 +138,6 @@
> 
>  #define CONFIG_SYS_MAX_NAND_DEVICE     1               /* Max number
of 
> NAND */
>                                                         /* devices
*/
> -#define CONFIG_NAND_OMAP_BCH8
>  #define CONFIG_BCH
> 
>  /* commands to include */
> @@ -374,6 +373,7 @@
> 
>  #define CONFIG_SYS_NAND_ECCSIZE                512
>  #define CONFIG_SYS_NAND_ECCBYTES       13
> +#define CONFIG_NAND_OMAP_ECCSCHEME    
OMAP_ECC_BCH8_CODE_HW_DETECTION_SW
> 
>  #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
> 
> --
> 1.8.1

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1994 bis 2014 - 20 Jahre SensoPart Industriesensorik  >>
http://www.sensopart.com/de/aktuelles/sensopart-news
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Besuchen Sie uns 2014 auf folgenden Messen:
21.-24.01.2014 NORTEC, Hamburg
13.-16.03.2014 CWIEME, Xian, China
01.-03.04.2014 Smart Industrie, Paris
07.-09.05.2014 Industrial Automation, Peking
03.-06.06.2014 AUTOMATICA, München
01.-05.09.2014 CNZBH, Shenyang, China
06.-09.10.2014 MOTEK, Stuttgart
04.-08.11.2014 CIIF Expo, Shanghai
05.-07.11.2014 FMB Forum Maschinenbau, Bad Salzuflen
04.-06.11.2014 VISION, Stuttgart
25.-27.11.2014 sps ipc drives, Nürnberg
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Besuchen Sie uns auf http://www.sensopart.com 

Postanschrift: Sensopart GmbH | Am Wiedenbach 1 | D-79695 Wieden,
Germany
Geschäftsführer: Dr. Theodor Wanner - Sitz der Gesellschaft: 79695
Wieden/Baden-Württemberg
Handelsregister: Amtsgericht Freiburg HRB 660163
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Zusätzliche Hinweise / Additional information

Vertraulichkeit: Diese E-Mail und/oder ihre Anhänge kann vertrauliche
und/oder rechtlich geschützte Informationen enthalten. Wenn Sie nicht
der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben,
informieren Sie bitte sofort den Absender und vernichten Sie diese Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist
nicht gestattet.

Virus: Diese E-Mail wurde auf Viren überprüft. Dies garantiert aber
keine Virenfreiheit. Wir übernehmen keine Haftung für eventuelle
Schäden, die durch diese E-Mail oder deren Anhänge entstehen könnten.
Danke für Ihr Verständnis.

Notice: This transmittal and/or attachments may be privileged or
confidential. If you are not the intended recipient, you are hereby
notified that you have received this transmittal in error; any review,
dissemination, or copying is strictly prohibited. If you received this
transmittal in error, please notify us immediately by reply and
immediately delete this message and all its attachments. Thank you


More information about the U-Boot mailing list