All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH V3 1/3] MMC: u-boot-spl may be compiled without partition support
@ 2012-07-09 18:53 Mikhail Kshevetskiy
  2012-07-09 18:53 ` [U-Boot] [PATCH V3 2/3] arm/davinci: spl - boot device selection Mikhail Kshevetskiy
  2012-07-09 18:53 ` [U-Boot] [PATCH V3 3/3] arm/davinci: spl - add compressed u-boot image support Mikhail Kshevetskiy
  0 siblings, 2 replies; 19+ messages in thread
From: Mikhail Kshevetskiy @ 2012-07-09 18:53 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@gmail.com>
---
Change for v3:
 * split MMC+SPL+no partition table support bugfix to separate patch
   series (series 3/3)
Change for v2:
 * fix checkpatch warnings
---
 drivers/mmc/mmc.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index aebe578..69df64a 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1253,7 +1253,9 @@ int mmc_startup(struct mmc *mmc)
 			(mmc->cid[1] >> 8) & 0xff, mmc->cid[1] & 0xff);
 	sprintf(mmc->block_dev.revision, "%d.%d", mmc->cid[2] >> 28,
 			(mmc->cid[2] >> 24) & 0xf);
+#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBDISK_SUPPORT)
 	init_part(&mmc->block_dev);
+#endif
 
 	return 0;
 }
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH V3 2/3] arm/davinci: spl - boot device selection
  2012-07-09 18:53 [U-Boot] [PATCH V3 1/3] MMC: u-boot-spl may be compiled without partition support Mikhail Kshevetskiy
@ 2012-07-09 18:53 ` Mikhail Kshevetskiy
  2012-07-09 19:41   ` Tom Rini
  2012-07-10 18:39   ` Sughosh Ganu
  2012-07-09 18:53 ` [U-Boot] [PATCH V3 3/3] arm/davinci: spl - add compressed u-boot image support Mikhail Kshevetskiy
  1 sibling, 2 replies; 19+ messages in thread
From: Mikhail Kshevetskiy @ 2012-07-09 18:53 UTC (permalink / raw)
  To: u-boot

This patch allow us to have a universal spl that detects a boot
device and select a corresponding boot algorithm for main u-boot part
(SOC_DA8XX only)

This patch create copy copy of drivers/mtd/nand/nand_spl_load.c and
drivers/mtd/spi/spi_spl_load.c for the following reasons:
 * avoid jump to main u-boot code just after its loading (required
   for the next patch: spl - add compressed u-boot image support)
 * makes a structure similar to omap3 sources

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@gmail.com>
---
Change for v3:
 * split MMC+SPL+no partition table support bugfix to separate patch
   series (series 3/3)
Change for v2:
 * fix checkpatch warnings
 * defines for constants
 * use readl() to read a BOOTCFG_REG
 * improve patch description
---
 arch/arm/cpu/arm926ejs/davinci/Makefile          |    5 ++
 arch/arm/cpu/arm926ejs/davinci/spl.c             |   91 +++++++++++++++++++---
 arch/arm/cpu/arm926ejs/davinci/spl_mmc.c         |   39 ++++++++++
 arch/arm/cpu/arm926ejs/davinci/spl_nand.c        |   11 +++
 arch/arm/cpu/arm926ejs/davinci/spl_spi_flash.c   |   25 ++++++
 arch/arm/cpu/arm926ejs/davinci/spl_ymodem.c      |   42 ++++++++++
 arch/arm/include/asm/arch-davinci/davinci_boot.h |   50 ++++++++++++
 include/configs/cam_enc_4xx.h                    |   12 +--
 include/configs/da850evm.h                       |   19 +++--
 include/configs/hawkboard.h                      |   11 +--
 10 files changed, 275 insertions(+), 30 deletions(-)
 create mode 100644 arch/arm/cpu/arm926ejs/davinci/spl_mmc.c
 create mode 100644 arch/arm/cpu/arm926ejs/davinci/spl_nand.c
 create mode 100644 arch/arm/cpu/arm926ejs/davinci/spl_spi_flash.c
 create mode 100644 arch/arm/cpu/arm926ejs/davinci/spl_ymodem.c
 create mode 100644 arch/arm/include/asm/arch-davinci/davinci_boot.h

diff --git a/arch/arm/cpu/arm926ejs/davinci/Makefile b/arch/arm/cpu/arm926ejs/davinci/Makefile
index da7efac..12bd37a 100644
--- a/arch/arm/cpu/arm926ejs/davinci/Makefile
+++ b/arch/arm/cpu/arm926ejs/davinci/Makefile
@@ -40,6 +40,11 @@ ifdef CONFIG_SPL_BUILD
 COBJS-y	+= spl.o
 COBJS-$(CONFIG_SOC_DM365)	+= dm365_lowlevel.o
 COBJS-$(CONFIG_SOC_DA8XX)	+= da850_lowlevel.o
+
+COBJS-$(CONFIG_SPL_NAND_SUPPORT)	+= spl_nand.o
+COBJS-$(CONFIG_SPL_SPI_FLASH_SUPPORT)	+= spl_spi_flash.o
+COBJS-$(CONFIG_SPL_YMODEM_SUPPORT)	+= spl_ymodem.o
+COBJS-$(CONFIG_SPL_MMC_SUPPORT)		+= spl_mmc.o
 endif
 
 SOBJS	= reset.o
diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c b/arch/arm/cpu/arm926ejs/davinci/spl.c
index 74632e5..50b4bbc 100644
--- a/arch/arm/cpu/arm926ejs/davinci/spl.c
+++ b/arch/arm/cpu/arm926ejs/davinci/spl.c
@@ -25,9 +25,11 @@
 #include <asm/utils.h>
 #include <nand.h>
 #include <asm/arch/dm365_lowlevel.h>
+#include <asm/arch/davinci_boot.h>
 #include <ns16550.h>
 #include <malloc.h>
 #include <spi_flash.h>
+#include <linux/compiler.h>
 
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
 
@@ -72,25 +74,92 @@ void board_init_f(ulong dummy)
 	relocate_code(CONFIG_SPL_STACK, NULL, CONFIG_SPL_TEXT_BASE);
 }
 
+u32 davinci_boot_device(void){
+#ifdef CONFIG_SOC_DA8XX
+	u32 bootmode = readl(BOOTCFG_REG) & BOOTCFG_REG_DEVICE_MASK;
+	switch (bootmode) {
+	case BOOTCFG_DEVICE_NAND8:
+	case BOOTCFG_DEVICE_NAND16:
+		return BOOT_DEVICE_TYPE_NAND;
+	case BOOTCFG_DEVICE_SPI0_FLASH:
+	case BOOTCFG_DEVICE_SPI1_FLASH:
+		return BOOT_DEVICE_TYPE_SPI_FLASH;
+	case BOOTCFG_DEVICE_UART0:
+	case BOOTCFG_DEVICE_UART1:
+	case BOOTCFG_DEVICE_UART2:
+		return BOOT_DEVICE_TYPE_UART;
+	case BOOTCFG_DEVICE_MMC_OR_SD0:
+		return BOOT_DEVICE_TYPE_MMC;
+	default:
+		return BOOT_DEVICE_TYPE_NONE;
+	}
+#else
+#ifdef
+#endif CONFIG_SPL_NAND_SUPPORT
+	return BOOT_DEVICE_TYPE_NAND;
+#endif
+#ifdef BOOT_DEVICE_SPI_FLASH
+	return BOOT_DEVICE_TYPE_SPI_FLASH;
+#endif
+#ifdef CONFIG_SPL_YMODEM_SUPPORT
+	return BOOT_DEVICE_TYPE_UART;
+#endif
+#ifdef CONFIG_SPL_MMC_SUPPORT
+	return BOOT_DEVICE_TYPE_MMC;
+#endif
+}
+
 void board_init_r(gd_t *id, ulong dummy)
 {
-#ifdef CONFIG_SPL_NAND_LOAD
-	nand_init();
-	puts("Nand boot...\n");
-	nand_boot();
-#endif
-#ifdef CONFIG_SPL_SPI_LOAD
-	mem_malloc_init(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN,
-			CONFIG_SYS_MALLOC_LEN);
+	u32 boot_device;
+	void (*uboot)(void) __noreturn;
+
+	mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START,
+			CONFIG_SYS_SPL_MALLOC_SIZE);
 
 	gd = &gdata;
 	gd->bd = &bdata;
 	gd->flags |= GD_FLG_RELOC;
+#ifdef CONFIG_SPL_SERIAL_SUPPORT
 	gd->baudrate = CONFIG_BAUDRATE;
-	serial_init();          /* serial communications setup */
+	serial_init();
 	gd->have_console = 1;
+#endif
 
-	puts("SPI boot...\n");
-	spi_boot();
+	boot_device = davinci_boot_device();
+	debug("boot device - %d\n", boot_device);
+	switch (boot_device) {
+#ifdef CONFIG_SPL_NAND_SUPPORT
+	case BOOT_DEVICE_TYPE_NAND:
+		puts("Booting from nand flash ...\n");
+		spl_nand_load_image();
+		break;
+#endif
+#ifdef CONFIG_SPL_SPI_FLASH_SUPPORT
+	case BOOT_DEVICE_TYPE_SPI_FLASH:
+		puts("Booting from spi flash ...\n");
+		spl_spi_flash_load_image();
+		break;
 #endif
+#ifdef CONFIG_SPL_YMODEM_SUPPORT
+	case BOOT_DEVICE_TYPE_UART:
+		puts("Booting from uart ...\n");
+		spl_ymodem_load_image();
+		break;
+#endif
+#ifdef CONFIG_SPL_MMC_SUPPORT
+	case BOOT_DEVICE_TYPE_MMC:
+		puts("Booting from mmc/sd card...\n");
+		spl_mmc_load_image();
+		break;
+#endif
+	default:
+		printf("SPL: Un-supported Boot Device - %d!!!\n", boot_device);
+		hang();
+		break;
+	}
+
+	puts("Jump to U-Boot image...\n");
+	uboot = (void *) CONFIG_SYS_TEXT_BASE;
+	(*uboot)();
 }
diff --git a/arch/arm/cpu/arm926ejs/davinci/spl_mmc.c b/arch/arm/cpu/arm926ejs/davinci/spl_mmc.c
new file mode 100644
index 0000000..1a551e9
--- /dev/null
+++ b/arch/arm/cpu/arm926ejs/davinci/spl_mmc.c
@@ -0,0 +1,39 @@
+#include <common.h>
+#include <asm/u-boot.h>
+#include <asm/utils.h>
+#include <mmc.h>
+#include <asm/arch/sdmmc_defs.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void spl_mmc_load_image(void)
+{
+	int ret;
+	struct mmc *mmc;
+
+	mmc_initialize(gd->bd);
+	/* We register only one device. So, the dev id is always 0 */
+	mmc = find_mmc_device(0);
+	if (!mmc) {
+		puts("spl: mmc device not found!!\n");
+		hang();
+	}
+
+	ret = mmc_init(mmc);
+	if (ret) {
+		printf("spl: mmc init failed: err - %d\n", ret);
+		hang();
+	}
+
+	ret = mmc->block_dev.block_read(0,
+				CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR,
+				CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS,
+				(void *) CONFIG_SYS_TEXT_BASE);
+	if (ret < 0) {
+		printf("spl: mmc blk read err - %d\n", ret);
+		hang();
+	}
+
+	debug("Loaded %d sectors from SD/MMC card\n",
+		CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS);
+}
diff --git a/arch/arm/cpu/arm926ejs/davinci/spl_nand.c b/arch/arm/cpu/arm926ejs/davinci/spl_nand.c
new file mode 100644
index 0000000..bad1e8f
--- /dev/null
+++ b/arch/arm/cpu/arm926ejs/davinci/spl_nand.c
@@ -0,0 +1,11 @@
+#include <common.h>
+#include <nand.h>
+
+void spl_nand_load_image(void)
+{
+	nand_init();
+	nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
+			CONFIG_SYS_NAND_U_BOOT_SIZE,
+			(void *) CONFIG_SYS_TEXT_BASE);
+	debug("Loaded %d bytes from NAND flash\n", CONFIG_SYS_NAND_U_BOOT_SIZE);
+}
diff --git a/arch/arm/cpu/arm926ejs/davinci/spl_spi_flash.c b/arch/arm/cpu/arm926ejs/davinci/spl_spi_flash.c
new file mode 100644
index 0000000..d6fadcd
--- /dev/null
+++ b/arch/arm/cpu/arm926ejs/davinci/spl_spi_flash.c
@@ -0,0 +1,25 @@
+#include <common.h>
+#include <spi_flash.h>
+
+void spl_spi_flash_load_image(void)
+{
+	int ret;
+	struct spi_flash *flash;
+
+	flash = spi_flash_probe(CONFIG_SPL_SPI_BUS, CONFIG_SPL_SPI_CS,
+				CONFIG_SF_DEFAULT_SPEED, SPI_MODE_3);
+	if (!flash) {
+		puts("spl: spi flash probe failed.\n");
+		hang();
+	}
+
+	ret = spi_flash_read(flash, CONFIG_SYS_SPI_U_BOOT_OFFS,
+				CONFIG_SYS_SPI_U_BOOT_SIZE,
+				(void *) CONFIG_SYS_TEXT_BASE);
+	if (ret < 0) {
+		printf("spl: spi flash read err - %d\n", ret);
+		hang();
+	}
+
+	debug("Loaded %d bytes from SPI flash\n", CONFIG_SYS_SPI_U_BOOT_SIZE);
+}
diff --git a/arch/arm/cpu/arm926ejs/davinci/spl_ymodem.c b/arch/arm/cpu/arm926ejs/davinci/spl_ymodem.c
new file mode 100644
index 0000000..b8c4db1
--- /dev/null
+++ b/arch/arm/cpu/arm926ejs/davinci/spl_ymodem.c
@@ -0,0 +1,42 @@
+#include <common.h>
+#include <xyzModem.h>
+#include <asm/u-boot.h>
+#include <asm/utils.h>
+
+#define BUF_SIZE 1024
+
+static int getcymodem(void)
+{
+	if (tstc())
+		return getc();
+	return -1;
+}
+
+void spl_ymodem_load_image(void)
+{
+	int size;
+	int err;
+	int res;
+	connection_info_t info;
+	ulong store_addr = ~0;
+
+	size = 0;
+	info.mode = xyzModem_ymodem;
+	res = xyzModem_stream_open(&info, &err);
+	if (!res) {
+		store_addr = CONFIG_SYS_TEXT_BASE;
+		while ((res = xyzModem_stream_read(
+					(char *)store_addr, 1024, &err)) > 0) {
+			store_addr += res;
+			size += res;
+		}
+	} else {
+		printf("spl: ymodem err - %s\n", xyzModem_error(err));
+		hang();
+	}
+
+	xyzModem_stream_close(&err);
+	xyzModem_stream_terminate(false, &getcymodem);
+
+	debug("Loaded %d bytes from UART\n", size);
+}
diff --git a/arch/arm/include/asm/arch-davinci/davinci_boot.h b/arch/arm/include/asm/arch-davinci/davinci_boot.h
new file mode 100644
index 0000000..57afa24
--- /dev/null
+++ b/arch/arm/include/asm/arch-davinci/davinci_boot.h
@@ -0,0 +1,50 @@
+#ifndef	_DAVINCI_BOOT_H_
+#define	_DAVINCI_BOOT_H_
+
+#include <asm/arch/hardware.h>
+
+#define BOOTCFG_REG			(DAVINCI_BOOTCFG_BASE + 0x20)
+#define BOOTCFG_REG_DEVICE_MASK		0x1F
+
+#define BOOTCFG_DEVICE_NOR		0x02
+#define BOOTCFG_DEVICE_NAND8		0x0E
+#define BOOTCFG_DEVICE_NAND16		0x10
+#define BOOTCFG_DEVICE_MMC_OR_SD0	0x1C
+#define BOOTCFG_DEVICE_I2C0_EEPROM	0x00
+#define BOOTCFG_DEVICE_I2C1_EEPROM	0x06
+#define BOOTCFG_DEVICE_I2C0_SLAVE	0x01
+#define BOOTCFG_DEVICE_I2C1_SLAVE	0x07
+#define BOOTCFG_DEVICE_SPI0_EEPROM	0x08
+#define BOOTCFG_DEVICE_SPI1_EEPROM	0x09
+#define BOOTCFG_DEVICE_SPI0_FLASH	0x0A
+#define BOOTCFG_DEVICE_SPI1_FLASH	0x0C
+#define BOOTCFG_DEVICE_SPI0_SLAVE	0x12
+#define BOOTCFG_DEVICE_SPI1_SLAVE	0x13
+#define BOOTCFG_DEVICE_UART0		0x16
+#define BOOTCFG_DEVICE_UART1		0x17
+#define BOOTCFG_DEVICE_UART2		0x14
+#define BOOTCFG_DEVICE_HPI		0x04
+#define BOOTCFG_DEVICE_EMULATION_DEBUG	0x1E
+
+/* Boot device */
+#define BOOT_DEVICE_TYPE_NONE		0
+#define BOOT_DEVICE_TYPE_NAND		1
+#define BOOT_DEVICE_TYPE_SPI_FLASH	2
+#define BOOT_DEVICE_TYPE_UART		3
+#define BOOT_DEVICE_TYPE_MMC		4
+
+u32 davinci_boot_device(void);
+
+/* NAND SPL functions */
+void spl_nand_load_image(void);
+
+/* SPI FLASH SPL functions */
+void spl_spi_flash_load_image(void);
+
+/* YMODEM SPL functions */
+void spl_ymodem_load_image(void);
+
+/* MMC SPL functions */
+void spl_mmc_load_image(void);
+
+#endif /* _DAVINCI_BOOT_H_ */
diff --git a/include/configs/cam_enc_4xx.h b/include/configs/cam_enc_4xx.h
index 771ac9c..590f3f8 100644
--- a/include/configs/cam_enc_4xx.h
+++ b/include/configs/cam_enc_4xx.h
@@ -217,18 +217,18 @@
 
 /* Defines for SPL */
 #define CONFIG_SPL
+#define CONFIG_SPL_LDSCRIPT		"$(BOARDDIR)/u-boot-spl.lds"
+#define CONFIG_SPL_STACK		(0x00010000 + 0x7f00)
+#define CONFIG_SPL_TEXT_BASE		0x00000020 /*CONFIG_SYS_SRAM_START*/
+#define CONFIG_SYS_SPL_MALLOC_START	(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN)
+#define CONFIG_SYS_SPL_MALLOC_SIZE	CONFIG_SYS_MALLOC_LEN
+#define CONFIG_SPL_MAX_SIZE		12320
 #define CONFIG_SPL_LIBGENERIC_SUPPORT
 #define CONFIG_SPL_NAND_SUPPORT
 #define CONFIG_SPL_NAND_SIMPLE
-#define CONFIG_SPL_NAND_LOAD
 #define CONFIG_SYS_NAND_HW_ECC_OOBFIRST
 #define CONFIG_SPL_SERIAL_SUPPORT
 #define CONFIG_SPL_POST_MEM_SUPPORT
-#define CONFIG_SPL_LDSCRIPT		"$(BOARDDIR)/u-boot-spl.lds"
-#define CONFIG_SPL_STACK		(0x00010000 + 0x7f00)
-
-#define CONFIG_SPL_TEXT_BASE		0x00000020 /*CONFIG_SYS_SRAM_START*/
-#define CONFIG_SPL_MAX_SIZE		12320
 
 #ifndef CONFIG_SPL_BUILD
 #define CONFIG_SYS_TEXT_BASE		0x81080000
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index e6adb1f..7a3ec4c 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -313,20 +313,23 @@
 
 /* defines for SPL */
 #define CONFIG_SPL
+#define CONFIG_SPL_LDSCRIPT		"board/$(BOARDDIR)/u-boot-spl-da850evm.lds"
+#define CONFIG_SPL_STACK		0x8001ff00
+#define CONFIG_SPL_TEXT_BASE		0x80000000
+#define CONFIG_SYS_SPL_MALLOC_START	(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN)
+#define CONFIG_SYS_SPL_MALLOC_SIZE	CONFIG_SYS_MALLOC_LEN
+#define CONFIG_SPL_MAX_SIZE		32768
+#define CONFIG_SPL_LIBCOMMON_SUPPORT
+#define CONFIG_SPL_LIBGENERIC_SUPPORT
 #define CONFIG_SPL_SPI_SUPPORT
 #define CONFIG_SPL_SPI_FLASH_SUPPORT
-#define CONFIG_SPL_SPI_LOAD
 #define CONFIG_SPL_SPI_BUS 0
 #define CONFIG_SPL_SPI_CS 0
-#define CONFIG_SPL_SERIAL_SUPPORT
-#define CONFIG_SPL_LIBCOMMON_SUPPORT
-#define CONFIG_SPL_LIBGENERIC_SUPPORT
-#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
 #define CONFIG_SYS_SPI_U_BOOT_OFFS	0x8000
 #define CONFIG_SYS_SPI_U_BOOT_SIZE	0x30000
+#define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_YMODEM_SUPPORT
+
 
 /* additions for new relocation code, must added to all boards */
 #define CONFIG_SYS_SDRAM_BASE		0xc0000000
diff --git a/include/configs/hawkboard.h b/include/configs/hawkboard.h
index c6e8859..133fdfb 100644
--- a/include/configs/hawkboard.h
+++ b/include/configs/hawkboard.h
@@ -59,14 +59,15 @@
 
 /* Spl */
 #define CONFIG_SPL
-#define CONFIG_SPL_NAND_SUPPORT
-#define CONFIG_SPL_NAND_SIMPLE
-#define CONFIG_SPL_NAND_LOAD
-#define CONFIG_SPL_LIBGENERIC_SUPPORT	/* for udelay and __div64_32 for NAND */
-#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
+#define CONFIG_SYS_SPL_MALLOC_START	(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN)
+#define CONFIG_SYS_SPL_MALLOC_SIZE	CONFIG_SYS_MALLOC_LEN
+#define CONFIG_SPL_LIBGENERIC_SUPPORT	/* for udelay and __div64_32 for NAND */
+#define CONFIG_SPL_NAND_SUPPORT
+#define CONFIG_SPL_NAND_SIMPLE
+#define CONFIG_SPL_SERIAL_SUPPORT
 
 /*
  * Memory Info
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH V3 3/3] arm/davinci: spl - add compressed u-boot image support
  2012-07-09 18:53 [U-Boot] [PATCH V3 1/3] MMC: u-boot-spl may be compiled without partition support Mikhail Kshevetskiy
  2012-07-09 18:53 ` [U-Boot] [PATCH V3 2/3] arm/davinci: spl - boot device selection Mikhail Kshevetskiy
@ 2012-07-09 18:53 ` Mikhail Kshevetskiy
  2012-07-10 18:49   ` Sughosh Ganu
  1 sibling, 1 reply; 19+ messages in thread
From: Mikhail Kshevetskiy @ 2012-07-09 18:53 UTC (permalink / raw)
  To: u-boot

Motivation:
 * we have a board with 128 Kb spi flash, so normal u-boot.ais does not
   fit on it.

This patch add support of compressed 2-nd u-boot stage. To create a compressed
ais image its required:
 * define CONFIG_SPL_GUNZIP_SUPPORT --- enable compressed ais image supports
 * define CONFIG_SPL_GUNZIP_MAX_SIZE --- define a maximum size of compressed
   u-boot part
 * define CONFIG_SPL_GUNZIP_LOAD_ADDR --- memory address to load compressed
   u-boot part (CONFIG_SPL_GUNZIP_LOAD_ADDR region should not overlap with
   CONFIG_SYS_TEXT_BASE region)
 * use: make u-boot-gzip.ais to get a compressed ais image

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@gmail.com>
---
Change for v3:
 * split MMC+SPL+no partition table support bugfix to separate patch
   series (series 3/3)
Change for v2:
 * fix checkpatch warnings
 * fix merge conflict with upstream u-boot sources
 * improve patch description
---
 Makefile                                       |   14 ++++++++++++++
 arch/arm/cpu/arm926ejs/davinci/spl.c           |    7 +++++++
 arch/arm/cpu/arm926ejs/davinci/spl_mmc.c       |    7 ++++++-
 arch/arm/cpu/arm926ejs/davinci/spl_nand.c      |    7 ++++++-
 arch/arm/cpu/arm926ejs/davinci/spl_spi_flash.c |    7 ++++++-
 arch/arm/cpu/arm926ejs/davinci/spl_ymodem.c    |    4 ++++
 lib/Makefile                                   |    1 +
 spl/Makefile                                   |    1 +
 8 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 85e36ec..cf16824 100644
--- a/Makefile
+++ b/Makefile
@@ -452,6 +452,20 @@ $(obj)u-boot.ais:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
 			$(obj)u-boot.ais
 		rm $(obj)spl/u-boot-spl{,-pad}.ais
 
+$(obj)u-boot-gzip.ais:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
+		$(obj)tools/mkimage -s -n /dev/null -T aisimage \
+			-e $(CONFIG_SPL_TEXT_BASE) \
+			-d $(obj)spl/u-boot-spl.bin \
+			$(obj)spl/u-boot-spl.ais
+		$(OBJCOPY) ${OBJCFLAGS} -I binary \
+			--pad-to=$(CONFIG_SPL_MAX_SIZE) -O binary \
+			$(obj)spl/u-boot-spl.ais $(obj)spl/u-boot-spl-pad.ais
+		cp $(obj)u-boot.bin $(obj)spl/u-boot.bin
+		gzip $(obj)spl/u-boot.bin
+		cat $(obj)spl/u-boot-spl-pad.ais $(obj)spl/u-boot.bin.gz > \
+			$(obj)u-boot-gzip.ais
+		rm $(obj)spl/u-boot-spl{,-pad}.ais $(obj)spl/u-boot.bin.gz
+
 $(obj)u-boot.sb:       $(obj)u-boot.bin $(obj)spl/u-boot-spl.bin
 		elftosb -zdf imx28 -c $(TOPDIR)/board/$(BOARDDIR)/u-boot.bd \
 			-o $(obj)u-boot.sb
diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c b/arch/arm/cpu/arm926ejs/davinci/spl.c
index 50b4bbc..041df5b 100644
--- a/arch/arm/cpu/arm926ejs/davinci/spl.c
+++ b/arch/arm/cpu/arm926ejs/davinci/spl.c
@@ -111,6 +111,7 @@ u32 davinci_boot_device(void){
 
 void board_init_r(gd_t *id, ulong dummy)
 {
+	int size;
 	u32 boot_device;
 	void (*uboot)(void) __noreturn;
 
@@ -159,6 +160,12 @@ void board_init_r(gd_t *id, ulong dummy)
 		break;
 	}
 
+#ifdef CONFIG_SPL_GUNZIP_SUPPORT
+	size = CONFIG_SPL_GUNZIP_MAX_SIZE;
+	gunzip((void *)CONFIG_SYS_TEXT_BASE, 512 * 1024,
+		(void *)CONFIG_SPL_GUNZIP_LOAD_ADDR, &size);
+#endif
+
 	puts("Jump to U-Boot image...\n");
 	uboot = (void *) CONFIG_SYS_TEXT_BASE;
 	(*uboot)();
diff --git a/arch/arm/cpu/arm926ejs/davinci/spl_mmc.c b/arch/arm/cpu/arm926ejs/davinci/spl_mmc.c
index 1a551e9..fa67f1a 100644
--- a/arch/arm/cpu/arm926ejs/davinci/spl_mmc.c
+++ b/arch/arm/cpu/arm926ejs/davinci/spl_mmc.c
@@ -28,7 +28,12 @@ void spl_mmc_load_image(void)
 	ret = mmc->block_dev.block_read(0,
 				CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR,
 				CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS,
-				(void *) CONFIG_SYS_TEXT_BASE);
+#ifndef CONFIG_SPL_GUNZIP_SUPPORT
+				(void *) CONFIG_SYS_TEXT_BASE
+#else
+				(void *) CONFIG_SPL_GUNZIP_LOAD_ADDR
+#endif
+				);
 	if (ret < 0) {
 		printf("spl: mmc blk read err - %d\n", ret);
 		hang();
diff --git a/arch/arm/cpu/arm926ejs/davinci/spl_nand.c b/arch/arm/cpu/arm926ejs/davinci/spl_nand.c
index bad1e8f..4bf3e6a 100644
--- a/arch/arm/cpu/arm926ejs/davinci/spl_nand.c
+++ b/arch/arm/cpu/arm926ejs/davinci/spl_nand.c
@@ -6,6 +6,11 @@ void spl_nand_load_image(void)
 	nand_init();
 	nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
 			CONFIG_SYS_NAND_U_BOOT_SIZE,
-			(void *) CONFIG_SYS_TEXT_BASE);
+#ifndef CONFIG_SPL_GUNZIP_SUPPORT
+			(void *) CONFIG_SYS_TEXT_BASE
+#else
+			(void *) CONFIG_SPL_GUNZIP_LOAD_ADDR
+#endif
+			);
 	debug("Loaded %d bytes from NAND flash\n", CONFIG_SYS_NAND_U_BOOT_SIZE);
 }
diff --git a/arch/arm/cpu/arm926ejs/davinci/spl_spi_flash.c b/arch/arm/cpu/arm926ejs/davinci/spl_spi_flash.c
index d6fadcd..76d4d51 100644
--- a/arch/arm/cpu/arm926ejs/davinci/spl_spi_flash.c
+++ b/arch/arm/cpu/arm926ejs/davinci/spl_spi_flash.c
@@ -15,7 +15,12 @@ void spl_spi_flash_load_image(void)
 
 	ret = spi_flash_read(flash, CONFIG_SYS_SPI_U_BOOT_OFFS,
 				CONFIG_SYS_SPI_U_BOOT_SIZE,
-				(void *) CONFIG_SYS_TEXT_BASE);
+#ifndef CONFIG_SPL_GUNZIP_SUPPORT
+				(void *) CONFIG_SYS_TEXT_BASE
+#else
+				(void *) CONFIG_SPL_GUNZIP_LOAD_ADDR
+#endif
+				);
 	if (ret < 0) {
 		printf("spl: spi flash read err - %d\n", ret);
 		hang();
diff --git a/arch/arm/cpu/arm926ejs/davinci/spl_ymodem.c b/arch/arm/cpu/arm926ejs/davinci/spl_ymodem.c
index b8c4db1..857436f 100644
--- a/arch/arm/cpu/arm926ejs/davinci/spl_ymodem.c
+++ b/arch/arm/cpu/arm926ejs/davinci/spl_ymodem.c
@@ -24,7 +24,11 @@ void spl_ymodem_load_image(void)
 	info.mode = xyzModem_ymodem;
 	res = xyzModem_stream_open(&info, &err);
 	if (!res) {
+#ifndef CONFIG_SPL_GUNZIP_SUPPORT
 		store_addr = CONFIG_SYS_TEXT_BASE;
+#else
+		store_addr = CONFIG_SPL_GUNZIP_LOAD_ADDR;
+#endif
 		while ((res = xyzModem_stream_read(
 					(char *)store_addr, 1024, &err)) > 0) {
 			store_addr += res;
diff --git a/lib/Makefile b/lib/Makefile
index c60c380..5a259ed 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -58,6 +58,7 @@ endif
 
 ifdef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_SPL_YMODEM_SUPPORT) += crc16.o
+COBJS-$(CONFIG_SPL_GUNZIP_SUPPORT) += gunzip.o
 endif
 COBJS-y += crc32.o
 COBJS-y += ctype.o
diff --git a/spl/Makefile b/spl/Makefile
index ea7d475..d11d8b2 100644
--- a/spl/Makefile
+++ b/spl/Makefile
@@ -52,6 +52,7 @@ LIBS-$(CONFIG_SPL_SPI_FLASH_SUPPORT) += drivers/mtd/spi/libspi_flash.o
 LIBS-$(CONFIG_SPL_SPI_SUPPORT) += drivers/spi/libspi.o
 LIBS-$(CONFIG_SPL_FAT_SUPPORT) += fs/fat/libfat.o
 LIBS-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/libgeneric.o
+LIBS-$(CONFIG_SPL_GUNZIP_SUPPORT) += lib/zlib/libz.o
 LIBS-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/libpower.o
 LIBS-$(CONFIG_SPL_NAND_SUPPORT) += drivers/mtd/nand/libnand.o
 LIBS-$(CONFIG_SPL_ONENAND_SUPPORT) += drivers/mtd/onenand/libonenand.o
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH V3 2/3] arm/davinci: spl - boot device selection
  2012-07-09 18:53 ` [U-Boot] [PATCH V3 2/3] arm/davinci: spl - boot device selection Mikhail Kshevetskiy
@ 2012-07-09 19:41   ` Tom Rini
  2012-07-09 19:57     ` Mikhail Kshevetskiy
  2012-07-10 18:39   ` Sughosh Ganu
  1 sibling, 1 reply; 19+ messages in thread
From: Tom Rini @ 2012-07-09 19:41 UTC (permalink / raw)
  To: u-boot

On 07/09/2012 11:53 AM, Mikhail Kshevetskiy wrote:
> This patch allow us to have a universal spl that detects a boot
> device and select a corresponding boot algorithm for main u-boot part
> (SOC_DA8XX only)
> 
> This patch create copy copy of drivers/mtd/nand/nand_spl_load.c and
> drivers/mtd/spi/spi_spl_load.c for the following reasons:
>  * avoid jump to main u-boot code just after its loading (required
>    for the next patch: spl - add compressed u-boot image support)
>  * makes a structure similar to omap3 sources
> 
> Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@gmail.com>

I guess I wasn't clear enough when I asked the series to be split.  I
want to see this portion turned into:
a) Move omap-common spl bits to arch/arm/lib/
b) davinci converted (and as needed, omap3/4/am33xx converted) to be
able to use the same code.

We shouldn't introduce a new spl_mmc.c for example, we should modify the
davinci structure to be able to re-use the same spl_mmc.c code to
load/verify and let the next step, as needed happen.  I want to see
"omap" be able to re-use SPI (since am33xx can do it too, and I've
kludged the davinci stuff before) and potentially be able to re-use for
example the gunzip support.  This I think is the easy set of steps to
being able to reuse this fairly common SPL logic outside of not just TI
parts but anyone else that wants it.

-- 
Tom

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH V3 2/3] arm/davinci: spl - boot device selection
  2012-07-09 19:41   ` Tom Rini
@ 2012-07-09 19:57     ` Mikhail Kshevetskiy
  2012-07-09 20:08       ` Tom Rini
  0 siblings, 1 reply; 19+ messages in thread
From: Mikhail Kshevetskiy @ 2012-07-09 19:57 UTC (permalink / raw)
  To: u-boot

On Mon, 9 Jul 2012 12:41:06 -0700
Tom Rini <trini@ti.com> wrote:

> On 07/09/2012 11:53 AM, Mikhail Kshevetskiy wrote:
> > This patch allow us to have a universal spl that detects a boot
> > device and select a corresponding boot algorithm for main u-boot part
> > (SOC_DA8XX only)
> > 
> > This patch create copy copy of drivers/mtd/nand/nand_spl_load.c and
> > drivers/mtd/spi/spi_spl_load.c for the following reasons:
> >  * avoid jump to main u-boot code just after its loading (required
> >    for the next patch: spl - add compressed u-boot image support)
> >  * makes a structure similar to omap3 sources
> > 
> > Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@gmail.com>
> 
> I guess I wasn't clear enough when I asked the series to be split.  I
> want to see this portion turned into:
> a) Move omap-common spl bits to arch/arm/lib/
> b) davinci converted (and as needed, omap3/4/am33xx converted) to be
> able to use the same code.
> 
> We shouldn't introduce a new spl_mmc.c for example, we should modify the
> davinci structure to be able to re-use the same spl_mmc.c code to
> load/verify and let the next step, as needed happen.  I want to see
> "omap" be able to re-use SPI (since am33xx can do it too, and I've
> kludged the davinci stuff before) and potentially be able to re-use for
> example the gunzip support.  This I think is the easy set of steps to
> being able to reuse this fairly common SPL logic outside of not just TI
> parts but anyone else that wants it.

Ok, I'll take this task. Unfortunately I have no too much free time for this
job (summer, parents visit, new job and so on), so it may take a month or so.

What about other patches?

Mikhail

> 
> -- 
> Tom
> 
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH V3 2/3] arm/davinci: spl - boot device selection
  2012-07-09 19:57     ` Mikhail Kshevetskiy
@ 2012-07-09 20:08       ` Tom Rini
  2012-07-09 20:10         ` Mikhail Kshevetskiy
  0 siblings, 1 reply; 19+ messages in thread
From: Tom Rini @ 2012-07-09 20:08 UTC (permalink / raw)
  To: u-boot

On 07/09/2012 12:57 PM, Mikhail Kshevetskiy wrote:
> On Mon, 9 Jul 2012 12:41:06 -0700
> Tom Rini <trini@ti.com> wrote:
> 
>> On 07/09/2012 11:53 AM, Mikhail Kshevetskiy wrote:
>>> This patch allow us to have a universal spl that detects a boot
>>> device and select a corresponding boot algorithm for main u-boot part
>>> (SOC_DA8XX only)
>>>
>>> This patch create copy copy of drivers/mtd/nand/nand_spl_load.c and
>>> drivers/mtd/spi/spi_spl_load.c for the following reasons:
>>>  * avoid jump to main u-boot code just after its loading (required
>>>    for the next patch: spl - add compressed u-boot image support)
>>>  * makes a structure similar to omap3 sources
>>>
>>> Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@gmail.com>
>>
>> I guess I wasn't clear enough when I asked the series to be split.  I
>> want to see this portion turned into:
>> a) Move omap-common spl bits to arch/arm/lib/
>> b) davinci converted (and as needed, omap3/4/am33xx converted) to be
>> able to use the same code.
>>
>> We shouldn't introduce a new spl_mmc.c for example, we should modify the
>> davinci structure to be able to re-use the same spl_mmc.c code to
>> load/verify and let the next step, as needed happen.  I want to see
>> "omap" be able to re-use SPI (since am33xx can do it too, and I've
>> kludged the davinci stuff before) and potentially be able to re-use for
>> example the gunzip support.  This I think is the easy set of steps to
>> being able to reuse this fairly common SPL logic outside of not just TI
>> parts but anyone else that wants it.
> 
> Ok, I'll take this task. Unfortunately I have no too much free time for this
> job (summer, parents visit, new job and so on), so it may take a month or so.

OK, thanks.

> What about other patches?

The ddr/uart ones should make their way in soon and I've assigned the
SPI ones to the custodian in patchwork.

-- 
Tom

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH V3 2/3] arm/davinci: spl - boot device selection
  2012-07-09 20:08       ` Tom Rini
@ 2012-07-09 20:10         ` Mikhail Kshevetskiy
  0 siblings, 0 replies; 19+ messages in thread
From: Mikhail Kshevetskiy @ 2012-07-09 20:10 UTC (permalink / raw)
  To: u-boot

On Mon, 9 Jul 2012 13:08:07 -0700
Tom Rini <trini@ti.com> wrote:

> On 07/09/2012 12:57 PM, Mikhail Kshevetskiy wrote:
> > On Mon, 9 Jul 2012 12:41:06 -0700
> > Tom Rini <trini@ti.com> wrote:
> > 
> >> On 07/09/2012 11:53 AM, Mikhail Kshevetskiy wrote:
> >>> This patch allow us to have a universal spl that detects a boot
> >>> device and select a corresponding boot algorithm for main u-boot part
> >>> (SOC_DA8XX only)
> >>>
> >>> This patch create copy copy of drivers/mtd/nand/nand_spl_load.c and
> >>> drivers/mtd/spi/spi_spl_load.c for the following reasons:
> >>>  * avoid jump to main u-boot code just after its loading (required
> >>>    for the next patch: spl - add compressed u-boot image support)
> >>>  * makes a structure similar to omap3 sources
> >>>
> >>> Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@gmail.com>
> >>
> >> I guess I wasn't clear enough when I asked the series to be split.  I
> >> want to see this portion turned into:
> >> a) Move omap-common spl bits to arch/arm/lib/
> >> b) davinci converted (and as needed, omap3/4/am33xx converted) to be
> >> able to use the same code.
> >>
> >> We shouldn't introduce a new spl_mmc.c for example, we should modify the
> >> davinci structure to be able to re-use the same spl_mmc.c code to
> >> load/verify and let the next step, as needed happen.  I want to see
> >> "omap" be able to re-use SPI (since am33xx can do it too, and I've
> >> kludged the davinci stuff before) and potentially be able to re-use for
> >> example the gunzip support.  This I think is the easy set of steps to
> >> being able to reuse this fairly common SPL logic outside of not just TI
> >> parts but anyone else that wants it.
> > 
> > Ok, I'll take this task. Unfortunately I have no too much free time for this
> > job (summer, parents visit, new job and so on), so it may take a month or
> > so.
> 
> OK, thanks.
> 
> > What about other patches?
> 
> The ddr/uart ones should make their way in soon and I've assigned the
> SPI ones to the custodian in patchwork.
> 
> -- 
> Tom

Thanks!

Mikhail

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH V3 2/3] arm/davinci: spl - boot device selection
  2012-07-09 18:53 ` [U-Boot] [PATCH V3 2/3] arm/davinci: spl - boot device selection Mikhail Kshevetskiy
  2012-07-09 19:41   ` Tom Rini
@ 2012-07-10 18:39   ` Sughosh Ganu
  2012-07-10 19:20     ` Mikhail Kshevetskiy
  1 sibling, 1 reply; 19+ messages in thread
From: Sughosh Ganu @ 2012-07-10 18:39 UTC (permalink / raw)
  To: u-boot

hi Mikhail,
On Mon Jul 09, 2012 at 10:53:39PM +0400, Mikhail Kshevetskiy wrote:
> This patch allow us to have a universal spl that detects a boot
> device and select a corresponding boot algorithm for main u-boot part
> (SOC_DA8XX only)

I have not tested this patch, will do so sometime this week. I had a
couple of questions though.

<snip>

> diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c b/arch/arm/cpu/arm926ejs/davinci/spl.c
> index 74632e5..50b4bbc 100644
> --- a/arch/arm/cpu/arm926ejs/davinci/spl.c
> +++ b/arch/arm/cpu/arm926ejs/davinci/spl.c

<snip>

>  void board_init_r(gd_t *id, ulong dummy)
>  {
> -#ifdef CONFIG_SPL_NAND_LOAD
> -	nand_init();
> -	puts("Nand boot...\n");
> -	nand_boot();
> -#endif
> -#ifdef CONFIG_SPL_SPI_LOAD
> -	mem_malloc_init(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN,
> -			CONFIG_SYS_MALLOC_LEN);
> +	u32 boot_device;
> +	void (*uboot)(void) __noreturn;
> +
> +	mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START,
> +			CONFIG_SYS_SPL_MALLOC_SIZE);

We do not need any heap for the spl on the hawkboard, so can you
please explain why do we need the heap allocation for all spl
images. Can't this be made configurable.


>  
>  	gd = &gdata;
>  	gd->bd = &bdata;
>  	gd->flags |= GD_FLG_RELOC;
> +#ifdef CONFIG_SPL_SERIAL_SUPPORT
>  	gd->baudrate = CONFIG_BAUDRATE;
> -	serial_init();          /* serial communications setup */
> +	serial_init();
>  	gd->have_console = 1;
> +#endif

This call to serial_init is not needed on the hawkboard -- we
initialise the console needed for spl through NS16550_init for all
da8xx based spl's in arch_cpu_init, which suffices for spl's debug
message requirement. I know this is being used for spi based spl
images, but now that this is being made common, just wanted to
know why we need this. Also, do these changes have any impact on the
size of the spl images.

-sughosh

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH V3 3/3] arm/davinci: spl - add compressed u-boot image support
  2012-07-09 18:53 ` [U-Boot] [PATCH V3 3/3] arm/davinci: spl - add compressed u-boot image support Mikhail Kshevetskiy
@ 2012-07-10 18:49   ` Sughosh Ganu
  2012-07-10 19:29     ` Mikhail Kshevetskiy
  0 siblings, 1 reply; 19+ messages in thread
From: Sughosh Ganu @ 2012-07-10 18:49 UTC (permalink / raw)
  To: u-boot

hi Mikhail,
On Mon Jul 09, 2012 at 10:53:40PM +0400, Mikhail Kshevetskiy wrote:
> Motivation:
>  * we have a board with 128 Kb spi flash, so normal u-boot.ais does not
>    fit on it.
> 
> This patch add support of compressed 2-nd u-boot stage. To create a compressed
> ais image its required:
>  * define CONFIG_SPL_GUNZIP_SUPPORT --- enable compressed ais image supports
>  * define CONFIG_SPL_GUNZIP_MAX_SIZE --- define a maximum size of compressed
>    u-boot part
>  * define CONFIG_SPL_GUNZIP_LOAD_ADDR --- memory address to load compressed
>    u-boot part (CONFIG_SPL_GUNZIP_LOAD_ADDR region should not overlap with
>    CONFIG_SYS_TEXT_BASE region)
>  * use: make u-boot-gzip.ais to get a compressed ais image

I don't see any of these macros being defined for any board in your
patch series. Which boards are they being used on. Also, i think these
defines need to be added to the README.

-sughosh

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH V3 2/3] arm/davinci: spl - boot device selection
  2012-07-10 18:39   ` Sughosh Ganu
@ 2012-07-10 19:20     ` Mikhail Kshevetskiy
  2012-07-11  6:38       ` Sughosh Ganu
  0 siblings, 1 reply; 19+ messages in thread
From: Mikhail Kshevetskiy @ 2012-07-10 19:20 UTC (permalink / raw)
  To: u-boot

On Wed, 11 Jul 2012 00:09:06 +0530
Sughosh Ganu <urwithsughosh@gmail.com> wrote:

> hi Mikhail,
> On Mon Jul 09, 2012 at 10:53:39PM +0400, Mikhail Kshevetskiy wrote:
> > This patch allow us to have a universal spl that detects a boot
> > device and select a corresponding boot algorithm for main u-boot part
> > (SOC_DA8XX only)
> 
> I have not tested this patch, will do so sometime this week. I had a
> couple of questions though.
> 
> <snip>
> 
> > diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c
> > b/arch/arm/cpu/arm926ejs/davinci/spl.c index 74632e5..50b4bbc 100644
> > --- a/arch/arm/cpu/arm926ejs/davinci/spl.c
> > +++ b/arch/arm/cpu/arm926ejs/davinci/spl.c
> 
> <snip>
> 
> >  void board_init_r(gd_t *id, ulong dummy)
> >  {
> > -#ifdef CONFIG_SPL_NAND_LOAD
> > -	nand_init();
> > -	puts("Nand boot...\n");
> > -	nand_boot();
> > -#endif
> > -#ifdef CONFIG_SPL_SPI_LOAD
> > -	mem_malloc_init(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN,
> > -			CONFIG_SYS_MALLOC_LEN);
> > +	u32 boot_device;
> > +	void (*uboot)(void) __noreturn;
> > +
> > +	mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START,
> > +			CONFIG_SYS_SPL_MALLOC_SIZE);
> 
> We do not need any heap for the spl on the hawkboard, so can you
> please explain why do we need the heap allocation for all spl
> images. Can't this be made configurable.

this is needed at least for:
  * MMC support
  * SPI support
  * gunzip support (see next patch)

it can be configurable, but is it reasonable?

> >  
> >  	gd = &gdata;
> >  	gd->bd = &bdata;
> >  	gd->flags |= GD_FLG_RELOC;
> > +#ifdef CONFIG_SPL_SERIAL_SUPPORT
> >  	gd->baudrate = CONFIG_BAUDRATE;
> > -	serial_init();          /* serial communications setup */
> > +	serial_init();
> >  	gd->have_console = 1;
> > +#endif
> 
> This call to serial_init is not needed on the hawkboard -- we
> initialise the console needed for spl through NS16550_init for all
> da8xx based spl's in arch_cpu_init, which suffices for spl's debug
> message requirement. I know this is being used for spi based spl
> images, but now that this is being made common, just wanted to
> know why we need this. Also, do these changes have any impact on the
> size of the spl images.

hm, i'll look on it more carefully. I've just look on spi support in spl.

What about ymodem support? If I am not mistake it require a normal console.

> -sughosh

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH V3 3/3] arm/davinci: spl - add compressed u-boot image support
  2012-07-10 18:49   ` Sughosh Ganu
@ 2012-07-10 19:29     ` Mikhail Kshevetskiy
  0 siblings, 0 replies; 19+ messages in thread
From: Mikhail Kshevetskiy @ 2012-07-10 19:29 UTC (permalink / raw)
  To: u-boot

On Wed, 11 Jul 2012 00:19:26 +0530
Sughosh Ganu <urwithsughosh@gmail.com> wrote:

> hi Mikhail,
> On Mon Jul 09, 2012 at 10:53:40PM +0400, Mikhail Kshevetskiy wrote:
> > Motivation:
> >  * we have a board with 128 Kb spi flash, so normal u-boot.ais does not
> >    fit on it.
> > 
> > This patch add support of compressed 2-nd u-boot stage. To create a
> > compressed ais image its required:
> >  * define CONFIG_SPL_GUNZIP_SUPPORT --- enable compressed ais image supports
> >  * define CONFIG_SPL_GUNZIP_MAX_SIZE --- define a maximum size of compressed
> >    u-boot part
> >  * define CONFIG_SPL_GUNZIP_LOAD_ADDR --- memory address to load compressed
> >    u-boot part (CONFIG_SPL_GUNZIP_LOAD_ADDR region should not overlap with
> >    CONFIG_SYS_TEXT_BASE region)
> >  * use: make u-boot-gzip.ais to get a compressed ais image
> 
> I don't see any of these macros being defined for any board in your
> patch series. Which boards are they being used on. Also, i think these
> defines need to be added to the README.

Definitely. This modification were created for our omap l138 based board.
The board is in early development state, so i think it's not reasonable to
add it to u-boot for now.

Anyway, I test this changes on da850evm board, so I can resubmit this patch
with defconfig modification for da850evm.

Mikhail

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH V3 2/3] arm/davinci: spl - boot device selection
  2012-07-10 19:20     ` Mikhail Kshevetskiy
@ 2012-07-11  6:38       ` Sughosh Ganu
  2012-07-11  8:19         ` Tom Rini
  0 siblings, 1 reply; 19+ messages in thread
From: Sughosh Ganu @ 2012-07-11  6:38 UTC (permalink / raw)
  To: u-boot

On Tue Jul 10, 2012 at 11:20:53PM +0400, Mikhail Kshevetskiy wrote:
> On Wed, 11 Jul 2012 00:09:06 +0530
> Sughosh Ganu <urwithsughosh@gmail.com> wrote:
> > > diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c
> > > b/arch/arm/cpu/arm926ejs/davinci/spl.c index 74632e5..50b4bbc 100644
> > > --- a/arch/arm/cpu/arm926ejs/davinci/spl.c
> > > +++ b/arch/arm/cpu/arm926ejs/davinci/spl.c
> > 
> > <snip>
> > 
> > >  void board_init_r(gd_t *id, ulong dummy)
> > >  {
> > > -#ifdef CONFIG_SPL_NAND_LOAD
> > > -	nand_init();
> > > -	puts("Nand boot...\n");
> > > -	nand_boot();
> > > -#endif
> > > -#ifdef CONFIG_SPL_SPI_LOAD
> > > -	mem_malloc_init(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN,
> > > -			CONFIG_SYS_MALLOC_LEN);
> > > +	u32 boot_device;
> > > +	void (*uboot)(void) __noreturn;
> > > +
> > > +	mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START,
> > > +			CONFIG_SYS_SPL_MALLOC_SIZE);
> > 
> > We do not need any heap for the spl on the hawkboard, so can you
> > please explain why do we need the heap allocation for all spl
> > images. Can't this be made configurable.
> 
> this is needed at least for:
>   * MMC support
>   * SPI support
>   * gunzip support (see next patch)
> 
> it can be configurable, but is it reasonable?

I would think so -- i guess it should be fine to include this only for
boards/configurations that actually need the heap.

> 
> > >  
> > >  	gd = &gdata;
> > >  	gd->bd = &bdata;
> > >  	gd->flags |= GD_FLG_RELOC;
> > > +#ifdef CONFIG_SPL_SERIAL_SUPPORT
> > >  	gd->baudrate = CONFIG_BAUDRATE;
> > > -	serial_init();          /* serial communications setup */
> > > +	serial_init();
> > >  	gd->have_console = 1;
> > > +#endif
> > 
> > This call to serial_init is not needed on the hawkboard -- we
> > initialise the console needed for spl through NS16550_init for all
> > da8xx based spl's in arch_cpu_init, which suffices for spl's debug
> > message requirement. I know this is being used for spi based spl
> > images, but now that this is being made common, just wanted to
> > know why we need this. Also, do these changes have any impact on the
> > size of the spl images.
> 
> hm, i'll look on it more carefully. I've just look on spi support in spl.
> 
> What about ymodem support? If I am not mistake it require a normal console.

If it's needed for ymodem support, include it for that use case -- i
see that your patch already has a separate cases for ymodem
support, spi flash support and so on. Can't it be called for cases
where it is really needed.

Btw, forgot to mention in my earlier mail that you need to add the
license header for all the new files, like spl_mmc.c etc.

-sughosh

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH V3 2/3] arm/davinci: spl - boot device selection
  2012-07-11  6:38       ` Sughosh Ganu
@ 2012-07-11  8:19         ` Tom Rini
  2012-07-11 10:40           ` Sughosh Ganu
  0 siblings, 1 reply; 19+ messages in thread
From: Tom Rini @ 2012-07-11  8:19 UTC (permalink / raw)
  To: u-boot

On 07/10/2012 11:38 PM, Sughosh Ganu wrote:
> On Tue Jul 10, 2012 at 11:20:53PM +0400, Mikhail Kshevetskiy wrote:
>> On Wed, 11 Jul 2012 00:09:06 +0530
>> Sughosh Ganu <urwithsughosh@gmail.com> wrote:
>>>> diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c
>>>> b/arch/arm/cpu/arm926ejs/davinci/spl.c index 74632e5..50b4bbc 100644
>>>> --- a/arch/arm/cpu/arm926ejs/davinci/spl.c
>>>> +++ b/arch/arm/cpu/arm926ejs/davinci/spl.c
>>>
>>> <snip>
>>>
>>>>  void board_init_r(gd_t *id, ulong dummy)
>>>>  {
>>>> -#ifdef CONFIG_SPL_NAND_LOAD
>>>> -	nand_init();
>>>> -	puts("Nand boot...\n");
>>>> -	nand_boot();
>>>> -#endif
>>>> -#ifdef CONFIG_SPL_SPI_LOAD
>>>> -	mem_malloc_init(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN,
>>>> -			CONFIG_SYS_MALLOC_LEN);
>>>> +	u32 boot_device;
>>>> +	void (*uboot)(void) __noreturn;
>>>> +
>>>> +	mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START,
>>>> +			CONFIG_SYS_SPL_MALLOC_SIZE);
>>>
>>> We do not need any heap for the spl on the hawkboard, so can you
>>> please explain why do we need the heap allocation for all spl
>>> images. Can't this be made configurable.
>>
>> this is needed at least for:
>>   * MMC support
>>   * SPI support
>>   * gunzip support (see next patch)
>>
>> it can be configurable, but is it reasonable?
> 
> I would think so -- i guess it should be fine to include this only for
> boards/configurations that actually need the heap.

Shouldn't "load u-boot.img from vfat SD card" be a common case at least
for developers?

-- 
Tom

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH V3 2/3] arm/davinci: spl - boot device selection
  2012-07-11  8:19         ` Tom Rini
@ 2012-07-11 10:40           ` Sughosh Ganu
  2012-07-11 10:46             ` Tom Rini
  0 siblings, 1 reply; 19+ messages in thread
From: Sughosh Ganu @ 2012-07-11 10:40 UTC (permalink / raw)
  To: u-boot

On Wed Jul 11, 2012 at 01:19:40AM -0700, Tom Rini wrote:
> On 07/10/2012 11:38 PM, Sughosh Ganu wrote:
> > On Tue Jul 10, 2012 at 11:20:53PM +0400, Mikhail Kshevetskiy wrote:
> >> On Wed, 11 Jul 2012 00:09:06 +0530
> >> Sughosh Ganu <urwithsughosh@gmail.com> wrote:
> >>>> diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c
> >>>> b/arch/arm/cpu/arm926ejs/davinci/spl.c index 74632e5..50b4bbc 100644
> >>>> --- a/arch/arm/cpu/arm926ejs/davinci/spl.c
> >>>> +++ b/arch/arm/cpu/arm926ejs/davinci/spl.c
> >>>
> >>> <snip>
> >>>
> >>>>  void board_init_r(gd_t *id, ulong dummy)
> >>>>  {
> >>>> -#ifdef CONFIG_SPL_NAND_LOAD
> >>>> -	nand_init();
> >>>> -	puts("Nand boot...\n");
> >>>> -	nand_boot();
> >>>> -#endif
> >>>> -#ifdef CONFIG_SPL_SPI_LOAD
> >>>> -	mem_malloc_init(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN,
> >>>> -			CONFIG_SYS_MALLOC_LEN);
> >>>> +	u32 boot_device;
> >>>> +	void (*uboot)(void) __noreturn;
> >>>> +
> >>>> +	mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START,
> >>>> +			CONFIG_SYS_SPL_MALLOC_SIZE);
> >>>
> >>> We do not need any heap for the spl on the hawkboard, so can you
> >>> please explain why do we need the heap allocation for all spl
> >>> images. Can't this be made configurable.
> >>
> >> this is needed at least for:
> >>   * MMC support
> >>   * SPI support
> >>   * gunzip support (see next patch)
> >>
> >> it can be configurable, but is it reasonable?
> > 
> > I would think so -- i guess it should be fine to include this only for
> > boards/configurations that actually need the heap.
> 
> Shouldn't "load u-boot.img from vfat SD card" be a common case at least
> for developers?

Yes, it should be, but what i meant was that things that are not
needed for certain boards or configurations need not be made
common. Like in this case, why does setting up a heap, which is not
needed at least on my board need to be common for all spl images. If a
particular board/configuration needs it, then use it.

Loading an image from a media is a common case, but for that
particular media only. Other media might have different requirements.

-sughosh

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH V3 2/3] arm/davinci: spl - boot device selection
  2012-07-11 10:40           ` Sughosh Ganu
@ 2012-07-11 10:46             ` Tom Rini
  2012-07-11 11:05               ` Sughosh Ganu
  0 siblings, 1 reply; 19+ messages in thread
From: Tom Rini @ 2012-07-11 10:46 UTC (permalink / raw)
  To: u-boot

On 07/11/2012 03:40 AM, Sughosh Ganu wrote:
> On Wed Jul 11, 2012 at 01:19:40AM -0700, Tom Rini wrote:
>> On 07/10/2012 11:38 PM, Sughosh Ganu wrote:
>>> On Tue Jul 10, 2012 at 11:20:53PM +0400, Mikhail Kshevetskiy wrote:
>>>> On Wed, 11 Jul 2012 00:09:06 +0530
>>>> Sughosh Ganu <urwithsughosh@gmail.com> wrote:
>>>>>> diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c
>>>>>> b/arch/arm/cpu/arm926ejs/davinci/spl.c index 74632e5..50b4bbc 100644
>>>>>> --- a/arch/arm/cpu/arm926ejs/davinci/spl.c
>>>>>> +++ b/arch/arm/cpu/arm926ejs/davinci/spl.c
>>>>>
>>>>> <snip>
>>>>>
>>>>>>  void board_init_r(gd_t *id, ulong dummy)
>>>>>>  {
>>>>>> -#ifdef CONFIG_SPL_NAND_LOAD
>>>>>> -	nand_init();
>>>>>> -	puts("Nand boot...\n");
>>>>>> -	nand_boot();
>>>>>> -#endif
>>>>>> -#ifdef CONFIG_SPL_SPI_LOAD
>>>>>> -	mem_malloc_init(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN,
>>>>>> -			CONFIG_SYS_MALLOC_LEN);
>>>>>> +	u32 boot_device;
>>>>>> +	void (*uboot)(void) __noreturn;
>>>>>> +
>>>>>> +	mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START,
>>>>>> +			CONFIG_SYS_SPL_MALLOC_SIZE);
>>>>>
>>>>> We do not need any heap for the spl on the hawkboard, so can you
>>>>> please explain why do we need the heap allocation for all spl
>>>>> images. Can't this be made configurable.
>>>>
>>>> this is needed at least for:
>>>>   * MMC support
>>>>   * SPI support
>>>>   * gunzip support (see next patch)
>>>>
>>>> it can be configurable, but is it reasonable?
>>>
>>> I would think so -- i guess it should be fine to include this only for
>>> boards/configurations that actually need the heap.
>>
>> Shouldn't "load u-boot.img from vfat SD card" be a common case at least
>> for developers?
> 
> Yes, it should be, but what i meant was that things that are not
> needed for certain boards or configurations need not be made
> common. Like in this case, why does setting up a heap, which is not
> needed at least on my board need to be common for all spl images. If a
> particular board/configuration needs it, then use it.

Wouldn't load from SD be a common case on hawkboard, esp once the ones
that can load from SD, from the ROM become more available?  I'm fine
saying that we should wrap the call around an #if, but I would expect it
to be set in the common case and only not set in custom production boards.

-- 
Tom

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH V3 2/3] arm/davinci: spl - boot device selection
  2012-07-11 10:46             ` Tom Rini
@ 2012-07-11 11:05               ` Sughosh Ganu
  2012-07-11 11:43                 ` Tom Rini
  0 siblings, 1 reply; 19+ messages in thread
From: Sughosh Ganu @ 2012-07-11 11:05 UTC (permalink / raw)
  To: u-boot

On Wed Jul 11, 2012 at 03:46:46AM -0700, Tom Rini wrote:
> On 07/11/2012 03:40 AM, Sughosh Ganu wrote:
> > On Wed Jul 11, 2012 at 01:19:40AM -0700, Tom Rini wrote:
> >> On 07/10/2012 11:38 PM, Sughosh Ganu wrote:
> >>> On Tue Jul 10, 2012 at 11:20:53PM +0400, Mikhail Kshevetskiy wrote:
> >>>> On Wed, 11 Jul 2012 00:09:06 +0530
> >>>> Sughosh Ganu <urwithsughosh@gmail.com> wrote:
> >>>>>> diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c
> >>>>>> b/arch/arm/cpu/arm926ejs/davinci/spl.c index 74632e5..50b4bbc 100644
> >>>>>> --- a/arch/arm/cpu/arm926ejs/davinci/spl.c
> >>>>>> +++ b/arch/arm/cpu/arm926ejs/davinci/spl.c
> >>>>>
> >>>>> <snip>
> >>>>>
> >>>>>>  void board_init_r(gd_t *id, ulong dummy)
> >>>>>>  {
> >>>>>> -#ifdef CONFIG_SPL_NAND_LOAD
> >>>>>> -	nand_init();
> >>>>>> -	puts("Nand boot...\n");
> >>>>>> -	nand_boot();
> >>>>>> -#endif
> >>>>>> -#ifdef CONFIG_SPL_SPI_LOAD
> >>>>>> -	mem_malloc_init(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN,
> >>>>>> -			CONFIG_SYS_MALLOC_LEN);
> >>>>>> +	u32 boot_device;
> >>>>>> +	void (*uboot)(void) __noreturn;
> >>>>>> +
> >>>>>> +	mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START,
> >>>>>> +			CONFIG_SYS_SPL_MALLOC_SIZE);
> >>>>>
> >>>>> We do not need any heap for the spl on the hawkboard, so can you
> >>>>> please explain why do we need the heap allocation for all spl
> >>>>> images. Can't this be made configurable.
> >>>>
> >>>> this is needed at least for:
> >>>>   * MMC support
> >>>>   * SPI support
> >>>>   * gunzip support (see next patch)
> >>>>
> >>>> it can be configurable, but is it reasonable?
> >>>
> >>> I would think so -- i guess it should be fine to include this only for
> >>> boards/configurations that actually need the heap.
> >>
> >> Shouldn't "load u-boot.img from vfat SD card" be a common case at least
> >> for developers?
> > 
> > Yes, it should be, but what i meant was that things that are not
> > needed for certain boards or configurations need not be made
> > common. Like in this case, why does setting up a heap, which is not
> > needed at least on my board need to be common for all spl images. If a
> > particular board/configuration needs it, then use it.
> 
> Wouldn't load from SD be a common case on hawkboard, esp once the ones
> that can load from SD, from the ROM become more available?

Yes, loading from SD could be supported on any board in the future,
but in that case, should it not be just a matter of adding something
like CONFIG_SPL_MMC_LOAD to the board's config file.


> I'm fine saying that we should wrap the call around an #if, but I
> would expect it to be set in the common case and only not set in
> custom production boards.

Correct, so all that is needed for SD/MMC loading can still be kept
separate from, say nand load in the spl.c file, isn't it. So if sd/mmc
spl load needs heap to be set up, can't it be done only for that
case.

-sughosh

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH V3 2/3] arm/davinci: spl - boot device selection
  2012-07-11 11:05               ` Sughosh Ganu
@ 2012-07-11 11:43                 ` Tom Rini
  2012-07-11 12:08                   ` Sughosh Ganu
  0 siblings, 1 reply; 19+ messages in thread
From: Tom Rini @ 2012-07-11 11:43 UTC (permalink / raw)
  To: u-boot

On 07/11/2012 04:05 AM, Sughosh Ganu wrote:
> On Wed Jul 11, 2012 at 03:46:46AM -0700, Tom Rini wrote:
>> On 07/11/2012 03:40 AM, Sughosh Ganu wrote:
>>> On Wed Jul 11, 2012 at 01:19:40AM -0700, Tom Rini wrote:
>>>> On 07/10/2012 11:38 PM, Sughosh Ganu wrote:
>>>>> On Tue Jul 10, 2012 at 11:20:53PM +0400, Mikhail Kshevetskiy wrote:
>>>>>> On Wed, 11 Jul 2012 00:09:06 +0530
>>>>>> Sughosh Ganu <urwithsughosh@gmail.com> wrote:
>>>>>>>> diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c
>>>>>>>> b/arch/arm/cpu/arm926ejs/davinci/spl.c index 74632e5..50b4bbc 100644
>>>>>>>> --- a/arch/arm/cpu/arm926ejs/davinci/spl.c
>>>>>>>> +++ b/arch/arm/cpu/arm926ejs/davinci/spl.c
>>>>>>>
>>>>>>> <snip>
>>>>>>>
>>>>>>>>  void board_init_r(gd_t *id, ulong dummy)
>>>>>>>>  {
>>>>>>>> -#ifdef CONFIG_SPL_NAND_LOAD
>>>>>>>> -	nand_init();
>>>>>>>> -	puts("Nand boot...\n");
>>>>>>>> -	nand_boot();
>>>>>>>> -#endif
>>>>>>>> -#ifdef CONFIG_SPL_SPI_LOAD
>>>>>>>> -	mem_malloc_init(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN,
>>>>>>>> -			CONFIG_SYS_MALLOC_LEN);
>>>>>>>> +	u32 boot_device;
>>>>>>>> +	void (*uboot)(void) __noreturn;
>>>>>>>> +
>>>>>>>> +	mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START,
>>>>>>>> +			CONFIG_SYS_SPL_MALLOC_SIZE);
>>>>>>>
>>>>>>> We do not need any heap for the spl on the hawkboard, so can you
>>>>>>> please explain why do we need the heap allocation for all spl
>>>>>>> images. Can't this be made configurable.
>>>>>>
>>>>>> this is needed at least for:
>>>>>>   * MMC support
>>>>>>   * SPI support
>>>>>>   * gunzip support (see next patch)
>>>>>>
>>>>>> it can be configurable, but is it reasonable?
>>>>>
>>>>> I would think so -- i guess it should be fine to include this only for
>>>>> boards/configurations that actually need the heap.
>>>>
>>>> Shouldn't "load u-boot.img from vfat SD card" be a common case at least
>>>> for developers?
>>>
>>> Yes, it should be, but what i meant was that things that are not
>>> needed for certain boards or configurations need not be made
>>> common. Like in this case, why does setting up a heap, which is not
>>> needed at least on my board need to be common for all spl images. If a
>>> particular board/configuration needs it, then use it.
>>
>> Wouldn't load from SD be a common case on hawkboard, esp once the ones
>> that can load from SD, from the ROM become more available?
> 
> Yes, loading from SD could be supported on any board in the future,
> but in that case, should it not be just a matter of adding something
> like CONFIG_SPL_MMC_LOAD to the board's config file.

Yes, along with adding the defines for the heap.  And unless you end up
being severely space constrained for the SPL file, it's usually the case
you build in support for a few modes, when it's possible to detect at
run time where you came from.

>> I'm fine saying that we should wrap the call around an #if, but I
>> would expect it to be set in the common case and only not set in
>> custom production boards.
> 
> Correct, so all that is needed for SD/MMC loading can still be kept
> separate from, say nand load in the spl.c file, isn't it. So if sd/mmc
> spl load needs heap to be set up, can't it be done only for that
> case.

Yes, but we don't want to have N locations that set up the heap.  We
want one location that will, if the board has defined a heap area, we
set it up.  Or to put it another way, calling mem_malloc_init isn't part
of the mmc boot-flow, it's part of the general boot flow.

-- 
Tom

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH V3 2/3] arm/davinci: spl - boot device selection
  2012-07-11 11:43                 ` Tom Rini
@ 2012-07-11 12:08                   ` Sughosh Ganu
  2012-07-11 12:15                     ` Tom Rini
  0 siblings, 1 reply; 19+ messages in thread
From: Sughosh Ganu @ 2012-07-11 12:08 UTC (permalink / raw)
  To: u-boot

On Wed Jul 11, 2012 at 04:43:19AM -0700, Tom Rini wrote:
> On 07/11/2012 04:05 AM, Sughosh Ganu wrote:

<snip>

> >> I'm fine saying that we should wrap the call around an #if, but I
> >> would expect it to be set in the common case and only not set in
> >> custom production boards.
> > 
> > Correct, so all that is needed for SD/MMC loading can still be kept
> > separate from, say nand load in the spl.c file, isn't it. So if sd/mmc
> > spl load needs heap to be set up, can't it be done only for that
> > case.
> 
> Yes, but we don't want to have N locations that set up the heap.  We
> want one location that will, if the board has defined a heap area, we
> set it up.  Or to put it another way, calling mem_malloc_init isn't part
> of the mmc boot-flow, it's part of the general boot flow.

Fair enough. My only concern was just that if some feature is not
needed for a board, it should be possible to exclude it out.

-sughosh

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [U-Boot] [PATCH V3 2/3] arm/davinci: spl - boot device selection
  2012-07-11 12:08                   ` Sughosh Ganu
@ 2012-07-11 12:15                     ` Tom Rini
  0 siblings, 0 replies; 19+ messages in thread
From: Tom Rini @ 2012-07-11 12:15 UTC (permalink / raw)
  To: u-boot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 07/11/2012 05:08 AM, Sughosh Ganu wrote:
> On Wed Jul 11, 2012 at 04:43:19AM -0700, Tom Rini wrote:
>> On 07/11/2012 04:05 AM, Sughosh Ganu wrote:
> 
> <snip>
> 
>>>> I'm fine saying that we should wrap the call around an #if,
>>>> but I would expect it to be set in the common case and only
>>>> not set in custom production boards.
>>> 
>>> Correct, so all that is needed for SD/MMC loading can still be
>>> kept separate from, say nand load in the spl.c file, isn't it.
>>> So if sd/mmc spl load needs heap to be set up, can't it be done
>>> only for that case.
>> 
>> Yes, but we don't want to have N locations that set up the heap.
>> We want one location that will, if the board has defined a heap
>> area, we set it up.  Or to put it another way, calling
>> mem_malloc_init isn't part of the mmc boot-flow, it's part of the
>> general boot flow.
> 
> Fair enough. My only concern was just that if some feature is not 
> needed for a board, it should be possible to exclude it out.

To be clear, absolutely agreed.

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJP/W50AAoJENk4IS6UOR1W6VEQAJ2C+IlU/irdxIBQJkWKdGoe
Rwr1bdQpnUIA4ILEBuD7jwiDj/Q6znfzUQf0XXZuRg+ShYu10y/2HBazn/alfrMj
FyLqm7YnjxDoWpfbSzR5EajdUOD7UgdDbZURwyte/NQos2WeS89IZTrlIT5sxfYV
L7DT0fDdK4pfh7+gArr99Ge/eE3ddm9kVdoxFbvYsr0BQs8xLnjh7t1DZ2rk0P7Y
AabwKIiM1o7xNn5GPIb7lraO4A1/m7U1/if2ad+I/qtEsAnsTC+Ds7VPvnxSdK/w
ga/r/OcYzpQLHna0dBQ4qXqnl5hKDARw3ZX2EYiqxRECRDLMDo2OWJio2F7yEqID
nYhhVKFNcSIC6mcIz1DyPGd/q3QFziCRFfFq0xrfF6K2rNByfXK4xHdld33EFvM1
V7Kfu8XSXeswGU41T+I6hHZyaCFWeNzDBTF/JtfXoZ0IoGgb045JLc6i14KAmwpO
AVCLhQy64h4O7BfvrzYK5u93RmI0PtjdXwkrBMpqAcICwsiPJ0mAU2azYQNbhYVk
NJM5xecgobni0HQek1f/UgzwllwDusjrjo5Hv+Di/D5wYBYTOWxPKZGEHOWfcuf6
O/io1QVQc3FMdrU3cCf5kB/tDAXDOpENhStCkkCgbFVf6u2hVz4vdSxV7oZ5Gmkp
bpFoazwtHzXpzE5B6eIe
=kJeB
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2012-07-11 12:15 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-09 18:53 [U-Boot] [PATCH V3 1/3] MMC: u-boot-spl may be compiled without partition support Mikhail Kshevetskiy
2012-07-09 18:53 ` [U-Boot] [PATCH V3 2/3] arm/davinci: spl - boot device selection Mikhail Kshevetskiy
2012-07-09 19:41   ` Tom Rini
2012-07-09 19:57     ` Mikhail Kshevetskiy
2012-07-09 20:08       ` Tom Rini
2012-07-09 20:10         ` Mikhail Kshevetskiy
2012-07-10 18:39   ` Sughosh Ganu
2012-07-10 19:20     ` Mikhail Kshevetskiy
2012-07-11  6:38       ` Sughosh Ganu
2012-07-11  8:19         ` Tom Rini
2012-07-11 10:40           ` Sughosh Ganu
2012-07-11 10:46             ` Tom Rini
2012-07-11 11:05               ` Sughosh Ganu
2012-07-11 11:43                 ` Tom Rini
2012-07-11 12:08                   ` Sughosh Ganu
2012-07-11 12:15                     ` Tom Rini
2012-07-09 18:53 ` [U-Boot] [PATCH V3 3/3] arm/davinci: spl - add compressed u-boot image support Mikhail Kshevetskiy
2012-07-10 18:49   ` Sughosh Ganu
2012-07-10 19:29     ` Mikhail Kshevetskiy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.