diff mbox series

[v3,13/17] scsi: ufs: ufs-exynos: add pre/post_hce_enable drv callbacks

Message ID 20210917065436.145629-14-chanho61.park@samsung.com (mailing list archive)
State Superseded
Headers show
Series [v3,01/17] scsi: ufs: add quirk to handle broken UIC command | expand

Commit Message

Chanho Park Sept. 17, 2021, 6:54 a.m. UTC
This patch adds driver-specific pre/post_hce_enable callbacks to execute
extra initializations before and after hce_enable_notify callback.

Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: Kiwoong Kim <kwmad.kim@samsung.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
---
 drivers/scsi/ufs/ufs-exynos.c | 10 ++++++++++
 drivers/scsi/ufs/ufs-exynos.h |  2 ++
 2 files changed, 12 insertions(+)

Comments

Alim Akhtar Sept. 23, 2021, 4:51 a.m. UTC | #1
Hi Chanho

>-----Original Message-----
>From: Chanho Park [mailto:chanho61.park@samsung.com]
>Sent: Friday, September 17, 2021 12:25 PM
>To: Alim Akhtar <alim.akhtar@samsung.com>; Avri Altman
><avri.altman@wdc.com>; James E . J . Bottomley <jejb@linux.ibm.com>; Martin
>K . Petersen <martin.petersen@oracle.com>; Krzysztof Kozlowski
><krzysztof.kozlowski@canonical.com>
>Cc: Bean Huo <beanhuo@micron.com>; Bart Van Assche
><bvanassche@acm.org>; Adrian Hunter <adrian.hunter@intel.com>; Christoph
>Hellwig <hch@infradead.org>; Can Guo <cang@codeaurora.org>; Jaegeuk Kim
><jaegeuk@kernel.org>; Gyunghoon Kwon <goodjob.kwon@samsung.com>;
>linux-samsung-soc@vger.kernel.org; linux-scsi@vger.kernel.org; Chanho Park
><chanho61.park@samsung.com>; Kiwoong Kim <kwmad.kim@samsung.com>
>Subject: [PATCH v3 13/17] scsi: ufs: ufs-exynos: add pre/post_hce_enable drv
>callbacks
>
>This patch adds driver-specific pre/post_hce_enable callbacks to execute extra
>initializations before and after hce_enable_notify callback.
>
>Cc: Alim Akhtar <alim.akhtar@samsung.com>
>Cc: Kiwoong Kim <kwmad.kim@samsung.com>
>Cc: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
>Signed-off-by: Chanho Park <chanho61.park@samsung.com>
>---

Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>


> drivers/scsi/ufs/ufs-exynos.c | 10 ++++++++++  drivers/scsi/ufs/ufs-exynos.h |  2
>++
> 2 files changed, 12 insertions(+)
>
>diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c index
>753b22358186..7fb4514f700d 100644
>--- a/drivers/scsi/ufs/ufs-exynos.c
>+++ b/drivers/scsi/ufs/ufs-exynos.c
>@@ -1141,6 +1141,12 @@ static int exynos_ufs_hce_enable_notify(struct
>ufs_hba *hba,
>
> 	switch (status) {
> 	case PRE_CHANGE:
>+		if (ufs->drv_data->pre_hce_enable) {
>+			ret = ufs->drv_data->pre_hce_enable(ufs);
>+			if (ret)
>+				return ret;
>+		}
>+
> 		ret = exynos_ufs_host_reset(hba);
> 		if (ret)
> 			return ret;
>@@ -1150,6 +1156,10 @@ static int exynos_ufs_hce_enable_notify(struct
>ufs_hba *hba,
> 		exynos_ufs_calc_pwm_clk_div(ufs);
> 		if (!(ufs->opts & EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL))
> 			exynos_ufs_enable_auto_ctrl_hcc(ufs);
>+
>+		if (ufs->drv_data->post_hce_enable)
>+			ret = ufs->drv_data->post_hce_enable(ufs);
>+
> 		break;
> 	}
>
>diff --git a/drivers/scsi/ufs/ufs-exynos.h b/drivers/scsi/ufs/ufs-exynos.h index
>a0899aaa902e..c291ae51dd41 100644
>--- a/drivers/scsi/ufs/ufs-exynos.h
>+++ b/drivers/scsi/ufs/ufs-exynos.h
>@@ -154,6 +154,8 @@ struct exynos_ufs_drv_data {
> 				struct ufs_pa_layer_attr *pwr);
> 	int (*post_pwr_change)(struct exynos_ufs *ufs,
> 				struct ufs_pa_layer_attr *pwr);
>+	int (*pre_hce_enable)(struct exynos_ufs *ufs);
>+	int (*post_hce_enable)(struct exynos_ufs *ufs);
> };
>
> struct ufs_phy_time_cfg {
>--
>2.33.0
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c
index 753b22358186..7fb4514f700d 100644
--- a/drivers/scsi/ufs/ufs-exynos.c
+++ b/drivers/scsi/ufs/ufs-exynos.c
@@ -1141,6 +1141,12 @@  static int exynos_ufs_hce_enable_notify(struct ufs_hba *hba,
 
 	switch (status) {
 	case PRE_CHANGE:
+		if (ufs->drv_data->pre_hce_enable) {
+			ret = ufs->drv_data->pre_hce_enable(ufs);
+			if (ret)
+				return ret;
+		}
+
 		ret = exynos_ufs_host_reset(hba);
 		if (ret)
 			return ret;
@@ -1150,6 +1156,10 @@  static int exynos_ufs_hce_enable_notify(struct ufs_hba *hba,
 		exynos_ufs_calc_pwm_clk_div(ufs);
 		if (!(ufs->opts & EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL))
 			exynos_ufs_enable_auto_ctrl_hcc(ufs);
+
+		if (ufs->drv_data->post_hce_enable)
+			ret = ufs->drv_data->post_hce_enable(ufs);
+
 		break;
 	}
 
diff --git a/drivers/scsi/ufs/ufs-exynos.h b/drivers/scsi/ufs/ufs-exynos.h
index a0899aaa902e..c291ae51dd41 100644
--- a/drivers/scsi/ufs/ufs-exynos.h
+++ b/drivers/scsi/ufs/ufs-exynos.h
@@ -154,6 +154,8 @@  struct exynos_ufs_drv_data {
 				struct ufs_pa_layer_attr *pwr);
 	int (*post_pwr_change)(struct exynos_ufs *ufs,
 				struct ufs_pa_layer_attr *pwr);
+	int (*pre_hce_enable)(struct exynos_ufs *ufs);
+	int (*post_hce_enable)(struct exynos_ufs *ufs);
 };
 
 struct ufs_phy_time_cfg {