History log of /linux-master/drivers/interconnect/qcom/sdm660.c
Revision Date Author Comments
# 772f8890 31-Oct-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

interconnect: qcom: Make qnoc_remove return void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Several interconnect/qcom drivers use qnoc_remove() as remove callback.
Make this function return void (instead of unconditionally zero) and
adapt the drivers using this function accordingly.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20231031222851.3126434-12-u.kleine-koenig@pengutronix.de
Signed-off-by: Georgi Djakov <djakov@kernel.org>


# a4a92517 25-Aug-2023 Konrad Dybcio <konrad.dybcio@linaro.org>

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>


# cff66ace 14-Jul-2023 Rob Herring <robh@kernel.org>

interconnect: Explicitly include correct DT includes

The DT of_device.h and of_platform.h date back to the separate
of_platform_bus_type before it as merged into the regular platform bus.
As part of that merge prepping Arm DT support 13 years ago, they
"temporarily" include each other. They also include platform_device.h
and of.h. As a result, there's a pretty much random mix of those include
files used throughout the tree. In order to detangle these headers and
replace the implicit includes with struct declarations, users need to
explicitly include the correct includes.

Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230714174638.4058268-1-robh@kernel.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>


# 11f63efe 19-Jun-2023 Konrad Dybcio <konrad.dybcio@linaro.org>

interconnect: qcom: icc-rpm: Control bus rpmcc from icc

The sole purpose of bus clocks that were previously registered with
rpmcc was to convey the aggregated bandwidth to RPM. There's no good
reason to keep them outside the interconnect framework, as it only
adds to the plentiful complexity.

Add the required code to handle these clocks from within SMD RPM ICC.

RPM-owned bus clocks are no longer considered a thing, but sadly we
have to allow for the existence of HLOS-owned bus clocks, as some
(mostly older) SoCs (ab)use these for bus scaling (e.g. MSM8998 and
&mmcc AHB_CLK_SRC).

This in turn is trivially solved with a single *clk, which is filled
and used iff qp.bus_clk_desc is absent and we have a "bus" clock-names
entry in the DT node.

This change should(tm) be fully compatible with all sorts of old
Device Trees as far as the interconnect functionality goes (modulo
abusing bus clock handles or wrongly using the qcom,icc.h binding,
but that's a mistake in and of itself).

Reviewed-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Acked-by: Georgi Djakov <djakov@kernel.org>
Link: https://lore.kernel.org/r/20230526-topic-smd_icc-v7-17-09c78c175546@linaro.org
Signed-off-by: Bjorn Andersson <andersson@kernel.org>


# 70ab8dee 19-Jun-2023 Konrad Dybcio <konrad.dybcio@linaro.org>

interconnect: qcom: sdm660: Hook up RPM bus clk definitions

Assign the necessary definitions to migrate to the new bus clock
handling mechanism.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Acked-by: Georgi Djakov <djakov@kernel.org>
Link: https://lore.kernel.org/r/20230526-topic-smd_icc-v7-11-09c78c175546@linaro.org
Signed-off-by: Bjorn Andersson <andersson@kernel.org>


# 19ced2ae 19-Jun-2023 Konrad Dybcio <konrad.dybcio@linaro.org>

interconnect: qcom: Fold smd-rpm.h into icc-rpm.h

smd-rpm.h is not very useful as-is and both files are always included
anyway.. Combine them.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Acked-by: Georgi Djakov <djakov@kernel.org>
Link: https://lore.kernel.org/r/20230526-topic-smd_icc-v7-8-09c78c175546@linaro.org
Signed-off-by: Bjorn Andersson <andersson@kernel.org>


# 40cdeed6 19-Jun-2023 Konrad Dybcio <konrad.dybcio@linaro.org>

interconnect: qcom: Add missing headers in icc-rpm.h

Currently the header does not provide all the required dependencies.
Fix it.

Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Acked-by: Georgi Djakov <djakov@kernel.org>
Link: https://lore.kernel.org/r/20230526-topic-smd_icc-v7-7-09c78c175546@linaro.org
Signed-off-by: Bjorn Andersson <andersson@kernel.org>


# a867cf9b 07-Apr-2023 Konrad Dybcio <konrad.dybcio@linaro.org>

interconnect: qcom: icc-rpm: Enforce 2 or 0 bus clocks

For SMD RPM bus scaling to work, we need a pair of sleep-wake clocks.
The variable number of them we previously supported was only a hack
to keep the clocks required for QoS register access, but now that
these are separated, we can leave bus_clks to the actual bus clocks.

In cases where there is no actual bus scaling (such as A0NoC on MSM8996
and GNoC on SDM660 where the HLOS is only supposed to program the QoS
registers and the bus is either static or controlled remotely), allow
for no clock scaling with a boolean property.

Remove all the code related to allowing an arbitrary number of bus_clks,
replace the number by BUS_CLK_MAX (= 2) and guard the bus clock paths
to ensure they are not taken on non-scaling buses.

Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20230228-topic-qos-v8-6-ee696a2c15a9@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>


# 2e2113c8 18-May-2023 Konrad Dybcio <konrad.dybcio@linaro.org>

interconnect: qcom: rpm: Handle interface clocks

Some (but not all) providers (or their specific nodes) require
specific clocks to be turned on before they can be accessed. Failure
to ensure that results in a seemingly random system crash (which
would usually happen at boot with the interconnect driver built-in),
resulting in the platform not booting up properly.

Limit the number of bus_clocks to 2 (which is the maximum that SMD
RPM interconnect supports anyway) and handle non-scaling clocks
separately. Update MSM8996 and SDM660 drivers to make sure they do
not regress with this change.

This unfortunately has to be done in one patch to prevent either
compile errors or broken bisect.

Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20230518195801.2556998-1-konrad.dybcio@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>


# 6643b532 07-Apr-2023 Konrad Dybcio <konrad.dybcio@linaro.org>

interconnect: qcom: rpm: Rename icc desc clocks to bus_blocks

Rename the "clocks" (and _names) fields of qcom_icc_desc to
"bus_clocks" in preparation for introducing handling of clocks that
need to be enabled but not voted on with aggregate frequency.

Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20230228-topic-qos-v8-1-ee696a2c15a9@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>


# 2ccf33c0 11-Apr-2022 Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

interconnect: qcom: constify icc_node pointers

Pointers to struct qcom_icc_node (and similar structures) are not
modified, so they can be made const for safety. The contents of struct
qcom_icc_node must stay non-const.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220412102623.227607-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>


# 1625aaa3 11-Apr-2022 Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

interconnect: qcom: constify qcom_icc_desc

struct qcom_icc_desc is not modified so it can be made const for safety.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220412102623.227607-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>


# e9d54c26 14-Dec-2021 Shawn Guo <shawn.guo@linaro.org>

interconnect: icc-rpm: Define ICC device type

The driver currently uses .is_bimc_node to distinguish device type BIMC
from NOC. Define type for bus/noc devices like what downstream[1] does
to make support for more types easier.

[1] https://source.codeaurora.org/quic/la/kernel/msm-4.19/tree/drivers/soc/qcom/msm_bus/msm_bus_core.h?h=kernel.lnx.4.19.r22-rel#n46

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Link: https://lore.kernel.org/r/20211215002324.1727-2-shawn.guo@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>


# 2b6c7d64 03-Sep-2021 Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

interconnect: sdm660: merge common code into icc-rpm

Other RPM interconnect drivers might also use QoS support. Move AP-owned
nodes support from SDM660 driver to common icc-rpm.c.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Tested-by: Marijn Suijten <marijn.suijten@somainline.org>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Link: https://lore.kernel.org/r/20210903232421.1384199-5-dmitry.baryshkov@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>


# 656ba110 03-Sep-2021 Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

interconnect: sdm660: drop default/unused values

Simplify qnode setup by removing unused/default values.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Tested-by: Marijn Suijten <marijn.suijten@somainline.org>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Link: https://lore.kernel.org/r/20210903232421.1384199-4-dmitry.baryshkov@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>


# 7ae77e60 03-Sep-2021 Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

interconnect: sdm660: expand DEFINE_QNODE macros

Expand DEFINE_QNODE macros, which with an addition of QoS become an ugly
beast with tons of different arguments. While we are at it also move
links lists to separate arrays.

Suggested-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Tested-by: Marijn Suijten <marijn.suijten@somainline.org>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Link: https://lore.kernel.org/r/20210903232421.1384199-3-dmitry.baryshkov@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>


# 13404ac8 13-Sep-2021 Shawn Guo <shawn.guo@linaro.org>

interconnect: qcom: sdm660: Add missing a2noc qos clocks

It adds the missing a2noc clocks required for QoS registers programming
per downstream kernel[1]. Otherwise, qcom_icc_noc_set_qos_priority()
call on mas_ufs or mas_usb_hs node will simply result in a hardware hang
on SDM660 SoC.

[1] https://source.codeaurora.org/quic/la/kernel/msm-4.4/tree/arch/arm/boot/dts/qcom/sdm660-bus.dtsi?h=LA.UM.8.2.r1-04800-sdm660.0#n43

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Tested-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Link: https://lore.kernel.org/r/20210824043435.23190-3-shawn.guo@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>


# 5833c9b8 13-Sep-2021 Shawn Guo <shawn.guo@linaro.org>

interconnect: qcom: sdm660: Correct NOC_QOS_PRIORITY shift and mask

The NOC_QOS_PRIORITY shift and mask do not match what vendor kernel
defines [1]. Correct them per vendor kernel. As the result of
NOC_QOS_PRIORITY_P0_SHIFT being 0, the definition can be dropped and
regmap_update_bits() call on P0 can be simplified a bit.

[1] https://source.codeaurora.org/quic/la/kernel/msm-4.4/tree/drivers/soc/qcom/msm_bus/msm_bus_noc_adhoc.c?h=LA.UM.8.2.r1-04800-sdm660.0#n37

Fixes: f80a1d414328 ("interconnect: qcom: Add SDM660 interconnect provider driver")
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Link: https://lore.kernel.org/r/20210902054915.28689-1-shawn.guo@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>


# a06c2e5c 13-Sep-2021 Shawn Guo <shawn.guo@linaro.org>

interconnect: qcom: sdm660: Fix id of slv_cnoc_mnoc_cfg

The id of slv_cnoc_mnoc_cfg node is mistakenly coded as id of
slv_blsp_1. It causes the following warning on slv_blsp_1 node adding.
Correct the id of slv_cnoc_mnoc_cfg node.

[ 1.948180] ------------[ cut here ]------------
[ 1.954122] WARNING: CPU: 2 PID: 7 at drivers/interconnect/core.c:962 icc_node_add+0xe4/0xf8
[ 1.958994] Modules linked in:
[ 1.967399] CPU: 2 PID: 7 Comm: kworker/u16:0 Not tainted 5.14.0-rc6-next-20210818 #21
[ 1.970275] Hardware name: Xiaomi Redmi Note 7 (DT)
[ 1.978169] Workqueue: events_unbound deferred_probe_work_func
[ 1.982945] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 1.988849] pc : icc_node_add+0xe4/0xf8
[ 1.995699] lr : qnoc_probe+0x350/0x438
[ 1.999519] sp : ffff80001008bb10
[ 2.003337] x29: ffff80001008bb10 x28: 000000000000001a x27: ffffb83ddc61ee28
[ 2.006818] x26: ffff2fe341d44080 x25: ffff2fe340f3aa80 x24: ffffb83ddc98f0e8
[ 2.013938] x23: 0000000000000024 x22: ffff2fe3408b7400 x21: 0000000000000000
[ 2.021054] x20: ffff2fe3408b7410 x19: ffff2fe341d44080 x18: 0000000000000010
[ 2.028173] x17: ffff2fe3bdd0aac0 x16: 0000000000000281 x15: ffff2fe3400f5528
[ 2.035290] x14: 000000000000013f x13: ffff2fe3400f5528 x12: 00000000ffffffea
[ 2.042410] x11: ffffb83ddc9109d0 x10: ffffb83ddc8f8990 x9 : ffffb83ddc8f89e8
[ 2.049527] x8 : 0000000000017fe8 x7 : c0000000ffffefff x6 : 0000000000000001
[ 2.056645] x5 : 0000000000057fa8 x4 : 0000000000000000 x3 : ffffb83ddc9903b0
[ 2.063764] x2 : 1a1f6fde34d45500 x1 : ffff2fe340f3a880 x0 : ffff2fe340f3a880
[ 2.070882] Call trace:
[ 2.077989] icc_node_add+0xe4/0xf8
[ 2.080247] qnoc_probe+0x350/0x438
[ 2.083718] platform_probe+0x68/0xd8
[ 2.087191] really_probe+0xb8/0x300
[ 2.091011] __driver_probe_device+0x78/0xe0
[ 2.094659] driver_probe_device+0x80/0x110
[ 2.098911] __device_attach_driver+0x90/0xe0
[ 2.102818] bus_for_each_drv+0x78/0xc8
[ 2.107331] __device_attach+0xf0/0x150
[ 2.110977] device_initial_probe+0x14/0x20
[ 2.114796] bus_probe_device+0x9c/0xa8
[ 2.118963] deferred_probe_work_func+0x88/0xc0
[ 2.122784] process_one_work+0x1a4/0x338
[ 2.127296] worker_thread+0x1f8/0x420
[ 2.131464] kthread+0x150/0x160
[ 2.135107] ret_from_fork+0x10/0x20
[ 2.138495] ---[ end trace 5eea8768cb620e87 ]---

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Fixes: f80a1d414328 ("interconnect: qcom: Add SDM660 interconnect provider driver")
Link: https://lore.kernel.org/r/20210823014003.31391-1-shawn.guo@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>


# 7014dfee 01-Apr-2021 Georgi Djakov <georgi.djakov@linaro.org>

interconnect: qcom: sdm660: Fix kerneldoc warning

Fix the following warning:

sdm660.c:191:warning: Function parameter or member 'regmap'
not described in 'qcom_icc_provider'

Link: https://lore.kernel.org/r/20210401094714.29075-1-georgi.djakov@linaro.org
Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>


# f80a1d41 08-Mar-2021 AngeloGioacchino Del Regno <kholk11@gmail.com>

interconnect: qcom: Add SDM660 interconnect provider driver

Introduce a driver for the Qualcomm interconnect busses found in
the SDM630/SDM636/SDM660 SoCs.
The topology consists of several NoCs that are controlled by a
remote processor that collects the aggregated bandwidth for each
master-slave pairs.

On a note, these chips are managing the "bus QoS" in a "hybrid"
fashion: some of the paths in the topology are managed through
(and by, of course) the RPM uC, while some others are "AP Owned",
meaning that the AP shall do direct writes to the appropriate
QoS registers for the specific paths and ports, instead of sending
an indication to the RPM and leaving the job to that one.

Signed-off-by: AngeloGioacchino Del Regno <kholk11@gmail.com>
Link: https://lore.kernel.org/r/20201017133718.31327-3-kholk11@gmail.com
Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>