[RFC PATCH v5 3/3] ufs: exynos: implement dbg_register_dump

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At present, I just add command history print and
you can add various vendor regions.

Signed-off-by: Kiwoong Kim <kwmad.kim@xxxxxxxxxxx>
---
 drivers/scsi/ufs/Kconfig          |  2 +-
 drivers/scsi/ufs/ufs-exynos-dbg.c |  2 --
 drivers/scsi/ufs/ufs-exynos.c     | 14 +++++++++++++-
 drivers/scsi/ufs/ufs-exynos.h     | 10 ++++++++--
 4 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/ufs/Kconfig b/drivers/scsi/ufs/Kconfig
index c946d8f..b906ff8 100644
--- a/drivers/scsi/ufs/Kconfig
+++ b/drivers/scsi/ufs/Kconfig
@@ -181,7 +181,7 @@ config SCSI_UFS_EXYNOS_DBG
 	  This selects EXYNOS specific functions to get and even print
 	  some information to see what's happening at both command
 	  issue time completion time.
-	  The information may contain gerernal things as well as
+	  The information may contain general things as well as
 	  EXYNOS specific, such as vendor specific hardware contexts.
 
 	  Select this if you want to get and print the information.
diff --git a/drivers/scsi/ufs/ufs-exynos-dbg.c b/drivers/scsi/ufs/ufs-exynos-dbg.c
index a626b71..7fd7308 100644
--- a/drivers/scsi/ufs/ufs-exynos-dbg.c
+++ b/drivers/scsi/ufs/ufs-exynos-dbg.c
@@ -121,9 +121,7 @@ void exynos_ufs_dump_info(struct ufs_exynos_handle *handle, struct device *dev)
 
 	mgr->time = cpu_clock(raw_smp_processor_id());
 
-#ifdef CONFIG_SCSI_UFS_EXYNOS_CMD_LOG
 	ufs_s_print_cmd_log(mgr, dev);
-#endif
 
 	if (mgr->first_time == 0ULL)
 		mgr->first_time = mgr->time;
diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c
index 53b9d6e..444aba1 100644
--- a/drivers/scsi/ufs/ufs-exynos.c
+++ b/drivers/scsi/ufs/ufs-exynos.c
@@ -1033,7 +1033,6 @@ static int exynos_ufs_init(struct ufs_hba *hba)
 	ret = exynos_ufs_init_dbg(&ufs->handle, dev);
 	if (ret)
 		return ret;
-	spin_lock_init(&ufs->dbg_lock);
 	return 0;
 
 phy_off:
@@ -1236,6 +1235,18 @@ static int exynos_ufs_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
 	return 0;
 }
 
+static void exynos_ufs_dbg_register_dump(struct ufs_hba *hba)
+{
+	struct exynos_ufs *ufs = ufshcd_get_variant(hba);
+
+	if (!test_and_set_bit(EXYNOS_UFS_DBG_DUMP_CXT, &ufs->dbg_flag)) {
+		exynos_ufs_dump_info(&ufs->handle, hba->dev);
+		clear_bit(EXYNOS_UFS_DBG_DUMP_CXT, &ufs->dbg_flag);
+	}
+out:
+	return;
+}
+
 static struct ufs_hba_variant_ops ufs_hba_exynos_ops = {
 	.name				= "exynos_ufs",
 	.init				= exynos_ufs_init,
@@ -1248,6 +1259,7 @@ static struct ufs_hba_variant_ops ufs_hba_exynos_ops = {
 	.hibern8_notify			= exynos_ufs_hibern8_notify,
 	.suspend			= exynos_ufs_suspend,
 	.resume				= exynos_ufs_resume,
+	.dbg_register_dump		= exynos_ufs_dbg_register_dump,
 };
 
 static int exynos_ufs_probe(struct platform_device *pdev)
diff --git a/drivers/scsi/ufs/ufs-exynos.h b/drivers/scsi/ufs/ufs-exynos.h
index b9cb517..3f242de 100644
--- a/drivers/scsi/ufs/ufs-exynos.h
+++ b/drivers/scsi/ufs/ufs-exynos.h
@@ -215,8 +215,8 @@ struct exynos_ufs {
 #define EXYNOS_UFS_OPT_USE_SW_HIBERN8_TIMER	BIT(4)
 
 	struct ufs_exynos_handle handle;
-	spinlock_t dbg_lock;
-	int under_dump;
+	unsigned long dbg_flag;
+#define EXYNOS_UFS_DBG_DUMP_CXT			BIT(0)
 };
 
 #define for_each_ufs_rx_lane(ufs, i) \
@@ -297,6 +297,7 @@ void exynos_ufs_cmd_log_start(struct ufs_exynos_handle *handle,
 void exynos_ufs_cmd_log_end(struct ufs_exynos_handle *handle,
 			    struct ufs_hba *hba, int tag);
 int exynos_ufs_init_dbg(struct ufs_exynos_handle *handle, struct device *dev);
+void exynos_ufs_dump_info(struct ufs_exynos_handle *handle, struct device *dev);
 #else
 void exynos_ufs_cmd_log_start(struct ufs_exynos_handle *handle,
 			      struct ufs_hba *hba, int tag)
@@ -312,5 +313,10 @@ int exynos_ufs_init_dbg(struct ufs_exynos_handle *handle, struct device *dev)
 {
 	return 0;
 }
+
+void exynos_ufs_dump_info(struct ufs_exynos_handle *handle, struct device *dev)
+{
+	return 0;
+}
 #endif
 #endif /* _UFS_EXYNOS_H_ */
-- 
2.7.4




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux