From patchwork Wed Nov 23 07:48:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 24761 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2648658wrr; Tue, 22 Nov 2022 23:51:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf67u72Kg4ZtGABwiMz+4uTcBhSmYgeHZN+y13aRS1JMgdnHVRyLTjcel2POW8nsqsV/RWYO X-Received: by 2002:a17:907:9116:b0:78a:16ad:8250 with SMTP id p22-20020a170907911600b0078a16ad8250mr11247018ejq.747.1669189883113; Tue, 22 Nov 2022 23:51:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669189883; cv=none; d=google.com; s=arc-20160816; b=KN6BNHQt98jEpeNL0yd6BuQzVTa6xKhxFqHjiqsNllE69/lkSCdos0b9azKHbT+d50 10Rg7FNkl/YhppgZVFmhTGpx7AHQVaVLxaJdhbaE2s1sRJk8vu6mKVM5lO76/bjea9TK SIKv/tWcn6XixTlGazJvlqfZjDzrDAMapqaq2fIwmKBY5+RAvCIlyPG7Ks3REX6GaZgz EEGr/4P6AqH4WTtOpULcz5W9k84k8pJTXAfEOc9I65a0tY0WauMQfL/pH72mdFDMIaB4 0YAEDeTHt0l+CmEosYf+2jxAxZa0QTDcVo3QfMwcdSrAVr/Xq+5BHgLxgnlOxzR+xGsZ 7ilQ== 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=17DUm1BHWO+9+pCruDSwXwFA2DWaV0LvIvFJmkLFp/8=; b=WOaMA0FI5Mkkijw+o2975AViD/pw8KKzwamB1qdlEHUxX44/O5pM+KT08YIIBjcgob dcgJ/L34wK+L/ktd8dQ57KT7szyTBb+BBZkrBc9xLyFaFOUec6mwQ5eN5VdNYMLVc8p/ X2LYzOYCWpq9tqkhHZqPXVxIVzDarG4FigZODflnAHoZIMhopKz0RXJ11QW9ccqrG/dL 4CB1mxWbf6kzD8bBn857010zODGQMsLNCssEnRkcIksBaTgcYLuesTvcm4KTaVZMiBDZ XEGCTnnRoBs58K4bvO15w7Op985VV2ZzangWLUPLC6kQqvXBUZjkRuND8eQ4/K4Sr0jb jyVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=szHgLObi; 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 z16-20020a170906715000b007aeef4dd9cfsi11308828ejj.908.2022.11.22.23.50.59; Tue, 22 Nov 2022 23:51:23 -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=szHgLObi; 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 S236125AbiKWHtc (ORCPT + 99 others); Wed, 23 Nov 2022 02:49:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236054AbiKWHtJ (ORCPT ); Wed, 23 Nov 2022 02:49:09 -0500 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3E65FA731 for ; Tue, 22 Nov 2022 23:49:00 -0800 (PST) Received: by mail-pg1-x529.google.com with SMTP id r18so16078239pgr.12 for ; Tue, 22 Nov 2022 23:49:00 -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=17DUm1BHWO+9+pCruDSwXwFA2DWaV0LvIvFJmkLFp/8=; b=szHgLObizdRjU8Uhq446KGApvra49ApA5BIcru3Ey/6Do2T56DSsWvR5g9jLZHc476 MSlgWT8MIf8p+f/sxml/uIYI/OfERwdOxx5UrTrYqsRwWRZFHtuRDyZJ5Rx4UxQu9KFi bHD+ee5c55d9SFNG5Pwp6XrqCpbVMI7Noo/UYKv4oy6hdO4XzjAQT10xIo8VNGpS1lk0 Z20HdS4+82s4XqLdrE2uV7dVCOiPbh7w+y4ldF3k1iYZtAtLx40Dsl+kKesa4AdfKKoU pHw3S/F4iNp6nK3l1atD4eXQ9Qt72dI6wxGZlj7nTc6si+4kweYwgd/xG8XerHXUsBmF dhZA== 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=17DUm1BHWO+9+pCruDSwXwFA2DWaV0LvIvFJmkLFp/8=; b=4J7Hjgsv7V/Nap/mhJRAagi1NDvQTUG2dWeQ75ychb4I0hHY04OtS9gOglIQQB8ova U3OFZQB3MJfXuOTOXPSNJYxLuc8qXKjjsf6ZZUzzNAZGSIBQwqYv0OMt1AO+pUIOatMa CAfIbg0zXnMiLSI6h4qpxYuyHfsaaq/WTOZQ2wTmP2ZWTmBwmL3tBbM2hUmMURN+9FLQ A1MOrx4EkfNp42ZnYSTs7XbxnOTukqo2YSju5xT3C8pawBjoUnqLPN7e7VUucP/MIFE2 jPskaR/hBE4LkxIhVdeTT3873h+2Ipf132D1wM8VpIRoizvoNkiQE6IW2P0Kaj5DBnkv ZbIw== X-Gm-Message-State: ANoB5plQb7n2tBTWBzpgSIN0ya4C5jdSaph2lHvwooAXDbBInKuePMqp VG+u4EKXCc8WU62o2iT7FyuZ X-Received: by 2002:a63:5007:0:b0:45f:beda:4116 with SMTP id e7-20020a635007000000b0045fbeda4116mr8165671pgb.618.1669189739616; Tue, 22 Nov 2022 23:48:59 -0800 (PST) Received: from localhost.localdomain ([117.202.191.0]) by smtp.gmail.com with ESMTPSA id s16-20020a170902a51000b001869f2120a5sm13334059plq.34.2022.11.22.23.48.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 23:48:58 -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 04/20] phy: qcom-qmp-ufs: Add support for configuring PHY in HS Series B mode Date: Wed, 23 Nov 2022 13:18:10 +0530 Message-Id: <20221123074826.95369-5-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?1750272450763316941?= X-GMAIL-MSGID: =?utf-8?q?1750272450763316941?= Add separate tables_hs_b instance to allow the PHY driver to configure the PHY in HS Series B mode. The individual SoC configs need to supply the serdes register setting in tables_hs_b and the UFS driver can request the Series B mode by calling phy_set_mode() with mode set to PHY_MODE_UFS_HS_B. Reviewed-by: Dmitry Baryshkov Signed-off-by: Manivannan Sadhasivam --- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c index 3b7b36e32f5d..694b1d6c1f9c 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c @@ -20,6 +20,8 @@ #include #include +#include + #include #include "phy-qcom-qmp.h" @@ -549,6 +551,8 @@ struct qmp_phy_cfg { /* Main init sequence for PHY blocks - serdes, tx, rx, pcs */ const struct qmp_phy_cfg_tbls tbls; + /* Additional sequence for HS Series B */ + const struct qmp_phy_cfg_tbls tbls_hs_b; /* clock ids to be requested */ const char * const *clk_list; @@ -582,6 +586,7 @@ struct qmp_phy_cfg { * @rx2: iomapped memory space for second lane's rx (in dual lane PHYs) * @pcs_misc: iomapped memory space for lane's pcs_misc * @qmp: QMP phy to which this lane belongs + * @mode: PHY mode configured by the UFS driver */ struct qmp_phy { struct phy *phy; @@ -594,6 +599,7 @@ struct qmp_phy { void __iomem *rx2; void __iomem *pcs_misc; struct qcom_qmp *qmp; + u32 mode; }; /** @@ -885,6 +891,8 @@ static void qmp_ufs_pcs_init(struct qmp_phy *qphy, const struct qmp_phy_cfg_tbls static void qmp_ufs_init_registers(struct qmp_phy *qphy, const struct qmp_phy_cfg *cfg) { qmp_ufs_serdes_init(qphy, &cfg->tbls); + if (qphy->mode == PHY_MODE_UFS_HS_B) + qmp_ufs_serdes_init(qphy, &cfg->tbls_hs_b); qmp_ufs_lanes_init(qphy, &cfg->tbls); qmp_ufs_pcs_init(qphy, &cfg->tbls); } @@ -1073,6 +1081,15 @@ static int qmp_ufs_disable(struct phy *phy) return qmp_ufs_exit(phy); } +static int qmp_ufs_set_mode(struct phy *phy, enum phy_mode mode, int submode) +{ + struct qmp_phy *qphy = phy_get_drvdata(phy); + + qphy->mode = mode; + + return 0; +} + static int qmp_ufs_vreg_init(struct device *dev, const struct qmp_phy_cfg *cfg) { struct qcom_qmp *qmp = dev_get_drvdata(dev); @@ -1108,6 +1125,7 @@ static int qmp_ufs_clk_init(struct device *dev, const struct qmp_phy_cfg *cfg) static const struct phy_ops qcom_qmp_ufs_ops = { .power_on = qmp_ufs_enable, .power_off = qmp_ufs_disable, + .set_mode = qmp_ufs_set_mode, .owner = THIS_MODULE, };