ata: start separating SATA specific code from libata-core.c
[linux/fpc-iii.git] / drivers / iommu / arm-smmu-qcom.c
blob24c071c1d8b049987e809aaacff7676e9ab14b2b
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
4 */
6 #include <linux/qcom_scm.h>
8 #include "arm-smmu.h"
10 struct qcom_smmu {
11 struct arm_smmu_device smmu;
14 static int qcom_sdm845_smmu500_reset(struct arm_smmu_device *smmu)
16 int ret;
18 arm_mmu500_reset(smmu);
21 * To address performance degradation in non-real time clients,
22 * such as USB and UFS, turn off wait-for-safe on sdm845 based boards,
23 * such as MTP and db845, whose firmwares implement secure monitor
24 * call handlers to turn on/off the wait-for-safe logic.
26 ret = qcom_scm_qsmmu500_wait_safe_toggle(0);
27 if (ret)
28 dev_warn(smmu->dev, "Failed to turn off SAFE logic\n");
30 return ret;
33 static const struct arm_smmu_impl qcom_smmu_impl = {
34 .reset = qcom_sdm845_smmu500_reset,
37 struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu)
39 struct qcom_smmu *qsmmu;
41 qsmmu = devm_kzalloc(smmu->dev, sizeof(*qsmmu), GFP_KERNEL);
42 if (!qsmmu)
43 return ERR_PTR(-ENOMEM);
45 qsmmu->smmu = *smmu;
47 qsmmu->smmu.impl = &qcom_smmu_impl;
48 devm_kfree(smmu->dev, smmu);
50 return &qsmmu->smmu;