Re: [PATCH v2] scsi: ufs: Give clk scaling min gear a value

2021-01-27 Thread Stanley Chu
()") > > Signed-off-by: Can Guo Reviewed-by: Stanley Chu

[PATCH v3 2/3] scsi: ufs: Remove redundant null checking of devfreq instance

2021-01-20 Thread Stanley Chu
hba->devfreq is zero-initialized thus it is not required to check its existence in ufshcd_add_lus() function which is invoked during initialization only. Reviewed-by: Can Guo Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 15 +++ 1 file changed, 7 insertions(+)

[PATCH v3 1/3] scsi: ufs: Refactor cancelling clkscaling works

2021-01-20 Thread Stanley Chu
Cancelling suspend_work and resume_work is only required while suspending clk-scaling. Thus moving these two invokes into ufshcd_suspend_clkscaling() function. Reviewed-by: Can Guo Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 17 ++--- 1 file changed, 6 insertions

[PATCH v3 3/3] scsi: ufs: Cleanup and refactor clk-scaling feature

2021-01-20 Thread Stanley Chu
Manipulate clock scaling related stuff only if the host capability supports clock scaling feature to avoid redundant code execution. Reviewed-by: Can Guo Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 63 --- 1 file changed, 32 insertions(+), 31

[PATCH v3 0/3] scsi: ufs: Cleanup and refactor clock scaling

2021-01-20 Thread Stanley Chu
n's series: [v11] Three changes related with UFS clock scaling Changes since v1: - Refactor ufshcd_clk_scaling_suspend() in patch [3/4] - Change function name from ufshcd_clk_scaling_pm() to ufshcd_clk_scaling_suspend() in patch [3/4] - Refine patch titles Stanley Chu (3): scsi: ufs

Re: [PATCH v11 1/3] scsi: ufs: Protect some contexts from unexpected clock scaling

2021-01-20 Thread Stanley Chu
rap the > entire func ufshcd_devfreq_scale() with the clk_scaling_lock, so that we > can use this flag and clk_scaling_lock to control and synchronize clock > scaling invoked through devfreq sysfs nodes. > > Signed-off-by: Can Guo Reviewed-by: Stanley Chu

Re: [PATCH v10 2/3] scsi: ufs: Refactor ufshcd_init/exit_clk_scaling/gating()

2021-01-19 Thread Stanley Chu
des of clock scaling/gating to make the code more readable. > Overall functionality remains same. > > Signed-off-by: Can Guo Looks good to me. BTW, FYI. this series has conflicts during the merge to the latest for-next branch in Martin's tree. Reviewed-by: Stanley Chu

Re: [PATCH v10 1/3] scsi: ufs: Protect some contexts from unexpected clock scaling

2021-01-19 Thread Stanley Chu
_in_progress) > + if (!hba->clk_scaling.is_enabled || hba->pm_op_in_progress) > return; > > if (queue_resume_work) > @@ -5093,7 +5100,8 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba > *hba, > update_scaling = t

Re: [PATCH 2/2] scsi: ufs: Protect PM ops and err_handler from user access through sysfs

2021-01-12 Thread Stanley Chu
ned-off-by: Can Guo > Looks good to me. Feel free to add Reviewed-by: Stanley Chu

Re: [PATCH 1/2] scsi: ufs: Fix a possible NULL pointer issue

2021-01-12 Thread Stanley Chu
Hi Can, On Tue, 2021-01-12 at 14:52 +0800, Can Guo wrote: > On 2021-01-12 14:35, Stanley Chu wrote: > > Hi Can, > > > > On Sat, 2021-01-02 at 05:59 -0800, Can Guo wrote: > >> During system resume/suspend, hba could be NULL. In this case, do not > >&

Re: [PATCH 1/2] scsi: ufs: Fix a possible NULL pointer issue

2021-01-11 Thread Stanley Chu
return -EINVAL; > + > + if (unlikely(early_suspend)) { > + early_suspend = false; > + down(>eh_sem); > } I guess early_suspend here is to handle the case that hba is null during ufshcd_system_suspend() but !null during ufshcd_system_resume(). If yes, would it be possible? If no, may I know what is the purpose? Thanks a lot. Stanley Chu > > if (!hba->is_powered || pm_runtime_suspended(hba->dev))

Re: [PATCH 2/2] scsi: ufs: Protect PM ops and err_handler from user access through sysfs

2021-01-08 Thread Stanley Chu
now, maybe as you said, it is always 0. But in > my testing, it didn't get there the system has been shutdown. Which > means once shutdonw starts, sysfs node access path cannot reach > pm_runtime_get_sync(). (note, I don't know if sysfs node access thread > has been disabled or not) > > > Responsibly say, I didn't reproduce this issue on my system (ubuntu), > maybe you are using Android. I am not an expert on this topic, if you > have the best idea on how to reproduce this issue. please please let me > try. appreciate it! > One of the racing in my platforms happens due to I/O access triggered from kernel space, not user space. Thanks, Stanley Chu > > Thanks, > Bean > > > > > > 264 system_state = state; > > 265 usermodehelper_disable(); > > 266 device_shutdown(); > > > > Thanks, > > Can Guo. >

Re: [PATCH] scsi: ufs: Correct the lun used in eh_device_reset_handler() callback

2020-12-30 Thread Stanley Chu
in this case, it is not right for eh_device_reset_handler() callback > to count on the lun get from hba->lrb[-1]. Fix it by getting lun from the > SCSI device associated with the SCSI cmd. > > Signed-off-by: Can Guo Reviewed-by: Stanley Chu

Re: [PATCH v1] scsi: ufs-mediatek: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

2020-12-27 Thread Stanley Chu
Hi Asutosh, On Sun, 2020-12-27 at 17:32 -0800, Asutosh Das (asd) wrote: > On 12/24/2020 5:47 AM, Stanley Chu wrote: > > Hi Avri, Bean, > > > > On Thu, 2020-12-24 at 13:01 +0100, Bean Huo wrote: > >> On Thu, 2020-12-24 at 11:03 +, Avri Altman wrote: > >>

Re: [PATCH v1] scsi: ufs-mediatek: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

2020-12-24 Thread Stanley Chu
-going flush operations. This delay may "randomly" degrade the performance right? Since the configuration, i.e., enable fWriteBoosterBufferFlushDuringHibernate only with fWriteBoosterBufferFlushEn disabled, has been applied in many of our mass-produced products these yeas, we would like to keep it unless the new setting has obvious benefits. Thanks, Stanley Chu > > Bean >

Re: [PATCH v1] scsi: ufs-mediatek: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

2020-12-23 Thread Stanley Chu
Hi Can, On Thu, 2020-12-24 at 10:21 +0800, Can Guo wrote: > On 2020-12-23 12:41, Can Guo wrote: > > On 2020-12-23 12:19, Stanley Chu wrote: > >> Hi Can, > >> > >> On Tue, 2020-12-22 at 19:34 +0800, Can Guo wrote: > >>> On 2020-12-22 15:29,

Re: [PATCH RFC v4 1/1] scsi: ufs: Fix ufs power down/on specs violation

2020-12-23 Thread Stanley Chu
or the function > ufschd_vops_device_reset(sturct ufs_hba *hba) to ufshcd_ > vops_device_reset(sturct ufs_hba *hba, bool asserted). The > new parameter "bool asserted" is used to separate device reset > line pulling down from pulling up. > > Cc: Kiwoong Kim > Cc: Stanley Chu &g

[PATCH v2 2/2] arm64: dts: mt6779: Support ufshci and ufsphy

2020-12-22 Thread Stanley Chu
Support UFS on MT6779 platforms by adding ufshci and ufsphy nodes in dts file. Reviewed-by: Hanks Chen Signed-off-by: Stanley Chu --- arch/arm64/boot/dts/mediatek/mt6779.dtsi | 36 +++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts

[PATCH v2 0/2] arm64: Support Universal Flash Storage on MediaTek MT6779 platform

2020-12-22 Thread Stanley Chu
Hi, This series adds UFS (Universal Flash Storage) support on MediaTek MT6779 SoC platform. Changes since v1: - Fix irq attribute in dts in patch [2/2] Stanley Chu (2): arm64: configs: Support Universal Flash Storage on MediaTek platforms arm64: dts: mt6779: Support ufshci and ufsphy

[PATCH v2 1/2] arm64: configs: Support Universal Flash Storage on MediaTek platforms

2020-12-22 Thread Stanley Chu
Support UFS on MediaTek platforms by enabling CONFIG_SCSI_UFS_MEDIATEK. Reviewed-by: Hanks Chen Signed-off-by: Stanley Chu --- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index 17a2df6a263e

Re: [PATCH v1] scsi: ufs-mediatek: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

2020-12-22 Thread Stanley Chu
Hi Can, On Tue, 2020-12-22 at 19:34 +0800, Can Guo wrote: > On 2020-12-22 15:29, Stanley Chu wrote: > > Flush during hibern8 is sufficient on MediaTek platforms, thus > > enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL to skip enabling > > fWriteBoosterBufferFlush during WriteB

[PATCH v1 2/2] arm64: dts: mt6779: Support ufshci and ufsphy

2020-12-22 Thread Stanley Chu
Support UFS on MT6779 platforms by adding ufshci and ufsphy nodes in dts file. Reviewed-by: Hanks Chen Signed-off-by: Stanley Chu --- arch/arm64/boot/dts/mediatek/mt6779.dtsi | 36 +++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts

[PATCH v1 1/2] arm64: configs: Support Universal Flash Storage on MediaTek platforms

2020-12-22 Thread Stanley Chu
Support UFS on MediaTek platforms by enabling CONFIG_SCSI_UFS_MEDIATEK. Reviewed-by: Hanks Chen Signed-off-by: Stanley Chu --- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index 838301650a79

[PATCH v1 0/2] arm64: Support Universal Flash Storage on MediaTek MT6779 platform

2020-12-22 Thread Stanley Chu
Hi, This series adds UFS (Universal Flash Storage) support on MediaTek MT6779 SoC platform. Stanley Chu (2): arm64: configs: Support Universal Flash Storage on MediaTek platforms arm64: dts: mt6779: Support ufshci and ufsphy arch/arm64/boot/dts/mediatek/mt6779.dtsi | 36

[PATCH v2 0/2] scsi: ufs: Fix power drain and hci quirk for WriteBooster

2020-12-21 Thread Stanley Chu
Hi, This series fixes two WriteBooster issues, 1. Fix a corner case that device flush capability is not disabled during system suspend 2. Fix the checking of UFSHCI quirk UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL Stanley Chu (2): scsi: ufs: Fix possible power drain during system suspend scsi

[PATCH v1] scsi: ufs-mediatek: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

2020-12-21 Thread Stanley Chu
Flush during hibern8 is sufficient on MediaTek platforms, thus enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL to skip enabling fWriteBoosterBufferFlush during WriteBooster initialization. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufs-mediatek.c | 1 + 1 file changed, 1 insertion(+) diff

[PATCH v2 2/2] scsi: ufs: Relax the condition of UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

2020-12-21 Thread Stanley Chu
UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL is aimed to skip enabling fWriteBoosterBufferFlushEn while WriteBooster is initializing. Therefore it is better to apply the checking during WriteBooster initialization only. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 6 ++ 1 file

[PATCH v2 1/2] scsi: ufs: Fix possible power drain during system suspend

2020-12-21 Thread Stanley Chu
Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index e221add25a7e..9d61dc3eb842 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -8903,7 +890

Re: [PATCH v5 1/7] scsi: ufs: Add "wb_on" sysfs node to control WB on/off

2020-12-21 Thread Stanley Chu
able/disable WB > during runtime. Write 1/0 to "wb_on" sysfs node to enable/disable UFS WB. > > Reviewed-by: Avri Altman > Reviewed-by: Stanley Chu > Signed-off-by: Bean Huo > --- > drivers/scsi/ufs/ufs-sysfs.c | 41 > driv

Re: [PATCH v2 0/4] scsi: ufs: Cleanup and refactor clock scaling

2020-12-17 Thread Stanley Chu
Hi Can, On Fri, 2020-12-18 at 14:20 +0800, Can Guo wrote: > On 2020-12-16 21:16, Stanley Chu wrote: > > Hi, > > This series cleans up and refactors clk-scaling feature, and shall not > > change any functionality. > > > > This series is based on Can's serie

Re: Subject: [PATCH v14 1/3] scsi: ufs: Introduce HPB feature

2020-12-17 Thread Stanley Chu
cd/*/geometry_descriptor/hpb_number_lu > +Date:December 2020 > +Contact: Daejun Park > +Description: This entry shows the maximum number of HPB LU supported by > + the device. > + 00h: HPB is not supported by the device. > + 01h ~ 20h: Maximum number of HPB LU supported by the device > + The file is read only. Please remove above duplicated item. Thanks, Stanley Chu

[PATCH v1] scsi: ufs: Fix possible power drain during system suspend

2020-12-16 Thread Stanley Chu
Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index e221add25a7e..9d61dc3eb842 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -8903,7 +890

Re: [PATCH] scsi: ufs: fix livelock on ufshcd_clear_ua_wlun

2020-12-16 Thread Stanley Chu
rs error, instead, error handler work will be scheduled without blocking ufshcd_uic_hibern8_exit(). In addition, ufshcd_scsi_unblock_requests() would be invoked before leaving ufshcd_uic_hibern8_exit(). So this stack is no longer existed. Thanks, Stanley Chu > process_one_work+0x270/0x47c &g

[PATCH v2 1/4] scsi: ufs: Refactor cancelling clkscaling works

2020-12-16 Thread Stanley Chu
Cancelling suspend_work and resume_work is only required while suspending clk-scaling. Thus moving these two invokes into ufshcd_suspend_clkscaling() function. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 17 ++--- 1 file changed, 6 insertions(+), 11 deletions(-) diff

[PATCH v2 3/4] scsi: ufs: Cleanup and refactor clk-scaling feature

2020-12-16 Thread Stanley Chu
Manipulate clock scaling related stuff only if the host capability supports clock scaling feature to avoid redundant code execution. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 64 --- 1 file changed, 33 insertions(+), 31 deletions(-) diff

[PATCH v2 4/4] scsi: ufs: Fix build warning by incorrect function description

2020-12-16 Thread Stanley Chu
in 'ufshcd_try_to_abort_task' ufshcd.c:6651: warning: Excess function parameter 'cmd' description in 'ufshcd_try_to_abort_task' Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index

[PATCH v2 2/4] scsi: ufs: Remove redundant null checking of devfreq instance

2020-12-16 Thread Stanley Chu
hba->devfreq is zero-initialized thus it is not required to check its existence in ufshcd_add_lus() function which is invoked during initialization only. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --

[PATCH v2 0/4] scsi: ufs: Cleanup and refactor clock scaling

2020-12-16 Thread Stanley Chu
) in patch [3/4] - Change function name from ufshcd_clk_scaling_pm() to ufshcd_clk_scaling_suspend() in patch [3/4] - Refine patch titles Stanley Chu (4): scsi: ufs: Refactor cancelling clkscaling works scsi: ufs: Remove redundant null checking of devfreq instance scsi: ufs: Cleanup an

Re: [PATCH v5 6/7] scsi: ufs: Cleanup WB buffer flush toggle implementation

2020-12-15 Thread Stanley Chu
On Wed, 2020-12-16 at 00:05 +0100, Bean Huo wrote: > From: Bean Huo > > Delete ufshcd_wb_buf_flush_enable() and ufshcd_wb_buf_flush_disable(), > move the implementation into ufshcd_wb_toggle_flush(). > > Signed-off-by: Bean Huo > --- Reviewed-by: Stanley Chu

Re: [PATCH v5 4/7] scsi: ufs: Remove two WB related fields from struct ufs_dev_info

2020-12-15 Thread Stanley Chu
Units is set to zero, > the WriteBooster feature is disabled", and if UFS device supports WB. > After that, no user uses them any more. So, don't need to keep time in > runtime. > > Signed-off-by: Bean Huo Reviewed-by: Stanley Chu

Re: [PATCH v5 5/7] scsi: ufs: Group UFS WB related flags to struct ufs_dev_info

2020-12-15 Thread Stanley Chu
cture > members vertically. > > Signed-off-by: Bean Huo Acked-by: Stanley Chu

Re: [PATCH v4 3/6] scsi: ufs: Group UFS WB related flags to struct ufs_dev_info

2020-12-15 Thread Stanley Chu
On Tue, 2020-12-15 at 10:42 +0100, Bean Huo wrote: > On Tue, 2020-12-15 at 17:01 +0800, Stanley Chu wrote: > > > + boolwb_buf_flush_enabled; > > > + u8 wb_dedicated_lu; > > > + u8 b_wb_buffer_type; > > > + u32 d_w

[PATCH v1 2/4] scsi: ufs: Cleanup ufshcd_add_lus function

2020-12-15 Thread Stanley Chu
hba->devfreq is zero-initialized thus it is not required to check its existence in ufshcd_add_lus() function which is invoked during initialization only. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --

[PATCH v1 0/4] Cleanup and refactor clock scaling

2020-12-15 Thread Stanley Chu
ed to 5.10. The choice of base branch is simply making these patches easy to be reviewed because this series is based on clk-scaling fixes by Can. If this series is decided not being merged to 5.10, then I would rebase it to 5.11/scsi-queue. Stanley Chu (4): scsi: ufs: Cleanup ufshcd_suspend_

[PATCH v1 1/4] scsi: ufs: Cleanup ufshcd_suspend_clkscaling function

2020-12-15 Thread Stanley Chu
Cancelling suspend_work and resume_work is only required while suspending clk-scaling. Thus moving these two invokes into ufshcd_suspend_clkscaling() function. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 17 ++--- 1 file changed, 6 insertions(+), 11 deletions(-) diff

[PATCH v1 3/4] scsi: ufs: Cleanup and refactor clk-scaling feature

2020-12-15 Thread Stanley Chu
Manipulate clock scaling related stuff only if the host capability supports clock scaling feature to avoid redundant code execution. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 54 ++- 1 file changed, 30 insertions(+), 24 deletions(-) diff

[PATCH v1 4/4] scsi: ufs: Fix build warning by incorrect function description

2020-12-15 Thread Stanley Chu
in 'ufshcd_try_to_abort_task' ufshcd.c:6651: warning: Excess function parameter 'cmd' description in 'ufshcd_try_to_abort_task' Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index

Re: [PATCH v4 5/6] scsi: ufs: Cleanup WB buffer flush toggle implementation

2020-12-15 Thread Stanley Chu
; - dev_dbg(hba->dev, "WB - Flush disabled: %d\n", ret); > + dev_err(hba->dev, "%s WB-Buf Flush %s failed %d\n", __func__, > + enable ? "enable" : "disable", ret); > + goto out; > } > > + if (enable) > + hba->dev_info.wb_buf_flush_enabled = true; > + else > + hba->dev_info.wb_buf_flush_enabled = false; Perhaps this could be simpler as below? hba->dev_info.wb_buf_flush_enabled = enable; Thanks, Stanley Chu > + > + dev_dbg(hba->dev, "WB-Buf Flush %s\n", enable ? "enabled" : "disabled"); > +out: > return ret; > } >

Re: [PATCH v4 3/6] scsi: ufs: Group UFS WB related flags to struct ufs_dev_info

2020-12-15 Thread Stanley Chu
b_wb_buffer_type; > + u32 d_wb_alloc_units; > + > + boolb_rpm_dev_flush_capable; > + u8 b_presrv_uspc_en; Perhaps we could unify the style of these WB related stuff to wb_* ? Besides, I am not sure if using tab instead space between the type and na

Re: [PATCH v4 4/6] scsi: ufs: Remove d_wb_alloc_units from struct ufs_dev_info

2020-12-15 Thread Stanley Chu
_buffer_type; > - u32 d_wb_alloc_units; Perhaps below two fields could be also removed from struct ufs_dev_info for the same reason? u32 d_ext_ufs_feature_sup; u32 d_wb_alloc_units; Thanks, Stanley Chu > > boolb_rpm_dev_flush_capable; > u8 b_presrv_

Re: [PATCH v4 3/3] scsi: ufs: Revert "Make sure clk scaling happens only when HBA is runtime ACTIVE"

2020-12-14 Thread Stanley Chu
t; mature fix to protect UFS LLD stability from clock scaling invoked through > sysfs nodes by users. > > Signed-off-by: Can Guo Reviewed-by: Stanley Chu

Re: [PATCH v4 2/3] scsi: ufs: Clean up ufshcd_exit_clk_scaling/gating()

2020-12-14 Thread Stanley Chu
On Sun, 2020-12-13 at 08:31 -0800, Can Guo wrote: > ufshcd_hba_exit() is always called after ufshcd_exit_clk_scaling() and > ufshcd_exit_clk_gating(), so move ufshcd_exit_clk_scaling/gating() to > ufshcd_hba_exit(). > > Signed-off-by: Can Guo Reviewed-by: Stanley Chu

Re: [PATCH v4 1/3] scsi: ufs: Protect some contexts from unexpected clock scaling

2020-12-14 Thread Stanley Chu
if (ufshcd_is_clkscaling_supported(hba)) > - device_remove_file(hba->dev, >clk_scaling.enable_attr); > ufshcd_hba_exit(hba); > } > EXPORT_SYMBOL_GPL(ufshcd_remove); > diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h > index e0f00a4..9fcecba 100644 > --- a/drivers/scsi/ufs/ufshcd.h > +++ b/drivers/scsi/ufs/ufshcd.h > @@ -382,6 +382,7 @@ struct ufs_saved_pwr_info { > * @workq: workqueue to schedule devfreq suspend/resume work > * @suspend_work: worker to suspend devfreq > * @resume_work: worker to resume devfreq > + * @is_enabled: tracks if scaling is currently enabled or not > * @is_allowed: tracks if scaling is currently allowed or not > * @is_busy_started: tracks if busy period has started or not > * @is_suspended: tracks if devfreq is suspended or not > @@ -396,6 +397,7 @@ struct ufs_clk_scaling { > struct workqueue_struct *workq; > struct work_struct suspend_work; > struct work_struct resume_work; > + bool is_enabled; > bool is_allowed; > bool is_busy_started; > bool is_suspended; Now there are more and more "similar boolean attributes" regarding clk-scaling control, maybe add more comprehensive comments to describe them? Otherwise this patch looks good to me. Feel free to add Reviewed-by: Stanley Chu

Re: [PATCH v1 2/2] scsi: ufs: Clean up some lines from ufshcd_hba_exit()

2020-12-09 Thread Stanley Chu
@ static void ufshcd_async_scan(void *data, > async_cookie_t cookie) > if (ret) { > pm_runtime_put_sync(hba->dev); > ufshcd_exit_clk_scaling(hba); > + ufshcd_exit_clk_gating(hba); How about moving above two lines to ufshcd_hba_e

Re: [PATCH 1/1] scsi: ufs-mediatek: use correct path to fix compiling error

2020-12-08 Thread Stanley Chu
RACE_INCLUDE_PATH > #undef TRACE_INCLUDE_FILE > -#define TRACE_INCLUDE_PATH . > +#define TRACE_INCLUDE_PATH ../../drivers/scsi/ufs/ > #define TRACE_INCLUDE_FILE ufs-mediatek-trace > #include Thanks for this fix. Reviewed-by: Stanley Chu

Re: [PATCH v2 1/2] scsi: ufs: Re-enable WriteBooster after device reset

2020-12-08 Thread Stanley Chu
On Tue, 2020-12-08 at 15:13 +0100, Bean Huo wrote: > On Tue, 2020-12-08 at 21:56 +0800, Stanley Chu wrote: > > index 08c8a591e6b0..36d367eb8139 100644 > > --- a/drivers/scsi/ufs/ufshcd.h > > +++ b/drivers/scsi/ufs/ufshcd.h > > @@ -1221,8 +1221,13 @@ static inline void &

Re: [PATCH v2] scsi: ufs: clear uac for RPMB after ufshcd resets

2020-12-08 Thread Stanley Chu
rovisioned, we may see RPMB failure after UFS suspend/resume. > Inject request_sense to clear uac in ufshcd reset flow. > > Signed-off-by: Randall Huang > Signed-off-by: Leo Liou > Signed-off-by: Jaegeuk Kim Reviewed-by: Stanley Chu

[PATCH v2 2/2] scsi: ufs: Uninline ufshcd_vops_device_reset function

2020-12-08 Thread Stanley Chu
Since more and more statements showing up in ufshcd_vops_device_reset(), uninline it to allow compiler making possibly better optimization. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 27 ++- drivers/scsi/ufs/ufshcd.h | 19 +-- 2 files

[PATCH v2 1/2] scsi: ufs: Re-enable WriteBooster after device reset

2020-12-08 Thread Stanley Chu
n: hba->wb_buf_flush_enabled - fWriteBoosterBufferFlushDuringHibernate: No variable mapped Fixes: 3d17b9b5ab11 ("scsi: ufs: Add write booster feature support") Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.h | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git

[PATCH v2 0/2] scsi: ufs: Re-enable WB after device reset

2020-12-08 Thread Stanley Chu
Hi, This series fixes up an issue that WB is not re-enabled after device reset. Stanley Chu (2): scsi: ufs: Re-enable WriteBooster after device reset scsi: ufs: Uninline ufshcd_vops_device_reset function drivers/scsi/ufs/ufshcd.c | 27 ++- drivers/scsi/ufs/ufshcd.h

[PATCH v1] scsi: ufs: Ensure WriteBooster to be re-enabled after device reset

2020-12-07 Thread Stanley Chu
n: hba->wb_buf_flush_enabled - fWriteBoosterBufferFlushDuringHibernate: No variable mapped Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.h | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 7a7e056a33a9..c22887bee7

Re: [PATCH v2 2/3] scsi: ufs: Keep device active mode only fWriteBoosterBufferFlushDuringHibernate == 1

2020-12-07 Thread Stanley Chu
On Mon, 2020-12-07 at 13:36 +0800, Stanley Chu wrote: > On Sun, 2020-12-06 at 11:13 +0100, Bean Huo wrote: > > From: Bean Huo > > > > According to the JEDEC UFS 3.1 Spec, If > > fWriteBoosterBufferFlushDuringHibernate > > is set to one, the device flu

Re: [PATCH] scsi: ufs: Enable WB flush during suspend only if WB is enabled

2020-12-07 Thread Stanley Chu
Hi Bean, On Mon, 2020-12-07 at 11:59 +0100, Bean Huo wrote: > On Mon, 2020-12-07 at 13:50 +0800, Stanley Chu wrote: > > WriteBootser flush during suspend is not necessary to be enabled if > > WriteBooster feature is disabled. Simply adding a check to prevent > > u

Re: [PATCH v2 1/3] scsi: ufs: Add "wb_on" sysfs node to control WB on/off

2020-12-06 Thread Stanley Chu
dev_warn(dev, "To control WB through wb_on is not allowed!\n"); > + return -EOPNOTSUPP; > + } Perhaps wb_on shall override clkscaling control. But this could be future work. Reviewed-by: Stanley Chu > + if (!ufshcd_is_wb_allowed

[PATCH v1 2/2] scsi: ufs-mediatek: Keep VCC always-on for specific devices

2020-12-06 Thread Stanley Chu
For some devices which needs extra delay after VCC power down, VCC shall be kept always-on in some MediaTek UFS platforms to ensure the stability of such devices because the extra delay may not be enough in those platforms. Reviewed-by: Andy Teng Signed-off-by: Stanley Chu --- drivers/scsi/ufs

[PATCH] scsi: ufs: Enable WB flush during suspend only if WB is enabled

2020-12-06 Thread Stanley Chu
WriteBootser flush during suspend is not necessary to be enabled if WriteBooster feature is disabled. Simply adding a check to prevent unexpected power drain. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers

[PATCH v1 0/2] scsi: ufs: Allow regulators being always on

2020-12-06 Thread Stanley Chu
Hi, This series allow vendors to keep the regulator always-on, and provide an implementation on MediaTek UFS platforms. Stanley Chu (2): scsi: ufs: Allow regulators being always-on scsi: ufs-mediatek: Keep VCC always-on for specific devices drivers/scsi/ufs/ufs-mediatek.c | 21

[PATCH v1 1/2] scsi: ufs: Allow regulators being always-on

2020-12-06 Thread Stanley Chu
Introduce a flag "always_on" in struct ufs_vreg to allow vendors to keep the regulator always-on. Reviewed-by: Andy Teng Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufs.h| 1 + drivers/scsi/ufs/ufshcd.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dr

Re: [PATCH v2 2/3] scsi: ufs: Keep device active mode only fWriteBoosterBufferFlushDuringHibernate == 1

2020-12-06 Thread Stanley Chu
if (ret) { > dev_err(hba->dev, "%s: En WB flush during H8: failed: %d\n", > __func__, ret); > + hba->dev_info.is_hibern8_wb_flush = false; Perhaps this statement could be dummy because hba-&

Re: [PATCH v2 3/3] scsi: ufs: Changes comment in the function ufshcd_wb_probe()

2020-12-06 Thread Stanley Chu
On Sun, 2020-12-06 at 11:13 +0100, Bean Huo wrote: > From: Bean Huo > > USFHCD supports WriteBooster "LU dedicated buffer” mode and > “shared buffer” mode both, so changes the comment in the > function ufshcd_wb_probe(). > > Signed-off-by: Bean Huo > Reviewed-by: C

[PATCH v5 0/4] scsi: ufs: Refine error history and introduce event_notify vop

2020-12-05 Thread Stanley Chu
: - Add patches for vop cleanups - Introduce phy_initialization helper and replace direct invoking in ufs-cdns and ufs-dwc by the helper - Introduce event_notify vop implemntation in ufs-mediatek Changes since v1: - Change notify_event() to event_notify() to follow vop naming covention Stanley

[PATCH v5 3/4] scsi: ufs: Introduce event_notify variant function

2020-12-05 Thread Stanley Chu
Introduce event_notify variant function to allow vendor to get notification of important events and connect to any proprietary debugging facilities. Reviewed-by: Asutosh Das Reviewed-by: Can Guo Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 2 ++ drivers/scsi/ufs/ufshcd.h | 11

[PATCH v1 4/4] scsi: ufs-dwc: Use phy_initialization helper

2020-12-05 Thread Stanley Chu
Use phy_initialization helper instead of direct invoking. Reviewed-by: Avri Altman Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd-dwc.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd-dwc.c b/drivers/scsi/ufs/ufshcd-dwc.c index

[PATCH v1 2/4] scsi: ufs: Introduce phy_initialization helper

2020-12-05 Thread Stanley Chu
Introduce phy_initialization helper since this is the only one variant function without helper. Reviewed-by: Avri Altman Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.h | 8 1 file changed, 8 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h

[PATCH v1 3/4] scsi: ufs-cdns: Use phy_initialization helper

2020-12-05 Thread Stanley Chu
Use phy_initialization helper instead of direct function invoking. Reviewed-by: Avri Altman Signed-off-by: Stanley Chu --- 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

[PATCH v5 4/4] scsi: ufs-mediatek: Introduce event_notify implementation

2020-12-05 Thread Stanley Chu
Introduce event_notify implementation on MediaTek UFS platform. A vendor-specific tracepoint is added that could be used for debugging purpose. Reviewed-by: Avri Altman Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufs-mediatek-trace.h | 37 +++ drivers/scsi/ufs/ufs

[PATCH v1 0/4] scsi: ufs: Cleanup phy_initialization vop

2020-12-05 Thread Stanley Chu
Hi, This series simply cleans up UFS vops and shall not change any functionality. Stanley Chu (4): 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

[PATCH v1 1/4] scsi: ufs: Remove unused setup_regulators variant function

2020-12-05 Thread Stanley Chu
Since setup_regulators variant function is not used by any vendors, simply remove it. Reviewed-by: Avri Altman Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 10 +- drivers/scsi/ufs/ufshcd.h | 10 -- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git

[PATCH v5 1/4] scsi: ufs: Add error history for abort event in UFS Device W-LUN

2020-12-05 Thread Stanley Chu
Add error history for abort event in UFS Device W-LUN. Besides, use specified value as parameter of ufshcd_update_reg_hist() to identify the aborted tag or LUNs. Reviewed-by: Asutosh Das Reviewed-by: Can Guo Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 6 -- 1 file changed

RE: [PATCH v4 0/8] Refine error history and introduce event_notify vop

2020-12-05 Thread Stanley Chu
ation 2. Error history and event notification since these patches are strongly related Please review my new posted series and feel free to provide any further suggestion. Thanks, Stanley Chu > > Thanks, > Avri > > > > > Thanks, > > Avri > > > > > &

[PATCH v5 2/4] scsi: ufs: Refine error history functions

2020-12-05 Thread Stanley Chu
This patch shall not change any functionality. Reviewed-by: Asutosh Das Reviewed-by: Can Guo Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 118 +- drivers/scsi/ufs/ufshcd.h | 71 ++- 2 files changed, 97 insertions(+), 92

[PATCH v4 1/8] scsi: ufs: Remove unused setup_regulators variant function

2020-12-04 Thread Stanley Chu
Since setup_regulators variant function is not used by any vendors, simply remove it. Signed-off-by: Stanley Chu --- 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

[PATCH v4 6/8] scsi: ufs: Refine error history functions

2020-12-04 Thread Stanley Chu
This patch shall not change any functionality. Reviewed-by: Can Guo Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 118 +- drivers/scsi/ufs/ufshcd.h | 71 ++- 2 files changed, 97 insertions(+), 92 deletions(-) diff --git a/dr

[PATCH v4 5/8] scsi: ufs: Add error history for abort event in UFS Device W-LUN

2020-12-04 Thread Stanley Chu
Add error history for abort event in UFS Device W-LUN. Besides, use specified value as parameter of ufshcd_update_reg_hist() to identify the aborted tag or LUNs. Reviewed-by: Can Guo Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 6 -- 1 file changed, 4 insertions(+), 2

[PATCH v4 4/8] scsi: ufs-dwc: Use phy_initialization helper

2020-12-04 Thread Stanley Chu
Use phy_initialization helper instead of direct invoking. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd-dwc.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd-dwc.c b/drivers/scsi/ufs/ufshcd-dwc.c index 6a901da2d15a..5bb9d3a88795

[PATCH v4 0/8] Refine error history and introduce event_notify vop

2020-12-04 Thread Stanley Chu
phy_initialization helper and replace direct invoking in ufs-cdns and ufs-dwc by the helper - 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

[PATCH v4 7/8] scsi: ufs: Introduce event_notify variant function

2020-12-04 Thread Stanley Chu
Introduce event_notify variant function to allow vendor to get notification of important events and connect to any proprietary debugging facilities. Reviewed-by: Can Guo Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 2 ++ drivers/scsi/ufs/ufshcd.h | 11 +++ 2 files

[PATCH v4 8/8] scsi: ufs-mediatek: Introduce event_notify implementation

2020-12-04 Thread Stanley Chu
Introduce event_notify implementation on MediaTek UFS platform. A vendor-specific tracepoint is added that could be used for debugging purpose. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufs-mediatek-trace.h | 37 +++ drivers/scsi/ufs/ufs-mediatek.c | 12

[PATCH v4 3/8] scsi: ufs-cdns: Use phy_initialization helper

2020-12-04 Thread Stanley Chu
Use phy_initialization helper instead of direct function invoking. Signed-off-by: Stanley Chu --- 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

[PATCH v4 2/8] scsi: ufs: Introduce phy_initialization helper

2020-12-04 Thread Stanley Chu
Introduce phy_initialization helper since this is the only one variant function without helper. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.h | 8 1 file changed, 8 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 21de7607611f

[PATCH v3 6/8] scsi: ufs: Refine error history functions

2020-12-04 Thread Stanley Chu
This patch shall not change any functionality. Reviewed-by: Can Guo Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 118 +- drivers/scsi/ufs/ufshcd.h | 71 ++- 2 files changed, 97 insertions(+), 92 deletions(-) diff --git a/dr

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

2020-12-04 Thread Stanley Chu
Use phy_initialization helper instead of direct function invoking. Signed-off-by: Stanley Chu --- 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

[PATCH v3 4/8] scsi: ufs-dwc: Use phy_initialization helper

2020-12-04 Thread Stanley Chu
Use phy_initialization helper instead of direct invoking. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd-dwc.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd-dwc.c b/drivers/scsi/ufs/ufshcd-dwc.c index 6a901da2d15a..5bb9d3a88795

[PATCH v3 7/8] scsi: ufs: Introduce event_notify variant function

2020-12-04 Thread Stanley Chu
Introduce event_notify variant function to allow vendor to get notification of important events and connect to any proprietary debugging facilities. Reviewed-by: Can Guo Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 2 ++ drivers/scsi/ufs/ufshcd.h | 11 +++ 2 files

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

2020-12-04 Thread Stanley Chu
Since setup_regulators variant function is not used by any vendors, simply remove it. Signed-off-by: Stanley Chu --- 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

[PATCH v3 2/8] scsi: ufs: Introduce phy_initialization helper

2020-12-04 Thread Stanley Chu
Introduce phy_initialization helper since this is the only one variant function without helper. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.h | 8 1 file changed, 8 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 21de7607611f

[PATCH v3 5/8] scsi: ufs: Add error history for abort event in UFS Device W-LUN

2020-12-04 Thread Stanley Chu
Add error history for abort event in UFS Device W-LUN. Besides, use specified value as parameter of ufshcd_update_reg_hist() to identify the aborted tag or LUNs. Reviewed-by: Can Guo Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 6 -- 1 file changed, 4 insertions(+), 2

[PATCH v3 8/8] scsi: ufs-mediatek: Introduce event_notify implementation

2020-12-04 Thread Stanley Chu
Introduce event_notify implementation on MediaTek UFS platform. A vendor-specific tracepoint is added that could be used for debugging purpose. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufs-mediatek-trace.h | 37 +++ drivers/scsi/ufs/ufs-mediatek.c | 10

[PATCH v3 0/8] Refine error history and introduce event_notify vop

2020-12-04 Thread Stanley Chu
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

RE: [PATCH v2 3/3] scsi: ufs: Introduce event_notify variant function

2020-12-02 Thread Stanley Chu
this vop, > otherwise it's just dead code. Sure, I will post it by new version. Thanks, Stanley Chu

  1   2   3   4   5   6   >