Skip to contentSkip to conversation

MMC: u-boot-spl may be compiled without partition support

PATCH New Mikhail Kshevetskiy 3 participants 19 messages Jul 9, 2012 – Jul 11, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/3 MMC: u-boot-spl may be compiled without partition support

---
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(+)
drivers/mmc/mmc.c +2 -0
index aebe578..69df64a 100644
@@ -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;
 }
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH v3 2/3 arm/davinci: spl - boot device selection

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

---
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
arch/arm/cpu/arm926ejs/davinci/Makefile +5 -0
index da7efac..12bd37a 100644
@@ -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
arch/arm/cpu/arm926ejs/davinci/spl.c +80 -11

114 lines not on this page · raw message

arch/arm/cpu/arm926ejs/davinci/spl_mmc.c new file +39 -0
new file mode 100644
index 0000000..1a551e9
@@ -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);
+}
arch/arm/cpu/arm926ejs/davinci/spl_nand.c new file +11 -0
new file mode 100644
index 0000000..bad1e8f
@@ -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);
+}
arch/arm/cpu/arm926ejs/davinci/spl_spi_flash.c new file +25 -0
new file mode 100644
index 0000000..d6fadcd
@@ -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);
+}
arch/arm/cpu/arm926ejs/davinci/spl_ymodem.c new file +42 -0

42 lines not on this page · raw message

arch/arm/include/asm/arch-davinci/davinci_boot.h new file +50 -0

50 lines not on this page · raw message

include/configs/cam_enc_4xx.h +6 -6
index 771ac9c..590f3f8 100644
@@ -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
include/configs/da850evm.h +11 -8
index e6adb1f..7a3ec4c 100644
@@ -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
include/configs/hawkboard.h +6 -5
index c6e8859..133fdfb 100644
@@ -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
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH v3 2/3 arm/davinci: spl - boot device selection

Quoted 11 lines · Mikhail Kshevetskiy

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

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.

Signature · 1 line
Tom
#3 lore raw

PATCH v3 2/3 arm/davinci: spl - boot device selection

Quoted 19 lines · On Mon, 9 Jul 2012 12:41:06 -0700 Tom Rini <[email protected]> wrote:
Quoted 11 lines · Mikhail Kshevetskiy

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

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.

Quoted 8 lines

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

Quoted 5 lines
Signature · 2 lines
-- 
Tom
#4 lore raw

PATCH v3 2/3 arm/davinci: spl - boot device selection

Quoted 31 lines · Mikhail Kshevetskiy
Quoted 19 lines · On Mon, 9 Jul 2012 12:41:06 -0700 Tom Rini <[email protected]> wrote:
Quoted 11 lines · Mikhail Kshevetskiy

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

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.

Quoted 8 lines

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.

Quoted 2 lines

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.

Quoted 1 line

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.

Signature · 1 line
Tom
#5 lore raw

PATCH v3 2/3 arm/davinci: spl - boot device selection

Quoted 36 lines · On Mon, 9 Jul 2012 13:08:07 -0700 Tom Rini <[email protected]> wrote:
Quoted 31 lines · Mikhail Kshevetskiy
Quoted 19 lines · On Mon, 9 Jul 2012 12:41:06 -0700 Tom Rini <[email protected]> wrote:
Quoted 11 lines · Mikhail Kshevetskiy

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

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.

Quoted 8 lines

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.

Quoted 3 lines

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.

Quoted 9 lines

OK, thanks.

Quoted 1 line

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.

Signature · 1 line
Tom

Thanks!

Mikhail

#6 lore raw

PATCH v3 2/3 arm/davinci: spl - boot device selection

In reply to Mikhail Kshevetskiy

hi Mikhail,

Quoted 3 lines · Mikhail Kshevetskiy

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>

Quoted 4 lines
arch/arm/cpu/arm926ejs/davinci/spl.c +0 -0
index 74632e5..50b4bbc 100644

<snip>

Quoted 5 lines

void board_init_r(gd_t *id, ulong dummy)
{

arch/arm/cpu/arm926ejs/davinci/spl.c +0 -3
-#ifdef CONFIG_SPL_NAND_LOAD
-	nand_init();
-	puts("Nand boot...\n");

arch/arm/cpu/arm926ejs/davinci/spl.c void board_init_f(ulong dummy) · line 118

Quoted 10 lines
arch/arm/cpu/arm926ejs/davinci/spl.c +5 -5
-	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.

arch/arm/cpu/arm926ejs/davinci/spl.c void board_init_f(ulong dummy) · line 127

Quoted 10 lines
arch/arm/cpu/arm926ejs/davinci/spl.c +3 -1
 	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

#7 lore raw

PATCH v3 2/3 arm/davinci: spl - boot device selection

Quoted 29 lines · On Wed, 11 Jul 2012 00:09:06 +0530 Sughosh Ganu <[email protected]> wrote:

hi Mikhail,

Quoted 3 lines · Mikhail Kshevetskiy

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>

Quoted 4 lines
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/davinci/spl.c index 74632e5..50b4bbc 100644

arch/arm/cpu/arm926ejs/davinci/spl.c +0 -0

<snip>

Quoted 11 lines

void board_init_r(gd_t *id, ulong dummy)
{

arch/arm/cpu/arm926ejs/davinci/spl.c +1 -8
-#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;
Quoted 8 lines

arch/arm/cpu/arm926ejs/davinci/spl.c void board_init_f(ulong dummy) · line 118

Quoted 4 lines
arch/arm/cpu/arm926ejs/davinci/spl.c +4 -0
+	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?

Quoted 11 lines

arch/arm/cpu/arm926ejs/davinci/spl.c void board_init_f(ulong dummy) · line 127

Quoted 10 lines
arch/arm/cpu/arm926ejs/davinci/spl.c +3 -1
 	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
Quoted 7 lines

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.

Quoted 1 line

-sughosh

#8 lore raw

PATCH v3 2/3 arm/davinci: spl - boot device selection

Quoted 29 lines · Mikhail Kshevetskiy
Quoted 18 lines · On Wed, 11 Jul 2012 00:09:06 +0530 Sughosh Ganu <[email protected]> wrote:
Quoted 4 lines
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/davinci/spl.c index 74632e5..50b4bbc 100644

arch/arm/cpu/arm926ejs/davinci/spl.c +0 -0

<snip>

Quoted 11 lines

void board_init_r(gd_t *id, ulong dummy)
{

arch/arm/cpu/arm926ejs/davinci/spl.c +1 -8
-#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;
Quoted 8 lines

arch/arm/cpu/arm926ejs/davinci/spl.c void board_init_f(ulong dummy) · line 118

Quoted 4 lines
arch/arm/cpu/arm926ejs/davinci/spl.c +4 -0
+	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.

Quoted 6 lines

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.

Quoted 20 lines
Quoted 12 lines

arch/arm/cpu/arm926ejs/davinci/spl.c void board_init_f(ulong dummy) · line 127

Quoted 11 lines
arch/arm/cpu/arm926ejs/davinci/spl.c +3 -1
 	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
Quoted 7 lines

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.

Quoted 3 lines

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

#9 lore raw

PATCH v3 2/3 arm/davinci: spl - boot device selection

Quoted 35 lines · Sughosh Ganu
Quoted 34 lines · Mikhail Kshevetskiy
Quoted 18 lines · On Wed, 11 Jul 2012 00:09:06 +0530 Sughosh Ganu <[email protected]> wrote:
Quoted 4 lines
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/davinci/spl.c index 74632e5..50b4bbc 100644

arch/arm/cpu/arm926ejs/davinci/spl.c +0 -0

<snip>

Quoted 11 lines

void board_init_r(gd_t *id, ulong dummy)
{

arch/arm/cpu/arm926ejs/davinci/spl.c +1 -8
-#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;
Quoted 8 lines

arch/arm/cpu/arm926ejs/davinci/spl.c void board_init_f(ulong dummy) · line 118

Quoted 4 lines
arch/arm/cpu/arm926ejs/davinci/spl.c +4 -0
+	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)

Quoted 4 lines
Quoted 1 line

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?

Signature · 1 line
Tom
#10 lore raw

PATCH v3 2/3 arm/davinci: spl - boot device selection

Quoted 36 lines · Tom Rini
Quoted 35 lines · Sughosh Ganu
Quoted 34 lines · Mikhail Kshevetskiy
Quoted 18 lines · On Wed, 11 Jul 2012 00:09:06 +0530 Sughosh Ganu <[email protected]> wrote:
Quoted 4 lines
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/davinci/spl.c index 74632e5..50b4bbc 100644

arch/arm/cpu/arm926ejs/davinci/spl.c +0 -0

<snip>

Quoted 11 lines

void board_init_r(gd_t *id, ulong dummy)
{

arch/arm/cpu/arm926ejs/davinci/spl.c +1 -8
-#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;
Quoted 8 lines

arch/arm/cpu/arm926ejs/davinci/spl.c void board_init_f(ulong dummy) · line 118

Quoted 4 lines
arch/arm/cpu/arm926ejs/davinci/spl.c +4 -0
+	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)

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

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

#11 lore raw

PATCH v3 2/3 arm/davinci: spl - boot device selection

Quoted 42 lines · Sughosh Ganu
Quoted 41 lines · Tom Rini
Quoted 39 lines · Sughosh Ganu
Quoted 29 lines · Mikhail Kshevetskiy
Quoted 18 lines · On Wed, 11 Jul 2012 00:09:06 +0530 Sughosh Ganu <[email protected]> wrote:
Quoted 4 lines
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/davinci/spl.c index 74632e5..50b4bbc 100644

arch/arm/cpu/arm926ejs/davinci/spl.c +0 -0

<snip>

Quoted 11 lines

void board_init_r(gd_t *id, ulong dummy)
{

arch/arm/cpu/arm926ejs/davinci/spl.c +1 -8
-#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;
Quoted 8 lines

arch/arm/cpu/arm926ejs/davinci/spl.c void board_init_f(ulong dummy) · line 118

Quoted 4 lines
arch/arm/cpu/arm926ejs/davinci/spl.c +4 -0
+	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.

Quoted 6 lines

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.

Quoted 8 lines
Quoted 2 lines

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.

Signature · 1 line
Tom
#12 lore raw

PATCH v3 2/3 arm/davinci: spl - boot device selection

Quoted 46 lines · Tom Rini
Quoted 45 lines · Sughosh Ganu
Quoted 43 lines · Tom Rini
Quoted 35 lines · Sughosh Ganu
Quoted 34 lines · Mikhail Kshevetskiy
Quoted 18 lines · On Wed, 11 Jul 2012 00:09:06 +0530 Sughosh Ganu <[email protected]> wrote:
Quoted 4 lines
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/davinci/spl.c index 74632e5..50b4bbc 100644

arch/arm/cpu/arm926ejs/davinci/spl.c +0 -0

<snip>

Quoted 11 lines

void board_init_r(gd_t *id, ulong dummy)
{

arch/arm/cpu/arm926ejs/davinci/spl.c +1 -8
-#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;
Quoted 8 lines

arch/arm/cpu/arm926ejs/davinci/spl.c

Quoted 4 lines
arch/arm/cpu/arm926ejs/davinci/spl.c +4 -0
+	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)

Quoted 4 lines
Quoted 1 line

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?

Quoted 8 lines
Quoted 5 lines

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.

Quoted 3 lines

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

#13 lore raw

PATCH v3 2/3 arm/davinci: spl - boot device selection

Quoted 53 lines · Sughosh Ganu
Quoted 52 lines · Tom Rini
Quoted 50 lines · Sughosh Ganu
Quoted 36 lines · Tom Rini
Quoted 35 lines · Sughosh Ganu
Quoted 34 lines · Mikhail Kshevetskiy
Quoted 18 lines · On Wed, 11 Jul 2012 00:09:06 +0530 Sughosh Ganu <[email protected]> wrote:
Quoted 4 lines
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/davinci/spl.c index 74632e5..50b4bbc 100644

arch/arm/cpu/arm926ejs/davinci/spl.c +0 -0

<snip>

Quoted 11 lines

void board_init_r(gd_t *id, ulong dummy)
{

arch/arm/cpu/arm926ejs/davinci/spl.c +1 -8
-#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;
Quoted 8 lines

arch/arm/cpu/arm926ejs/davinci/spl.c

Quoted 4 lines
arch/arm/cpu/arm926ejs/davinci/spl.c +4 -0
+	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)

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

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.

Quoted 6 lines
Quoted 2 lines

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.

Quoted 8 lines
Quoted 3 lines

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.

Signature · 1 line
Tom
#14 lore raw

PATCH v3 2/3 arm/davinci: spl - boot device selection

Quoted 1 line · Tom Rini

On 07/11/2012 04:05 AM, Sughosh Ganu wrote:

<snip>

Quoted 9 lines
Quoted 8 lines
Quoted 3 lines

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.

Quoted 4 lines

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

#15 lore raw

PATCH v3 2/3 arm/davinci: spl - boot device selection

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

Quoted 14 lines · Sughosh Ganu
Quoted 1 line · Tom Rini

On 07/11/2012 04:05 AM, Sughosh Ganu wrote:

<snip>

Quoted 9 lines
Quoted 8 lines
Quoted 3 lines

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.

Quoted 8 lines
Quoted 5 lines

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-----

#16 lore raw

PATCH v3 3/3 arm/davinci: spl - add compressed u-boot image support

In reply to Mikhail Kshevetskiy

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

---
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(-)
Makefile +14 -0
index 85e36ec..cf16824 100644
@@ -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
arch/arm/cpu/arm926ejs/davinci/spl.c +7 -0
index 50b4bbc..041df5b 100644
@@ -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)();
arch/arm/cpu/arm926ejs/davinci/spl_mmc.c +6 -1
index 1a551e9..fa67f1a 100644
@@ -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();
arch/arm/cpu/arm926ejs/davinci/spl_nand.c +6 -1
index bad1e8f..4bf3e6a 100644
@@ -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);
 }
arch/arm/cpu/arm926ejs/davinci/spl_spi_flash.c +6 -1
index d6fadcd..76d4d51 100644
@@ -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();
arch/arm/cpu/arm926ejs/davinci/spl_ymodem.c +4 -0
index b8c4db1..857436f 100644
@@ -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;
lib/Makefile +1 -0
index c60c380..5a259ed 100644
@@ -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
spl/Makefile +1 -0
index ea7d475..d11d8b2 100644
@@ -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
Signature · 1 line
1.7.10.4
#17 lore raw

PATCH v3 3/3 arm/davinci: spl - add compressed u-boot image support

hi Mikhail,

Quoted 4 lines · Mikhail Kshevetskiy

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

Quoted 9 lines

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

#18 lore raw

PATCH v3 3/3 arm/davinci: spl - add compressed u-boot image support

Quoted 16 lines · On Wed, 11 Jul 2012 00:19:26 +0530 Sughosh Ganu <[email protected]> wrote:

hi Mikhail,

Quoted 4 lines · Mikhail Kshevetskiy

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

Quoted 9 lines

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

Quoted 3 lines

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