linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] UFS support on SM6350 & FP4
@ 2022-03-18 18:29 Luca Weiss
  2022-03-18 18:29 ` [PATCH 1/6] scsi: ufs: dt-bindings: Add SM6350 compatible string Luca Weiss
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Luca Weiss @ 2022-03-18 18:29 UTC (permalink / raw)
  To: linux-arm-msm
  Cc: ~postmarketos/upstreaming, phone-devel, Luca Weiss, Alim Akhtar,
	Andy Gross, AngeloGioacchino Del Regno, Avri Altman,
	Bjorn Andersson, devicetree, Konrad Dybcio, Linus Walleij,
	linux-gpio, linux-kernel, linux-phy, linux-scsi, Vinod Koul

This series adds support for UFS on SM6350 which is used for internal
storage.

Luca Weiss (6):
  scsi: ufs: dt-bindings: Add SM6350 compatible string
  dt-bindings: phy: qcom,qmp: Add SM6350 UFS PHY bindings
  phy: qcom-qmp: Add SM6350 UFS PHY support
  pinctrl: qcom: sm6350: fix order of UFS & SDC pins
  arm64: dts: qcom: sm6350: Add UFS nodes
  arm64: dts: qcom: sm7225-fairphone-fp4: Enable UFS

 .../devicetree/bindings/phy/qcom,qmp-phy.yaml |  1 +
 .../devicetree/bindings/ufs/qcom,ufs.yaml     |  1 +
 arch/arm64/boot/dts/qcom/sm6350.dtsi          | 79 +++++++++++++++++++
 .../boot/dts/qcom/sm7225-fairphone-fp4.dts    | 18 +++++
 drivers/phy/qualcomm/phy-qcom-qmp.c           |  3 +
 drivers/pinctrl/qcom/pinctrl-sm6350.c         | 16 ++--
 6 files changed, 110 insertions(+), 8 deletions(-)

-- 
2.35.1


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

* [PATCH 1/6] scsi: ufs: dt-bindings: Add SM6350 compatible string
  2022-03-18 18:29 [PATCH 0/6] UFS support on SM6350 & FP4 Luca Weiss
@ 2022-03-18 18:29 ` Luca Weiss
  2022-03-19 14:38   ` Krzysztof Kozlowski
  2022-03-21 11:48   ` Alim Akhtar
  2022-03-18 18:30 ` [PATCH 2/6] dt-bindings: phy: qcom,qmp: Add SM6350 UFS PHY bindings Luca Weiss
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 15+ messages in thread
From: Luca Weiss @ 2022-03-18 18:29 UTC (permalink / raw)
  To: linux-arm-msm
  Cc: ~postmarketos/upstreaming, phone-devel, Luca Weiss, Andy Gross,
	Bjorn Andersson, Alim Akhtar, Avri Altman, Rob Herring,
	Krzysztof Kozlowski, linux-scsi, devicetree, linux-kernel

Document the compatible for the UFS found on SM6350.

Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
---
 Documentation/devicetree/bindings/ufs/qcom,ufs.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml b/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml
index 5b3a2157f7e5..d17db2cdf3c2 100644
--- a/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml
+++ b/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml
@@ -27,6 +27,7 @@ properties:
           - qcom,msm8996-ufshc
           - qcom,msm8998-ufshc
           - qcom,sdm845-ufshc
+          - qcom,sm6350-ufshc
           - qcom,sm8150-ufshc
           - qcom,sm8250-ufshc
           - qcom,sm8350-ufshc
-- 
2.35.1


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

* [PATCH 2/6] dt-bindings: phy: qcom,qmp: Add SM6350 UFS PHY bindings
  2022-03-18 18:29 [PATCH 0/6] UFS support on SM6350 & FP4 Luca Weiss
  2022-03-18 18:29 ` [PATCH 1/6] scsi: ufs: dt-bindings: Add SM6350 compatible string Luca Weiss
@ 2022-03-18 18:30 ` Luca Weiss
  2022-03-19 14:40   ` Krzysztof Kozlowski
  2022-03-18 18:30 ` [PATCH 3/6] phy: qcom-qmp: Add SM6350 UFS PHY support Luca Weiss
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 15+ messages in thread
From: Luca Weiss @ 2022-03-18 18:30 UTC (permalink / raw)
  To: linux-arm-msm
  Cc: ~postmarketos/upstreaming, phone-devel, Luca Weiss, Andy Gross,
	Bjorn Andersson, Kishon Vijay Abraham I, Vinod Koul, Rob Herring,
	Krzysztof Kozlowski, linux-phy, devicetree, linux-kernel

Document the compatible string for the UFS PHY found in SM6350.

Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
---
 Documentation/devicetree/bindings/phy/qcom,qmp-phy.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/phy/qcom,qmp-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,qmp-phy.yaml
index e20d9b087bb8..934aa9101ddd 100644
--- a/Documentation/devicetree/bindings/phy/qcom,qmp-phy.yaml
+++ b/Documentation/devicetree/bindings/phy/qcom,qmp-phy.yaml
@@ -39,6 +39,7 @@ properties:
       - qcom,sdm845-qmp-usb3-phy
       - qcom,sdm845-qmp-usb3-uni-phy
       - qcom,sm6115-qmp-ufs-phy
+      - qcom,sm6350-qmp-ufs-phy
       - qcom,sm8150-qmp-ufs-phy
       - qcom,sm8150-qmp-usb3-phy
       - qcom,sm8150-qmp-usb3-uni-phy
-- 
2.35.1


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

* [PATCH 3/6] phy: qcom-qmp: Add SM6350 UFS PHY support
  2022-03-18 18:29 [PATCH 0/6] UFS support on SM6350 & FP4 Luca Weiss
  2022-03-18 18:29 ` [PATCH 1/6] scsi: ufs: dt-bindings: Add SM6350 compatible string Luca Weiss
  2022-03-18 18:30 ` [PATCH 2/6] dt-bindings: phy: qcom,qmp: Add SM6350 UFS PHY bindings Luca Weiss
@ 2022-03-18 18:30 ` Luca Weiss
  2022-03-18 18:30 ` [PATCH 4/6] pinctrl: qcom: sm6350: fix order of UFS & SDC pins Luca Weiss
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 15+ messages in thread
From: Luca Weiss @ 2022-03-18 18:30 UTC (permalink / raw)
  To: linux-arm-msm
  Cc: ~postmarketos/upstreaming, phone-devel, Luca Weiss, Andy Gross,
	Bjorn Andersson, Kishon Vijay Abraham I, Vinod Koul, linux-phy,
	linux-kernel

The SM6350 UFS PHY is compatible with the one from SDM845. Add a
compatible for that.

Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
---
 drivers/phy/qualcomm/phy-qcom-qmp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c
index b144ae1f729a..1628275265b5 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp.c
@@ -6007,6 +6007,9 @@ static const struct of_device_id qcom_qmp_phy_of_match_table[] = {
 	}, {
 		.compatible = "qcom,sm6115-qmp-ufs-phy",
 		.data = &sm6115_ufsphy_cfg,
+	}, {
+		.compatible = "qcom,sm6350-qmp-ufs-phy",
+		.data = &sdm845_ufsphy_cfg,
 	}, {
 		.compatible = "qcom,sm8150-qmp-ufs-phy",
 		.data = &sm8150_ufsphy_cfg,
-- 
2.35.1


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

* [PATCH 4/6] pinctrl: qcom: sm6350: fix order of UFS & SDC pins
  2022-03-18 18:29 [PATCH 0/6] UFS support on SM6350 & FP4 Luca Weiss
                   ` (2 preceding siblings ...)
  2022-03-18 18:30 ` [PATCH 3/6] phy: qcom-qmp: Add SM6350 UFS PHY support Luca Weiss
@ 2022-03-18 18:30 ` Luca Weiss
  2022-04-17 23:38   ` Linus Walleij
  2022-03-18 18:30 ` [PATCH 5/6] arm64: dts: qcom: sm6350: Add UFS nodes Luca Weiss
  2022-03-18 18:30 ` [PATCH 6/6] arm64: dts: qcom: sm7225-fairphone-fp4: Enable UFS Luca Weiss
  5 siblings, 1 reply; 15+ messages in thread
From: Luca Weiss @ 2022-03-18 18:30 UTC (permalink / raw)
  To: linux-arm-msm
  Cc: ~postmarketos/upstreaming, phone-devel, Luca Weiss, Andy Gross,
	Bjorn Andersson, Linus Walleij, AngeloGioacchino Del Regno,
	Konrad Dybcio, linux-gpio, linux-kernel

In other places the SDC and UFS pins have been swapped but this was
missed in the PINCTRL_PIN definitions. Fix that.

Fixes: 7d74b55afd27 ("pinctrl: qcom: Add SM6350 pinctrl driver")
Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
---
 drivers/pinctrl/qcom/pinctrl-sm6350.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/pinctrl/qcom/pinctrl-sm6350.c b/drivers/pinctrl/qcom/pinctrl-sm6350.c
index 4d37b817b232..a91a86628f2f 100644
--- a/drivers/pinctrl/qcom/pinctrl-sm6350.c
+++ b/drivers/pinctrl/qcom/pinctrl-sm6350.c
@@ -264,14 +264,14 @@ static const struct pinctrl_pin_desc sm6350_pins[] = {
 	PINCTRL_PIN(153, "GPIO_153"),
 	PINCTRL_PIN(154, "GPIO_154"),
 	PINCTRL_PIN(155, "GPIO_155"),
-	PINCTRL_PIN(156, "SDC1_RCLK"),
-	PINCTRL_PIN(157, "SDC1_CLK"),
-	PINCTRL_PIN(158, "SDC1_CMD"),
-	PINCTRL_PIN(159, "SDC1_DATA"),
-	PINCTRL_PIN(160, "SDC2_CLK"),
-	PINCTRL_PIN(161, "SDC2_CMD"),
-	PINCTRL_PIN(162, "SDC2_DATA"),
-	PINCTRL_PIN(163, "UFS_RESET"),
+	PINCTRL_PIN(156, "UFS_RESET"),
+	PINCTRL_PIN(157, "SDC1_RCLK"),
+	PINCTRL_PIN(158, "SDC1_CLK"),
+	PINCTRL_PIN(159, "SDC1_CMD"),
+	PINCTRL_PIN(160, "SDC1_DATA"),
+	PINCTRL_PIN(161, "SDC2_CLK"),
+	PINCTRL_PIN(162, "SDC2_CMD"),
+	PINCTRL_PIN(163, "SDC2_DATA"),
 };
 
 #define DECLARE_MSM_GPIO_PINS(pin) \
-- 
2.35.1


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

* [PATCH 5/6] arm64: dts: qcom: sm6350: Add UFS nodes
  2022-03-18 18:29 [PATCH 0/6] UFS support on SM6350 & FP4 Luca Weiss
                   ` (3 preceding siblings ...)
  2022-03-18 18:30 ` [PATCH 4/6] pinctrl: qcom: sm6350: fix order of UFS & SDC pins Luca Weiss
@ 2022-03-18 18:30 ` Luca Weiss
  2022-03-19 14:43   ` Krzysztof Kozlowski
  2022-03-18 18:30 ` [PATCH 6/6] arm64: dts: qcom: sm7225-fairphone-fp4: Enable UFS Luca Weiss
  5 siblings, 1 reply; 15+ messages in thread
From: Luca Weiss @ 2022-03-18 18:30 UTC (permalink / raw)
  To: linux-arm-msm
  Cc: ~postmarketos/upstreaming, phone-devel, Luca Weiss, Andy Gross,
	Bjorn Andersson, Rob Herring, Krzysztof Kozlowski, devicetree,
	linux-kernel

Add the necessary nodes for UFS and its PHY.

Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
---
 arch/arm64/boot/dts/qcom/sm6350.dtsi | 79 ++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sm6350.dtsi b/arch/arm64/boot/dts/qcom/sm6350.dtsi
index d7c9edff19f7..c5c93b6bcd2a 100644
--- a/arch/arm64/boot/dts/qcom/sm6350.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm6350.dtsi
@@ -541,6 +541,85 @@ uart2: serial@98c000 {
 			};
 		};
 
+		ufs_mem_hc: ufshc@1d84000 {
+			compatible = "qcom,sm6350-ufshc", "qcom,ufshc",
+				     "jedec,ufs-2.0";
+			reg = <0 0x01d84000 0 0x3000>,
+			      <0 0x01d90000 0 0x8000>;
+			reg-names = "std", "ice";
+			interrupts = <GIC_SPI 265 IRQ_TYPE_LEVEL_HIGH>;
+			phys = <&ufs_mem_phy_lanes>;
+			phy-names = "ufsphy";
+			lanes-per-direction = <2>;
+			#reset-cells = <1>;
+			resets = <&gcc GCC_UFS_PHY_BCR>;
+			reset-names = "rst";
+
+			power-domains = <&gcc UFS_PHY_GDSC>;
+
+			iommus = <&apps_smmu 0x80 0x0>;
+
+			clock-names =
+				"core_clk",
+				"bus_aggr_clk",
+				"iface_clk",
+				"core_clk_unipro",
+				"core_clk_ice",
+				"ref_clk",
+				"tx_lane0_sync_clk",
+				"rx_lane0_sync_clk",
+				"rx_lane1_sync_clk";
+			clocks =
+				<&gcc GCC_UFS_PHY_AXI_CLK>,
+				<&gcc GCC_AGGRE_UFS_PHY_AXI_CLK>,
+				<&gcc GCC_UFS_PHY_AHB_CLK>,
+				<&gcc GCC_UFS_PHY_UNIPRO_CORE_CLK>,
+				<&gcc GCC_UFS_PHY_ICE_CORE_CLK>,
+				<&rpmhcc RPMH_QLINK_CLK>,
+				<&gcc GCC_UFS_PHY_TX_SYMBOL_0_CLK>,
+				<&gcc GCC_UFS_PHY_RX_SYMBOL_0_CLK>,
+				<&gcc GCC_UFS_PHY_RX_SYMBOL_1_CLK>;
+			freq-table-hz =
+				<50000000 200000000>,
+				<0 0>,
+				<0 0>,
+				<37500000 150000000>,
+				<75000000 300000000>,
+				<0 0>,
+				<0 0>,
+				<0 0>,
+				<0 0>;
+
+			status = "disabled";
+		};
+
+		ufs_mem_phy: phy@1d87000 {
+			compatible = "qcom,sm6350-qmp-ufs-phy";
+			reg = <0 0x01d87000 0 0x18c>;
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges;
+
+			clock-names = "ref",
+				      "ref_aux";
+			clocks = <&gcc GCC_UFS_MEM_CLKREF_CLK>,
+				 <&gcc GCC_UFS_PHY_PHY_AUX_CLK>;
+
+			resets = <&ufs_mem_hc 0>;
+			reset-names = "ufsphy";
+
+			status = "disabled";
+
+			ufs_mem_phy_lanes: phy@1d87400 {
+				reg = <0 0x01d87400 0 0x128>,
+				      <0 0x01d87600 0 0x1fc>,
+				      <0 0x01d87c00 0 0x1dc>,
+				      <0 0x01d87800 0 0x128>,
+				      <0 0x01d87a00 0 0x1fc>;
+				#phy-cells = <0>;
+			};
+		};
+
 		tcsr_mutex: hwlock@1f40000 {
 			compatible = "qcom,tcsr-mutex";
 			reg = <0x0 0x01f40000 0x0 0x40000>;
-- 
2.35.1


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

* [PATCH 6/6] arm64: dts: qcom: sm7225-fairphone-fp4: Enable UFS
  2022-03-18 18:29 [PATCH 0/6] UFS support on SM6350 & FP4 Luca Weiss
                   ` (4 preceding siblings ...)
  2022-03-18 18:30 ` [PATCH 5/6] arm64: dts: qcom: sm6350: Add UFS nodes Luca Weiss
@ 2022-03-18 18:30 ` Luca Weiss
  5 siblings, 0 replies; 15+ messages in thread
From: Luca Weiss @ 2022-03-18 18:30 UTC (permalink / raw)
  To: linux-arm-msm
  Cc: ~postmarketos/upstreaming, phone-devel, Luca Weiss, Andy Gross,
	Bjorn Andersson, Rob Herring, Krzysztof Kozlowski, devicetree,
	linux-kernel

Configure and enable the nodes for UFS that are used for internal
storage on FP4.

Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
---
 .../boot/dts/qcom/sm7225-fairphone-fp4.dts     | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts b/arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts
index adb6ca2be2a5..533a1c88040f 100644
--- a/arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts
+++ b/arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts
@@ -336,6 +336,24 @@ &uart2 {
 	status = "okay";
 };
 
+&ufs_mem_hc {
+	status = "okay";
+
+	reset-gpios = <&tlmm 156 GPIO_ACTIVE_LOW>;
+
+	vcc-supply = <&vreg_l7e>;
+	vcc-max-microamp = <800000>;
+	vccq2-supply = <&vreg_l12a>;
+	vccq2-max-microamp = <800000>;
+};
+
+&ufs_mem_phy {
+	status = "okay";
+
+	vdda-phy-supply = <&vreg_l18a>;
+	vdda-pll-supply = <&vreg_l22a>;
+};
+
 &usb_1 {
 	status = "okay";
 };
-- 
2.35.1


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

* Re: [PATCH 1/6] scsi: ufs: dt-bindings: Add SM6350 compatible string
  2022-03-18 18:29 ` [PATCH 1/6] scsi: ufs: dt-bindings: Add SM6350 compatible string Luca Weiss
@ 2022-03-19 14:38   ` Krzysztof Kozlowski
  2022-03-19 14:41     ` Krzysztof Kozlowski
  2022-03-21 11:48   ` Alim Akhtar
  1 sibling, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2022-03-19 14:38 UTC (permalink / raw)
  To: Luca Weiss, linux-arm-msm
  Cc: ~postmarketos/upstreaming, phone-devel, Andy Gross,
	Bjorn Andersson, Alim Akhtar, Avri Altman, Rob Herring,
	Krzysztof Kozlowski, linux-scsi, devicetree, linux-kernel

On 18/03/2022 19:29, Luca Weiss wrote:
> Document the compatible for the UFS found on SM6350.
> 
> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
> ---
>  Documentation/devicetree/bindings/ufs/qcom,ufs.yaml | 1 +
>  1 file changed, 1 insertion(+)
> 


Acked-by: Krzysztof Kozlowski <krzk@kernel.org>


Best regards,
Krzysztof

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

* Re: [PATCH 2/6] dt-bindings: phy: qcom,qmp: Add SM6350 UFS PHY bindings
  2022-03-18 18:30 ` [PATCH 2/6] dt-bindings: phy: qcom,qmp: Add SM6350 UFS PHY bindings Luca Weiss
@ 2022-03-19 14:40   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2022-03-19 14:40 UTC (permalink / raw)
  To: Luca Weiss, linux-arm-msm
  Cc: ~postmarketos/upstreaming, phone-devel, Andy Gross,
	Bjorn Andersson, Kishon Vijay Abraham I, Vinod Koul, Rob Herring,
	Krzysztof Kozlowski, linux-phy, devicetree, linux-kernel

On 18/03/2022 19:30, Luca Weiss wrote:
> Document the compatible string for the UFS PHY found in SM6350.
> 
> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
> ---
>  Documentation/devicetree/bindings/phy/qcom,qmp-phy.yaml | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/phy/qcom,qmp-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,qmp-phy.yaml
> index e20d9b087bb8..934aa9101ddd 100644
> --- a/Documentation/devicetree/bindings/phy/qcom,qmp-phy.yaml
> +++ b/Documentation/devicetree/bindings/phy/qcom,qmp-phy.yaml
> @@ -39,6 +39,7 @@ properties:
>        - qcom,sdm845-qmp-usb3-phy
>        - qcom,sdm845-qmp-usb3-uni-phy
>        - qcom,sm6115-qmp-ufs-phy
> +      - qcom,sm6350-qmp-ufs-phy

Please also add constraints to clocks, resets and any other necessary
properties in allOf:if:then section.


Best regards,
Krzysztof

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

* Re: [PATCH 1/6] scsi: ufs: dt-bindings: Add SM6350 compatible string
  2022-03-19 14:38   ` Krzysztof Kozlowski
@ 2022-03-19 14:41     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2022-03-19 14:41 UTC (permalink / raw)
  To: Luca Weiss, linux-arm-msm
  Cc: ~postmarketos/upstreaming, phone-devel, Andy Gross,
	Bjorn Andersson, Alim Akhtar, Avri Altman, Rob Herring,
	Krzysztof Kozlowski, linux-scsi, devicetree, linux-kernel

On 19/03/2022 15:38, Krzysztof Kozlowski wrote:
> On 18/03/2022 19:29, Luca Weiss wrote:
>> Document the compatible for the UFS found on SM6350.
>>
>> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
>> ---
>>  Documentation/devicetree/bindings/ufs/qcom,ufs.yaml | 1 +
>>  1 file changed, 1 insertion(+)
>>
> 
> 
> Acked-by: Krzysztof Kozlowski <krzk@kernel.org>

No, I revoke it. You also missed the constraints in if:then.


Best regards,
Krzysztof

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

* Re: [PATCH 5/6] arm64: dts: qcom: sm6350: Add UFS nodes
  2022-03-18 18:30 ` [PATCH 5/6] arm64: dts: qcom: sm6350: Add UFS nodes Luca Weiss
@ 2022-03-19 14:43   ` Krzysztof Kozlowski
  2022-03-19 18:29     ` Luca Weiss
  0 siblings, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2022-03-19 14:43 UTC (permalink / raw)
  To: Luca Weiss, linux-arm-msm
  Cc: ~postmarketos/upstreaming, phone-devel, Andy Gross,
	Bjorn Andersson, Rob Herring, Krzysztof Kozlowski, devicetree,
	linux-kernel

On 18/03/2022 19:30, Luca Weiss wrote:
> Add the necessary nodes for UFS and its PHY.
> 
> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
> ---
>  arch/arm64/boot/dts/qcom/sm6350.dtsi | 79 ++++++++++++++++++++++++++++
>  1 file changed, 79 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/qcom/sm6350.dtsi b/arch/arm64/boot/dts/qcom/sm6350.dtsi
> index d7c9edff19f7..c5c93b6bcd2a 100644
> --- a/arch/arm64/boot/dts/qcom/sm6350.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sm6350.dtsi
> @@ -541,6 +541,85 @@ uart2: serial@98c000 {
>  			};
>  		};
>  
> +		ufs_mem_hc: ufshc@1d84000 {

Generic node name, so ufs.

> +			compatible = "qcom,sm6350-ufshc", "qcom,ufshc",
> +				     "jedec,ufs-2.0";
> +			reg = <0 0x01d84000 0 0x3000>,
> +			      <0 0x01d90000 0 0x8000>;
> +			reg-names = "std", "ice";
> +			interrupts = <GIC_SPI 265 IRQ_TYPE_LEVEL_HIGH>;
> +			phys = <&ufs_mem_phy_lanes>;
> +			phy-names = "ufsphy";
> +			lanes-per-direction = <2>;
> +			#reset-cells = <1>;
> +			resets = <&gcc GCC_UFS_PHY_BCR>;
> +			reset-names = "rst";
> +
> +			power-domains = <&gcc UFS_PHY_GDSC>;
> +
> +			iommus = <&apps_smmu 0x80 0x0>;
> +
> +			clock-names =

Drop unneeded blank line, start just after '=' and align next elements
with it.

> +				"core_clk",
> +				"bus_aggr_clk",
> +				"iface_clk",
> +				"core_clk_unipro",
> +				"core_clk_ice",
> +				"ref_clk",
> +				"tx_lane0_sync_clk",
> +				"rx_lane0_sync_clk",
> +				"rx_lane1_sync_clk";
> +			clocks =

The same.


Best regards,
Krzysztof

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

* Re: [PATCH 5/6] arm64: dts: qcom: sm6350: Add UFS nodes
  2022-03-19 14:43   ` Krzysztof Kozlowski
@ 2022-03-19 18:29     ` Luca Weiss
  2022-03-20 11:00       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 15+ messages in thread
From: Luca Weiss @ 2022-03-19 18:29 UTC (permalink / raw)
  To: Krzysztof Kozlowski, linux-arm-msm
  Cc: ~postmarketos/upstreaming, phone-devel, Andy Gross,
	Bjorn Andersson, Rob Herring, Krzysztof Kozlowski, devicetree,
	linux-kernel

Hi Krzysztof,

On Sat Mar 19, 2022 at 3:43 PM CET, Krzysztof Kozlowski wrote:
> On 18/03/2022 19:30, Luca Weiss wrote:
> > Add the necessary nodes for UFS and its PHY.
> > 
> > Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
> > ---
> >  arch/arm64/boot/dts/qcom/sm6350.dtsi | 79 ++++++++++++++++++++++++++++
> >  1 file changed, 79 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/qcom/sm6350.dtsi b/arch/arm64/boot/dts/qcom/sm6350.dtsi
> > index d7c9edff19f7..c5c93b6bcd2a 100644
> > --- a/arch/arm64/boot/dts/qcom/sm6350.dtsi
> > +++ b/arch/arm64/boot/dts/qcom/sm6350.dtsi
> > @@ -541,6 +541,85 @@ uart2: serial@98c000 {
> >  			};
> >  		};
> >  
> > +		ufs_mem_hc: ufshc@1d84000 {
>
> Generic node name, so ufs.

With the node name changes UFS doesn't probe anymore.

[    1.893762] ufshcd-qcom 1d84000.ufs: ufshcd_variant_hba_init: variant qcom init failed err -19
[    1.902674] ufshcd-qcom 1d84000.ufs: Initialization failed
[    1.908391] ufshcd-qcom 1d84000.ufs: ufshcd_pltfrm_init() failed -19

I didn't debug this in detail but it's likely from the
androidboot.bootdevice=1d84000.ufshc parameter in cmdline that
ufs-qcom.c uses to fail probe with -ENODEV for all UFS other than the
selected one. Not sure why this behavior exists in mainline (didn't look
into this either).

This cmdline parameter (among many others) is added by the stock
bootloader and as far as I know there's no way to turn that off.


>
> > +			compatible = "qcom,sm6350-ufshc", "qcom,ufshc",
> > +				     "jedec,ufs-2.0";
> > +			reg = <0 0x01d84000 0 0x3000>,
> > +			      <0 0x01d90000 0 0x8000>;
> > +			reg-names = "std", "ice";
> > +			interrupts = <GIC_SPI 265 IRQ_TYPE_LEVEL_HIGH>;
> > +			phys = <&ufs_mem_phy_lanes>;
> > +			phy-names = "ufsphy";
> > +			lanes-per-direction = <2>;
> > +			#reset-cells = <1>;
> > +			resets = <&gcc GCC_UFS_PHY_BCR>;
> > +			reset-names = "rst";
> > +
> > +			power-domains = <&gcc UFS_PHY_GDSC>;
> > +
> > +			iommus = <&apps_smmu 0x80 0x0>;
> > +
> > +			clock-names =
>
> Drop unneeded blank line, start just after '=' and align next elements
> with it.

Sure.

>
> > +				"core_clk",
> > +				"bus_aggr_clk",
> > +				"iface_clk",
> > +				"core_clk_unipro",
> > +				"core_clk_ice",
> > +				"ref_clk",
> > +				"tx_lane0_sync_clk",
> > +				"rx_lane0_sync_clk",
> > +				"rx_lane1_sync_clk";
> > +			clocks =
>
> The same.

Sure. I also adjusted the clock name/order to match the bindings (thanks
for spotting the problems there!)

Regards
Luca

>
>
> Best regards,
> Krzysztof


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

* Re: [PATCH 5/6] arm64: dts: qcom: sm6350: Add UFS nodes
  2022-03-19 18:29     ` Luca Weiss
@ 2022-03-20 11:00       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2022-03-20 11:00 UTC (permalink / raw)
  To: Luca Weiss, linux-arm-msm
  Cc: ~postmarketos/upstreaming, phone-devel, Andy Gross,
	Bjorn Andersson, Rob Herring, Krzysztof Kozlowski, devicetree,
	linux-kernel

On 19/03/2022 19:29, Luca Weiss wrote:
> Hi Krzysztof,
> 
> On Sat Mar 19, 2022 at 3:43 PM CET, Krzysztof Kozlowski wrote:
>> On 18/03/2022 19:30, Luca Weiss wrote:
>>> Add the necessary nodes for UFS and its PHY.
>>>
>>> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
>>> ---
>>>  arch/arm64/boot/dts/qcom/sm6350.dtsi | 79 ++++++++++++++++++++++++++++
>>>  1 file changed, 79 insertions(+)
>>>
>>> diff --git a/arch/arm64/boot/dts/qcom/sm6350.dtsi b/arch/arm64/boot/dts/qcom/sm6350.dtsi
>>> index d7c9edff19f7..c5c93b6bcd2a 100644
>>> --- a/arch/arm64/boot/dts/qcom/sm6350.dtsi
>>> +++ b/arch/arm64/boot/dts/qcom/sm6350.dtsi
>>> @@ -541,6 +541,85 @@ uart2: serial@98c000 {
>>>  			};
>>>  		};
>>>  
>>> +		ufs_mem_hc: ufshc@1d84000 {
>>
>> Generic node name, so ufs.
> 
> With the node name changes UFS doesn't probe anymore.
> 
> [    1.893762] ufshcd-qcom 1d84000.ufs: ufshcd_variant_hba_init: variant qcom init failed err -19
> [    1.902674] ufshcd-qcom 1d84000.ufs: Initialization failed
> [    1.908391] ufshcd-qcom 1d84000.ufs: ufshcd_pltfrm_init() failed -19
> 
> I didn't debug this in detail but it's likely from the
> androidboot.bootdevice=1d84000.ufshc parameter in cmdline that
> ufs-qcom.c uses to fail probe with -ENODEV for all UFS other than the
> selected one. Not sure why this behavior exists in mainline (didn't look
> into this either).
> 
> This cmdline parameter (among many others) is added by the stock
> bootloader and as far as I know there's no way to turn that off.

I see now in the driver weird Android code like:
  static char android_boot_dev[ANDROID_BOOT_DEV_MAX];
  ....
  if (strlen(android_boot_dev) && strcmp(android_boot_dev, dev_name(dev)))

This is wrong. How is Android boot arguments needed for UFS? UFS is
independent of Android... what if you run it with different bootloader
and different system?

I understand that it is inconvenient for you to change the name, but
looking at driver code, I insist even more. :)


Best regards,
Krzysztof

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

* RE: [PATCH 1/6] scsi: ufs: dt-bindings: Add SM6350 compatible string
  2022-03-18 18:29 ` [PATCH 1/6] scsi: ufs: dt-bindings: Add SM6350 compatible string Luca Weiss
  2022-03-19 14:38   ` Krzysztof Kozlowski
@ 2022-03-21 11:48   ` Alim Akhtar
  1 sibling, 0 replies; 15+ messages in thread
From: Alim Akhtar @ 2022-03-21 11:48 UTC (permalink / raw)
  To: 'Luca Weiss', linux-arm-msm
  Cc: ~postmarketos/upstreaming, phone-devel, 'Andy Gross',
	'Bjorn Andersson', 'Avri Altman',
	'Rob Herring', 'Krzysztof Kozlowski',
	linux-scsi, devicetree, linux-kernel



>-----Original Message-----
>From: Luca Weiss [mailto:luca.weiss@fairphone.com]
>Sent: Saturday, March 19, 2022 12:00 AM
>To: linux-arm-msm@vger.kernel.org
>Cc: ~postmarketos/upstreaming@lists.sr.ht; phone-devel@vger.kernel.org;
>Luca Weiss <luca.weiss@fairphone.com>; Andy Gross <agross@kernel.org>;
>Bjorn Andersson <bjorn.andersson@linaro.org>; Alim Akhtar
><alim.akhtar@samsung.com>; Avri Altman <avri.altman@wdc.com>; Rob
>Herring <robh+dt@kernel.org>; Krzysztof Kozlowski <krzk+dt@kernel.org>;
>linux-scsi@vger.kernel.org; devicetree@vger.kernel.org; linux-
>kernel@vger.kernel.org
>Subject: [PATCH 1/6] scsi: ufs: dt-bindings: Add SM6350 compatible string
>
>Document the compatible for the UFS found on SM6350.
>
>Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
>---
> Documentation/devicetree/bindings/ufs/qcom,ufs.yaml | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml
>b/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml
>index 5b3a2157f7e5..d17db2cdf3c2 100644
>--- a/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml
>+++ b/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml
>@@ -27,6 +27,7 @@ properties:
>           - qcom,msm8996-ufshc
>           - qcom,msm8998-ufshc
>           - qcom,sdm845-ufshc
>+          - qcom,sm6350-ufshc

You need to update "if:then" below as well, as this SoC is different than
other in the series

>           - qcom,sm8150-ufshc
>           - qcom,sm8250-ufshc
>           - qcom,sm8350-ufshc
>--
>2.35.1



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

* Re: [PATCH 4/6] pinctrl: qcom: sm6350: fix order of UFS & SDC pins
  2022-03-18 18:30 ` [PATCH 4/6] pinctrl: qcom: sm6350: fix order of UFS & SDC pins Luca Weiss
@ 2022-04-17 23:38   ` Linus Walleij
  0 siblings, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2022-04-17 23:38 UTC (permalink / raw)
  To: Luca Weiss
  Cc: linux-arm-msm, ~postmarketos/upstreaming, phone-devel,
	Andy Gross, Bjorn Andersson, AngeloGioacchino Del Regno,
	Konrad Dybcio, linux-gpio, linux-kernel

On Fri, Mar 18, 2022 at 7:30 PM Luca Weiss <luca.weiss@fairphone.com> wrote:

> In other places the SDC and UFS pins have been swapped but this was
> missed in the PINCTRL_PIN definitions. Fix that.
>
> Fixes: 7d74b55afd27 ("pinctrl: qcom: Add SM6350 pinctrl driver")
> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>

Patch applied for fixes.

Yours,
Linus Walleij

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

end of thread, other threads:[~2022-04-17 23:39 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-18 18:29 [PATCH 0/6] UFS support on SM6350 & FP4 Luca Weiss
2022-03-18 18:29 ` [PATCH 1/6] scsi: ufs: dt-bindings: Add SM6350 compatible string Luca Weiss
2022-03-19 14:38   ` Krzysztof Kozlowski
2022-03-19 14:41     ` Krzysztof Kozlowski
2022-03-21 11:48   ` Alim Akhtar
2022-03-18 18:30 ` [PATCH 2/6] dt-bindings: phy: qcom,qmp: Add SM6350 UFS PHY bindings Luca Weiss
2022-03-19 14:40   ` Krzysztof Kozlowski
2022-03-18 18:30 ` [PATCH 3/6] phy: qcom-qmp: Add SM6350 UFS PHY support Luca Weiss
2022-03-18 18:30 ` [PATCH 4/6] pinctrl: qcom: sm6350: fix order of UFS & SDC pins Luca Weiss
2022-04-17 23:38   ` Linus Walleij
2022-03-18 18:30 ` [PATCH 5/6] arm64: dts: qcom: sm6350: Add UFS nodes Luca Weiss
2022-03-19 14:43   ` Krzysztof Kozlowski
2022-03-19 18:29     ` Luca Weiss
2022-03-20 11:00       ` Krzysztof Kozlowski
2022-03-18 18:30 ` [PATCH 6/6] arm64: dts: qcom: sm7225-fairphone-fp4: Enable UFS Luca Weiss

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).