summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonard Crestez <leonard.crestez@nxp.com>2017-09-27 19:28:05 +0300
committerLeonard Crestez <leonard.crestez@nxp.com>2017-10-09 13:11:55 +0300
commit38d2113328872f9b61195866b11c1573e8889146 (patch)
treeec33b654a551503041154c61a7df1b021e7eb723
parent62237c5928ab98916994cc9e8a58fcc90bffb293 (diff)
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: Leonard Crestez <leonard.crestez@nxp.com> Reviewed-by: Ye Li <ye.li@nxp.com> Acked-by: Peng Fan <peng.fan@nxp.com>
-rw-r--r--arch/arm/cpu/armv8/imx8/cpu.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/arch/arm/cpu/armv8/imx8/cpu.c b/arch/arm/cpu/armv8/imx8/cpu.c
index d03f0fc952..b5caaf562e 100644
--- a/arch/arm/cpu/armv8/imx8/cpu.c
+++ b/arch/arm/cpu/armv8/imx8/cpu.c
@@ -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 */
static int config_smmu_fdt(void *blob)
{
- int offset, proplen;
+ int offset, proplen, i;
const fdt32_t *prop;
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;
while ((offset = fdt_next_node(blob, offset, NULL)) > 0)
{