@@ -154,4 +154,49 @@
#define CONFIG_SPL_DISPLAY_PRINT
#define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/omap-common/u-boot-spl.lds"
+#ifdef CONFIG_NAND
+#define CONFIG_NAND_OMAP_GPMC
+#define CONFIG_NAND_OMAP_ELM
+#define CONFIG_SYS_NAND_5_ADDR_CYCLE
+#define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \
+ CONFIG_SYS_NAND_PAGE_SIZE)
+#define CONFIG_SYS_NAND_PAGE_SIZE 2048
+#define CONFIG_SYS_NAND_OOBSIZE 64
+#define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024)
+#define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS
+#define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9, \
+ 10, 11, 12, 13, 14, 15, 16, 17, \
+ 18, 19, 20, 21, 22, 23, 24, 25, \
+ 26, 27, 28, 29, 30, 31, 32, 33, \
+ 34, 35, 36, 37, 38, 39, 40, 41, \
+ 42, 43, 44, 45, 46, 47, 48, 49, \
+ 50, 51, 52, 53, 54, 55, 56, 57, }
+
+#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
+
+/* NAND support */
+#ifdef CONFIG_NAND
+#define CONFIG_CMD_NAND
+#define GPMC_NAND_ECC_LP_x16_LAYOUT 1
+#if !defined(CONFIG_SPI_BOOT) && !defined(CONFIG_NOR_BOOT)
+#define MTDIDS_DEFAULT "nand0=omap2-nand.0"
+#define MTDPARTS_DEFAULT "mtdparts=omap2-nand.0:128k(SPL)," \
+ "128k(SPL.backup1)," \
+ "128k(SPL.backup2)," \
+ "128k(SPL.backup3),1792k(u-boot)," \
+ "128k(u-boot-spl-os)," \
+
"128k(u-boot-env),5m(kernel),-(rootfs)"
+#define CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OFFSET 0x260000 /* environment starts here
*/
+#define CONFIG_SYS_ENV_SECT_SIZE (128 << 10) /* 128 KiB */
+#endif
+#endif
+
#endif /* __CONFIG_OMAP4_COMMON_H */
3. Edited omap4_panda.h to prevent a compilation error (The ENV gets setup
as NAND thanks to earlier change);
@@ -45,8 +45,10 @@
/* GPIO */
#define CONFIG_CMD_GPIO
+#ifndef CONFIG_NAND
/* ENV related config options */
#define CONFIG_ENV_IS_NOWHERE
+#endif
#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
4. Copied over 2 header files from arch-omap3 to arch-omap4 (since they are
from the same processor family, I'm hoping it will work)
> cp arch/arm/include/asm/arch-omap3/mem.h
arch/arm/include/asm/arch-omap4/mem.h
> cp arch/arm/include/asm/arch-omap3/omap_gpmc.h
arch/arm/include/asm/arch-omap4/omap_gpmc.h
>
5. Edited cpu.h to add a few structure members needed for BCH error
correction (compiler complains they are missing otherwise);
b/arch/arm/include/asm/arch-omap4/cpu.h
@@ -28,6 +28,10 @@ struct gpmc_cs {
u8 res[8]; /* blow up to 0x30 byte */
};
+struct bch_res_0_3 {
+ u32 bch_result_x[4];
+};
+
struct gpmc {
u8 res1[0x10];
u32 sysconfig; /* 0x10 */
@@ -35,7 +39,7 @@ struct gpmc {
u32 irqstatus; /* 0x18 */
u32 irqenable; /* 0x1C */
u8 res3[0x20];
- u32 timeout_control; /* 0x40 */
+ u32 timeout_control; /* 0x40 */
u8 res4[0xC];
u32 config; /* 0x50 */
u32 status; /* 0x54 */
@@ -54,6 +58,8 @@ struct gpmc {
u32 ecc7_result; /* 0x218 */
u32 ecc8_result; /* 0x21C */
u32 ecc9_result; /* 0x220 */
+ u8 res7[0x1C]; /* fill up to 0x240 */
+ struct bch_res_0_3 bch_result_0_3[7]; /* 0x240 */
};
/* Used for board specific gpmc initialization */
6. Adding a #define in omap.h to allow NAND driver to compile (The value of
ELM_BASE was copied over from arch/arm/include/asm/arch-am33xx/hardware.h)
b/arch/arm/include/asm/arch-omap4/omap.h
@@ -63,6 +63,9 @@
/* GPMC */
#define OMAP44XX_GPMC_BASE 0x50000000
+/* BCH Error Location Module */
+#define ELM_BASE 0x48080000
+
/*
* Hardware Register Details
*/