Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -220,16 +220,26 @@ int __init cma_fdt_scan(unsigned long node, const char *uname,
	__be32 *prop;
	char *name;
	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))
		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);
	if (!prop || (len != 2 * sizeof(unsigned long)))
	if (!prop || depth != 2)
		return 0;

	base = be32_to_cpu(prop[0]);
	size = be32_to_cpu(prop[1]);
	base = dt_mem_next_cell(addr_cells, &prop);
	size = dt_mem_next_cell(size_cells, &prop);

	name = of_get_flat_dt_prop(node, "label", NULL);
	in_system =