-/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
<GIC_SPI 367 IRQ_TYPE_EDGE_RISING>,
<GIC_SPI 368 IRQ_TYPE_EDGE_RISING>,
<GIC_SPI 369 IRQ_TYPE_EDGE_RISING>;
- clocks = <&clock_gcc clk_aggre1_noc_clk>;
- clock-names = "smmu_aggre1_noc_clk";
- #clock-cells = <1>;
+ qcom,msm-bus,name = "smmu-bus-client-anoc1";
+ qcom,msm-bus,num-cases = <2>;
+ qcom,msm-bus,active-only;
+ qcom,msm-bus,num-paths = <1>;
+ /* aggre1_noc_clk */
+ qcom,msm-bus,vectors-KBps =
+ <84 10062 0 0>,
+ <84 10062 0 1000>;
};
anoc2_smmu: arm,smmu-anoc2@16c0000 {
<GIC_SPI 463 IRQ_TYPE_EDGE_RISING>,
<GIC_SPI 464 IRQ_TYPE_EDGE_RISING>,
<GIC_SPI 465 IRQ_TYPE_EDGE_RISING>;
- clocks = <&clock_gcc clk_aggre2_noc_clk>;
- clock-names = "smmu_aggre2_noc_clk";
- #clock-cells = <1>;
+ qcom,msm-bus,name = "smmu-bus-client-anoc2";
+ qcom,msm-bus,num-cases = <2>;
+ qcom,msm-bus,active-only;
+ qcom,msm-bus,num-paths = <1>;
+ /* aggre2_noc_clk */
+ qcom,msm-bus,vectors-KBps =
+ <117 10065 0 0>,
+ <117 10065 0 1000>;
};
lpass_q6_smmu: arm,smmu-lpass_q6@5100000 {
<GIC_SPI 272 IRQ_TYPE_LEVEL_HIGH>;
vdd-supply = <&gdsc_bimc_smmu>;
clocks = <&clock_mmss clk_mmss_mnoc_ahb_clk>,
- <&clock_gcc clk_mmssnoc_axi_clk>,
<&clock_mmss clk_mmss_bimc_smmu_ahb_clk>,
<&clock_mmss clk_mmss_bimc_smmu_axi_clk>;
clock-names = "mmss_mnoc_ahb_clk",
- "mmssnoc_axi_clk",
"mmss_bimc_smmu_ahb_clk",
"mmss_bimc_smmu_axi_clk";
#clock-cells = <1>;
- qcom,bus-master-id = <MSM_BUS_MNOC_BIMC_MAS>;
+ qcom,msm-bus,name = "smmu-bus-client-mmss";
+ qcom,msm-bus,num-cases = <2>;
+ qcom,msm-bus,active-only;
+ qcom,msm-bus,num-paths = <2>;
+ /* ahb_clk_src, mmssnoc_axi_clk */
+ qcom,msm-bus,vectors-KBps =
+ <102 722 0 0>, <29 512 0 0>,
+ <102 722 0 1000>, <29 512 0 1000>;
};
kgsl_smmu: arm,smmu-kgsl@5040000 {
struct mutex power_lock;
unsigned int power_count;
- struct msm_bus_client_handle *bus_client;
- char *bus_client_name;
+ u32 bus_client;
+ struct msm_bus_scale_pdata *bus_pdata;
enum tz_smmu_device_id sec_id;
};
{
if (!smmu->bus_client)
return 0;
- return msm_bus_scale_update_bw(smmu->bus_client, 0, 1000);
+ return msm_bus_scale_client_update_request(smmu->bus_client, 1);
}
static int arm_smmu_unrequest_bus(struct arm_smmu_device *smmu)
{
if (!smmu->bus_client)
return 0;
- return msm_bus_scale_update_bw(smmu->bus_client, 0, 0);
+ return msm_bus_scale_client_update_request(smmu->bus_client, 0);
}
static int arm_smmu_disable_regulators(struct arm_smmu_device *smmu)
static int arm_smmu_init_bus_scaling(struct platform_device *pdev,
struct arm_smmu_device *smmu)
{
- u32 master_id;
-
- if (of_property_read_u32(pdev->dev.of_node, "qcom,bus-master-id",
- &master_id)) {
- dev_dbg(smmu->dev, "No bus scaling info\n");
+ if (!of_find_property(pdev->dev.of_node, "qcom,msm-bus,name", NULL)) {
+ dev_dbg(&pdev->dev, "No bus scaling info\n");
return 0;
}
- smmu->bus_client_name = devm_kasprintf(
- smmu->dev, GFP_KERNEL, "smmu-bus-client-%s",
- dev_name(smmu->dev));
-
- if (!smmu->bus_client_name)
- return -ENOMEM;
-
- smmu->bus_client = msm_bus_scale_register(
- master_id, MSM_BUS_SLAVE_EBI_CH0, smmu->bus_client_name, true);
- if (IS_ERR(&smmu->bus_client)) {
- int ret = PTR_ERR(smmu->bus_client);
+ smmu->bus_pdata = msm_bus_cl_get_pdata(pdev);
+ if (!smmu->bus_pdata) {
+ dev_err(&pdev->dev, "Unable to read bus-scaling from DT\n");
+ return -EINVAL;
+ }
- if (ret != -EPROBE_DEFER)
- dev_err(smmu->dev, "Bus client registration failed\n");
- return ret;
+ smmu->bus_client = msm_bus_scale_register_client(smmu->bus_pdata);
+ if (!smmu->bus_client) {
+ dev_err(&pdev->dev, "Bus client registration failed\n");
+ return -EINVAL;
}
return 0;
}
+static void arm_smmu_exit_bus_scaling(struct arm_smmu_device *smmu)
+{
+ if (smmu->bus_client)
+ msm_bus_scale_unregister_client(smmu->bus_client);
+ if (smmu->bus_pdata)
+ msm_bus_cl_clear_pdata(smmu->bus_pdata);
+
+ smmu->bus_client = 0;
+ smmu->bus_pdata = NULL;
+}
+
static int arm_smmu_parse_impl_def_registers(struct arm_smmu_device *smmu)
{
struct device *dev = smmu->dev;
free_irq(smmu->irqs[i], smmu);
out_put_masters:
+ arm_smmu_exit_bus_scaling(smmu);
for (node = rb_first(&smmu->masters); node; node = rb_next(node)) {
struct arm_smmu_master *master
= container_of(node, struct arm_smmu_master, node);
arm_smmu_power_off(smmu);
mutex_unlock(&smmu->attach_lock);
- msm_bus_scale_unregister(smmu->bus_client);
+ arm_smmu_exit_bus_scaling(smmu);
return 0;
}