scsi: ufs: add ufshcd_dme_rmw wrapper
Add a wrapper to get/modify/set DME attribute. Change-Id: Ife2ae05950e6c437bef779955432d91d5117d49b Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
This commit is contained in:
parent
f0a5174e94
commit
dbd6e84bff
1 changed files with 26 additions and 0 deletions
|
@ -1049,6 +1049,32 @@ static inline int ufshcd_dme_peer_get(struct ufs_hba *hba,
|
|||
return ufshcd_dme_get_attr(hba, attr_sel, mib_val, DME_PEER);
|
||||
}
|
||||
|
||||
/**
|
||||
* ufshcd_dme_rmw - get modify set a dme attribute
|
||||
* @hba - per adapter instance
|
||||
* @mask - mask to apply on read value
|
||||
* @val - actual value to write
|
||||
* @attr - dme attribute
|
||||
*/
|
||||
static inline int ufshcd_dme_rmw(struct ufs_hba *hba, u32 mask,
|
||||
u32 val, u32 attr)
|
||||
{
|
||||
u32 cfg = 0;
|
||||
int err = 0;
|
||||
|
||||
err = ufshcd_dme_get(hba, UIC_ARG_MIB(attr), &cfg);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
cfg &= ~mask;
|
||||
cfg |= (val & mask);
|
||||
|
||||
err = ufshcd_dme_set(hba, UIC_ARG_MIB(attr), cfg);
|
||||
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
|
||||
int ufshcd_read_device_desc(struct ufs_hba *hba, u8 *buf, u32 size);
|
||||
|
||||
static inline bool ufshcd_is_hs_mode(struct ufs_pa_layer_attr *pwr_info)
|
||||
|
|
Loading…
Add table
Reference in a new issue