Re: [PATCH v2 3/6] phy: qcom-qusb2: Add QUSB2 PHY support for msm8998

From: Jeffrey Hugo
Date: Thu Jan 17 2019 - 12:57:26 EST


On 1/17/2019 3:52 AM, Kishon Vijay Abraham I wrote:
Hi,

On 16/01/19 8:58 PM, Jeffrey Hugo wrote:
On 1/16/2019 1:58 AM, Kishon Vijay Abraham I wrote:
Hi,

On 16/01/19 2:20 PM, Kishon Vijay Abraham I wrote:


On 15/01/19 11:41 PM, Bjorn Andersson wrote:
On Mon 14 Jan 08:36 PST 2019, Jeffrey Hugo wrote:

MSM8998 contains one QUSB2 PHY which is very similar to the existing
sdm845 support.


I don't seem to have the dt-binding patch in my inbox. Can you send them as
well?

Ignore my request. I found the patch.

Sorry about that. I was made aware there is something glitched when sending
this out, and the series didn't get threaded properly. I'll be investigating
and correcting for the next time I need to send out a series.

Is this change acceptable? I saw you picked up patch 1 (phy bindings) and
patch 4 (QMP phy changes), but not this one. I do want to see as much of this
hit 5.1 as possible, so if there is anything I need to correct, please let me
know. I'd be happy to update.

I've updated the tree now. Can you check if everything looks alright w.r.t your
patches?

Looks great. Thank you very much for taking all the phy changes.


Thanks
Kishon


Thanks
Kishon


Thanks
Kishon
Reviewed-by: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>

Signed-off-by: Jeffrey Hugo <jhugo@xxxxxxxxxxxxxx>
---
 drivers/phy/qualcomm/phy-qcom-qusb2.c | 41
+++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/drivers/phy/qualcomm/phy-qcom-qusb2.c
b/drivers/phy/qualcomm/phy-qcom-qusb2.c
index 9177989f..e5e4f36 100644
--- a/drivers/phy/qualcomm/phy-qcom-qusb2.c
+++ b/drivers/phy/qualcomm/phy-qcom-qusb2.c
@@ -152,6 +152,32 @@ enum qusb2phy_reg_layout {
ÂÂÂÂÂ QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_PWR_CTRL, 0x00),
 };
 +static const unsigned int msm8998_regs_layout[] = {
+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CFG(QUSB2PHY_PLL_DIGITAL_TIMERS_TWO, 0x19),
+};
+
+
 static const unsigned int sdm845_regs_layout[] = {
ÂÂÂÂÂ [QUSB2PHY_PLL_CORE_INPUT_OVERRIDE] = 0xa8,
ÂÂÂÂÂ [QUSB2PHY_PLL_STATUS]ÂÂÂÂÂÂÂ = 0x1a0,
@@ -221,6 +247,18 @@ struct qusb2_phy_cfg {
ÂÂÂÂÂ .autoresume_enÂÂÂÂ = BIT(3),
 };
 +static const struct qusb2_phy_cfg msm8998_phy_cfg = {
+ÂÂÂ .tblÂÂÂÂÂÂÂÂÂÂÂ = msm8998_init_tbl,
+ÂÂÂ .tbl_numÂÂÂÂÂÂÂ = ARRAY_SIZE(msm8998_init_tbl),
+ÂÂÂ .regsÂÂÂÂÂÂÂÂÂÂ = msm8998_regs_layout,
+
+ÂÂÂ .disable_ctrlÂÂ = POWER_DOWN,
+ÂÂÂ .mask_core_ready = CORE_READY_STATUS,
+ÂÂÂ .has_pll_override = true,
+ÂÂÂ .autoresume_enÂÂ = BIT(0),
+ÂÂÂ .update_tune1_with_efuse = true,
+};
+
 static const struct qusb2_phy_cfg sdm845_phy_cfg = {
ÂÂÂÂÂ .tblÂÂÂÂÂÂÂ = sdm845_init_tbl,
ÂÂÂÂÂ .tbl_numÂÂÂ = ARRAY_SIZE(sdm845_init_tbl),
@@ -734,6 +772,9 @@ static int qusb2_phy_exit(struct phy *phy)
ÂÂÂÂÂÂÂÂÂ .compatibleÂÂÂ = "qcom,msm8996-qusb2-phy",
ÂÂÂÂÂÂÂÂÂ .dataÂÂÂÂÂÂÂ = &msm8996_phy_cfg,
ÂÂÂÂÂ }, {
+ÂÂÂÂÂÂÂ .compatibleÂÂÂ = "qcom,msm8998-qusb2-phy",
+ÂÂÂÂÂÂÂ .dataÂÂÂÂÂÂÂ = &msm8998_phy_cfg,
+ÂÂÂ }, {
ÂÂÂÂÂÂÂÂÂ .compatibleÂÂÂ = "qcom,sdm845-qusb2-phy",
ÂÂÂÂÂÂÂÂÂ .dataÂÂÂÂÂÂÂ = &sdm845_phy_cfg,
ÂÂÂÂÂ },
--
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies,
Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.





--
Jeffrey Hugo
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.