mirror of
https://git.codelinaro.org/clo/qsdk/oss/boot/u-boot-2016.git
synced 2025-12-10 07:44:53 +01:00
ipq5018: Support for Compressed ART caldata
This code update add support in tiny spi-nor flash for uncompressing the ART partition and read the mac address. This support GZIP and LZMA compression Signed-off-by: Vandhiadevan Karunamoorthy <vkarunam@codeaurora.org> Change-Id: I699cebeb98748116ab7e3b1412d33562a4aa9d6d
This commit is contained in:
parent
577c8ba9dc
commit
b36a6b7023
4 changed files with 49 additions and 2 deletions
|
|
@ -48,4 +48,7 @@ config NAND_FLASH
|
|||
config GEPHY
|
||||
bool "Enable Internel GEPHY for ipq5018"
|
||||
|
||||
config ART_COMPRESSED
|
||||
bool "Enable uncompress support for ipq5018"
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -23,7 +23,11 @@
|
|||
#include <spi.h>
|
||||
#include <spi_flash.h>
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ART_COMPRESSED) && \
|
||||
(defined(CONFIG_GZIP) || defined(CONFIG_LZMA))
|
||||
#include <mapmem.h>
|
||||
#include <lzma/LzmaTools.h>
|
||||
#endif
|
||||
#ifdef CONFIG_QCA_MMC
|
||||
#ifndef CONFIG_SDHCI_SUPPORT
|
||||
extern qca_mmc mmc_host;
|
||||
|
|
@ -52,6 +56,10 @@ int get_eth_mac_address(uchar *enetaddr, uint no_of_macs)
|
|||
#endif
|
||||
#ifdef CONFIG_IPQ_TINY_SPI_NOR
|
||||
struct spi_flash *flash = NULL;
|
||||
#if defined(CONFIG_ART_COMPRESSED) && (defined(CONFIG_GZIP) || defined(CONFIG_LZMA))
|
||||
void *load_buf, *image_buf;
|
||||
unsigned long img_size;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (sfi->flash_type != SMEM_BOOT_MMC_FLASH) {
|
||||
|
|
@ -85,7 +93,33 @@ int get_eth_mac_address(uchar *enetaddr, uint no_of_macs)
|
|||
printf("No SPI flash device found\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
ret = spi_flash_read(flash, art_offset, length, enetaddr);
|
||||
#if defined(CONFIG_ART_COMPRESSED) && (defined(CONFIG_GZIP) || defined(CONFIG_LZMA))
|
||||
image_buf = map_sysmem(CONFIG_SYS_LOAD_ADDR, 0);
|
||||
load_buf = map_sysmem(CONFIG_SYS_LOAD_ADDR + 0x100000, 0);
|
||||
img_size = qca_smem_flash_info.flash_block_size * size_blocks;
|
||||
ret = spi_flash_read(flash, art_offset, img_size, image_buf);
|
||||
if (ret == 0) {
|
||||
ret = -1;
|
||||
#ifdef CONFIG_GZIP
|
||||
ret = gunzip(load_buf, img_size, image_buf, &img_size);
|
||||
#endif
|
||||
#ifdef CONFIG_LZMA
|
||||
if (ret != 0)
|
||||
ret = lzmaBuffToBuffDecompress(load_buf,
|
||||
(SizeT *)&img_size,
|
||||
image_buf,
|
||||
(SizeT)img_size);
|
||||
#endif
|
||||
if (ret == 0) {
|
||||
memcpy(enetaddr, load_buf, length);
|
||||
} else {
|
||||
printf("Invalid compression type..\n");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
ret = spi_flash_read(flash, art_offset, length, enetaddr);
|
||||
#endif
|
||||
}
|
||||
/*
|
||||
* Avoid unused warning
|
||||
|
|
|
|||
|
|
@ -330,3 +330,8 @@ CONFIG_LZMA=y
|
|||
#
|
||||
CONFIG_SYS_THUMB_BUILD=y
|
||||
CONFIG_HAS_THUMB2=y
|
||||
|
||||
#
|
||||
# ART uncompression support
|
||||
#
|
||||
CONFIG_ART_COMPRESSED=y
|
||||
|
|
|
|||
|
|
@ -373,4 +373,9 @@ extern loff_t board_env_size;
|
|||
#undef CONFIG_BOOTM_RTEMS
|
||||
#undef CONFIG_BOOTM_VXWORKS
|
||||
|
||||
#ifdef CONFIG_ART_COMPRESSED
|
||||
#undef CONFIG_GZIP
|
||||
#undef CONFIG_ZLIB
|
||||
#endif
|
||||
|
||||
#endif /* _IPQ5018_H */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue