1 From 02638b2627104cd02aff7484bb250d029e05dc5f Mon Sep 17 00:00:00 2001
2 From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
3 Date: Tue, 3 Apr 2018 18:08:48 +0300
4 Subject: [PATCH] soc/fsl/qman: map FQD and PFDR areas in the iommu
6 Add a one-to-one iommu mapping for qman private data memory areas
7 (FQD and PFDR). This is required for QMAN to work without faults
10 Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
12 drivers/soc/fsl/qbman/qman_ccsr.c | 15 +++++++++++++++
13 1 file changed, 15 insertions(+)
15 --- a/drivers/soc/fsl/qbman/qman_ccsr.c
16 +++ b/drivers/soc/fsl/qbman/qman_ccsr.c
20 #include "qman_priv.h"
21 +#include <linux/iommu.h>
24 EXPORT_SYMBOL(qman_ip_rev);
25 @@ -755,6 +756,7 @@ static int fsl_qman_probe(struct platfor
27 struct device *dev = &pdev->dev;
28 struct device_node *node = dev->of_node;
29 + struct iommu_domain *domain;
33 @@ -834,6 +836,19 @@ static int fsl_qman_probe(struct platfor
35 dev_dbg(dev, "Allocated PFDR 0x%llx 0x%zx\n", pfdr_a, pfdr_sz);
37 + /* Create an 1-to-1 iommu mapping for fqd and pfdr areas */
38 + domain = iommu_get_domain_for_dev(dev);
40 + ret = iommu_map(domain, fqd_a, fqd_a, fqd_sz,
41 + IOMMU_READ | IOMMU_WRITE | IOMMU_CACHE);
43 + dev_warn(dev, "iommu_map(fqd) failed %d\n", ret);
44 + ret = iommu_map(domain, pfdr_a, pfdr_a, pfdr_sz,
45 + IOMMU_READ | IOMMU_WRITE | IOMMU_CACHE);
47 + dev_warn(dev, "iommu_map(pfdr) failed %d\n", ret);
50 ret = qman_init_ccsr(dev);
52 dev_err(dev, "CCSR setup failed\n");