提交 c28c00ba 编写于 作者: S Stanley Chu 提交者: Martin K. Petersen

scsi: ufs: Introduce fixup_dev_quirks vops

Some UFS deivces may have required device quirks or have non-standard
features which are enabled only on specified UFS hosts or for special
customers.

To not "pollute" common device quirk list, i.e. ufs_fixups table, for those
devices mentioned above, introduce "fixup_dev_quirks" vops to allow vendors
to fix or modify device quirks accordingly.

Link: https://lore.kernel.org/r/20200508080115.24233-3-stanley.chu@mediatek.comReviewed-by: NAvri Altman <avri.altman@wdc.com>
Reviewed-by: NAsutosh Das <asutoshd@codeaurora.org>
Signed-off-by: NStanley Chu <stanley.chu@mediatek.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 817d7e14
...@@ -6838,7 +6838,7 @@ static void ufshcd_wb_probe(struct ufs_hba *hba, u8 *desc_buf) ...@@ -6838,7 +6838,7 @@ static void ufshcd_wb_probe(struct ufs_hba *hba, u8 *desc_buf)
hba->caps &= ~UFSHCD_CAP_WB_EN; hba->caps &= ~UFSHCD_CAP_WB_EN;
} }
static void ufs_fixup_device_setup(struct ufs_hba *hba) static void ufshcd_fixup_dev_quirks(struct ufs_hba *hba)
{ {
struct ufs_dev_fix *f; struct ufs_dev_fix *f;
struct ufs_dev_info *dev_info = &hba->dev_info; struct ufs_dev_info *dev_info = &hba->dev_info;
...@@ -6853,6 +6853,15 @@ static void ufs_fixup_device_setup(struct ufs_hba *hba) ...@@ -6853,6 +6853,15 @@ static void ufs_fixup_device_setup(struct ufs_hba *hba)
} }
} }
static void ufs_fixup_device_setup(struct ufs_hba *hba)
{
/* fix by general quirk table */
ufshcd_fixup_dev_quirks(hba);
/* allow vendors to fix quirks */
ufshcd_vops_fixup_dev_quirks(hba);
}
static int ufs_get_device_desc(struct ufs_hba *hba) static int ufs_get_device_desc(struct ufs_hba *hba)
{ {
int err; int err;
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
#include <scsi/scsi_eh.h> #include <scsi/scsi_eh.h>
#include "ufs.h" #include "ufs.h"
#include "ufs_quirks.h"
#include "ufshci.h" #include "ufshci.h"
#define UFSHCD "ufshcd" #define UFSHCD "ufshcd"
...@@ -336,6 +337,7 @@ struct ufs_hba_variant_ops { ...@@ -336,6 +337,7 @@ struct ufs_hba_variant_ops {
void (*hibern8_notify)(struct ufs_hba *, enum uic_cmd_dme, void (*hibern8_notify)(struct ufs_hba *, enum uic_cmd_dme,
enum ufs_notify_change_status); enum ufs_notify_change_status);
int (*apply_dev_quirks)(struct ufs_hba *hba); int (*apply_dev_quirks)(struct ufs_hba *hba);
void (*fixup_dev_quirks)(struct ufs_hba *hba);
int (*suspend)(struct ufs_hba *, enum ufs_pm_op); int (*suspend)(struct ufs_hba *, enum ufs_pm_op);
int (*resume)(struct ufs_hba *, enum ufs_pm_op); int (*resume)(struct ufs_hba *, enum ufs_pm_op);
void (*dbg_register_dump)(struct ufs_hba *hba); void (*dbg_register_dump)(struct ufs_hba *hba);
...@@ -950,7 +952,6 @@ int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode, ...@@ -950,7 +952,6 @@ int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode,
void ufshcd_auto_hibern8_enable(struct ufs_hba *hba); void ufshcd_auto_hibern8_enable(struct ufs_hba *hba);
void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit); void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit);
#define SD_ASCII_STD true #define SD_ASCII_STD true
#define SD_RAW false #define SD_RAW false
int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index, int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index,
...@@ -1085,6 +1086,12 @@ static inline int ufshcd_vops_apply_dev_quirks(struct ufs_hba *hba) ...@@ -1085,6 +1086,12 @@ static inline int ufshcd_vops_apply_dev_quirks(struct ufs_hba *hba)
return 0; return 0;
} }
static inline void ufshcd_vops_fixup_dev_quirks(struct ufs_hba *hba)
{
if (hba->vops && hba->vops->fixup_dev_quirks)
hba->vops->fixup_dev_quirks(hba);
}
static inline int ufshcd_vops_suspend(struct ufs_hba *hba, enum ufs_pm_op op) static inline int ufshcd_vops_suspend(struct ufs_hba *hba, enum ufs_pm_op op)
{ {
if (hba->vops && hba->vops->suspend) if (hba->vops && hba->vops->suspend)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册