Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp600264pxf; Wed, 31 Mar 2021 11:03:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZwK6tN846xTPW1ndXaoQdy3Hr1S1T9CPDFeMQiNKW8azRT3+emBdt37TeDg4R/Cfa5NN8 X-Received: by 2002:aa7:d0c2:: with SMTP id u2mr5243159edo.158.1617213783566; Wed, 31 Mar 2021 11:03:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617213783; cv=none; d=google.com; s=arc-20160816; b=kRJsU6UML3G7jUAUvULN1deTI+0xUTqKXWsIIBzlX5jzfUx5DKnN8QyA/K2XoYrbwh WCS7/YjbGkVBuKgcHAMQDa1R2/92YoaddM63M60z9rQEvkHTGnCytfYBRV+TmP7NZ5ZD phqNnKc7JFsbWfmswS8jCZuW23fBpk/obfF5xg6aRwcVtHJSAndatkbj3BnD0NPESGr3 Ld/+QR+wHpF2rphcr4WUzpUGUQ/3r4hxC1YY6PNtorPipJ+gKnMWXDalf1msRS+vnrLk aBccyTMCYsQe8H0/LhkVWUhr1LU9VhRm2AgyOCzVK2EFdvCyb8ON76VqQgm5z5dOCU6D +Ifw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dmarc-filter:sender:dkim-signature; bh=mYdCYC/FPImOY3Dj4Qxijet1JbSBWQXVRBoquvOZPb8=; b=u7aUZy29CY12rA2tnDjHspnnKgvUoTa0ZOnpNJwvsMBU7k+HF558u7Fk6yRBwKj5JR aHJfvZf1SQr0AcAWAEAS8/akuQ88/MEEORtJ2jwcs6Jlq2OsYnUrL1Lz6h2Ao70Gt95q IrAT7TOfHZuY3b+hDRBbhyTjnGRHHj0zS1WhYZUI0ceCd5pL1+QgO10l6BoQhbSSzy3+ uOTNr9CjkL/0dAY9ms4XNAJr4LrDQsWWjsI7JL+HpadQoUAdh+yacnA/838fvo3qlpEV cEAG32HwxkQQQl2AKIb0ucySdrqdiy37hd0iYwDgbMQd13HvfSjZdDtI28MTkmh1sgrf Ybjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=D33tjsWX; 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 d8si2038494ejr.549.2021.03.31.11.02.40; Wed, 31 Mar 2021 11:03:03 -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=D33tjsWX; 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 S234665AbhCaSBC (ORCPT + 99 others); Wed, 31 Mar 2021 14:01:02 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:40342 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233735AbhCaSAa (ORCPT ); Wed, 31 Mar 2021 14:00:30 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1617213630; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=mYdCYC/FPImOY3Dj4Qxijet1JbSBWQXVRBoquvOZPb8=; b=D33tjsWXEJUiAoeH8krsXF2Y9AMbnm2y+7o4i7DBPxB89GxM5z+o4c62RiQlrIwLBFXGEEaU W8dhkFFfYUXnOsC5nF6s4OO2ClkaOjvTxy6/7kwPNAwV/ZxcOdzyMD2NN8ll6dubjrqzG+1g P+XnJYBZ+Zu9WWOq/NzciTOWHTk= X-Mailgun-Sending-Ip: 69.72.43.7 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-n06.prod.us-west-2.postgun.com with SMTP id 6064b8abfebcffa80fe61ba2 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Wed, 31 Mar 2021 18:00:11 GMT Sender: asutoshd=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 09775C43466; Wed, 31 Mar 2021 18:00:11 +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, NICE_REPLY_A,SPF_FAIL autolearn=no autolearn_force=no version=3.4.0 Received: from [192.168.8.168] (cpe-70-95-149-85.san.res.rr.com [70.95.149.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: asutoshd) by smtp.codeaurora.org (Postfix) with ESMTPSA id 7C840C433ED; Wed, 31 Mar 2021 18:00:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 7C840C433ED Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=asutoshd@codeaurora.org Subject: Re: [PATCH V2 2/3] scsi: ufs: add a vops to configure VCC voltage level To: Nitin Rawat , 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 Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org References: <1616363857-26760-1-git-send-email-nitirawa@codeaurora.org> <1616363857-26760-3-git-send-email-nitirawa@codeaurora.org> From: "Asutosh Das (asd)" Message-ID: <80f681a6-165f-0610-dfea-6b66ce4abddc@codeaurora.org> Date: Wed, 31 Mar 2021 11:00:07 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <1616363857-26760-3-git-send-email-nitirawa@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, Linux Foundation Collaborative Project