LIB   := $(obj)libnand.o
  
  ifdef CONFIG_CMD_NAND
 +
  ifdef CONFIG_SPL_BUILD
 -ifdef CONFIG_SPL_NAND_SIMPLE
 -COBJS-y += nand_spl_simple.o
 +
 +ifdef CONFIG_SPL_NAND_DRIVERS
 +NORMAL_DRIVERS=y
  endif
 -ifdef CONFIG_SPL_NAND_LOAD
 -COBJS-y       += nand_spl_load.o
 -endif
 -else
 +
+ COBJS-$(CONFIG_SPL_NAND_AM33XX_BCH) += am335x_spl_bch.o
 +COBJS-$(CONFIG_SPL_NAND_SIMPLE) += nand_spl_simple.o
 +COBJS-$(CONFIG_SPL_NAND_LOAD) += nand_spl_load.o
 +COBJS-$(CONFIG_SPL_NAND_ECC) += nand_ecc.o
 +COBJS-$(CONFIG_SPL_NAND_BASE) += nand_base.o
 +
 +else # not spl
 +
 +NORMAL_DRIVERS=y
 +
  COBJS-y += nand.o
  COBJS-y += nand_bbt.o
  COBJS-y += nand_ids.o
  COBJS-$(CONFIG_TEGRA_NAND) += tegra_nand.o
  COBJS-$(CONFIG_NAND_OMAP_GPMC) += omap_gpmc.o
  COBJS-$(CONFIG_NAND_PLAT) += nand_plat.o
 -endif
 +
- else  # minimal SPL drivers
- 
- COBJS-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_spl.o
- 
 +endif # drivers
 +endif # nand
  
  COBJS := $(COBJS-y)
  SRCS  := $(COBJS:.o=.c)
 
  #define CONFIG_SYS_SPI_U_BOOT_SIZE    0x40000
  #define CONFIG_SPL_LDSCRIPT           "$(CPUDIR)/omap-common/u-boot-spl.lds"
  
+ #define CONFIG_SPL_BOARD_INIT
+ #define CONFIG_SPL_NAND_AM33XX_BCH
+ #define CONFIG_SPL_NAND_SUPPORT
++#define CONFIG_SPL_NAND_BASE
++#define CONFIG_SPL_NAND_DRIVERS
++#define CONFIG_SPL_NAND_ECC
+ #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_ECCSTEPS      4
+ #define       CONFIG_SYS_NAND_ECCTOTAL        (CONFIG_SYS_NAND_ECCBYTES * \
+                                               CONFIG_SYS_NAND_ECCSTEPS)
+ 
+ #define       CONFIG_SYS_NAND_U_BOOT_START    CONFIG_SYS_TEXT_BASE
+ 
+ #define CONFIG_SYS_NAND_U_BOOT_OFFS   0x80000
+ 
  /*
   * 1MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM
   * 64 bytes before this address should be set aside for u-boot.img's