* [PATCH] scsi: ufs: Additional clock initialization in Cadence UFS
@ 2019-07-31 8:36 ` Anil Varughese
0 siblings, 0 replies; 6+ messages in thread
From: Anil Varughese @ 2019-07-31 8:36 UTC (permalink / raw)
To: alim.akhtar, avri.altman, pedrom.sousa
Cc: jejb, martin.petersen, hare, aniljoy, rafalc, mparab, jank,
vigneshr, linux-scsi, linux-kernel
Configure CDNS_UFS_REG_HCLKDIV in .hce_enable_notify()
because if UFSHCD resets the controller ip because of
phy or device related errors then CDNS_UFS_REG_HCLKDIV
is reset to default value and .setup_clock() is not
called later in the sequence whereas hce_enable_notify
will be called everytime controller is reenabled.
Signed-off-by: Anil Varughese <aniljoy@cadence.com>
---
drivers/scsi/ufs/cdns-pltfrm.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/scsi/ufs/cdns-pltfrm.c b/drivers/scsi/ufs/cdns-pltfrm.c
index 86dbb723f..15ee54d28 100644
--- a/drivers/scsi/ufs/cdns-pltfrm.c
+++ b/drivers/scsi/ufs/cdns-pltfrm.c
@@ -78,6 +78,22 @@ static int cdns_ufs_setup_clocks(struct ufs_hba *hba, bool on,
return cdns_ufs_set_hclkdiv(hba);
}
+/**
+ * Called before and after HCE enable bit is set.
+ * @hba: host controller instance
+ * @status: notify stage (pre, post change)
+ *
+ * Return zero for success and non-zero for failure
+ */
+static int cdns_ufs_hce_enable_notify(struct ufs_hba *hba,
+ enum ufs_notify_change_status status)
+{
+ if (status != PRE_CHANGE)
+ return 0;
+
+ return cdns_ufs_set_hclkdiv(hba);
+}
+
/**
* cdns_ufs_init - performs additional ufs initialization
* @hba: host controller instance
@@ -115,12 +131,14 @@ static int cdns_ufs_m31_16nm_phy_initialization(struct ufs_hba *hba)
static const struct ufs_hba_variant_ops cdns_ufs_pltfm_hba_vops = {
.name = "cdns-ufs-pltfm",
.setup_clocks = cdns_ufs_setup_clocks,
+ .hce_enable_notify = cdns_ufs_hce_enable_notify,
};
static const struct ufs_hba_variant_ops cdns_ufs_m31_16nm_pltfm_hba_vops = {
.name = "cdns-ufs-pltfm",
.init = cdns_ufs_init,
.setup_clocks = cdns_ufs_setup_clocks,
+ .hce_enable_notify = cdns_ufs_hce_enable_notify,
.phy_initialization = cdns_ufs_m31_16nm_phy_initialization,
};
--
2.15.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] scsi: ufs: Additional clock initialization in Cadence UFS
@ 2019-07-31 8:36 ` Anil Varughese
0 siblings, 0 replies; 6+ messages in thread
From: Anil Varughese @ 2019-07-31 8:36 UTC (permalink / raw)
To: alim.akhtar, avri.altman, pedrom.sousa
Cc: jejb, martin.petersen, hare, aniljoy, rafalc, mparab, jank,
vigneshr, linux-scsi, linux-kernel
Configure CDNS_UFS_REG_HCLKDIV in .hce_enable_notify()
because if UFSHCD resets the controller ip because of
phy or device related errors then CDNS_UFS_REG_HCLKDIV
is reset to default value and .setup_clock() is not
called later in the sequence whereas hce_enable_notify
will be called everytime controller is reenabled.
Signed-off-by: Anil Varughese <aniljoy@cadence.com>
---
drivers/scsi/ufs/cdns-pltfrm.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/scsi/ufs/cdns-pltfrm.c b/drivers/scsi/ufs/cdns-pltfrm.c
index 86dbb723f..15ee54d28 100644
--- a/drivers/scsi/ufs/cdns-pltfrm.c
+++ b/drivers/scsi/ufs/cdns-pltfrm.c
@@ -78,6 +78,22 @@ static int cdns_ufs_setup_clocks(struct ufs_hba *hba, bool on,
return cdns_ufs_set_hclkdiv(hba);
}
+/**
+ * Called before and after HCE enable bit is set.
+ * @hba: host controller instance
+ * @status: notify stage (pre, post change)
+ *
+ * Return zero for success and non-zero for failure
+ */
+static int cdns_ufs_hce_enable_notify(struct ufs_hba *hba,
+ enum ufs_notify_change_status status)
+{
+ if (status != PRE_CHANGE)
+ return 0;
+
+ return cdns_ufs_set_hclkdiv(hba);
+}
+
/**
* cdns_ufs_init - performs additional ufs initialization
* @hba: host controller instance
@@ -115,12 +131,14 @@ static int cdns_ufs_m31_16nm_phy_initialization(struct ufs_hba *hba)
static const struct ufs_hba_variant_ops cdns_ufs_pltfm_hba_vops = {
.name = "cdns-ufs-pltfm",
.setup_clocks = cdns_ufs_setup_clocks,
+ .hce_enable_notify = cdns_ufs_hce_enable_notify,
};
static const struct ufs_hba_variant_ops cdns_ufs_m31_16nm_pltfm_hba_vops = {
.name = "cdns-ufs-pltfm",
.init = cdns_ufs_init,
.setup_clocks = cdns_ufs_setup_clocks,
+ .hce_enable_notify = cdns_ufs_hce_enable_notify,
.phy_initialization = cdns_ufs_m31_16nm_phy_initialization,
};
--
2.15.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: [PATCH] scsi: ufs: Additional clock initialization in Cadence UFS
2019-07-31 8:36 ` Anil Varughese
(?)
@ 2019-07-31 10:09 ` Avri Altman
-1 siblings, 0 replies; 6+ messages in thread
From: Avri Altman @ 2019-07-31 10:09 UTC (permalink / raw)
To: Anil Varughese, alim.akhtar, pedrom.sousa
Cc: jejb, martin.petersen, hare, rafalc, mparab, jank, vigneshr,
linux-scsi, linux-kernel
>
> Configure CDNS_UFS_REG_HCLKDIV in .hce_enable_notify()
> because if UFSHCD resets the controller ip because of
> phy or device related errors then CDNS_UFS_REG_HCLKDIV
> is reset to default value and .setup_clock() is not
> called later in the sequence whereas hce_enable_notify
> will be called everytime controller is reenabled.
>
> Signed-off-by: Anil Varughese <aniljoy@cadence.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: ufs: Additional clock initialization in Cadence UFS
2019-07-31 8:36 ` Anil Varughese
@ 2019-07-31 16:35 ` Vignesh Raghavendra
-1 siblings, 0 replies; 6+ messages in thread
From: Vignesh Raghavendra @ 2019-07-31 16:35 UTC (permalink / raw)
To: Anil Varughese, alim.akhtar, avri.altman, pedrom.sousa
Cc: jejb, martin.petersen, hare, rafalc, mparab, jank, linux-scsi,
linux-kernel
Hi,
On 31-Jul-19 2:06 PM, Anil Varughese wrote:
> Configure CDNS_UFS_REG_HCLKDIV in .hce_enable_notify()
> because if UFSHCD resets the controller ip because of
> phy or device related errors then CDNS_UFS_REG_HCLKDIV
> is reset to default value and .setup_clock() is not
> called later in the sequence whereas hce_enable_notify
> will be called everytime controller is reenabled.
>
So, now that CDNS_UFS_REG_HCLKDIV is configured in .hce_enable_notify(),
is it still required to have the same code in .setup_clock() as well?
Isn't setting up CDNS_UFS_REG_HCLKDIV in .hce_enable_notify() alone not
sufficient?
Regards
Vignesh
> Signed-off-by: Anil Varughese <aniljoy@cadence.com>
> ---
> drivers/scsi/ufs/cdns-pltfrm.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/scsi/ufs/cdns-pltfrm.c b/drivers/scsi/ufs/cdns-pltfrm.c
> index 86dbb723f..15ee54d28 100644
> --- a/drivers/scsi/ufs/cdns-pltfrm.c
> +++ b/drivers/scsi/ufs/cdns-pltfrm.c
> @@ -78,6 +78,22 @@ static int cdns_ufs_setup_clocks(struct ufs_hba *hba, bool on,
> return cdns_ufs_set_hclkdiv(hba);
> }
>
> +/**
> + * Called before and after HCE enable bit is set.
> + * @hba: host controller instance
> + * @status: notify stage (pre, post change)
> + *
> + * Return zero for success and non-zero for failure
> + */
> +static int cdns_ufs_hce_enable_notify(struct ufs_hba *hba,
> + enum ufs_notify_change_status status)
> +{
> + if (status != PRE_CHANGE)
> + return 0;
> +
> + return cdns_ufs_set_hclkdiv(hba);
> +}
> +
> /**
> * cdns_ufs_init - performs additional ufs initialization
> * @hba: host controller instance
> @@ -115,12 +131,14 @@ static int cdns_ufs_m31_16nm_phy_initialization(struct ufs_hba *hba)
> static const struct ufs_hba_variant_ops cdns_ufs_pltfm_hba_vops = {
> .name = "cdns-ufs-pltfm",
> .setup_clocks = cdns_ufs_setup_clocks,
> + .hce_enable_notify = cdns_ufs_hce_enable_notify,
> };
>
> static const struct ufs_hba_variant_ops cdns_ufs_m31_16nm_pltfm_hba_vops = {
> .name = "cdns-ufs-pltfm",
> .init = cdns_ufs_init,
> .setup_clocks = cdns_ufs_setup_clocks,
> + .hce_enable_notify = cdns_ufs_hce_enable_notify,
> .phy_initialization = cdns_ufs_m31_16nm_phy_initialization,
> };
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: ufs: Additional clock initialization in Cadence UFS
@ 2019-07-31 16:35 ` Vignesh Raghavendra
0 siblings, 0 replies; 6+ messages in thread
From: Vignesh Raghavendra @ 2019-07-31 16:35 UTC (permalink / raw)
To: Anil Varughese, alim.akhtar, avri.altman, pedrom.sousa
Cc: jejb, martin.petersen, hare, rafalc, mparab, jank, linux-scsi,
linux-kernel
Hi,
On 31-Jul-19 2:06 PM, Anil Varughese wrote:
> Configure CDNS_UFS_REG_HCLKDIV in .hce_enable_notify()
> because if UFSHCD resets the controller ip because of
> phy or device related errors then CDNS_UFS_REG_HCLKDIV
> is reset to default value and .setup_clock() is not
> called later in the sequence whereas hce_enable_notify
> will be called everytime controller is reenabled.
>
So, now that CDNS_UFS_REG_HCLKDIV is configured in .hce_enable_notify(),
is it still required to have the same code in .setup_clock() as well?
Isn't setting up CDNS_UFS_REG_HCLKDIV in .hce_enable_notify() alone not
sufficient?
Regards
Vignesh
> Signed-off-by: Anil Varughese <aniljoy@cadence.com>
> ---
> drivers/scsi/ufs/cdns-pltfrm.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/scsi/ufs/cdns-pltfrm.c b/drivers/scsi/ufs/cdns-pltfrm.c
> index 86dbb723f..15ee54d28 100644
> --- a/drivers/scsi/ufs/cdns-pltfrm.c
> +++ b/drivers/scsi/ufs/cdns-pltfrm.c
> @@ -78,6 +78,22 @@ static int cdns_ufs_setup_clocks(struct ufs_hba *hba, bool on,
> return cdns_ufs_set_hclkdiv(hba);
> }
>
> +/**
> + * Called before and after HCE enable bit is set.
> + * @hba: host controller instance
> + * @status: notify stage (pre, post change)
> + *
> + * Return zero for success and non-zero for failure
> + */
> +static int cdns_ufs_hce_enable_notify(struct ufs_hba *hba,
> + enum ufs_notify_change_status status)
> +{
> + if (status != PRE_CHANGE)
> + return 0;
> +
> + return cdns_ufs_set_hclkdiv(hba);
> +}
> +
> /**
> * cdns_ufs_init - performs additional ufs initialization
> * @hba: host controller instance
> @@ -115,12 +131,14 @@ static int cdns_ufs_m31_16nm_phy_initialization(struct ufs_hba *hba)
> static const struct ufs_hba_variant_ops cdns_ufs_pltfm_hba_vops = {
> .name = "cdns-ufs-pltfm",
> .setup_clocks = cdns_ufs_setup_clocks,
> + .hce_enable_notify = cdns_ufs_hce_enable_notify,
> };
>
> static const struct ufs_hba_variant_ops cdns_ufs_m31_16nm_pltfm_hba_vops = {
> .name = "cdns-ufs-pltfm",
> .init = cdns_ufs_init,
> .setup_clocks = cdns_ufs_setup_clocks,
> + .hce_enable_notify = cdns_ufs_hce_enable_notify,
> .phy_initialization = cdns_ufs_m31_16nm_phy_initialization,
> };
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] scsi: ufs: Additional clock initialization in Cadence UFS
2019-07-31 16:35 ` Vignesh Raghavendra
(?)
@ 2019-08-01 12:58 ` Anil Joy Varughese
-1 siblings, 0 replies; 6+ messages in thread
From: Anil Joy Varughese @ 2019-08-01 12:58 UTC (permalink / raw)
To: Vignesh Raghavendra, alim.akhtar, avri.altman, pedrom.sousa
Cc: jejb, martin.petersen, hare, Rafal Ciepiela, Milind Parab,
Jan Kotas, linux-scsi, linux-kernel
Hi Vignesh,
You are correct I have tested the code here and .setup_clock is not needed anymore; CDNS_UFS_REG_HCLKDIV configured in .hce_enable_notify() is enough. I will fix this in patch v2.
Thanks,
Anil
-----Original Message-----
From: Vignesh Raghavendra <vigneshr@ti.com>
Sent: Wednesday, July 31, 2019 10:05 PM
To: Anil Joy Varughese <aniljoy@cadence.com>; alim.akhtar@samsung.com; avri.altman@wdc.com; pedrom.sousa@synopsys.com
Cc: jejb@linux.ibm.com; martin.petersen@oracle.com; hare@suse.de; Rafal Ciepiela <rafalc@cadence.com>; Milind Parab <mparab@cadence.com>; Jan Kotas <jank@cadence.com>; linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: ufs: Additional clock initialization in Cadence UFS
EXTERNAL MAIL
Hi,
On 31-Jul-19 2:06 PM, Anil Varughese wrote:
> Configure CDNS_UFS_REG_HCLKDIV in .hce_enable_notify() because if
> UFSHCD resets the controller ip because of phy or device related
> errors then CDNS_UFS_REG_HCLKDIV is reset to default value and
> .setup_clock() is not called later in the sequence whereas
> hce_enable_notify will be called everytime controller is reenabled.
>
So, now that CDNS_UFS_REG_HCLKDIV is configured in .hce_enable_notify(), is it still required to have the same code in .setup_clock() as well?
Isn't setting up CDNS_UFS_REG_HCLKDIV in .hce_enable_notify() alone not sufficient?
Regards
Vignesh
> Signed-off-by: Anil Varughese <aniljoy@cadence.com>
> ---
> drivers/scsi/ufs/cdns-pltfrm.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/scsi/ufs/cdns-pltfrm.c
> b/drivers/scsi/ufs/cdns-pltfrm.c index 86dbb723f..15ee54d28 100644
> --- a/drivers/scsi/ufs/cdns-pltfrm.c
> +++ b/drivers/scsi/ufs/cdns-pltfrm.c
> @@ -78,6 +78,22 @@ static int cdns_ufs_setup_clocks(struct ufs_hba *hba, bool on,
> return cdns_ufs_set_hclkdiv(hba);
> }
>
> +/**
> + * Called before and after HCE enable bit is set.
> + * @hba: host controller instance
> + * @status: notify stage (pre, post change)
> + *
> + * Return zero for success and non-zero for failure */ static int
> +cdns_ufs_hce_enable_notify(struct ufs_hba *hba,
> + enum ufs_notify_change_status status) {
> + if (status != PRE_CHANGE)
> + return 0;
> +
> + return cdns_ufs_set_hclkdiv(hba);
> +}
> +
> /**
> * cdns_ufs_init - performs additional ufs initialization
> * @hba: host controller instance
> @@ -115,12 +131,14 @@ static int
> cdns_ufs_m31_16nm_phy_initialization(struct ufs_hba *hba) static const struct ufs_hba_variant_ops cdns_ufs_pltfm_hba_vops = {
> .name = "cdns-ufs-pltfm",
> .setup_clocks = cdns_ufs_setup_clocks,
> + .hce_enable_notify = cdns_ufs_hce_enable_notify,
> };
>
> static const struct ufs_hba_variant_ops cdns_ufs_m31_16nm_pltfm_hba_vops = {
> .name = "cdns-ufs-pltfm",
> .init = cdns_ufs_init,
> .setup_clocks = cdns_ufs_setup_clocks,
> + .hce_enable_notify = cdns_ufs_hce_enable_notify,
> .phy_initialization = cdns_ufs_m31_16nm_phy_initialization,
> };
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-08-01 12:59 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-31 8:36 [PATCH] scsi: ufs: Additional clock initialization in Cadence UFS Anil Varughese
2019-07-31 8:36 ` Anil Varughese
2019-07-31 10:09 ` Avri Altman
2019-07-31 16:35 ` Vignesh Raghavendra
2019-07-31 16:35 ` Vignesh Raghavendra
2019-08-01 12:58 ` Anil Joy Varughese
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.