summaryrefslogtreecommitdiff
path: root/drivers/platform
diff options
context:
space:
mode:
authorHamad Kadmany <hkadmany@codeaurora.org>2016-12-26 14:57:52 +0200
committerHamad Kadmany <hkadmany@codeaurora.org>2016-12-26 14:57:52 +0200
commitea31a9294643707072ffb18794e5d91880ea962d (patch)
tree4145caa916b4ea125541b691a7f3dae0f01f6e50 /drivers/platform
parent5142c18bae30439decd1c139999b54197e2aae91 (diff)
msm_11ad: Add option to enable SMMU fastmap
Option added not to bypass SMMU and use fastmap DMA APIs for 11ad use-cases. SMMU address range is changed to have the max possible. Change-Id: I073ab59cc4ef1b71545a9e77b76d94f09d659aac CRs-Fixed: 1105323 Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/msm/msm_11ad/msm_11ad.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/drivers/platform/msm/msm_11ad/msm_11ad.c b/drivers/platform/msm/msm_11ad/msm_11ad.c
index 5810f7bf7f2f..b7fc68a6efdd 100644
--- a/drivers/platform/msm/msm_11ad/msm_11ad.c
+++ b/drivers/platform/msm/msm_11ad/msm_11ad.c
@@ -33,7 +33,7 @@
#define WIGIG_DEVICE (0x0310)
#define SMMU_BASE 0x10000000 /* Device address range base */
-#define SMMU_SIZE 0x40000000 /* Device address range size */
+#define SMMU_SIZE ((SZ_1G * 4ULL) - SMMU_BASE)
#define WIGIG_ENABLE_DELAY 50
#define PM_OPT_SUSPEND (MSM_PCIE_CONFIG_NO_CFG_RESTORE | \
@@ -87,6 +87,8 @@ struct msm11ad_ctx {
/* SMMU */
bool use_smmu; /* have SMMU enabled? */
+ int smmu_bypass;
+ int smmu_fast_map;
struct dma_iommu_mapping *mapping;
/* bus frequency scaling */
@@ -596,11 +598,13 @@ static int msm_11ad_smmu_init(struct msm11ad_ctx *ctx)
{
int atomic_ctx = 1;
int rc;
- int bypass_enable = 1;
if (!ctx->use_smmu)
return 0;
+ dev_info(ctx->dev, "Initialize SMMU, bypass = %d, fastmap = %d\n",
+ ctx->smmu_bypass, ctx->smmu_fast_map);
+
ctx->mapping = arm_iommu_create_mapping(&platform_bus_type,
SMMU_BASE, SMMU_SIZE);
if (IS_ERR_OR_NULL(ctx->mapping)) {
@@ -608,7 +612,6 @@ static int msm_11ad_smmu_init(struct msm11ad_ctx *ctx)
dev_err(ctx->dev, "Failed to create IOMMU mapping (%d)\n", rc);
return rc;
}
- dev_info(ctx->dev, "IOMMU mapping created: %p\n", ctx->mapping);
rc = iommu_domain_set_attr(ctx->mapping->domain,
DOMAIN_ATTR_ATOMIC,
@@ -619,13 +622,24 @@ static int msm_11ad_smmu_init(struct msm11ad_ctx *ctx)
goto release_mapping;
}
- rc = iommu_domain_set_attr(ctx->mapping->domain,
- DOMAIN_ATTR_S1_BYPASS,
- &bypass_enable);
- if (rc) {
- dev_err(ctx->dev, "Set bypass attribute to SMMU failed (%d)\n",
- rc);
- goto release_mapping;
+ if (ctx->smmu_bypass) {
+ rc = iommu_domain_set_attr(ctx->mapping->domain,
+ DOMAIN_ATTR_S1_BYPASS,
+ &ctx->smmu_bypass);
+ if (rc) {
+ dev_err(ctx->dev, "Set bypass attribute to SMMU failed (%d)\n",
+ rc);
+ goto release_mapping;
+ }
+ } else if (ctx->smmu_fast_map) {
+ rc = iommu_domain_set_attr(ctx->mapping->domain,
+ DOMAIN_ATTR_FAST,
+ &ctx->smmu_fast_map);
+ if (rc) {
+ dev_err(ctx->dev, "Set fast attribute to SMMU failed (%d)\n",
+ rc);
+ goto release_mapping;
+ }
}
rc = arm_iommu_attach_device(&ctx->pcidev->dev, ctx->mapping);
@@ -870,6 +884,9 @@ static int msm_11ad_probe(struct platform_device *pdev)
ctx->use_smmu = of_property_read_bool(of_node, "qcom,smmu-support");
ctx->bus_scale = msm_bus_cl_get_pdata(pdev);
+ ctx->smmu_bypass = 1;
+ ctx->smmu_fast_map = 0;
+
/*== execute ==*/
/* turn device on */
rc = msm_11ad_init_vregs(ctx);