Currently UFS driver has "global" device quirk scheme to allow driver applying
special handling for certain UFS devive models.
However some special device handlings are required for specific UFS hosts only
so it is better to make it happen in vendor's callbacks only to not "pollute"
common driver and common device quirks.
We already have apply_dev_quirks variant callback for vendors but lack of device
information for handling specific UFS device models. This series provides such
information to apply_dev_quirks callbacks, and applies related modifications.
Stanley Chu (3):
scsi: ufs: pass device information to apply_dev_quirks
scsi: ufs-qcom: modify apply_dev_quirks interface
scsi: ufs-mediatek: add apply_dev_quirks variant operation
drivers/scsi/ufs/ufs-mediatek.c | 11 +++++++++++
drivers/scsi/ufs/ufs-qcom.c | 3 ++-
drivers/scsi/ufs/ufshcd.c | 5 +++--
drivers/scsi/ufs/ufshcd.h | 7 ++++---
4 files changed, 20 insertions(+), 6 deletions(-)
--
2.18.0
Modify interface according to the change of vendor-specific
variant callback "apply_dev_quirks".
Cc: Alim Akhtar <[email protected]>
Cc: Asutosh Das <[email protected]>
Cc: Avri Altman <[email protected]>
Cc: Bart Van Assche <[email protected]>
Cc: Bean Huo <[email protected]>
Cc: Can Guo <[email protected]>
Cc: Matthias Brugger <[email protected]>
Signed-off-by: Stanley Chu <[email protected]>
---
drivers/scsi/ufs/ufs-qcom.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index c69c29a1ceb9..ebb5c66e069f 100644
--- a/drivers/scsi/ufs/ufs-qcom.c
+++ b/drivers/scsi/ufs/ufs-qcom.c
@@ -949,7 +949,8 @@ static int ufs_qcom_quirk_host_pa_saveconfigtime(struct ufs_hba *hba)
return err;
}
-static int ufs_qcom_apply_dev_quirks(struct ufs_hba *hba)
+static int ufs_qcom_apply_dev_quirks(struct ufs_hba *hba,
+ struct ufs_dev_desc *card)
{
int err = 0;
--
2.18.0
Pass UFS device information to vendor-specific variant callback
"apply_dev_quirks" because some platform vendors need to know such
information to apply special handlings or quirks in specific devices.
Cc: Alim Akhtar <[email protected]>
Cc: Asutosh Das <[email protected]>
Cc: Avri Altman <[email protected]>
Cc: Bart Van Assche <[email protected]>
Cc: Bean Huo <[email protected]>
Cc: Can Guo <[email protected]>
Cc: Matthias Brugger <[email protected]>
Signed-off-by: Stanley Chu <[email protected]>
---
drivers/scsi/ufs/ufshcd.c | 5 +++--
drivers/scsi/ufs/ufshcd.h | 7 ++++---
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 1b97f2dc0b63..9abf0ea8c308 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6803,7 +6803,8 @@ static int ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba)
return ret;
}
-static void ufshcd_tune_unipro_params(struct ufs_hba *hba)
+static void ufshcd_tune_unipro_params(struct ufs_hba *hba,
+ struct ufs_dev_desc *card)
{
if (ufshcd_is_unipro_pa_params_tuning_req(hba)) {
ufshcd_tune_pa_tactivate(hba);
@@ -6817,7 +6818,7 @@ static void ufshcd_tune_unipro_params(struct ufs_hba *hba)
if (hba->dev_quirks & UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE)
ufshcd_quirk_tune_host_pa_tactivate(hba);
- ufshcd_vops_apply_dev_quirks(hba);
+ ufshcd_vops_apply_dev_quirks(hba, card);
}
static void ufshcd_clear_dbg_ufs_stats(struct ufs_hba *hba)
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index e05cafddc87b..4f3fa71303da 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -320,7 +320,7 @@ struct ufs_hba_variant_ops {
void (*setup_task_mgmt)(struct ufs_hba *, int, u8);
void (*hibern8_notify)(struct ufs_hba *, enum uic_cmd_dme,
enum ufs_notify_change_status);
- int (*apply_dev_quirks)(struct ufs_hba *);
+ int (*apply_dev_quirks)(struct ufs_hba *, struct ufs_dev_desc *);
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);
@@ -1052,10 +1052,11 @@ static inline void ufshcd_vops_hibern8_notify(struct ufs_hba *hba,
return hba->vops->hibern8_notify(hba, cmd, status);
}
-static inline int ufshcd_vops_apply_dev_quirks(struct ufs_hba *hba)
+static inline int ufshcd_vops_apply_dev_quirks(struct ufs_hba *hba,
+ struct ufs_dev_desc *card)
{
if (hba->vops && hba->vops->apply_dev_quirks)
- return hba->vops->apply_dev_quirks(hba);
+ return hba->vops->apply_dev_quirks(hba, card);
return 0;
}
--
2.18.0
You have to squash patch 1 & 2, otherwise your patch 1 won't compile.
Other than that: looks good to me.
Thanks,
Avri
________________________________________
From: Stanley Chu <[email protected]>
Sent: Sunday, January 5, 2020 6:55:15 AM
To: [email protected]; [email protected]; Avri Altman; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Stanley Chu
Subject: [PATCH v1 0/3] scsi: ufs: pass device information to apply_dev_quirks
CAUTION: This email originated from outside of Western Digital. Do not click on links or open attachments unless you recognize the sender and know that the content is safe.
Currently UFS driver has "global" device quirk scheme to allow driver applying
special handling for certain UFS devive models.
However some special device handlings are required for specific UFS hosts only
so it is better to make it happen in vendor's callbacks only to not "pollute"
common driver and common device quirks.
We already have apply_dev_quirks variant callback for vendors but lack of device
information for handling specific UFS device models. This series provides such
information to apply_dev_quirks callbacks, and applies related modifications.
Stanley Chu (3):
scsi: ufs: pass device information to apply_dev_quirks
scsi: ufs-qcom: modify apply_dev_quirks interface
scsi: ufs-mediatek: add apply_dev_quirks variant operation
drivers/scsi/ufs/ufs-mediatek.c | 11 +++++++++++
drivers/scsi/ufs/ufs-qcom.c | 3 ++-
drivers/scsi/ufs/ufshcd.c | 5 +++--
drivers/scsi/ufs/ufshcd.h | 7 ++++---
4 files changed, 20 insertions(+), 6 deletions(-)
--
2.18.0
Hi Avri,
On Sun, 2020-01-05 at 05:51 +0000, Avri Altman wrote:
> You have to squash patch 1 & 2, otherwise your patch 1 won't compile.
> Other than that: looks good to me.
> Thanks,
> Avri
Sorry because I sent 2 series in these two days.
Would you mean patch 1 is series: "scsi: ufs: fix error history and
complete device reset history" and patch 2 is series "scsi: ufs: pass
device information to apply_dev_quirks"?
Or patch 1 & 2 mean the first 2 commits in this series: "scsi: ufs: pass
device information to apply_dev_quirks"?
Thanks a lot.
Stanley
> Hi Avri,
>
> On Sun, 2020-01-05 at 05:51 +0000, Avri Altman wrote:
> > You have to squash patch 1 & 2, otherwise your patch 1 won't compile.
> > Other than that: looks good to me.
> > Thanks,
> > Avri
>
> Sorry because I sent 2 series in these two days.
>
> Would you mean patch 1 is series: "scsi: ufs: fix error history and complete
> device reset history" and patch 2 is series "scsi: ufs: pass device information to
> apply_dev_quirks"?
>
> Or patch 1 & 2 mean the first 2 commits in this series: "scsi: ufs: pass device
> information to apply_dev_quirks"?
This one.
>
> Thanks a lot.
> Stanley
Hi Avri,
On Sun, 2020-01-05 at 16:40 +0000, Avri Altman wrote:
> > Hi Avri,
> >
> > On Sun, 2020-01-05 at 05:51 +0000, Avri Altman wrote:
> > > You have to squash patch 1 & 2, otherwise your patch 1 won't compile.
> > > Other than that: looks good to me.
> > > Thanks,
> > > Avri
> >
> > Sorry because I sent 2 series in these two days.
> >
> > Would you mean patch 1 is series: "scsi: ufs: fix error history and complete
> > device reset history" and patch 2 is series "scsi: ufs: pass device information to
> > apply_dev_quirks"?
> >
> > Or patch 1 & 2 mean the first 2 commits in this series: "scsi: ufs: pass device
> > information to apply_dev_quirks"?
> This one.
OK! I will send the updated v2.
>
> >
> > Thanks a lot.
> > Stanley
Thanks,
Stanley