summaryrefslogtreecommitdiff
path: root/include/fdtdec.h
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@chromium.org>2018-06-11 13:07:09 -0600
committerSimon Glass <sjg@chromium.org>2018-07-09 09:11:00 -0600
commit90c08fa038451d6d7b7d8711bfd829b61d64c490 (patch)
tree7cfd0d58221ae95037dea8e435ef8b55ea2898d4 /include/fdtdec.h
parent8c5d4fd0ec222701598a27b26ab7265d4cee45a3 (diff)
downloadu-boot-90c08fa038451d6d7b7d8711bfd829b61d64c490.tar.gz
fdt: Add device tree memory bindings
Support a default memory bank, specified in reg, as well as board-specific memory banks in subtree board-id nodes. This allows memory information to be provided in the device tree, rather than hard-coded in, which will make it simpler to handle similar devices with different memory banks, as the board-id values or masks can be used to match devices. Signed-off-by: Michael Pratt <mpratt@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'include/fdtdec.h')
-rw-r--r--include/fdtdec.h38
1 files changed, 37 insertions, 1 deletions
diff --git a/include/fdtdec.h b/include/fdtdec.h
index c15b2a04a7..332105504b 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -41,6 +41,8 @@ struct fdt_memory {
fdt_addr_t end;
};
+struct bd_info;
+
#ifdef CONFIG_SPL_BUILD
#define SPL_BUILD 1
#else
@@ -993,6 +995,40 @@ int fdtdec_setup(void);
* Called when CONFIG_OF_BOARD is defined, or if CONFIG_OF_SEPARATE is defined
* and the board implements it.
*/
-void *board_fdt_blob_setup(void);
+
+/*
+ * Decode the size of memory
+ *
+ * RAM size is normally set in a /memory node and consists of a list of
+ * (base, size) cells in the 'reg' property. This information is used to
+ * determine the total available memory as well as the address and size
+ * of each bank.
+ *
+ * Optionally the memory configuration can vary depending on a board id,
+ * typically read from strapping resistors or an EEPROM on the board.
+ *
+ * Finally, memory size can be detected (within certain limits) by probing
+ * the available memory. It is safe to do so within the limits provides by
+ * the board's device tree information. This makes it possible to produce
+ * boards with different memory sizes, where the device tree specifies the
+ * maximum memory configuration, and the smaller memory configuration is
+ * probed.
+ *
+ * This function decodes that information, returning the memory base address,
+ * size and bank information. See the memory.txt binding for full
+ * documentation.
+ *
+ * @param blob Device tree blob
+ * @param area Name of node to check (NULL means "/memory")
+ * @param board_id Board ID to look up
+ * @param basep Returns base address of first memory bank (NULL to
+ * ignore)
+ * @param sizep Returns total memory size (NULL to ignore)
+ * @param bd Updated with the memory bank information (NULL to skip)
+ * @return 0 if OK, -ve on error
+ */
+int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id,
+ phys_addr_t *basep, phys_size_t *sizep,
+ struct bd_info *bd);
#endif