[PATCH v1] scsi: ufs: skip shutdown if hba is not powered

2019-09-17 Thread Stanley Chu
be accessed in unpowered state. To solve this issue, simply add checking to skip shutdown for above kind of situation. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index

[PATCH v4 2/3] scsi: ufs: override auto suspend tunables for ufs

2019-09-16 Thread Stanley Chu
Rework from previous work by: Sujit Reddy Thumma Override auto suspend tunables for UFS device LUNs during initialization so as to efficiently manage background operations and the power consumption. Signed-off-by: Stanley Chu Reviewed-by: Avri Altman Reviewed-by: Bean Huo --- drivers/scsi

[PATCH v4 1/3] scsi: core: allow auto suspend override by low-level driver

2019-09-16 Thread Stanley Chu
spend parameters override within the LLD itself instead of waiting for userspace to control the power management. Signed-off-by: Stanley Chu Reviewed-by: Avri Altman Reviewed-by: Bart Van Assche --- drivers/scsi/scsi_sysfs.c | 3 ++- drivers/scsi/sd.c | 4 include/scsi/scsi_device.

[PATCH v4 3/3] scsi: ufs-mediatek: enable auto suspend capability

2019-09-16 Thread Stanley Chu
Enable auto suspend capability in MediaTek UFS driver. Signed-off-by: Stanley Chu Reviewed-by: Avri Altman --- drivers/scsi/ufs/ufs-mediatek.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c index 0f6ff33ce52e

[PATCH v4 0/3] scsi: core: allow auto suspend override by low-level driver

2019-09-16 Thread Stanley Chu
y v1 => v2: - Allow "zero" sdev->rpm_autosuspend_delay (Avri) - Fix format of some lines (Avri) Stanley Chu (3): scsi: core: allow auto suspend override by low-level driver scsi: ufs: override auto suspend tunables for ufs scsi: ufs-mediatek: enable auto suspend capability

Re: [PATCH v3 1/3] scsi: core: allow auto suspend override by low-level driver

2019-09-16 Thread Stanley Chu
Hi Bart, > > - > > + unsigned rpm_autosuspend_on:1; /* Runtime autosuspend */ > > atomic_t disk_events_disable_depth; /* disable depth for disk events */ > The "_on" part in the variable name "rpm_autosuspend_on" is probably > redundant and the comment could have been more elaborate. A

[PATCH v3 1/3] scsi: core: allow auto suspend override by low-level driver

2019-09-15 Thread Stanley Chu
spend parameters override within the LLD itself instead of waiting for userspace to control the power management. Signed-off-by: Stanley Chu Reviewed-by: Avri Altman --- drivers/scsi/scsi_sysfs.c | 3 ++- drivers/scsi/sd.c | 4 include/scsi/scsi_device.h | 2 +- include/scsi/scsi_host.h

[PATCH v3 2/3] scsi: ufs: override auto suspend tunables for ufs

2019-09-15 Thread Stanley Chu
Rework from previous work by: Sujit Reddy Thumma Override auto suspend tunables for UFS device LUNs during initialization so as to efficiently manage background operations and the power consumption. Signed-off-by: Stanley Chu Reviewed-by: Avri Altman --- drivers/scsi/ufs/ufshcd.c | 9

[PATCH v3 3/3] scsi: ufs-mediatek: enable auto suspend capability

2019-09-15 Thread Stanley Chu
Enable auto suspend capability in MediaTek UFS driver. Signed-off-by: Stanley Chu Reviewed-by: Avri Altman --- drivers/scsi/ufs/ufs-mediatek.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c index 0f6ff33ce52e

[PATCH v3 0/3] scsi: core: allow auto suspend override by low-level driver

2019-09-15 Thread Stanley Chu
s, (Bart) (a) Whether or not runtime suspend is enabled at device creation time (b) The power management autosuspend delay v1 => v2: - Allow "zero" sdev->rpm_autosuspend_delay (Avri) - Fix format of some lines (Avri) Stanley Chu (3): scsi: core: allow auto suspend override by

Re: [PATCH v2 1/3] scsi: core: allow auto suspend override by low-level driver

2019-09-15 Thread Stanley Chu
Hi Bart, > > - pm_runtime_forbid(&sdev->sdev_gendev); > > + if (sdev->rpm_autosuspend_delay < 0) > > + pm_runtime_forbid(&sdev->sdev_gendev); > > pm_runtime_enable(&sdev->sdev_gendev); > > scsi_autopm_put_target(starget); > > So we have a single new struct member, rpm_autosu

Re: [PATCH v2 3/3] scsi: ufs-mediatek: enable auto suspend capability

2019-09-15 Thread Stanley Chu
Hi Bart, > > @@ -147,6 +152,8 @@ static int ufs_mtk_init(struct ufs_hba *hba) > > if (err) > > goto out_variant_clear; > > > > + ufs_mtk_set_caps(hba); > > + > > /* > > * ufshcd_vops_init() is invoked after > > * ufshcd_setup_clock(true) in ufshcd_hba_init() thus

[PATCH v2 1/3] scsi: core: allow auto suspend override by low-level driver

2019-09-11 Thread Stanley Chu
spend parameters override within the LLD itself instead of waiting for userspace to control the power management. Signed-off-by: Stanley Chu Reviewed-by: Avri Altman --- drivers/scsi/scsi_scan.c | 6 ++ drivers/scsi/scsi_sysfs.c | 3 ++- drivers/scsi/sd.c | 4 include/scsi/scsi_dev

[PATCH v2 3/3] scsi: ufs-mediatek: enable auto suspend capability

2019-09-11 Thread Stanley Chu
Enable auto suspend capability in MediaTek UFS driver. Signed-off-by: Stanley Chu Reviewed-by: Avri Altman --- drivers/scsi/ufs/ufs-mediatek.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c index 0f6ff33ce52e

[PATCH v2 2/3] scsi: ufs: override auto suspend tunables for ufs

2019-09-11 Thread Stanley Chu
Rework from previous work by: Sujit Reddy Thumma Override auto suspend tunables for UFS device LUNs during initialization so as to efficiently manage background operations and the power consumption. Signed-off-by: Stanley Chu Reviewed-by: Avri Altman --- drivers/scsi/ufs/ufshcd.c | 8

[PATCH v2] scsi: allow auto suspend override by low-level driver

2019-09-11 Thread Stanley Chu
tself instead of waiting for userspace to control the power management, and make UFS as the first user of this capability. v1 => v2: - Allow "zero" sdev->rpm_autosuspend_delay (Avri) - Fix format of some lines (Avri) Stanley Chu (3): scsi: core: allow auto suspend override by lo

RE: [PATCH v1 3/3] scsi: ufs-mediatek: enable auto suspend capability

2019-09-11 Thread Stanley Chu
Hi Avri, On Wed, 2019-09-11 at 10:58 +, Avri Altman wrote: > > > > Enable auto suspend capability in MediaTek UFS driver. > > > > Signed-off-by: Stanley Chu > Reviewed-by: Avri Altman > > > --- > > drivers/scsi/ufs/ufs-mediatek.c | 7

RE: [PATCH v1 2/3] scsi: ufs: override auto suspend tunables for ufs

2019-09-11 Thread Stanley Chu
Hi Avri, > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index > > 30b752c61b97..d253a018a73b 100644 > > --- a/drivers/scsi/ufs/ufshcd.c > > +++ b/drivers/scsi/ufs/ufshcd.c > > @@ -88,6 +88,9 @@ > > /* Interrupt aggregation default timeout, unit: 40us */ > > #define INT_AG

RE: [PATCH v1 1/3] scsi: core: allow auto suspend override by low-level driver

2019-09-11 Thread Stanley Chu
Hi Avri, > > diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index > > 149d406aacc9..2218d57c4c0c 100644 > > --- a/drivers/scsi/sd.c > > +++ b/drivers/scsi/sd.c > > @@ -3371,6 +3371,9 @@ static int sd_probe(struct device *dev) > > } > > > > blk_pm_runtime_init(sdp->request_queu

[PATCH v1] scsi: allow auto suspend override by low-level driver

2019-09-11 Thread Stanley Chu
tself instead of waiting for userspace to control the power management, and make UFS as the first user of this capability. Stanley Chu (3): scsi: core: allow auto suspend override by low-level driver scsi: ufs: override auto suspend tunables for ufs scsi: ufs-mediatek: enable auto su

[PATCH v1 2/3] scsi: ufs: override auto suspend tunables for ufs

2019-09-11 Thread Stanley Chu
Rework from previous work by: Sujit Reddy Thumma Override auto suspend tunables for UFS device LUNs during initialization so as to efficiently manage background operations and the power consumption. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 8 drivers/scsi/ufs

[PATCH v1 1/3] scsi: core: allow auto suspend override by low-level driver

2019-09-11 Thread Stanley Chu
spend parameters override within the LLD itself instead of waiting for userspace to control the power management. Signed-off-by: Stanley Chu --- drivers/scsi/scsi_sysfs.c | 3 ++- drivers/scsi/sd.c | 3 +++ include/scsi/scsi_device.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-)

[PATCH v1 3/3] scsi: ufs-mediatek: enable auto suspend capability

2019-09-11 Thread Stanley Chu
Enable auto suspend capability in MediaTek UFS driver. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufs-mediatek.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c index 0f6ff33ce52e..b7b177c6194c 100644 --- a

[PATCH v3] scsi: ufs: fix broken hba->outstanding_tasks

2019-08-19 Thread Stanley Chu
lution is referried from error handling of device commands: bits in hba->outstanding_tasks shall be cleared regardless of their execution results. Signed-off-by: Stanley Chu Signed-off-by: Chun-Hung Wu --- drivers/scsi/ufs/ufshcd.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-)

RE: [PATCH v2 0/3] scsi: ufs: fix broken hba->outstanding_tasks

2019-08-19 Thread Stanley Chu
Hi Avri, On Thu, 2019-07-25 at 16:52 +0800, Stanley Chu wrote: > Hi Avri, > > On Thu, 2019-07-25 at 07:54 +, Avri Altman wrote: > > Stanly, > > > > > > > > Currently bits in hba->outstanding_tasks are cleared only after their > > > corr

RE: [PATCH v2 0/3] scsi: ufs: fix broken hba->outstanding_tasks

2019-07-25 Thread Stanley Chu
Hi Avri, On Thu, 2019-07-25 at 07:54 +, Avri Altman wrote: > Stanly, > > > > > Currently bits in hba->outstanding_tasks are cleared only after their > > corresponding task management commands are successfully done by > > __ufshcd_issue_tm_cmd(). > > > > If timeout happens in a task manageme

[PATCH v2 1/3] scsi: ufs: clean-up task resource immediately only if task is responded

2019-07-23 Thread Stanley Chu
immediately only if task is responded. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 3804a704e565..66c8e7402001 100644 --- a/drivers/scs

[PATCH v2 2/3] scsi: ufs: introduce ufshcd_tm_cmd_compl() to refactor task cleanup

2019-07-23 Thread Stanley Chu
Introduce ufshcd_tm_cmd_compl() to re-factor taks cleanup jobs to make code more readable and for future wider usage by task error handling. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/ufs

[PATCH v2 0/3] scsi: ufs: fix broken hba->outstanding_tasks

2019-07-23 Thread Stanley Chu
t; ufshcd_tmc_handler(). This patch tries to "re-factor" cleanup jobs first, and then add fixed flow to make the whole patch more readable. Stanley Chu (3): scsi: ufs: clean-up task resource immediately only if task is responded scsi: ufs: introduce ufshcd_tm_cmd_compl() to refacto

[PATCH v2 3/3] scsi: ufs: fix broken hba->outstanding_tasks

2019-07-23 Thread Stanley Chu
t; ufshcd_tmc_handler(). Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 114c15ed75f7..3cb942ef64e2 100644 --- a/drivers/scsi/ufs/ufshcd.c +

RE: [PATCH v1 0/2] scsi: ufs: Fix broken hba->outstanding_tasks

2019-07-23 Thread Stanley Chu
Hi Avri, On Mon, 2019-07-22 at 06:10 +, Avri Altman wrote: > > > > > > > > Hi, > > > > > > > > > > > Currently bits in hba->outstanding_tasks are cleared only after their > > > > corresponding task management commands are successfully done by > > > > __ufshcd_issue_tm_cmd(). > > > > > > > > I

Re: [PATCH v1 0/2] scsi: ufs: Fix broken hba->outstanding_tasks

2019-07-17 Thread Stanley Chu
Hi Avri, Alim and Pedrom, Gentle ping for this fix. On Fri, 2019-07-12 at 12:44 +0800, Stanley Chu wrote: > Currently bits in hba->outstanding_tasks are cleared only after their > corresponding task management commands are successfully done by > __ufshcd_issue_tm_cmd(). > >

[PATCH v1 1/2] scsi: ufs: Make new function for clearing outstanding task bits

2019-07-11 Thread Stanley Chu
Make a new function "ufshcd_outstanding_task_clear()" used to clear bits in hba->outstanding_tasks for future wider usage. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/u

[PATCH v1 2/2] scsi: ufs: Fix broken hba->outstanding_tasks

2019-07-11 Thread Stanley Chu
ing flow can clear their tags specifically. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 38 +++--- drivers/scsi/ufs/ufshcd.h | 1 + 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/uf

[PATCH v1 0/2] scsi: ufs: Fix broken hba->outstanding_tasks

2019-07-11 Thread Stanley Chu
ing flow can clear their tags specifically. Stanley Chu (2): scsi: ufs: Make new function for clearing outstanding task bits scsi: ufs: Fix broken hba->outstanding_tasks drivers/scsi/ufs/ufshcd.c | 49 +-- drivers/scsi/ufs/ufshcd.h | 1 + 2 files changed

[PATCH v3 3/4] scsi: ufs: Do not reset error history during host reset

2019-07-10 Thread Stanley Chu
Currently UFS error history will be reset and lost during host reset flow by ufschd_probe_hba(). We shall not reset it and then error history can be kept as completed as possible to improve debugging. In addition, fix a minor display error in ufshcd_print_err_hist(). Signed-off-by: Stanley Chu

[PATCH v3 4/4] scsi: ufs: Add history of fatal events

2019-07-10 Thread Stanley Chu
error - Resume error Example of abnormal events, - Task or request abort - Device reset (now equals to Logical Unit Reset) - Host reset This patch tries to track above errors and events by existed UFS error history mechanism. Signed-off-by: Stanley Chu --- drivers/sc

[PATCH v3 0/4] scsi: ufs: Provide fatal and auto-hibern8 error history

2019-07-10 Thread Stanley Chu
st reset Changes in v3: - Fix one missing place to track link startup error (Avri Altman) - Add history of device reset events (Avri Altman) - Add history of host reset events Changes in v2: - Add new patch "scsi: ufs: Add history of fatal events" Stanley Chu (4): scsi: ufs: Change

[PATCH v3 1/4] scsi: ufs: Change names related to error history

2019-07-10 Thread Stanley Chu
r_reg_hist *err_hist, char *err_name); Signed-off-by: Stanley Chu Reviewed-by: Avri Altman --- drivers/scsi/ufs/ufshcd.c | 39 --- drivers/scsi/ufs/ufshcd.h | 20 ++-- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/driver

[PATCH v3 2/4] scsi: ufs: Add fatal and auto-hibern8 error history

2019-07-10 Thread Stanley Chu
Provide more information of fatal errros and auto-hibern8 errors to improve debugging by extending extend existed UFS error history framework. Signed-off-by: Stanley Chu Reviewed-by: Avri Altman --- drivers/scsi/ufs/ufshcd.c | 11 ++- drivers/scsi/ufs/ufshcd.h | 10 +- 2 files

RE: [PATCH v2 4/4] scsi: ufs: Add history of fatal events

2019-07-10 Thread Stanley Chu
Hi Avri, On Wed, 2019-07-10 at 08:04 +, Avri Altman wrote: > Hi Stanley, > > > + (u32)ret); > > goto out; > > + } > > } while (ret && retries--); > > > > if (ret) > Here also link startup fails... Thanks! Will tr

[PATCH v2 3/4] scsi: ufs: Do not reset error history during host reset

2019-07-09 Thread Stanley Chu
Currently UFS error history will be reset and lost during host reset flow by ufschd_probe_hba(). We shall not reset it and then error history can be kept as completed as possible to improve debugging. In addition, fix a minor display error in ufshcd_print_err_hist(). Signed-off-by: Stanley Chu

[PATCH v2 0/4] scsi: ufs: Provide fatal and auto-hibern8 error history

2019-07-09 Thread Stanley Chu
fatal events" to add history for "non-interrupt-based" errors as well, for example, - Link startup fail - Suspend fail - Resume fail - Task or request abort event Changes in v2: - Add new patch "scsi: ufs: Add history of fatal events". Stanley Chu (4): scsi: ufs: Change

[PATCH v2 2/4] scsi: ufs: Add fatal and auto-hibern8 error history

2019-07-09 Thread Stanley Chu
Provide more information of fatal errros and auto-hibern8 errors to improve debugging by extending extend existed UFS error history framework. Signed-off-by: Stanley Chu Reviewed-by: Avri Altman --- drivers/scsi/ufs/ufshcd.c | 11 ++- drivers/scsi/ufs/ufshcd.h | 10 +- 2 files

[PATCH v2 1/4] scsi: ufs: Change names related to error history

2019-07-09 Thread Stanley Chu
r_reg_hist *err_hist, char *err_name); Signed-off-by: Stanley Chu Reviewed-by: Avri Altman --- drivers/scsi/ufs/ufshcd.c | 39 --- drivers/scsi/ufs/ufshcd.h | 20 ++-- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/driver

[PATCH v2 4/4] scsi: ufs: Add history of fatal events

2019-07-09 Thread Stanley Chu
esume fail - Task or request abort event This patch tries to add those failed events by existed UFS error history mechanism. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 36 +++- drivers/scsi/ufs/ufshcd.h | 10 ++ 2 files changed, 37 insertions(+),

[PATCH v1 0/3] scsi: ufs: Provide fatal and auto-hibern8 error history

2019-07-07 Thread Stanley Chu
This patch set provides more information of fatal errros and auto-hibern8 errors to improve debugging by keeping their error history as completed as possible. Stanley Chu (3): scsi: ufs: Change names related to error history scsi: ufs: Add fatal and auto-hibern8 error history scsi: ufs: Do

[PATCH v1 2/3] scsi: ufs: Add fatal and auto-hibern8 error history

2019-07-07 Thread Stanley Chu
Provide more information of fatal errros and auto-hibern8 errors to improve debugging by extending existed UFS error history framework. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 11 ++- drivers/scsi/ufs/ufshcd.h | 6 ++ 2 files changed, 16 insertions(+), 1 deletion

[PATCH v1 1/3] scsi: ufs: Change names related to error history

2019-07-07 Thread Stanley Chu
r_reg_hist *err_hist, char *err_name); Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 39 --- drivers/scsi/ufs/ufshcd.h | 20 ++-- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/driver

[PATCH v1 3/3] scsi: ufs: Do not reset error history during host reset

2019-07-07 Thread Stanley Chu
Currently UFS error history will be reset and lost during host reset flow by ufschd_probe_hba(). We shall not reset it and then error history can be kept as completed as possible to improve debugging. In addition, fix a minor display error in ufshcd_print_err_hist(). Signed-off-by: Stanley Chu

[PATCH v2] scsi: ufs: Avoid runtime suspend possibly being blocked forever

2019-06-12 Thread Stanley Chu
e PM only after hba is successfully bound to UFS device structure. Fixes: 62694735ca95 ([SCSI] ufs: Add runtime PM support for UFS host controller driver) Cc: sta...@vger.kernel.org Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd-pltfrm.c | 11 --- 1 file changed, 4 insertions(+), 7 dele

Re: [PATCH v1] scsi: ufs: Avoid runtime suspend possibly being blocked forever

2019-06-12 Thread Stanley Chu
Hi Marc, On Wed, 2019-06-12 at 13:30 +0200, Marc Gonzalez wrote: > On 12/06/2019 13:10, Avri Altman wrote: > > > On 12/06/2019 09:42, Stanley Chu wrote: > > > >> Fixes: e3ce73d (scsi: ufs: fix bugs related to null pointer access and > >> array size) &g

RE: [PATCH v1] scsi: ufs: Avoid runtime suspend possibly being blocked forever

2019-06-12 Thread Stanley Chu
Hi Avri, On Wed, 2019-06-12 at 11:10 +, Avri Altman wrote: > Hi, > > > > > UFS runtime suspend can be triggered after pm_runtime_enable() > > is invoked in ufshcd_pltfrm_init(). However if the first runtime > > suspend is triggered before binding ufs_hba structure to ufs > > device structure

[PATCH v1] scsi: ufs: Avoid runtime suspend possibly being blocked forever

2019-06-12 Thread Stanley Chu
e PM only after hba is successfully bound to UFS device structure. Fixes: e3ce73d (scsi: ufs: fix bugs related to null pointer access and array size) Cc: sta...@vger.kernel.org Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd-pltfrm.c | 11 --- 1 file changed, 4 insertions(+), 7 dele

[PATCH] scsi: ufs: Use pm_runtime_get_sync in shutdown flow

2019-05-28 Thread Stanley Chu
_sync() in shutdown flow instead of internal function ufshcd_runtime_resume() for consolidated control of RPM status. One concern is that pm_runtime_get_sync() may be better paired with pm_runtime_put_sync(), however shutdown could be one-way path thus the pairing is not required. Signed-off-by: S

[PATCH v5 0/3] scsi: ufs: Add error handling of Auto-Hibernate

2019-05-20 Thread Stanley Chu
e timer" (Avri Altman) - Rebase to Linux 5.2-rc1 v2: - Fix sentences in commit message (Marc Gonzalez) - Make "Auto-Hibernate" error detection more precise (Bean Huo) Stanley Chu (3): scsi: ufs: Introduce ufshcd_is_auto_hibern8_supported() scsi: ufs: Do not overwrite Auto-Hibern

[PATCH v5 1/3] scsi: ufs: Introduce ufshcd_is_auto_hibern8_supported()

2019-05-20 Thread Stanley Chu
The checking of Auto-Hibernation support is used in many places in the driver, thus re-factor it as ufshcd_is_auto_hibern8_supported() to make code more clean. Signed-off-by: Stanley Chu Reviewed-by: Bean Huo Reviewed-by: Alim Akhtar --- drivers/scsi/ufs/ufs-sysfs.c | 6 +++--- drivers/scsi

[PATCH v5 3/3] scsi: ufs: Add error-handling of Auto-Hibernate

2019-05-20 Thread Stanley Chu
happens, trigger error-handling just like "manual-hibernate" fail and apply the same recovery flow: schedule UFS error handler in ufshcd_check_errors(), and then do host reset and restore in UFS error handler. Signed-off-by: Stanley Chu Reviewed-by: B

[PATCH v5 2/3] scsi: ufs: Do not overwrite Auto-Hibernate timer

2019-05-20 Thread Stanley Chu
Some vendor-specific initialization flow may set its own auto-hibernate timer. In this case, do not overwrite timer value as "default value" in ufshcd_init(). Signed-off-by: Stanley Chu Reviewed-by: Alim Akhtar --- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+),

RE: [PATCH v4 2/3] scsi: ufs: Introduce ufshcd_is_auto_hibern8_supported()

2019-05-20 Thread Stanley Chu
Hi Avri, On Tue, 2019-05-21 at 06:18 +, Avri Altman wrote: > > > > ufshcd_is_auto_hibern8_supported() will be used elsewhere > > in the driver, thus refactor it for preparation. > You missed a couple of spots, e.g. in ufshcd_auto_hibern8_enable and in > ufs-sysfs. Yes... Will re-factor them

[PATCH v4 1/3] scsi: ufs: Do not overwrite Auto-Hibernate timer

2019-05-20 Thread Stanley Chu
Some vendor-specific initialization flow may set its own auto-hibernate timer. In this case, do not overwrite timer value as "default value" in ufshcd_init(). Signed-off-by: Stanley Chu Reviewed-by: Alim Akhtar --- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+),

[PATCH v4 0/3] scsi: ufs: Add error handling of Auto-Hibernate

2019-05-20 Thread Stanley Chu
Auto-Hibernate timer" (Avri Altman) - Rebase to Linux 5.2-rc1 v2: - Fix sentences in commit message (Marc Gonzalez) - Make "Auto-Hibernate" error detection more precise (Bean Huo) Stanley Chu (3): scsi: ufs: Do not overwrite Auto-Hibernate timer scsi: ufs: Introduce ufshcd_

[PATCH v4 3/3] scsi: ufs: Add error-handling of Auto-Hibernate

2019-05-20 Thread Stanley Chu
happens, trigger error-handling just like "manual-hibernate" fail and apply the same recovery flow: schedule UFS error handler in ufshcd_check_errors(), and then do host reset and restore in UFS error handler. Signed-off-by: Stanley Chu Reviewed-by: B

[PATCH v4 2/3] scsi: ufs: Introduce ufshcd_is_auto_hibern8_supported()

2019-05-20 Thread Stanley Chu
ufshcd_is_auto_hibern8_supported() will be used elsewhere in the driver, thus refactor it for preparation. Signed-off-by: Stanley Chu Reviewed-by: Bean Huo Reviewed-by: Alim Akhtar --- drivers/scsi/ufs/ufshcd.c | 2 +- drivers/scsi/ufs/ufshcd.h | 5 + 2 files changed, 6 insertions(+), 1

RE: [PATCH v3 2/3] scsi: ufs: Add error-handling of Auto-Hibernate

2019-05-20 Thread Stanley Chu
Hi Avri, On Mon, 2019-05-20 at 09:51 +, Avri Altman wrote: > Aside from some nits - see below, looks fine. > > Thanks, > Avri > > > diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h > > index ecfa898b9ccc..994d73d03207 100644 > > --- a/drivers/scsi/ufs/ufshcd.h > > +++ b/dri

[PATCH v3 0/3] scsi: ufs: Add error handling of Auto-Hibernate

2019-05-20 Thread Stanley Chu
" (Avri Altman) - Rebase to Linux 5.2-rc1 v2: - Fix sentences in commit message (Marc Gonzalez) - Make "Auto-Hibernate" error detection more precise (Bean Huo) Stanley Chu (3): scsi: ufs: Do not overwrite Auto-Hibernate timer scsi: ufs: Add error-handling of Auto-Hiber

[PATCH v3 1/3] scsi: ufs: Do not overwrite Auto-Hibernate timer

2019-05-20 Thread Stanley Chu
Some vendor-specific initialization flow may set its own auto-hibernate timer. In this case, do not overwrite timer value as "default value" in ufshcd_init(). Signed-off-by: Stanley Chu Reviewed-by: Alim Akhtar --- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+),

[PATCH v3 2/3] scsi: ufs: Add error-handling of Auto-Hibernate

2019-05-20 Thread Stanley Chu
happens, trigger error-handling just like "manual-hibernate" fail and apply the same recovery flow: schedule UFS error handler in ufshcd_check_errors(), and then do host reset and restore in UFS error handler. Signed-off-by: Stanley Chu Reviewed-by: B

[PATCH v3 3/3] scsi: ufs: Use re-factored Auto-Hibernate function

2019-05-20 Thread Stanley Chu
Use re-factored ufshcd_is_auto_hibern8_supported() function in ufshcd_init() instead to make code more cleaner. Signed-off-by: Stanley Chu Reviewed-by: Bean Huo Reviewed-by: Alim Akhtar --- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers

RE: [PATCH v2 1/3] scsi: ufs: Do not overwrite Auto-Hibernate timer

2019-05-19 Thread Stanley Chu
Hi Avri, On Mon, 2019-05-20 at 05:47 +, Avri Altman wrote: > > > > Hello Stanley, > > > > On 5/15/19 3:06 PM, Stanley Chu wrote: > > > Some vendor-specific initialization flow may set its own > > > auto-hibernate timer. In this case, do not overwri

Re: [PATCH v2 0/3] scsi: ufs: Add error handling of Auto-Hibernate

2019-05-19 Thread Stanley Chu
Hi Avri, Alim, Pedro, Gentle ping for this patch. On Wed, 2019-05-15 at 17:36 +0800, Stanley Chu wrote: > Currently auto-hibernate is activated if host supports > auto-hibern8 capability. However error-handling is not implemented, > which makes the feature somewhat risky. >

[PATCH v2 0/3] scsi: ufs: Add error handling of Auto-Hibernate

2019-05-15 Thread Stanley Chu
happens, trigger error-handling just like "manual-hibernate" fail and apply the same recovery flow: schedule UFS error handler in ufshcd_check_errors(), and then do host reset and restore in UFS error handler. v2: - Fix sentences in commit message (Marc Gonzalez) - Make "Auto-Hiber

[PATCH v2 1/3] scsi: ufs: Do not overwrite Auto-Hibernate timer

2019-05-15 Thread Stanley Chu
Some vendor-specific initialization flow may set its own auto-hibernate timer. In this case, do not overwrite timer value as "default value" in ufshcd_init(). Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH v2 2/3] scsi: ufs: Add error-handling of Auto-Hibernate

2019-05-15 Thread Stanley Chu
happens, trigger error-handling just like "manual-hibernate" fail and apply the same recovery flow: schedule UFS error handler in ufshcd_check_errors(), and then do host reset and restore in UFS error handler. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 31 +

[PATCH v2 3/3] scsi: ufs: Use re-factored Auto-Hibernate function

2019-05-15 Thread Stanley Chu
Use re-factored ufshcd_is_auto_hibern8_supported() function in ufshcd_init() instead to make code more cleaner. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c

RE: [EXT] [PATCH v1 2/3] scsi: ufs: add error handling of auto-hibern8

2019-05-14 Thread Stanley Chu
Hi Bean, On Tue, 2019-05-14 at 11:14 +, Bean Huo (beanhuo) wrote: > Hi, Stanley > Thanks for reply. > > > > >On Mon, 2019-05-13 at 18:21 +, Bean Huo (beanhuo) wrote: > >> Hi, Stanley > >> > >> >+ > >> >+static inline bool ufshcd_is_auto_hibern8_error(struct ufs_hba *hba, > >> >+

RE: [EXT] [PATCH v1 2/3] scsi: ufs: add error handling of auto-hibern8

2019-05-13 Thread Stanley Chu
Hi Bean, Thanks so much for review. On Mon, 2019-05-13 at 18:21 +, Bean Huo (beanhuo) wrote: > Hi, Stanley > > >+ > >+static inline bool ufshcd_is_auto_hibern8_error(struct ufs_hba *hba, > >+u32 intr_mask) > >+{ > >+return (ufshcd_is_auto_hiber

Re: [PATCH v1 0/3] scsi: ufs: add error handlings of auto-hibern8

2019-05-13 Thread Stanley Chu
Hi Marc, Thank you so much for below suggestions. I will fix them all in next version. On Mon, 2019-05-13 at 16:51 +0200, Marc Gonzalez wrote: > On 13/05/2019 16:36, Stanley Chu wrote: > > > Currently auto-hibern8 is activated if host supports > > auto-hibern8 capability

[PATCH v1 0/3] scsi: ufs: add error handlings of auto-hibern8

2019-05-13 Thread Stanley Chu
or handlings just like "manual-hibernate" fail and use the same flow: Identify errors and schedule UFS error handler in ufshcd_check_errors(), and then do host reset and restore in UFS error handler. Stanley Chu (3): scsi: ufs: do not overwrite auto-hibern8 timer scsi

[PATCH v1 3/3] scsi: ufs: use re-factored auto_hibern8 function

2019-05-13 Thread Stanley Chu
Use re-factored ufshcd_is_auto_hibern8_supported() function in ufshcd_init() instead to make code more cleaner. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c

[PATCH v1 2/3] scsi: ufs: add error handling of auto-hibern8

2019-05-13 Thread Stanley Chu
or handlings just like "manual-hibernate" fail and use the same flow: Identify errors and schedule UFS error handler in ufshcd_check_errors(), and then do host reset and restore in UFS error handler. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 14 ++ d

[PATCH v1 1/3] scsi: ufs: do not overwrite auto-hibern8 timer

2019-05-13 Thread Stanley Chu
Some vendor-specific initialization flow may set its own auto-hibern8 timer. In this case, do not overwrite timer value as "default value" in ufshcd_init(). Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dr

[PATCH 1/1] scsi: ufs: Print real incorrect request response code

2019-04-15 Thread Stanley Chu
If UFS device responds an unknown request response code, we can not know what it was via logs because the code is replaced by "DID_ERROR << 16" before log printing. Fix this to provide precise request response code information for easier issue breakdown. Signed-off-by: Stanley C

[PATCH 2/2] scsi: dt-bindings: ufs: Add VCC capability on MediaTek UFS driver

2019-03-29 Thread Stanley Chu
Add VCC supply for ufs-mediatek driver to provide power-saving operation during low-power modes, for example, VCC can be turned-off during system suspend and turned-on after system is resumed. Signed-off-by: Stanley Chu --- Documentation/devicetree/bindings/ufs/ufs-mediatek.txt | 3 +++ 1 file

[PATCH 0/2] scsi: dt-bindings: ufs: Remove "-fixed-regulator" property and add VCC capability on MediaTek UFS driver

2019-03-29 Thread Stanley Chu
" property in device tree. Besides, add VCC supply capability on MediaTek UFS driver. Stanley Chu (2): scsi: dt-bindings: ufs: Remove custom property "-fixed-regulator" scsi: dt-bindings: ufs: Add VCC capability on MediaTek UFS driver Documentation/devicetree/bindings/ufs/

[PATCH 1/2] scsi: dt-bindings: ufs: Remove custom property "-fixed-regulator"

2019-03-29 Thread Stanley Chu
ty in device tree. Signed-off-by: Stanley Chu --- Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt b/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt index 5111e9130

[PATCH v4 2/5] scsi: ufs: Avoid configuring regulator with undefined voltage range

2019-03-28 Thread Stanley Chu
nd return "good" results. However improper values shall be fixed to avoid potential bugs. Simply bypass voltage configuration if voltage range is not defined. Signed-off-by: Stanley Chu Reviewed-by: Avri Altman Acked-by: Alim Akhtar --- drivers/scsi/ufs/ufshcd.c | 13 - 1

[PATCH v4 1/5] scsi: ufs: Remove unused min_uA field in struct ufs_vreg

2019-03-28 Thread Stanley Chu
ever "min_uA" field is not used anywhere, thus we can remove it. Signed-off-by: Stanley Chu Reviewed-by: Marc Gonzalez Reviewed-by: Avri Altman Acked-by: Alim Akhtar --- drivers/scsi/ufs/ufs.h | 1 - drivers/scsi/ufs/ufshcd-pltfrm.c | 1 - 2 files changed, 2 deletions(-)

[PATCH v4 0/5] scsi: ufs: Fix regulator operations and remove "-fixed-regulator" device tree property

2019-03-28 Thread Stanley Chu
uot;. V2: - Add two patches to prepare to and remove "-fixed-regulator" device tree property. - Add more details on patch "scsi: ufs: remove unused min_uA field in struct ufs_vreg" (Marc Gonzalez). Stanley Chu (5): scsi: ufs: Remove unused min_uA field in struct ufs_vreg scs

[PATCH v4 4/5] scsi: ufs: Change "-max-microamp" to non-mandatory property

2019-03-28 Thread Stanley Chu
e of undefined current limit, this patch shall be safe. Signed-off-by: Stanley Chu Reviewed-by: Avri Altman Acked-by: Alim Akhtar --- drivers/scsi/ufs/ufshcd-pltfrm.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufsh

[PATCH v4 3/5] scsi: ufs: Fix regulator load and icc-level configuration

2019-03-28 Thread Stanley Chu
alid current limit, otherwise a wrong icc_level will be calculated by zero "max_uA" and thus causes unexpected results after it is written to device. Signed-off-by: Stanley Chu Reviewed-by: Avri Altman Acked-by: Alim Akhtar --- drivers/scsi/ufs/ufshcd.c | 15 --- 1 file changed

[PATCH v4 5/5] scsi: ufs: Remove "-fixed-regulator" device tree property

2019-03-28 Thread Stanley Chu
unexpected. * For other regulators with undefined voltage range, voltage range will be still undefined after patched. Therefore this patch is safe for all existed regulators with "-fixed-regulator" property already defined. Signed-off-by: Stanley Chu Reviewed-by: Avri Altman

Re: [PATCH RESEND v3 0/5] scsi: ufs: Fix regulator operations and remove "-fixed-regulator" device tree property

2019-03-27 Thread Stanley Chu
take to miss some tags in reposted patch. Will fix it in next version. > This series looks good, it will be if we get a Tested-by as well. > For this series > Acked-by: Alim Akhtar Thanks so much for review. > > On Wed, Mar 27, 2019 at 3:29 PM Stanley Chu wrote: > > > &

RE: [PATCH RESEND v3 0/5] scsi: ufs: Fix regulator operations and remove "-fixed-regulator" device tree property

2019-03-27 Thread Stanley Chu
t; V2: > > - Add two patches to prepare to and remove "-fixed-regulator" device > > tree property. > > - Add more details on patch "scsi: ufs: remove unused min_uA field in struct > > ufs_vreg" (Marc Gonzalez). > > > > Stanley Chu (5): > >

[PATCH RESEND v3 4/5] scsi: ufs: Change "-max-microamp" to non-mandatory property

2019-03-27 Thread Stanley Chu
in case of undefined current limit, this patch shall be safe. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd-pltfrm.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index 32cf8c56f029..2420e69

[PATCH RESEND v3 2/5] scsi: ufs: Avoid configuring regulator with undefined voltage range

2019-03-27 Thread Stanley Chu
nd return "good" results. However improper values shall be fixed to avoid potential bugs. Simply bypass voltage configuration if voltage range is not defined. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-

[PATCH RESEND v3 0/5] scsi: ufs: Fix regulator operations and remove "-fixed-regulator" device tree property

2019-03-27 Thread Stanley Chu
nge on a regulator". V2: - Add two patches to prepare to and remove "-fixed-regulator" device tree property. - Add more details on patch "scsi: ufs: remove unused min_uA field in struct ufs_vreg" (Marc Gonzalez). Stanley Chu (5): scsi: ufs: Remove unused min_uA field

[PATCH RESEND v3 1/5] scsi: ufs: Remove unused min_uA field in struct ufs_vreg

2019-03-27 Thread Stanley Chu
ever "min_uA" field is not used anywhere, thus we can remove it. Signed-off-by: Stanley Chu Reviewed-by: Marc Gonzalez --- drivers/scsi/ufs/ufs.h | 1 - drivers/scsi/ufs/ufshcd-pltfrm.c | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi

[PATCH RESEND v3 3/5] scsi: ufs: Fix regulator load and icc-level configuration

2019-03-27 Thread Stanley Chu
alid current limit, otherwise a wrong icc_level will be calculated by zero "max_uA" and thus causes unexpected results after it is written to device. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --

[PATCH RESEND v3 5/5] scsi: ufs: Remove "-fixed-regulator" device tree property

2019-03-27 Thread Stanley Chu
unexpected. * For other regulators with undefined voltage range, voltage range will be still undefined after patched. Therefore this patch is safe for all existed regulators with "-fixed-regulator" property already defined. Signed-off-by: Stanley Chu --- drivers/scsi/uf

  1   2   >