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.
Signed-off-by: Stanley Chu <[email protected]>
---
drivers/scsi/ufs/ufshcd.c | 1 +
drivers/scsi/ufs/ufshcd.h | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 04ddfb15e858..da7b375709b6 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6899,6 +6899,7 @@ static int ufs_get_device_desc(struct ufs_hba *hba)
}
ufs_fixup_device_setup(hba);
+ ufshcd_vops_fixup_dev_quirks(hba);
/*
* Probe WB only for UFS-3.1 devices or UFS devices with quirk
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 056537e52c19..5fa03e0f3bd1 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -336,6 +336,7 @@ struct ufs_hba_variant_ops {
void (*hibern8_notify)(struct ufs_hba *, enum uic_cmd_dme,
enum ufs_notify_change_status);
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 (*resume)(struct ufs_hba *, enum ufs_pm_op);
void (*dbg_register_dump)(struct ufs_hba *hba);
@@ -1085,6 +1086,12 @@ static inline int ufshcd_vops_apply_dev_quirks(struct ufs_hba *hba)
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)
{
if (hba->vops && hba->vops->suspend)
--
2.18.0
>
> ufs_fixup_device_setup(hba);
> + ufshcd_vops_fixup_dev_quirks(hba);
Maybe call your new ufshcd_vops_fixup_dev_quirks as part of ufs_fixup_device_setup.
Thanks,
Avri
Hi Avri,
On Mon, 2020-05-04 at 10:38 +0000, Avri Altman wrote:
> >
> > ufs_fixup_device_setup(hba);
> > + ufshcd_vops_fixup_dev_quirks(hba);
> Maybe call your new ufshcd_vops_fixup_dev_quirks as part of ufs_fixup_device_setup
The latter patch exports ufs_fixup_device_setup() for vendors to re-use
it to parse vendor-specific device quirk table during the call of
ufshcd_vops_fixup_dev_quirks(), thus ufshcd_vops_fixup_dev_quirks()
cannot be as part of ufs_fixup_device_setup().
Thanks,
Stanley Chu
> .
>
> Thanks,
> Avri