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: <beanhuo@micron.com>, <asutoshd@codeaurora.org>,
<cang@codeaurora.org>, <kwmad.kim@samsung.com>,
<liwei213@huawei.com>, <matthias.bgg@gmail.com>,
<linux-mediatek@lists.infradead.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <kuohong.wang@mediatek.com>,
<peter.wang@mediatek.com>, <chun-hung.wu@mediatek.com>,
<andy.teng@mediatek.com>, <chaotian.jing@mediatek.com>,
<cc.chou@mediatek.com>, <jiajie.hao@mediatek.com>,
<alice.chao@mediatek.com>, Stanley Chu <stanley.chu@mediatek.com>
Subject: [PATCH v1 7/9] scsi: ufs: Refactor ADAPT configuration function
Date: Mon, 16 Nov 2020 14:50:52 +0800 [thread overview]
Message-ID: <20201116065054.7658-8-stanley.chu@mediatek.com> (raw)
In-Reply-To: <20201116065054.7658-1-stanley.chu@mediatek.com>
Several vendors are using same code to configure ADAPT
settings for HS-G4. Simply refactor it as common function.
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
drivers/scsi/ufs/ufshcd.c | 16 ++++++++++++++++
drivers/scsi/ufs/ufshcd.h | 3 +++
2 files changed, 19 insertions(+)
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 9186ee01379a..80cbce414678 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -3587,6 +3587,22 @@ static int ufshcd_dme_reset(struct ufs_hba *hba)
return ret;
}
+int ufshcd_dme_configure_adapt(struct ufs_hba *hba,
+ int agreed_gear,
+ int adapt_val)
+{
+ int ret;
+
+ if (agreed_gear != UFS_HS_G4)
+ adapt_val = PA_INITIAL_ADAPT;
+
+ ret = ufshcd_dme_set(hba,
+ UIC_ARG_MIB(PA_TXHSADAPTTYPE),
+ adapt_val);
+ return ret;
+}
+EXPORT_SYMBOL_GPL(ufshcd_dme_configure_adapt);
+
/**
* ufshcd_dme_enable - UIC command for DME_ENABLE
* @hba: per adapter instance
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 5191d87f6263..d0b68df07eef 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -956,6 +956,9 @@ extern int ufshcd_runtime_idle(struct ufs_hba *hba);
extern int ufshcd_system_suspend(struct ufs_hba *hba);
extern int ufshcd_system_resume(struct ufs_hba *hba);
extern int ufshcd_shutdown(struct ufs_hba *hba);
+extern int ufshcd_dme_configure_adapt(struct ufs_hba *hba,
+ int agreed_gear,
+ int adapt_val);
extern int ufshcd_dme_set_attr(struct ufs_hba *hba, u32 attr_sel,
u8 attr_set, u32 mib_val, u8 peer);
extern int ufshcd_dme_get_attr(struct ufs_hba *hba, u32 attr_sel,
--
2.18.0
next prev parent reply other threads:[~2020-11-16 6:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-16 6:50 [PATCH v1 0/9] scsi: ufs: Refactoring and cleanups Stanley Chu
2020-11-16 6:50 ` [PATCH v1 1/9] scsi: ufs-mediatek: Refactor performance scaling functions Stanley Chu
2020-11-16 6:50 ` [PATCH v1 2/9] scsi: ufs: Introduce device parameter initialization function Stanley Chu
2020-11-16 6:50 ` [PATCH v1 3/9] scsi: ufs-mediatek: Use " Stanley Chu
2020-11-16 6:50 ` [PATCH v1 4/9] scsi: ufs-qcom: " Stanley Chu
2020-11-16 6:50 ` [PATCH v1 5/9] scsi: ufs-exynos: " Stanley Chu
2020-11-16 6:50 ` [PATCH v1 6/9] scsi: ufs-hisi: " Stanley Chu
2020-11-16 6:50 ` Stanley Chu [this message]
2020-11-16 6:50 ` [PATCH v1 8/9] scsi: ufs-mediatek: Use common ADAPT configuration function Stanley Chu
2020-11-16 6:50 ` [PATCH v1 9/9] scsi: ufs-qcom: " Stanley Chu
2020-11-16 8:46 ` [PATCH v1 0/9] scsi: ufs: Refactoring and cleanups Bean Huo
2020-11-17 5:50 ` Martin K. Petersen
2020-11-20 3:31 ` 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=20201116065054.7658-8-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=asutoshd@codeaurora.org \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=cang@codeaurora.org \
--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=kwmad.kim@samsung.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=liwei213@huawei.com \
--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;
as well as URLs for NNTP newsgroup(s).