From patchwork Wed Nov 23 07:48:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 24762 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2648672wrr; Tue, 22 Nov 2022 23:51:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf7jwQkYgfiZhqPD0N9OXKci+UPdAdEpVfutaN0fU4STrrhNQvj5H1RL70Km+QEab4pXG0CV X-Received: by 2002:a17:906:8296:b0:7ba:29a1:543c with SMTP id h22-20020a170906829600b007ba29a1543cmr699586ejx.297.1669189886611; Tue, 22 Nov 2022 23:51:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669189886; cv=none; d=google.com; s=arc-20160816; b=iyHklTw4h4jamuxjlL1Dg1haogKMKmuUCYaGY336pGl98jZnYdPtCAzIyoewD/KtH+ GPvZPrOWSmbUuogiQwaODGVE7FlAmiWD0hnU+F3UCxjCXhwI3tHOqtua9C38BIo9jIhy 2yX1b4XudVL2bQtf0hh8HyO1RDwxdKv0qrlPqCPkvkvn4Duu4pA/MH8KLw2W/t9GPMy4 qChk0ZW22iMRIbnrOCkwX6OcHOdPM1nygl/o+c4ZvkkRZvTJ8o6XDIgl2WvoyZkAhBfU zkM1e8xlhU4GKH2GKz/tABb9jysmDFXP8ZHDE7bFto7WPf66duoijl93lTSKhF7HN5Vw NdKQ== 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=Hg08mVmbyiFP9E6Z2PHg4XW3jll6IEe2Kyqu7cYnyxo=; b=czbom+MfxQC421lDwWf6r5NVgTlgnVJ54v936NJ+ce7XJw/ciKy6oKMUBEtfOmDOx7 Pv8aMgD4dLgiftFcOFWiwb9Xq8hdNkMZYF7AX6nruoVSwnUQ66L7A/snzPXEiLK4Slq2 NjIhxv3fDYDVyJB3DnPcX1gGhNeFXI+s382w8xPqdSFsSzpPxiT0kkGHm7Wk0Os5dWze 6UeeKPFbG9Ns2kSHDnkHkoS1z4h5L5WkH/U9ZqC8C3Lf0RaIiB8wMmJRlFZLa/Rnn8pr P1Ub0fBmMTZcKwenKOJRMnNkVzMqaP1SaxoYXAUhgjLIM+dWJzE8eHjifo3bM1+wdO26 KWtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rhA03McC; 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 mp8-20020a1709071b0800b007adb868f102si3624096ejc.476.2022.11.22.23.51.03; Tue, 22 Nov 2022 23:51:26 -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=rhA03McC; 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 S236086AbiKWHt4 (ORCPT + 99 others); Wed, 23 Nov 2022 02:49:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236110AbiKWHtZ (ORCPT ); Wed, 23 Nov 2022 02:49:25 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FDD7FAEA8 for ; Tue, 22 Nov 2022 23:49:24 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id io19so15924979plb.8 for ; Tue, 22 Nov 2022 23:49:24 -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=Hg08mVmbyiFP9E6Z2PHg4XW3jll6IEe2Kyqu7cYnyxo=; b=rhA03McCzm2tbgQAfVlulnKmZMzII8Jz/JuV3yBJceN2ArgPZ2jrg8TtBza3skhG+H Xo7xWCeRUL+Sr29C75isrQ+lIqP7VQTtWFv2j9TE/JZH1MAfwHL/NImAqIqfTq00SxT+ K/t1D+a+V8IxhCtJ2mOo1QgmpykiPLorndzBBCx2q/SD4zIrU+uHWFKIB7ziyZUDRlCf LFDHo5wifIjPa/EiGtu4mxEaJQeFMi5PsGMh730A+i+VEp1rhfQI8F9TZyUw4+hQY+fg WyeKzs1xWRhNFXg5xpxytf0mslhbaZXlAhClbcGiYq+8yOcYBfY8I4aoQLtEgcAmfpji bIfg== 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=Hg08mVmbyiFP9E6Z2PHg4XW3jll6IEe2Kyqu7cYnyxo=; b=Yu+biWqeO1mtuA9PuW29DcfTv9lyxXvED4HCXtQiBPmnuPg/pXvZimxTDZEXgQUazb mraKrGqQR8NQBG3Nz/c+wy+2Zg2h4ZQnUaXRynp2SiUkSM8pnpM+f/9TuTd4XBiC4AEp iFMRRHBpzFxG1IpQzSXuC/zCSpB2e+lJHMekh7factg6B+tlyPzPSLsUBbeZDznqvgWN VBtSvqHx09jzjUDEt7Dlh7wfmGthsBoGqDB8AwtCdK5zGcm1+WLPjXMtQbwamwrSrV5W I+l3bJ+mVa3uuvvCtF7rVMAjIuZtLbdKpWtF8HnFzZY+GNezZL/XjMcITdi1tGH/QN3Y lLrg== X-Gm-Message-State: ANoB5pn34ktzVpjXkoPEUffD9xNf0gmTwWQgIOI7kDFzABsYwIyUB5v2 i93soH6GcxZC4rXNUXBwEk3b X-Received: by 2002:a17:90a:be11:b0:218:c83e:4735 with SMTP id a17-20020a17090abe1100b00218c83e4735mr9212963pjs.9.1669189763826; Tue, 22 Nov 2022 23:49:23 -0800 (PST) Received: from localhost.localdomain ([117.202.191.0]) by smtp.gmail.com with ESMTPSA id s16-20020a170902a51000b001869f2120a5sm13334059plq.34.2022.11.22.23.49.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 23:49:22 -0800 (PST) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com, andersson@kernel.org, vkoul@kernel.org Cc: quic_cang@quicinc.com, quic_asutoshd@quicinc.com, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-scsi@vger.kernel.org, dmitry.baryshkov@linaro.org, ahalaney@redhat.com, abel.vesa@linaro.org, Manivannan Sadhasivam Subject: [PATCH v3 08/20] phy: qcom-qmp-ufs: Add HS G4 mode support to SM8250 SoC Date: Wed, 23 Nov 2022 13:18:14 +0530 Message-Id: <20221123074826.95369-9-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221123074826.95369-1-manivannan.sadhasivam@linaro.org> References: <20221123074826.95369-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=unavailable 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?1750272454446126530?= X-GMAIL-MSGID: =?utf-8?q?1750272454446126530?= UFS PHY in SM8250 SoC is capable of operating at HS G4 mode. Hence, add the required register settings using the tables_hs_g4 struct instance. This also requires a separate qmp_phy_cfg for SM8250 instead of reusing SM8150. Reviewed-by: Dmitry Baryshkov Signed-off-by: Manivannan Sadhasivam --- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 66 ++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c index 98ebaf898a50..d39ee28fb6a3 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c @@ -463,6 +463,34 @@ static const struct qmp_phy_init_tbl sm8150_ufsphy_hs_g4_pcs[] = { QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_BIST_FIXED_PAT_CTRL, 0x0a), }; +static const struct qmp_phy_init_tbl sm8250_ufsphy_hs_g4_tx[] = { + QMP_PHY_INIT_CFG(QSERDES_V4_TX_LANE_MODE_1, 0xe5), +}; + +static const struct qmp_phy_init_tbl sm8250_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_EQU_ADAPTOR_CNTRL1, 0x04), + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL2, 0x00), + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL3, 0x09), + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL4, 0x07), + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x17), + 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, 0x2c), + 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 sm8350_ufsphy_serdes[] = { QMP_PHY_INIT_CFG(QSERDES_V5_COM_SYSCLK_EN_SEL, 0xd9), QMP_PHY_INIT_CFG(QSERDES_V5_COM_HSCLK_SEL, 0x11), @@ -825,6 +853,42 @@ static const struct qmp_phy_cfg sm8150_ufsphy_cfg = { .phy_status = PHYSTATUS, }; +static const struct qmp_phy_cfg sm8250_ufsphy_cfg = { + .lanes = 2, + + .tbls = { + .serdes = sm8150_ufsphy_serdes, + .serdes_num = ARRAY_SIZE(sm8150_ufsphy_serdes), + .tx = sm8150_ufsphy_tx, + .tx_num = ARRAY_SIZE(sm8150_ufsphy_tx), + .rx = sm8150_ufsphy_rx, + .rx_num = ARRAY_SIZE(sm8150_ufsphy_rx), + .pcs = sm8150_ufsphy_pcs, + .pcs_num = ARRAY_SIZE(sm8150_ufsphy_pcs), + }, + .tbls_hs_b = { + .serdes = sm8150_ufsphy_hs_b_serdes, + .serdes_num = ARRAY_SIZE(sm8150_ufsphy_hs_b_serdes), + }, + .tbls_hs_g4 = { + .tx = sm8250_ufsphy_hs_g4_tx, + .tx_num = ARRAY_SIZE(sm8250_ufsphy_hs_g4_tx), + .rx = sm8250_ufsphy_hs_g4_rx, + .rx_num = ARRAY_SIZE(sm8250_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, + .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), + .regs = sm8150_ufsphy_regs_layout, + + .start_ctrl = SERDES_START, + .pwrdn_ctrl = SW_PWRDN, + .phy_status = PHYSTATUS, +}; + static const struct qmp_phy_cfg sm8350_ufsphy_cfg = { .lanes = 2, @@ -1288,7 +1352,7 @@ static const struct of_device_id qmp_ufs_of_match_table[] = { .data = &sm8150_ufsphy_cfg, }, { .compatible = "qcom,sm8250-qmp-ufs-phy", - .data = &sm8150_ufsphy_cfg, + .data = &sm8250_ufsphy_cfg, }, { .compatible = "qcom,sm8350-qmp-ufs-phy", .data = &sm8350_ufsphy_cfg,