Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1142593pxb; Thu, 28 Jan 2021 08:59:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJxMO4F88zqQYXqzDnDJSqAHdd1vf/p8OAG2NBDzRwcNUv7tV4XmmFCFOPFjIf2OJPfnfwA+ X-Received: by 2002:a17:906:b51:: with SMTP id v17mr352195ejg.8.1611853157820; Thu, 28 Jan 2021 08:59:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611853157; cv=none; d=google.com; s=arc-20160816; b=AO3SWuQz/CKGEMRbY7jm+ZYrHZTljHSGIerJRghfZCgNdSMCT/ea9Znr4ORL1Y4IyG iLmkF1e5tvkhb/VKm+phTtNe9EtvCg+K3SwYKJ7DSTXiB4FrTLKD8TCovQJtsQecSCQq 6Jj2XrvqE4SjxYimJ71cObRHVHsApOZgiCXkYPkAkH429fl94v6v34HLUSvaS6KgMX5I WQ1+YqLJ2mwVCy/E9cVa5htvAgc+pdgsSIOkM4PUtV6HEhhoZNbHg8xecnL/G/yiKeYT RjyzCsN50dWqQ2La0/1skphGGZ8RDA0tMqTUn+gC0i8uMhrjxKvMLvuC2tS6A+Dwy5ms eZxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=CmZv8jZLa1b/3IQE9LCLNSJeodWjy/OZGdJ0B+8u8hk=; b=NV32QeDQf2D2Z93mXqM1Nr55hQIUYqzQ1HWhHs9O8T8oXLYKYVQkse1nl26gHrzNE5 TtOVrrPnxXwrGNfObbW2MxPMw9JqVVRvsUJU89j+b8qHTeDjC+kpD6FcMPteZdWVq2ou hDHD79LYrTUJ92jN8OuJmqi1SeTGJu9Uh/debZ9xSW/UUbsQZiAuhK3lkhm533BBNCma YWXC3WWNw2dwk/hgkKDjvXXRxdXL4eiwmOYxU2njhdwGo8E9aBpWOcRuM/ua61seF29Z PZMeX9jNk+pnKvZpqWrd4A72DKJYaqI90Pmu5U6+e9BXuZvo34dyBLnYWX7kbdQX24PJ bsag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p5si1910115ejo.398.2021.01.28.08.58.51; Thu, 28 Jan 2021 08:59:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232744AbhA1Q5U (ORCPT + 99 others); Thu, 28 Jan 2021 11:57:20 -0500 Received: from alexa-out.qualcomm.com ([129.46.98.28]:32697 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232763AbhA1Q5A (ORCPT ); Thu, 28 Jan 2021 11:57:00 -0500 Received: from ironmsg-lv-alpha.qualcomm.com ([10.47.202.13]) by alexa-out.qualcomm.com with ESMTP; 28 Jan 2021 08:55:33 -0800 X-QCInternal: smtphost Received: from ironmsg02-blr.qualcomm.com ([10.86.208.131]) by ironmsg-lv-alpha.qualcomm.com with ESMTP/TLS/AES256-SHA; 28 Jan 2021 08:55:32 -0800 X-QCInternal: smtphost Received: from nitirawa-linux.qualcomm.com ([10.206.25.176]) by ironmsg02-blr.qualcomm.com with ESMTP; 28 Jan 2021 22:25:05 +0530 Received: by nitirawa-linux.qualcomm.com (Postfix, from userid 2342877) id B641D2A73; Thu, 28 Jan 2021 22:25:05 +0530 (IST) From: Nitin Rawat To: asutoshd@codeaurora.org, cang@codeaurora.org, stummala@codeaurora.org, vbadigan@codeaurora.org, alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com, martin.petersen@oracle.com, stanley.chu@mediatek.com, beanhuo@micron.com Cc: bvanassche@acm.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Nitin Rawat , "Bao D . Nguyen" Subject: [PATCH V1 2/3] scsi: ufs: add a vops to configure VCC voltage level Date: Thu, 28 Jan 2021 22:24:58 +0530 Message-Id: <1611852899-2171-3-git-send-email-nitirawa@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1611852899-2171-1-git-send-email-nitirawa@codeaurora.org> References: <1611852899-2171-1-git-send-email-nitirawa@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a vops to configure VCC voltage VCC voltage level for platform supporting both ufs2.x and ufs 3.x devices. Signed-off-by: Nitin Rawat Signed-off-by: Bao D. Nguyen Signed-off-by: Veerabhadrarao Badiganti --- drivers/scsi/ufs/ufshcd.c | 5 +++++ drivers/scsi/ufs/ufshcd.h | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 000a03a..3b2e026 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -7772,6 +7772,11 @@ static int ufshcd_add_lus(struct ufs_hba *hba) if (ret) goto out; + if (ufshcd_vops_setup_vcc_regulators(hba)) + dev_err(hba->dev, + "%s: Failed to set the VCC regulator values, continue with 2.7v\n", + __func__); + /* Initialize devfreq after UFS device is detected */ if (ufshcd_is_clkscaling_supported(hba)) { memcpy(&hba->clk_scaling.saved_pwr_info.info, diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 1410c95..250cff5 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -324,6 +324,7 @@ struct ufs_pwr_mode_info { * @device_reset: called to issue a reset pulse on the UFS device * @program_key: program or evict an inline encryption key * @event_notify: called to notify important events + * @setup_vcc_regulators : update vcc regulator level */ struct ufs_hba_variant_ops { const char *name; @@ -360,6 +361,7 @@ struct ufs_hba_variant_ops { const union ufs_crypto_cfg_entry *cfg, int slot); void (*event_notify)(struct ufs_hba *hba, enum ufs_event_type evt, void *data); + int (*setup_vcc_regulators)(struct ufs_hba *hba); }; /* clock gating state */ @@ -1269,6 +1271,14 @@ static inline void ufshcd_vops_config_scaling_param(struct ufs_hba *hba, hba->vops->config_scaling_param(hba, profile, data); } +static inline int ufshcd_vops_setup_vcc_regulators(struct ufs_hba *hba) +{ + if (hba->vops && hba->vops->setup_vcc_regulators) + return hba->vops->setup_vcc_regulators(hba); + + return 0; +} + extern struct ufs_pm_lvl_states ufs_pm_lvl_states[]; /* -- 2.7.4