From: Stanley Chu <stanley.chu@mediatek.com>
To: <linux-scsi@vger.kernel.org>, <martin.petersen@oracle.com>,
<avri.altman@wdc.com>, <alim.akhtar@samsung.com>,
<jejb@linux.ibm.com>
Cc: andy.teng@mediatek.com, cc.chou@mediatek.com,
chun-hung.wu@mediatek.com, kuohong.wang@mediatek.com,
linux-kernel@vger.kernel.org, jiajie.hao@mediatek.com,
linux-mediatek@lists.infradead.org, peter.wang@mediatek.com,
matthias.bgg@gmail.com, Stanley Chu <stanley.chu@mediatek.com>,
chaotian.jing@mediatek.com, linux-arm-kernel@lists.infradead.org,
alice.chao@mediatek.com
Subject: [PATCH v1 4/6] scsi: ufs-mediatek: Support option to disable auto-hibern8
Date: Thu, 29 Oct 2020 19:57:48 +0800 [thread overview]
Message-ID: <20201029115750.24391-5-stanley.chu@mediatek.com> (raw)
In-Reply-To: <20201029115750.24391-1-stanley.chu@mediatek.com>
Support an option to allow users to disable auto-hibern8 feature.
Instead, enable hibern8-during-clk-gating feature to keep similar
power consumption.
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
drivers/scsi/ufs/ufs-mediatek.c | 18 ++++++++++++++++++
drivers/scsi/ufs/ufs-mediatek.h | 1 +
2 files changed, 19 insertions(+)
diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
index fa7d0e4eeb0d..dda028ec30dc 100644
--- a/drivers/scsi/ufs/ufs-mediatek.c
+++ b/drivers/scsi/ufs/ufs-mediatek.c
@@ -158,6 +158,7 @@ static int ufs_mtk_hce_enable_notify(struct ufs_hba *hba,
enum ufs_notify_change_status status)
{
struct ufs_mtk_host *host = ufshcd_get_variant(hba);
+ unsigned long flags;
if (status == PRE_CHANGE) {
if (host->unipro_lpm) {
@@ -169,6 +170,17 @@ static int ufs_mtk_hce_enable_notify(struct ufs_hba *hba,
if (hba->caps & UFSHCD_CAP_CRYPTO)
ufs_mtk_crypto_enable(hba);
+
+ if (host->caps & UFS_MTK_CAP_DISABLE_AH8) {
+ spin_lock_irqsave(hba->host->host_lock, flags);
+ ufshcd_writel(hba, 0,
+ REG_AUTO_HIBERNATE_IDLE_TIMER);
+ spin_unlock_irqrestore(hba->host->host_lock,
+ flags);
+
+ hba->capabilities &= ~MASK_AUTO_HIBERN8_SUPPORT;
+ hba->ahit = 0;
+ }
}
return 0;
@@ -496,6 +508,9 @@ static void ufs_mtk_init_host_caps(struct ufs_hba *hba)
if (of_property_read_bool(np, "mediatek,ufs-support-va09"))
ufs_mtk_init_va09_pwr_ctrl(hba);
+ if (of_property_read_bool(np, "mediatek,ufs-disable-ah8"))
+ host->caps |= UFS_MTK_CAP_DISABLE_AH8;
+
dev_info(hba->dev, "caps: 0x%x", host->caps);
}
@@ -609,6 +624,9 @@ static int ufs_mtk_init(struct ufs_hba *hba)
hba->caps |= UFSHCD_CAP_WB_EN;
hba->vps->wb_flush_threshold = UFS_WB_BUF_REMAIN_PERCENT(80);
+ if (host->caps & UFS_MTK_CAP_DISABLE_AH8)
+ hba->caps |= UFSHCD_CAP_HIBERN8_WITH_CLK_GATING;
+
/*
* ufshcd_vops_init() is invoked after
* ufshcd_setup_clock(true) in ufshcd_hba_init() thus
diff --git a/drivers/scsi/ufs/ufs-mediatek.h b/drivers/scsi/ufs/ufs-mediatek.h
index 0e76429f69d6..30f45dfce04c 100644
--- a/drivers/scsi/ufs/ufs-mediatek.h
+++ b/drivers/scsi/ufs/ufs-mediatek.h
@@ -96,6 +96,7 @@ enum {
enum ufs_mtk_host_caps {
UFS_MTK_CAP_BOOST_CRYPT_ENGINE = 1 << 0,
UFS_MTK_CAP_VA09_PWR_CTRL = 1 << 1,
+ UFS_MTK_CAP_DISABLE_AH8 = 1 << 2,
};
struct ufs_mtk_crypt_cfg {
--
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
next prev parent reply other threads:[~2020-10-29 11:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-29 11:57 [PATCH v1 0/6] scsi: ufs: Add some proprietary features in MediaTek UFS platforms Stanley Chu
2020-10-29 11:57 ` [PATCH v1 1/6] scsi: ufs-mediatek: Assign arguments with correct type Stanley Chu
2020-11-03 7:12 ` Avri Altman
2020-11-03 7:39 ` Stanley Chu
2020-11-03 8:55 ` Avri Altman
2020-10-29 11:57 ` [PATCH v1 2/6] scsi: ufs-mediatek: Support VA09 regulator operations Stanley Chu
2020-10-29 11:57 ` [PATCH v1 3/6] scsi: ufs-mediatek: Decouple features from platform bindings Stanley Chu
2020-10-29 11:57 ` Stanley Chu [this message]
2020-10-29 11:57 ` [PATCH v1 5/6] scsi: ufs: Add enums for UniPro version higher than 1.6 Stanley Chu
2020-10-29 11:57 ` [PATCH v1 6/6] scsi: ufs-mediatek: Add HS-G4 support Stanley Chu
2020-11-06 6:10 ` [PATCH v1 0/6] scsi: ufs: Add some proprietary features in MediaTek UFS platforms Stanley Chu
2020-11-11 4:04 ` Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201029115750.24391-5-stanley.chu@mediatek.com \
--to=stanley.chu@mediatek.com \
--cc=alice.chao@mediatek.com \
--cc=alim.akhtar@samsung.com \
--cc=andy.teng@mediatek.com \
--cc=avri.altman@wdc.com \
--cc=cc.chou@mediatek.com \
--cc=chaotian.jing@mediatek.com \
--cc=chun-hung.wu@mediatek.com \
--cc=jejb@linux.ibm.com \
--cc=jiajie.hao@mediatek.com \
--cc=kuohong.wang@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=matthias.bgg@gmail.com \
--cc=peter.wang@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox