cros_ec: Add a function for reading a flash map entry

A flash map describes the layout of flash memory in terms of offsets and
sizes for each region. Add a function to read a flash map entry from the
device tree.

Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2014-02-27 13:26:01 -07:00
parent cecb19c03f
commit 006e73b9ca
2 changed files with 42 additions and 0 deletions

View File

@@ -530,4 +530,22 @@ const u8 *fdtdec_locate_byte_array(const void *blob, int node,
*/
int fdtdec_decode_region(const void *blob, int node,
const char *prop_name, void **ptrp, size_t *size);
/* A flash map entry, containing an offset and length */
struct fmap_entry {
uint32_t offset;
uint32_t length;
};
/**
* Read a flash entry from the fdt
*
* @param blob FDT blob
* @param node Offset of node to read
* @param name Name of node being read
* @param entry Place to put offset and size of this node
* @return 0 if ok, -ve on error
*/
int fdtdec_read_fmap_entry(const void *blob, int node, const char *name,
struct fmap_entry *entry);
#endif