aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShravan Karthik2017-09-08 01:24:09 -0500
committerNikhil Devshatwar2017-09-27 04:41:42 -0500
commite53eaa08999e2e75103cbf7373a819b0f5718d04 (patch)
tree518f4d4aeb0407813fde6ea97deeb53495fdb10c
parente8d8a79a0c99b450ea3a4e95832861a52adc31a9 (diff)
downloadinfoadas-u-boot-e53eaa08999e2e75103cbf7373a819b0f5718d04.tar.gz
infoadas-u-boot-e53eaa08999e2e75103cbf7373a819b0f5718d04.tar.xz
infoadas-u-boot-e53eaa08999e2e75103cbf7373a819b0f5718d04.zip
spl: dra7xx: Add support to decompress lzop compressed images
Lzop compressed image reduce the binary size by ~75% subsequently decreasing the time needed to load image from permanent storage. The compressed image is read from storage as part of loading the remote-core binary and is decompressed to the load-address specified for each core Change-Id: I7607575f6f43480b913580b525d12573edd6be9e
-rw-r--r--board/ti/dra7xx/lateattach.c21
-rw-r--r--common/spl/spl_mmc.c5
-rw-r--r--include/configs/dra7xx_evm.h2
-rw-r--r--include/configs/ti_omap5_common.h5
-rw-r--r--include/omap_remoteproc.h5
-rw-r--r--lib/Makefile1
6 files changed, 33 insertions, 6 deletions
diff --git a/board/ti/dra7xx/lateattach.c b/board/ti/dra7xx/lateattach.c
index b0458d62bbd1..aa9dbf8e2fa9 100644
--- a/board/ti/dra7xx/lateattach.c
+++ b/board/ti/dra7xx/lateattach.c
@@ -17,6 +17,7 @@
17#include <asm/io.h> 17#include <asm/io.h>
18#include <omap_remoteproc.h> 18#include <omap_remoteproc.h>
19#include <elf.h> 19#include <elf.h>
20#include <linux/lzo.h>
20 21
21#define DPLL_TIMEOUT 5000 22#define DPLL_TIMEOUT 5000
22#define L4_CFG_TARG 0x4A000000 23#define L4_CFG_TARG 0x4A000000
@@ -1176,8 +1177,9 @@ struct rproc ipu1_config = {
1176 .page_table_addr = DRA7_PGTBL_BASE_IPU1, 1177 .page_table_addr = DRA7_PGTBL_BASE_IPU1,
1177 .mmu_base_addr = {0x58882000, 0}, 1178 .mmu_base_addr = {0x58882000, 0},
1178 .load_addr = IPU1_LOAD_ADDR, 1179 .load_addr = IPU1_LOAD_ADDR,
1180 .comp_addr = IPU1_COMP_ADDR,
1179 .core_name = "IPU1", 1181 .core_name = "IPU1",
1180 .firmware_name = "dra7-ipu1-fw.xem4", 1182 .firmware_name = "dra7-ipu1-fw.lzop",
1181#ifdef CONFIG_MMC_IPU1_PART_NAME 1183#ifdef CONFIG_MMC_IPU1_PART_NAME
1182 .ptn = CONFIG_MMC_IPU1_PART_NAME, 1184 .ptn = CONFIG_MMC_IPU1_PART_NAME,
1183#else 1185#else
@@ -1197,8 +1199,9 @@ struct rproc ipu2_config = {
1197 .page_table_addr = DRA7_PGTBL_BASE_IPU2, 1199 .page_table_addr = DRA7_PGTBL_BASE_IPU2,
1198 .mmu_base_addr = {0x55082000, 0}, 1200 .mmu_base_addr = {0x55082000, 0},
1199 .load_addr = IPU2_LOAD_ADDR, 1201 .load_addr = IPU2_LOAD_ADDR,
1202 .comp_addr = IPU2_COMP_ADDR,
1200 .core_name = "IPU2", 1203 .core_name = "IPU2",
1201 .firmware_name = "dra7-ipu2-fw.xem4", 1204 .firmware_name = "dra7-ipu2-fw.lzop",
1202#ifdef CONFIG_MMC_IPU2_PART_NAME 1205#ifdef CONFIG_MMC_IPU2_PART_NAME
1203 .ptn = CONFIG_MMC_IPU2_PART_NAME, 1206 .ptn = CONFIG_MMC_IPU2_PART_NAME,
1204#else 1207#else
@@ -1218,8 +1221,9 @@ struct rproc dsp1_config = {
1218 .page_table_addr = DRA7_PGTBL_BASE_DSP1, 1221 .page_table_addr = DRA7_PGTBL_BASE_DSP1,
1219 .mmu_base_addr = {0x40D01000, 0x40D02000}, 1222 .mmu_base_addr = {0x40D01000, 0x40D02000},
1220 .load_addr = DSP1_LOAD_ADDR, 1223 .load_addr = DSP1_LOAD_ADDR,
1224 .comp_addr = DSP1_COMP_ADDR,
1221 .core_name = "DSP1", 1225 .core_name = "DSP1",
1222 .firmware_name = "dra7-dsp1-fw.xe66", 1226 .firmware_name = "dra7-dsp1-fw.lzop",
1223#ifdef CONFIG_MMC_DSP1_PART_NAME 1227#ifdef CONFIG_MMC_DSP1_PART_NAME
1224 .ptn = CONFIG_MMC_DSP1_PART_NAME, 1228 .ptn = CONFIG_MMC_DSP1_PART_NAME,
1225#else 1229#else
@@ -1239,8 +1243,9 @@ struct rproc dsp2_config = {
1239 .page_table_addr = DRA7_PGTBL_BASE_DSP2, 1243 .page_table_addr = DRA7_PGTBL_BASE_DSP2,
1240 .mmu_base_addr = {0x41501000, 0x41502000}, 1244 .mmu_base_addr = {0x41501000, 0x41502000},
1241 .load_addr = DSP2_LOAD_ADDR, 1245 .load_addr = DSP2_LOAD_ADDR,
1246 .comp_addr = DSP2_COMP_ADDR,
1242 .core_name = "DSP2", 1247 .core_name = "DSP2",
1243 .firmware_name = "dra7-dsp2-fw.xe66", 1248 .firmware_name = "dra7-dsp2-fw.lzop",
1244#ifdef CONFIG_MMC_DSP2_PART_NAME 1249#ifdef CONFIG_MMC_DSP2_PART_NAME
1245 .ptn = CONFIG_MMC_DSP2_PART_NAME, 1250 .ptn = CONFIG_MMC_DSP2_PART_NAME,
1246#else 1251#else
@@ -1265,6 +1270,7 @@ u32 spl_boot_core(u32 core_id)
1265 struct rproc *cfg = NULL; 1270 struct rproc *cfg = NULL;
1266 unsigned long load_elf_status = 0; 1271 unsigned long load_elf_status = 0;
1267 int tablesz; 1272 int tablesz;
1273 u32 decomp_len, inp_len;
1268 1274
1269 if ((core_id == 0) || (core_id >= RPROC_END_ENUMS)) { 1275 if ((core_id == 0) || (core_id >= RPROC_END_ENUMS)) {
1270 debug("Invalid core id speicified: %d\n", core_id); 1276 debug("Invalid core id speicified: %d\n", core_id);
@@ -1272,6 +1278,13 @@ u32 spl_boot_core(u32 core_id)
1272 } 1278 }
1273 1279
1274 cfg = rproc_cfg_arr[core_id]; 1280 cfg = rproc_cfg_arr[core_id];
1281 /* Check if a compressed image is present */
1282 decomp_len = MAX_REMOTECORE_BIN_SIZE;
1283 inp_len = MAX_REMOTECORE_BIN_SIZE;
1284
1285 if(lzop_decompress((u8 *) cfg->comp_addr, inp_len,
1286 (u8 *) cfg->load_addr, &decomp_len) != 0)
1287 return 1;
1275 1288
1276 /* Check for valid elf image */ 1289 /* Check for valid elf image */
1277 if (!valid_elf_image_local(cfg->load_addr)) 1290 if (!valid_elf_image_local(cfg->load_addr))
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index c6bd1b589353..2aa0b404c931 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -571,11 +571,12 @@ u32 spl_mmc_load_core(u32 core_id, u32 boot_device)
571 err = 1; 571 err = 1;
572 } 572 }
573 } else { 573 } else {
574 /* load the remotecore image */ 574 /* load the remotecore image to compressed address defined. Once the image
575 is loaded its decompressed to the load address defined for each core*/
575 err = spl_load_file_fat(&mmc->block_dev, 576 err = spl_load_file_fat(&mmc->block_dev,
576 CONFIG_SYS_MMCSD_FS_BOOT_PARTITION, 577 CONFIG_SYS_MMCSD_FS_BOOT_PARTITION,
577 cfg->firmware_name, 578 cfg->firmware_name,
578 (u8 *)cfg->load_addr); 579 (u8 *)cfg->comp_addr);
579 } 580 }
580 581
581 if (err <= 0) { 582 if (err <= 0) {
diff --git a/include/configs/dra7xx_evm.h b/include/configs/dra7xx_evm.h
index 8c6a7803d1ca..ff2c95cd8e7e 100644
--- a/include/configs/dra7xx_evm.h
+++ b/include/configs/dra7xx_evm.h
@@ -320,6 +320,8 @@
320#define CONFIG_PCF8575_GPIO 320#define CONFIG_PCF8575_GPIO
321#endif 321#endif
322 322
323#define CONFIG_LZO
324
323/* JAMR3 board pin mux */ 325/* JAMR3 board pin mux */
324#define CONFIG_DRA7XX_JAMR3 326#define CONFIG_DRA7XX_JAMR3
325 327
diff --git a/include/configs/ti_omap5_common.h b/include/configs/ti_omap5_common.h
index 13008ec3cbf5..ff12c95916fd 100644
--- a/include/configs/ti_omap5_common.h
+++ b/include/configs/ti_omap5_common.h
@@ -247,6 +247,11 @@
247#define DSP1_LOAD_ADDR (IPU2_LOAD_ADDR+MAX_REMOTECORE_BIN_SIZE) 247#define DSP1_LOAD_ADDR (IPU2_LOAD_ADDR+MAX_REMOTECORE_BIN_SIZE)
248#define DSP2_LOAD_ADDR (DSP1_LOAD_ADDR+MAX_REMOTECORE_BIN_SIZE) 248#define DSP2_LOAD_ADDR (DSP1_LOAD_ADDR+MAX_REMOTECORE_BIN_SIZE)
249 249
250#define IPU1_COMP_ADDR (DSP2_LOAD_ADDR+MAX_REMOTECORE_BIN_SIZE)
251#define IPU2_COMP_ADDR (IPU1_COMP_ADDR+MAX_REMOTECORE_BIN_SIZE)
252#define DSP1_COMP_ADDR (IPU2_COMP_ADDR+MAX_REMOTECORE_BIN_SIZE)
253#define DSP2_COMP_ADDR (DSP1_COMP_ADDR+MAX_REMOTECORE_BIN_SIZE)
254
250/* Define the GPT partition names only when they are used. 255/* Define the GPT partition names only when they are used.
251 * This prevents warnings of invalid GPT table when loading 256 * This prevents warnings of invalid GPT table when loading
252 * binaries from FAT partition. 257 * binaries from FAT partition.
diff --git a/include/omap_remoteproc.h b/include/omap_remoteproc.h
index 63bf9e282a50..463172ea773d 100644
--- a/include/omap_remoteproc.h
+++ b/include/omap_remoteproc.h
@@ -430,6 +430,10 @@ struct rproc_intmem_to_l3_mapping {
430 * storage for remotecore2 via EDMA while the CPU is processing the ELF image 430 * storage for remotecore2 via EDMA while the CPU is processing the ELF image
431 * of remotecore1. This address is in the memory view of the A15. 431 * of remotecore1. This address is in the memory view of the A15.
432 * 432 *
433 * @comp_addr: Address to which the bootloader loads the compressed firmware
434 * from persistent storage before decompressing it and loading it to the
435 * corresponding load_addr.
436 *
433 * @firmware_name: Name of the file that is expected to contain the ELF image. 437 * @firmware_name: Name of the file that is expected to contain the ELF image.
434 * 438 *
435 * @has_rsc_table: Flag populated after parsing the ELF binary on target. 439 * @has_rsc_table: Flag populated after parsing the ELF binary on target.
@@ -442,6 +446,7 @@ struct rproc {
442 unsigned long page_table_addr; 446 unsigned long page_table_addr;
443 unsigned long mmu_base_addr[MAX_NUM_IOMMU]; 447 unsigned long mmu_base_addr[MAX_NUM_IOMMU];
444 unsigned long load_addr; 448 unsigned long load_addr;
449 unsigned long comp_addr;
445 unsigned long entry_point; 450 unsigned long entry_point;
446 char *core_name; 451 char *core_name;
447 char *firmware_name; 452 char *firmware_name;
diff --git a/lib/Makefile b/lib/Makefile
index d1a4be5e42c6..5720d7926ac0 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -60,6 +60,7 @@ obj-$(CONFIG_$(SPL_)OF_CONTROL) += fdtdec.o
60ifdef CONFIG_SPL_BUILD 60ifdef CONFIG_SPL_BUILD
61obj-$(CONFIG_SPL_YMODEM_SUPPORT) += crc16.o 61obj-$(CONFIG_SPL_YMODEM_SUPPORT) += crc16.o
62obj-$(CONFIG_SPL_NET_SUPPORT) += net_utils.o 62obj-$(CONFIG_SPL_NET_SUPPORT) += net_utils.o
63obj-$(CONFIG_LZO) += lzo/
63endif 64endif
64obj-$(CONFIG_ADDR_MAP) += addr_map.o 65obj-$(CONFIG_ADDR_MAP) += addr_map.o
65obj-y += hashtable.o 66obj-y += hashtable.o