2020-12-04 09:54:46

by Stanley Chu

[permalink] [raw]
Subject: [PATCH v3 0/8] Refine error history and introduce event_notify vop

Hi,
This series refines error history functions, do vop cleanups and introduce a new event_notify vop to allow vendor to get notification of important events.

Changes since v2:
- Add patches for vop cleanups
- Introduce phy_initialization helper and replace direct invoking in ufs-cdns and ufs-dwc drivers/scsi/ufs/cdns-pltfrm
- Introduce event_notify vop implemntation in ufs-mediatek

Changes since v1:
- Change notify_event() to event_notify() to follow vop naming covention

Stanley Chu (8):
scsi: ufs: Remove unused setup_regulators variant function
scsi: ufs: Introduce phy_initialization helper
scsi: ufs-cdns: Use phy_initialization helper
scsi: ufs-dwc: Use phy_initialization helper
scsi: ufs: Add error history for abort event in UFS Device W-LUN
scsi: ufs: Refine error history functions
scsi: ufs: Introduce event_notify variant function
scsi: ufs-mediatek: Introduce event_notify implementation

drivers/scsi/ufs/cdns-pltfrm.c | 3 +-
drivers/scsi/ufs/ufs-mediatek-trace.h | 37 ++++++++
drivers/scsi/ufs/ufs-mediatek.c | 10 ++
drivers/scsi/ufs/ufshcd-dwc.c | 11 +--
drivers/scsi/ufs/ufshcd.c | 132 ++++++++++++++------------
drivers/scsi/ufs/ufshcd.h | 100 +++++++++----------
6 files changed, 173 insertions(+), 120 deletions(-)
create mode 100644 drivers/scsi/ufs/ufs-mediatek-trace.h

--
2.18.0


2020-12-04 09:54:53

by Stanley Chu

[permalink] [raw]
Subject: [PATCH v3 3/8] scsi: ufs-cdns: Use phy_initialization helper

Use phy_initialization helper instead of direct function invoking.

Signed-off-by: Stanley Chu <[email protected]>
---
drivers/scsi/ufs/cdns-pltfrm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/ufs/cdns-pltfrm.c b/drivers/scsi/ufs/cdns-pltfrm.c
index da065a259f6e..149391faa19c 100644
--- a/drivers/scsi/ufs/cdns-pltfrm.c
+++ b/drivers/scsi/ufs/cdns-pltfrm.c
@@ -221,8 +221,7 @@ static int cdns_ufs_init(struct ufs_hba *hba)
return -ENOMEM;
ufshcd_set_variant(hba, host);

- if (hba->vops && hba->vops->phy_initialization)
- status = hba->vops->phy_initialization(hba);
+ status = ufshcd_vops_phy_initialization(hba);

return status;
}
--
2.18.0

2020-12-04 09:55:12

by Stanley Chu

[permalink] [raw]
Subject: [PATCH v3 1/8] scsi: ufs: Remove unused setup_regulators variant function

Since setup_regulators variant function is not used by any
vendors, simply remove it.

Signed-off-by: Stanley Chu <[email protected]>
---
drivers/scsi/ufs/ufshcd.c | 10 +---------
drivers/scsi/ufs/ufshcd.h | 10 ----------
2 files changed, 1 insertion(+), 19 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 11a4aad09f3a..c2f611516ea7 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -8171,16 +8171,10 @@ static int ufshcd_variant_hba_init(struct ufs_hba *hba)
goto out;

err = ufshcd_vops_init(hba);
- if (err)
- goto out;
-
- err = ufshcd_vops_setup_regulators(hba, true);
- if (err)
- ufshcd_vops_exit(hba);
-out:
if (err)
dev_err(hba->dev, "%s: variant %s init failed err %d\n",
__func__, ufshcd_get_var_name(hba), err);
+out:
return err;
}

@@ -8189,8 +8183,6 @@ static void ufshcd_variant_hba_exit(struct ufs_hba *hba)
if (!hba->vops)
return;

- ufshcd_vops_setup_regulators(hba, false);
-
ufshcd_vops_exit(hba);
}

diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 7a7e056a33a9..21de7607611f 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -277,7 +277,6 @@ struct ufs_pwr_mode_info {
* @get_ufs_hci_version: called to get UFS HCI version
* @clk_scale_notify: notifies that clks are scaled up/down
* @setup_clocks: called before touching any of the controller registers
- * @setup_regulators: called before accessing the host controller
* @hce_enable_notify: called before and after HCE enable bit is set to allow
* variant specific Uni-Pro initialization.
* @link_startup_notify: called before and after Link startup is carried out
@@ -307,7 +306,6 @@ struct ufs_hba_variant_ops {
enum ufs_notify_change_status);
int (*setup_clocks)(struct ufs_hba *, bool,
enum ufs_notify_change_status);
- int (*setup_regulators)(struct ufs_hba *, bool);
int (*hce_enable_notify)(struct ufs_hba *,
enum ufs_notify_change_status);
int (*link_startup_notify)(struct ufs_hba *,
@@ -1119,14 +1117,6 @@ static inline int ufshcd_vops_setup_clocks(struct ufs_hba *hba, bool on,
return 0;
}

-static inline int ufshcd_vops_setup_regulators(struct ufs_hba *hba, bool status)
-{
- if (hba->vops && hba->vops->setup_regulators)
- return hba->vops->setup_regulators(hba, status);
-
- return 0;
-}
-
static inline int ufshcd_vops_hce_enable_notify(struct ufs_hba *hba,
bool status)
{
--
2.18.0