Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp696085pxf; Thu, 1 Apr 2021 11:07:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxd4o5uN5dxaNbZxcfU5A3lAEghmmofZ8JctVfqYUBDk5YfJbyVfYaP+3iN2qPS5y0Sf1t8 X-Received: by 2002:aa7:c447:: with SMTP id n7mr11173860edr.171.1617300469441; Thu, 01 Apr 2021 11:07:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617300469; cv=none; d=google.com; s=arc-20160816; b=MeSQLJopTahiozepwGSu7C41MQk9xypzBrrVr87nRGQQwS7xE78kHCQrU2lPJlanwF niC6fIcnf2Ed5HeV42kVznBnCK9i5SU4K6RhbkAOkb8bzUGasPRf4U8odOSX41wvMu8x MVQnMaUMvyULTBh1cg9krZ87fDvb6v3erJixSWa9UjanA5vzvvhlOUJY7EpMqftGwCfi 5iO51RRvcsvrgYlPSBRFWwjT9/oh8hT9wo8tLwvpz2teVdMLLJl/XAP/6ngDqpk4tiL7 lofESApBnN6BBvuBf6swgelIDBlw6OOAkZQj8CJHTRCN14xKqJxXdazraOdpOt5b4urF Iu0Q== 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=umKbm8N9QR1ITCNfEI8UNCb/d98JCMacMjQP959z5lE=; b=hjsJ/saUVmUKRtN76Il5R4ZP19YBNX4m8z536TA3W131Jt98v0x/EnMA2m2LnUti+H FqYNmRecvSmBIYoLieq4IIKZh++O63vsWssoGXESUdYuMIyq9ancLWeUEt6e9AqDvKm5 kc7dwQGT/EDvOnB0KrUlNfE/HZh3Jv0FIvYHXxnQe4Wfk0CT02mHajarWLQUkuxPY4LB kX3zPZwgJKpfBx1DpOVPirSCR6MKUFVS6B04uIW+HOvEaPBF3Gtc7q2jBNWscjmqDME3 F6AQtiAJYVm393gJZURVmUcP4oXd5ynVVaoF8CLVRu6v+kVeDz04evczoqcAIGrtZh8P jXgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=gqNlzCyu; 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 cy27si4568232edb.529.2021.04.01.11.07.26; Thu, 01 Apr 2021 11:07:49 -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=gqNlzCyu; 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 S237730AbhDASEP (ORCPT + 99 others); Thu, 1 Apr 2021 14:04:15 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:22116 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236453AbhDARpA (ORCPT ); Thu, 1 Apr 2021 13:45:00 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1617299100; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=umKbm8N9QR1ITCNfEI8UNCb/d98JCMacMjQP959z5lE=; b=gqNlzCyu1NlBNfNKdf88n7NTneWMpNs8OQXT1E5/sq67ljSCxSnL9DoioIbcEcraDfXtyecQ 9gSiZwsnr7eAYRz7MxTDjFSbraOa+zVTf9flMzN0VEpe+Ypim8yT3fIJOzoIEQaZnIqdceni AW4mQPM1bmyNM8bfg7jqin87nrk= 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-n04.prod.us-west-2.postgun.com with SMTP id 6065e0229a9ff96d955ca100 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 01 Apr 2021 15:00:50 GMT Sender: nitirawa=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id BB3BEC43465; Thu, 1 Apr 2021 15:00:50 +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 46FA5C433CA; Thu, 1 Apr 2021 15:00:49 +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:30:49 +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: <73019fc8a71748496cd6a974600e37de@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. Hi Asutosh, Thanks for the suggestion. I will check and try to accommodate your suggestion. Regards, Nitin > >> + 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 >>