Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp688215pxf; Thu, 1 Apr 2021 10:57:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxowSHhVUBLSTvgwlbwiqr0UwKjDcdIKZMObVzGEplegqLLfWW5YVQdWuPjjg0VT5y07Zzq X-Received: by 2002:a92:c784:: with SMTP id c4mr3686845ilk.212.1617299839513; Thu, 01 Apr 2021 10:57:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617299839; cv=none; d=google.com; s=arc-20160816; b=CPMKDXFvRM+KWaql++OTtPzz3J4q5/5Y9AMEhTlHxnO4YnKnNYxIFnWV82KP3XU00W Hh/D+QFWn/QoFBMAPgi1jnBSv+uClQZ+IzqGsPAJ5sObhQhnOIPfwzy4qUwdMZhNSf0l mhwIeS68ih+OhwIgoay2ch//DSz0xbP6gR9F0JakLzNVczM+odjL5txjKHJBtzST+Jkn ztDL3rY3wFxSJQ/B+SSXxDQwPW4BbBfRpbPcwVW8PKK+LCXlvULizDuxHhOpMdOj5vat RzIvKtofB7qIgWjKkjbMq9v3nK9gQ6+XFCFy3RQv2sCLSRYDjuPG9lqHtBeV49jpnn0J 2dVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :sender:dkim-signature; bh=bHbr7KBSlGV8bKA1algZFTTPRBsvH2U+aHDd0G/QszY=; b=XAxdJdZ/D3ffLkGuRxbPdBkgmGZRK1VJ61MFBatgoJnsaVTU7zGFfxkrYjzyslAKwv 92C88jUxfk2Rq4nBAWHAL8wBRl3SAaeuA/y+wGo2XbK/n/ypbHnUih+9/i0MH9zeQjHK UwI9uO5S6WM7trx2io/Y+sonZl2JzKucq4AaXTOKAKrnvyswK48soolKGLfNAIBe0bvE Lg33tvkVAUKia20CCc489MA4u3jq4CzZHPNNkAcGkw6QjN+UhPyGIDyY6DedoJM45yIz IEIjr6IsE7KkjPwCjuUYihksnBiY4rvh5we15a2yaJMKEMivNMClykAiQpKuCp6PKBkR 7cMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=WrOHH14A; 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 t5si4888432ilu.91.2021.04.01.10.57.06; Thu, 01 Apr 2021 10:57:19 -0700 (PDT) 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; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=WrOHH14A; 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 S236979AbhDAR4k (ORCPT + 99 others); Thu, 1 Apr 2021 13:56:40 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:59134 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235147AbhDARmX (ORCPT ); Thu, 1 Apr 2021 13:42:23 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1617298944; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=bHbr7KBSlGV8bKA1algZFTTPRBsvH2U+aHDd0G/QszY=; b=WrOHH14Al24CxRnv0499HXBp9unvzD18HktIvHrpymAllszQmc/K9ruVdlpzdS65YBmHH/Re hXrdBt6NcybfO3sX9QUOWXsmdou3Og3WzXUxqCe8v+OoAwEH7iSK/zyRj6mdo+idhl7NtUrv 3COctvFUXtcPZVIEFJ1+Hafjg4E= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n01.prod.us-east-1.postgun.com with SMTP id 6065e0d48166b7eff77a57fc (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 01 Apr 2021 15:03:48 GMT Sender: nitirawa=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id EFE16C43466; Thu, 1 Apr 2021 15:03:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: nitirawa) by smtp.codeaurora.org (Postfix) with ESMTPSA id 74421C433CA; Thu, 1 Apr 2021 15:03:46 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 01 Apr 2021 20:33:46 +0530 From: nitirawa@codeaurora.org To: "Asutosh Das (asd)" Cc: 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, bjorn.andersson@linaro.org, adrian.hunter@intel.com, bvanassche@acm.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, asutoshd=codeaurora.org@codeaurora.org Subject: Re: [PATCH V2 2/3] scsi: ufs: add a vops to configure VCC voltage level In-Reply-To: <80f681a6-165f-0610-dfea-6b66ce4abddc@codeaurora.org> References: <1616363857-26760-1-git-send-email-nitirawa@codeaurora.org> <1616363857-26760-3-git-send-email-nitirawa@codeaurora.org> <80f681a6-165f-0610-dfea-6b66ce4abddc@codeaurora.org> Message-ID: <0681d6426135afebf4feca549bf0a79c@codeaurora.org> X-Sender: nitirawa@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-03-31 23:30, Asutosh Das (asd) wrote: > On 3/21/2021 2:57 PM, Nitin Rawat wrote: >> Add a vops to configure VCC voltage VCC voltage level >> for platform supporting both ufs2.x and ufs 3.x devices. >> >> Suggested-by: Stanley Chu >> Suggested-by: Asutosh Das >> Suggested-by: Bjorn Andersson >> Signed-off-by: Nitin Rawat >> Signed-off-by: Veerabhadrarao Badiganti >> --- >> drivers/scsi/ufs/ufshcd.c | 4 ++++ >> drivers/scsi/ufs/ufshcd.h | 10 ++++++++++ >> 2 files changed, 14 insertions(+) >> >> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c >> index 633ca8e..5bfe987 100644 >> --- a/drivers/scsi/ufs/ufshcd.c >> +++ b/drivers/scsi/ufs/ufshcd.c >> @@ -7763,6 +7763,10 @@ static int ufshcd_add_lus(struct ufs_hba *hba) >> goto out; >> >> ufshcd_clear_ua_wluns(hba); >> + if (ufshcd_vops_setup_vcc_regulators(hba)) > This would be invoked even for platforms that don't support both 2.x > and 3.x and don't need to set the voltages in the driver. > I guess platforms that support both 2.x and 3.x and can't set the > regulator voltages from dts due to different voltage requirements of > 2.x and 3.x, should request the driver to set the voltages. And the > driver may do so after determining the device version. > >> + 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)) { >> diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h >> index 0db796a..8f0945d 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 >> Hi Asutosh, Thanks for the suggestion. I will check and try to accommodate your suggestion. Regards, Nitin