Skip to contentSkip to conversation

ufs: introcude UFSHCD_QUIRK_GET_VS_RESULT quirk

PATCH In review Kiwoong Kim 2 participants 4 messages Nov 8, 2016 – Nov 9, 2016 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ufs: introcude UFSHCD_QUIRK_GET_VS_RESULT quirk

Some UFS host controllers may not report a result of UIC command completion properly.
In such cases, they should get the result from UIC directly if their architectures support that.

---
 drivers/scsi/ufs/ufshcd.c | 27 +++++++++++++++++++++++----
 drivers/scsi/ufs/ufshcd.h | 20 ++++++++++++++++++++
 2 files changed, 43 insertions(+), 4 deletions(-)
drivers/scsi/ufs/ufshcd.c +23 -4
index d4a5a9c..8e19631 100644
@@ -1011,7 +1011,10 @@ static inline bool ufshcd_ready_for_uic_cmd(struct ufs_hba *hba)
  */
 static inline u8 ufshcd_get_upmcrs(struct ufs_hba *hba)
 {
-	return (ufshcd_readl(hba, REG_CONTROLLER_STATUS) >> 8) & 0x7;
+	if (hba->quirks & UFSHCD_QUIRK_GET_VS_RESULT)
+		return (u8)ufshcd_vops_get_vs_info(hba, VS_OP_03);
+	else
+		return (ufshcd_readl(hba, REG_CONTROLLER_STATUS) >> 8) & 0x7;
 }
 
 /**
@@ -1038,6 +1041,17 @@ ufshcd_dispatch_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)
 		      REG_UIC_COMMAND);
 }
 
+static inline enum vs_opcode ufshcd_get_vs_opcode(struct uic_command *uic_cmd)
+{
+	if (uic_cmd->command == UIC_CMD_DME_LINK_STARTUP)
+		return VS_OP_00;
+	else if ((uic_cmd->command == UIC_CMD_DME_HIBER_ENTER))
+		return VS_OP_01;
+	else if ((uic_cmd->command == UIC_CMD_DME_HIBER_EXIT))
+		return VS_OP_02;
+	else
+		return VS_OP_INVALID;
+}
 /**
  * ufshcd_wait_for_uic_cmd - Wait complectioin of UIC command
  * @hba: per adapter instance
@@ -1051,11 +1065,16 @@ ufshcd_wait_for_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)
 {
 	int ret;
 	unsigned long flags;
+	enum vs_opcode vs_op = ufshcd_get_vs_opcode(uic_cmd);
 
 	if (wait_for_completion_timeout(&uic_cmd->done,
-					msecs_to_jiffies(UIC_CMD_TIMEOUT)))
-		ret = uic_cmd->argument2 & MASK_UIC_COMMAND_RESULT;
-	else
+					msecs_to_jiffies(UIC_CMD_TIMEOUT))) {
+		if (hba->quirks & UFSHCD_QUIRK_GET_VS_RESULT &&
+					vs_op != VS_OP_INVALID)
+			ret = ufshcd_vops_get_vs_info(hba, vs_op);
+		else
+			ret = uic_cmd->argument2 & MASK_UIC_COMMAND_RESULT;
+	} else
 		ret = -ETIMEDOUT;
 
 	spin_lock_irqsave(hba->host->host_lock, flags);
drivers/scsi/ufs/ufshcd.h +20 -0
index 13504b4..8cf3991 100644
@@ -245,6 +245,14 @@ struct ufs_pwr_mode_info {
 	struct ufs_pa_layer_attr info;
 };
 
+enum vs_opcode {
+	VS_OP_00 = 0x00,
+	VS_OP_01,
+	VS_OP_02,
+	VS_OP_03,
+	VS_OP_INVALID = 0xFF,
+};
+
 /**
  * struct ufs_hba_variant_ops - variant specific callbacks
  * @name: variant name
@@ -297,6 +305,7 @@ struct ufs_hba_variant_ops {
 	int     (*resume)(struct ufs_hba *, enum ufs_pm_op);
 	void	(*dbg_register_dump)(struct ufs_hba *hba);
 	int	(*phy_initialization)(struct ufs_hba *);
+	int	(*get_vs_info)(struct ufs_hba *hba, enum vs_opcode);
 };
 
 /* clock gating state  */
@@ -484,6 +493,8 @@ struct ufs_hba {
 	 */
 	#define UFSHCD_QUIRK_BROKEN_UFS_HCI_VERSION		UFS_BIT(5)
 
+	#define UFSHCD_QUIRK_GET_VS_RESULT			UFS_BIT(6)
+
 	unsigned int quirks;	/* Deviations from standard UFSHCI spec. */
 
 	/* Device deviations from standard UFS device spec. */
@@ -853,4 +864,13 @@ static inline void ufshcd_vops_dbg_register_dump(struct ufs_hba *hba)
 		hba->vops->dbg_register_dump(hba);
 }
 
+static inline int ufshcd_vops_get_vs_info(struct ufs_hba *hba,
+					enum vs_opcode op)
+{
+	if (hba->vops && hba->vops->get_vs_info)
+		return hba->vops->get_vs_info(hba, op);
+
+	return -ENOTSUPP;
+}
+
 #endif /* End of Header */
Signature · 1 line
2.1.4
#1 lore raw
Quoted 49 lines · Kiwoong Kim

Some UFS host controllers may not report a result of UIC command completion properly.
In such cases, they should get the result from UIC directly if their architectures support that.

---
 drivers/scsi/ufs/ufshcd.c | 27 +++++++++++++++++++++++----
 drivers/scsi/ufs/ufshcd.h | 20 ++++++++++++++++++++
 2 files changed, 43 insertions(+), 4 deletions(-)
drivers/scsi/ufs/ufshcd.c +4 -1
index d4a5a9c..8e19631 100644
@@ -1011,7 +1011,10 @@ static inline bool
 ufshcd_ready_for_uic_cmd(struct ufs_hba *hba)
  */
 static inline u8 ufshcd_get_upmcrs(struct ufs_hba *hba)
 {
-	return (ufshcd_readl(hba, REG_CONTROLLER_STATUS) >> 8) & 0x7;
+	if (hba->quirks & UFSHCD_QUIRK_GET_VS_RESULT)
+		return (u8)ufshcd_vops_get_vs_info(hba, VS_OP_03);
+	else
+		return (ufshcd_readl(hba, REG_CONTROLLER_STATUS) >> 8) & 0x7;
 }
 

/**

drivers/scsi/ufs/ufshcd.c +11 -0
@@ -1038,6 +1041,17 @@ ufshcd_dispatch_uic_cmd(struct ufs_hba *hba,
 struct uic_command *uic_cmd)
 		      REG_UIC_COMMAND);
 }
 
+static inline enum vs_opcode ufshcd_get_vs_opcode(struct uic_command 
 *uic_cmd)
+{
+	if (uic_cmd->command == UIC_CMD_DME_LINK_STARTUP)
+		return VS_OP_00;
+	else if ((uic_cmd->command == UIC_CMD_DME_HIBER_ENTER))
+		return VS_OP_01;
+	else if ((uic_cmd->command == UIC_CMD_DME_HIBER_EXIT))
+		return VS_OP_02;
+	else
+		return VS_OP_INVALID;
+}
 /**

* ufshcd_wait_for_uic_cmd - Wait complectioin of UIC command
* @hba: per adapter instance

drivers/scsi/ufs/ufshcd.c ufshcd_wait_for_uic_cmd(struct ufs_hba *hba, · line 1069

Quoted 5 lines
drivers/scsi/ufs/ufshcd.c +1 -0
@@ -1051,11 +1065,16 @@ ufshcd_wait_for_uic_cmd(struct ufs_hba *hba,
 struct uic_command *uic_cmd)
 {
 	int ret;
 	unsigned long flags;
+	enum vs_opcode vs_op = ufshcd_get_vs_opcode(uic_cmd);

Please move this after we check the quirk below.

Quoted 21 lines
drivers/scsi/ufs/ufshcd.c +7 -3
 	if (wait_for_completion_timeout(&uic_cmd->done,
-					msecs_to_jiffies(UIC_CMD_TIMEOUT)))
-		ret = uic_cmd->argument2 & MASK_UIC_COMMAND_RESULT;
-	else
+					msecs_to_jiffies(UIC_CMD_TIMEOUT))) {
+		if (hba->quirks & UFSHCD_QUIRK_GET_VS_RESULT &&
+					vs_op != VS_OP_INVALID)
+			ret = ufshcd_vops_get_vs_info(hba, vs_op);
+		else
+			ret = uic_cmd->argument2 & MASK_UIC_COMMAND_RESULT;
+	} else
 		ret = -ETIMEDOUT;
 
 	spin_lock_irqsave(hba->host->host_lock, flags);
drivers/scsi/ufs/ufshcd.h +0 -0
index 13504b4..8cf3991 100644
@@ -245,6 +245,14 @@ struct ufs_pwr_mode_info {
 	struct ufs_pa_layer_attr info;

drivers/scsi/ufs/ufshcd.h struct ufs_pwr_mode_info { · line 255

Quoted 10 lines
drivers/scsi/ufs/ufshcd.h +8 -0
 };
 
+enum vs_opcode {
+	VS_OP_00 = 0x00,
+	VS_OP_01,
+	VS_OP_02,
+	VS_OP_03,
+	VS_OP_INVALID = 0xFF,
+};
+

How do we interpret these codes? and how is this useful for non-exynos UFS host controller? Please make it generic which can be used by other controllers in future (if required).

Quoted 12 lines
drivers/scsi/ufs/ufshcd.h +1 -0
 /**
  * struct ufs_hba_variant_ops - variant specific callbacks
  * @name: variant name
@@ -297,6 +305,7 @@ struct ufs_hba_variant_ops {
 	int     (*resume)(struct ufs_hba *, enum ufs_pm_op);
 	void	(*dbg_register_dump)(struct ufs_hba *hba);
 	int	(*phy_initialization)(struct ufs_hba *);
+	int	(*get_vs_info)(struct ufs_hba *hba, enum vs_opcode);
 };
 
 /* clock gating state  */

drivers/scsi/ufs/ufshcd.h struct ufs_hba { · line 496

Quoted 4 lines
drivers/scsi/ufs/ufshcd.h +1 -0
@@ -484,6 +493,8 @@ struct ufs_hba {
 	 */
 	#define UFSHCD_QUIRK_BROKEN_UFS_HCI_VERSION		UFS_BIT(5)
 
+	#define UFSHCD_QUIRK_GET_VS_RESULT			UFS_BIT(6)

Name is weird, can we name it to reflect the actual purpose of this quirk? something like UFSHCD_QUIRK_BROKEN_UIC_COMPL ?

drivers/scsi/ufs/ufshcd.h static inline void · line 868

Quoted 10 lines
drivers/scsi/ufs/ufshcd.h +2 -0
+
 	unsigned int quirks;	/* Deviations from standard UFSHCI spec. */
 
 	/* Device deviations from standard UFS device spec. */
@@ -853,4 +864,13 @@ static inline void
 ufshcd_vops_dbg_register_dump(struct ufs_hba *hba)
 		hba->vops->dbg_register_dump(hba);
 }
 
+static inline int ufshcd_vops_get_vs_info(struct ufs_hba *hba,

You may name it as *get_uic_coml_info() ?

Quoted 9 lines
drivers/scsi/ufs/ufshcd.h +8 -0
+					enum vs_opcode op)
+{
+	if (hba->vops && hba->vops->get_vs_info)
+		return hba->vops->get_vs_info(hba, op);
+
+	return -ENOTSUPP;
+}
+

#endif /* End of Header */

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#2 lore raw
Quoted 11 lines
Quoted 11 lines

Some UFS host controllers may not report a result of UIC command completion properly.
In such cases, they should get the result from UIC directly if their architectures support that.

---
 drivers/scsi/ufs/ufshcd.c | 27 +++++++++++++++++++++++----
drivers/scsi/ufs/ufshcd.h | 20 ++++++++++++++++++++
 2 files changed, 43 insertions(+), 4 deletions(-)
Quoted 13 lines

drivers/scsi/ufs/ufshcd.c static inline bool · line 1017

Quoted 13 lines
drivers/scsi/ufs/ufshcd.c +4 -1
index d4a5a9c..8e19631 100644
@@ -1011,7 +1011,10 @@ static inline bool
 ufshcd_ready_for_uic_cmd(struct ufs_hba *hba)
  */
 static inline u8 ufshcd_get_upmcrs(struct ufs_hba *hba)  {
-	return (ufshcd_readl(hba, REG_CONTROLLER_STATUS) >> 8) & 0x7;
+	if (hba->quirks & UFSHCD_QUIRK_GET_VS_RESULT)
+		return (u8)ufshcd_vops_get_vs_info(hba, VS_OP_03);
+	else
+		return (ufshcd_readl(hba, REG_CONTROLLER_STATUS) >> 8) &

0x7;

Quoted 22 lines
Quoted 22 lines
drivers/scsi/ufs/ufshcd.c +11 -0
 }
 
 /**
@@ -1038,6 +1041,17 @@ ufshcd_dispatch_uic_cmd(struct ufs_hba *hba,
 struct uic_command *uic_cmd)
 		      REG_UIC_COMMAND);
 }
 
+static inline enum vs_opcode ufshcd_get_vs_opcode(struct uic_command
 *uic_cmd)
+{
+	if (uic_cmd->command == UIC_CMD_DME_LINK_STARTUP)
+		return VS_OP_00;
+	else if ((uic_cmd->command == UIC_CMD_DME_HIBER_ENTER))
+		return VS_OP_01;
+	else if ((uic_cmd->command == UIC_CMD_DME_HIBER_EXIT))
+		return VS_OP_02;
+	else
+		return VS_OP_INVALID;
+}
 /**

* ufshcd_wait_for_uic_cmd - Wait complectioin of UIC command

Quoted 8 lines

drivers/scsi/ufs/ufshcd.c ufshcd_wait_for_uic_cmd(struct ufs_hba *hba, · line 1068

Quoted 6 lines

* @hba: per adapter instance

drivers/scsi/ufs/ufshcd.c +1 -0
@@ -1051,11 +1065,16 @@ ufshcd_wait_for_uic_cmd(struct ufs_hba *hba,
 struct uic_command *uic_cmd)  {
 	int ret;
 	unsigned long flags;
+	enum vs_opcode vs_op = ufshcd_get_vs_opcode(uic_cmd);

Please move this after we check the quirk below.

Okay, I'll apply what you said.

Quoted 7 lines

drivers/scsi/ufs/ufshcd.c ufshcd_wait_for_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)

Quoted 7 lines
drivers/scsi/ufs/ufshcd.c +1 -3
 	if (wait_for_completion_timeout(&uic_cmd->done,
-					msecs_to_jiffies(UIC_CMD_TIMEOUT)))
-		ret = uic_cmd->argument2 & MASK_UIC_COMMAND_RESULT;
-	else
+					msecs_to_jiffies(UIC_CMD_TIMEOUT)))

{

Quoted 17 lines
Quoted 17 lines
drivers/scsi/ufs/ufshcd.c +6 -0
+		if (hba->quirks & UFSHCD_QUIRK_GET_VS_RESULT &&
+					vs_op != VS_OP_INVALID)
+			ret = ufshcd_vops_get_vs_info(hba, vs_op);
+		else
+			ret = uic_cmd->argument2 & MASK_UIC_COMMAND_RESULT;
+	} else
 		ret = -ETIMEDOUT;
 
 	spin_lock_irqsave(hba->host->host_lock, flags);
drivers/scsi/ufs/ufshcd.h +0 -0
index 13504b4..8cf3991 100644
@@ -245,6 +245,14 @@ struct ufs_pwr_mode_info {
 	struct ufs_pa_layer_attr info;
 };
 
Quoted 12 lines

drivers/scsi/ufs/ufshcd.h struct ufs_pwr_mode_info { · line 255

Quoted 8 lines
drivers/scsi/ufs/ufshcd.h +8 -0
+enum vs_opcode {
+	VS_OP_00 = 0x00,
+	VS_OP_01,
+	VS_OP_02,
+	VS_OP_03,
+	VS_OP_INVALID = 0xFF,
+};
+

How do we interpret these codes? and how is this useful for non-exynos UFS host controller? Please make it generic which can be used by other controllers in future (if required).

As you guessed, this patch is to get some information
by using vendor specific ways directly, which was got from standard UFSHCI SFRs for some hardware problems.

If other controllers have similar problems, but the problems are acutally another cases, you should add the function call - ufshcd_vops_get_vs_info
- wherever you want to use this interface.

This patch is intended to cover all results of link startup, hibern8 and power mode change. Because I don't want to add an additional interface whenever a new controller has a new problem similar with what I mentioned above.

Anyway, could you give me your opinion about it?
Or, if you don't agree applying something just to fix some simple problems, such as reading SFRs, I won't update this patch any more.

Thank you.

Quoted 16 lines
Quoted 16 lines
drivers/scsi/ufs/ufshcd.h +1 -0
 /**
  * struct ufs_hba_variant_ops - variant specific callbacks
  * @name: variant name
@@ -297,6 +305,7 @@ struct ufs_hba_variant_ops {
 	int     (*resume)(struct ufs_hba *, enum ufs_pm_op);
 	void	(*dbg_register_dump)(struct ufs_hba *hba);
 	int	(*phy_initialization)(struct ufs_hba *);
+	int	(*get_vs_info)(struct ufs_hba *hba, enum vs_opcode);
 };
 
 /* clock gating state  */
@@ -484,6 +493,8 @@ struct ufs_hba {
 	 */
 	#define UFSHCD_QUIRK_BROKEN_UFS_HCI_VERSION		UFS_BIT(5)
 
Quoted 4 lines

drivers/scsi/ufs/ufshcd.h struct ufs_hba { · line 496

Quoted 1 line
drivers/scsi/ufs/ufshcd.h +1 -0
+	#define UFSHCD_QUIRK_GET_VS_RESULT			UFS_BIT(6)

Name is weird, can we name it to reflect the actual purpose of this quirk? something like UFSHCD_QUIRK_BROKEN_UIC_COMPL ?

Okay, I'll change the name with proper one.

Quoted 11 lines

drivers/scsi/ufs/ufshcd.h struct ufs_hba { · line 498

Quoted 3 lines
drivers/scsi/ufs/ufshcd.h +1 -0
+
 	unsigned int quirks;	/* Deviations from standard UFSHCI spec.

*/

Quoted 7 lines
drivers/scsi/ufs/ufshcd.h +0 -0
 	/* Device deviations from standard UFS device spec. */
@@ -853,4 +864,13 @@ static inline void
 ufshcd_vops_dbg_register_dump(struct ufs_hba *hba)
 		hba->vops->dbg_register_dump(hba);
 }
 
Quoted 4 lines

drivers/scsi/ufs/ufshcd.h static inline void ufshcd_vops_dbg_register_dump(struct ufs_hba *hba) · line 867

Quoted 1 line
drivers/scsi/ufs/ufshcd.h +1 -0
+static inline int ufshcd_vops_get_vs_info(struct ufs_hba *hba,

You may name it as *get_uic_coml_info() ?

Same with above.

Quoted 18 lines
Quoted 10 lines
drivers/scsi/ufs/ufshcd.h +8 -0
+					enum vs_opcode op)
+{
+	if (hba->vops && hba->vops->get_vs_info)
+		return hba->vops->get_vs_info(hba, op);
+
+	return -ENOTSUPP;
+}
+

#endif /* End of Header */

--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 104 lines · Kiwoong Kim
Quoted 11 lines
Quoted 11 lines

Some UFS host controllers may not report a result of UIC command completion properly.
In such cases, they should get the result from UIC directly if their architectures support that.

---
 drivers/scsi/ufs/ufshcd.c | 27 +++++++++++++++++++++++----
drivers/scsi/ufs/ufshcd.h | 20 ++++++++++++++++++++
 2 files changed, 43 insertions(+), 4 deletions(-)
Quoted 13 lines

drivers/scsi/ufs/ufshcd.c static inline bool · line 1017

Quoted 13 lines
drivers/scsi/ufs/ufshcd.c +4 -1
index d4a5a9c..8e19631 100644
@@ -1011,7 +1011,10 @@ static inline bool
 ufshcd_ready_for_uic_cmd(struct ufs_hba *hba)
  */
 static inline u8 ufshcd_get_upmcrs(struct ufs_hba *hba)  {
-	return (ufshcd_readl(hba, REG_CONTROLLER_STATUS) >> 8) & 0x7;
+	if (hba->quirks & UFSHCD_QUIRK_GET_VS_RESULT)
+		return (u8)ufshcd_vops_get_vs_info(hba, VS_OP_03);
+	else
+		return (ufshcd_readl(hba, REG_CONTROLLER_STATUS) >> 8) &

0x7;

Quoted 22 lines
Quoted 22 lines
drivers/scsi/ufs/ufshcd.c +11 -0
 }
 
 /**
@@ -1038,6 +1041,17 @@ ufshcd_dispatch_uic_cmd(struct ufs_hba *hba,
 struct uic_command *uic_cmd)
 		      REG_UIC_COMMAND);
 }
 
+static inline enum vs_opcode ufshcd_get_vs_opcode(struct uic_command
 *uic_cmd)
+{
+	if (uic_cmd->command == UIC_CMD_DME_LINK_STARTUP)
+		return VS_OP_00;
+	else if ((uic_cmd->command == UIC_CMD_DME_HIBER_ENTER))
+		return VS_OP_01;
+	else if ((uic_cmd->command == UIC_CMD_DME_HIBER_EXIT))
+		return VS_OP_02;
+	else
+		return VS_OP_INVALID;
+}
 /**

* ufshcd_wait_for_uic_cmd - Wait complectioin of UIC command

Quoted 8 lines

drivers/scsi/ufs/ufshcd.c ufshcd_wait_for_uic_cmd(struct ufs_hba *hba, · line 1068

Quoted 6 lines

* @hba: per adapter instance

drivers/scsi/ufs/ufshcd.c +1 -0
@@ -1051,11 +1065,16 @@ ufshcd_wait_for_uic_cmd(struct ufs_hba *hba,
 struct uic_command *uic_cmd)  {
 	int ret;
 	unsigned long flags;
+	enum vs_opcode vs_op = ufshcd_get_vs_opcode(uic_cmd);

Please move this after we check the quirk below.

Okay, I'll apply what you said.

Quoted 7 lines

drivers/scsi/ufs/ufshcd.c ufshcd_wait_for_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)

Quoted 7 lines
drivers/scsi/ufs/ufshcd.c +1 -3
 	if (wait_for_completion_timeout(&uic_cmd->done,
-					msecs_to_jiffies(UIC_CMD_TIMEOUT)))
-		ret = uic_cmd->argument2 & MASK_UIC_COMMAND_RESULT;
-	else
+					msecs_to_jiffies(UIC_CMD_TIMEOUT)))

{

Quoted 17 lines
Quoted 17 lines
drivers/scsi/ufs/ufshcd.c +6 -0
+		if (hba->quirks & UFSHCD_QUIRK_GET_VS_RESULT &&
+					vs_op != VS_OP_INVALID)
+			ret = ufshcd_vops_get_vs_info(hba, vs_op);
+		else
+			ret = uic_cmd->argument2 & MASK_UIC_COMMAND_RESULT;
+	} else
 		ret = -ETIMEDOUT;
 
 	spin_lock_irqsave(hba->host->host_lock, flags);
drivers/scsi/ufs/ufshcd.h +0 -0
index 13504b4..8cf3991 100644
@@ -245,6 +245,14 @@ struct ufs_pwr_mode_info {
 	struct ufs_pa_layer_attr info;
 };
 
Quoted 12 lines

drivers/scsi/ufs/ufshcd.h struct ufs_pwr_mode_info { · line 255

Quoted 8 lines
drivers/scsi/ufs/ufshcd.h +8 -0
+enum vs_opcode {
+	VS_OP_00 = 0x00,
+	VS_OP_01,
+	VS_OP_02,
+	VS_OP_03,
+	VS_OP_INVALID = 0xFF,
+};
+

How do we interpret these codes? and how is this useful for non-exynos UFS host controller? Please make it generic which can be used by other controllers in future (if required).

As you guessed, this patch is to get some information
by using vendor specific ways directly, which was got from standard UFSHCI SFRs for some hardware problems.

If other controllers have similar problems, but the problems are acutally another cases, you should add the function call - ufshcd_vops_get_vs_info
- wherever you want to use this interface.

Quoted 8 lines

This patch is intended to cover all results of link startup, hibern8 and power mode change. Because I don't want to add an additional interface whenever a new controller has a new problem similar with what I mentioned above.

Anyway, could you give me your opinion about it?
Or, if you don't agree applying something just to fix some simple problems, such as reading SFRs, I won't update this patch any more.

VS_OP_XY is not at all readable and not generic enough. If you can define some generic names for it, we should be ok with this change.

Quoted 62 lines

Thank you.

Quoted 16 lines
Quoted 16 lines
drivers/scsi/ufs/ufshcd.h +1 -0
 /**
  * struct ufs_hba_variant_ops - variant specific callbacks
  * @name: variant name
@@ -297,6 +305,7 @@ struct ufs_hba_variant_ops {
 	int     (*resume)(struct ufs_hba *, enum ufs_pm_op);
 	void	(*dbg_register_dump)(struct ufs_hba *hba);
 	int	(*phy_initialization)(struct ufs_hba *);
+	int	(*get_vs_info)(struct ufs_hba *hba, enum vs_opcode);
 };
 
 /* clock gating state  */
@@ -484,6 +493,8 @@ struct ufs_hba {
 	 */
 	#define UFSHCD_QUIRK_BROKEN_UFS_HCI_VERSION		UFS_BIT(5)
 
Quoted 4 lines

drivers/scsi/ufs/ufshcd.h struct ufs_hba { · line 496

Quoted 1 line
drivers/scsi/ufs/ufshcd.h +1 -0
+	#define UFSHCD_QUIRK_GET_VS_RESULT			UFS_BIT(6)

Name is weird, can we name it to reflect the actual purpose of this quirk? something like UFSHCD_QUIRK_BROKEN_UIC_COMPL ?

Okay, I'll change the name with proper one.

Quoted 11 lines

drivers/scsi/ufs/ufshcd.h struct ufs_hba { · line 498

Quoted 3 lines
drivers/scsi/ufs/ufshcd.h +1 -0
+
 	unsigned int quirks;	/* Deviations from standard UFSHCI spec.

*/

Quoted 7 lines
drivers/scsi/ufs/ufshcd.h +0 -0
 	/* Device deviations from standard UFS device spec. */
@@ -853,4 +864,13 @@ static inline void
 ufshcd_vops_dbg_register_dump(struct ufs_hba *hba)
 		hba->vops->dbg_register_dump(hba);
 }
 
Quoted 4 lines

drivers/scsi/ufs/ufshcd.h static inline void ufshcd_vops_dbg_register_dump(struct ufs_hba *hba) · line 867

Quoted 1 line
drivers/scsi/ufs/ufshcd.h +1 -0
+static inline int ufshcd_vops_get_vs_info(struct ufs_hba *hba,

You may name it as *get_uic_coml_info() ?

Same with above.

Quoted 18 lines
Quoted 10 lines
drivers/scsi/ufs/ufshcd.h +8 -0
+					enum vs_opcode op)
+{
+	if (hba->vops && hba->vops->get_vs_info)
+		return hba->vops->get_vs_info(hba, op);
+
+	return -ENOTSUPP;
+}
+

#endif /* End of Header */

--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project