Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: huobean@gmail.com
To: alim.akhtar@samsung.com, avri.altman@wdc.com,
	asutoshd@codeaurora.org, jejb@linux.ibm.com,
	martin.petersen@oracle.com, stanley.chu@mediatek.com,
	beanhuo@micron.com, bvanassche@acm.org, tomas.winkler@intel.com,
	cang@codeaurora.org
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	ymhungry.lee@samsung.com, j-young.choi@samsung.com
Subject: [PATCH v1 1/5] scsi; ufs: add device descriptor for Host Performance Booster
Date: Sat, 21 Mar 2020 01:41:52 +0100	[thread overview]
Message-ID: <20200321004156.23364-2-beanhuo@micron.com> (raw)
In-Reply-To: <20200321004156.23364-1-beanhuo@micron.com>

From: Bean Huo <beanhuo@micron.com>

HPB support is specified by Bit7 of bUFSFeatureSupport,
HPB version is indicated by wHPBVersion and the HPB Control
Mode is specified by bHPBControl in UFS device descriptor.

Signed-off-by: Bean Huo <beanhuo@micron.com>
---
 drivers/scsi/ufs/ufs.h    | 10 ++++++++++
 drivers/scsi/ufs/ufshcd.c | 11 +++++++++++
 2 files changed, 21 insertions(+)

diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h
index b7fec5c73688..31011d86610b 100644
--- a/drivers/scsi/ufs/ufs.h
+++ b/drivers/scsi/ufs/ufs.h
@@ -258,6 +258,12 @@ enum device_desc_param {
 	DEVICE_DESC_PARAM_PSA_MAX_DATA		= 0x25,
 	DEVICE_DESC_PARAM_PSA_TMT		= 0x29,
 	DEVICE_DESC_PARAM_PRDCT_REV		= 0x2A,
+	DEVICE_DESC_PARAM_HPB_VER		= 0x40,
+	DEVICE_DESC_PARAM_HPB_CTRL_MODE		= 0x42,
+	DEVICE_DESC_PARAM_EXT_UFS_FEAT		= 0x4F,
+	DEVICE_DESC_PARAM_WBB_USER_SPEC_EN	= 0x53,
+	DEVICE_DESC_PARAM_WBB_TYPE		= 0x54,
+	DEVICE_DESC_PARAM_WBB_SHARED_NUM	= 0x55,
 };
 
 /* Interconnect descriptor parameters offsets in bytes*/
@@ -537,6 +543,10 @@ struct ufs_dev_info {
 	u8 *model;
 	u16 wspecversion;
 	u32 clk_gating_wait_us;
+	/* HPB Version */
+	u16 hpb_ver;
+	/* bHPBControl */
+	u8 hpb_control_mode;
 };
 
 /**
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 2a2a63b68a67..492e4685e587 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6559,6 +6559,17 @@ static int ufs_get_device_desc(struct ufs_hba *hba)
 		goto out;
 	}
 
+	if (desc_buf[DEVICE_DESC_PARAM_UFS_FEAT] & 0x80) {
+		hba->dev_info.hpb_control_mode =
+			desc_buf[DEVICE_DESC_PARAM_HPB_CTRL_MODE];
+		hba->dev_info.hpb_ver =
+			(u16) (desc_buf[DEVICE_DESC_PARAM_HPB_VER] << 8) |
+			desc_buf[DEVICE_DESC_PARAM_HPB_VER + 1];
+		dev_info(hba->dev, "HPB Version: 0x%2x\n",
+			 hba->dev_info.hpb_ver);
+		dev_info(hba->dev, "HPB control mode: %d\n",
+			 hba->dev_info.hpb_control_mode);
+	}
 	/*
 	 * getting vendor (manufacturerID) and Bank Index in big endian
 	 * format
-- 
2.17.1


  reply	other threads:[~2020-03-21  0:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-21  0:41 [PATCH v1 0/5] scsi: ufs: add UFS Host Performance Booster(HPB) driver huobean
2020-03-21  0:41 ` huobean [this message]
2020-03-21  0:41 ` [PATCH v1 2/5] scsi: ufs: make ufshcd_read_unit_desc_param() non-static func huobean
2020-03-21  0:41 ` [PATCH v1 3/5] scsi: ufs: add ufs_features parameter in structure ufs_dev_info huobean
2020-03-21  0:41 ` [PATCH v1 4/5] scsi: ufs: add unit and geometry parameters for HPB huobean
2020-03-21  0:41 ` [PATCH v1 5/5] scsi: ufs: UFS Host Performance Booster(HPB) driver huobean
2020-03-21  2:27   ` kbuild test robot
2020-03-21  3:37   ` kbuild test robot
2020-03-21 16:50   ` kbuild test robot
2020-03-21 16:50   ` [RFC PATCH] scsi: ufs: alloc_mctx can be static kbuild test robot

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=20200321004156.23364-2-beanhuo@micron.com \
    --to=huobean@gmail.com \
    --cc=alim.akhtar@samsung.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=cang@codeaurora.org \
    --cc=j-young.choi@samsung.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=stanley.chu@mediatek.com \
    --cc=tomas.winkler@intel.com \
    --cc=ymhungry.lee@samsung.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