Skip to content
Snippets Groups Projects
Commit be59e85d authored by Laura Abbott's avatar Laura Abbott
Browse files

cma: Add support for different size_cells and address_cells


Currently, the CMA flat device tree code does not take into account
targets that may specify size_cells and address_cells > 1. This will
lead to unsuccessful parsing. Add support for taking into account
nodes that may specify size_cells and address_cells explicitly.

Change-Id: I9ea63b8c34e903b186c29ec6555dd7a5c317c602
Signed-off-by: default avatarLaura Abbott <lauraa@codeaurora.org>
parent dc077d46
No related branches found
No related tags found
No related merge requests found
...@@ -220,16 +220,26 @@ int __init cma_fdt_scan(unsigned long node, const char *uname, ...@@ -220,16 +220,26 @@ int __init cma_fdt_scan(unsigned long node, const char *uname,
__be32 *prop; __be32 *prop;
char *name; char *name;
bool in_system; bool in_system;
unsigned long size_cells = dt_root_size_cells;
unsigned long addr_cells = dt_root_addr_cells;
if (!of_get_flat_dt_prop(node, "linux,contiguous-region", NULL)) if (!of_get_flat_dt_prop(node, "linux,contiguous-region", NULL))
return 0; return 0;
prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
if (prop)
size_cells = be32_to_cpu(prop);
prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
if (prop)
addr_cells = be32_to_cpu(prop);
prop = of_get_flat_dt_prop(node, "reg", &len); prop = of_get_flat_dt_prop(node, "reg", &len);
if (!prop || (len != 2 * sizeof(unsigned long))) if (!prop || depth != 2)
return 0; return 0;
base = be32_to_cpu(prop[0]); base = dt_mem_next_cell(addr_cells, &prop);
size = be32_to_cpu(prop[1]); size = dt_mem_next_cell(size_cells, &prop);
name = of_get_flat_dt_prop(node, "label", NULL); name = of_get_flat_dt_prop(node, "label", NULL);
in_system = in_system =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment