From patchwork Fri Jan 24 06:49:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanley Chu X-Patchwork-Id: 11349801 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 79BEC924 for ; Fri, 24 Jan 2020 06:49:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 53FF620709 for ; Fri, 24 Jan 2020 06:49:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="njXorR7X" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730843AbgAXGtl (ORCPT ); Fri, 24 Jan 2020 01:49:41 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:31589 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725843AbgAXGtk (ORCPT ); Fri, 24 Jan 2020 01:49:40 -0500 X-UUID: d7e01f615e6a4a1db03db46215489869-20200124 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=/iGSD+wjvNgUnG2Paki6e43ca0HmiXdtKRWjFiR1Rb8=; b=njXorR7Xp8QqcVM7HbRRvz2YzAyVpzrjX/HpAh1jyeK6HpA0+vUjFSPOFF4gzvZhg93+2b17Muvt0hhj/RjW4Hswvf26Q5hllhXKScRtxL8rmrX9ZO8Fcki57REFW8HappNdRet8a94yYI+U/lm7D8NQf6WeXxeRNWcBgOxpGew=; X-UUID: d7e01f615e6a4a1db03db46215489869-20200124 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1480089201; Fri, 24 Jan 2020 14:49:31 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 24 Jan 2020 14:47:51 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 24 Jan 2020 14:48:58 +0800 From: Stanley Chu To: , , , , CC: , , , , , , , , , , , , Stanley Chu Subject: [PATCH v1 3/5] scsi: ufs: add ufshcd_is_auto_hibern8_enabled facility Date: Fri, 24 Jan 2020 14:49:24 +0800 Message-ID: <20200124064926.29472-4-stanley.chu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200124064926.29472-1-stanley.chu@mediatek.com> References: <20200124064926.29472-1-stanley.chu@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 2186B81FC91BD56D56DC2ED70414E5CFF365755ADAE41D3EA0322DFF951F41F22000:8 X-MTK: N Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Auto-Hibern8 may be disabled by some vendors or sysfs in runtime even if Auto-Hibern8 capability is supported by host. Thus provide a way to detect if Auto-Hibern8 is actually enabled for future related handlings. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 2ae6c7c8528c..81c71a3e3474 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -55,6 +55,7 @@ #include #include #include +#include #include "unipro.h" #include @@ -773,6 +774,11 @@ static inline bool ufshcd_is_auto_hibern8_supported(struct ufs_hba *hba) return (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT); } +static inline bool ufshcd_is_auto_hibern8_enabled(struct ufs_hba *hba) +{ + return FIELD_GET(UFSHCI_AHIBERN8_TIMER_MASK, hba->ahit) ? true : false; +} + #define ufshcd_writel(hba, val, reg) \ writel((val), (hba)->mmio_base + (reg)) #define ufshcd_readl(hba, reg) \