devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] arm64/msm8996: enable UFS interconnect
@ 2023-01-19 14:43 Dmitry Baryshkov
  2023-01-19 14:43 ` [PATCH 1/2] scsi: ufs: ufs-qcom: add basic interconnect support Dmitry Baryshkov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2023-01-19 14:43 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski
  Cc: linux-arm-msm, devicetree, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi

MSM8996 requires a vote on UFS interconnects to work in a stable manner.
The first patch is a rework of older patch from Brian, see [1]

[1] https://lore.kernel.org/all/20221117104957.254648-2-bmasney@redhat.com/

Brian Masney (1):
  scsi: ufs: ufs-qcom: add basic interconnect support

Dmitry Baryshkov (1):
  arm64: dts: qcom: msm8996: enable UFS interconnects

 arch/arm64/boot/dts/qcom/msm8996.dtsi |  4 ++++
 drivers/ufs/host/ufs-qcom.c           | 26 ++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)

-- 
2.39.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] scsi: ufs: ufs-qcom: add basic interconnect support
  2023-01-19 14:43 [PATCH 0/2] arm64/msm8996: enable UFS interconnect Dmitry Baryshkov
@ 2023-01-19 14:43 ` Dmitry Baryshkov
  2023-01-19 14:43 ` [PATCH 2/2] arm64: dts: qcom: msm8996: enable UFS interconnects Dmitry Baryshkov
  2023-02-09  4:22 ` (subset) [PATCH 0/2] arm64/msm8996: enable UFS interconnect Bjorn Andersson
  2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2023-01-19 14:43 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski
  Cc: linux-arm-msm, devicetree, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, Brian Masney

From: Brian Masney <bmasney@redhat.com>

The firmware on the Qualcomm platforms expects the interconnect votes to
be present. Let's add very basic support where the maximum throughput is
requested to match what's done in a few other drivers.

This will not break boot on systems where the interconnects and
interconnect-names properties are not specified in device tree for UFS
since the interconnect framework will silently return.

Signed-off-by: Brian Masney <bmasney@redhat.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/ufs/host/ufs-qcom.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
index 8ad1415e10b6..8267a4056120 100644
--- a/drivers/ufs/host/ufs-qcom.c
+++ b/drivers/ufs/host/ufs-qcom.c
@@ -14,6 +14,7 @@
 #include <linux/gpio/consumer.h>
 #include <linux/reset-controller.h>
 #include <linux/devfreq.h>
+#include <linux/interconnect.h>
 
 #include <ufs/ufshcd.h>
 #include "ufshcd-pltfrm.h"
@@ -936,6 +937,23 @@ static const struct reset_control_ops ufs_qcom_reset_ops = {
 	.deassert = ufs_qcom_reset_deassert,
 };
 
+static int ufs_qcom_icc_init(struct device *dev, char *pathname,
+		u32 avg_bw, u32 peak_bw)
+{
+	struct icc_path *path;
+	int ret;
+
+	path = devm_of_icc_get(dev, pathname);
+	if (IS_ERR(path))
+		return dev_err_probe(dev, PTR_ERR(path), "failed to acquire interconnect path\n");
+
+	ret = icc_set_bw(path, avg_bw, peak_bw);
+	if (ret < 0)
+		return dev_err_probe(dev, ret, "failed to set bandwidth request\n");
+
+	return 0;
+}
+
 /**
  * ufs_qcom_init - bind phy with controller
  * @hba: host controller instance
@@ -1005,6 +1023,14 @@ static int ufs_qcom_init(struct ufs_hba *hba)
 	ufs_qcom_get_controller_revision(hba, &host->hw_ver.major,
 		&host->hw_ver.minor, &host->hw_ver.step);
 
+	err = ufs_qcom_icc_init(dev, "ufs-ddr", 4096000, 0);
+	if (err)
+		goto out_variant_clear;
+
+	err = ufs_qcom_icc_init(dev, "cpu-ufs", 1000, 0);
+	if (err)
+		goto out_variant_clear;
+
 	/*
 	 * for newer controllers, device reference clock control bit has
 	 * moved inside UFS controller register address space itself.
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] arm64: dts: qcom: msm8996: enable UFS interconnects
  2023-01-19 14:43 [PATCH 0/2] arm64/msm8996: enable UFS interconnect Dmitry Baryshkov
  2023-01-19 14:43 ` [PATCH 1/2] scsi: ufs: ufs-qcom: add basic interconnect support Dmitry Baryshkov
@ 2023-01-19 14:43 ` Dmitry Baryshkov
  2023-02-09  4:22 ` (subset) [PATCH 0/2] arm64/msm8996: enable UFS interconnect Bjorn Andersson
  2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2023-01-19 14:43 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski
  Cc: linux-arm-msm, devicetree, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi

Specify interconnects to be used by the UFS host controller.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 arch/arm64/boot/dts/qcom/msm8996.dtsi | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi
index 55180586f7b6..0c2f7be9f205 100644
--- a/arch/arm64/boot/dts/qcom/msm8996.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi
@@ -2037,6 +2037,10 @@ ufshc: ufshc@624000 {
 				<0 0>,
 				<0 0>;
 
+			interconnects = <&a2noc MASTER_UFS &bimc SLAVE_EBI_CH0>,
+					<&bimc MASTER_AMPSS_M0 &cnoc SLAVE_UFS_CFG>;
+			interconnect-names = "ufs-ddr", "cpu-ufs";
+
 			lanes-per-direction = <1>;
 			#reset-cells = <1>;
 			status = "disabled";
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: (subset) [PATCH 0/2] arm64/msm8996: enable UFS interconnect
  2023-01-19 14:43 [PATCH 0/2] arm64/msm8996: enable UFS interconnect Dmitry Baryshkov
  2023-01-19 14:43 ` [PATCH 1/2] scsi: ufs: ufs-qcom: add basic interconnect support Dmitry Baryshkov
  2023-01-19 14:43 ` [PATCH 2/2] arm64: dts: qcom: msm8996: enable UFS interconnects Dmitry Baryshkov
@ 2023-02-09  4:22 ` Bjorn Andersson
  2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Andersson @ 2023-02-09  4:22 UTC (permalink / raw)
  To: Andy Gross, Dmitry Baryshkov, Rob Herring, Konrad Dybcio,
	Krzysztof Kozlowski
  Cc: Martin K. Petersen, linux-scsi, James E.J. Bottomley, devicetree,
	linux-arm-msm

On Thu, 19 Jan 2023 16:43:24 +0200, Dmitry Baryshkov wrote:
> MSM8996 requires a vote on UFS interconnects to work in a stable manner.
> The first patch is a rework of older patch from Brian, see [1]
> 
> [1] https://lore.kernel.org/all/20221117104957.254648-2-bmasney@redhat.com/
> 
> Brian Masney (1):
>   scsi: ufs: ufs-qcom: add basic interconnect support
> 
> [...]

Applied, thanks!

[2/2] arm64: dts: qcom: msm8996: enable UFS interconnects
      commit: bc72f13e4456afa34ccbd1dfc61aaea18f877b88

Best regards,
-- 
Bjorn Andersson <andersson@kernel.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-02-09  4:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-19 14:43 [PATCH 0/2] arm64/msm8996: enable UFS interconnect Dmitry Baryshkov
2023-01-19 14:43 ` [PATCH 1/2] scsi: ufs: ufs-qcom: add basic interconnect support Dmitry Baryshkov
2023-01-19 14:43 ` [PATCH 2/2] arm64: dts: qcom: msm8996: enable UFS interconnects Dmitry Baryshkov
2023-02-09  4:22 ` (subset) [PATCH 0/2] arm64/msm8996: enable UFS interconnect Bjorn Andersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).