linux-phy.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] phy: qcom-qmp-usb: fix initialization of PCS_USB
@ 2023-08-23 17:12 Adrien Thierry
  2023-08-23 17:12 ` [PATCH 1/2] phy: qcom-qmp-usb: initialize PCS_USB registers Adrien Thierry
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Adrien Thierry @ 2023-08-23 17:12 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Dmitry Baryshkov,
	Kishon Vijay Abraham I, Konrad Dybcio, Shazad Hussain, Vinod Koul
  Cc: Adrien Thierry, linux-arm-msm, linux-phy

This series attempts at making sure PCS_USB registers are properly
initialized. Please note I don't have access to the qmp phy datasheet and
only reasoned from the code, so I appreciate a double check to make sure
I'm not messing with the registers.

Adrien Thierry (2):
  phy: qcom-qmp-usb: initialize PCS_USB registers
  phy: qcom-qmp-usb: split PCS_USB init table for sc8280xp and sa8775p

 drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

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

* [PATCH 1/2] phy: qcom-qmp-usb: initialize PCS_USB registers
  2023-08-23 17:12 [PATCH 0/2] phy: qcom-qmp-usb: fix initialization of PCS_USB Adrien Thierry
@ 2023-08-23 17:12 ` Adrien Thierry
  2023-08-24 20:58   ` Dmitry Baryshkov
  2023-08-23 17:12 ` [PATCH 2/2] phy: qcom-qmp-usb: split PCS_USB init table for sc8280xp and sa8775p Adrien Thierry
  2023-08-24  9:15 ` [PATCH 0/2] phy: qcom-qmp-usb: fix initialization of PCS_USB Bryan O'Donoghue
  2 siblings, 1 reply; 7+ messages in thread
From: Adrien Thierry @ 2023-08-23 17:12 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul,
	Kishon Vijay Abraham I, Dmitry Baryshkov
  Cc: Adrien Thierry, linux-arm-msm, linux-phy

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")
Signed-off-by: Adrien Thierry <athierry@redhat.com>
---
 drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
index 466f0a56c82e..ccbe64f7897e 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
@@ -2233,6 +2233,7 @@ static int qmp_usb_power_on(struct phy *phy)
 	void __iomem *tx = qmp->tx;
 	void __iomem *rx = qmp->rx;
 	void __iomem *pcs = qmp->pcs;
+	void __iomem *pcs_usb = qmp->pcs_usb ?: qmp->pcs;
 	void __iomem *status;
 	unsigned int val;
 	int ret;
@@ -2255,6 +2256,7 @@ static int qmp_usb_power_on(struct phy *phy)
 	}
 
 	qmp_usb_configure(pcs, cfg->pcs_tbl, cfg->pcs_tbl_num);
+	qmp_usb_configure(pcs_usb, cfg->pcs_usb_tbl, cfg->pcs_usb_tbl_num);
 
 	if (cfg->has_pwrdn_delay)
 		usleep_range(10, 20);
-- 
2.41.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

* [PATCH 2/2] phy: qcom-qmp-usb: split PCS_USB init table for sc8280xp and sa8775p
  2023-08-23 17:12 [PATCH 0/2] phy: qcom-qmp-usb: fix initialization of PCS_USB Adrien Thierry
  2023-08-23 17:12 ` [PATCH 1/2] phy: qcom-qmp-usb: initialize PCS_USB registers Adrien Thierry
@ 2023-08-23 17:12 ` Adrien Thierry
  2023-08-24 20:52   ` Dmitry Baryshkov
  2023-08-24  9:15 ` [PATCH 0/2] phy: qcom-qmp-usb: fix initialization of PCS_USB Bryan O'Donoghue
  2 siblings, 1 reply; 7+ messages in thread
From: Adrien Thierry @ 2023-08-23 17:12 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul,
	Kishon Vijay Abraham I, Dmitry Baryshkov, Shazad Hussain
  Cc: Adrien Thierry, linux-arm-msm, linux-phy

For sc8280xp and sa8775p, PCS and PCS_USB initialization data is
described in the same table, thus the pcs_usb offset is not being
applied during initialization of PCS_USB registers. Fix this by adding
the appropriate pcs_usb_tbl tables.

Fixes: 8bd2d6e11c99 ("phy: qcom-qmp: Add SA8775P USB3 UNI phy")
Fixes: c0c7769cdae2 ("phy: qcom-qmp: Add SC8280XP USB3 UNI phy")
Signed-off-by: Adrien Thierry <athierry@redhat.com>
---
 drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
index ccbe64f7897e..22bcf11494d5 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
@@ -1480,8 +1480,6 @@ static const struct qmp_phy_init_tbl sc8280xp_usb3_uniphy_pcs_tbl[] = {
 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_RCVR_DTCT_DLY_P1U2_H, 0x03),
 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_RX_SIGDET_LVL, 0xaa),
 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCS_TX_RX_CONFIG, 0x0c),
-	QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07),
-	QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8),
 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_CDR_RESET_TIME, 0x0a),
 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_ALIGN_DETECT_CONFIG1, 0x88),
 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_ALIGN_DETECT_CONFIG2, 0x13),
@@ -1490,6 +1488,11 @@ static const struct qmp_phy_init_tbl sc8280xp_usb3_uniphy_pcs_tbl[] = {
 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_REFGEN_REQ_CONFIG1, 0x21),
 };
 
+static const struct qmp_phy_init_tbl sc8280xp_usb3_uniphy_pcs_usb_tbl[] = {
+	QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07),
+	QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8),
+};
+
 static const struct qmp_phy_init_tbl sa8775p_usb3_uniphy_pcs_tbl[] = {
 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_LOCK_DETECT_CONFIG1, 0xc4),
 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_LOCK_DETECT_CONFIG2, 0x89),
@@ -1499,9 +1502,6 @@ static const struct qmp_phy_init_tbl sa8775p_usb3_uniphy_pcs_tbl[] = {
 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_RCVR_DTCT_DLY_P1U2_H, 0x03),
 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_RX_SIGDET_LVL, 0xaa),
 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCS_TX_RX_CONFIG, 0x0c),
-	QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07),
-	QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8),
-	QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_POWER_STATE_CONFIG1, 0x6f),
 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_CDR_RESET_TIME, 0x0a),
 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_ALIGN_DETECT_CONFIG1, 0x88),
 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_ALIGN_DETECT_CONFIG2, 0x13),
@@ -1510,6 +1510,12 @@ static const struct qmp_phy_init_tbl sa8775p_usb3_uniphy_pcs_tbl[] = {
 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_REFGEN_REQ_CONFIG1, 0x21),
 };
 
+static const struct qmp_phy_init_tbl sa8775p_usb3_uniphy_pcs_usb_tbl[] = {
+	QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07),
+	QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8),
+	QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_POWER_STATE_CONFIG1, 0x6f),
+};
+
 struct qmp_usb_offsets {
 	u16 serdes;
 	u16 pcs;
@@ -1788,6 +1794,8 @@ static const struct qmp_phy_cfg sa8775p_usb3_uniphy_cfg = {
 	.rx_tbl_num		= ARRAY_SIZE(sc8280xp_usb3_uniphy_rx_tbl),
 	.pcs_tbl		= sa8775p_usb3_uniphy_pcs_tbl,
 	.pcs_tbl_num		= ARRAY_SIZE(sa8775p_usb3_uniphy_pcs_tbl),
+	.pcs_usb_tbl		= sa8775p_usb3_uniphy_pcs_usb_tbl,
+	.pcs_usb_tbl_num	= ARRAY_SIZE(sa8775p_usb3_uniphy_pcs_usb_tbl),
 	.clk_list		= qmp_v4_phy_clk_l,
 	.num_clks		= ARRAY_SIZE(qmp_v4_phy_clk_l),
 	.reset_list		= qcm2290_usb3phy_reset_l,
@@ -1833,6 +1841,8 @@ static const struct qmp_phy_cfg sc8280xp_usb3_uniphy_cfg = {
 	.rx_tbl_num		= ARRAY_SIZE(sc8280xp_usb3_uniphy_rx_tbl),
 	.pcs_tbl		= sc8280xp_usb3_uniphy_pcs_tbl,
 	.pcs_tbl_num		= ARRAY_SIZE(sc8280xp_usb3_uniphy_pcs_tbl),
+	.pcs_usb_tbl		= sc8280xp_usb3_uniphy_pcs_usb_tbl,
+	.pcs_usb_tbl_num	= ARRAY_SIZE(sc8280xp_usb3_uniphy_pcs_usb_tbl),
 	.clk_list		= qmp_v4_phy_clk_l,
 	.num_clks		= ARRAY_SIZE(qmp_v4_phy_clk_l),
 	.reset_list		= qcm2290_usb3phy_reset_l,
-- 
2.41.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 0/2] phy: qcom-qmp-usb: fix initialization of PCS_USB
  2023-08-23 17:12 [PATCH 0/2] phy: qcom-qmp-usb: fix initialization of PCS_USB Adrien Thierry
  2023-08-23 17:12 ` [PATCH 1/2] phy: qcom-qmp-usb: initialize PCS_USB registers Adrien Thierry
  2023-08-23 17:12 ` [PATCH 2/2] phy: qcom-qmp-usb: split PCS_USB init table for sc8280xp and sa8775p Adrien Thierry
@ 2023-08-24  9:15 ` Bryan O'Donoghue
  2023-08-24 19:32   ` Adrien Thierry
  2 siblings, 1 reply; 7+ messages in thread
From: Bryan O'Donoghue @ 2023-08-24  9:15 UTC (permalink / raw)
  To: Adrien Thierry, Andy Gross, Bjorn Andersson, Dmitry Baryshkov,
	Kishon Vijay Abraham I, Konrad Dybcio, Shazad Hussain, Vinod Koul
  Cc: linux-arm-msm, linux-phy

On 23/08/2023 18:12, Adrien Thierry wrote:
> This series attempts at making sure PCS_USB registers are properly
> initialized. Please note I don't have access to the qmp phy datasheet and
> only reasoned from the code, so I appreciate a double check to make sure
> I'm not messing with the registers.
> 
> Adrien Thierry (2):
>    phy: qcom-qmp-usb: initialize PCS_USB registers
>    phy: qcom-qmp-usb: split PCS_USB init table for sc8280xp and sa8775p
> 
>   drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 22 +++++++++++++++++-----
>   1 file changed, 17 insertions(+), 5 deletions(-)
> 

How is this series tested ? What are the before/after results/effects ?

---
bod

-- 
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 0/2] phy: qcom-qmp-usb: fix initialization of PCS_USB
  2023-08-24  9:15 ` [PATCH 0/2] phy: qcom-qmp-usb: fix initialization of PCS_USB Bryan O'Donoghue
@ 2023-08-24 19:32   ` Adrien Thierry
  0 siblings, 0 replies; 7+ messages in thread
From: Adrien Thierry @ 2023-08-24 19:32 UTC (permalink / raw)
  To: Bryan O'Donoghue
  Cc: Andy Gross, Bjorn Andersson, Dmitry Baryshkov,
	Kishon Vijay Abraham I, Konrad Dybcio, Shazad Hussain, Vinod Koul,
	linux-arm-msm, linux-phy

Hi Bryan,

On Thu, Aug 24, 2023 at 10:15:32AM +0100, Bryan O'Donoghue wrote:
> On 23/08/2023 18:12, Adrien Thierry wrote:
> > This series attempts at making sure PCS_USB registers are properly
> > initialized. Please note I don't have access to the qmp phy datasheet and
> > only reasoned from the code, so I appreciate a double check to make sure
> > I'm not messing with the registers.
> > 
> > Adrien Thierry (2):
> >    phy: qcom-qmp-usb: initialize PCS_USB registers
> >    phy: qcom-qmp-usb: split PCS_USB init table for sc8280xp and sa8775p
> > 
> >   drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 22 +++++++++++++++++-----
> >   1 file changed, 17 insertions(+), 5 deletions(-)
> > 
> 
> How is this series tested ? What are the before/after results/effects ?
> 

I tested this series on the sa8775p. AFAICT there's no noticeable change
before/after the patch series: lsusb and dmesg output are the same. USB is
still working properly. I don't know what those PCS_USB registers do
exactly on the qmp PHY and I don't have access to docs, so it's hard for
me to tell the impact of them being initialized vs not.

> ---
> bod

Best,
Adrien


-- 
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 2/2] phy: qcom-qmp-usb: split PCS_USB init table for sc8280xp and sa8775p
  2023-08-23 17:12 ` [PATCH 2/2] phy: qcom-qmp-usb: split PCS_USB init table for sc8280xp and sa8775p Adrien Thierry
@ 2023-08-24 20:52   ` Dmitry Baryshkov
  0 siblings, 0 replies; 7+ messages in thread
From: Dmitry Baryshkov @ 2023-08-24 20:52 UTC (permalink / raw)
  To: Adrien Thierry
  Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul,
	Kishon Vijay Abraham I, Shazad Hussain, linux-arm-msm, linux-phy

On Wed, 23 Aug 2023 at 20:12, Adrien Thierry <athierry@redhat.com> wrote:
>
> For sc8280xp and sa8775p, PCS and PCS_USB initialization data is
> described in the same table, thus the pcs_usb offset is not being
> applied during initialization of PCS_USB registers. Fix this by adding
> the appropriate pcs_usb_tbl tables.
>
> Fixes: 8bd2d6e11c99 ("phy: qcom-qmp: Add SA8775P USB3 UNI phy")
> Fixes: c0c7769cdae2 ("phy: qcom-qmp: Add SC8280XP USB3 UNI phy")
> Signed-off-by: Adrien Thierry <athierry@redhat.com>

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

> ---
>  drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 20 +++++++++++++++-----
>  1 file changed, 15 insertions(+), 5 deletions(-)


-- 
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-usb: initialize PCS_USB registers
  2023-08-23 17:12 ` [PATCH 1/2] phy: qcom-qmp-usb: initialize PCS_USB registers Adrien Thierry
@ 2023-08-24 20:58   ` Dmitry Baryshkov
  0 siblings, 0 replies; 7+ messages in thread
From: Dmitry Baryshkov @ 2023-08-24 20:58 UTC (permalink / raw)
  To: Adrien Thierry
  Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul,
	Kishon Vijay Abraham I, linux-arm-msm, linux-phy

On Wed, 23 Aug 2023 at 20:12, Adrien Thierry <athierry@redhat.com> 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")
> Signed-off-by: Adrien Thierry <athierry@redhat.com>
> ---
>  drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
> index 466f0a56c82e..ccbe64f7897e 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
> @@ -2233,6 +2233,7 @@ static int qmp_usb_power_on(struct phy *phy)
>         void __iomem *tx = qmp->tx;
>         void __iomem *rx = qmp->rx;
>         void __iomem *pcs = qmp->pcs;
> +       void __iomem *pcs_usb = qmp->pcs_usb ?: qmp->pcs;
>         void __iomem *status;
>         unsigned int val;
>         int ret;
> @@ -2255,6 +2256,7 @@ static int qmp_usb_power_on(struct phy *phy)
>         }
>
>         qmp_usb_configure(pcs, cfg->pcs_tbl, cfg->pcs_tbl_num);
> +       qmp_usb_configure(pcs_usb, cfg->pcs_usb_tbl, cfg->pcs_usb_tbl_num);

I think we don't need to fallback to pcs here: if there is a separate
pcs_usb_tbl, we need a separate pcs_usb region. Just pass qmp->pcs_usb
here.

>
>         if (cfg->has_pwrdn_delay)
>                 usleep_range(10, 20);
> --
> 2.41.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

end of thread, other threads:[~2023-08-24 20:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-23 17:12 [PATCH 0/2] phy: qcom-qmp-usb: fix initialization of PCS_USB Adrien Thierry
2023-08-23 17:12 ` [PATCH 1/2] phy: qcom-qmp-usb: initialize PCS_USB registers Adrien Thierry
2023-08-24 20:58   ` Dmitry Baryshkov
2023-08-23 17:12 ` [PATCH 2/2] phy: qcom-qmp-usb: split PCS_USB init table for sc8280xp and sa8775p Adrien Thierry
2023-08-24 20:52   ` Dmitry Baryshkov
2023-08-24  9:15 ` [PATCH 0/2] phy: qcom-qmp-usb: fix initialization of PCS_USB Bryan O'Donoghue
2023-08-24 19:32   ` Adrien Thierry

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