1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
6 #include <linux/qcom_scm.h>
11 struct arm_smmu_device smmu
;
14 static int qcom_sdm845_smmu500_reset(struct arm_smmu_device
*smmu
)
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);
28 dev_warn(smmu
->dev
, "Failed to turn off SAFE logic\n");
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
);
43 return ERR_PTR(-ENOMEM
);
47 qsmmu
->smmu
.impl
= &qcom_smmu_impl
;
48 devm_kfree(smmu
->dev
, smmu
);