diff options
Diffstat (limited to 'recipes-kernel/linux/linux-yocto/generic-drivers/icc')
9 files changed, 651 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0001-interconnect-qcom-icc-rpm-Add-AB-IB-calculations-coe.patch b/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0001-interconnect-qcom-icc-rpm-Add-AB-IB-calculations-coe.patch new file mode 100644 index 0000000..6b8e76f --- /dev/null +++ b/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0001-interconnect-qcom-icc-rpm-Add-AB-IB-calculations-coe.patch @@ -0,0 +1,97 @@ +From dd014803f260b337daaabcde259daf70d5b26b5e Mon Sep 17 00:00:00 2001 +From: Konrad Dybcio <konrad.dybcio@linaro.org> +Date: Fri, 25 Aug 2023 17:38:23 +0200 +Subject: [PATCH 1/9] interconnect: qcom: icc-rpm: Add AB/IB calculations + coefficients + +Presumably due to the hardware being so complex, some nodes (or busses) +have different (usually higher) requirements for bandwidth than what +the usual calculations would suggest. + +Looking at the available downstream files, it seems like AB values are +adjusted per-bus and IB values are adjusted per-node. +With that in mind, introduce percentage-based coefficient struct members +and use them in the calculations. + +One thing to note is that the IB coefficient is inverse (100/ib_percent) +which feels a bit backwards, but it's necessary for precision.. + +Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> +Link: https://lore.kernel.org/r/20230726-topic-icc_coeff-v4-1-c04b60caa467@linaro.org +Signed-off-by: Georgi Djakov <djakov@kernel.org> +Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git dd014803f260] +--- + drivers/interconnect/qcom/icc-rpm.c | 18 +++++++++++++++--- + drivers/interconnect/qcom/icc-rpm.h | 6 ++++++ + 2 files changed, 21 insertions(+), 3 deletions(-) + +diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c +index 2c16917ba1fd..8b02aa8aa96a 100644 +--- a/drivers/interconnect/qcom/icc-rpm.c ++++ b/drivers/interconnect/qcom/icc-rpm.c +@@ -298,7 +298,8 @@ static int qcom_icc_bw_aggregate(struct icc_node *node, u32 tag, u32 avg_bw, + */ + static void qcom_icc_bus_aggregate(struct icc_provider *provider, u64 *agg_clk_rate) + { +- u64 agg_avg_rate, agg_rate; ++ struct qcom_icc_provider *qp = to_qcom_provider(provider); ++ u64 agg_avg_rate, agg_peak_rate, agg_rate; + struct qcom_icc_node *qn; + struct icc_node *node; + int i; +@@ -315,8 +316,19 @@ static void qcom_icc_bus_aggregate(struct icc_provider *provider, u64 *agg_clk_r + else + agg_avg_rate = qn->sum_avg[i]; + +- agg_rate = max_t(u64, agg_avg_rate, qn->max_peak[i]); +- do_div(agg_rate, qn->buswidth); ++ if (qp->ab_coeff) { ++ agg_avg_rate = agg_avg_rate * qp->ab_coeff; ++ agg_avg_rate = div_u64(agg_avg_rate, 100); ++ } ++ ++ if (qp->ib_coeff) { ++ agg_peak_rate = qn->max_peak[i] * 100; ++ agg_peak_rate = div_u64(qn->max_peak[i], qp->ib_coeff); ++ } else { ++ agg_peak_rate = qn->max_peak[i]; ++ } ++ ++ agg_rate = max_t(u64, agg_avg_rate, agg_peak_rate); + + agg_clk_rate[i] = max_t(u64, agg_clk_rate[i], agg_rate); + } +diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h +index eed3451af3e6..5e7d6a4fd2f3 100644 +--- a/drivers/interconnect/qcom/icc-rpm.h ++++ b/drivers/interconnect/qcom/icc-rpm.h +@@ -44,6 +44,8 @@ struct rpm_clk_resource { + * @type: the ICC provider type + * @regmap: regmap for QoS registers read/write access + * @qos_offset: offset to QoS registers ++ * @ab_coeff: a percentage-based coefficient for compensating the AB calculations ++ * @ib_coeff: an inverse-percentage-based coefficient for compensating the IB calculations + * @bus_clk_rate: bus clock rate in Hz + * @bus_clk_desc: a pointer to a rpm_clk_resource description of bus clocks + * @bus_clk: a pointer to a HLOS-owned bus clock +@@ -57,6 +59,8 @@ struct qcom_icc_provider { + enum qcom_icc_type type; + struct regmap *regmap; + unsigned int qos_offset; ++ u16 ab_coeff; ++ u16 ib_coeff; + u32 bus_clk_rate[QCOM_SMD_RPM_STATE_NUM]; + const struct rpm_clk_resource *bus_clk_desc; + struct clk *bus_clk; +@@ -123,6 +127,8 @@ struct qcom_icc_desc { + enum qcom_icc_type type; + const struct regmap_config *regmap_cfg; + unsigned int qos_offset; ++ u16 ab_coeff; ++ u16 ib_coeff; + }; + + /* Valid for all bus types */ +-- +2.39.2 + diff --git a/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0002-interconnect-qcom-icc-rpm-Separate-out-clock-rate-ca.patch b/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0002-interconnect-qcom-icc-rpm-Separate-out-clock-rate-ca.patch new file mode 100644 index 0000000..be1d79f --- /dev/null +++ b/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0002-interconnect-qcom-icc-rpm-Separate-out-clock-rate-ca.patch @@ -0,0 +1,100 @@ +From db8fc1002c53bc17a3ca6fad2c524de42b77c146 Mon Sep 17 00:00:00 2001 +From: Konrad Dybcio <konrad.dybcio@linaro.org> +Date: Fri, 25 Aug 2023 17:38:24 +0200 +Subject: [PATCH 2/9] interconnect: qcom: icc-rpm: Separate out clock rate + calulcations + +In preparation for also setting per-node clock rates, separate out the +logic that computes it. + +Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> +Link: https://lore.kernel.org/r/20230726-topic-icc_coeff-v4-2-c04b60caa467@linaro.org +Signed-off-by: Georgi Djakov <djakov@kernel.org> +Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git db8fc1002c53] +--- + drivers/interconnect/qcom/icc-rpm.c | 53 ++++++++++++++++------------- + 1 file changed, 30 insertions(+), 23 deletions(-) + +diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c +index 8b02aa8aa96a..8c1bfd65d774 100644 +--- a/drivers/interconnect/qcom/icc-rpm.c ++++ b/drivers/interconnect/qcom/icc-rpm.c +@@ -291,6 +291,32 @@ static int qcom_icc_bw_aggregate(struct icc_node *node, u32 tag, u32 avg_bw, + return 0; + } + ++static u64 qcom_icc_calc_rate(struct qcom_icc_provider *qp, struct qcom_icc_node *qn, int ctx) ++{ ++ u64 agg_avg_rate, agg_peak_rate, agg_rate; ++ ++ if (qn->channels) ++ agg_avg_rate = div_u64(qn->sum_avg[ctx], qn->channels); ++ else ++ agg_avg_rate = qn->sum_avg[ctx]; ++ ++ if (qp->ab_coeff) { ++ agg_avg_rate = agg_avg_rate * qp->ab_coeff; ++ agg_avg_rate = div_u64(agg_avg_rate, 100); ++ } ++ ++ if (qp->ib_coeff) { ++ agg_peak_rate = qn->max_peak[ctx] * 100; ++ agg_peak_rate = div_u64(qn->max_peak[ctx], qp->ib_coeff); ++ } else { ++ agg_peak_rate = qn->max_peak[ctx]; ++ } ++ ++ agg_rate = max_t(u64, agg_avg_rate, agg_peak_rate); ++ ++ return div_u64(agg_rate, qn->buswidth); ++} ++ + /** + * qcom_icc_bus_aggregate - calculate bus clock rates by traversing all nodes + * @provider: generic interconnect provider +@@ -299,10 +325,9 @@ static int qcom_icc_bw_aggregate(struct icc_node *node, u32 tag, u32 avg_bw, + static void qcom_icc_bus_aggregate(struct icc_provider *provider, u64 *agg_clk_rate) + { + struct qcom_icc_provider *qp = to_qcom_provider(provider); +- u64 agg_avg_rate, agg_peak_rate, agg_rate; + struct qcom_icc_node *qn; + struct icc_node *node; +- int i; ++ int ctx; + + /* + * Iterate nodes on the provider, aggregate bandwidth requests for +@@ -310,27 +335,9 @@ static void qcom_icc_bus_aggregate(struct icc_provider *provider, u64 *agg_clk_r + */ + list_for_each_entry(node, &provider->nodes, node_list) { + qn = node->data; +- for (i = 0; i < QCOM_SMD_RPM_STATE_NUM; i++) { +- if (qn->channels) +- agg_avg_rate = div_u64(qn->sum_avg[i], qn->channels); +- else +- agg_avg_rate = qn->sum_avg[i]; +- +- if (qp->ab_coeff) { +- agg_avg_rate = agg_avg_rate * qp->ab_coeff; +- agg_avg_rate = div_u64(agg_avg_rate, 100); +- } +- +- if (qp->ib_coeff) { +- agg_peak_rate = qn->max_peak[i] * 100; +- agg_peak_rate = div_u64(qn->max_peak[i], qp->ib_coeff); +- } else { +- agg_peak_rate = qn->max_peak[i]; +- } +- +- agg_rate = max_t(u64, agg_avg_rate, agg_peak_rate); +- +- agg_clk_rate[i] = max_t(u64, agg_clk_rate[i], agg_rate); ++ for (ctx = 0; ctx < QCOM_SMD_RPM_STATE_NUM; ctx++) { ++ agg_clk_rate[ctx] = max_t(u64, agg_clk_rate[ctx], ++ qcom_icc_calc_rate(qp, qn, ctx)); + } + } + } +-- +2.39.2 + diff --git a/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0003-interconnect-qcom-icc-rpm-Let-nodes-drive-their-own-.patch b/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0003-interconnect-qcom-icc-rpm-Let-nodes-drive-their-own-.patch new file mode 100644 index 0000000..f71cf3d --- /dev/null +++ b/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0003-interconnect-qcom-icc-rpm-Let-nodes-drive-their-own-.patch @@ -0,0 +1,99 @@ +From 919791d82d3b878094e9edc39b0d9a4eafcc0860 Mon Sep 17 00:00:00 2001 +From: Konrad Dybcio <konrad.dybcio@linaro.org> +Date: Fri, 25 Aug 2023 17:38:25 +0200 +Subject: [PATCH 3/9] interconnect: qcom: icc-rpm: Let nodes drive their own + bus clock + +If this hardware couldn't get messier, some nodes are supposed to drive +their own bus clock.. Presumably to connect to some intermediate +interface between the node itself and the bus it's (supposed to be) +connected to. + +Expand the node struct with the necessary data and hook up the +allocations & calculations. + +Note that the node-specific AB/IB coefficients contribute (by design) +to both the node-level and the bus-level aggregation. + +Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> +Link: https://lore.kernel.org/r/20230726-topic-icc_coeff-v4-3-c04b60caa467@linaro.org +Signed-off-by: Georgi Djakov <djakov@kernel.org> +Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 919791d82d3b] +--- + drivers/interconnect/qcom/icc-rpm.c | 27 +++++++++++++++++++++++++++ + drivers/interconnect/qcom/icc-rpm.h | 4 ++++ + 2 files changed, 31 insertions(+) + +diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c +index 8c1bfd65d774..1d3af4e9ead8 100644 +--- a/drivers/interconnect/qcom/icc-rpm.c ++++ b/drivers/interconnect/qcom/icc-rpm.c +@@ -414,6 +414,33 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) + qp->bus_clk_rate[QCOM_SMD_RPM_SLEEP_STATE] = sleep_rate; + } + ++ /* Handle the node-specific clock */ ++ if (!src_qn->bus_clk_desc) ++ return 0; ++ ++ active_rate = qcom_icc_calc_rate(qp, src_qn, QCOM_SMD_RPM_ACTIVE_STATE); ++ sleep_rate = qcom_icc_calc_rate(qp, src_qn, QCOM_SMD_RPM_SLEEP_STATE); ++ ++ if (active_rate != src_qn->bus_clk_rate[QCOM_SMD_RPM_ACTIVE_STATE]) { ++ ret = qcom_icc_rpm_set_bus_rate(src_qn->bus_clk_desc, QCOM_SMD_RPM_ACTIVE_STATE, ++ active_rate); ++ if (ret) ++ return ret; ++ ++ /* Cache the rate after we've successfully committed it to RPM */ ++ src_qn->bus_clk_rate[QCOM_SMD_RPM_ACTIVE_STATE] = active_rate; ++ } ++ ++ if (sleep_rate != src_qn->bus_clk_rate[QCOM_SMD_RPM_SLEEP_STATE]) { ++ ret = qcom_icc_rpm_set_bus_rate(src_qn->bus_clk_desc, QCOM_SMD_RPM_SLEEP_STATE, ++ sleep_rate); ++ if (ret) ++ return ret; ++ ++ /* Cache the rate after we've successfully committed it to RPM */ ++ src_qn->bus_clk_rate[QCOM_SMD_RPM_SLEEP_STATE] = sleep_rate; ++ } ++ + return 0; + } + +diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h +index 5e7d6a4fd2f3..725e0d4840e4 100644 +--- a/drivers/interconnect/qcom/icc-rpm.h ++++ b/drivers/interconnect/qcom/icc-rpm.h +@@ -97,11 +97,13 @@ struct qcom_icc_qos { + * @num_links: the total number of @links + * @channels: number of channels at this node (e.g. DDR channels) + * @buswidth: width of the interconnect between a node and the bus (bytes) ++ * @bus_clk_desc: a pointer to a rpm_clk_resource description of bus clocks + * @sum_avg: current sum aggregate value of all avg bw requests + * @max_peak: current max aggregate value of all peak bw requests + * @mas_rpm_id: RPM id for devices that are bus masters + * @slv_rpm_id: RPM id for devices that are bus slaves + * @qos: NoC QoS setting parameters ++ * @bus_clk_rate: a pointer to an array containing bus clock rates in Hz + */ + struct qcom_icc_node { + unsigned char *name; +@@ -110,11 +112,13 @@ struct qcom_icc_node { + u16 num_links; + u16 channels; + u16 buswidth; ++ const struct rpm_clk_resource *bus_clk_desc; + u64 sum_avg[QCOM_SMD_RPM_STATE_NUM]; + u64 max_peak[QCOM_SMD_RPM_STATE_NUM]; + int mas_rpm_id; + int slv_rpm_id; + struct qcom_icc_qos qos; ++ u32 bus_clk_rate[QCOM_SMD_RPM_STATE_NUM]; + }; + + struct qcom_icc_desc { +-- +2.39.2 + diff --git a/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0004-interconnect-qcom-icc-rpm-Check-for-node-specific-ra.patch b/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0004-interconnect-qcom-icc-rpm-Check-for-node-specific-ra.patch new file mode 100644 index 0000000..faee1be --- /dev/null +++ b/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0004-interconnect-qcom-icc-rpm-Check-for-node-specific-ra.patch @@ -0,0 +1,82 @@ +From ba3f826639782587b70a684dae79d39f6d3c433e Mon Sep 17 00:00:00 2001 +From: Konrad Dybcio <konrad.dybcio@linaro.org> +Date: Fri, 25 Aug 2023 17:38:26 +0200 +Subject: [PATCH 4/9] interconnect: qcom: icc-rpm: Check for node-specific rate + coefficients + +Some nodes may have different coefficients than the general values for +bus they're attached to. Check for that and use them if present. See +[1], [2] for reference. + +[1] https://github.com/sonyxperiadev/kernel/commit/7456d9779af9ad6bb9c7ee6f33d5c5a8d3648e24 +[2] https://github.com/artem/android_kernel_sony_msm8996/commit/bf7a8985dcaf0eab5bc2562d2d6775e7e29c0f30 +Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> +Link: https://lore.kernel.org/r/20230726-topic-icc_coeff-v4-4-c04b60caa467@linaro.org +Signed-off-by: Georgi Djakov <djakov@kernel.org> +Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git ba3f82663978] +--- + drivers/interconnect/qcom/icc-rpm.c | 14 ++++++++++---- + drivers/interconnect/qcom/icc-rpm.h | 4 ++++ + 2 files changed, 14 insertions(+), 4 deletions(-) + +diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c +index 1d3af4e9ead8..9c40314e03b5 100644 +--- a/drivers/interconnect/qcom/icc-rpm.c ++++ b/drivers/interconnect/qcom/icc-rpm.c +@@ -300,14 +300,14 @@ static u64 qcom_icc_calc_rate(struct qcom_icc_provider *qp, struct qcom_icc_node + else + agg_avg_rate = qn->sum_avg[ctx]; + +- if (qp->ab_coeff) { +- agg_avg_rate = agg_avg_rate * qp->ab_coeff; ++ if (qn->ab_coeff) { ++ agg_avg_rate = agg_avg_rate * qn->ab_coeff; + agg_avg_rate = div_u64(agg_avg_rate, 100); + } + +- if (qp->ib_coeff) { ++ if (qn->ib_coeff) { + agg_peak_rate = qn->max_peak[ctx] * 100; +- agg_peak_rate = div_u64(qn->max_peak[ctx], qp->ib_coeff); ++ agg_peak_rate = div_u64(qn->max_peak[ctx], qn->ib_coeff); + } else { + agg_peak_rate = qn->max_peak[ctx]; + } +@@ -563,6 +563,12 @@ int qnoc_probe(struct platform_device *pdev) + for (i = 0; i < num_nodes; i++) { + size_t j; + ++ if (!qnodes[i]->ab_coeff) ++ qnodes[i]->ab_coeff = qp->ab_coeff; ++ ++ if (!qnodes[i]->ib_coeff) ++ qnodes[i]->ib_coeff = qp->ib_coeff; ++ + node = icc_node_create(qnodes[i]->id); + if (IS_ERR(node)) { + ret = PTR_ERR(node); +diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h +index 725e0d4840e4..4abf99ce2690 100644 +--- a/drivers/interconnect/qcom/icc-rpm.h ++++ b/drivers/interconnect/qcom/icc-rpm.h +@@ -103,6 +103,8 @@ struct qcom_icc_qos { + * @mas_rpm_id: RPM id for devices that are bus masters + * @slv_rpm_id: RPM id for devices that are bus slaves + * @qos: NoC QoS setting parameters ++ * @ab_coeff: a percentage-based coefficient for compensating the AB calculations ++ * @ib_coeff: an inverse-percentage-based coefficient for compensating the IB calculations + * @bus_clk_rate: a pointer to an array containing bus clock rates in Hz + */ + struct qcom_icc_node { +@@ -118,6 +120,8 @@ struct qcom_icc_node { + int mas_rpm_id; + int slv_rpm_id; + struct qcom_icc_qos qos; ++ u16 ab_coeff; ++ u16 ib_coeff; + u32 bus_clk_rate[QCOM_SMD_RPM_STATE_NUM]; + }; + +-- +2.39.2 + diff --git a/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0005-interconnect-qcom-qcm2290-Hook-up-MAS_APPS_PROC-s-bu.patch b/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0005-interconnect-qcom-qcm2290-Hook-up-MAS_APPS_PROC-s-bu.patch new file mode 100644 index 0000000..4a0bbb4 --- /dev/null +++ b/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0005-interconnect-qcom-qcm2290-Hook-up-MAS_APPS_PROC-s-bu.patch @@ -0,0 +1,69 @@ +From fa35757ae0a5a88bd1b7df8578ee9dac9d147c64 Mon Sep 17 00:00:00 2001 +From: Konrad Dybcio <konrad.dybcio@linaro.org> +Date: Fri, 25 Aug 2023 17:38:27 +0200 +Subject: [PATCH 5/9] interconnect: qcom: qcm2290: Hook up MAS_APPS_PROC's bus + clock + +This single node has its own clock which seems to be responsible for +transactions between CPUSS (CPU + some stuff) and the GNOC. See [1] +for reference. + +Define it and hook it up. + +[1] https://android.googlesource.com/kernel/msm-extra/devicetree/+/02f8c342b23c20a5cf967df649814be37a08227c%5E%21/#F0 +Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> +Link: https://lore.kernel.org/r/20230726-topic-icc_coeff-v4-5-c04b60caa467@linaro.org +Signed-off-by: Georgi Djakov <djakov@kernel.org> +Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git fa35757ae0a5] +--- + drivers/interconnect/qcom/icc-rpm-clocks.c | 6 ++++++ + drivers/interconnect/qcom/icc-rpm.h | 1 + + drivers/interconnect/qcom/qcm2290.c | 3 +++ + 3 files changed, 10 insertions(+) + +diff --git a/drivers/interconnect/qcom/icc-rpm-clocks.c b/drivers/interconnect/qcom/icc-rpm-clocks.c +index 63c82a91bbc7..ac1677de7dfd 100644 +--- a/drivers/interconnect/qcom/icc-rpm-clocks.c ++++ b/drivers/interconnect/qcom/icc-rpm-clocks.c +@@ -25,6 +25,12 @@ const struct rpm_clk_resource bimc_clk = { + }; + EXPORT_SYMBOL_GPL(bimc_clk); + ++const struct rpm_clk_resource mem_1_clk = { ++ .resource_type = QCOM_SMD_RPM_MEM_CLK, ++ .clock_id = 1, ++}; ++EXPORT_SYMBOL_GPL(mem_1_clk); ++ + const struct rpm_clk_resource bus_0_clk = { + .resource_type = QCOM_SMD_RPM_BUS_CLK, + .clock_id = 0, +diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h +index 4abf99ce2690..a13768cfd231 100644 +--- a/drivers/interconnect/qcom/icc-rpm.h ++++ b/drivers/interconnect/qcom/icc-rpm.h +@@ -152,6 +152,7 @@ extern const struct rpm_clk_resource bimc_clk; + extern const struct rpm_clk_resource bus_0_clk; + extern const struct rpm_clk_resource bus_1_clk; + extern const struct rpm_clk_resource bus_2_clk; ++extern const struct rpm_clk_resource mem_1_clk; + extern const struct rpm_clk_resource mmaxi_0_clk; + extern const struct rpm_clk_resource mmaxi_1_clk; + extern const struct rpm_clk_resource qup_clk; +diff --git a/drivers/interconnect/qcom/qcm2290.c b/drivers/interconnect/qcom/qcm2290.c +index 5bc4b7516608..026e4c82d6d4 100644 +--- a/drivers/interconnect/qcom/qcm2290.c ++++ b/drivers/interconnect/qcom/qcm2290.c +@@ -112,6 +112,9 @@ static struct qcom_icc_node mas_appss_proc = { + .qos.qos_mode = NOC_QOS_MODE_FIXED, + .qos.prio_level = 0, + .qos.areq_prio = 0, ++ .bus_clk_desc = &mem_1_clk, ++ .ab_coeff = 159, ++ .ib_coeff = 96, + .mas_rpm_id = 0, + .slv_rpm_id = -1, + .num_links = ARRAY_SIZE(mas_appss_proc_links), +-- +2.39.2 + diff --git a/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0006-interconnect-qcom-qcm2290-Set-AB-coefficients.patch b/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0006-interconnect-qcom-qcm2290-Set-AB-coefficients.patch new file mode 100644 index 0000000..3062f49 --- /dev/null +++ b/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0006-interconnect-qcom-qcm2290-Set-AB-coefficients.patch @@ -0,0 +1,47 @@ +From 8657ed471196f4dc8e7917453a39363e0014840c Mon Sep 17 00:00:00 2001 +From: Konrad Dybcio <konrad.dybcio@linaro.org> +Date: Fri, 25 Aug 2023 17:38:28 +0200 +Subject: [PATCH 6/9] interconnect: qcom: qcm2290: Set AB coefficients + +Some buses need additional manual adjustments atop the usual +calculations. Fill in the missing coefficients. + +Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> +Link: https://lore.kernel.org/r/20230726-topic-icc_coeff-v4-6-c04b60caa467@linaro.org +Signed-off-by: Georgi Djakov <djakov@kernel.org> +Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 8657ed471196] +--- + drivers/interconnect/qcom/qcm2290.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/interconnect/qcom/qcm2290.c b/drivers/interconnect/qcom/qcm2290.c +index 026e4c82d6d4..7abc0c449220 100644 +--- a/drivers/interconnect/qcom/qcm2290.c ++++ b/drivers/interconnect/qcom/qcm2290.c +@@ -1202,6 +1202,7 @@ static const struct qcom_icc_desc qcm2290_bimc = { + .keep_alive = true, + /* M_REG_BASE() in vendor msm_bus_bimc_adhoc driver */ + .qos_offset = 0x8000, ++ .ab_coeff = 153, + }; + + static struct qcom_icc_node * const qcm2290_cnoc_nodes[] = { +@@ -1332,6 +1333,7 @@ static const struct qcom_icc_desc qcm2290_mmnrt_virt = { + .regmap_cfg = &qcm2290_snoc_regmap_config, + .keep_alive = true, + .qos_offset = 0x15000, ++ .ab_coeff = 142, + }; + + static struct qcom_icc_node * const qcm2290_mmrt_virt_nodes[] = { +@@ -1348,6 +1350,7 @@ static const struct qcom_icc_desc qcm2290_mmrt_virt = { + .regmap_cfg = &qcm2290_snoc_regmap_config, + .keep_alive = true, + .qos_offset = 0x15000, ++ .ab_coeff = 139, + }; + + static const struct of_device_id qcm2290_noc_of_match[] = { +-- +2.39.2 + diff --git a/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0007-interconnect-qcom-qcm2290-Update-EBI-channel-configu.patch b/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0007-interconnect-qcom-qcm2290-Update-EBI-channel-configu.patch new file mode 100644 index 0000000..c6960d8 --- /dev/null +++ b/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0007-interconnect-qcom-qcm2290-Update-EBI-channel-configu.patch @@ -0,0 +1,43 @@ +From 550064a85ba564cfb508a995f45e39a6ad0e26ed Mon Sep 17 00:00:00 2001 +From: Konrad Dybcio <konrad.dybcio@linaro.org> +Date: Fri, 25 Aug 2023 17:38:29 +0200 +Subject: [PATCH 7/9] interconnect: qcom: qcm2290: Update EBI channel + configuration + +QCM2290 can support two memory configurations: single-channel, 32-bit +wide LPDDR3 @ up to 933MHz (bus clock) or dual-channel, 16-bit wide +LPDDR4X @ up to 1804 MHz. The interconnect driver in its current form +seems to gravitate towards the first one, however there are no LPDDR3- +equipped boards upstream and we still don't have a great way to discern +the DDR generations on the kernel side. + +To make DDR scaling possible on the only currently-supported 2290 +board, stick with the LPDDR4X config by default. The side effect on any +potential LPDDR3 board would be that the requested bus clock rate is +too high (but still capped to the firmware-configured FMAX). + +Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> +Link: https://lore.kernel.org/r/20230726-topic-icc_coeff-v4-7-c04b60caa467@linaro.org +Signed-off-by: Georgi Djakov <djakov@kernel.org> +Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 550064a85ba5] +--- + drivers/interconnect/qcom/qcm2290.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/interconnect/qcom/qcm2290.c b/drivers/interconnect/qcom/qcm2290.c +index 7abc0c449220..b88cf9a022e0 100644 +--- a/drivers/interconnect/qcom/qcm2290.c ++++ b/drivers/interconnect/qcom/qcm2290.c +@@ -678,7 +678,8 @@ static struct qcom_icc_node mas_gfx3d = { + static struct qcom_icc_node slv_ebi1 = { + .name = "slv_ebi1", + .id = QCM2290_SLAVE_EBI1, +- .buswidth = 8, ++ .buswidth = 4, ++ .channels = 2, + .mas_rpm_id = -1, + .slv_rpm_id = 0, + }; +-- +2.39.2 + diff --git a/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0008-interconnect-qcom-sdm660-Set-AB-IB-coefficients.patch b/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0008-interconnect-qcom-sdm660-Set-AB-IB-coefficients.patch new file mode 100644 index 0000000..af67d8c --- /dev/null +++ b/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0008-interconnect-qcom-sdm660-Set-AB-IB-coefficients.patch @@ -0,0 +1,55 @@ +From a4a9251760185af9ca7ff1592a05a0eabfe0cd00 Mon Sep 17 00:00:00 2001 +From: Konrad Dybcio <konrad.dybcio@linaro.org> +Date: Fri, 25 Aug 2023 17:38:30 +0200 +Subject: [PATCH 8/9] interconnect: qcom: sdm660: Set AB/IB coefficients + +Some buses and nodes need additional manual adjustments atop the usual +calculations. Fill in the missing coefficients. + +Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> +Link: https://lore.kernel.org/r/20230726-topic-icc_coeff-v4-8-c04b60caa467@linaro.org +Signed-off-by: Georgi Djakov <djakov@kernel.org> +Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git a4a925176018] +--- + drivers/interconnect/qcom/sdm660.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/interconnect/qcom/sdm660.c b/drivers/interconnect/qcom/sdm660.c +index 36962f7bd7bb..7392bebba334 100644 +--- a/drivers/interconnect/qcom/sdm660.c ++++ b/drivers/interconnect/qcom/sdm660.c +@@ -602,6 +602,7 @@ static struct qcom_icc_node mas_mdp_p0 = { + .name = "mas_mdp_p0", + .id = SDM660_MASTER_MDP_P0, + .buswidth = 16, ++ .ib_coeff = 50, + .mas_rpm_id = 8, + .slv_rpm_id = -1, + .qos.ap_owned = true, +@@ -621,6 +622,7 @@ static struct qcom_icc_node mas_mdp_p1 = { + .name = "mas_mdp_p1", + .id = SDM660_MASTER_MDP_P1, + .buswidth = 16, ++ .ib_coeff = 50, + .mas_rpm_id = 61, + .slv_rpm_id = -1, + .qos.ap_owned = true, +@@ -1540,6 +1542,7 @@ static const struct qcom_icc_desc sdm660_bimc = { + .num_nodes = ARRAY_SIZE(sdm660_bimc_nodes), + .bus_clk_desc = &bimc_clk, + .regmap_cfg = &sdm660_bimc_regmap_config, ++ .ab_coeff = 153, + }; + + static struct qcom_icc_node * const sdm660_cnoc_nodes[] = { +@@ -1659,6 +1662,7 @@ static const struct qcom_icc_desc sdm660_mnoc = { + .intf_clocks = mm_intf_clocks, + .num_intf_clocks = ARRAY_SIZE(mm_intf_clocks), + .regmap_cfg = &sdm660_mnoc_regmap_config, ++ .ab_coeff = 153, + }; + + static struct qcom_icc_node * const sdm660_snoc_nodes[] = { +-- +2.39.2 + diff --git a/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0009-interconnect-qcom-msm8996-Set-AB-IB-coefficients.patch b/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0009-interconnect-qcom-msm8996-Set-AB-IB-coefficients.patch new file mode 100644 index 0000000..ff49eb0 --- /dev/null +++ b/recipes-kernel/linux/linux-yocto/generic-drivers/icc/0009-interconnect-qcom-msm8996-Set-AB-IB-coefficients.patch @@ -0,0 +1,59 @@ +From 1255f23c219a74f2577c9ca5521abeb36db35d3b Mon Sep 17 00:00:00 2001 +From: Konrad Dybcio <konrad.dybcio@linaro.org> +Date: Fri, 25 Aug 2023 17:38:31 +0200 +Subject: [PATCH 9/9] interconnect: qcom: msm8996: Set AB/IB coefficients + +Some buses and nodes need additional manual adjustments atop the usual +calculations. Fill in the missing coefficients. + +Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> +Link: https://lore.kernel.org/r/20230726-topic-icc_coeff-v4-9-c04b60caa467@linaro.org +Signed-off-by: Georgi Djakov <djakov@kernel.org> +Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 1255f23c219a] +--- + drivers/interconnect/qcom/msm8996.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/interconnect/qcom/msm8996.c b/drivers/interconnect/qcom/msm8996.c +index 88683dfa468f..b73566c9b21f 100644 +--- a/drivers/interconnect/qcom/msm8996.c ++++ b/drivers/interconnect/qcom/msm8996.c +@@ -448,6 +448,7 @@ static struct qcom_icc_node mas_mdp_p0 = { + .name = "mas_mdp_p0", + .id = MSM8996_MASTER_MDP_PORT0, + .buswidth = 32, ++ .ib_coeff = 25, + .mas_rpm_id = 8, + .slv_rpm_id = -1, + .qos.ap_owned = true, +@@ -463,6 +464,7 @@ static struct qcom_icc_node mas_mdp_p1 = { + .name = "mas_mdp_p1", + .id = MSM8996_MASTER_MDP_PORT1, + .buswidth = 32, ++ .ib_coeff = 25, + .mas_rpm_id = 61, + .slv_rpm_id = -1, + .qos.ap_owned = true, +@@ -1889,7 +1891,8 @@ static const struct qcom_icc_desc msm8996_bimc = { + .nodes = bimc_nodes, + .num_nodes = ARRAY_SIZE(bimc_nodes), + .bus_clk_desc = &bimc_clk, +- .regmap_cfg = &msm8996_bimc_regmap_config ++ .regmap_cfg = &msm8996_bimc_regmap_config, ++ .ab_coeff = 154, + }; + + static struct qcom_icc_node * const cnoc_nodes[] = { +@@ -2004,7 +2007,8 @@ static const struct qcom_icc_desc msm8996_mnoc = { + .bus_clk_desc = &mmaxi_0_clk, + .intf_clocks = mm_intf_clocks, + .num_intf_clocks = ARRAY_SIZE(mm_intf_clocks), +- .regmap_cfg = &msm8996_mnoc_regmap_config ++ .regmap_cfg = &msm8996_mnoc_regmap_config, ++ .ab_coeff = 154, + }; + + static struct qcom_icc_node * const pnoc_nodes[] = { +-- +2.39.2 + |