Changes to move hawkboard to the new spl infrastructure

This patch moves hawkboard to the new spl infrastructure from the
older nand_spl one.

Removed the hawkboard_nand_config build option -- The spl code now
gets compiled with hawkboard_config, after building the main u-boot
image, using the CONFIG_SPL_TEXT_BASE. Modified the README.hawkboard
to reflect the same.

Signed-off-by: Sughosh Ganu <urwithsughosh@gmail.com>
Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Cc: Christian Riesch <christian.riesch@omicron.at>
Cc: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
Cc: Tom Rini <trini@ti.com>
Acked-by: Christian Riesch <christian.riesch@omicron.at>
diff --git a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c
index eec06bc..df7d6a2 100644
--- a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c
+++ b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c
@@ -32,6 +32,7 @@
 #include <asm/arch/emif_defs.h>
 #include <asm/arch/pll_defs.h>
 
+#if defined(CONFIG_SYS_DA850_PLL_INIT)
 void da850_waitloop(unsigned long loopcnt)
 {
 	unsigned long	i;
@@ -163,7 +164,9 @@
 
 	return 0;
 }
+#endif /* CONFIG_SYS_DA850_PLL_INIT */
 
+#if defined(CONFIG_SYS_DA850_DDR_INIT)
 int da850_ddr_setup(void)
 {
 	unsigned long	tmp;
@@ -242,6 +245,7 @@
 
 	return 0;
 }
+#endif /* CONFIG_SYS_DA850_DDR_INIT */
 
 __attribute__((weak))
 void board_gpio_init(void)
@@ -249,10 +253,6 @@
 	return;
 }
 
-/* pinmux_resource[] vector is defined in the board specific file */
-extern const struct pinmux_resource pinmuxes[];
-extern const int pinmuxes_size;
-
 int arch_cpu_init(void)
 {
 	/* Unlock kick registers */
@@ -266,13 +266,11 @@
 	if (davinci_configure_pin_mux_items(pinmuxes, pinmuxes_size))
 		return 1;
 
+#if defined(CONFIG_SYS_DA850_PLL_INIT)
 	/* PLL setup */
 	da850_pll_init(davinci_pllc0_regs, CONFIG_SYS_DA850_PLL0_PLLM);
 	da850_pll_init(davinci_pllc1_regs, CONFIG_SYS_DA850_PLL1_PLLM);
-
-	/* GPIO setup */
-	board_gpio_init();
-
+#endif
 	/* setup CSn config */
 #if defined(CONFIG_SYS_DA850_CS2CFG)
 	writel(CONFIG_SYS_DA850_CS2CFG, &davinci_emif_regs->ab1cr);
@@ -281,7 +279,12 @@
 	writel(CONFIG_SYS_DA850_CS3CFG, &davinci_emif_regs->ab2cr);
 #endif
 
-	lpsc_on(CONFIG_SYS_DA850_LPSC_UART);
+	da8xx_configure_lpsc_items(lpsc, lpsc_size);
+
+	/* GPIO setup */
+	board_gpio_init();
+
+
 	NS16550_init((NS16550_t)(CONFIG_SYS_NS16550_COM1),
 			CONFIG_SYS_NS16550_CLK / 16 / CONFIG_BAUDRATE);
 
@@ -293,6 +296,9 @@
 		DAVINCI_UART_PWREMU_MGMT_UTRST),
 	       &davinci_uart2_ctrl_regs->pwremu_mgmt);
 
+#if defined(CONFIG_SYS_DA850_DDR_INIT)
 	da850_ddr_setup();
+#endif
+
 	return 0;
 }
diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c b/arch/arm/cpu/arm926ejs/davinci/spl.c
index f475f9b..74632e5 100644
--- a/arch/arm/cpu/arm926ejs/davinci/spl.c
+++ b/arch/arm/cpu/arm926ejs/davinci/spl.c
@@ -74,12 +74,12 @@
 
 void board_init_r(gd_t *id, ulong dummy)
 {
-#ifdef CONFIG_SOC_DM365
+#ifdef CONFIG_SPL_NAND_LOAD
 	nand_init();
 	puts("Nand boot...\n");
 	nand_boot();
 #endif
-#ifdef CONFIG_SOC_DA8XX
+#ifdef CONFIG_SPL_SPI_LOAD
 	mem_malloc_init(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN,
 			CONFIG_SYS_MALLOC_LEN);
 
diff --git a/arch/arm/include/asm/arch-davinci/da850_lowlevel.h b/arch/arm/include/asm/arch-davinci/da850_lowlevel.h
index e489c47..11ed91d 100644
--- a/arch/arm/include/asm/arch-davinci/da850_lowlevel.h
+++ b/arch/arm/include/asm/arch-davinci/da850_lowlevel.h
@@ -24,6 +24,15 @@
 #ifndef __DA850_LOWLEVEL_H
 #define __DA850_LOWLEVEL_H
 
+#include <asm/arch/pinmux_defs.h>
+
+/* pinmux_resource[] vector is defined in the board specific file */
+extern const struct pinmux_resource pinmuxes[];
+extern const int pinmuxes_size;
+
+extern const struct lpsc_resource lpsc[];
+extern const int lpsc_size;
+
 /* NOR Boot Configuration Word Field Descriptions */
 #define DA850_NORBOOT_COPY_XK(X)	((X - 1) << 8)
 #define DA850_NORBOOT_METHOD_DIRECT	(1 << 4)
diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index 9bd3e71..34ef53d 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -137,7 +137,7 @@
 
 const int pinmuxes_size = ARRAY_SIZE(pinmuxes);
 
-static const struct lpsc_resource lpsc[] = {
+const struct lpsc_resource lpsc[] = {
 	{ DAVINCI_LPSC_AEMIF },	/* NAND, NOR */
 	{ DAVINCI_LPSC_SPI1 },	/* Serial Flash */
 	{ DAVINCI_LPSC_EMAC },	/* image download */
@@ -145,6 +145,8 @@
 	{ DAVINCI_LPSC_GPIO },
 };
 
+const int lpsc_size = ARRAY_SIZE(lpsc);
+
 #ifndef CONFIG_DA850_EVM_MAX_CPU_CLK
 #define CONFIG_DA850_EVM_MAX_CPU_CLK	300000000
 #endif
diff --git a/board/davinci/da8xxevm/hawkboard.c b/board/davinci/da8xxevm/hawkboard.c
index 9d4e238..b694258 100644
--- a/board/davinci/da8xxevm/hawkboard.c
+++ b/board/davinci/da8xxevm/hawkboard.c
@@ -27,10 +27,33 @@
 #include <asm/arch/hardware.h>
 #include <asm/io.h>
 #include <asm/arch/davinci_misc.h>
+#include <asm/arch/pinmux_defs.h>
 #include <ns16550.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
+const struct pinmux_resource pinmuxes[] = {
+	PINMUX_ITEM(emac_pins_mii),
+	PINMUX_ITEM(emac_pins_mdio),
+	PINMUX_ITEM(emifa_pins_cs3),
+	PINMUX_ITEM(emifa_pins_cs4),
+	PINMUX_ITEM(emifa_pins_nand),
+	PINMUX_ITEM(uart2_pins_txrx),
+	PINMUX_ITEM(uart2_pins_rtscts),
+};
+
+const int pinmuxes_size = ARRAY_SIZE(pinmuxes);
+
+const struct lpsc_resource lpsc[] = {
+	{ DAVINCI_LPSC_AEMIF },	/* NAND, NOR */
+	{ DAVINCI_LPSC_SPI1 },	/* Serial Flash */
+	{ DAVINCI_LPSC_EMAC },	/* image download */
+	{ DAVINCI_LPSC_UART2 },	/* console */
+	{ DAVINCI_LPSC_GPIO },
+};
+
+const int lpsc_size = ARRAY_SIZE(lpsc);
+
 int board_init(void)
 {
 	/* arch number of the board */
diff --git a/board/davinci/da8xxevm/hawkboard_nand_spl.c b/board/davinci/da8xxevm/hawkboard_nand_spl.c
deleted file mode 100644
index df97963..0000000
--- a/board/davinci/da8xxevm/hawkboard_nand_spl.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Modified for Hawkboard - Syed Mohammed Khasim <khasim@beagleboard.org>
- *
- * Copyright (C) 2008 Sekhar Nori, Texas Instruments, Inc.  <nsekhar@ti.com>
- * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net>
- * Copyright (C) 2004 Texas Instruments.
- *
- * ----------------------------------------------------------------------------
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- * ----------------------------------------------------------------------------
- */
-
-#include <common.h>
-#include <asm/errno.h>
-#include <asm/arch/hardware.h>
-#include <asm/io.h>
-#include <asm/arch/davinci_misc.h>
-#include <asm/arch/pinmux_defs.h>
-#include <ns16550.h>
-#include <nand.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-static const struct pinmux_resource pinmuxes[] = {
-	PINMUX_ITEM(emac_pins_mii),
-	PINMUX_ITEM(emac_pins_mdio),
-	PINMUX_ITEM(emifa_pins_cs3),
-	PINMUX_ITEM(emifa_pins_cs4),
-	PINMUX_ITEM(emifa_pins_nand),
-	PINMUX_ITEM(uart2_pins_txrx),
-	PINMUX_ITEM(uart2_pins_rtscts),
-};
-
-static const struct lpsc_resource lpsc[] = {
-	{ DAVINCI_LPSC_AEMIF },	/* NAND, NOR */
-	{ DAVINCI_LPSC_SPI1 },	/* Serial Flash */
-	{ DAVINCI_LPSC_EMAC },	/* image download */
-	{ DAVINCI_LPSC_UART2 },	/* console */
-	{ DAVINCI_LPSC_GPIO },
-};
-
-void board_init_f(ulong bootflag)
-{
-	/*
-	 * Kick Registers need to be set to allow access to Pin Mux registers
-	 */
-	writel(DV_SYSCFG_KICK0_UNLOCK, &davinci_syscfg_regs->kick0);
-	writel(DV_SYSCFG_KICK1_UNLOCK, &davinci_syscfg_regs->kick1);
-
-	/* setup the SUSPSRC for ARM to control emulation suspend */
-	writel(readl(&davinci_syscfg_regs->suspsrc) &
-	       ~(DAVINCI_SYSCFG_SUSPSRC_EMAC | DAVINCI_SYSCFG_SUSPSRC_I2C |
-		 DAVINCI_SYSCFG_SUSPSRC_SPI1 | DAVINCI_SYSCFG_SUSPSRC_TIMER0 |
-		 DAVINCI_SYSCFG_SUSPSRC_UART2), &davinci_syscfg_regs->suspsrc);
-
-	/* Power on required peripherals
-	 * ARM does not have acess by default to PSC0 and PSC1
-	 * assuming here that the DSP bootloader has set the IOPU
-	 * such that PSC access is available to ARM
-	 */
-	da8xx_configure_lpsc_items(lpsc, ARRAY_SIZE(lpsc));
-
-	/* configure pinmux settings */
-	davinci_configure_pin_mux_items(pinmuxes,
-					ARRAY_SIZE(pinmuxes));
-
-	writel(readl(&davinci_uart2_ctrl_regs->pwremu_mgmt) |
-	       (DAVINCI_UART_PWREMU_MGMT_FREE) |
-	       (DAVINCI_UART_PWREMU_MGMT_URRST) |
-	       (DAVINCI_UART_PWREMU_MGMT_UTRST),
-	       &davinci_uart2_ctrl_regs->pwremu_mgmt);
-
-	NS16550_init((NS16550_t)(DAVINCI_UART2_BASE),
-			CONFIG_SYS_NS16550_CLK / 16 / CONFIG_BAUDRATE);
-
-	puts("Nand boot...\n");
-
-	nand_boot();
-}
-
-void puts(const char *str)
-{
-	while (*str)
-		putc(*str++);
-}
-
-void putc(char c)
-{
-	if (gd->flags & GD_FLG_SILENT)
-		return;
-
-	if (c == '\n')
-		NS16550_putc((NS16550_t)(DAVINCI_UART2_BASE), '\r');
-
-	NS16550_putc((NS16550_t)(DAVINCI_UART2_BASE), c);
-}
-
-void hang(void)
-{
-	puts("### ERROR ### Please RESET the board ###\n");
-	for (;;)
-		;
-}
diff --git a/board/davinci/da8xxevm/u-boot-spl.lds b/board/davinci/da8xxevm/u-boot-spl-da850evm.lds
similarity index 100%
rename from board/davinci/da8xxevm/u-boot-spl.lds
rename to board/davinci/da8xxevm/u-boot-spl-da850evm.lds
diff --git a/nand_spl/board/davinci/da8xxevm/u-boot.lds b/board/davinci/da8xxevm/u-boot-spl-hawk.lds
similarity index 85%
rename from nand_spl/board/davinci/da8xxevm/u-boot.lds
rename to board/davinci/da8xxevm/u-boot-spl-hawk.lds
index 638ffd9..b3a41af 100644
--- a/nand_spl/board/davinci/da8xxevm/u-boot.lds
+++ b/board/davinci/da8xxevm/u-boot-spl-hawk.lds
@@ -34,11 +34,11 @@
 	. = ALIGN(4);
 	.text      :
 	{
-	  start.o	(.text)
-	  cpu.o		(.text)
-	  nand_boot.o	(.text)
+	  arch/arm/cpu/arm926ejs/start.o		(.text)
+	  arch/arm/cpu/arm926ejs/davinci/libdavinci.o	(.text)
+	  drivers/mtd/nand/libnand.o			(.text)
 
-	  *(.text)
+	  *(.text*)
 	}
 
 	. = ALIGN(4);
@@ -68,10 +68,14 @@
 
 	__got_end = .;
 
-	_end = .;
+	.bss :
+	{
+		. = ALIGN(4);
+		__bss_start = .;
+		*(.bss*)
+		. = ALIGN(4);
+		__bss_end__ = .;
+	}
 
-	. = ALIGN(4);
-	__bss_start = .;
-	.bss : { *(.bss) }
-	__bss_end__ = .;
+	_end = .;
 }
diff --git a/board/enbw/enbw_cmc/enbw_cmc.c b/board/enbw/enbw_cmc/enbw_cmc.c
index 98dda1e..16d1b08 100644
--- a/board/enbw/enbw_cmc/enbw_cmc.c
+++ b/board/enbw/enbw_cmc/enbw_cmc.c
@@ -49,7 +49,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static const struct lpsc_resource lpsc[] = {
+const struct lpsc_resource lpsc[] = {
 	{ DAVINCI_LPSC_AEMIF },
 	{ DAVINCI_LPSC_SPI1 },
 	{ DAVINCI_LPSC_ARM_RAM_ROM },
@@ -65,6 +65,8 @@
 	{ DAVINCI_LPSC_USB11 },
 };
 
+const int lpsc_size = ARRAY_SIZE(lpsc);
+
 static const struct pinmux_config enbw_pins[] = {
 	{ pinmux(0), 8, 0 },
 	{ pinmux(0), 8, 1 },
@@ -549,15 +551,6 @@
 	struct davinci_gpio *gpio = davinci_gpio_bank01;
 
 	/*
-	 * Power on required peripherals
-	 * ARM does not have access by default to PSC0 and PSC1
-	 * assuming here that the DSP bootloader has set the IOPU
-	 * such that PSC access is available to ARM
-	 */
-	if (da8xx_configure_lpsc_items(lpsc, ARRAY_SIZE(lpsc)))
-		return;
-
-	/*
 	 * set LED (gpio Interface not usable here)
 	 * set LED pins to output and state 0
 	 */
diff --git a/boards.cfg b/boards.cfg
index ceaf9ac..0c39625 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -133,7 +133,6 @@
 davinci_sonata               arm         arm926ejs   sonata              davinci        davinci
 ea20			     arm	 arm926ejs   ea20		 davinci	davinci
 hawkboard                    arm         arm926ejs   da8xxevm            davinci        davinci
-hawkboard_nand               arm         arm926ejs   da8xxevm            davinci        davinci     hawkboard:NAND_U_BOOT
 hawkboard_uart               arm         arm926ejs   da8xxevm            davinci        davinci     hawkboard:UART_U_BOOT
 enbw_cmc                     arm         arm926ejs   enbw_cmc            enbw           davinci
 dns325                       arm         arm926ejs   -                   d-link         kirkwood
diff --git a/doc/README.hawkboard b/doc/README.hawkboard
index b7afec4..d6ae02e 100644
--- a/doc/README.hawkboard
+++ b/doc/README.hawkboard
@@ -9,8 +9,8 @@
 internal ROM of the omap. The RBL initialises the memory and the nand
 controller, and copies the image stored at a predefined location(block
 1) of the nand flash. The image loaded by the RBL to the memory is the
-AIS signed nand_spl image. This, in turns copies the u-boot binary
-from the nand flash to the memory and jumps to the u-boot entry point.
+AIS signed spl image. This, in turns copies the u-boot binary from the
+nand flash to the memory and jumps to the u-boot entry point.
 
 AIS is an image format defined by TI for the images that are to be
 loaded to memory by the RBL. The image is divided into a series of
@@ -20,14 +20,14 @@
 image. At the end of the image the RBL jumps to the image entry
 point.
 
-The secondary stage bootloader(nand_spl) which is loaded by the RBL
-then loads the u-boot from a predefined location in the nand to the
-memory and jumps to the u-boot entry point.
+The secondary stage bootloader(spl) which is loaded by the RBL then
+loads the u-boot from a predefined location in the nand to the memory
+and jumps to the u-boot entry point.
 
 The reason a secondary stage bootloader is used is because the ECC
 layout expected by the RBL is not the same as that used by
-u-boot/linux. This also implies that for flashing the nand_spl image,
-we need to use the u-boot which uses the ECC layout expected by the
+u-boot/linux. This also implies that for flashing the spl image,we
+need to use the u-boot which uses the ECC layout expected by the
 RBL[1]. Booting u-boot over UART(UART boot) is explained here[2].
 
 
@@ -35,20 +35,19 @@
 ===========
 Three images might be needed
 
-* nand_spl - This is the secondary bootloader which boots the u-boot
+* spl - This is the secondary bootloader which boots the u-boot
   binary.
 
-  hawkboard_nand_config
-
-  The nand_spl ELF gets generated under nand_spl/u-boot-spl. This
-  needs to be processed with the AISGen tool for generating the AIS
-  signed image to be flashed. Steps for generating the AIS image are
-  explained here[3].
-
 * u-boot binary - This is the image flashed to the nand and copied to
-  the memory by the nand_spl.
+  the memory by the spl.
 
-  hawkboard_config
+  Both the images get compiled with hawkboard_config, with the TOPDIR
+  containing the u-boot images, and the spl image under the spl
+  directory.
+
+  The spl image needs to be processed with the AISGen tool for
+  generating the AIS signed image to be flashed. Steps for generating
+  the AIS image are explained here[3].
 
 * u-boot for uart boot - This is same as the u-boot binary generated
   above, with the sole difference of the CONFIG_SYS_TEXT_BASE being
@@ -59,17 +58,17 @@
 
 Flashing the images to Nand
 ===========================
-The nand_spl AIS image needs to be flashed to the block 1 of the
-Nand flash, as that is the location the RBL expects the image[4]. For
-flashing the nand_spl, boot over the u-boot specified in [1], and
-flash the image
+The spl AIS image needs to be flashed to the block 1 of the Nand
+flash, as that is the location the RBL expects the image[4]. For
+flashing the spl, boot over the u-boot specified in [1], and flash the
+image
 
 => tftpboot 0xc0700000 <nand_spl_ais.bin>
 => nand erase 0x20000 0x20000
 => nand write.e 0xc0700000 0x20000 <nand_spl_size>
 
 The u-boot binary is flashed at location 0xe0000(block 6) of the nand
-flash. The nand_spl loader expects the u-boot at this location. For
+flash. The spl loader expects the u-boot at this location. For
 flashing the u-boot binary
 
 => tftpboot 0xc0700000 u-boot.bin
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index 8e0293d..989472b 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -44,6 +44,8 @@
 #define CONFIG_SYS_HZ_CLOCK		clk_get(DAVINCI_AUXCLK_CLKID)
 #define CONFIG_SYS_HZ			1000
 #define CONFIG_SYS_TEXT_BASE		0xc1080000
+#define CONFIG_SYS_DA850_PLL_INIT
+#define CONFIG_SYS_DA850_DDR_INIT
 
 /*
  * Memory Info
@@ -142,7 +144,6 @@
 #define CONFIG_CONS_INDEX	1		/* use UART0 for console */
 #define CONFIG_BAUDRATE		115200		/* Default baud rate */
 #define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200 }
-#define CONFIG_SYS_DA850_LPSC_UART DAVINCI_LPSC_UART2
 
 #define CONFIG_SPI
 #define CONFIG_SPI_FLASH
@@ -322,7 +323,7 @@
 #define CONFIG_SPL_SERIAL_SUPPORT
 #define CONFIG_SPL_LIBCOMMON_SUPPORT
 #define CONFIG_SPL_LIBGENERIC_SUPPORT
-#define CONFIG_SPL_LDSCRIPT	"$(BOARDDIR)/u-boot-spl.lds"
+#define CONFIG_SPL_LDSCRIPT	"board/$(BOARDDIR)/u-boot-spl-da850evm.lds"
 #define CONFIG_SPL_STACK	0x8001ff00
 #define CONFIG_SPL_TEXT_BASE	0x80000000
 #define CONFIG_SPL_MAX_SIZE	32768
diff --git a/include/configs/enbw_cmc.h b/include/configs/enbw_cmc.h
index 053cfa4..29b0d33 100644
--- a/include/configs/enbw_cmc.h
+++ b/include/configs/enbw_cmc.h
@@ -48,6 +48,8 @@
 #define CONFIG_SYS_HZ			1000
 #define CONFIG_DA850_LOWLEVEL
 #define CONFIG_ARCH_CPU_INIT
+#define CONFIG_SYS_DA850_PLL_INIT
+#define CONFIG_SYS_DA850_DDR_INIT
 #define CONFIG_DA8XX_GPIO
 #define CONFIG_HOSTNAME		enbw_cmc
 
@@ -82,7 +84,7 @@
 #define CONFIG_CONS_INDEX	1		/* use UART0 for console */
 #define CONFIG_BAUDRATE		115200		/* Default baud rate */
 #define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200 }
-#define CONFIG_SYS_DA850_LPSC_UART	DAVINCI_LPSC_UART2
+
 /*
  * I2C Configuration
  */
diff --git a/include/configs/hawkboard.h b/include/configs/hawkboard.h
index c310c73..50a1c17 100644
--- a/include/configs/hawkboard.h
+++ b/include/configs/hawkboard.h
@@ -44,12 +44,29 @@
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #define CONFIG_BOARD_EARLY_INIT_F
 
-#if defined(CONFIG_NAND_U_BOOT) || defined(CONFIG_UART_U_BOOT)
+#define CONFIG_SYS_DA850_SYSCFG_SUSPSRC (	\
+	DAVINCI_SYSCFG_SUSPSRC_EMAC |		\
+	DAVINCI_SYSCFG_SUSPSRC_I2C  |		\
+	DAVINCI_SYSCFG_SUSPSRC_SPI1 |		\
+	DAVINCI_SYSCFG_SUSPSRC_TIMER0 |		\
+	DAVINCI_SYSCFG_SUSPSRC_UART2)
+
+#if defined(CONFIG_UART_U_BOOT)
 #define CONFIG_SYS_TEXT_BASE		0xc1080000
-#else
+#elif !defined(CONFIG_SPL_BUILD)
 #define CONFIG_SYS_TEXT_BASE		0xc1180000
 #endif
 
+/* Spl */
+#define CONFIG_SPL
+#define CONFIG_SPL_NAND_SUPPORT
+#define CONFIG_SPL_NAND_SIMPLE
+#define CONFIG_SPL_NAND_LOAD
+#define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_LDSCRIPT		"board/$(BOARDDIR)/u-boot-spl-hawk.lds"
+#define CONFIG_SPL_TEXT_BASE		0xc1080000
+#define CONFIG_SPL_STACK		CONFIG_SYS_INIT_SP_ADDR
+
 /*
  * Memory Info
  */
@@ -85,9 +102,7 @@
 /*
  * Network & Ethernet Configuration
  */
-#if !defined(CONFIG_NAND_SPL)
 #define CONFIG_DRIVER_TI_EMAC
-#endif
 #define CONFIG_MII
 #define CONFIG_BOOTP_DEFAULT
 #define CONFIG_BOOTP_DNS
diff --git a/nand_spl/board/davinci/da8xxevm/Makefile b/nand_spl/board/davinci/da8xxevm/Makefile
deleted file mode 100644
index 7746e41..0000000
--- a/nand_spl/board/davinci/da8xxevm/Makefile
+++ /dev/null
@@ -1,155 +0,0 @@
-#
-# (C) Copyright 2006-2007
-# Stefan Roese, DENX Software Engineering, sr@denx.de.
-#
-# (C) Copyright 2008
-# Guennadi Liakhovetki, DENX Software Engineering, <lg@denx.de>
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-CONFIG_NAND_SPL	= y
-
-include $(TOPDIR)/config.mk
-
-nandobj	:= $(OBJTREE)/nand_spl/
-
-LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
-LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
-	   $(LDFLAGS_FINAL)
-AFLAGS	+= -DCONFIG_SPL_BUILD -DCONFIG_NAND_SPL
-CFLAGS	+= -DCONFIG_SPL_BUILD -DCONFIG_NAND_SPL
-
-SOBJS	= _divsi3.o \
-	_udivsi3.o \
-	start.o
-
-COBJS	= cpu.o \
-	davinci_nand.o \
-	pinmux.o \
-	da850_pinmux.o \
-	div0.o \
-	hawkboard_nand_spl.o \
-	misc.o \
-	nand_boot.o \
-	ns16550.o \
-	psc.o
-
-SRCS	:= $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
-OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
-__OBJS	:= $(SOBJS) $(COBJS)
-LNDIR	:= $(nandobj)board/$(BOARDDIR)
-
-ALL	= $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin \
-	$(nandobj)u-boot-spl-16k.bin
-
-all:	$(ALL)
-
-$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
-	$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@
-
-$(nandobj)u-boot-spl.bin:	$(nandobj)u-boot-spl
-	$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
-
-$(nandobj)u-boot-spl:	$(OBJS) $(nandobj)u-boot.lds
-	cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) \
-		-Map $(nandobj)u-boot-spl.map \
-		-o $(nandobj)u-boot-spl
-
-$(nandobj)u-boot.lds: $(LDSCRIPT)
-	$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
-
-# create symbolic links for common files
-
-# from board directory
-$(obj)pinmux.c:
-	@rm -f $@
-	@ln -s $(TOPDIR)/arch/arm/cpu/arm926ejs/davinci/pinmux.c $@
-
-$(obj)da850_pinmux.c:
-	@rm -f $@
-	@ln -s $(TOPDIR)/arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c $@
-
-# from drivers/mtd/nand directory
-$(obj)davinci_nand.c:
-	@rm -f $@
-	@ln -s $(TOPDIR)/drivers/mtd/nand/davinci_nand.c $@
-
-# from nand_spl directory
-$(obj)nand_boot.c:
-	@rm -f $@
-	@ln -s $(TOPDIR)/nand_spl/nand_boot.c $@
-
-# from drivers/serial directory
-$(obj)ns16550.c:
-	@rm -f $@
-	@ln -sf $(TOPDIR)/drivers/serial/ns16550.c $@
-
-# from cpu directory
-$(obj)start.S:
-	@rm -f $@
-	ln -s $(TOPDIR)/arch/arm/cpu/arm926ejs/start.S $@
-
-# from lib directory
-$(obj)_udivsi3.S:
-	@rm -f $@
-	ln -s $(TOPDIR)/arch/arm/lib/_udivsi3.S $@
-
-# from lib directory
-$(obj)_divsi3.S:
-	@rm -f $@
-	ln -s $(TOPDIR)/arch/arm/lib/_divsi3.S $@
-
-# from lib directory
-$(obj)div0.c:
-	@rm -f $@
-	ln -s $(TOPDIR)/arch/arm/lib/div0.c $@
-
-# from SoC directory
-$(obj)cpu.c:
-	@rm -f $@
-	@ln -s $(TOPDIR)/arch/arm/cpu/arm926ejs/davinci/cpu.c $@
-
-$(obj)misc.c:
-	@rm -f $@
-	ln -s $(TOPDIR)/arch/arm/cpu/arm926ejs/davinci/misc.c $@
-
-# from board directory
-$(obj)hawkboard_nand_spl.c:
-	@rm -f $@
-	ln -s $(TOPDIR)/board/davinci/da8xxevm/hawkboard_nand_spl.c $@
-
-$(obj)psc.c:
-	@rm -f $@
-	ln -s $(TOPDIR)/arch/arm/cpu/arm926ejs/davinci/psc.c $@
-
-#########################################################################
-
-$(obj)%.o:	$(obj)%.S
-	$(CC) $(AFLAGS) -c -o $@ $<
-
-$(obj)%.o:	$(obj)%.c
-	$(CC) $(CFLAGS) -c -o $@ $<
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################