* [PATCH 1/2] scsi: ufs: ufs-qcom: add basic interconnect support
2022-11-17 10:49 [PATCH 0/2] qcom: add basic interconnect support to UFS Brian Masney
@ 2022-11-17 10:49 ` Brian Masney
2022-11-17 11:33 ` Manivannan Sadhasivam
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Brian Masney @ 2022-11-17 10:49 UTC (permalink / raw)
To: andersson
Cc: agross, konrad.dybcio, robh+dt, krzysztof.kozlowski+dt, jejb,
martin.petersen, linux-arm-msm, devicetree, linux-kernel,
linux-scsi
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>
---
drivers/ufs/host/ufs-qcom.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
index 8ad1415e10b6..55bf8dd88985 100644
--- a/drivers/ufs/host/ufs-qcom.c
+++ b/drivers/ufs/host/ufs-qcom.c
@@ -7,6 +7,7 @@
#include <linux/time.h>
#include <linux/clk.h>
#include <linux/delay.h>
+#include <linux/interconnect.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
@@ -936,6 +937,22 @@ 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)
+{
+ 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, 0, UINT_MAX);
+ 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
@@ -991,6 +1008,14 @@ static int ufs_qcom_init(struct ufs_hba *hba)
err = dev_err_probe(dev, PTR_ERR(host->generic_phy), "Failed to get PHY\n");
goto out_variant_clear;
}
+
+ err = ufs_qcom_icc_init(dev, "ufs-ddr");
+ if (err)
+ goto out_variant_clear;
+
+ err = ufs_qcom_icc_init(dev, "cpu-ufs");
+ if (err)
+ goto out_variant_clear;
}
host->device_reset = devm_gpiod_get_optional(dev, "reset",
--
2.38.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] scsi: ufs: ufs-qcom: add basic interconnect support
2022-11-17 10:49 ` [PATCH 1/2] scsi: ufs: ufs-qcom: add basic interconnect support Brian Masney
@ 2022-11-17 11:33 ` Manivannan Sadhasivam
2022-12-22 22:17 ` Dmitry Baryshkov
2023-05-19 17:20 ` Konrad Dybcio
2 siblings, 0 replies; 8+ messages in thread
From: Manivannan Sadhasivam @ 2022-11-17 11:33 UTC (permalink / raw)
To: Brian Masney
Cc: andersson, agross, konrad.dybcio, robh+dt, krzysztof.kozlowski+dt,
jejb, martin.petersen, linux-arm-msm, devicetree, linux-kernel,
linux-scsi
On Thu, Nov 17, 2022 at 05:49:56AM -0500, Brian Masney wrote:
> 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>
> ---
> drivers/ufs/host/ufs-qcom.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
> index 8ad1415e10b6..55bf8dd88985 100644
> --- a/drivers/ufs/host/ufs-qcom.c
> +++ b/drivers/ufs/host/ufs-qcom.c
> @@ -7,6 +7,7 @@
> #include <linux/time.h>
> #include <linux/clk.h>
> #include <linux/delay.h>
> +#include <linux/interconnect.h>
> #include <linux/module.h>
> #include <linux/of.h>
> #include <linux/platform_device.h>
> @@ -936,6 +937,22 @@ 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)
> +{
> + 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, 0, UINT_MAX);
Please use icc macros for setting the bandwidth. Like, GBps_to_icc(),
MBps_to_icc() etc...
Also, during the init stage you can set a minimum bandwidth that will allow the
controller to get probed successfully. Then, you should update the bandwidth
based on the gear in pwr_change_notify() callback.
> + 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
> @@ -991,6 +1008,14 @@ static int ufs_qcom_init(struct ufs_hba *hba)
> err = dev_err_probe(dev, PTR_ERR(host->generic_phy), "Failed to get PHY\n");
> goto out_variant_clear;
> }
> +
> + err = ufs_qcom_icc_init(dev, "ufs-ddr");
> + if (err)
> + goto out_variant_clear;
> +
> + err = ufs_qcom_icc_init(dev, "cpu-ufs");
> + if (err)
> + goto out_variant_clear;
It'd be nice to have a single function that initializes both paths.
Thanks,
Mani
> }
>
> host->device_reset = devm_gpiod_get_optional(dev, "reset",
> --
> 2.38.1
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] scsi: ufs: ufs-qcom: add basic interconnect support
2022-11-17 10:49 ` [PATCH 1/2] scsi: ufs: ufs-qcom: add basic interconnect support Brian Masney
2022-11-17 11:33 ` Manivannan Sadhasivam
@ 2022-12-22 22:17 ` Dmitry Baryshkov
2023-05-19 17:20 ` Konrad Dybcio
2 siblings, 0 replies; 8+ messages in thread
From: Dmitry Baryshkov @ 2022-12-22 22:17 UTC (permalink / raw)
To: Brian Masney, andersson
Cc: agross, konrad.dybcio, robh+dt, krzysztof.kozlowski+dt, jejb,
martin.petersen, linux-arm-msm, devicetree, linux-kernel,
linux-scsi
On 17/11/2022 12:49, Brian Masney wrote:
> 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>
> ---
> drivers/ufs/host/ufs-qcom.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
> index 8ad1415e10b6..55bf8dd88985 100644
> --- a/drivers/ufs/host/ufs-qcom.c
> +++ b/drivers/ufs/host/ufs-qcom.c
> @@ -7,6 +7,7 @@
> #include <linux/time.h>
> #include <linux/clk.h>
> #include <linux/delay.h>
> +#include <linux/interconnect.h>
> #include <linux/module.h>
> #include <linux/of.h>
> #include <linux/platform_device.h>
> @@ -936,6 +937,22 @@ 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)
> +{
> + 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, 0, UINT_MAX);
I noticed that this patch bumps peak_bw (and leaves average_bw as 0),
while vendor kernels bump average_bw, but ib (peak_bw) is set to 0.
> + 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
> @@ -991,6 +1008,14 @@ static int ufs_qcom_init(struct ufs_hba *hba)
> err = dev_err_probe(dev, PTR_ERR(host->generic_phy), "Failed to get PHY\n");
> goto out_variant_clear;
> }
> +
> + err = ufs_qcom_icc_init(dev, "ufs-ddr");
> + if (err)
> + goto out_variant_clear;
> +
> + err = ufs_qcom_icc_init(dev, "cpu-ufs");
> + if (err)
> + goto out_variant_clear;
> }
>
> host->device_reset = devm_gpiod_get_optional(dev, "reset",
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 8+ messages in thread
* [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; 8+ 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] 8+ 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; 8+ 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] 8+ 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; 8+ 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] 8+ 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; 8+ 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] 8+ messages in thread
* Re: [PATCH 1/2] scsi: ufs: ufs-qcom: add basic interconnect support
2022-11-17 10:49 ` [PATCH 1/2] scsi: ufs: ufs-qcom: add basic interconnect support Brian Masney
2022-11-17 11:33 ` Manivannan Sadhasivam
2022-12-22 22:17 ` Dmitry Baryshkov
@ 2023-05-19 17:20 ` Konrad Dybcio
2 siblings, 0 replies; 8+ messages in thread
From: Konrad Dybcio @ 2023-05-19 17:20 UTC (permalink / raw)
To: Brian Masney, andersson
Cc: agross, robh+dt, krzysztof.kozlowski+dt, jejb, martin.petersen,
linux-arm-msm, devicetree, linux-kernel, linux-scsi
On 17.11.2022 11:49, Brian Masney wrote:
> 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>
> ---
Hi everyone!
This was never merged, but it's actually strictly necessary!
For example UFS dies on SM8450 if we add sync_state to its interconnect
driver, as there's no votes cast.
Can we look into this again?
Konrad
> drivers/ufs/host/ufs-qcom.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
> index 8ad1415e10b6..55bf8dd88985 100644
> --- a/drivers/ufs/host/ufs-qcom.c
> +++ b/drivers/ufs/host/ufs-qcom.c
> @@ -7,6 +7,7 @@
> #include <linux/time.h>
> #include <linux/clk.h>
> #include <linux/delay.h>
> +#include <linux/interconnect.h>
> #include <linux/module.h>
> #include <linux/of.h>
> #include <linux/platform_device.h>
> @@ -936,6 +937,22 @@ 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)
> +{
> + 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, 0, UINT_MAX);
> + 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
> @@ -991,6 +1008,14 @@ static int ufs_qcom_init(struct ufs_hba *hba)
> err = dev_err_probe(dev, PTR_ERR(host->generic_phy), "Failed to get PHY\n");
> goto out_variant_clear;
> }
> +
> + err = ufs_qcom_icc_init(dev, "ufs-ddr");
> + if (err)
> + goto out_variant_clear;
> +
> + err = ufs_qcom_icc_init(dev, "cpu-ufs");
> + if (err)
> + goto out_variant_clear;
> }
>
> host->device_reset = devm_gpiod_get_optional(dev, "reset",
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-05-19 17:20 UTC | newest]
Thread overview: 8+ 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
-- strict thread matches above, loose matches on Subject: below --
2022-11-17 10:49 [PATCH 0/2] qcom: add basic interconnect support to UFS Brian Masney
2022-11-17 10:49 ` [PATCH 1/2] scsi: ufs: ufs-qcom: add basic interconnect support Brian Masney
2022-11-17 11:33 ` Manivannan Sadhasivam
2022-12-22 22:17 ` Dmitry Baryshkov
2023-05-19 17:20 ` Konrad Dybcio
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).