From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77734C433E0 for ; Wed, 29 Jul 2020 05:33:09 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3C0582070B for ; Wed, 29 Jul 2020 05:33:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="nLBYxk89"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="mO6UaN4g" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C0582070B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:To:From: Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kiPyxVQettpFO9GrkG4TKYkmZIv3Dmr5xBgUxWrHC3Y=; b=nLBYxk890mraTVchY/pikIoRw VVnDxUw1NfccFm/oNShD56HctsKq6BciaabPIf1smZ+WWVbjBbtf44caP6fGsr7LudlD5KuRFcFfT /8K2X9GlaWiZZAl3JJ5vMJ8yLyrZV6vS0oO+iuXJGt12ucnruC+0X5gyIK3Z16Q9jHfU4TiUlb6t/ bwqhzKcMk2g21LV5DV2UFufEEmm5/g6L0dRtzHoHNIZAm/Uecsrmdfo9pMnPKE2CKcRNgtRHmcK1u coYok9WI+k9zXCHwGNp6ShpbTaHoDqBT52Ih1XvtibBlw0QzvH7SrpNKlXWpIoLSPUkk24JGTCsOu n9CQH2A6A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k0egt-0005Mi-0Q; Wed, 29 Jul 2020 05:31:47 +0000 Received: from m43-7.mailgun.net ([69.72.43.7]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k0egq-0005Ll-6u for linux-arm-kernel@lists.infradead.org; Wed, 29 Jul 2020 05:31:45 +0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1596000704; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=msx+gBK9mgOBcKEpu5rUP0WumjhIp0LNn0i9vsL3Tdc=; b=mO6UaN4g4NrCvDqQSaVjjC4Yb+kbJxkCfyy66gbjRRHY8GUDbkpyb0e/h1zvLNWaVkHiaa+E UtEdJzQiKTRiAYc1eMBPp4AJBX6qziRvzydbwenUDtTfvOSlvIDRzaEdMw/4Rz2sTEEsvRII j4Pj84W5YNW3lYRZXMLwrO2c9Gw= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyJiYzAxZiIsICJsaW51eC1hcm0ta2VybmVsQGxpc3RzLmluZnJhZGVhZC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n16.prod.us-east-1.postgun.com with SMTP id 5f2109bdbd0c3f02966fe3f9 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Wed, 29 Jul 2020 05:31:41 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 3EA35C433C9; Wed, 29 Jul 2020 05:31:41 +0000 (UTC) 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: cang) by smtp.codeaurora.org (Postfix) with ESMTPSA id 4A649C433C6; Wed, 29 Jul 2020 05:31:40 +0000 (UTC) MIME-Version: 1.0 Date: Wed, 29 Jul 2020 13:31:40 +0800 From: Can Guo To: Stanley Chu Subject: Re: [PATCH v1 1/2] scsi: ufs: Introduce device quirk "DELAY_AFTER_LPM" In-Reply-To: <20200729051840.31318-2-stanley.chu@mediatek.com> References: <20200729051840.31318-1-stanley.chu@mediatek.com> <20200729051840.31318-2-stanley.chu@mediatek.com> Message-ID: X-Sender: cang@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200729_013144_825489_6A17F1A7 X-CRM114-Status: GOOD ( 21.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-scsi@vger.kernel.org, martin.petersen@oracle.com, andy.teng@mediatek.com, jejb@linux.ibm.com, chun-hung.wu@mediatek.com, kuohong.wang@mediatek.com, linux-kernel@vger.kernel.org, cc.chou@mediatek.com, avri.altman@wdc.com, linux-mediatek@lists.infradead.org, peter.wang@mediatek.com, alim.akhtar@samsung.com, matthias.bgg@gmail.com, asutoshd@codeaurora.org, chaotian.jing@mediatek.com, bvanassche@acm.org, linux-arm-kernel@lists.infradead.org, beanhuo@micron.com Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Stanley, On 2020-07-29 13:18, Stanley Chu wrote: > Some UFS devices require delay after VCC power rail is turned-off. > Introduce a device quirk "DELAY_AFTER_LPM" to add 5ms delays after > VCC power-off during suspend flow. > Just curious, I can understand if you want to add some delays before turnning off VCC/VCCQ/VCCQ2, but what is the delay AFTER turnning them off for? I mean the power has been cut by host from PMIC, how can the delay benefit the UFS device? Thanks, Can Guo. > Signed-off-by: Andy Teng > Signed-off-by: Peter Wang > Signed-off-by: Stanley Chu > --- > drivers/scsi/ufs/ufs_quirks.h | 7 +++++++ > drivers/scsi/ufs/ufshcd.c | 11 +++++++++++ > 2 files changed, 18 insertions(+) > > diff --git a/drivers/scsi/ufs/ufs_quirks.h > b/drivers/scsi/ufs/ufs_quirks.h > index 2a0041493e30..07f559ac5883 100644 > --- a/drivers/scsi/ufs/ufs_quirks.h > +++ b/drivers/scsi/ufs/ufs_quirks.h > @@ -109,4 +109,11 @@ struct ufs_dev_fix { > */ > #define UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES (1 << 10) > > +/* > + * Some UFS devices require delay after VCC power rail is turned-off. > + * Enable this quirk to introduce 5ms delays after VCC power-off > during > + * suspend flow. > + */ > +#define UFS_DEVICE_QUIRK_DELAY_AFTER_LPM (1 << 11) > + > #endif /* UFS_QUIRKS_H_ */ > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index acba2271c5d3..63f4e2f75aa1 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -8111,6 +8111,8 @@ static int ufshcd_link_state_transition(struct > ufs_hba *hba, > > static void ufshcd_vreg_set_lpm(struct ufs_hba *hba) > { > + bool vcc_off = false; > + > /* > * It seems some UFS devices may keep drawing more than sleep current > * (atleast for 500us) from UFS rails (especially from VCCQ rail). > @@ -8139,13 +8141,22 @@ static void ufshcd_vreg_set_lpm(struct ufs_hba > *hba) > if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba) && > !hba->dev_info.is_lu_power_on_wp) { > ufshcd_setup_vreg(hba, false); > + vcc_off = true; > } else if (!ufshcd_is_ufs_dev_active(hba)) { > ufshcd_toggle_vreg(hba->dev, hba->vreg_info.vcc, false); > + vcc_off = true; > if (!ufshcd_is_link_active(hba)) { > ufshcd_config_vreg_lpm(hba, hba->vreg_info.vccq); > ufshcd_config_vreg_lpm(hba, hba->vreg_info.vccq2); > } > } > + > + /* > + * Some UFS devices require delay after VCC power rail is turned-off. > + */ > + if (vcc_off && hba->vreg_info.vcc && > + hba->dev_quirks & UFS_DEVICE_QUIRK_DELAY_AFTER_LPM) > + usleep_range(5000, 5100); > } > > static int ufshcd_vreg_set_hpm(struct ufs_hba *hba) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel