mbox series

[0/2] phy: qcom-qmp-usb: fix initialization of PCS_USB

Message ID 20230823171208.18382-1-athierry@redhat.com
Headers show
Series phy: qcom-qmp-usb: fix initialization of PCS_USB | expand

Message

Adrien Thierry Aug. 23, 2023, 5:12 p.m. UTC
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(-)

Comments

Bryan O'Donoghue Aug. 24, 2023, 9:15 a.m. UTC | #1
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
Adrien Thierry Aug. 24, 2023, 7:32 p.m. UTC | #2
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
Dmitry Baryshkov Aug. 24, 2023, 8:58 p.m. UTC | #3
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
>