Received: by 10.192.165.156 with SMTP id m28csp1593766imm; Wed, 11 Apr 2018 23:26:55 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/VO29d4gczzsYmXIq38UlEziKZqU72dWR7s4wADCYqPrFrPpWv/1yhzJwzDboeaR5pa+2r X-Received: by 10.99.109.198 with SMTP id i189mr5699919pgc.328.1523514415909; Wed, 11 Apr 2018 23:26:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523514415; cv=none; d=google.com; s=arc-20160816; b=e32JW524/OOCJIiAtFg+kzv5nV5HKn+QfL6LLjKj8dnsCGS46H3Oep3ZyRpvEvHGJ/ ReWoCsCL+kH22MahiHUJtcf0k+y2DeHUrOQXAkTFGc3xmMQQKng6d4Jsams3wp85niYU teOtSnHvWtGb1BgXYqmKlg3DZg+V3dDfpn4LTMUbVGOsA19/kd37cwn1FnutDkwaC26X /E+ThMhB9YSHk2L+pha1qLpPouJqV7hHfPcmJYkQ1+I9MZ+yISllWb6jq8s4TXqpTDgg KaPpFmimFseSmizsR7Q81IFN+haUVIUfkzN+ejKgtvKRKxPHjzwgI9fqU8yWDdrlHBTa wWqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=98nmwurQdwtYsnHRIIGt1FRPeqLRweBeuJ7b6vYEwGE=; b=Mn62WubXcdveqx3IITWyckgiL2VsgoudUtUPx3R7bH3tBRyl7PTFIYGMLmT9xU5ErL eOAp1CzTAH+J5DALRv4EPNuW46RmMGouPXepFffq3/dfMbCQ6v5mqAkavLeF0tCpU6Dj 0QyRbz3hSgAboqpMruvARTh5yqcCdsB5Zpko2V7RrK2q/9vAarvy36EKnmLAJvuxx1cZ 1UgtOTLG4fj9xT34BLAulIMSVSx9NBSC115xHvyFiZpjtZDfGjQqJf/8ywmVTJtNf7DF T5Qf0wymwmVz7J7w03doFDmUgoPkuJHWfiSMU6+WE/RR1qh3M1mfCVUhVBBn3sKz+orz J8Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=QS8fTor7; dkim=pass header.i=@codeaurora.org header.s=default header.b=NJbYeY4c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r77si2087257pfa.359.2018.04.11.23.26.19; Wed, 11 Apr 2018 23:26:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=QS8fTor7; dkim=pass header.i=@codeaurora.org header.s=default header.b=NJbYeY4c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752646AbeDLGXC (ORCPT + 99 others); Thu, 12 Apr 2018 02:23:02 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:45884 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752041AbeDLGXB (ORCPT ); Thu, 12 Apr 2018 02:23:01 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id A708460F90; Thu, 12 Apr 2018 06:23:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523514180; bh=tTDw8PUnGN/wPYMmFk5Dnouq5wnVvpJEAi5H3kFd+rU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QS8fTor7db5SLlLms5Of7YRy3HiXyhsXQiVnY19GrZlTd/UL9FMcWe5eHgigCMsCF vkxVfvZZfIK8dkq4MMEMlP2wFi0qJfGy+CBVrdT3FcSw57smcZVLKB188UeUpTN9L+ cYTMP8F82BkuToEX5okq4ovb3q459wII73VAN67g= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID,UPPERCASE_50_75 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 7C62B6081C; Thu, 12 Apr 2018 06:22:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523514179; bh=tTDw8PUnGN/wPYMmFk5Dnouq5wnVvpJEAi5H3kFd+rU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=NJbYeY4cS3GxLZkMdxIc3Yz8d94ssOkR80GBTQ5B5TGeEB4qLceaqFORMmDrMehpo s3zWdvUI77inxxrgyMetD/tUC2/xD2Zj0RNRdhouudzWQPKEGR2kI7HZWRkC2RbTvN 0UyGP+GWNpuGftvbOpeYwsB06Kk/vrcEqz8cxx+o= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Thu, 12 Apr 2018 14:22:59 +0800 From: cang@codeaurora.org To: Vivek Gautam Cc: subhashj@codeaurora.org, asutoshd@codeaurora.org, mgautam@codeaurora.org, kishon@ti.com, robh+dt@kernel.org, mark.rutland@arm.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH v3 1/2] phy: Add QMP phy based UFS phy support for sdm845 In-Reply-To: References: <20180327071838.11168-1-cang@codeaurora.org> <20180327071838.11168-2-cang@codeaurora.org> Message-ID: X-Sender: cang@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-04-12 13:13, Vivek Gautam wrote: > On 4/12/2018 6:27 AM, cang@codeaurora.org wrote: >> On 2018-04-09 19:28, Vivek Gautam wrote: >>> Hi Can, >>> >>> >>> On 3/27/2018 12:48 PM, Can Guo wrote: >>>> Add UFS PHY support to make SDM845 UFS work with common PHY >>>> framework. >>>> >>>> Signed-off-by: Can Guo >>>> --- >>>>   drivers/phy/qualcomm/phy-qcom-qmp.c | 130 >>>> +++++++++++++++++++++++++++++++++--- >>>>   drivers/phy/qualcomm/phy-qcom-qmp.h |   8 +++ >>>>   2 files changed, 127 insertions(+), 11 deletions(-) >>>> >>>> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c >>>> b/drivers/phy/qualcomm/phy-qcom-qmp.c >>>> index 5cf2c3c..0b58030 100644 >>>> --- a/drivers/phy/qualcomm/phy-qcom-qmp.c >>>> +++ b/drivers/phy/qualcomm/phy-qcom-qmp.c >>>> @@ -156,6 +156,11 @@ enum qphy_reg_layout { >>>>       [QPHY_PCS_LFPS_RXTERM_IRQ_STATUS] = 0x170, >>>>   }; >>>>   +static const unsigned int sdm845_ufsphy_regs_layout[] = { >>>> +    [QPHY_START_CTRL]        = 0x00, >>>> +    [QPHY_PCS_READY_STATUS]        = 0x168, >>>> +}; >>>> + >>>>   static const struct qmp_phy_init_tbl msm8996_pcie_serdes_tbl[] = { >>>>       QMP_PHY_INIT_CFG(QSERDES_COM_BIAS_EN_CLKBUFLR_EN, 0x1c), >>>>       QMP_PHY_INIT_CFG(QSERDES_COM_CLK_ENABLE1, 0x10), >>>> @@ -601,6 +606,73 @@ enum qphy_reg_layout { >>>>       QMP_PHY_INIT_CFG(QPHY_V3_PCS_REFGEN_REQ_CONFIG2, 0x60), >>>>   }; >>>>   +static const struct qmp_phy_init_tbl sdm845_ufsphy_serdes_tbl[] = >>>> { >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_SYS_CLK_CTRL, 0x02), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_BG_TIMER, 0x0a), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_IVCO, 0x0f), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_CMN_CONFIG, 0x06), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_SYSCLK_EN_SEL, 0xd5), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_RESETSM_CNTRL, 0x20), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_SELECT, 0x30), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_HSCLK_SEL, 0x00), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP_EN, 0x01), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE_CTRL, 0x00), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_CORE_CLK_EN, 0x00), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE_MAP, 0x04), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_SVS_MODE_CLK_SEL, 0x05), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE_INITVAL1, 0xff), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE_INITVAL2, 0x00), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_DEC_START_MODE0, 0x82), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_CP_CTRL_MODE0, 0x06), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_RCTRL_MODE0, 0x16), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_CCTRL_MODE0, 0x36), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_INTEGLOOP_GAIN0_MODE0, 0x3f), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_INTEGLOOP_GAIN1_MODE0, 0x00), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE1_MODE0, 0xda), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE2_MODE0, 0x01), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP1_MODE0, 0xff), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP2_MODE0, 0x0c), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_DEC_START_MODE1, 0x98), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_CP_CTRL_MODE1, 0x06), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_RCTRL_MODE1, 0x16), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_CCTRL_MODE1, 0x36), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_INTEGLOOP_GAIN0_MODE1, 0x3f), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_INTEGLOOP_GAIN1_MODE1, 0x00), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE1_MODE1, 0xc1), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE2_MODE1, 0x00), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP1_MODE1, 0x32), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP2_MODE1, 0x0f), >>>> + >>>> +    /* Rate B */ >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE_MAP, 0x44), >>>> +}; >>>> + >>>> +static const struct qmp_phy_init_tbl sdm845_ufsphy_tx_tbl[] = { >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_TX_LANE_MODE_1, 0x06), >>>> +}; >>>> + >>>> +static const struct qmp_phy_init_tbl sdm845_ufsphy_rx_tbl[] = { >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_LVL, 0x24), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_CNTRL, 0x0f), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_DEGLITCH_CNTRL, 0x1e), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_INTERFACE_MODE, 0x40), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_FASTLOCK_FO_GAIN, 0x0b), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_TERM_BW, 0x5b), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL2, 0x06), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL3, 0x04), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL4, 0x1d), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SVS_SO_GAIN_HALF, 0x04), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SVS_SO_GAIN_QUARTER, 0x04), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SVS_SO_GAIN, 0x04), >>>> + QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SO_SATURATION_AND_ENABLE, >>>> 0x4b), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_PI_CONTROLS, 0x81), >>>> +    QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_FASTLOCK_COUNT_LOW, 0x80), >>>> +}; >>>> + >>>> +static const struct qmp_phy_init_tbl sdm845_ufsphy_pcs_tbl[] = { >>>> +    QMP_PHY_INIT_CFG(QPHY_V3_PCS_POWER_DOWN_CONTROL, 0x01), >>>> +    QMP_PHY_INIT_CFG(QPHY_V3_PCS_MULTI_LANE_CTRL1, 0x02), >>>> +}; >>>>     /* struct qmp_phy_cfg - per-PHY initialization config */ >>>>   struct qmp_phy_cfg { >>>> @@ -652,6 +724,9 @@ struct qmp_phy_cfg { >>>>       /* Register offset of secondary tx/rx lanes for USB DP combo >>>> PHY */ >>>>       unsigned int tx_b_lane_offset; >>>>       unsigned int rx_b_lane_offset; >>>> + >>>> +    /* true, if PCS block has no separate SW_RESET register */ >>>> +    bool skip_sw_rst; >>>>   }; >>>>     /** >>>> @@ -748,6 +823,10 @@ static inline void qphy_clrbits(void __iomem >>>> *base, u32 offset, u32 val) >>>>       "aux", "cfg_ahb", "ref", "com_aux", >>>>   }; >>>>   +static const char * const sdm845_ufs_phy_clk_l[] = { >>>> +    "ref", >>> >>> did you miss adding 'ref_aux' clock here as in the v2 version? >>> Rest looks good. After this change, you can add my reviewed-by >>> Reviewed-by: Vivek Gautam >>> >>> Thanks >>> Vivek >> >> Thank you Vivek. I removed 'ref_aux' as it was from the old UFS PHY >> driver. >> And I have tested the new patch on MTP845 V2, it worked fine. Do you >> have >> any concerns about it? >> > > I see in the downstream there's a ref_aux clock, so can you check from > the phy's > hardware docs if this is required for phy's functionality. Working on > the MTP is > one thing as some of the clocks may be kept enabled by the bootloader > too sometimes. > > Thanks > Vivek You are right Vivek, I checked the HPG,'ref_aux' is needed for 845 indeed. I will add it back. BTW, is it OK that I use 'aux' instead? As clk name 'aux' in the documentation seems to serve the same purpose for UFS PHY. Thanks Can >> Thanks >> Can > [snip]