devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] phy: qcom-qusb2: Add support for SDM630/660
@ 2020-09-26 13:11 kholk11
  2020-09-26 13:25 ` Martin Botka
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: kholk11 @ 2020-09-26 13:11 UTC (permalink / raw)
  To: agross
  Cc: bjorn.andersson, kishon, robh+dt, kholk11, marijns95,
	konradybcio, martin.botka1, devicetree, linux-arm-msm,
	phone-devel, linux-kernel

From: Konrad Dybcio <konradybcio@gmail.com>

QUSB on these SoCs actually uses *almost* the same
configuration that msm8996 does, so we can reuse
the phy_cfg from there with just a single change
(se clock scheme).

Signed-off-by: Konrad Dybcio <konradybcio@gmail.com>
Signed-off-by: AngeloGioacchino Del Regno <kholk11@gmail.com>
---
 Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml | 1 +
 drivers/phy/qualcomm/phy-qcom-qusb2.c                     | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml
index ccda92859eca..97dae24752b4 100644
--- a/Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml
+++ b/Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml
@@ -21,6 +21,7 @@ properties:
               - qcom,ipq8074-qusb2-phy
               - qcom,msm8996-qusb2-phy
               - qcom,msm8998-qusb2-phy
+              - qcom,sdm660-qusb2-phy
       - items:
           - enum:
               - qcom,sc7180-qusb2-phy
diff --git a/drivers/phy/qualcomm/phy-qcom-qusb2.c b/drivers/phy/qualcomm/phy-qcom-qusb2.c
index 557547dabfd5..a4d706b361b9 100644
--- a/drivers/phy/qualcomm/phy-qcom-qusb2.c
+++ b/drivers/phy/qualcomm/phy-qcom-qusb2.c
@@ -702,7 +702,8 @@ static int qusb2_phy_init(struct phy *phy)
 	usleep_range(150, 160);
 
 	/* Default is single-ended clock on msm8996 */
-	qphy->has_se_clk_scheme = true;
+	if (!of_device_is_compatible(phy->dev.of_node, "qcom,sdm660-qusb2-phy"))
+		qphy->has_se_clk_scheme = true;
 	/*
 	 * read TCSR_PHY_CLK_SCHEME register to check if single-ended
 	 * clock scheme is selected. If yes, then disable differential
@@ -818,6 +819,10 @@ static const struct of_device_id qusb2_phy_of_match_table[] = {
 	}, {
 		.compatible	= "qcom,msm8998-qusb2-phy",
 		.data		= &msm8998_phy_cfg,
+	}, {
+		.compatible	= "qcom,sdm660-qusb2-phy",
+		/* sdm630/660 use the same config as msm8996. */
+		.data		= &msm8996_phy_cfg,
 	}, {
 		/*
 		 * Deprecated. Only here to support legacy device
-- 
2.28.0


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

* Re: [PATCH] phy: qcom-qusb2: Add support for SDM630/660
  2020-09-26 13:11 [PATCH] phy: qcom-qusb2: Add support for SDM630/660 kholk11
@ 2020-09-26 13:25 ` Martin Botka
  2020-09-29 19:12 ` Rob Herring
  2020-09-30  9:31 ` Alexey Minekhanov
  2 siblings, 0 replies; 6+ messages in thread
From: Martin Botka @ 2020-09-26 13:25 UTC (permalink / raw)
  To: kholk11
  Cc: Andy Gross, Bjorn Andersson, kishon, Rob Herring, marijns95,
	Konrad Dybcio, devicetree, linux-arm-msm, phone-devel,
	Linux Kernel Mailing List

Tested on Xperia 10
Tested-by: Martin Botka <martin.botka1@gmail.com>

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

* Re: [PATCH] phy: qcom-qusb2: Add support for SDM630/660
  2020-09-26 13:11 [PATCH] phy: qcom-qusb2: Add support for SDM630/660 kholk11
  2020-09-26 13:25 ` Martin Botka
@ 2020-09-29 19:12 ` Rob Herring
  2020-09-29 19:25   ` Konrad Dybcio
  2020-09-30  9:31 ` Alexey Minekhanov
  2 siblings, 1 reply; 6+ messages in thread
From: Rob Herring @ 2020-09-29 19:12 UTC (permalink / raw)
  To: kholk11
  Cc: agross, bjorn.andersson, kishon, marijns95, konradybcio,
	martin.botka1, devicetree, linux-arm-msm, phone-devel,
	linux-kernel

On Sat, Sep 26, 2020 at 03:11:57PM +0200, kholk11@gmail.com wrote:
> From: Konrad Dybcio <konradybcio@gmail.com>
> 
> QUSB on these SoCs actually uses *almost* the same
> configuration that msm8996 does, so we can reuse
> the phy_cfg from there with just a single change
> (se clock scheme).
> 
> Signed-off-by: Konrad Dybcio <konradybcio@gmail.com>
> Signed-off-by: AngeloGioacchino Del Regno <kholk11@gmail.com>
> ---
>  Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml | 1 +
>  drivers/phy/qualcomm/phy-qcom-qusb2.c                     | 7 ++++++-
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml
> index ccda92859eca..97dae24752b4 100644
> --- a/Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml
> +++ b/Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml
> @@ -21,6 +21,7 @@ properties:
>                - qcom,ipq8074-qusb2-phy
>                - qcom,msm8996-qusb2-phy
>                - qcom,msm8998-qusb2-phy
> +              - qcom,sdm660-qusb2-phy
>        - items:
>            - enum:
>                - qcom,sc7180-qusb2-phy
> diff --git a/drivers/phy/qualcomm/phy-qcom-qusb2.c b/drivers/phy/qualcomm/phy-qcom-qusb2.c
> index 557547dabfd5..a4d706b361b9 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qusb2.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qusb2.c
> @@ -702,7 +702,8 @@ static int qusb2_phy_init(struct phy *phy)
>  	usleep_range(150, 160);
>  
>  	/* Default is single-ended clock on msm8996 */
> -	qphy->has_se_clk_scheme = true;
> +	if (!of_device_is_compatible(phy->dev.of_node, "qcom,sdm660-qusb2-phy"))
> +		qphy->has_se_clk_scheme = true;

You should just pull this from the driver data.

>  	/*
>  	 * read TCSR_PHY_CLK_SCHEME register to check if single-ended
>  	 * clock scheme is selected. If yes, then disable differential
> @@ -818,6 +819,10 @@ static const struct of_device_id qusb2_phy_of_match_table[] = {
>  	}, {
>  		.compatible	= "qcom,msm8998-qusb2-phy",
>  		.data		= &msm8998_phy_cfg,
> +	}, {
> +		.compatible	= "qcom,sdm660-qusb2-phy",
> +		/* sdm630/660 use the same config as msm8996. */
> +		.data		= &msm8996_phy_cfg,
>  	}, {
>  		/*
>  		 * Deprecated. Only here to support legacy device
> -- 
> 2.28.0
> 

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

* Re: [PATCH] phy: qcom-qusb2: Add support for SDM630/660
  2020-09-29 19:12 ` Rob Herring
@ 2020-09-29 19:25   ` Konrad Dybcio
  2020-09-29 19:46     ` Rob Herring
  0 siblings, 1 reply; 6+ messages in thread
From: Konrad Dybcio @ 2020-09-29 19:25 UTC (permalink / raw)
  To: Rob Herring
  Cc: AngeloGioacchino Del Regno, Andy Gross, Bjorn Andersson,
	Kishon Vijay Abraham I, marijns95, Martin Botka, DTML,
	linux-arm-msm, phone-devel, Linux Kernel Mailing List

>You should just pull this from the driver data.

I reused 8996's phy_cfg so as to change one line and not repeat dozens
for what's essentially the same thing, so I don't think it's the
better option..


Konrad

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

* Re: [PATCH] phy: qcom-qusb2: Add support for SDM630/660
  2020-09-29 19:25   ` Konrad Dybcio
@ 2020-09-29 19:46     ` Rob Herring
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2020-09-29 19:46 UTC (permalink / raw)
  To: Konrad Dybcio
  Cc: AngeloGioacchino Del Regno, Andy Gross, Bjorn Andersson,
	Kishon Vijay Abraham I, marijns95, Martin Botka, DTML,
	linux-arm-msm, phone-devel, Linux Kernel Mailing List

On Tue, Sep 29, 2020 at 2:25 PM Konrad Dybcio <konradybcio@gmail.com> wrote:
>
> >You should just pull this from the driver data.
>
> I reused 8996's phy_cfg so as to change one line and not repeat dozens
> for what's essentially the same thing, so I don't think it's the
> better option..

Okay, save it for the next person when the if statement grows.

Rob

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

* Re: [PATCH] phy: qcom-qusb2: Add support for SDM630/660
  2020-09-26 13:11 [PATCH] phy: qcom-qusb2: Add support for SDM630/660 kholk11
  2020-09-26 13:25 ` Martin Botka
  2020-09-29 19:12 ` Rob Herring
@ 2020-09-30  9:31 ` Alexey Minekhanov
  2 siblings, 0 replies; 6+ messages in thread
From: Alexey Minekhanov @ 2020-09-30  9:31 UTC (permalink / raw)
  To: kholk11, agross
  Cc: bjorn.andersson, kishon, robh+dt, marijns95, konradybcio,
	martin.botka1, devicetree, linux-arm-msm, phone-devel,
	linux-kernel

Tested on Xiaomi Redmi Note 7 (lavender), SDM660

Tested-by: Alexey Minnekhanov <alexeymin@postmarketos.org>

On 9/26/20 4:11 PM, kholk11@gmail.com wrote:
> From: Konrad Dybcio <konradybcio@gmail.com>
>
> QUSB on these SoCs actually uses *almost* the same
> configuration that msm8996 does, so we can reuse
> the phy_cfg from there with just a single change
> (se clock scheme).
>
> Signed-off-by: Konrad Dybcio <konradybcio@gmail.com>
> Signed-off-by: AngeloGioacchino Del Regno <kholk11@gmail.com>
> ---
>  Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml | 1 +
>  drivers/phy/qualcomm/phy-qcom-qusb2.c                     | 7 ++++++-
>  2 files changed, 7 insertions(+), 1 deletion(-)

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

end of thread, other threads:[~2020-09-30  9:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-26 13:11 [PATCH] phy: qcom-qusb2: Add support for SDM630/660 kholk11
2020-09-26 13:25 ` Martin Botka
2020-09-29 19:12 ` Rob Herring
2020-09-29 19:25   ` Konrad Dybcio
2020-09-29 19:46     ` Rob Herring
2020-09-30  9:31 ` Alexey Minekhanov

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