* [PATCH] phy: qcom: qmp-combo: Fix register base for QSERDES_DP_PHY_MODE
@ 2024-04-05 0:01 Stephen Boyd
2024-04-05 0:08 ` Abhinav Kumar
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Stephen Boyd @ 2024-04-05 0:01 UTC (permalink / raw)
To: Vinod Koul, Kishon Vijay Abraham I
Cc: linux-kernel, patches, linux-arm-msm, Konrad Dybcio, linux-phy,
freedreno, Douglas Anderson, Abhinav Kumar, Dmitry Baryshkov,
Neil Armstrong, Abel Vesa, Steev Klimaszewski, Johan Hovold,
Bjorn Andersson
The register base that was used to write to the QSERDES_DP_PHY_MODE
register was 'dp_dp_phy' before commit 815891eee668 ("phy:
qcom-qmp-combo: Introduce orientation variable"). There isn't any
explanation in the commit why this is changed, so I suspect it was an
oversight or happened while being extracted from some other series.
Oddly the value being 0x4c or 0x5c doesn't seem to matter for me, so I
suspect this is dead code, but that can be fixed in another patch. It's
not good to write to the wrong register space, and maybe some other
version of this phy relies on this.
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Abel Vesa <abel.vesa@linaro.org>
Cc: Steev Klimaszewski <steev@kali.org>
Cc: Johan Hovold <johan+linaro@kernel.org>
Cc: Bjorn Andersson <quic_bjorande@quicinc.com>
Fixes: 815891eee668 ("phy: qcom-qmp-combo: Introduce orientation variable")
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
index 7d585a4bbbba..746d009d702b 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
@@ -2150,9 +2150,9 @@ static bool qmp_combo_configure_dp_mode(struct qmp_combo *qmp)
writel(val, qmp->dp_dp_phy + QSERDES_DP_PHY_PD_CTL);
if (reverse)
- writel(0x4c, qmp->pcs + QSERDES_DP_PHY_MODE);
+ writel(0x4c, qmp->dp_dp_phy + QSERDES_DP_PHY_MODE);
else
- writel(0x5c, qmp->pcs + QSERDES_DP_PHY_MODE);
+ writel(0x5c, qmp->dp_dp_phy + QSERDES_DP_PHY_MODE);
return reverse;
}
base-commit: 4cece764965020c22cff7665b18a012006359095
--
https://chromeos.dev
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] phy: qcom: qmp-combo: Fix register base for QSERDES_DP_PHY_MODE
2024-04-05 0:01 [PATCH] phy: qcom: qmp-combo: Fix register base for QSERDES_DP_PHY_MODE Stephen Boyd
@ 2024-04-05 0:08 ` Abhinav Kumar
2024-04-05 0:56 ` Bjorn Andersson
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Abhinav Kumar @ 2024-04-05 0:08 UTC (permalink / raw)
To: Stephen Boyd, Vinod Koul, Kishon Vijay Abraham I
Cc: linux-kernel, patches, linux-arm-msm, Konrad Dybcio, linux-phy,
freedreno, Douglas Anderson, Dmitry Baryshkov, Neil Armstrong,
Abel Vesa, Steev Klimaszewski, Johan Hovold, Bjorn Andersson
On 4/4/2024 5:01 PM, Stephen Boyd wrote:
> The register base that was used to write to the QSERDES_DP_PHY_MODE
> register was 'dp_dp_phy' before commit 815891eee668 ("phy:
> qcom-qmp-combo: Introduce orientation variable"). There isn't any
> explanation in the commit why this is changed, so I suspect it was an
> oversight or happened while being extracted from some other series.
> Oddly the value being 0x4c or 0x5c doesn't seem to matter for me, so I
> suspect this is dead code, but that can be fixed in another patch. It's
> not good to write to the wrong register space, and maybe some other
> version of this phy relies on this.
>
> Cc: Douglas Anderson <dianders@chromium.org>
> Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Cc: Neil Armstrong <neil.armstrong@linaro.org>
> Cc: Abel Vesa <abel.vesa@linaro.org>
> Cc: Steev Klimaszewski <steev@kali.org>
> Cc: Johan Hovold <johan+linaro@kernel.org>
> Cc: Bjorn Andersson <quic_bjorande@quicinc.com>
> Fixes: 815891eee668 ("phy: qcom-qmp-combo: Introduce orientation variable")
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---
> drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
Yes I dont know why the commit 815891eee668 ("phy:
qcom-qmp-combo: Introduce orientation variable") changed the base in
below code. Certainly looks like a bug to me because we should be
writing to DP_PHY_MODE which is at an offset 0x1c from the dp_phy base.
Hence, this LGTM,
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] phy: qcom: qmp-combo: Fix register base for QSERDES_DP_PHY_MODE
2024-04-05 0:01 [PATCH] phy: qcom: qmp-combo: Fix register base for QSERDES_DP_PHY_MODE Stephen Boyd
2024-04-05 0:08 ` Abhinav Kumar
@ 2024-04-05 0:56 ` Bjorn Andersson
2024-04-05 7:34 ` Johan Hovold
2024-04-05 2:56 ` Dmitry Baryshkov
2024-04-06 9:18 ` Vinod Koul
3 siblings, 1 reply; 6+ messages in thread
From: Bjorn Andersson @ 2024-04-05 0:56 UTC (permalink / raw)
To: Stephen Boyd
Cc: Vinod Koul, Kishon Vijay Abraham I, linux-kernel, patches,
linux-arm-msm, Konrad Dybcio, linux-phy, freedreno,
Douglas Anderson, Abhinav Kumar, Dmitry Baryshkov, Neil Armstrong,
Abel Vesa, Steev Klimaszewski, Johan Hovold
On Thu, Apr 04, 2024 at 05:01:03PM -0700, Stephen Boyd wrote:
> The register base that was used to write to the QSERDES_DP_PHY_MODE
> register was 'dp_dp_phy' before commit 815891eee668 ("phy:
> qcom-qmp-combo: Introduce orientation variable"). There isn't any
> explanation in the commit why this is changed, so I suspect it was an
> oversight or happened while being extracted from some other series.
Thanks for catching that, I wrote that patch long before Johan did the
rename of "pcs" to "dp_dp_phy", and must have missed that while later
rebasing the patch.
Reviewed-by: Bjorn Andersson <quic_bjorande@quicinc.com>
Regards,
Bjorn
> Oddly the value being 0x4c or 0x5c doesn't seem to matter for me, so I
> suspect this is dead code, but that can be fixed in another patch. It's
> not good to write to the wrong register space, and maybe some other
> version of this phy relies on this.
>
> Cc: Douglas Anderson <dianders@chromium.org>
> Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Cc: Neil Armstrong <neil.armstrong@linaro.org>
> Cc: Abel Vesa <abel.vesa@linaro.org>
> Cc: Steev Klimaszewski <steev@kali.org>
> Cc: Johan Hovold <johan+linaro@kernel.org>
> Cc: Bjorn Andersson <quic_bjorande@quicinc.com>
> Fixes: 815891eee668 ("phy: qcom-qmp-combo: Introduce orientation variable")
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---
> drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> index 7d585a4bbbba..746d009d702b 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> @@ -2150,9 +2150,9 @@ static bool qmp_combo_configure_dp_mode(struct qmp_combo *qmp)
> writel(val, qmp->dp_dp_phy + QSERDES_DP_PHY_PD_CTL);
>
> if (reverse)
> - writel(0x4c, qmp->pcs + QSERDES_DP_PHY_MODE);
> + writel(0x4c, qmp->dp_dp_phy + QSERDES_DP_PHY_MODE);
> else
> - writel(0x5c, qmp->pcs + QSERDES_DP_PHY_MODE);
> + writel(0x5c, qmp->dp_dp_phy + QSERDES_DP_PHY_MODE);
>
> return reverse;
> }
>
> base-commit: 4cece764965020c22cff7665b18a012006359095
> --
> https://chromeos.dev
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] phy: qcom: qmp-combo: Fix register base for QSERDES_DP_PHY_MODE
2024-04-05 0:01 [PATCH] phy: qcom: qmp-combo: Fix register base for QSERDES_DP_PHY_MODE Stephen Boyd
2024-04-05 0:08 ` Abhinav Kumar
2024-04-05 0:56 ` Bjorn Andersson
@ 2024-04-05 2:56 ` Dmitry Baryshkov
2024-04-06 9:18 ` Vinod Koul
3 siblings, 0 replies; 6+ messages in thread
From: Dmitry Baryshkov @ 2024-04-05 2:56 UTC (permalink / raw)
To: Stephen Boyd
Cc: Vinod Koul, Kishon Vijay Abraham I, linux-kernel, patches,
linux-arm-msm, Konrad Dybcio, linux-phy, freedreno,
Douglas Anderson, Abhinav Kumar, Neil Armstrong, Abel Vesa,
Steev Klimaszewski, Johan Hovold, Bjorn Andersson
On Fri, 5 Apr 2024 at 03:01, Stephen Boyd <swboyd@chromium.org> wrote:
>
> The register base that was used to write to the QSERDES_DP_PHY_MODE
> register was 'dp_dp_phy' before commit 815891eee668 ("phy:
> qcom-qmp-combo: Introduce orientation variable"). There isn't any
> explanation in the commit why this is changed, so I suspect it was an
> oversight or happened while being extracted from some other series.
> Oddly the value being 0x4c or 0x5c doesn't seem to matter for me, so I
> suspect this is dead code, but that can be fixed in another patch. It's
> not good to write to the wrong register space, and maybe some other
> version of this phy relies on this.
>
> Cc: Douglas Anderson <dianders@chromium.org>
> Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Cc: Neil Armstrong <neil.armstrong@linaro.org>
> Cc: Abel Vesa <abel.vesa@linaro.org>
> Cc: Steev Klimaszewski <steev@kali.org>
> Cc: Johan Hovold <johan+linaro@kernel.org>
> Cc: Bjorn Andersson <quic_bjorande@quicinc.com>
> Fixes: 815891eee668 ("phy: qcom-qmp-combo: Introduce orientation variable")
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---
> drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] phy: qcom: qmp-combo: Fix register base for QSERDES_DP_PHY_MODE
2024-04-05 0:56 ` Bjorn Andersson
@ 2024-04-05 7:34 ` Johan Hovold
0 siblings, 0 replies; 6+ messages in thread
From: Johan Hovold @ 2024-04-05 7:34 UTC (permalink / raw)
To: Bjorn Andersson
Cc: Stephen Boyd, Vinod Koul, Kishon Vijay Abraham I, linux-kernel,
patches, linux-arm-msm, Konrad Dybcio, linux-phy, freedreno,
Douglas Anderson, Abhinav Kumar, Dmitry Baryshkov, Neil Armstrong,
Abel Vesa, Steev Klimaszewski, Johan Hovold
On Thu, Apr 04, 2024 at 05:56:32PM -0700, Bjorn Andersson wrote:
> On Thu, Apr 04, 2024 at 05:01:03PM -0700, Stephen Boyd wrote:
> > The register base that was used to write to the QSERDES_DP_PHY_MODE
> > register was 'dp_dp_phy' before commit 815891eee668 ("phy:
> > qcom-qmp-combo: Introduce orientation variable"). There isn't any
> > explanation in the commit why this is changed, so I suspect it was an
> > oversight or happened while being extracted from some other series.
>
> Thanks for catching that, I wrote that patch long before Johan did the
> rename of "pcs" to "dp_dp_phy", and must have missed that while later
> rebasing the patch.
>
> Reviewed-by: Bjorn Andersson <quic_bjorande@quicinc.com>
>
> > Oddly the value being 0x4c or 0x5c doesn't seem to matter for me, so I
> > suspect this is dead code, but that can be fixed in another patch. It's
> > not good to write to the wrong register space, and maybe some other
> > version of this phy relies on this.
This code is still reached on sc8280xp, but I guess only Qualcomm can
tell us what these bits are for (and they should).
The write to qmp->pcs + QSERDES_DP_PHY_MODE does not seem to have any
effect on sc8280xp and that register still reads back as 0x2020202 after
the incorrect write.
qmp->dp_dp_phy + QSERDES_DP_PHY_MODE reads back as 0x4c4c4c4c before the
fixed write and either 0x4c4c4c4c or 0x5c5c5c5c after depending on the
orientation.
Can someone please replace the magic constants in this driver, and at
least explain what the impact of bit 0x10 not reflecting the orientation
is?
> > Fixes: 815891eee668 ("phy: qcom-qmp-combo: Introduce orientation variable")
> > Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Either way, good catch, this was clearly unintentional:
Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
I think this should go to stable as well even if the impact is currently
not fully understood:
Cc: stable@vger.kernel.org # 6.5
> > @@ -2150,9 +2150,9 @@ static bool qmp_combo_configure_dp_mode(struct qmp_combo *qmp)
> > writel(val, qmp->dp_dp_phy + QSERDES_DP_PHY_PD_CTL);
> >
> > if (reverse)
> > - writel(0x4c, qmp->pcs + QSERDES_DP_PHY_MODE);
> > + writel(0x4c, qmp->dp_dp_phy + QSERDES_DP_PHY_MODE);
> > else
> > - writel(0x5c, qmp->pcs + QSERDES_DP_PHY_MODE);
> > + writel(0x5c, qmp->dp_dp_phy + QSERDES_DP_PHY_MODE);
Johan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] phy: qcom: qmp-combo: Fix register base for QSERDES_DP_PHY_MODE
2024-04-05 0:01 [PATCH] phy: qcom: qmp-combo: Fix register base for QSERDES_DP_PHY_MODE Stephen Boyd
` (2 preceding siblings ...)
2024-04-05 2:56 ` Dmitry Baryshkov
@ 2024-04-06 9:18 ` Vinod Koul
3 siblings, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2024-04-06 9:18 UTC (permalink / raw)
To: Kishon Vijay Abraham I, Stephen Boyd
Cc: linux-kernel, patches, linux-arm-msm, Konrad Dybcio, linux-phy,
freedreno, Douglas Anderson, Abhinav Kumar, Dmitry Baryshkov,
Neil Armstrong, Abel Vesa, Steev Klimaszewski, Johan Hovold,
Bjorn Andersson
On Thu, 04 Apr 2024 17:01:03 -0700, Stephen Boyd wrote:
> The register base that was used to write to the QSERDES_DP_PHY_MODE
> register was 'dp_dp_phy' before commit 815891eee668 ("phy:
> qcom-qmp-combo: Introduce orientation variable"). There isn't any
> explanation in the commit why this is changed, so I suspect it was an
> oversight or happened while being extracted from some other series.
> Oddly the value being 0x4c or 0x5c doesn't seem to matter for me, so I
> suspect this is dead code, but that can be fixed in another patch. It's
> not good to write to the wrong register space, and maybe some other
> version of this phy relies on this.
>
> [...]
Applied, thanks!
[1/1] phy: qcom: qmp-combo: Fix register base for QSERDES_DP_PHY_MODE
commit: ee13e1f3c72b9464a4d73017c060ab503eed653a
Best regards,
--
~Vinod
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-04-06 9:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-05 0:01 [PATCH] phy: qcom: qmp-combo: Fix register base for QSERDES_DP_PHY_MODE Stephen Boyd
2024-04-05 0:08 ` Abhinav Kumar
2024-04-05 0:56 ` Bjorn Andersson
2024-04-05 7:34 ` Johan Hovold
2024-04-05 2:56 ` Dmitry Baryshkov
2024-04-06 9:18 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox