From 5f18187f4cd84d20fac8051a720f4746bede4bbb Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Tue, 2 Aug 2022 13:52:12 +0300 Subject: MTCDT SD image: Fix NAND initialization in the u-boot SD image --- .../u-boot/u-boot-2016.09.01/config-sd.patch | 2 +- .../u-boot/u-boot-2016.09.01/mtcdt-sd.patch | 35 +++++++++++----------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/recipes-bsp/u-boot/u-boot-2016.09.01/config-sd.patch b/recipes-bsp/u-boot/u-boot-2016.09.01/config-sd.patch index 4fcc301..f4fe410 100644 --- a/recipes-bsp/u-boot/u-boot-2016.09.01/config-sd.patch +++ b/recipes-bsp/u-boot/u-boot-2016.09.01/config-sd.patch @@ -318,7 +318,7 @@ diff -Naru orig/configs/at91sam9x5ek_nandflash_defconfig new/configs/at91sam9x5e +# CONFIG_CMD_LOADS is not set # CONFIG_CMD_FLASH is not set +# CONFIG_CMD_ARMFLASH is not set -+# CONFIG_CMD_NAND is not set ++CONFIG_CMD_NAND=y CONFIG_CMD_MMC=y -CONFIG_CMD_SF=y +# CONFIG_CMD_SF is not set diff --git a/recipes-bsp/u-boot/u-boot-2016.09.01/mtcdt-sd.patch b/recipes-bsp/u-boot/u-boot-2016.09.01/mtcdt-sd.patch index ddffc77..5604fcb 100644 --- a/recipes-bsp/u-boot/u-boot-2016.09.01/mtcdt-sd.patch +++ b/recipes-bsp/u-boot/u-boot-2016.09.01/mtcdt-sd.patch @@ -163,16 +163,17 @@ diff -Naru a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h #else #define CONFIG_BOOTARGS \ "console=ttyS0,115200 earlyprintk " \ -@@ -264,7 +315,7 @@ - #define CONFIG_SYS_NAND_OOBSIZE 64 - #define CONFIG_SYS_NAND_BLOCK_SIZE 0x20000 - #define CONFIG_SYS_NAND_BAD_BLOCK_POS 0x0 --#define CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER -+/* # CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER is not defined */ +@@ -253,7 +304,8 @@ + #define CONFIG_SPL_FAT_SUPPORT + #define CONFIG_SPL_LIBDISK_SUPPORT - #elif CONFIG_SYS_USE_SPIFLASH - #define CONFIG_SPL_SPI_SUPPORT -@@ -274,4 +325,21 @@ +-#elif CONFIG_SYS_USE_NANDFLASH ++/* Always Initialize NAND - required for SD manufacturing image. TODO: Double-check. */ ++/*#elif CONFIG_SYS_USE_NANDFLASH */ + #define CONFIG_SPL_NAND_SUPPORT + #define CONFIG_SPL_NAND_DRIVERS + #define CONFIG_SPL_NAND_BASE +@@ -274,4 +326,21 @@ #endif @@ -197,17 +198,15 @@ diff -Naru a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h diff -raNu old/board/atmel/at91sam9x5ek/at91sam9x5ek.c new/board/atmel/at91sam9x5ek/at91sam9x5ek.c --- old/board/atmel/at91sam9x5ek/at91sam9x5ek.c 2017-05-05 11:09:53.668926301 -0500 +++ new/board/atmel/at91sam9x5ek/at91sam9x5ek.c 2017-05-05 17:35:53.342774065 -0500 -@@ -44,7 +44,8 @@ +@@ -44,6 +44,7 @@ static void at91sam9x5ek_nand_hw_init(void) csa = readl(&matrix->ebicsa); csa |= AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA; /* NAND flash on D16 */ -- csa |= AT91_MATRIX_NFD0_ON_D16; -+ /* MTCDT: nand flash is set up by bootstrap, so leave it alone here */ -+ /* csa |= AT91_MATRIX_NFD0_ON_D16; */ ++ /* MTCDT: nand flash is NOT set up by bootstrap when booting from SD, so do NOT leave it alone here. TODO: Double-check. */ + csa |= AT91_MATRIX_NFD0_ON_D16; /* Configure IO drive */ - csa &= ~AT91_MATRIX_EBI_EBI_IOSR_NORMAL; -@@ -256,6 +257,9 @@ +@@ -256,6 +257,9 @@ int board_early_init_f(void) int board_init(void) { @@ -217,7 +216,7 @@ diff -raNu old/board/atmel/at91sam9x5ek/at91sam9x5ek.c new/board/atmel/at91sam9x /* arch number of AT91SAM9X5EK-Board */ gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9X5EK; -@@ -267,6 +271,7 @@ +@@ -267,6 +271,7 @@ int board_init(void) #endif #ifdef CONFIG_ATMEL_SPI @@ -225,7 +224,7 @@ diff -raNu old/board/atmel/at91sam9x5ek/at91sam9x5ek.c new/board/atmel/at91sam9x at91_spi0_hw_init(1 << 4); #endif -@@ -283,12 +288,6 @@ +@@ -283,12 +288,6 @@ int board_init(void) return 0; } @@ -238,7 +237,7 @@ diff -raNu old/board/atmel/at91sam9x5ek/at91sam9x5ek.c new/board/atmel/at91sam9x #if defined(CONFIG_SPL_BUILD) #include -@@ -362,4 +361,69 @@ +@@ -362,4 +361,69 @@ void mem_init(void) /* DDRAM2 Controller initialize */ ddr2_init(ATMEL_BASE_DDRSDRC, ATMEL_BASE_CS1, &ddr2); } -- cgit v1.2.3