diff options
author | Simon Glass <sjg@chromium.org> | 2014-10-23 18:58:52 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2014-11-21 04:43:17 +0100 |
commit | f3cc44f9849fa7682d759621a74fb189a994e3b2 (patch) | |
tree | d65f60627666cc2a9301e99d340c72db51cb3ac0 /lib | |
parent | 76489832b28d158dd341b8992006576584cd204b (diff) | |
download | u-boot-f3cc44f9849fa7682d759621a74fb189a994e3b2.tar.gz u-boot-f3cc44f9849fa7682d759621a74fb189a994e3b2.tar.xz u-boot-f3cc44f9849fa7682d759621a74fb189a994e3b2.zip |
fdt: Enhance flashmap function to deal with region properties
Flash regions can optionally be compressed or hashed. Add the ability to
read this information from the flashmap.
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Tom Rini <trini@ti.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fdtdec.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 749f66ecc2..4dbd6aee85 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -703,6 +703,7 @@ int fdtdec_decode_region(const void *blob, int node, const char *prop_name, int fdtdec_read_fmap_entry(const void *blob, int node, const char *name, struct fmap_entry *entry) { + const char *prop; u32 reg[2]; if (fdtdec_get_int_array(blob, node, "reg", reg, 2)) { @@ -711,6 +712,13 @@ int fdtdec_read_fmap_entry(const void *blob, int node, const char *name, } entry->offset = reg[0]; entry->length = reg[1]; + entry->used = fdtdec_get_int(blob, node, "used", entry->length); + prop = fdt_getprop(blob, node, "compress", NULL); + entry->compress_algo = prop && !strcmp(prop, "lzo") ? + FMAP_COMPRESS_LZO : FMAP_COMPRESS_NONE; + prop = fdt_getprop(blob, node, "hash", &entry->hash_size); + entry->hash_algo = prop ? FMAP_HASH_SHA256 : FMAP_HASH_NONE; + entry->hash = (uint8_t *)prop; return 0; } |