at91: Fix NAND PMECC on various SoCs/boards
cover at91: Fix NAND PMECC on various SoCs/boards
Fix the Galois Field Table offsets for sama5d3 and sam9x60 SoCs. PMECC could not correct errors.
Fix the involuntarily disablement of NAND PMECC on some boards, and fix some wrong definitions for CONFIG_PMECC_CAP.
Tested on sam9x60ek and sama5d3_xplained. I/we "injected" bit flips into u-boot NAND memory area, and then read back. PMECC could not correct the errors. With these everything is fine.
Kai Stuhlemmer (ebee Engineering) (1):
sam9x60.h: Fix Galois Field Table offsets
Tudor Ambarus (3):
configs: at91: Fix the involuntarily disablement of NAND PMECC
configs: at91: Fix wrong definitions for CONFIG_PMECC_CAP
sama5d3: Fix Galois Field Table offsets
arch/arm/mach-at91/include/mach/sam9x60.h | 4 ++-- arch/arm/mach-at91/include/mach/sama5d3.h | 4 ++-- configs/at91sam9n12ek_mmc_defconfig | 1 + configs/at91sam9n12ek_spiflash_defconfig | 1 + configs/at91sam9x5ek_mmc_defconfig | 1 + configs/at91sam9x5ek_spiflash_defconfig | 1 + configs/sama5d36ek_cmp_mmc_defconfig | 2 ++ configs/sama5d36ek_cmp_nandflash_defconfig | 1 + configs/sama5d36ek_cmp_spiflash_defconfig | 2 ++ configs/sama5d3_xplained_mmc_defconfig | 2 ++ configs/sama5d3xek_mmc_defconfig | 2 ++ configs/sama5d3xek_spiflash_defconfig | 2 ++ configs/sama5d4_xplained_spiflash_defconfig | 2 ++ configs/sama5d4ek_mmc_defconfig | 2 ++ configs/sama5d4ek_spiflash_defconfig | 2 ++ 15 files changed, 25 insertions(+), 4 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/4 configs: at91: Fix the involuntarily disablement of NAND PMECC
SPL_GENERATE_ATMEL_PMECC_HEADER selects:ATMEL_NAND_HWECC [=y] && ATMEL_NAND_HW_PMECC [=y].
With the removal of SPL_GENERATE_ATMEL_PMECC_HEADER, ATMEL_NAND_HW_PMECC and ATMEL_NAND_HWECC were no longer selected. Also, when the SPL_GENERATE_ATMEL_PMECC_HEADER was removed, the configs were not updated using savedefconfig, thus the 'commit d168bcb6fe39 ("configs: Resync with savedefconfig")' further removes the CONFIG_PMECC_CAP value.
Update defconfigs and add CONFIG_ATMEL_NAND_HW_PMECC, which selects ATMEL_NAND_HWECC, in order to restore NAND PMECC support. Restore CONFIG_PMECC_CAP value.
--- configs/at91sam9n12ek_mmc_defconfig | 1 + configs/at91sam9n12ek_spiflash_defconfig | 1 + configs/at91sam9x5ek_mmc_defconfig | 1 + configs/at91sam9x5ek_spiflash_defconfig | 1 + configs/sama5d36ek_cmp_mmc_defconfig | 1 + configs/sama5d36ek_cmp_spiflash_defconfig | 1 + configs/sama5d3_xplained_mmc_defconfig | 1 + configs/sama5d3xek_mmc_defconfig | 2 ++ configs/sama5d3xek_spiflash_defconfig | 2 ++ configs/sama5d4_xplained_spiflash_defconfig | 2 ++ configs/sama5d4ek_mmc_defconfig | 1 + configs/sama5d4ek_spiflash_defconfig | 2 ++ 12 files changed, 16 insertions(+)
configs/at91sam9n12ek_mmc_defconfig +1 -0
@@ -43,6 +43,7 @@ CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y # CONFIG_SYS_NAND_USE_FLASH_BBT is not set CONFIG_NAND_ATMEL=y +CONFIG_ATMEL_NAND_HW_PMECC=y CONFIG_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=30000000 CONFIG_SPI_FLASH_ATMEL=y
configs/at91sam9n12ek_spiflash_defconfig +1 -0
@@ -45,6 +45,7 @@ CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y # CONFIG_SYS_NAND_USE_FLASH_BBT is not set CONFIG_NAND_ATMEL=y +CONFIG_ATMEL_NAND_HW_PMECC=y CONFIG_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=30000000 CONFIG_SPI_FLASH_ATMEL=y
configs/at91sam9x5ek_mmc_defconfig +1 -0
@@ -46,6 +46,7 @@ CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y # CONFIG_SYS_NAND_USE_FLASH_BBT is not set CONFIG_NAND_ATMEL=y +CONFIG_ATMEL_NAND_HW_PMECC=y CONFIG_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=30000000 CONFIG_SPI_FLASH_ATMEL=y
configs/at91sam9x5ek_spiflash_defconfig +1 -0
@@ -48,6 +48,7 @@ CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y # CONFIG_SYS_NAND_USE_FLASH_BBT is not set CONFIG_NAND_ATMEL=y +CONFIG_ATMEL_NAND_HW_PMECC=y CONFIG_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=30000000 CONFIG_SPI_FLASH_ATMEL=y
configs/sama5d36ek_cmp_mmc_defconfig +1 -0
@@ -47,6 +47,7 @@ CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y # CONFIG_SYS_NAND_USE_FLASH_BBT is not set CONFIG_NAND_ATMEL=y +CONFIG_ATMEL_NAND_HW_PMECC=y CONFIG_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=30000000 CONFIG_SPI_FLASH_ATMEL=y
configs/sama5d36ek_cmp_spiflash_defconfig +1 -0
@@ -49,6 +49,7 @@ CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y # CONFIG_SYS_NAND_USE_FLASH_BBT is not set CONFIG_NAND_ATMEL=y +CONFIG_ATMEL_NAND_HW_PMECC=y CONFIG_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=30000000 CONFIG_SPI_FLASH_ATMEL=y
configs/sama5d3_xplained_mmc_defconfig +1 -0
@@ -66,6 +66,7 @@ CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y # CONFIG_SYS_NAND_USE_FLASH_BBT is not set CONFIG_NAND_ATMEL=y +CONFIG_ATMEL_NAND_HW_PMECC=y CONFIG_DM_ETH=y CONFIG_MACB=y CONFIG_PINCTRL=y
configs/sama5d3xek_mmc_defconfig +2 -0
@@ -71,6 +71,8 @@ CONFIG_SYS_FLASH_CFI=y CONFIG_MTD_RAW_NAND=y # CONFIG_SYS_NAND_USE_FLASH_BBT is not set CONFIG_NAND_ATMEL=y +CONFIG_ATMEL_NAND_HW_PMECC=y +CONFIG_PMECC_CAP=4 CONFIG_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=30000000 CONFIG_SPI_FLASH_ATMEL=y
configs/sama5d3xek_spiflash_defconfig +2 -0
@@ -72,6 +72,8 @@ CONFIG_SYS_FLASH_CFI=y CONFIG_MTD_RAW_NAND=y # CONFIG_SYS_NAND_USE_FLASH_BBT is not set CONFIG_NAND_ATMEL=y +CONFIG_ATMEL_NAND_HW_PMECC=y +CONFIG_PMECC_CAP=4 CONFIG_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=30000000 CONFIG_SPI_FLASH_ATMEL=y
configs/sama5d4_xplained_spiflash_defconfig +2 -0
@@ -68,6 +68,8 @@ CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y # CONFIG_SYS_NAND_USE_FLASH_BBT is not set CONFIG_NAND_ATMEL=y +CONFIG_ATMEL_NAND_HW_PMECC=y +CONFIG_PMECC_CAP=8 CONFIG_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=30000000 CONFIG_SPI_FLASH_ATMEL=y
configs/sama5d4ek_mmc_defconfig +1 -0
@@ -62,6 +62,7 @@ CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y # CONFIG_SYS_NAND_USE_FLASH_BBT is not set CONFIG_NAND_ATMEL=y +CONFIG_ATMEL_NAND_HW_PMECC=y CONFIG_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=30000000 CONFIG_SPI_FLASH_ATMEL=y
configs/sama5d4ek_spiflash_defconfig +2 -0
@@ -65,6 +65,8 @@ CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y # CONFIG_SYS_NAND_USE_FLASH_BBT is not set CONFIG_NAND_ATMEL=y +CONFIG_ATMEL_NAND_HW_PMECC=y +CONFIG_PMECC_CAP=8 CONFIG_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=30000000 CONFIG_SPI_FLASH_ATMEL=y
Signature · 1 line
2.25.1
PATCH 2/4 configs: at91: Fix wrong definitions for CONFIG_PMECC_CAP
In reply to Tudor AmbarusWhen CONFIG_ATMEL_NAND_HW_PMECC is set, CONFIG_PMECC_CAP defaults to the value of 2. At the conversion to Kconfig for the PMECC config values, some boards/defconfigs were wrongly configured. Update CONFIG_PMECC_CAP to the PMECC_CAP value before the conversion.
--- configs/sama5d36ek_cmp_mmc_defconfig | 1 + configs/sama5d36ek_cmp_nandflash_defconfig | 1 + configs/sama5d36ek_cmp_spiflash_defconfig | 1 + configs/sama5d3_xplained_mmc_defconfig | 1 + configs/sama5d4ek_mmc_defconfig | 1 + 5 files changed, 5 insertions(+)
configs/sama5d36ek_cmp_mmc_defconfig +1 -0
@@ -48,6 +48,7 @@ CONFIG_MTD_RAW_NAND=y # CONFIG_SYS_NAND_USE_FLASH_BBT is not set CONFIG_NAND_ATMEL=y CONFIG_ATMEL_NAND_HW_PMECC=y +CONFIG_PMECC_CAP=4 CONFIG_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=30000000 CONFIG_SPI_FLASH_ATMEL=y
configs/sama5d36ek_cmp_nandflash_defconfig +1 -0
@@ -47,6 +47,7 @@ CONFIG_GENERIC_ATMEL_MCI=y CONFIG_MTD=y # CONFIG_SYS_NAND_USE_FLASH_BBT is not set CONFIG_NAND_ATMEL=y +CONFIG_PMECC_CAP=4 CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER=y CONFIG_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=30000000
configs/sama5d36ek_cmp_spiflash_defconfig +1 -0
@@ -50,6 +50,7 @@ CONFIG_MTD_RAW_NAND=y # CONFIG_SYS_NAND_USE_FLASH_BBT is not set CONFIG_NAND_ATMEL=y CONFIG_ATMEL_NAND_HW_PMECC=y +CONFIG_PMECC_CAP=4 CONFIG_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=30000000 CONFIG_SPI_FLASH_ATMEL=y
configs/sama5d3_xplained_mmc_defconfig +1 -0
@@ -67,6 +67,7 @@ CONFIG_MTD_RAW_NAND=y # CONFIG_SYS_NAND_USE_FLASH_BBT is not set CONFIG_NAND_ATMEL=y CONFIG_ATMEL_NAND_HW_PMECC=y +CONFIG_PMECC_CAP=4 CONFIG_DM_ETH=y CONFIG_MACB=y CONFIG_PINCTRL=y
configs/sama5d4ek_mmc_defconfig +1 -0
@@ -63,6 +63,7 @@ CONFIG_MTD_RAW_NAND=y # CONFIG_SYS_NAND_USE_FLASH_BBT is not set CONFIG_NAND_ATMEL=y CONFIG_ATMEL_NAND_HW_PMECC=y +CONFIG_PMECC_CAP=8 CONFIG_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=30000000 CONFIG_SPI_FLASH_ATMEL=y
Signature · 1 line
2.25.1
PATCH 3/4 sama5d3: Fix Galois Field Table offsets
In reply to Tudor AmbarusOffsets are described in the datasheet at section:
"11.4.4.2 NAND Flash Boot: PMECC Error Detection and Correction".
For testing I "injected" bit flips into u-boot NAND memory area, and then read back. PMECC could not correct the errors. With the offsets updated everything is fine.
--- arch/arm/mach-at91/include/mach/sama5d3.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-at91/include/mach/sama5d3.h +2 -2
@@ -190,8 +190,8 @@/* * PMECC table in ROM */ -#define ATMEL_PMECC_INDEX_OFFSET_512 0x10000 -#define ATMEL_PMECC_INDEX_OFFSET_1024 0x18000 +#define ATMEL_PMECC_INDEX_OFFSET_512 0x8000 +#define ATMEL_PMECC_INDEX_OFFSET_1024 0x10000/* * SAMA5D3 specific prototypes
Signature · 1 line
2.25.1
PATCH 4/4 sam9x60.h: Fix Galois Field Table offsets
In reply to Tudor AmbarusFrom: "Kai Stuhlemmer (ebee Engineering)" <[email protected]>
Because ATMEL_BASE_ROM is defined to 0x100000, it already points to the begin of the index table for 512 byte sectors correction. Thus its offset must be zero and the index of the table for 1024 byte sectors must start at offset 0x8000.
--- arch/arm/mach-at91/include/mach/sam9x60.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-at91/include/mach/sam9x60.h +2 -2
@@ -154,8 +154,8 @@/* * PMECC table in ROM */ -#define ATMEL_PMECC_INDEX_OFFSET_512 0x8000 -#define ATMEL_PMECC_INDEX_OFFSET_1024 0x10000 +#define ATMEL_PMECC_INDEX_OFFSET_512 0x0000 +#define ATMEL_PMECC_INDEX_OFFSET_1024 0x8000/* * SAM9X60 specific prototypes
Signature · 1 line
2.25.1
cover at91: Fix NAND PMECC on various SoCs/boards
In reply to Tudor AmbarusQuoted 18 lines · Tudor Ambarus
Fix the Galois Field Table offsets for sama5d3 and sam9x60 SoCs. PMECC could not correct errors.
Fix the involuntarily disablement of NAND PMECC on some boards, and fix some wrong definitions for
CONFIG_PMECC_CAP.Tested on sam9x60ek and
sama5d3_xplained. I/we "injected" bit flips into u-boot NAND memory area, and then read back. PMECC could not correct the errors. With these everything is fine.Kai Stuhlemmer (ebee Engineering) (1):
sam9x60.h: Fix Galois Field Table offsetsTudor Ambarus (3):
configs: at91: Fix the involuntarily disablement of NAND PMECC
configs: at91: Fix wrong definitions forCONFIG_PMECC_CAP
sama5d3: Fix Galois Field Table offsets
Quoted 17 lines
arch/arm/mach-at91/include/mach/sam9x60.h | 4 ++-- arch/arm/mach-at91/include/mach/sama5d3.h | 4 ++-- configs/at91sam9n12ek_mmc_defconfig | 1 + configs/at91sam9n12ek_spiflash_defconfig | 1 + configs/at91sam9x5ek_mmc_defconfig | 1 + configs/at91sam9x5ek_spiflash_defconfig | 1 + configs/sama5d36ek_cmp_mmc_defconfig | 2 ++ configs/sama5d36ek_cmp_nandflash_defconfig | 1 + configs/sama5d36ek_cmp_spiflash_defconfig | 2 ++ configs/sama5d3_xplained_mmc_defconfig | 2 ++ configs/sama5d3xek_mmc_defconfig | 2 ++ configs/sama5d3xek_spiflash_defconfig | 2 ++ configs/sama5d4_xplained_spiflash_defconfig | 2 ++ configs/sama5d4ek_mmc_defconfig | 2 ++ configs/sama5d4ek_spiflash_defconfig | 2 ++ 15 files changed, 25 insertions(+), 4 deletions(-)
Applied to u-boot-atmel/master and pushed out, thanks !