* [PATCH v2 0/2] 8550 USB QMPPHY fixups
@ 2023-09-11 19:32 Konrad Dybcio
2023-09-11 19:32 ` [PATCH v2 1/2] phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1 Konrad Dybcio
2023-09-11 19:32 ` [PATCH v2 2/2] phy: qcom-qmp-combo: initialize PCS_USB registers Konrad Dybcio
0 siblings, 2 replies; 6+ messages in thread
From: Konrad Dybcio @ 2023-09-11 19:32 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>
---
Changes in v2:
- Pick up tags
- "Q6" -> "V6"
- Link to v1: https://lore.kernel.org/r/20230829-topic-8550_usbphy-v1-0-599ddbfa094a@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: 7bc675554773f09d88101bf1ccfc8537dc7c0be9
change-id: 20230829-topic-8550_usbphy-691f367b9b3e
Best regards,
--
Konrad Dybcio <konrad.dybcio@linaro.org>
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH v2 1/2] phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1 2023-09-11 19:32 [PATCH v2 0/2] 8550 USB QMPPHY fixups Konrad Dybcio @ 2023-09-11 19:32 ` Konrad Dybcio 2023-09-11 19:37 ` Dmitry Baryshkov 2023-09-12 10:06 ` kernel test robot 2023-09-11 19:32 ` [PATCH v2 2/2] phy: qcom-qmp-combo: initialize PCS_USB registers Konrad Dybcio 1 sibling, 2 replies; 6+ messages in thread From: Konrad Dybcio @ 2023-09-11 19:32 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") Reviewed-by: Abel Vesa <abel.vesa@linaro.org> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> 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..c38530d6776b 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_V6_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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1 2023-09-11 19:32 ` [PATCH v2 1/2] phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1 Konrad Dybcio @ 2023-09-11 19:37 ` Dmitry Baryshkov 2023-09-11 20:03 ` Konrad Dybcio 2023-09-12 10:06 ` kernel test robot 1 sibling, 1 reply; 6+ messages in thread From: Dmitry Baryshkov @ 2023-09-11 19:37 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 Mon, 11 Sept 2023 at 22:32, 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") > Reviewed-by: Abel Vesa <abel.vesa@linaro.org> > Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > 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), And this is still _Q6_ > 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..c38530d6776b 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_V6_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 > -- With best wishes Dmitry ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1 2023-09-11 19:37 ` Dmitry Baryshkov @ 2023-09-11 20:03 ` Konrad Dybcio 0 siblings, 0 replies; 6+ messages in thread From: Konrad Dybcio @ 2023-09-11 20:03 UTC (permalink / raw) To: Dmitry Baryshkov 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 11.09.2023 21:37, Dmitry Baryshkov wrote: > On Mon, 11 Sept 2023 at 22:32, 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") >> Reviewed-by: Abel Vesa <abel.vesa@linaro.org> >> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> >> 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), > > And this is still _Q6_ Gah, I thought about compiletesting but pride got me.. Konrad ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1 2023-09-11 19:32 ` [PATCH v2 1/2] phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1 Konrad Dybcio 2023-09-11 19:37 ` Dmitry Baryshkov @ 2023-09-12 10:06 ` kernel test robot 1 sibling, 0 replies; 6+ messages in thread From: kernel test robot @ 2023-09-12 10:06 UTC (permalink / raw) To: Konrad Dybcio, Andy Gross, Bjorn Andersson, Vinod Koul, Kishon Vijay Abraham I, Abel Vesa, Johan Hovold, Dmitry Baryshkov Cc: llvm, oe-kbuild-all, Marijn Suijten, linux-arm-msm, linux-phy, linux-kernel, Konrad Dybcio Hi Konrad, kernel test robot noticed the following build errors: [auto build test ERROR on linus/master] [also build test ERROR on v6.6-rc1 next-20230912] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Konrad-Dybcio/phy-qcom-qmp-combo-initialize-PCS_USB-registers/20230912-072106 base: linus/master patch link: https://lore.kernel.org/r/20230829-topic-8550_usbphy-v2-1-a72f43311d19%40linaro.org patch subject: [PATCH v2 1/2] phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1 config: arm-randconfig-r016-20230912 (https://download.01.org/0day-ci/archive/20230912/202309121747.8Ln8K1XY-lkp@intel.com/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230912/202309121747.8Ln8K1XY-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202309121747.8Ln8K1XY-lkp@intel.com/ All errors (new ones prefixed by >>): >> drivers/phy/qualcomm/phy-qcom-qmp-combo.c:865:19: error: use of undeclared identifier 'QPHY_USB_Q6_PCS_USB3_POWER_STATE_CONFIG1' 865 | QMP_PHY_INIT_CFG(QPHY_USB_Q6_PCS_USB3_POWER_STATE_CONFIG1, 0x68), | ^ >> drivers/phy/qualcomm/phy-qcom-qmp-combo.c:1837:21: error: invalid application of 'sizeof' to an incomplete type 'const struct qmp_phy_init_tbl[]' 1837 | .pcs_usb_tbl_num = ARRAY_SIZE(sm8550_usb3_pcs_usb_tbl), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/kernel.h:57:32: note: expanded from macro 'ARRAY_SIZE' 57 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | ^~~~~ 2 errors generated. vim +/QPHY_USB_Q6_PCS_USB3_POWER_STATE_CONFIG1 +865 drivers/phy/qualcomm/phy-qcom-qmp-combo.c 863 864 static const struct qmp_phy_init_tbl sm8550_usb3_pcs_usb_tbl[] = { > 865 QMP_PHY_INIT_CFG(QPHY_USB_Q6_PCS_USB3_POWER_STATE_CONFIG1, 0x68), 866 QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8), 867 QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07), 868 QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_RCVR_DTCT_DLY_U3_L, 0x40), 869 QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_RCVR_DTCT_DLY_U3_H, 0x00), 870 }; 871 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] phy: qcom-qmp-combo: initialize PCS_USB registers 2023-09-11 19:32 [PATCH v2 0/2] 8550 USB QMPPHY fixups Konrad Dybcio 2023-09-11 19:32 ` [PATCH v2 1/2] phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1 Konrad Dybcio @ 2023-09-11 19:32 ` Konrad Dybcio 1 sibling, 0 replies; 6+ messages in thread From: Konrad Dybcio @ 2023-09-11 19:32 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> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-09-12 10:07 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-09-11 19:32 [PATCH v2 0/2] 8550 USB QMPPHY fixups Konrad Dybcio 2023-09-11 19:32 ` [PATCH v2 1/2] phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1 Konrad Dybcio 2023-09-11 19:37 ` Dmitry Baryshkov 2023-09-11 20:03 ` Konrad Dybcio 2023-09-12 10:06 ` kernel test robot 2023-09-11 19:32 ` [PATCH v2 2/2] phy: qcom-qmp-combo: initialize PCS_USB registers Konrad Dybcio
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®