* [PATCH 0/2] 8550 USB QMPPHY fixups
@ 2023-08-29 20:59 Konrad Dybcio
2023-08-29 20:59 ` [PATCH 1/2] phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1 Konrad Dybcio
2023-08-29 20:59 ` [PATCH 2/2] phy: qcom-qmp-combo: initialize PCS_USB registers Konrad Dybcio
0 siblings, 2 replies; 7+ messages in thread
From: Konrad Dybcio @ 2023-08-29 20:59 UTC (permalink / raw)
To: Andy Gross, Bjorn Andersson, Vinod Koul, Kishon Vijay Abraham I,
Abel Vesa, Johan Hovold, Dmitry Baryshkov
Cc: Marijn Suijten, linux-arm-msm, linux-phy, linux-kernel,
Konrad Dybcio, Adrien Thierry
Inspired by [1] I went over the 8550 QMPPHY init sequences and found
some inconsistencies. This series attempts to fix them.
[1] https://lore.kernel.org/linux-arm-msm/20230828152353.16529-1-athierry@redhat.com/
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
Konrad Dybcio (2):
phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1
phy: qcom-qmp-combo: initialize PCS_USB registers
drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 6 +++++-
drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h | 3 ++-
2 files changed, 7 insertions(+), 2 deletions(-)
---
base-commit: ae782d4e2bf53b0b642ae860794f7a39470f995a
change-id: 20230829-topic-8550_usbphy-691f367b9b3e
Best regards,
--
Konrad Dybcio <konrad.dybcio@linaro.org>
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 1/2] phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1 2023-08-29 20:59 [PATCH 0/2] 8550 USB QMPPHY fixups Konrad Dybcio @ 2023-08-29 20:59 ` Konrad Dybcio 2023-08-29 22:55 ` Dmitry Baryshkov ` (2 more replies) 2023-08-29 20:59 ` [PATCH 2/2] phy: qcom-qmp-combo: initialize PCS_USB registers Konrad Dybcio 1 sibling, 3 replies; 7+ messages in thread From: Konrad Dybcio @ 2023-08-29 20:59 UTC (permalink / raw) To: Andy Gross, Bjorn Andersson, Vinod Koul, Kishon Vijay Abraham I, Abel Vesa, Johan Hovold, Dmitry Baryshkov Cc: Marijn Suijten, linux-arm-msm, linux-phy, linux-kernel, Konrad Dybcio There are two instances of the POWER_STATE_CONFIG1 register: one in the PCS space and another one in PCS_USB. The downstream init sequence pokes the latter one while we've been poking the former one (and misnamed it as the latter one, impostor!). Fix that up to avoid UB. Fixes: 49742e9edab3 ("phy: qcom-qmp-combo: Add support for SM8550") Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> --- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 2 +- drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c index cbb28afce135..843099d314bf 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c @@ -859,10 +859,10 @@ static const struct qmp_phy_init_tbl sm8550_usb3_pcs_tbl[] = { QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_PCS_TX_RX_CONFIG, 0x0c), QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_EQ_CONFIG1, 0x4b), QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_EQ_CONFIG5, 0x10), - QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_POWER_STATE_CONFIG1, 0x68), }; static const struct qmp_phy_init_tbl sm8550_usb3_pcs_usb_tbl[] = { + QMP_PHY_INIT_CFG(QPHY_USB_Q6_PCS_USB3_POWER_STATE_CONFIG1, 0x68), QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8), QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07), QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_RCVR_DTCT_DLY_U3_L, 0x40), diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h b/drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h index 9510e63ba9d8..b9060c242fd2 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h @@ -12,7 +12,7 @@ #define QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG3 0xcc #define QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG6 0xd8 #define QPHY_USB_V6_PCS_REFGEN_REQ_CONFIG1 0xdc -#define QPHY_USB_V6_PCS_USB3_POWER_STATE_CONFIG1 0x90 +#define QPHY_USB_V6_PCS_POWER_STATE_CONFIG1 0x90 #define QPHY_USB_V6_PCS_RX_SIGDET_LVL 0x188 #define QPHY_USB_V6_PCS_RCVR_DTCT_DLY_P1U2_L 0x190 #define QPHY_USB_V6_PCS_RCVR_DTCT_DLY_P1U2_H 0x194 @@ -23,6 +23,7 @@ #define QPHY_USB_V6_PCS_EQ_CONFIG1 0x1dc #define QPHY_USB_V6_PCS_EQ_CONFIG5 0x1ec +#define QPHY_USB_Q6_PCS_USB3_POWER_STATE_CONFIG1 0x00 #define QPHY_USB_V6_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL 0x18 #define QPHY_USB_V6_PCS_USB3_RXEQTRAINING_DFE_TIME_S2 0x3c #define QPHY_USB_V6_PCS_USB3_RCVR_DTCT_DLY_U3_L 0x40 -- 2.42.0 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1 2023-08-29 20:59 ` [PATCH 1/2] phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1 Konrad Dybcio @ 2023-08-29 22:55 ` Dmitry Baryshkov 2023-09-01 17:30 ` Abel Vesa 2023-09-11 19:03 ` Dmitry Baryshkov 2 siblings, 0 replies; 7+ messages in thread From: Dmitry Baryshkov @ 2023-08-29 22:55 UTC (permalink / raw) To: Konrad Dybcio Cc: Andy Gross, Bjorn Andersson, Vinod Koul, Kishon Vijay Abraham I, Abel Vesa, Johan Hovold, Marijn Suijten, linux-arm-msm, linux-phy, linux-kernel On Tue, 29 Aug 2023 at 23:59, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: > > There are two instances of the POWER_STATE_CONFIG1 register: one in > the PCS space and another one in PCS_USB. > > The downstream init sequence pokes the latter one while we've been poking > the former one (and misnamed it as the latter one, impostor!). Fix that > up to avoid UB. > > Fixes: 49742e9edab3 ("phy: qcom-qmp-combo: Add support for SM8550") > Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> > --- > drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 2 +- > drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h | 3 ++- > 2 files changed, 3 insertions(+), 2 deletions(-) > Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> -- With best wishes Dmitry -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1 2023-08-29 20:59 ` [PATCH 1/2] phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1 Konrad Dybcio 2023-08-29 22:55 ` Dmitry Baryshkov @ 2023-09-01 17:30 ` Abel Vesa 2023-09-11 19:03 ` Dmitry Baryshkov 2 siblings, 0 replies; 7+ messages in thread From: Abel Vesa @ 2023-09-01 17:30 UTC (permalink / raw) To: Konrad Dybcio Cc: Andy Gross, Bjorn Andersson, Vinod Koul, Kishon Vijay Abraham I, Johan Hovold, Dmitry Baryshkov, Marijn Suijten, linux-arm-msm, linux-phy, linux-kernel On 23-08-29 22:59:04, Konrad Dybcio wrote: > There are two instances of the POWER_STATE_CONFIG1 register: one in > the PCS space and another one in PCS_USB. > > The downstream init sequence pokes the latter one while we've been poking > the former one (and misnamed it as the latter one, impostor!). Fix that > up to avoid UB. > > Fixes: 49742e9edab3 ("phy: qcom-qmp-combo: Add support for SM8550") > Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> Reviewed-by: Abel Vesa <abel.vesa@linaro.org> > --- > drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 2 +- > drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h | 3 ++- > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c > index cbb28afce135..843099d314bf 100644 > --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c > +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c > @@ -859,10 +859,10 @@ static const struct qmp_phy_init_tbl sm8550_usb3_pcs_tbl[] = { > QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_PCS_TX_RX_CONFIG, 0x0c), > QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_EQ_CONFIG1, 0x4b), > QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_EQ_CONFIG5, 0x10), > - QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_POWER_STATE_CONFIG1, 0x68), > }; > > static const struct qmp_phy_init_tbl sm8550_usb3_pcs_usb_tbl[] = { > + QMP_PHY_INIT_CFG(QPHY_USB_Q6_PCS_USB3_POWER_STATE_CONFIG1, 0x68), > QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8), > QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07), > QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_RCVR_DTCT_DLY_U3_L, 0x40), > diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h b/drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h > index 9510e63ba9d8..b9060c242fd2 100644 > --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h > +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h > @@ -12,7 +12,7 @@ > #define QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG3 0xcc > #define QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG6 0xd8 > #define QPHY_USB_V6_PCS_REFGEN_REQ_CONFIG1 0xdc > -#define QPHY_USB_V6_PCS_USB3_POWER_STATE_CONFIG1 0x90 > +#define QPHY_USB_V6_PCS_POWER_STATE_CONFIG1 0x90 > #define QPHY_USB_V6_PCS_RX_SIGDET_LVL 0x188 > #define QPHY_USB_V6_PCS_RCVR_DTCT_DLY_P1U2_L 0x190 > #define QPHY_USB_V6_PCS_RCVR_DTCT_DLY_P1U2_H 0x194 > @@ -23,6 +23,7 @@ > #define QPHY_USB_V6_PCS_EQ_CONFIG1 0x1dc > #define QPHY_USB_V6_PCS_EQ_CONFIG5 0x1ec > > +#define QPHY_USB_Q6_PCS_USB3_POWER_STATE_CONFIG1 0x00 > #define QPHY_USB_V6_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL 0x18 > #define QPHY_USB_V6_PCS_USB3_RXEQTRAINING_DFE_TIME_S2 0x3c > #define QPHY_USB_V6_PCS_USB3_RCVR_DTCT_DLY_U3_L 0x40 > > -- > 2.42.0 > -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1 2023-08-29 20:59 ` [PATCH 1/2] phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1 Konrad Dybcio 2023-08-29 22:55 ` Dmitry Baryshkov 2023-09-01 17:30 ` Abel Vesa @ 2023-09-11 19:03 ` Dmitry Baryshkov 2 siblings, 0 replies; 7+ messages in thread From: Dmitry Baryshkov @ 2023-09-11 19:03 UTC (permalink / raw) To: Konrad Dybcio Cc: Andy Gross, Bjorn Andersson, Vinod Koul, Kishon Vijay Abraham I, Abel Vesa, Johan Hovold, Marijn Suijten, linux-arm-msm, linux-phy, linux-kernel On Tue, 29 Aug 2023 at 23:59, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: > > There are two instances of the POWER_STATE_CONFIG1 register: one in > the PCS space and another one in PCS_USB. > > The downstream init sequence pokes the latter one while we've been poking > the former one (and misnamed it as the latter one, impostor!). Fix that > up to avoid UB. > > Fixes: 49742e9edab3 ("phy: qcom-qmp-combo: Add support for SM8550") > Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> > --- > drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 2 +- > drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h | 3 ++- > 2 files changed, 3 insertions(+), 2 deletions(-) [skipped] > @@ -23,6 +23,7 @@ > #define QPHY_USB_V6_PCS_EQ_CONFIG1 0x1dc > #define QPHY_USB_V6_PCS_EQ_CONFIG5 0x1ec > > +#define QPHY_USB_Q6_PCS_USB3_POWER_STATE_CONFIG1 0x00 Konrad, could you please send v2, fixing this to be _V6_ rather than _Q6_. I'll rebase my series on top of this. > #define QPHY_USB_V6_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL 0x18 > #define QPHY_USB_V6_PCS_USB3_RXEQTRAINING_DFE_TIME_S2 0x3c > #define QPHY_USB_V6_PCS_USB3_RCVR_DTCT_DLY_U3_L 0x40 > > -- > 2.42.0 > -- With best wishes Dmitry -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] phy: qcom-qmp-combo: initialize PCS_USB registers 2023-08-29 20:59 [PATCH 0/2] 8550 USB QMPPHY fixups Konrad Dybcio 2023-08-29 20:59 ` [PATCH 1/2] phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1 Konrad Dybcio @ 2023-08-29 20:59 ` Konrad Dybcio 2023-08-29 22:55 ` Dmitry Baryshkov 1 sibling, 1 reply; 7+ messages in thread From: Konrad Dybcio @ 2023-08-29 20:59 UTC (permalink / raw) To: Andy Gross, Bjorn Andersson, Vinod Koul, Kishon Vijay Abraham I, Abel Vesa, Johan Hovold, Dmitry Baryshkov Cc: Marijn Suijten, linux-arm-msm, linux-phy, linux-kernel, Konrad Dybcio, Adrien Thierry Currently, PCS_USB registers that have their initialization data in a pcs_usb_tbl table are never initialized. Fix that. Fixes: fc64623637da ("phy: qcom-qmp-combo,usb: add support for separate PCS_USB region") Reported-by: Adrien Thierry <athierry@redhat.com> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> --- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c index 843099d314bf..1922b05403ac 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c @@ -2555,6 +2555,7 @@ static int qmp_combo_usb_power_on(struct phy *phy) void __iomem *tx2 = qmp->tx2; void __iomem *rx2 = qmp->rx2; void __iomem *pcs = qmp->pcs; + void __iomem *pcs_usb = qmp->pcs_usb; void __iomem *status; unsigned int val; int ret; @@ -2576,6 +2577,9 @@ static int qmp_combo_usb_power_on(struct phy *phy) qmp_combo_configure(pcs, cfg->pcs_tbl, cfg->pcs_tbl_num); + if (pcs_usb) + qmp_combo_configure(pcs_usb, cfg->pcs_usb_tbl, cfg->pcs_usb_tbl_num); + if (cfg->has_pwrdn_delay) usleep_range(10, 20); -- 2.42.0 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] phy: qcom-qmp-combo: initialize PCS_USB registers 2023-08-29 20:59 ` [PATCH 2/2] phy: qcom-qmp-combo: initialize PCS_USB registers Konrad Dybcio @ 2023-08-29 22:55 ` Dmitry Baryshkov 0 siblings, 0 replies; 7+ messages in thread From: Dmitry Baryshkov @ 2023-08-29 22:55 UTC (permalink / raw) To: Konrad Dybcio Cc: Andy Gross, Bjorn Andersson, Vinod Koul, Kishon Vijay Abraham I, Abel Vesa, Johan Hovold, Marijn Suijten, linux-arm-msm, linux-phy, linux-kernel, Adrien Thierry On Tue, 29 Aug 2023 at 23:59, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: > > Currently, PCS_USB registers that have their initialization data in a > pcs_usb_tbl table are never initialized. Fix that. > > Fixes: fc64623637da ("phy: qcom-qmp-combo,usb: add support for separate PCS_USB region") > Reported-by: Adrien Thierry <athierry@redhat.com> > Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> > --- > drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 4 ++++ > 1 file changed, 4 insertions(+) Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> -- With best wishes Dmitry -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-09-11 19:04 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-08-29 20:59 [PATCH 0/2] 8550 USB QMPPHY fixups Konrad Dybcio 2023-08-29 20:59 ` [PATCH 1/2] phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1 Konrad Dybcio 2023-08-29 22:55 ` Dmitry Baryshkov 2023-09-01 17:30 ` Abel Vesa 2023-09-11 19:03 ` Dmitry Baryshkov 2023-08-29 20:59 ` [PATCH 2/2] phy: qcom-qmp-combo: initialize PCS_USB registers Konrad Dybcio 2023-08-29 22:55 ` Dmitry Baryshkov
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).