RE: [PATCH v2 4/6] ufs: core: Advanced RPMB detection

From: Avri Altman
Date: Tue Nov 22 2022 - 04:11:44 EST


> From: Bean Huo <beanhuo@xxxxxxxxxx>
>
> Check UFS Advanced RPMB LU enablement during ufshcd_lu_init().
>
> Signed-off-by: Bean Huo <beanhuo@xxxxxxxxxx>
> ---
> drivers/ufs/core/ufshcd.c | 6 ++++++
> include/ufs/ufs.h | 24 ++++++++++++++++++++++++
> 2 files changed, 30 insertions(+)
>
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index
> 1b252e6cf93f..311172578fd8 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -4956,6 +4956,12 @@ static void ufshcd_lu_init(struct ufs_hba *hba,
> struct scsi_device *sdev)
> desc_buf[UNIT_DESC_PARAM_LU_WR_PROTECT] ==
> UFS_LU_POWER_ON_WP)
> hba->dev_info.is_lu_power_on_wp = true;
>
> + /* In case of RPMB LU, check if advanced RPMB mode is enabled */
> + if (desc_buf[UNIT_DESC_PARAM_UNIT_INDEX] ==
> UFS_UPIU_RPMB_WLUN &&
> + desc_buf[RPMB_UNIT_DESC_PARAM_REGION_EN] & BIT(4))
If instead you use bit 10 in dExtendedUFSFeaturesSupport,
You wouldn't need to add the rpmb unit descriptor, just the appropriate bit.

Thanks,
Avri