scsi: ufs-debugfs: fix reading the M-PHY RX attributes
DME attributes read/write commands need GenSelectorIndex argument and according to UFS host controller specification, it should specify the targeted M-PHY data lane. This is the valid range of GenSelectorIndex for M-PHY attributes: 0 to (2 * PA_MaxDataLanes - 1) Example (Note: PA_MaxDataLanes is UniPro protocol constant set to 4): ----------------------------------------- MPHY Access target | GenSelectorIndex ----------------------------------------- TX Lane0 | 0 TX Lane1 | 1 RX Lane0 | 4 RX Lane1 | 5 ----------------------------------------- This change makes sure that correct GenSelectorIndex is passed for M-PHY attributes while it reading via debugfs. Change-Id: If09e4271958e4bb18d315446cef253caec75584a Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
This commit is contained in:
parent
a729df084c
commit
fcdf9bdb3f
2 changed files with 14 additions and 2 deletions
|
@ -1303,6 +1303,7 @@ static int ufsdbg_dme_read(void *data, u64 *attr_val, bool peer)
|
||||||
struct ufs_hba *hba = data;
|
struct ufs_hba *hba = data;
|
||||||
u32 attr_id, read_val = 0;
|
u32 attr_id, read_val = 0;
|
||||||
int (*read_func)(struct ufs_hba *, u32, u32 *);
|
int (*read_func)(struct ufs_hba *, u32, u32 *);
|
||||||
|
u32 attr_sel;
|
||||||
|
|
||||||
if (!hba)
|
if (!hba)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -1313,8 +1314,16 @@ static int ufsdbg_dme_read(void *data, u64 *attr_val, bool peer)
|
||||||
pm_runtime_get_sync(hba->dev);
|
pm_runtime_get_sync(hba->dev);
|
||||||
scsi_block_requests(hba->host);
|
scsi_block_requests(hba->host);
|
||||||
ret = ufshcd_wait_for_doorbell_clr(hba, DOORBELL_CLR_TOUT_US);
|
ret = ufshcd_wait_for_doorbell_clr(hba, DOORBELL_CLR_TOUT_US);
|
||||||
if (!ret)
|
if (!ret) {
|
||||||
ret = read_func(hba, UIC_ARG_MIB(attr_id), &read_val);
|
if ((attr_id >= MPHY_RX_ATTR_ADDR_START)
|
||||||
|
&& (attr_id <= MPHY_RX_ATTR_ADDR_END))
|
||||||
|
attr_sel = UIC_ARG_MIB_SEL(attr_id,
|
||||||
|
UIC_ARG_MPHY_RX_GEN_SEL_INDEX(0));
|
||||||
|
else
|
||||||
|
attr_sel = UIC_ARG_MIB(attr_id);
|
||||||
|
|
||||||
|
ret = read_func(hba, attr_sel, &read_val);
|
||||||
|
}
|
||||||
scsi_unblock_requests(hba->host);
|
scsi_unblock_requests(hba->host);
|
||||||
pm_runtime_put_sync(hba->dev);
|
pm_runtime_put_sync(hba->dev);
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,9 @@
|
||||||
#define RX_MIN_ACTIVATETIME_CAPABILITY 0x008F
|
#define RX_MIN_ACTIVATETIME_CAPABILITY 0x008F
|
||||||
#define RX_HIBERN8TIME_CAPABILITY 0x0092
|
#define RX_HIBERN8TIME_CAPABILITY 0x0092
|
||||||
|
|
||||||
|
#define MPHY_RX_ATTR_ADDR_START 0x81
|
||||||
|
#define MPHY_RX_ATTR_ADDR_END 0xC1
|
||||||
|
|
||||||
#define is_mphy_tx_attr(attr) (attr < RX_MODE)
|
#define is_mphy_tx_attr(attr) (attr < RX_MODE)
|
||||||
#define RX_MIN_ACTIVATETIME_UNIT_US 100
|
#define RX_MIN_ACTIVATETIME_UNIT_US 100
|
||||||
#define HIBERN8TIME_UNIT_US 100
|
#define HIBERN8TIME_UNIT_US 100
|
||||||
|
|
Loading…
Add table
Reference in a new issue