From patchwork Sat Jan 14 07:10:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 43711 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp163989wrn; Fri, 13 Jan 2023 23:13:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXu8OXjS/rD+GA5r08pXIyppw3TfyX4cu+ihrAE97eo5aOc+z2B7A1Et3o43OPmVwpSZF2c9 X-Received: by 2002:a17:902:db08:b0:194:5d2d:3c31 with SMTP id m8-20020a170902db0800b001945d2d3c31mr13132180plx.11.1673680391210; Fri, 13 Jan 2023 23:13:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673680391; cv=none; d=google.com; s=arc-20160816; b=oH6WtP7H8JMiwC12+vVj3E+xRuyaSC2pj0d2ol20nPyNddN2BwJyWBuYme94iUX1ZN 33WfXkY6IsVum3uNxgmXNa8sp5KlvFK/pVPBUkCJIqHPjg1k52HT0mURssOd7LcSlJ7J VSUS3IgIAVK6FHZvcMcpeHdrHNvPdXie+ud86CD7bGpQwjFYjQTMBOA0wD3opbI6eGPl DJwSDVFCcXVBA+tfXVeH3+g1ZMs+AsUIWcBmjyYEs4RIBomC3KHXoZhHEBfzQgNeRUoY dNB2WslWhyKAgcYY5m2gpa7Crihv3C9OMPs3OUe1CVmlG20TEAk52bYTrN6++2IX1xR3 MpLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1ATjbzDQlL4OA8nxAfb65uZnNVJqa+ucbbND1K754XE=; b=e6UVXlpgmplV1r2v5no9X0NP/a0qNNRc9B6ZSBcYyJu5l5SP3r//n84J6iNzIaTyC5 aRYG2gXq7NjtHfJq0K13U01Y3PArzLAk2IeibOKTcj7nVLxVu+xJicuRHRZsCTf4PuZj aQDT/P0hnV2rg4V8aLewlQluHKEilFqPPUCKW9obQX4qLir4Pf8gaVG2p2lj2KYoekCw Pp0+8UE4V4a1yLbG/cmrxMB2skfGXH1FpAi6D9FiWr/ED+MVjZLzaDlTAbLkRUYrSsFI 5doLqDrhYLHHb87kVlCa4I7x7cDQthR7885xJSKkuxJnngc3E7ImHeNs2d6EpHPI4IaZ Z22A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G1+dzuwe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d11-20020a170902cecb00b0017840d9d42esi23943990plg.582.2023.01.13.23.12.59; Fri, 13 Jan 2023 23:13:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G1+dzuwe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229743AbjANHLj (ORCPT + 99 others); Sat, 14 Jan 2023 02:11:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229679AbjANHLO (ORCPT ); Sat, 14 Jan 2023 02:11:14 -0500 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2958859DE for ; Fri, 13 Jan 2023 23:10:45 -0800 (PST) Received: by mail-pl1-x630.google.com with SMTP id w3so25576918ply.3 for ; Fri, 13 Jan 2023 23:10:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1ATjbzDQlL4OA8nxAfb65uZnNVJqa+ucbbND1K754XE=; b=G1+dzuweYveFF3fKUfyYg3EkQcvxBV0KRGC0MJUNNuksus2io5QwA7JLyjvyA72rD3 wWroFh0PLCngGG2+bT3muP1yl3ThO35CKRUDsK0ZrhRqZhWLogXHig4SWwtcQ7Oa/MV/ vouHQV0hUAX/vRy1qQOaKHNI/mxZRAO6Ms0Op6yKvd1cMcLDW1Z+6b9FUxrCVpFcXP33 d6N/H++CVuYXQyY3ru7F6pTLhLk8wULsAtDp3o5U7QaxE1z+FTfGi6uuRVmo9d4l3YCb K2lqUqa/sxg9VDFvTNzqg8pEfySD1YmMVuya/0mvlKMpIbs1hGNS9CstURh2lZVDgun/ c/0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1ATjbzDQlL4OA8nxAfb65uZnNVJqa+ucbbND1K754XE=; b=of956lEk96LZwpIBMrSTf0TYfN/G9TLPYaJ2bv5PER/rKwvWcVC9ev13db+j/Ok0IO qqZCLALUK3AhTG1sgzaope0neDeALwof8NaHZDlmQthme1Z+v90I8cXOc2olfjY/Ki/T J6/YzjT7SHRCaKsYhjMHnaL5cXaV3gaPBAa+oo7ozJg1CxqOgV8YAZZ0gksBfuRqcMn+ oqFE32FYpjOj7Hd4/VAWTZAHKnlDBnWX6M1T3/57kKCwSPkyvZwtMNmFoPeVDaPhzQFN ah9TNC9fcPaSRfw8lT1kNM2m4jwm3JsjLXj6rkw2XbbaljdqTfCY8YRDS2xe7gr/+PtK U5gw== X-Gm-Message-State: AFqh2kolKkb9JBvALoEsJ6NyEq+/VtAY7PSarueMD0K+SC/egU+oKKJZ /v8FKE5tFmLzRuAT5t84wu2A0577P2wA43Y= X-Received: by 2002:a17:902:c497:b0:193:3845:de53 with SMTP id n23-20020a170902c49700b001933845de53mr21809874plx.39.1673680244828; Fri, 13 Jan 2023 23:10:44 -0800 (PST) Received: from localhost.localdomain ([220.158.159.156]) by smtp.gmail.com with ESMTPSA id q10-20020a170902e30a00b00192a04bc620sm15225358plc.295.2023.01.13.23.10.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 23:10:43 -0800 (PST) From: Manivannan Sadhasivam To: vkoul@kernel.org Cc: andersson@kernel.org, quic_cang@quicinc.com, quic_asutoshd@quicinc.com, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, dmitry.baryshkov@linaro.org, ahalaney@redhat.com, abel.vesa@linaro.org, Manivannan Sadhasivam Subject: [PATCH v6 07/12] phy: qcom-qmp-ufs: Add HS G4 mode support to SM8150 SoC Date: Sat, 14 Jan 2023 12:40:04 +0530 Message-Id: <20230114071009.88102-8-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230114071009.88102-1-manivannan.sadhasivam@linaro.org> References: <20230114071009.88102-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754981090108507159?= X-GMAIL-MSGID: =?utf-8?q?1754981090108507159?= UFS PHY in SM8150 SoC is capable of operating at HS G4 mode. Hence, add the required register settings using the tables_hs_g4 struct instance. Reviewed-by: Dmitry Baryshkov Tested-by: Andrew Halaney # Qdrive3/sa8540p-ride Signed-off-by: Manivannan Sadhasivam --- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c index a7261744f971..57d0744d18c2 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c @@ -379,6 +379,10 @@ static const struct qmp_phy_init_tbl sm8150_ufsphy_tx[] = { QMP_PHY_INIT_CFG(QSERDES_V4_TX_TRAN_DRVR_EMP_EN, 0x0c), }; +static const struct qmp_phy_init_tbl sm8150_ufsphy_hs_g4_tx[] = { + QMP_PHY_INIT_CFG(QSERDES_V4_TX_LANE_MODE_1, 0x75), +}; + static const struct qmp_phy_init_tbl sm8150_ufsphy_rx[] = { QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_LVL, 0x24), QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_CNTRL, 0x0f), @@ -416,6 +420,25 @@ static const struct qmp_phy_init_tbl sm8150_ufsphy_rx[] = { QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH4, 0xb1), }; +static const struct qmp_phy_init_tbl sm8150_ufsphy_hs_g4_rx[] = { + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x5a), + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_PI_CTRL2, 0x81), + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FO_GAIN, 0x0e), + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_TERM_BW, 0x6f), + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_MEASURE_TIME, 0x20), + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_LOW, 0x80), + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_HIGH, 0x01), + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_LOW, 0x3f), + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH, 0xff), + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH2, 0xff), + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH3, 0x7f), + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH4, 0x6c), + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_LOW, 0x6d), + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH, 0x6d), + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH2, 0xed), + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH4, 0x3c), +}; + static const struct qmp_phy_init_tbl sm8150_ufsphy_pcs[] = { QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_RX_SIGDET_CTRL2, 0x6d), QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_TX_LARGE_AMP_DRV_LVL, 0x0a), @@ -426,6 +449,11 @@ static const struct qmp_phy_init_tbl sm8150_ufsphy_pcs[] = { QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_MULTI_LANE_CTRL1, 0x02), }; +static const struct qmp_phy_init_tbl sm8150_ufsphy_hs_g4_pcs[] = { + QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_TX_LARGE_AMP_DRV_LVL, 0x10), + QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_BIST_FIXED_PAT_CTRL, 0x0a), +}; + static const struct qmp_phy_init_tbl sm8350_ufsphy_serdes[] = { QMP_PHY_INIT_CFG(QSERDES_V5_COM_SYSCLK_EN_SEL, 0xd9), QMP_PHY_INIT_CFG(QSERDES_V5_COM_HSCLK_SEL, 0x11), @@ -769,6 +797,14 @@ static const struct qmp_phy_cfg sm8150_ufsphy_cfg = { .serdes = sm8150_ufsphy_hs_b_serdes, .serdes_num = ARRAY_SIZE(sm8150_ufsphy_hs_b_serdes), }, + .tbls_hs_g4 = { + .tx = sm8150_ufsphy_hs_g4_tx, + .tx_num = ARRAY_SIZE(sm8150_ufsphy_hs_g4_tx), + .rx = sm8150_ufsphy_hs_g4_rx, + .rx_num = ARRAY_SIZE(sm8150_ufsphy_hs_g4_rx), + .pcs = sm8150_ufsphy_hs_g4_pcs, + .pcs_num = ARRAY_SIZE(sm8150_ufsphy_hs_g4_pcs), + }, .clk_list = sdm845_ufs_phy_clk_l, .num_clks = ARRAY_SIZE(sdm845_ufs_phy_clk_l), .vreg_list = qmp_phy_vreg_l,