Commit c9fb5658 authored by Leonard Crestez's avatar Leonard Crestez Committed by Jason Liu
Browse files

MLK-16560-3: imx8: config_smmu_fdt: Support mmu-masters binding



This is deprecated in favor of the generic iommus binding but xen only
supports this older version.
Signed-off-by: default avatarLeonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: default avatarYe Li <ye.li@nxp.com>
Acked-by: default avatarPeng Fan <peng.fan@nxp.com>
parent 27914af9
...@@ -978,10 +978,34 @@ static int config_smmu_fdt_device_sid(void *blob, int device_offset, int sid) ...@@ -978,10 +978,34 @@ static int config_smmu_fdt_device_sid(void *blob, int device_offset, int sid)
/* assign master sid based on iommu properties in fdt */ /* assign master sid based on iommu properties in fdt */
static int config_smmu_fdt(void *blob) static int config_smmu_fdt(void *blob)
{ {
int offset, proplen; int offset, proplen, i;
const fdt32_t *prop; const fdt32_t *prop;
const char *name; const char *name;
/* Legacy smmu bindings, still used by xen. */
offset = fdt_node_offset_by_compatible(blob, 0, "arm,mmu-500");
if (offset > 0 && (prop = fdt_getprop(blob, offset, "mmu-masters", &proplen)))
{
debug("found legacy mmu-masters property\n");
for (i = 0; i < proplen / 8; ++i) {
uint32_t phandle = fdt32_to_cpu(prop[2 * i]);
int sid = fdt32_to_cpu(prop[2 * i + 1]);
int device_offset;
device_offset = fdt_node_offset_by_phandle(blob, phandle);
if (device_offset < 0) {
error("Failed to fetch device reference from mmu_masters: %d", device_offset);
continue;
}
config_smmu_fdt_device_sid(blob, device_offset, sid);
}
/* Ignore new bindings if old bindings found, just like linux. */
return 0;
}
/* Generic smmu bindings */
offset = 0; offset = 0;
while ((offset = fdt_next_node(blob, offset, NULL)) > 0) while ((offset = fdt_next_node(blob, offset, NULL)) > 0)
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment