Re: [PATCH 1/2] phy: qcom-qmp: Add MSM8996 UFS QMP support

From: Bjorn Andersson
Date: Thu Dec 19 2019 - 02:07:13 EST


On Wed 18 Dec 20:20 PST 2019, Vinod Koul wrote:

> On 07-12-19, 12:21, Bjorn Andersson wrote:
> > The support for the 14nm MSM8996 UFS PHY is currently handled by the
> > UFS-specific 14nm QMP driver, due to the earlier need for additional
> > operations beyond the standard PHY API.
> >
> > Add support for this PHY to the common QMP driver, to allow us to remove
> > the old driver.
> >
> > Signed-off-by: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>
> > ---
> > .../devicetree/bindings/phy/qcom-qmp-phy.txt | 5 +
> > drivers/phy/qualcomm/phy-qcom-qmp.c | 106 ++++++++++++++++++
> > 2 files changed, 111 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/phy/qcom-qmp-phy.txt b/Documentation/devicetree/bindings/phy/qcom-qmp-phy.txt
> > index eac9ad3cbbc8..5b99cf081817 100644
> > --- a/Documentation/devicetree/bindings/phy/qcom-qmp-phy.txt
> > +++ b/Documentation/devicetree/bindings/phy/qcom-qmp-phy.txt
> > @@ -8,6 +8,7 @@ Required properties:
> > - compatible: compatible list, contains:
> > "qcom,ipq8074-qmp-pcie-phy" for PCIe phy on IPQ8074
> > "qcom,msm8996-qmp-pcie-phy" for 14nm PCIe phy on msm8996,
> > + "qcom,msm8996-qmp-ufs-phy" for 14nm UFS phy on msm8996,
> > "qcom,msm8996-qmp-usb3-phy" for 14nm USB3 phy on msm8996,
> > "qcom,msm8998-qmp-usb3-phy" for USB3 QMP V3 phy on msm8998,
> > "qcom,msm8998-qmp-ufs-phy" for UFS QMP phy on msm8998,
> > @@ -44,6 +45,8 @@ Required properties:
> > For "qcom,ipq8074-qmp-pcie-phy": no clocks are listed.
> > For "qcom,msm8996-qmp-pcie-phy" must contain:
> > "aux", "cfg_ahb", "ref".
> > + For "qcom,msm8996-qmp-ufs-phy" must contain:
> > + "ref".
> > For "qcom,msm8996-qmp-usb3-phy" must contain:
> > "aux", "cfg_ahb", "ref".
> > For "qcom,msm8998-qmp-usb3-phy" must contain:
> > @@ -72,6 +75,8 @@ Required properties:
> > "phy", "common".
> > For "qcom,msm8996-qmp-pcie-phy" must contain:
> > "phy", "common", "cfg".
> > + For "qcom,msm8996-qmp-ufs-phy": must contain:
> > + "ufsphy".
> > For "qcom,msm8996-qmp-usb3-phy" must contain
> > "phy", "common".
> > For "qcom,msm8998-qmp-usb3-phy" must contain
> > diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c
> > index a6b8fc5798e2..d81516c4d747 100644
> > --- a/drivers/phy/qualcomm/phy-qcom-qmp.c
> > +++ b/drivers/phy/qualcomm/phy-qcom-qmp.c
> > @@ -121,6 +121,11 @@ enum qphy_reg_layout {
> > QPHY_PCS_LFPS_RXTERM_IRQ_STATUS,
> > };
> >
> > +static const unsigned int msm8996_ufsphy_regs_layout[] = {
> > + [QPHY_START_CTRL] = 0x00,
> > + [QPHY_PCS_READY_STATUS] = 0x168,
> > +};
> > +
> > static const unsigned int pciephy_regs_layout[] = {
> > [QPHY_COM_SW_RESET] = 0x400,
> > [QPHY_COM_POWER_DOWN_CONTROL] = 0x404,
> > @@ -330,6 +335,75 @@ static const struct qmp_phy_init_tbl msm8998_pcie_pcs_tbl[] = {
> > QMP_PHY_INIT_CFG(QPHY_V3_PCS_SIGDET_CNTRL, 0x03),
> > };
> >
> > +static const struct qmp_phy_init_tbl msm8996_ufs_serdes_tbl[] = {
> > + QMP_PHY_INIT_CFG(QPHY_POWER_DOWN_CONTROL, 0x01),
>
> Can you check this after adding the reset for ufs, I suspect you might
> run into same issue as I am seeing on 8150, power down here does not
> seem correct.
>

I'm not sure why we need to tickle POWER_DOWN here, but it's documented
as such, done in the old driver and without it the PHY does not come up.

Regards,
Bjorn