UFS patches for kernel v5.19
Subsystems (8)
Bart Van Assche
reviewerv2 cover UFS patches for kernel v5.19
Hi Martin,
This patch series includes the following changes:
- Separation of UFS core and UFS driver source code into separate directories.
- Split the ufshcd.h header file into two header files - one file that defines the interface with UFS drivers and another file with definitions only used in the core.
- Multiple source code cleanup patches.
- A few patches with minor functional changes.
Please consider these changes for kernel v5.19.
Thank you,
Bart.
Changes compared to v1:
* Added a new patch with a source code comment spelling fix.
* Included a HPB change in patch "Simplify statements that return a boolean".
* Removed a superfluous test from patch "Remove ufshcd_lrb.sense_buffer".
* Dropped patch "Remove the LUN quiescing code from ufshcd_wl_shutdown()".
* Fixed indentation in patch "Make the config_scaling_param calls type safe".
* Improved the description of patch "Remove locking from around single register writes".
* Modified patch "Minimize #include directives" such that the current order of #include directives is preserved.
* Fixed support for CONFIG_SCSI_UFS_HWMON=n in patch "Split the ufshcd.h header file".
* In patch "Split the drivers/scsi/ufs directory", moved the UFS source files from drivers/scsi/ufs/ into drivers/ufs/.
Bart Van Assche (29):
scsi: ufs: Fix a spelling error in a source code comment
scsi: ufs: Declare ufshcd_wait_for_register() static
scsi: ufs: Remove superfluous boolean conversions
scsi: ufs: Simplify statements that return a boolean
scsi: ufs: Remove ufshcd_lrb.sense_bufflen
scsi: ufs: Remove ufshcd_lrb.sense_buffer
scsi: ufs: Use get_unaligned_be16() instead of be16_to_cpup()
scsi: ufs: Remove the UFS_FIX() and END_FIX() macros
scsi: ufs: Rename struct ufs_dev_fix into ufs_dev_quirk
scsi: ufs: Declare the quirks array const
scsi: ufs: Invert the return value of ufshcd_is_hba_active()
scsi: ufs: Remove unused constants and code
scsi: ufs: Switch to aggregate initialization
scsi: ufs: Make the config_scaling_param calls type safe
scsi: ufs: Remove the driver version
scsi: ufs: Rename sdev_ufs_device into ufs_device_wlun
scsi: ufs: Use an SPDX license identifier in the Kconfig file
scsi: ufs: Remove paths from source code comments
scsi: ufs: Remove the TRUE and FALSE definitions
scsi: ufs: Remove locking from around single register writes
scsi: ufs: Introduce ufshcd_clkgate_delay_set()
scsi: ufs: qcom: Fix ufs_qcom_resume()
scsi: ufs: Remove unnecessary ufshcd-crypto.h include directives
scsi: ufs: Fix kernel-doc syntax in ufshcd.h
scsi: ufs: Minimize #include directives
scsi: ufs: Split the ufshcd.h header file
scsi: ufs: Move the struct ufs_ref_clk definition
scsi: ufs: Move the ufs_is_valid_unit_desc_lun() definition
scsi: ufs: Split the drivers/scsi/ufs directory
MAINTAINERS | 9 +-
drivers/Kconfig | 2 +
drivers/Makefile | 1 +
drivers/scsi/Kconfig | 1 -
drivers/scsi/Makefile | 1 -
drivers/scsi/ufs/Kconfig | 211 ----------
drivers/ufs/Kconfig | 30 ++
drivers/ufs/Makefile | 5 +
drivers/ufs/core/Kconfig | 60 +++
drivers/ufs/core/Makefile | 10 +
drivers/{scsi/ufs => ufs/core}/ufs-debugfs.c | 3 +-
drivers/{scsi/ufs => ufs/core}/ufs-debugfs.h | 0
.../ufs => ufs/core}/ufs-fault-injection.c | 0
.../ufs => ufs/core}/ufs-fault-injection.h | 0
drivers/{scsi/ufs => ufs/core}/ufs-hwmon.c | 3 +-
drivers/{scsi/ufs => ufs/core}/ufs-sysfs.c | 3 +-
drivers/{scsi/ufs => ufs/core}/ufs-sysfs.h | 3 +-
drivers/{scsi/ufs => ufs/core}/ufs_bsg.c | 6 +
drivers/{scsi/ufs => ufs/core}/ufs_bsg.h | 7 +-
.../{scsi/ufs => ufs/core}/ufshcd-crypto.c | 2 +-
.../{scsi/ufs => ufs/core}/ufshcd-crypto.h | 7 +-
drivers/ufs/core/ufshcd-priv.h | 298 ++++++++++++++
drivers/{scsi/ufs => ufs/core}/ufshcd.c | 236 +++++------
drivers/{scsi/ufs => ufs/core}/ufshpb.c | 16 +-
drivers/{scsi/ufs => ufs/core}/ufshpb.h | 0
drivers/ufs/host/Kconfig | 114 ++++++
drivers/{scsi/ufs => ufs/host}/Makefile | 12 -
drivers/{scsi/ufs => ufs/host}/cdns-pltfrm.c | 2 +-
.../{scsi/ufs => ufs/host}/tc-dwc-g210-pci.c | 3 +-
.../ufs => ufs/host}/tc-dwc-g210-pltfrm.c | 1 +
drivers/{scsi/ufs => ufs/host}/tc-dwc-g210.c | 6 +-
drivers/{scsi/ufs => ufs/host}/tc-dwc-g210.h | 2 +
drivers/{scsi/ufs => ufs/host}/ti-j721e-ufs.c | 0
drivers/{scsi/ufs => ufs/host}/ufs-exynos.c | 11 +-
drivers/{scsi/ufs => ufs/host}/ufs-exynos.h | 8 +-
drivers/{scsi/ufs => ufs/host}/ufs-hisi.c | 10 +-
drivers/{scsi/ufs => ufs/host}/ufs-hisi.h | 0
.../ufs => ufs/host}/ufs-mediatek-trace.h | 2 +-
drivers/{scsi/ufs => ufs/host}/ufs-mediatek.c | 37 +-
drivers/{scsi/ufs => ufs/host}/ufs-mediatek.h | 0
drivers/{scsi/ufs => ufs/host}/ufs-qcom-ice.c | 2 +-
drivers/{scsi/ufs => ufs/host}/ufs-qcom.c | 36 +-
drivers/{scsi/ufs => ufs/host}/ufs-qcom.h | 6 +-
drivers/{scsi/ufs => ufs/host}/ufshcd-dwc.c | 6 +-
drivers/{scsi/ufs => ufs/host}/ufshcd-dwc.h | 2 +
drivers/{scsi/ufs => ufs/host}/ufshcd-pci.c | 6 +-
.../{scsi/ufs => ufs/host}/ufshcd-pltfrm.c | 32 +-
.../{scsi/ufs => ufs/host}/ufshcd-pltfrm.h | 2 +-
drivers/{scsi/ufs => ufs/host}/ufshci-dwc.h | 0
{drivers/scsi/ufs => include/scsi}/ufs.h | 35 --
.../scsi/ufs => include/scsi}/ufs_quirks.h | 15 +-
{drivers/scsi/ufs => include/scsi}/ufshcd.h | 376 ++++--------------
{drivers/scsi/ufs => include/scsi}/ufshci.h | 2 +
{drivers/scsi/ufs => include/scsi}/unipro.h | 18 +-
54 files changed, 840 insertions(+), 820 deletions(-)
delete mode 100644 drivers/scsi/ufs/Kconfig
create mode 100644 drivers/ufs/Kconfig
create mode 100644 drivers/ufs/Makefile
create mode 100644 drivers/ufs/core/Kconfig
create mode 100644 drivers/ufs/core/Makefile
rename drivers/{scsi/ufs => ufs/core}/ufs-debugfs.c (99%)
rename drivers/{scsi/ufs => ufs/core}/ufs-debugfs.h (100%)
rename drivers/{scsi/ufs => ufs/core}/ufs-fault-injection.c (100%)
rename drivers/{scsi/ufs => ufs/core}/ufs-fault-injection.h (100%)
rename drivers/{scsi/ufs => ufs/core}/ufs-hwmon.c (98%)
rename drivers/{scsi/ufs => ufs/core}/ufs-sysfs.c (99%)
rename drivers/{scsi/ufs => ufs/core}/ufs-sysfs.h (95%)
rename drivers/{scsi/ufs => ufs/core}/ufs_bsg.c (97%)
rename drivers/{scsi/ufs => ufs/core}/ufs_bsg.h (77%)
rename drivers/{scsi/ufs => ufs/core}/ufshcd-crypto.c (99%)
rename drivers/{scsi/ufs => ufs/core}/ufshcd-crypto.h (94%)
create mode 100644 drivers/ufs/core/ufshcd-priv.h
rename drivers/{scsi/ufs => ufs/core}/ufshcd.c (98%)
rename drivers/{scsi/ufs => ufs/core}/ufshpb.c (99%)
rename drivers/{scsi/ufs => ufs/core}/ufshpb.h (100%)
create mode 100644 drivers/ufs/host/Kconfig
rename drivers/{scsi/ufs => ufs/host}/Makefile (56%)
rename drivers/{scsi/ufs => ufs/host}/cdns-pltfrm.c (99%)
rename drivers/{scsi/ufs => ufs/host}/tc-dwc-g210-pci.c (98%)
rename drivers/{scsi/ufs => ufs/host}/tc-dwc-g210-pltfrm.c (98%)
rename drivers/{scsi/ufs => ufs/host}/tc-dwc-g210.c (99%)
rename drivers/{scsi/ufs => ufs/host}/tc-dwc-g210.h (95%)
rename drivers/{scsi/ufs => ufs/host}/ti-j721e-ufs.c (100%)
rename drivers/{scsi/ufs => ufs/host}/ufs-exynos.c (99%)
rename drivers/{scsi/ufs => ufs/host}/ufs-exynos.h (97%)
rename drivers/{scsi/ufs => ufs/host}/ufs-hisi.c (99%)
rename drivers/{scsi/ufs => ufs/host}/ufs-hisi.h (100%)
rename drivers/{scsi/ufs => ufs/host}/ufs-mediatek-trace.h (93%)
rename drivers/{scsi/ufs => ufs/host}/ufs-mediatek.c (97%)
rename drivers/{scsi/ufs => ufs/host}/ufs-mediatek.h (100%)
rename drivers/{scsi/ufs => ufs/host}/ufs-qcom-ice.c (99%)
rename drivers/{scsi/ufs => ufs/host}/ufs-qcom.c (98%)
rename drivers/{scsi/ufs => ufs/host}/ufs-qcom.h (98%)
rename drivers/{scsi/ufs => ufs/host}/ufshcd-dwc.c (98%)
rename drivers/{scsi/ufs => ufs/host}/ufshcd-dwc.h (95%)
rename drivers/{scsi/ufs => ufs/host}/ufshcd-pci.c (99%)
rename drivers/{scsi/ufs => ufs/host}/ufshcd-pltfrm.c (94%)
rename drivers/{scsi/ufs => ufs/host}/ufshcd-pltfrm.h (98%)
rename drivers/{scsi/ufs => ufs/host}/ufshci-dwc.h (100%)
rename {drivers/scsi/ufs => include/scsi}/ufs.h (93%)
rename {drivers/scsi/ufs => include/scsi}/ufs_quirks.h (94%)
rename {drivers/scsi/ufs => include/scsi}/ufshcd.h (81%)
rename {drivers/scsi/ufs => include/scsi}/ufshci.h (99%)
rename {drivers/scsi/ufs => include/scsi}/unipro.h (98%)Bart Van Assche
reviewerPATCH v2 1/29 scsi: ufs: Fix a spelling error in a source code comment
Change one occurrence of "adpater" into "adapter".
--- drivers/scsi/ufs/unipro.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ufs/unipro.h +1 -1
@@ -103,7 +103,7 @@#define UNIPRO_CB_OFFSET (x) (0x8000 | x)/* -* PHY Adpater attributes +* PHY Adapter attributes */ #define PA_ACTIVETXDATALANES 0x1560#define PA_ACTIVERXDATALANES 0x1580
RE: [PATCH v2 01/29] scsi: ufs: Fix a spelling error in a source code comment
Quoted 4 lines
Change one occurrence of "adpater" into "adapter".
Signed-off-by Bart Van Assche <[email protected]>
Bart Van Assche
reviewerPATCH v2 2/29 scsi: ufs: Declare ufshcd_wait_for_register() static
In reply to Bart Van AsscheDeclare this function static since it is only used inside the ufshcd.c source file.
--- drivers/scsi/ufs/ufshcd.c | 2 +- drivers/scsi/ufs/ufshcd.h | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-)
drivers/scsi/ufs/ufshcd.c +1 -1
@@ -639,7 +639,7 @@ EXPORT_SYMBOL_GPL(ufshcd_delay_us);* Return: * -ETIMEDOUT on error, zero on success. */ -int ufshcd_wait_for_register (struct ufs_hba *hba,u32 reg,u32 mask, +static int ufshcd_wait_for_register (struct ufs_hba *hba,u32 reg,u32 mask,u32 val,unsigned long interval_us,unsigned long timeout_ms) {
drivers/scsi/ufs/ufshcd.h +0 -3
@@ -1030,9 +1030,6 @@ void ufshcd_remove(struct ufs_hba *);int ufshcd_uic_hibern8_enter (struct ufs_hba *hba);int ufshcd_uic_hibern8_exit (struct ufs_hba *hba);void ufshcd_delay_us (unsigned long us,unsigned long tolerance); -int ufshcd_wait_for_register (struct ufs_hba *hba,u32 reg,u32 mask, -u32 val,unsigned long interval_us, -unsigned long timeout_ms);void ufshcd_parse_dev_ref_clk_freq (struct ufs_hba *hba,struct clk *refclk);void ufshcd_update_evt_hist (struct ufs_hba *hba,u32 id,u32 val);void ufshcd_hba_stop (struct ufs_hba *hba);
Bart Van Assche
reviewerPATCH v2 3/29 scsi: ufs: Remove superfluous boolean conversions
In reply to Bart Van AsscheRemove "? true : false" if the preceding expression yields a boolean or if the result of the expression is assigned to a boolean since in these two cases the "? true : false" part is superfluous.
--- drivers/scsi/ufs/ufs-qcom.c | 3 +-- drivers/scsi/ufs/ufshcd.c | 9 ++++----- drivers/scsi/ufs/ufshcd.h | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-)
drivers/scsi/ufs/ufs-qcom.c +1 -2
@@ -299,8 +299,7 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba)struct ufs_qcom_host *host =ufshcd_get_variant (hba);struct phy *phy = host->generic_phy;int ret =0 ; -bool is_rate_B = (UFS_QCOM_LIMIT_HS_RATE ==PA_HS_MODE_B ) - ? true : false; +bool is_rate_B =UFS_QCOM_LIMIT_HS_RATE ==PA_HS_MODE_B ;/* Reset UFS Host Controller and PHY */ ret =ufs_qcom_host_reset (hba);
drivers/scsi/ufs/ufshcd.c +4 -5
@@ -712,8 +712,7 @@ static inline u32 ufshcd_get_ufs_version(struct ufs_hba *hba)*/ static inline bool ufshcd_is_device_present (struct ufs_hba *hba) { -return (ufshcd_readl (hba,REG_CONTROLLER_STATUS ) & -DEVICE_PRESENT ) ? true : false; +return ufshcd_readl (hba,REG_CONTROLLER_STATUS ) &DEVICE_PRESENT ; }/**
@@ -840,7 +839,7 @@ ufshcd_get_rsp_upiu_data_seg_len(struct utp_upiu_rsp *ucd_rsp_ptr)static inline bool ufshcd_is_exception_event (struct utp_upiu_rsp *ucd_rsp_ptr) {return be32_to_cpu (ucd_rsp_ptr->header.dword_2) & -MASK_RSP_EXCEPTION_EVENT ? true : false; +MASK_RSP_EXCEPTION_EVENT ; }/**
@@ -1350,7 +1349,7 @@ static int ufshcd_devfreq_target(struct device *dev, }/* Decide based on the rounded-off frequency and update */ - scale_up = (*freq == clki->max_freq) ? true : false; + scale_up = *freq == clki->max_freq;if (!scale_up) *freq = clki->min_freq;/* Update the frequency */
@@ -2800,7 +2799,7 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) lrbp->sense_buffer = cmd->sense_buffer; lrbp->task_tag = tag; lrbp->lun =ufshcd_scsi_to_upiu_lun (cmd->device->lun); - lrbp->intr_cmd = !ufshcd_is_intr_aggr_allowed (hba) ? true : false; + lrbp->intr_cmd = !ufshcd_is_intr_aggr_allowed (hba);ufshcd_prepare_lrbp_crypto (scsi_cmd_to_rq (cmd), lrbp);
drivers/scsi/ufs/ufshcd.h +1 -1
@@ -985,7 +985,7 @@ static inline bool ufshcd_is_auto_hibern8_supported(struct ufs_hba *hba)static inline bool ufshcd_is_auto_hibern8_enabled (struct ufs_hba *hba) { -return FIELD_GET (UFSHCI_AHIBERN8_TIMER_MASK , hba->ahit) ? true : false; +return FIELD_GET (UFSHCI_AHIBERN8_TIMER_MASK , hba->ahit); }static inline bool ufshcd_is_wb_allowed (struct ufs_hba *hba)
Bart Van Assche
reviewerPATCH v2 4/29 scsi: ufs: Simplify statements that return a boolean
In reply to Bart Van AsscheConvert "if (expr) return true; else return false;" into "return expr;" if either 'expr' is a boolean expression or the return type of the function is 'bool'.
--- drivers/scsi/ufs/ufs-qcom.h | 5 +---- drivers/scsi/ufs/ufshcd.c | 22 +++++----------------- drivers/scsi/ufs/ufshpb.c | 8 ++------ 3 files changed, 8 insertions(+), 27 deletions(-)
drivers/scsi/ufs/ufs-qcom.h +1 -4
@@ -239,10 +239,7 @@ int ufs_qcom_testbus_config(struct ufs_qcom_host *host);static inline bool ufs_qcom_cap_qunipro (struct ufs_qcom_host *host) { -if (host->caps &UFS_QCOM_CAP_QUNIPRO ) -return true; -else -return false; +return host->caps &UFS_QCOM_CAP_QUNIPRO ; }/* ufs-qcom-ice.c */
drivers/scsi/ufs/ufshcd.c +5 -17
@@ -939,10 +939,7 @@ static bool ufshcd_is_unipro_pa_params_tuning_req(struct ufs_hba *hba)* logic simple, we will only do manual tuning if local unipro version * doesn't support ver1.6 or later. */ -if (ufshcd_get_local_unipro_ver (hba) <UFS_UNIPRO_VER_1_6 ) -return true; -else -return false; +return ufshcd_get_local_unipro_ver (hba) <UFS_UNIPRO_VER_1_6 ; }/**
@@ -2216,10 +2213,7 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba)*/ static inline bool ufshcd_ready_for_uic_cmd (struct ufs_hba *hba) { -if (ufshcd_readl (hba,REG_CONTROLLER_STATUS ) &UIC_COMMAND_READY ) -return true; -else -return false; +return ufshcd_readl (hba,REG_CONTROLLER_STATUS ) &UIC_COMMAND_READY ; }/**
@@ -5781,10 +5775,7 @@ static bool ufshcd_wb_presrv_usrspc_keep_vcc_on(struct ufs_hba *hba,return false; }/* Let it continue to flush when available buffer exceeds threshold */ -if (avail_buf < hba->vps->wb_flush_threshold) -return true; - -return false; +return avail_buf < hba->vps->wb_flush_threshold; }static void ufshcd_wb_force_disable (struct ufs_hba *hba)
@@ -5863,11 +5854,8 @@ static bool ufshcd_wb_need_flush(struct ufs_hba *hba)return false; } -if (!hba->dev_info.b_presrv_uspc_en) { -if (avail_buf <=UFS_WB_BUF_REMAIN_PERCENT (10 )) -return true; -return false; - } +if (!hba->dev_info.b_presrv_uspc_en) +return avail_buf <=UFS_WB_BUF_REMAIN_PERCENT (10 );return ufshcd_wb_presrv_usrspc_keep_vcc_on (hba, avail_buf); }
drivers/scsi/ufs/ufshpb.c +2 -6
@@ -90,12 +90,8 @@ static bool ufshpb_is_general_lun(int lun)static bool ufshpb_is_pinned_region (struct ufshpb_lu *hpb,int rgn_idx) { -if (hpb->lu_pinned_end !=PINNED_NOT_SET && - rgn_idx >= hpb->lu_pinned_start && - rgn_idx <= hpb->lu_pinned_end) -return true; - -return false; +return hpb->lu_pinned_end !=PINNED_NOT_SET && + rgn_idx >= hpb->lu_pinned_start && rgn_idx <= hpb->lu_pinned_end; }static void ufshpb_kick_map_work (struct ufshpb_lu *hpb)
RE: [PATCH v2 04/29] scsi: ufs: Simplify statements that return a boolean
Hi Bart,
Quoted 3 lines
Convert "if (expr) return true; else return false;" into "return expr;" if either 'expr' is a boolean expression or the return type of the function is 'bool'.
How about adding ufshcd_is_pwr_mode_restore_needed()?
Best Regards,
Keoseong Park
Quoted 99 lines
Reviewed-by Bjorn Andersson <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/ufs/ufs-qcom.h | 5 +---- drivers/scsi/ufs/ufshcd.c | 22 +++++----------------- drivers/scsi/ufs/ufshpb.c | 8 ++------ 3 files changed, 8 insertions(+), 27 deletions(-)drivers/scsi/ufs/ufs-qcom.h +1
-4@@ -239,10 +239,7 @@ int ufs_qcom_testbus_config(struct ufs_qcom_host *host);static inline bool ufs_qcom_cap_qunipro (struct ufs_qcom_host *host) { -if (host->caps &UFS_QCOM_CAP_QUNIPRO ) -return true; -else -return false; +return host->caps &UFS_QCOM_CAP_QUNIPRO ; }/* ufs-qcom-ice.c */ drivers/scsi/ufs/ufshcd.c +5
-17@@ -939,10 +939,7 @@ static bool ufshcd_is_unipro_pa_params_tuning_req(struct ufs_hba *hba)* logic simple, we will only do manual tuning if local unipro version * doesn't support ver1.6 or later. */ -if (ufshcd_get_local_unipro_ver (hba) <UFS_UNIPRO_VER_1_6 ) -return true; -else -return false; +return ufshcd_get_local_unipro_ver (hba) <UFS_UNIPRO_VER_1_6 ; }/** @@ -2216,10 +2213,7 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba)*/ static inline bool ufshcd_ready_for_uic_cmd (struct ufs_hba *hba) { -if (ufshcd_readl (hba,REG_CONTROLLER_STATUS ) &UIC_COMMAND_READY ) -return true; -else -return false; +return ufshcd_readl (hba,REG_CONTROLLER_STATUS ) &UIC_COMMAND_READY ; }/** @@ -5781,10 +5775,7 @@ static bool ufshcd_wb_presrv_usrspc_keep_vcc_on(struct ufs_hba *hba,return false; }/* Let it continue to flush when available buffer exceeds threshold */ -if (avail_buf < hba->vps->wb_flush_threshold) -return true; - -return false; +return avail_buf < hba->vps->wb_flush_threshold; }static void ufshcd_wb_force_disable (struct ufs_hba *hba)@@ -5863,11 +5854,8 @@ static bool ufshcd_wb_need_flush(struct ufs_hba *hba)return false; } -if (!hba->dev_info.b_presrv_uspc_en) { -if (avail_buf <=UFS_WB_BUF_REMAIN_PERCENT (10 )) -return true; -return false; - } +if (!hba->dev_info.b_presrv_uspc_en) +return avail_buf <=UFS_WB_BUF_REMAIN_PERCENT (10 );return ufshcd_wb_presrv_usrspc_keep_vcc_on (hba, avail_buf); }drivers/scsi/ufs/ufshpb.c +2
-6@@ -90,12 +90,8 @@ static bool ufshpb_is_general_lun(int lun)static bool ufshpb_is_pinned_region (struct ufshpb_lu *hpb,int rgn_idx) { -if (hpb->lu_pinned_end !=PINNED_NOT_SET && - rgn_idx >= hpb->lu_pinned_start && - rgn_idx <= hpb->lu_pinned_end) -return true; - -return false; +return hpb->lu_pinned_end !=PINNED_NOT_SET && + rgn_idx >= hpb->lu_pinned_start && rgn_idx <= hpb->lu_pinned_end; }static void ufshpb_kick_map_work (struct ufshpb_lu *hpb)
Bart Van Assche
reviewerRe: [PATCH v2 04/29] scsi: ufs: Simplify statements that return a boolean
Quoted 7 lines · Keoseong Park
Hi Bart,
Quoted 3 lines
Convert "if (expr) return true; else return false;" into "return expr;" if either 'expr' is a boolean expression or the return type of the function is 'bool'.
How about adding
ufshcd_is_pwr_mode_restore_needed()?
Hi Keoseong,
I'd like to keep that function as-is because it has three return statements instead of two.
Thanks,
Bart.
Keoseong Park
Reviewed-byRE: [PATCH v2 04/29] scsi: ufs: Simplify statements that return a boolean
Quoted 9 lines · Keoseong Park
Quoted 7 lines
Hi Bart,
Quoted 3 lines
Convert "if (expr) return true; else return false;" into "return expr;" if either 'expr' is a boolean expression or the return type of the function is 'bool'.
How about adding
ufshcd_is_pwr_mode_restore_needed()?
Quoted 8 lines
Hi Keoseong,
I'd like to keep that function as-is because it has three return statements instead of two.
Thanks,
Bart.
I get it.
Best Regards,
Keoseong Park
Bart Van Assche
reviewerPATCH v2 5/29 scsi: ufs: Remove ufshcd_lrb.sense_bufflen
In reply to Bart Van Asscheufshcd_lrb.sense_bufflen is set but never read. Hence remove this struct member.
--- drivers/scsi/ufs/ufshcd.c | 3 --- drivers/scsi/ufs/ufshcd.h | 2 -- 2 files changed, 5 deletions(-)
drivers/scsi/ufs/ufshcd.c +0 -3
@@ -2789,7 +2789,6 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) lrbp = &hba->lrb[tag];WARN_ON (lrbp->cmd); lrbp->cmd = cmd; - lrbp->sense_bufflen =UFS_SENSE_SIZE ; lrbp->sense_buffer = cmd->sense_buffer; lrbp->task_tag = tag; lrbp->lun =ufshcd_scsi_to_upiu_lun (cmd->device->lun);
@@ -2830,7 +2829,6 @@ static int ufshcd_compose_dev_cmd(struct ufs_hba *hba, struct ufshcd_lrb *lrbp, enum dev_cmd_type cmd_type, int tag) { lrbp->cmd = NULL; - lrbp->sense_bufflen =0 ; lrbp->sense_buffer =NULL ; lrbp->task_tag = tag; lrbp->lun =0 ;/* device management cmd is not specific to any LUN */
@@ -6802,7 +6800,6 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba, lrbp = &hba->lrb[tag];WARN_ON (lrbp->cmd); lrbp->cmd =NULL ; - lrbp->sense_bufflen =0 ; lrbp->sense_buffer =NULL ; lrbp->task_tag = tag; lrbp->lun =0 ;
drivers/scsi/ufs/ufshcd.h +0 -2
@@ -182,7 +182,6 @@ struct ufs_pm_lvl_states {* @ucd_req_dma_addr: UPIU request dma address for debug * @cmd: pointer to SCSI command * @sense_buffer: pointer to sense buffer address of the SCSI command -* @sense_bufflen: Length of the sense buffer * @scsi_status: SCSI status of the command * @command_type: SCSI, UFS, Query. * @task_tag: Task tag of the command
@@ -207,7 +206,6 @@ struct ufshcd_lrb {struct scsi_cmnd *cmd;u8 *sense_buffer; -unsigned int sense_bufflen;int scsi_status;int command_type;
Bart Van Assche
reviewerPATCH v2 6/29 scsi: ufs: Remove ufshcd_lrb.sense_buffer
In reply to Bart Van Asscheufshcd_lrb.sense_buffer is NULL if ufshcd_lrb.cmd is NULL and ufshcd_lrb.sense_buffer points at cmd->sense_buffer if ufshcd_lrb.cmd is set. In other words, the ufshcd_lrb.sense_buffer member is identical to cmd->sense_buffer. Hence this patch that removes the ufshcd_lrb.sense_buffer structure member.
--- drivers/scsi/ufs/ufshcd.c | 9 ++++----- drivers/scsi/ufs/ufshcd.h | 2 -- 2 files changed, 4 insertions(+), 7 deletions(-)
drivers/scsi/ufs/ufshcd.c +4 -5
@@ -2127,15 +2127,17 @@ void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag)*/ static inline void ufshcd_copy_sense_data (struct ufshcd_lrb *lrbp) { +u8 *const sense_buffer = lrbp->cmd->sense_buffer;int len; -if (lrbp->sense_buffer && + +if (sense_buffer &&ufshcd_get_rsp_upiu_data_seg_len (lrbp->ucd_rsp_ptr)) {int len_to_copy; len =be16_to_cpu (lrbp->ucd_rsp_ptr->sr.sense_data_len); len_to_copy =min_t (int,UFS_SENSE_SIZE , len); -memcpy (lrbp->sense_buffer, lrbp->ucd_rsp_ptr->sr.sense_data, +memcpy (sense_buffer, lrbp->ucd_rsp_ptr->sr.sense_data, len_to_copy); } }
@@ -2789,7 +2791,6 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) lrbp = &hba->lrb[tag];WARN_ON (lrbp->cmd); lrbp->cmd = cmd; - lrbp->sense_buffer = cmd->sense_buffer; lrbp->task_tag = tag; lrbp->lun =ufshcd_scsi_to_upiu_lun (cmd->device->lun); lrbp->intr_cmd = !ufshcd_is_intr_aggr_allowed (hba);
@@ -2829,7 +2830,6 @@ static int ufshcd_compose_dev_cmd(struct ufs_hba *hba, struct ufshcd_lrb *lrbp, enum dev_cmd_type cmd_type, int tag) { lrbp->cmd = NULL; - lrbp->sense_buffer =NULL ; lrbp->task_tag = tag; lrbp->lun =0 ;/* device management cmd is not specific to any LUN */ lrbp->intr_cmd = true;/* No interrupt aggregation */
@@ -6800,7 +6800,6 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba, lrbp = &hba->lrb[tag];WARN_ON (lrbp->cmd); lrbp->cmd =NULL ; - lrbp->sense_buffer =NULL ; lrbp->task_tag = tag; lrbp->lun =0 ; lrbp->intr_cmd = true;
drivers/scsi/ufs/ufshcd.h +0 -2
@@ -181,7 +181,6 @@ struct ufs_pm_lvl_states {* @ucd_rsp_dma_addr: UPIU response dma address for debug * @ucd_req_dma_addr: UPIU request dma address for debug * @cmd: pointer to SCSI command -* @sense_buffer: pointer to sense buffer address of the SCSI command * @scsi_status: SCSI status of the command * @command_type: SCSI, UFS, Query. * @task_tag: Task tag of the command
@@ -205,7 +204,6 @@ struct ufshcd_lrb {dma_addr_t ucd_prdt_dma_addr;struct scsi_cmnd *cmd; -u8 *sense_buffer;int scsi_status;int command_type;
RE: [PATCH v2 06/29] scsi: ufs: Remove ufshcd_lrb.sense_buffer
Quoted 8 lines
ufshcd_lrb.sense_buffer is NULL if ufshcd_lrb.cmd is NULL and ufshcd_lrb.sense_buffer points at
cmd->sense_bufferif ufshcd_lrb.cmd is set. In other words, the ufshcd_lrb.sense_buffer member is identical tocmd->sense_buffer. Hence this patch that removes the ufshcd_lrb.sense_buffer structure member.Signed-off-by Bart Van Assche <[email protected]>
Bart Van Assche
reviewerPATCH v2 7/29 scsi: ufs: Use get_unaligned_be16() instead of be16_to_cpup()
In reply to Bart Van AsscheUse get_unaligned_be16(...) instead of the equivalent but harder to read be16_to_cpup((__be16 *)...).
--- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ufs/ufshcd.c +1 -1
@@ -7334,7 +7334,7 @@ static u32 ufshcd_get_max_icc_level(int sup_curr_uA, u32 start_scan, char *buff)u16 unit;for (i = start_scan; i >=0 ; i--) { - data =be16_to_cpup ((__be16 *)&buff[2 * i]); + data =get_unaligned_be16 (&buff[2 * i]); unit = (data &ATTR_ICC_LVL_UNIT_MASK ) >>ATTR_ICC_LVL_UNIT_OFFSET ; curr_uA = data &ATTR_ICC_LVL_VALUE_MASK ;
Re: [PATCH v2 07/29] scsi: ufs: Use get_unaligned_be16() instead of be16_to_cpup()
Quoted 14 lines · Bart Van Assche
Use
get_unaligned_be16(...)instead of the equivalent but harder to readbe16_to_cpup((__be16 *)...).Reviewed-by Bean Huo <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/ufs/ufshcd.c +0
-0
drivers/scsi/ufs/ufshcd.c static u32 ufshcd_get_max_icc_level(int sup_curr_uA, u32 start_scan, char *buff) · line 7337
Quoted 5 lines
drivers/scsi/ufs/ufshcd.c +1
-1@@ -7334,7 +7334,7 @@ static u32 ufshcd_get_max_icc_level(int sup_curr_uA, u32 start_scan, char *buff)u16 unit;for (i = start_scan; i >=0 ; i--) { - data =be16_to_cpup ((__be16 *)&buff[2 * i]); + data =get_unaligned_be16 (&buff[2 * i]);
This is not "equivalent". get_unaligned_be16() works on unaligned values whereas be16_to_cpup() assumes a naturally aligned value. This patch might still be the right thing to do, but the explanation is not correct.
- Eric
Bart Van Assche
reviewerRe: [PATCH v2 07/29] scsi: ufs: Use get_unaligned_be16() instead of be16_to_cpup()
Quoted 17 lines · Eric Biggers
Quoted 16 lines · Bart Van Assche
Use
get_unaligned_be16(...)instead of the equivalent but harder to readbe16_to_cpup((__be16 *)...).Reviewed-by Bean Huo <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/ufs/ufshcd.c +0
-0@@ -7334,7 +7334,7 @@ static u32 ufshcd_get_max_icc_level(int sup_curr_uA, u32 start_scan, char *buff)u16 unit;
Quoted 7 lines
drivers/scsi/ufs/ufshcd.c static u32 ufshcd_get_max_icc_level(int sup_curr_uA, u32 start_scan, char *buff) · line 7337
Quoted 3 lines
drivers/scsi/ufs/ufshcd.c +1
-1for (i = start_scan; i >=0 ; i--) { - data =be16_to_cpup ((__be16 *)&buff[2 * i]); + data =get_unaligned_be16 (&buff[2 * i]);This is not "equivalent".
get_unaligned_be16()works on unaligned values whereasbe16_to_cpup()assumes a naturally aligned value. This patch might still be the right thing to do, but the explanation is not correct.
This is what I found in an English dictionary for the word equivalent:
"corresponding or virtually identical especially in effect or function". The effect of this patch is that the same value will be stored in 'data' as without this patch. Additionally, no runtime error will be generated with the patch applied if the original code did not trigger a runtime exception. I think that how I used the word "equivalent" is consistent with the explanation I found in an English dictionary.
Thanks,
Bart.
Bart Van Assche
reviewerPATCH v2 8/29 scsi: ufs: Remove the UFS_FIX() and END_FIX() macros
In reply to Bart Van AsscheSince these two macros reduce code readability, remove these two macros.
--- drivers/scsi/ufs/ufs-mediatek.c | 12 +++++---- drivers/scsi/ufs/ufs_quirks.h | 9 ------- drivers/scsi/ufs/ufshcd.c | 43 +++++++++++++++++++-------------- 3 files changed, 32 insertions(+), 32 deletions(-)
drivers/scsi/ufs/ufs-mediatek.c +7 -5
@@ -45,11 +45,13 @@ ufs_mtk_smc(UFS_MTK_SIP_DEVICE_RESET, high, res)static struct ufs_dev_fix ufs_mtk_dev_fixups[] = { -UFS_FIX (UFS_VENDOR_MICRON ,UFS_ANY_MODEL , -UFS_DEVICE_QUIRK_DELAY_AFTER_LPM ), -UFS_FIX (UFS_VENDOR_SKHYNIX ,"H9HQ21AFAMZDAR" , -UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES ), -END_FIX + { .wmanufacturerid =UFS_VENDOR_MICRON , + .model =UFS_ANY_MODEL , + .quirk =UFS_DEVICE_QUIRK_DELAY_AFTER_LPM }, + { .wmanufacturerid =UFS_VENDOR_SKHYNIX , + .model ="H9HQ21AFAMZDAR" , + .quirk =UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES }, + {} };static const struct of_device_id ufs_mtk_of_match[] = {
drivers/scsi/ufs/ufs_quirks.h +0 -9
@@ -29,15 +29,6 @@ struct ufs_dev_fix {unsigned int quirk; }; -#define END_FIX { } - -/* add specific device quirk */ -#define UFS_FIX (_vendor, _model, _quirk) { \ - .wmanufacturerid = (_vendor),\ - .model = (_model), \ - .quirk = (_quirk), \ -} -/* * Some vendor's UFS device sends back to back NACs for the DL data frames * causing the host controller to raise the DFES error status. Sometimes
drivers/scsi/ufs/ufshcd.c +25 -18
49 lines not on this page · raw message
Bart Van Assche
reviewerPATCH v2 9/29 scsi: ufs: Rename struct ufs_dev_fix into ufs_dev_quirk
In reply to Bart Van AsscheSince struct ufs_dev_fix contains quirk information, rename it into struct ufs_dev_quirk.
--- drivers/scsi/ufs/ufs-mediatek.c | 2 +- drivers/scsi/ufs/ufs_quirks.h | 4 ++-- drivers/scsi/ufs/ufshcd.c | 6 +++--- drivers/scsi/ufs/ufshcd.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-)
drivers/scsi/ufs/ufs-mediatek.c +1 -1
@@ -44,7 +44,7 @@#define ufs_mtk_device_reset_ctrl (high, res) \ ufs_mtk_smc(UFS_MTK_SIP_DEVICE_RESET, high, res) -static struct ufs_dev_fix ufs_mtk_dev_fixups[] = { +static struct ufs_dev_quirk ufs_mtk_dev_fixups[] = { { .wmanufacturerid =UFS_VENDOR_MICRON , .model =UFS_ANY_MODEL , .quirk =UFS_DEVICE_QUIRK_DELAY_AFTER_LPM },
drivers/scsi/ufs/ufs_quirks.h +2 -2
@@ -19,11 +19,11 @@#define UFS_VENDOR_WDC 0x145/** -* ufs_dev_fix - ufs device quirk info +* ufs_dev_quirk - ufs device quirk info * @card: ufs card details * @quirk: device quirk */ -struct ufs_dev_fix { +struct ufs_dev_quirk {u16 wmanufacturerid;u8 *model;unsigned int quirk;
drivers/scsi/ufs/ufshcd.c +3 -3
@@ -204,7 +204,7 @@ ufs_get_desired_pm_lvl_for_dev_link_state(enum ufs_dev_pwr_mode dev_state,return UFS_PM_LVL_0 ; } -static struct ufs_dev_fix ufs_fixups[] = { +static struct ufs_dev_quirk ufs_fixups[] = {/* UFS cards deviations table */ { .wmanufacturerid =UFS_VENDOR_MICRON , .model =UFS_ANY_MODEL ,
@@ -7624,9 +7624,9 @@ static void ufshcd_temp_notif_probe(struct ufs_hba *hba, u8 *desc_buf) } } -void ufshcd_fixup_dev_quirks (struct ufs_hba *hba,struct ufs_dev_fix *fixups) +void ufshcd_fixup_dev_quirks (struct ufs_hba *hba,struct ufs_dev_quirk *fixups) { -struct ufs_dev_fix *f; +struct ufs_dev_quirk *f;struct ufs_dev_info *dev_info = &hba->dev_info;if (!fixups)
drivers/scsi/ufs/ufshcd.h +1 -1
@@ -1180,7 +1180,7 @@ int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode,void ufshcd_auto_hibern8_enable (struct ufs_hba *hba);void ufshcd_auto_hibern8_update (struct ufs_hba *hba,u32 ahit); -void ufshcd_fixup_dev_quirks (struct ufs_hba *hba,struct ufs_dev_fix *fixups); +void ufshcd_fixup_dev_quirks (struct ufs_hba *hba,struct ufs_dev_quirk *fixups);#define SD_ASCII_STD true#define SD_RAW false int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index,
Bart Van Assche
reviewerPATCH v2 10/29 scsi: ufs: Declare the quirks array const
In reply to Bart Van AsscheDeclare the quirks array and also its 'model' member const to make it explicit that these are not modified.
--- drivers/scsi/ufs/ufs-mediatek.c | 2 +- drivers/scsi/ufs/ufs_quirks.h | 2 +- drivers/scsi/ufs/ufshcd.c | 7 ++++--- drivers/scsi/ufs/ufshcd.h | 3 ++- 4 files changed, 8 insertions(+), 6 deletions(-)
drivers/scsi/ufs/ufs-mediatek.c +1 -1
@@ -44,7 +44,7 @@#define ufs_mtk_device_reset_ctrl (high, res) \ ufs_mtk_smc(UFS_MTK_SIP_DEVICE_RESET, high, res) -static struct ufs_dev_quirk ufs_mtk_dev_fixups[] = { +static const struct ufs_dev_quirk ufs_mtk_dev_fixups[] = { { .wmanufacturerid =UFS_VENDOR_MICRON , .model =UFS_ANY_MODEL , .quirk =UFS_DEVICE_QUIRK_DELAY_AFTER_LPM },
drivers/scsi/ufs/ufs_quirks.h +1 -1
@@ -25,7 +25,7 @@*/ struct ufs_dev_quirk {u16 wmanufacturerid; -u8 *model; +const u8 *model;unsigned int quirk; };
drivers/scsi/ufs/ufshcd.c +4 -3
@@ -204,7 +204,7 @@ ufs_get_desired_pm_lvl_for_dev_link_state(enum ufs_dev_pwr_mode dev_state,return UFS_PM_LVL_0 ; } -static struct ufs_dev_quirk ufs_fixups[] = { +static const struct ufs_dev_quirk ufs_fixups[] = {/* UFS cards deviations table */ { .wmanufacturerid =UFS_VENDOR_MICRON , .model =UFS_ANY_MODEL ,
@@ -7624,9 +7624,10 @@ static void ufshcd_temp_notif_probe(struct ufs_hba *hba, u8 *desc_buf) } } -void ufshcd_fixup_dev_quirks (struct ufs_hba *hba,struct ufs_dev_quirk *fixups) +void ufshcd_fixup_dev_quirks (struct ufs_hba *hba, +const struct ufs_dev_quirk *fixups) { -struct ufs_dev_quirk *f; +const struct ufs_dev_quirk *f;struct ufs_dev_info *dev_info = &hba->dev_info;if (!fixups)
drivers/scsi/ufs/ufshcd.h +2 -1
@@ -1180,7 +1180,8 @@ int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode,void ufshcd_auto_hibern8_enable (struct ufs_hba *hba);void ufshcd_auto_hibern8_update (struct ufs_hba *hba,u32 ahit); -void ufshcd_fixup_dev_quirks (struct ufs_hba *hba,struct ufs_dev_quirk *fixups); +void ufshcd_fixup_dev_quirks (struct ufs_hba *hba, +const struct ufs_dev_quirk *fixups);#define SD_ASCII_STD true#define SD_RAW false int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index,
Bart Van Assche
reviewerPATCH v2 11/29 scsi: ufs: Invert the return value of ufshcd_is_hba_active()
In reply to Bart Van AsscheIt is confusing that ufshcd_is_hba_active() returns 'true' if the HBA is not active. Clear up this confusion by inverting the return value of ufshcd_is_hba_active(). This patch does not change any functionality.
--- drivers/scsi/ufs/ufshcd.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/scsi/ufs/ufshcd.c +4 -5
@@ -917,12 +917,11 @@ static inline void ufshcd_hba_start(struct ufs_hba *hba)* ufshcd_is_hba_active - Get controller state * @hba: per adapter instance * -* Returns false if controller is active, true otherwise +* Returns true if and only if the controller is active. */ static inline bool ufshcd_is_hba_active (struct ufs_hba *hba) { -return (ufshcd_readl (hba,REG_CONTROLLER_ENABLE ) &CONTROLLER_ENABLE ) - ? false : true; +return ufshcd_readl (hba,REG_CONTROLLER_ENABLE ) &CONTROLLER_ENABLE ; }u32 ufshcd_get_local_unipro_ver (struct ufs_hba *hba)
@@ -4552,7 +4551,7 @@ static int ufshcd_hba_execute_hce(struct ufs_hba *hba)int retry_inner; start: -if (!ufshcd_is_hba_active (hba)) +if (ufshcd_is_hba_active (hba))/* change controller state to "reset state" */ ufshcd_hba_stop (hba);
@@ -4578,7 +4577,7 @@ static int ufshcd_hba_execute_hce(struct ufs_hba *hba)/* wait for the host controller to complete initialization */ retry_inner =50 ; -while (ufshcd_is_hba_active (hba)) { +while (!ufshcd_is_hba_active (hba)) {if (retry_inner) { retry_inner--; }else {
Bart Van Assche
reviewerPATCH v2 12/29 scsi: ufs: Remove unused constants and code
In reply to Bart Van AsscheCommit 5b44a07b6bb2 ("scsi: ufs: Remove pre-defined initial voltage values of device power") removed the code that uses the UFS_VREG_VCC* constants and also the code that sets the min_uV and max_uV member variables. Hence also remove these constants and that member variable.
--- drivers/scsi/ufs/ufs.h | 11 ----------- drivers/scsi/ufs/ufshcd.c | 29 +++-------------------------- 2 files changed, 3 insertions(+), 37 deletions(-)
drivers/scsi/ufs/ufs.h +0 -11
@@ -562,15 +562,6 @@ struct ufs_query_res {struct utp_upiu_query upiu_res; }; -#define UFS_VREG_VCC_MIN_UV 2700000/* uV */ -#define UFS_VREG_VCC_MAX_UV 3600000/* uV */ -#define UFS_VREG_VCC_1P8_MIN_UV 1700000/* uV */ -#define UFS_VREG_VCC_1P8_MAX_UV 1950000/* uV */ -#define UFS_VREG_VCCQ_MIN_UV 1140000/* uV */ -#define UFS_VREG_VCCQ_MAX_UV 1260000/* uV */ -#define UFS_VREG_VCCQ2_MIN_UV 1700000/* uV */ -#define UFS_VREG_VCCQ2_MAX_UV 1950000/* uV */ -/* * VCCQ & VCCQ2 current requirement when UFS device is in sleep state * and link is in Hibern8 state.
@@ -582,8 +573,6 @@ struct ufs_vreg {const char *name;bool always_on;bool enabled; -int min_uV; -int max_uV;int max_uA; };
drivers/scsi/ufs/ufshcd.c +3 -26
@@ -8309,33 +8309,10 @@ static inline int ufshcd_config_vreg_hpm(struct ufs_hba *hba,static int ufshcd_config_vreg (struct device *dev,struct ufs_vreg *vreg,bool on) { -int ret =0 ; -struct regulator *reg; -const char *name; -int min_uV, uA_load; - -BUG_ON (!vreg); - - reg = vreg->reg; - name = vreg->name; - -if (regulator_count_voltages (reg) >0 ) { - uA_load = on ? vreg->max_uA :0 ; - ret =ufshcd_config_vreg_load (dev, vreg, uA_load); -if (ret) - goto out; +if (regulator_count_voltages (vreg->reg) <=0 ) +return 0 ; -if (vreg->min_uV && vreg->max_uV) { - min_uV = on ? vreg->min_uV :0 ; - ret =regulator_set_voltage (reg, min_uV, vreg->max_uV); -if (ret) -dev_err (dev, -"%s: %s set voltage failed, err=%d\n" , - __func__, name, ret); - } - } -out: -return ret; +return ufshcd_config_vreg_load (dev, vreg, on ? vreg->max_uA :0 ); }static int ufshcd_enable_vreg (struct device *dev,struct ufs_vreg *vreg)
Bart Van Assche
reviewerPATCH v2 13/29 scsi: ufs: Switch to aggregate initialization
In reply to Bart Van AsscheMake it easier to verify for humans that ufshcd_init_pwr_dev_param() initializes all structure members. This patch does not change any functionality.
--- drivers/scsi/ufs/ufshcd-pltfrm.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
drivers/scsi/ufs/ufshcd-pltfrm.c +14 -12
@@ -297,18 +297,20 @@ EXPORT_SYMBOL_GPL(ufshcd_get_pwr_dev_param);void ufshcd_init_pwr_dev_param (struct ufs_dev_params *dev_param) { - dev_param->tx_lanes =2 ; - dev_param->rx_lanes =2 ; - dev_param->hs_rx_gear =UFS_HS_G3 ; - dev_param->hs_tx_gear =UFS_HS_G3 ; - dev_param->pwm_rx_gear =UFS_PWM_G4 ; - dev_param->pwm_tx_gear =UFS_PWM_G4 ; - dev_param->rx_pwr_pwm =SLOW_MODE ; - dev_param->tx_pwr_pwm =SLOW_MODE ; - dev_param->rx_pwr_hs =FAST_MODE ; - dev_param->tx_pwr_hs =FAST_MODE ; - dev_param->hs_rate =PA_HS_MODE_B ; - dev_param->desired_working_mode =UFS_HS_MODE ; + *dev_param = (struct ufs_dev_params ){ + .tx_lanes =2 , + .rx_lanes =2 , + .hs_rx_gear =UFS_HS_G3 , + .hs_tx_gear =UFS_HS_G3 , + .pwm_rx_gear =UFS_PWM_G4 , + .pwm_tx_gear =UFS_PWM_G4 , + .rx_pwr_pwm =SLOW_MODE , + .tx_pwr_pwm =SLOW_MODE , + .rx_pwr_hs =FAST_MODE , + .tx_pwr_hs =FAST_MODE , + .hs_rate =PA_HS_MODE_B , + .desired_working_mode =UFS_HS_MODE , + }; }EXPORT_SYMBOL_GPL (ufshcd_init_pwr_dev_param);
Bart Van Assche
reviewerPATCH v2 14/29 scsi: ufs: Make the config_scaling_param calls type safe
In reply to Bart Van AsschePass the actual type to config_scaling_param callback as the third argment instead of a void pointer. Remove a superfluous NULL pointer check from ufs_qcom_config_scaling_param().
--- drivers/scsi/ufs/ufs-qcom.c | 14 ++++---------- drivers/scsi/ufs/ufshcd.h | 10 +++++----- 2 files changed, 9 insertions(+), 15 deletions(-)
drivers/scsi/ufs/ufs-qcom.c +4 -10
@@ -1463,23 +1463,17 @@ static int ufs_qcom_device_reset(struct ufs_hba *hba)#if IS_ENABLED (CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND )static void ufs_qcom_config_scaling_param (struct ufs_hba *hba, -struct devfreq_dev_profile *p, -void *data) +struct devfreq_dev_profile *p, +struct devfreq_simple_ondemand_data *d) { -static struct devfreq_simple_ondemand_data *d; - -if (!data) -return ; - - d = (struct devfreq_simple_ondemand_data *)data; p->polling_ms =60 ; d->upthreshold =70 ; d->downdifferential =5 ; }#else static void ufs_qcom_config_scaling_param (struct ufs_hba *hba, -struct devfreq_dev_profile *p, -void *data) +struct devfreq_dev_profile *p, +struct devfreq_simple_ondemand_data *data) { }#endif
drivers/scsi/ufs/ufshcd.h +5 -5
@@ -348,8 +348,8 @@ struct ufs_hba_variant_ops {int (*phy_initialization)(struct ufs_hba *);int (*device_reset)(struct ufs_hba *hba);void (*config_scaling_param)(struct ufs_hba *hba, -struct devfreq_dev_profile *profile, -void *data); +struct devfreq_dev_profile *profile, +struct devfreq_simple_ondemand_data *data);int (*program_key)(struct ufs_hba *hba,const union ufs_crypto_cfg_entry *cfg,int slot); void (*event_notify)(struct ufs_hba *hba,
@@ -1360,11 +1360,11 @@ static inline int ufshcd_vops_device_reset(struct ufs_hba *hba) }static inline void ufshcd_vops_config_scaling_param (struct ufs_hba *hba, -struct devfreq_dev_profile - *profile,void *data) +struct devfreq_dev_profile *p, +struct devfreq_simple_ondemand_data *data) {if (hba->vops && hba->vops->config_scaling_param) - hba->vops->config_scaling_param (hba, profile, data); + hba->vops->config_scaling_param (hba, p, data); }extern struct ufs_pm_lvl_states ufs_pm_lvl_states[];
Bart Van Assche
reviewerPATCH v2 15/29 scsi: ufs: Remove the driver version
In reply to Bart Van AsscheThe current version number is 0.2. That driver version was assigned more than nine years ago. A version number that is not updated while the driver is updated is not useful. Hence remove the driver version number from the UFS driver. See also commit e0eca63e3421 ("[SCSI] ufs: Separate PCI code into glue driver").
--- drivers/scsi/ufs/cdns-pltfrm.c | 1 - drivers/scsi/ufs/ufshcd-pci.c | 1 - drivers/scsi/ufs/ufshcd-pltfrm.c | 1 - drivers/scsi/ufs/ufshcd.c | 1 - drivers/scsi/ufs/ufshcd.h | 1 - 5 files changed, 5 deletions(-)
drivers/scsi/ufs/cdns-pltfrm.c +0 -1
@@ -340,4 +340,3 @@ module_platform_driver(cdns_ufs_pltfrm_driver);MODULE_AUTHOR ("Jan Kotas <[email protected]>" );MODULE_DESCRIPTION ("Cadence UFS host controller platform driver" );MODULE_LICENSE ("GPL v2" ); -MODULE_VERSION (UFSHCD_DRIVER_VERSION );
drivers/scsi/ufs/ufshcd-pci.c +0 -1
@@ -601,4 +601,3 @@ MODULE_AUTHOR("Santosh Yaragnavi <[email protected]>");MODULE_AUTHOR ("Vinayak Holikatti <[email protected]>" );MODULE_DESCRIPTION ("UFS host controller PCI glue driver" );MODULE_LICENSE ("GPL" ); -MODULE_VERSION (UFSHCD_DRIVER_VERSION );
drivers/scsi/ufs/ufshcd-pltfrm.c +0 -1
@@ -386,4 +386,3 @@ MODULE_AUTHOR("Santosh Yaragnavi <[email protected]>");MODULE_AUTHOR ("Vinayak Holikatti <[email protected]>" );MODULE_DESCRIPTION ("UFS host controller Platform bus based glue driver" );MODULE_LICENSE ("GPL" ); -MODULE_VERSION (UFSHCD_DRIVER_VERSION );
drivers/scsi/ufs/ufshcd.c +0 -1
@@ -9923,4 +9923,3 @@ MODULE_AUTHOR("Santosh Yaragnavi <[email protected]>");MODULE_AUTHOR ("Vinayak Holikatti <[email protected]>" );MODULE_DESCRIPTION ("Generic UFS host controller driver Core" );MODULE_LICENSE ("GPL" ); -MODULE_VERSION (UFSHCD_DRIVER_VERSION );
drivers/scsi/ufs/ufshcd.h +0 -1
@@ -49,7 +49,6 @@#include "ufshci.h" #define UFSHCD "ufshcd" -#define UFSHCD_DRIVER_VERSION "0.2"struct ufs_hba ;
Bart Van Assche
reviewerPATCH v2 16/29 scsi: ufs: Rename sdev_ufs_device into ufs_device_wlun
In reply to Bart Van AsscheThe new name reflects the role of this member variable better: a WLUN through which the power mode of the UFS device is controlled.
--- drivers/scsi/ufs/ufshcd.c | 50 +++++++++++++++++++-------------------- drivers/scsi/ufs/ufshcd.h | 17 ++++++------- 2 files changed, 32 insertions(+), 35 deletions(-)
drivers/scsi/ufs/ufshcd.c +25 -25
@@ -540,7 +540,7 @@ static void ufshcd_print_tmrs(struct ufs_hba *hba, unsigned long bitmap)static void ufshcd_print_host_state (struct ufs_hba *hba) { -struct scsi_device *sdev_ufs = hba->sdev_ufs_device; +struct scsi_device *sdev_ufs = hba->ufs_device_wlun;dev_err (hba->dev,"UFS Host state=%d\n" , hba->ufshcd_state); dev_err(hba->dev, "outstanding reqs=0x%lx tasks=0x%lx\n",
@@ -4195,7 +4195,7 @@ void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit)spin_unlock_irqrestore (hba->host->host_lock, flags);if (update && - !pm_runtime_suspended (&hba->sdev_ufs_device->sdev_gendev)) { + !pm_runtime_suspended (&hba->ufs_device_wlun->sdev_gendev)) {ufshcd_rpm_get_sync (hba);ufshcd_hold (hba, false);ufshcd_auto_hibern8_enable (hba);
@@ -4911,13 +4911,13 @@ static void ufshcd_setup_links(struct ufs_hba *hba, struct scsi_device *sdev)* Device wlun is the supplier & rest of the luns are consumers. * This ensures that device wlun suspends after all other luns. */ -if (hba->sdev_ufs_device) { +if (hba->ufs_device_wlun) { link =device_link_add (&sdev->sdev_gendev, - &hba->sdev_ufs_device->sdev_gendev, + &hba->ufs_device_wlun->sdev_gendev,DL_FLAG_PM_RUNTIME |DL_FLAG_RPM_ACTIVE );if (!link) {dev_err (&sdev->sdev_gendev,"Failed establishing link - %s\n" , -dev_name (&hba->sdev_ufs_device->sdev_gendev)); +dev_name (&hba->ufs_device_wlun->sdev_gendev));return ; } hba->luns_avail--;
@@ -5053,15 +5053,15 @@ static void ufshcd_slave_destroy(struct scsi_device *sdev)/* Drop the reference as it won't be needed anymore */ if (ufshcd_scsi_to_upiu_lun (sdev->lun) ==UFS_UPIU_UFS_DEVICE_WLUN ) {spin_lock_irqsave (hba->host->host_lock, flags); - hba->sdev_ufs_device =NULL ; + hba->ufs_device_wlun =NULL ;spin_unlock_irqrestore (hba->host->host_lock, flags); - }else if (hba->sdev_ufs_device) { + }else if (hba->ufs_device_wlun) {struct device *supplier =NULL ;/* Ensure UFS Device WLUN exists and does not disappear */ spin_lock_irqsave (hba->host->host_lock, flags); -if (hba->sdev_ufs_device) { - supplier = &hba->sdev_ufs_device->sdev_gendev; +if (hba->ufs_device_wlun) { + supplier = &hba->ufs_device_wlun->sdev_gendev;get_device (supplier); }spin_unlock_irqrestore (hba->host->host_lock, flags);
@@ -6037,7 +6037,7 @@ static void ufshcd_clk_scaling_suspend(struct ufs_hba *hba, bool suspend)static void ufshcd_err_handling_prepare (struct ufs_hba *hba) {ufshcd_rpm_get_sync (hba); -if (pm_runtime_status_suspended (&hba->sdev_ufs_device->sdev_gendev) || +if (pm_runtime_status_suspended (&hba->ufs_device_wlun->sdev_gendev) || hba->is_sys_suspended) {enum ufs_pm_op pm_op;
@@ -6082,7 +6082,7 @@ static void ufshcd_err_handling_unprepare(struct ufs_hba *hba)static inline bool ufshcd_err_handling_should_stop (struct ufs_hba *hba) {return (!hba->is_powered || hba->shutting_down || - !hba->sdev_ufs_device || + !hba->ufs_device_wlun || hba->ufshcd_state ==UFSHCD_STATE_ERROR || (!(hba->saved_err || hba->saved_uic_err || hba->force_reset ||ufshcd_is_link_broken (hba))));
@@ -6101,7 +6101,7 @@ static void ufshcd_recover_pm_error(struct ufs_hba *hba)* Set RPM status of wlun device to RPM_ACTIVE, * this also clears its runtime error. */ - ret =pm_runtime_set_active (&hba->sdev_ufs_device->sdev_gendev); + ret =pm_runtime_set_active (&hba->ufs_device_wlun->sdev_gendev);/* hba device might have a runtime error otherwise */ if (ret)
@@ -7495,20 +7495,20 @@ static int ufshcd_scsi_add_wlus(struct ufs_hba *hba)int ret =0 ;struct scsi_device *sdev_boot, *sdev_rpmb; - hba->sdev_ufs_device =__scsi_add_device (hba->host,0 ,0 , + hba->ufs_device_wlun =__scsi_add_device (hba->host,0 ,0 ,ufshcd_upiu_wlun_to_scsi_wlun (UFS_UPIU_UFS_DEVICE_WLUN ),NULL ); -if (IS_ERR (hba->sdev_ufs_device)) { - ret =PTR_ERR (hba->sdev_ufs_device); - hba->sdev_ufs_device =NULL ; +if (IS_ERR (hba->ufs_device_wlun)) { + ret =PTR_ERR (hba->ufs_device_wlun); + hba->ufs_device_wlun =NULL ; goto out; } -scsi_device_put (hba->sdev_ufs_device); +scsi_device_put (hba->ufs_device_wlun); sdev_rpmb =__scsi_add_device (hba->host,0 ,0 ,ufshcd_upiu_wlun_to_scsi_wlun (UFS_UPIU_RPMB_WLUN ),NULL );if (IS_ERR (sdev_rpmb)) { ret =PTR_ERR (sdev_rpmb); - goto remove_sdev_ufs_device; + goto remove_ufs_device_wlun; }ufshcd_blk_pm_runtime_init (sdev_rpmb);scsi_device_put (sdev_rpmb);
@@ -7523,8 +7523,8 @@ static int ufshcd_scsi_add_wlus(struct ufs_hba *hba) } goto out; -remove_sdev_ufs_device: -scsi_remove_device (hba->sdev_ufs_device); +remove_ufs_device_wlun: +scsi_remove_device (hba->ufs_device_wlun); out:return ret; }
@@ -8660,7 +8660,7 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,int ret, retries;spin_lock_irqsave (hba->host->host_lock, flags); - sdp = hba->sdev_ufs_device; + sdp = hba->ufs_device_wlun;if (sdp) { ret =scsi_device_get (sdp);if (!ret && !scsi_device_online (sdp)) {
@@ -9224,7 +9224,7 @@ static void ufshcd_wl_shutdown(struct device *dev)ufshcd_rpm_get_sync (hba);scsi_device_quiesce (sdev);shost_for_each_device (sdev, hba->host) { -if (sdev == hba->sdev_ufs_device) +if (sdev == hba->ufs_device_wlun)continue ;scsi_device_quiesce (sdev); }
@@ -9445,7 +9445,7 @@ EXPORT_SYMBOL(ufshcd_shutdown);*/ void ufshcd_remove (struct ufs_hba *hba) { -if (hba->sdev_ufs_device) +if (hba->ufs_device_wlun)ufshcd_rpm_get_sync (hba);ufs_hwmon_remove (hba);ufs_bsg_remove (hba);
@@ -9773,7 +9773,7 @@ EXPORT_SYMBOL_GPL(ufshcd_resume_complete);static bool ufshcd_rpm_ok_for_spm (struct ufs_hba *hba) { -struct device *dev = &hba->sdev_ufs_device->sdev_gendev; +struct device *dev = &hba->ufs_device_wlun->sdev_gendev;enum ufs_dev_pwr_mode dev_pwr_mode;enum uic_link_state link_state;unsigned long flags;
@@ -9802,7 +9802,7 @@ int __ufshcd_suspend_prepare(struct device *dev, bool rpm_ok_for_spm)* if it's runtime suspended. But ufs doesn't follow that. * Refer ufshcd_resume_complete() */ -if (hba->sdev_ufs_device) { +if (hba->ufs_device_wlun) {/* Prevent runtime suspend */ ufshcd_rpm_get_noresume (hba);/*
drivers/scsi/ufs/ufshcd.h +7 -10
@@ -732,6 +732,7 @@ struct ufs_hba_monitor {* @utmrdl_dma_addr: UTMRDL DMA address * @host: Scsi_Host instance of the driver * @dev: device handle +* @ufs_device_wlun: WLUN that controls the entire UFS device. * @lrb: local reference block * @outstanding_tasks: Bits representing outstanding task requests * @outstanding_lock: Protects @outstanding_reqs.
@@ -799,11 +800,7 @@ struct ufs_hba {struct Scsi_Host *host;struct device *dev; -/* -* This field is to keep a reference to "scsi_device" corresponding to -* "UFS device" W-LU. -*/ -struct scsi_device *sdev_ufs_device; +struct scsi_device *ufs_device_wlun;#ifdef CONFIG_SCSI_UFS_HWMON struct device *hwmon_device;
@@ -1407,27 +1404,27 @@ static inline int ufshcd_update_ee_usr_mask(struct ufs_hba *hba,static inline int ufshcd_rpm_get_sync (struct ufs_hba *hba) { -return pm_runtime_get_sync (&hba->sdev_ufs_device->sdev_gendev); +return pm_runtime_get_sync (&hba->ufs_device_wlun->sdev_gendev); }static inline int ufshcd_rpm_put_sync (struct ufs_hba *hba) { -return pm_runtime_put_sync (&hba->sdev_ufs_device->sdev_gendev); +return pm_runtime_put_sync (&hba->ufs_device_wlun->sdev_gendev); }static inline void ufshcd_rpm_get_noresume (struct ufs_hba *hba) { -pm_runtime_get_noresume (&hba->sdev_ufs_device->sdev_gendev); +pm_runtime_get_noresume (&hba->ufs_device_wlun->sdev_gendev); }static inline int ufshcd_rpm_resume (struct ufs_hba *hba) { -return pm_runtime_resume (&hba->sdev_ufs_device->sdev_gendev); +return pm_runtime_resume (&hba->ufs_device_wlun->sdev_gendev); }static inline int ufshcd_rpm_put (struct ufs_hba *hba) { -return pm_runtime_put (&hba->sdev_ufs_device->sdev_gendev); +return pm_runtime_put (&hba->ufs_device_wlun->sdev_gendev); }#endif /* End of Header */
Bart Van Assche
reviewerPATCH v2 17/29 scsi: ufs: Use an SPDX license identifier in the Kconfig file
In reply to Bart Van AsscheAs requested in Documentation/process/license-rules.rst, use an SPDX license identifier.
--- drivers/scsi/ufs/Kconfig | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-)
drivers/scsi/ufs/Kconfig +1 -24
@@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0+ # # Kernel configuration file for the UFS Host Controller #
@@ -7,30 +8,6 @@ # Authors: # Santosh Yaraganavi <[email protected]> # Vinayak Holikatti <[email protected]> -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# See the COPYING file in the top-level directory or visit -# <http://www.gnu.org/licenses/gpl-2.0.html> -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# This program is provided "AS IS" and "WITH ALL FAULTS" and -# without warranty of any kind. You are solely responsible for -# determining the appropriateness of using and distributing -# the program and assume all risks associated with your exercise -# of rights with respect to the program, including but not limited -# to infringement of third party rights, the risks and costs of -# program errors, damage to or loss of data, programs or equipment, -# and unavailability or interruption of operations. Under no -# circumstances will the contributor of this Program be liable for -# any damages of any kind arising from your use or distribution of -# this program. config SCSI_UFSHCD tristate "Universal Flash Storage Controller Driver Core"
Bart Van Assche
reviewerPATCH v2 18/29 scsi: ufs: Remove paths from source code comments
In reply to Bart Van AsscheSince specifying the path in a source file is redundant, remove the paths from source code comments.
--- drivers/scsi/ufs/Kconfig | 1 - drivers/scsi/ufs/ufshcd-pci.c | 1 - drivers/scsi/ufs/unipro.h | 2 -- 3 files changed, 4 deletions(-)
drivers/scsi/ufs/Kconfig +0 -1
@@ -2,7 +2,6 @@ # # Kernel configuration file for the UFS Host Controller # -# This code is based on drivers/scsi/ufs/Kconfig # Copyright (C) 2011-2013 Samsung India Software Operations # # Authors:
drivers/scsi/ufs/ufshcd-pci.c +0 -1
@@ -2,7 +2,6 @@/* * Universal Flash Storage Host controller PCI glue driver * -* This code is based on drivers/scsi/ufs/ufshcd-pci.c * Copyright (C) 2011-2013 Samsung India Software Operations * * Authors:
drivers/scsi/ufs/unipro.h +0 -2
@@ -1,7 +1,5 @@/* SPDX-License-Identifier: GPL-2.0-or-later */ /* -* drivers/scsi/ufs/unipro.h -* * Copyright (C) 2013 Samsung Electronics Co., Ltd. */
Bart Van Assche
reviewerPATCH v2 19/29 scsi: ufs: Remove the TRUE and FALSE definitions
In reply to Bart Van AsscheIn the Linux kernel coding style document (Documentation/process/coding-style.rst) it is recommended to use the type 'bool' and also the values 'true' and 'false'. Hence this patch that removes the definitions and uses of TRUE and FALSE from the UFS driver.
--- drivers/scsi/ufs/ufs-exynos.c | 4 ++-- drivers/scsi/ufs/ufs-exynos.h | 8 ++++---- drivers/scsi/ufs/ufshcd.c | 8 ++++---- drivers/scsi/ufs/unipro.h | 14 -------------- 4 files changed, 10 insertions(+), 24 deletions(-)
drivers/scsi/ufs/ufs-exynos.c +2 -2
@@ -704,7 +704,7 @@ static void exynos_ufs_establish_connt(struct exynos_ufs *ufs)/* local unipro attributes */ ufshcd_dme_set (hba,UIC_ARG_MIB (N_DEVICEID ),DEV_ID ); -ufshcd_dme_set (hba,UIC_ARG_MIB (N_DEVICEID_VALID ), TRUE); +ufshcd_dme_set (hba,UIC_ARG_MIB (N_DEVICEID_VALID ), true);ufshcd_dme_set (hba,UIC_ARG_MIB (T_PEERDEVICEID ),PEER_DEV_ID );ufshcd_dme_set (hba,UIC_ARG_MIB (T_PEERCPORTID ),PEER_CPORT_ID );ufshcd_dme_set (hba,UIC_ARG_MIB (T_CPORTFLAGS ),CPORT_DEF_FLAGS );
@@ -1028,7 +1028,7 @@ static int exynos_ufs_post_link(struct ufs_hba *hba)if (ufs->opts &EXYNOS_UFS_OPT_SKIP_CONNECTION_ESTAB )ufshcd_dme_set (hba, -UIC_ARG_MIB (T_DBG_SKIP_INIT_HIBERN8_EXIT ), TRUE); +UIC_ARG_MIB (T_DBG_SKIP_INIT_HIBERN8_EXIT ), true);if (attr->pa_granularity) {exynos_ufs_enable_dbg_mode (hba);
drivers/scsi/ufs/ufs-exynos.h +4 -4
@@ -248,22 +248,22 @@ long exynos_ufs_calc_time_cntr(struct exynos_ufs *, long);static inline void exynos_ufs_enable_ov_tm (struct ufs_hba *hba) { -ufshcd_dme_set (hba,UIC_ARG_MIB (PA_DBG_OV_TM ), TRUE); +ufshcd_dme_set (hba,UIC_ARG_MIB (PA_DBG_OV_TM ), true); }static inline void exynos_ufs_disable_ov_tm (struct ufs_hba *hba) { -ufshcd_dme_set (hba,UIC_ARG_MIB (PA_DBG_OV_TM ), FALSE); +ufshcd_dme_set (hba,UIC_ARG_MIB (PA_DBG_OV_TM ), false); }static inline void exynos_ufs_enable_dbg_mode (struct ufs_hba *hba) { -ufshcd_dme_set (hba,UIC_ARG_MIB (PA_DBG_MODE ), TRUE); +ufshcd_dme_set (hba,UIC_ARG_MIB (PA_DBG_MODE ), true); }static inline void exynos_ufs_disable_dbg_mode (struct ufs_hba *hba) { -ufshcd_dme_set (hba,UIC_ARG_MIB (PA_DBG_MODE ), FALSE); +ufshcd_dme_set (hba,UIC_ARG_MIB (PA_DBG_MODE ), false); }#endif /* _UFS_EXYNOS_H_ */
drivers/scsi/ufs/ufshcd.c +4 -4
@@ -4325,18 +4325,18 @@ static int ufshcd_change_power_mode(struct ufs_hba *hba, pwr_mode->lane_rx);if (pwr_mode->pwr_rx ==FASTAUTO_MODE || pwr_mode->pwr_rx ==FAST_MODE ) -ufshcd_dme_set (hba,UIC_ARG_MIB (PA_RXTERMINATION ), TRUE); +ufshcd_dme_set (hba,UIC_ARG_MIB (PA_RXTERMINATION ), true);else -ufshcd_dme_set (hba,UIC_ARG_MIB (PA_RXTERMINATION ), FALSE); +ufshcd_dme_set (hba,UIC_ARG_MIB (PA_RXTERMINATION ), false);ufshcd_dme_set (hba,UIC_ARG_MIB (PA_TXGEAR ), pwr_mode->gear_tx);ufshcd_dme_set (hba,UIC_ARG_MIB (PA_ACTIVETXDATALANES ), pwr_mode->lane_tx);if (pwr_mode->pwr_tx ==FASTAUTO_MODE || pwr_mode->pwr_tx ==FAST_MODE ) -ufshcd_dme_set (hba,UIC_ARG_MIB (PA_TXTERMINATION ), TRUE); +ufshcd_dme_set (hba,UIC_ARG_MIB (PA_TXTERMINATION ), true);else -ufshcd_dme_set (hba,UIC_ARG_MIB (PA_TXTERMINATION ), FALSE); +ufshcd_dme_set (hba,UIC_ARG_MIB (PA_TXTERMINATION ), false); if (pwr_mode->pwr_rx == FASTAUTO_MODE || pwr_mode->pwr_tx == FASTAUTO_MODE ||
drivers/scsi/ufs/unipro.h +0 -14
@@ -298,20 +298,6 @@ enum ufs_unipro_ver {#define T_TC0TXMAXSDUSIZE 0x4060#define T_TC1TXMAXSDUSIZE 0x4061 -#ifdef FALSE -#undef FALSE -#endif - -#ifdef TRUE -#undef TRUE -#endif - -/* Boolean attribute values */ -enum { -FALSE =0 , -TRUE , -}; -/* CPort setting */ #define E2EFC_ON (1 << 0)#define E2EFC_OFF (0 << 0)
RE: [PATCH v2 19/29] scsi: ufs: Remove the TRUE and FALSE definitions
Quoted 6 lines
In the Linux kernel coding style document (
Documentation/process/coding-style.rst) it is recommended to use the type 'bool' and also the values 'true' and 'false'. Hence this patch that removes the definitions and uses of TRUE and FALSE from the UFS driver.Signed-off-by Bart Van Assche <[email protected]>
Bart Van Assche
reviewerPATCH v2 20/29 scsi: ufs: Remove locking from around single register writes
In reply to Bart Van AsscheSingle register writes are atomic and hence do not need to be surrounded by locking. Additionally, MMIO writes are typically posted asynchronously. Hence, there is no guarantee that these have finished by the time the spin_unlock*() call has finished. See also the nonposted-mmio property of the Open Firmware tree. See also pci_iomap().
--- drivers/scsi/ufs/ufs-mediatek.c | 8 -------- drivers/scsi/ufs/ufshcd.c | 4 ---- 2 files changed, 12 deletions(-)
drivers/scsi/ufs/ufs-mediatek.c +0 -8
@@ -171,7 +171,6 @@ static int ufs_mtk_hce_enable_notify(struct ufs_hba *hba, enum ufs_notify_change_status status) {struct ufs_mtk_host *host =ufshcd_get_variant (hba); -unsigned long flags;if (status ==PRE_CHANGE ) {if (host->unipro_lpm) {
@@ -185,12 +184,8 @@ static int ufs_mtk_hce_enable_notify(struct ufs_hba *hba,ufs_mtk_crypto_enable (hba);if (host->caps &UFS_MTK_CAP_DISABLE_AH8 ) { -spin_lock_irqsave (hba->host->host_lock, flags);ufshcd_writel (hba,0 ,REG_AUTO_HIBERNATE_IDLE_TIMER ); -spin_unlock_irqrestore (hba->host->host_lock, - flags); - hba->capabilities &= ~MASK_AUTO_HIBERN8_SUPPORT ; hba->ahit =0 ; }
@@ -994,13 +989,10 @@ static void ufs_mtk_vreg_set_lpm(struct ufs_hba *hba, bool lpm)static void ufs_mtk_auto_hibern8_disable (struct ufs_hba *hba) { -unsigned long flags;int ret;/* disable auto-hibern8 */ -spin_lock_irqsave (hba->host->host_lock, flags);ufshcd_writel (hba,0 ,REG_AUTO_HIBERNATE_IDLE_TIMER ); -spin_unlock_irqrestore (hba->host->host_lock, flags);/* wait host return to idle state when auto-hibern8 off */ ufs_mtk_wait_idle_state (hba,5 );
drivers/scsi/ufs/ufshcd.c +0 -4
@@ -4207,14 +4207,10 @@ EXPORT_SYMBOL_GPL(ufshcd_auto_hibern8_update);void ufshcd_auto_hibern8_enable (struct ufs_hba *hba) { -unsigned long flags; -if (!ufshcd_is_auto_hibern8_supported (hba))return ; -spin_lock_irqsave (hba->host->host_lock, flags);ufshcd_writel (hba, hba->ahit,REG_AUTO_HIBERNATE_IDLE_TIMER ); -spin_unlock_irqrestore (hba->host->host_lock, flags); }/**
Bart Van Assche
reviewerPATCH v2 21/29 scsi: ufs: Introduce ufshcd_clkgate_delay_set()
In reply to Bart Van AsscheSince the code to modify delay_ms while holding the host lock occurs twice, introduce a function that performs this action.
--- drivers/scsi/ufs/ufs-mediatek.c | 5 +---- drivers/scsi/ufs/ufshcd.c | 18 +++++++++++++----- drivers/scsi/ufs/ufshcd.h | 2 ++ 3 files changed, 16 insertions(+), 9 deletions(-)
drivers/scsi/ufs/ufs-mediatek.c +1 -4
@@ -857,7 +857,6 @@ static int ufs_mtk_pre_link(struct ufs_hba *hba)static void ufs_mtk_setup_clk_gating (struct ufs_hba *hba) { -unsigned long flags;u32 ah_ms;if (ufshcd_is_clkgating_allowed (hba)) {
@@ -866,9 +865,7 @@ static void ufs_mtk_setup_clk_gating(struct ufs_hba *hba) hba->ahit); else ah_ms =10 ; -spin_lock_irqsave (hba->host->host_lock, flags); - hba->clk_gating.delay_ms = ah_ms +5 ; -spin_unlock_irqrestore (hba->host->host_lock, flags); +ufshcd_clkgate_delay_set (hba->dev, ah_ms +5 ); } }
drivers/scsi/ufs/ufshcd.c +13 -5
@@ -1864,18 +1864,26 @@ static ssize_t ufshcd_clkgate_delay_show(struct device *dev,return sysfs_emit (buf,"%lu\n" , hba->clk_gating.delay_ms); } +void ufshcd_clkgate_delay_set (struct device *dev,unsigned long value) +{ +struct ufs_hba *hba =dev_get_drvdata (dev); +unsigned long flags; + +spin_lock_irqsave (hba->host->host_lock, flags); + hba->clk_gating.delay_ms = value; +spin_unlock_irqrestore (hba->host->host_lock, flags); +} +EXPORT_SYMBOL_GPL (ufshcd_clkgate_delay_set); +static ssize_t ufshcd_clkgate_delay_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) { -struct ufs_hba *hba =dev_get_drvdata (dev); -unsigned long flags, value; +unsigned long value;if (kstrtoul (buf,0 , &value))return -EINVAL ; -spin_lock_irqsave (hba->host->host_lock, flags); - hba->clk_gating.delay_ms = value; -spin_unlock_irqrestore (hba->host->host_lock, flags); +ufshcd_clkgate_delay_set (dev, value);return count; }
drivers/scsi/ufs/ufshcd.h +2 -0
@@ -1186,6 +1186,8 @@ int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index,int ufshcd_hold (struct ufs_hba *hba,bool async);void ufshcd_release (struct ufs_hba *hba); +void ufshcd_clkgate_delay_set (struct device *dev,unsigned long value); +void ufshcd_map_desc_id_to_length (struct ufs_hba *hba,enum desc_idn desc_id,int *desc_length);
Bart Van Assche
reviewerPATCH v2 22/29 scsi: ufs: qcom: Fix ufs_qcom_resume()
In reply to Bart Van AsscheClearing hba->is_sys_suspended if ufs_qcom_resume() succeeds is wrong. That variable must only be cleared if all actions involved in a resume succeed. Hence remove the statement that clears hba->is_sys_suspended from ufs_qcom_resume().
--- drivers/scsi/ufs/ufs-qcom.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/scsi/ufs/ufs-qcom.c +1 -6
@@ -640,12 +640,7 @@ static int ufs_qcom_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)return err; } - err =ufs_qcom_ice_resume (host); -if (err) -return err; - - hba->is_sys_suspended = false; -return 0 ; +return ufs_qcom_ice_resume (host); }static void ufs_qcom_dev_ref_clk_ctrl (struct ufs_qcom_host *host,bool enable)
Bart Van Assche
reviewerPATCH v2 23/29 scsi: ufs: Remove unnecessary ufshcd-crypto.h include directives
In reply to Bart Van Asscheufshcd-crypto.h declares functions that must only be called by the UFS core. Hence remove the #include "ufshcd-crypto.h" directive from UFS drivers.
--- drivers/scsi/ufs/ufs-mediatek.c | 1 - drivers/scsi/ufs/ufs-qcom-ice.c | 1 - drivers/scsi/ufs/ufs-qcom.h | 1 + 3 files changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/ufs/ufs-mediatek.c +0 -1
@@ -19,7 +19,6 @@#include <linux/soc/mediatek/mtk_sip_svc.h> #include "ufshcd.h" -#include "ufshcd-crypto.h" #include "ufshcd-pltfrm.h" #include "ufs_quirks.h" #include "unipro.h"
drivers/scsi/ufs/ufs-qcom-ice.c +0 -1
@@ -9,7 +9,6 @@#include <linux/platform_device.h> #include <linux/qcom_scm.h> -#include "ufshcd-crypto.h" #include "ufs-qcom.h" #define AES_256_XTS_KEY_SIZE 64
drivers/scsi/ufs/ufs-qcom.h +1 -0
@@ -7,6 +7,7 @@#include <linux/reset-controller.h> #include <linux/reset.h> +#include "ufshcd.h" #define MAX_UFS_QCOM_HOSTS 1#define MAX_U32 (~(u32)0)
Re: [PATCH v2 23/29] scsi: ufs: Remove unnecessary ufshcd-crypto.h include directives
Quoted 10 lines · Bart Van Assche
ufshcd-crypto.hdeclares functions that must only be called by the UFS core. Hence remove the #include "ufshcd-crypto.h" directive from UFS drivers.Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/ufs/ufs-mediatek.c | 1 - drivers/scsi/ufs/ufs-qcom-ice.c | 1 - drivers/scsi/ufs/ufs-qcom.h | 1 + 3 files changed, 1 insertion(+), 2 deletions(-)
- Eric
Bart Van Assche
reviewerPATCH v2 24/29 scsi: ufs: Fix kernel-doc syntax in ufshcd.h
In reply to Bart Van AsscheThis patch fixes all the warnings and errors reported by the following command:
scripts/kernel-doc -none drivers/scsi/ufs/ufshcd.h
--- drivers/scsi/ufs/ufshcd.h | 89 ++++++++++++++++++++++++++++++--------- 1 file changed, 68 insertions(+), 21 deletions(-)
drivers/scsi/ufs/ufshcd.h +68 -21
@@ -236,6 +236,7 @@ struct ufs_query {* @type: device management command type - Query, NOP OUT * @lock: lock to allow one command at a time * @complete: internal commands completion +* @query: Device management query information */ struct ufs_dev_cmd {enum dev_cmd_type type;
@@ -253,7 +254,7 @@ struct ufs_dev_cmd {* @min_freq: min frequency that can be used for clock scaling * @curr_freq: indicates the current frequency that it is set to * @keep_link_active: indicates that the clk should not be disabled if -link is active +* link is active * @enabled: variable to check against multiple enable/disable */ struct ufs_clk_info {
@@ -308,11 +309,13 @@ struct ufs_pwr_mode_info {* to set some things * @hibern8_notify: called around hibern8 enter/exit * @apply_dev_quirks: called to apply device specific quirks +* @fixup_dev_quirks: called to modify device specific quirks * @suspend: called during host controller PM callback * @resume: called during host controller PM callback * @dbg_register_dump: used to dump controller debug information * @phy_initialization: used to initialize phys * @device_reset: called to issue a reset pulse on the UFS device +* @config_scaling_param: called to configure clock scaling parameters * @program_key: program or evict an inline encryption key * @event_notify: called to notify important events */
@@ -379,6 +382,7 @@ enum clk_gating_state {* @is_initialized: Indicates whether clock gating is initialized or not * @active_reqs: number of requests that are pending and should be waited for * completion before gating clocks. +* @clk_gating_workq: workqueue for clock gating work. */ struct ufs_clk_gating {struct delayed_work gate_work;
@@ -415,9 +419,9 @@ struct ufs_saved_pwr_info {* @resume_work: worker to resume devfreq * @min_gear: lowest HS gear to scale down to * @is_enabled: tracks if scaling is currently enabled or not, controlled by -clkscale_enable sysfs node +* clkscale_enable sysfs node * @is_allowed: tracks if scaling is currently allowed or not, used to block -clock scaling which is not invoked from devfreq governor +* clock scaling which is not invoked from devfreq governor * @is_initialized: Indicates whether clock scaling is initialized or not * @is_busy_started: tracks if busy period has started or not * @is_suspended: tracks if devfreq is suspended or not
@@ -444,7 +448,7 @@ struct ufs_clk_scaling {/** * struct ufs_event_hist - keeps history of errors * @pos: index to indicate cyclic buffer position -* @reg: cyclic buffer for registers value +* @val: cyclic buffer for registers value * @tstamp: cyclic buffer for time stamp * @cnt: error counter */
@@ -463,6 +467,7 @@ struct ufs_event_hist {* reset this after link-startup. * @last_hibern8_exit_tstamp: Set time after the hibern8 exit. * Clear after the first successful command completion. +* @event: array with event history. */ struct ufs_stats {u32 last_intr_status;
@@ -733,6 +738,13 @@ struct ufs_hba_monitor {* @host: Scsi_Host instance of the driver * @dev: device handle * @ufs_device_wlun: WLUN that controls the entire UFS device. +* @hwmon_device: device instance registered with the hwmon core. +* @curr_dev_pwr_mode: active UFS device power mode. +* @uic_link_state: active state of the link to the UFS device. +* @rpm_lvl: desired UFS power management level during runtime PM. +* @spm_lvl: desired UFS power management level during system PM. +* @pm_op_in_progress: whether or not a PM operation is in progress. +* @ahit: value of Auto-Hibernate Idle Timer register. * @lrb: local reference block * @outstanding_tasks: Bits representing outstanding task requests * @outstanding_lock: Protects @outstanding_reqs.
@@ -743,17 +755,26 @@ struct ufs_hba_monitor {* @reserved_slot: Used to submit device commands. Protected by @dev_cmd.lock. * @ufs_version: UFS Version to which controller complies * @vops: pointer to variant specific operations +* @vps: pointer to variant specific parameters * @priv: pointer to variant specific private data * @irq: Irq number of the controller -* @active_uic_cmd: handle of active UIC command -* @uic_cmd_mutex: mutex for UIC command +* @is_irq_enabled: whether or not the UFS controller interrupt is enabled. +* @dev_ref_clk_freq: reference clock frequency +* @quirks: bitmask with information about deviations from the UFSHCI standard. +* @dev_quirks: bitmask with information about deviations from the UFS standard. * @tmf_tag_set: TMF tag set. * @tmf_queue: Used to allocate TMF tags. -* @pwr_done: completion for power mode change +* @tmf_rqs: array with pointers to TMF requests while these are in progress. +* @active_uic_cmd: handle of active UIC command +* @uic_cmd_mutex: mutex for UIC command +* @uic_async_done: completion used during UIC processing * @ufshcd_state: UFSHCD state * @eh_flags: Error handling flags * @intr_mask: Interrupt Mask Bits * @ee_ctrl_mask: Exception event control mask +* @ee_drv_mask: Exception event mask for driver +* @ee_usr_mask: Exception event mask for user (set via debugfs) +* @ee_ctrl_mutex: Used to serialize exception event information. * @is_powered: flag to check if HBA is powered * @shutting_down: flag to check if shutdown has been invoked * @host_sem: semaphore used to serialize concurrent contexts
@@ -764,26 +785,52 @@ struct ufs_hba_monitor {* @uic_error: UFS interconnect layer error status * @saved_err: sticky error mask * @saved_uic_err: sticky UIC error mask +* @ufs_stats: various error counters * @force_reset: flag to force eh_work perform a full reset * @force_pmc: flag to force a power mode change * @silence_err_logs: flag to silence error logs * @dev_cmd: ufs device management command information * @last_dme_cmd_tstamp: time stamp of the last completed DME command +* @nop_out_timeout: NOP OUT timeout value +* @dev_info: information about the UFS device * @auto_bkops_enabled: to track whether bkops is enabled in device * @vreg_info: UFS device voltage regulator information * @clk_list_head: UFS host controller clocks list node head +* @req_abort_count: number of times ufshcd_abort() has been called +* @lanes_per_direction: number of lanes per data direction between the UFS +* controller and the UFS device. * @pwr_info: holds current power mode * @max_pwr_info: keeps the device max valid pwm -* @clk_scaling_lock: used to serialize device commands and clock scaling -* @desc_size: descriptor sizes reported by device +* @clk_gating: information related to clock gating +* @caps: bitmask with information about UFS controller capabilities +* @devfreq: frequency scaling information owned by the devfreq core +* @clk_scaling: frequency scaling information owned by the UFS driver +* @is_sys_suspended: whether or not the entire system has been suspended * @urgent_bkops_lvl: keeps track of urgent bkops level for device * @is_urgent_bkops_lvl_checked: keeps track if the urgent bkops level for * device is known or not. +* @clk_scaling_lock: used to serialize device commands and clock scaling +* @desc_size: descriptor sizes reported by device * @scsi_block_reqs_cnt: reference counting for scsi block requests +* @bsg_dev: struct device associated with the BSG queue +* @bsg_queue: BSG queue associated with the UFS controller +* @rpm_dev_flush_recheck_work: used to suspend from RPM (runtime power +* management) after the UFS device has finished a WriteBooster buffer +* flush or auto BKOP. +* @ufshpb_dev: information related to HPB (Host Performance Booster). +* @monitor: statistics about UFS commands * @crypto_capabilities: Content of crypto capabilities register (0x100) * @crypto_cap_array: Array of crypto capabilities * @crypto_cfg_register: Start of the crypto cfg array * @crypto_profile: the crypto profile of this hba (if applicable) +* @debugfs_root: UFS controller debugfs root directory +* @debugfs_ee_work: used to restore ee_ctrl_mask after a delay +* @debugfs_ee_rate_limit_ms: user configurable delay after which to restore +* ee_ctrl_mask +* @luns_avail: number of regular and well known LUNs supported by the UFS +* device +* @complete_put: whether or not to call ufshcd_rpm_put() from inside +* ufshcd_resume_complete() */ struct ufs_hba {void __iomem *mmio_base;
@@ -853,9 +900,9 @@ struct ufs_hba {enum ufshcd_state ufshcd_state;u32 eh_flags;u32 intr_mask; -u16 ee_ctrl_mask;/* Exception event mask */ -u16 ee_drv_mask;/* Exception event mask for driver */ -u16 ee_usr_mask;/* Exception event mask for user (via debugfs) */ +u16 ee_ctrl_mask; +u16 ee_drv_mask; +u16 ee_usr_mask;struct mutex ee_ctrl_mutex;bool is_powered;bool shutting_down;
@@ -996,11 +1043,11 @@ static inline bool ufshcd_is_user_access_allowed(struct ufs_hba *hba)readl ((hba)->mmio_base + (reg))/** -* ufshcd_rmwl - read modify write into a register -* @hba - per adapter instance -* @mask - mask to apply on read value -* @val - actual value to write -* @reg - register address +* ufshcd_rmwl - perform read/modify/write for a controller register +* @hba: per adapter instance +* @mask: mask to apply on read value +* @val: actual value to write +* @reg: register address */static inline void ufshcd_rmwl (struct ufs_hba *hba,u32 mask,u32 val,u32 reg) {
@@ -1035,8 +1082,8 @@ static inline void check_upiu_size(void)/** * ufshcd_set_variant - set variant specific data to the hba -* @hba - per adapter instance -* @variant - pointer to variant specific data +* @hba: per adapter instance +* @variant: pointer to variant specific data */ static inline void ufshcd_set_variant (struct ufs_hba *hba,void *variant) {
@@ -1046,7 +1093,7 @@ static inline void ufshcd_set_variant(struct ufs_hba *hba, void *variant)/** * ufshcd_get_variant - get variant specific data from the hba -* @hba - per adapter instance +* @hba: per adapter instance */ static inline void *ufshcd_get_variant (struct ufs_hba *hba) {
@@ -1367,7 +1414,7 @@ static inline void ufshcd_vops_config_scaling_param(struct ufs_hba *hba,extern struct ufs_pm_lvl_states ufs_pm_lvl_states[]; -/* +/** * ufshcd_scsi_to_upiu_lun - maps scsi LUN to UPIU LUN * @scsi_lun: scsi LUN id *
Bart Van Assche
reviewerPATCH v2 25/29 scsi: ufs: Minimize #include directives
In reply to Bart Van AsscheOnly include those headers of which the declarations are used directly.
--- drivers/scsi/ufs/cdns-pltfrm.c | 1 + drivers/scsi/ufs/tc-dwc-g210-pci.c | 1 + drivers/scsi/ufs/tc-dwc-g210-pltfrm.c | 1 + drivers/scsi/ufs/tc-dwc-g210.c | 2 ++ drivers/scsi/ufs/tc-dwc-g210.h | 2 ++ drivers/scsi/ufs/ufs-exynos.c | 1 + drivers/scsi/ufs/ufs-hisi.c | 2 ++ drivers/scsi/ufs/ufs-mediatek.c | 3 +++ drivers/scsi/ufs/ufs-qcom-ice.c | 1 + drivers/scsi/ufs/ufs-qcom.c | 4 ++++ drivers/scsi/ufs/ufs-sysfs.c | 1 + drivers/scsi/ufs/ufs-sysfs.h | 3 ++- drivers/scsi/ufs/ufs_bsg.c | 5 ++++ drivers/scsi/ufs/ufs_bsg.h | 7 +----- drivers/scsi/ufs/ufshcd-crypto.h | 5 ++-- drivers/scsi/ufs/ufshcd-dwc.c | 2 ++ drivers/scsi/ufs/ufshcd-dwc.h | 2 ++ drivers/scsi/ufs/ufshcd-pci.c | 2 ++ drivers/scsi/ufs/ufshcd-pltfrm.c | 1 + drivers/scsi/ufs/ufshcd.c | 9 ++++++++ drivers/scsi/ufs/ufshcd.h | 33 ++++----------------------- drivers/scsi/ufs/ufshci.h | 2 ++ drivers/scsi/ufs/ufshpb.c | 4 ++++ 23 files changed, 56 insertions(+), 38 deletions(-)
drivers/scsi/ufs/cdns-pltfrm.c +1 -0
@@ -9,6 +9,7 @@* */ +#include <linux/clk.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/platform_device.h>
drivers/scsi/ufs/tc-dwc-g210-pci.c +1 -0
@@ -11,6 +11,7 @@#include "ufshcd-dwc.h" #include "tc-dwc-g210.h" +#include <linux/module.h> #include <linux/pci.h> #include <linux/pm_runtime.h>
drivers/scsi/ufs/tc-dwc-g210-pltfrm.c +1 -0
@@ -12,6 +12,7 @@#include <linux/platform_device.h> #include <linux/of.h> #include <linux/delay.h> +#include <linux/pm_runtime.h> #include "ufshcd-pltfrm.h" #include "ufshcd-dwc.h"
drivers/scsi/ufs/tc-dwc-g210.c +2 -0
@@ -7,6 +7,8 @@* Authors: Joao Pinto <[email protected]> */ +#include <linux/module.h> +#include "ufshcd.h" #include "unipro.h"
drivers/scsi/ufs/tc-dwc-g210.h +2 -0
@@ -10,6 +10,8 @@#ifndef _TC_DWC_G210_H#define _TC_DWC_G210_H +struct ufs_hba ; +int tc_dwc_g210_config_40_bit (struct ufs_hba *hba);int tc_dwc_g210_config_20_bit (struct ufs_hba *hba);
drivers/scsi/ufs/ufs-exynos.c +1 -0
@@ -9,6 +9,7 @@*/ #include <linux/clk.h> +#include <linux/delay.h> #include <linux/module.h> #include <linux/of.h> #include <linux/of_address.h>
drivers/scsi/ufs/ufs-hisi.c +2 -0
@@ -7,6 +7,8 @@*/ #include <linux/time.h> +#include <linux/delay.h> +#include <linux/module.h> #include <linux/of.h> #include <linux/of_address.h> #include <linux/dma-mapping.h>
drivers/scsi/ufs/ufs-mediatek.c +3 -0
@@ -8,6 +8,9 @@#include <linux/arm-smccc.h> #include <linux/bitfield.h> +#include <linux/clk.h> +#include <linux/delay.h> +#include <linux/module.h> #include <linux/of.h> #include <linux/of_address.h> #include <linux/of_device.h>
drivers/scsi/ufs/ufs-qcom-ice.c +1 -0
@@ -6,6 +6,7 @@* Copyright 2019 Google LLC */ +#include <linux/delay.h> #include <linux/platform_device.h> #include <linux/qcom_scm.h>
drivers/scsi/ufs/ufs-qcom.c +4 -0
@@ -5,6 +5,9 @@#include <linux/acpi.h> #include <linux/time.h> +#include <linux/clk.h> +#include <linux/delay.h> +#include <linux/module.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/phy/phy.h>
@@ -18,6 +21,7 @@#include "ufs-qcom.h" #include "ufshci.h" #include "ufs_quirks.h" +#define UFS_QCOM_DEFAULT_DBG_PRINT_EN \ (UFS_QCOM_DBG_PRINT_REGS_EN | UFS_QCOM_DBG_PRINT_TEST_BUS_EN)
drivers/scsi/ufs/ufs-sysfs.c +1 -0
@@ -8,6 +8,7 @@#include "ufs.h" #include "ufs-sysfs.h" +#include "ufshcd.h" static const char *ufshcd_uic_link_state_to_string (enum uic_link_state state)
drivers/scsi/ufs/ufs-sysfs.h +2 -1
@@ -7,11 +7,12 @@#include <linux/sysfs.h> -#include "ufshcd.h" +struct device ;void ufs_sysfs_add_nodes (struct device *dev);void ufs_sysfs_remove_nodes (struct device *dev);extern const struct attribute_group ufs_sysfs_unit_descriptor_group;extern const struct attribute_group ufs_sysfs_lun_attributes_group; +#endif
drivers/scsi/ufs/ufs_bsg.c +5 -0
@@ -4,7 +4,12 @@* * Copyright (C) 2018 Western Digital Corporation */ + +#include <linux/bsg-lib.h> +#include <scsi/scsi.h> +#include <scsi/scsi_host.h> #include "ufs_bsg.h" +#include "ufshcd.h" static int ufs_bsg_get_query_desc_size (struct ufs_hba *hba,int *desc_len,struct utp_upiu_query *qr)
drivers/scsi/ufs/ufs_bsg.h +1 -6
@@ -5,12 +5,7 @@#ifndef UFS_BSG_H #define UFS_BSG_H -#include <linux/bsg-lib.h> -#include <scsi/scsi.h> -#include <scsi/scsi_host.h> - -#include "ufshcd.h" -#include "ufs.h" +struct ufs_hba ;#ifdef CONFIG_SCSI_UFS_BSG void ufs_bsg_remove (struct ufs_hba *hba);
drivers/scsi/ufs/ufshcd-crypto.h +3 -2
@@ -6,9 +6,10 @@#ifndef _UFSHCD_CRYPTO_H#define _UFSHCD_CRYPTO_H -#ifdef CONFIG_SCSI_UFS_CRYPTO +#include <scsi/scsi_cmnd.h> #include "ufshcd.h" -#include "ufshci.h" + +#ifdef CONFIG_SCSI_UFS_CRYPTO static inline void ufshcd_prepare_lrbp_crypto (struct request *rq,struct ufshcd_lrb *lrbp)
drivers/scsi/ufs/ufshcd-dwc.c +2 -0
@@ -7,6 +7,8 @@* Authors: Joao Pinto <[email protected]> */ +#include <linux/module.h> +#include "ufshcd.h" #include "unipro.h"
drivers/scsi/ufs/ufshcd-dwc.h +2 -0
@@ -10,6 +10,8 @@ #ifndef _UFSHCD_DWC_H #define _UFSHCD_DWC_H +#include "ufshcd.h" + struct ufshcd_dme_attr_val { u32 attr_sel; u32 mib_val;
drivers/scsi/ufs/ufshcd-pci.c +2 -0
@@ -10,6 +10,8 @@*/ #include "ufshcd.h" +#include <linux/delay.h> +#include <linux/module.h> #include <linux/pci.h> #include <linux/pm_runtime.h> #include <linux/pm_qos.h>
drivers/scsi/ufs/ufshcd-pltfrm.c +1 -0
@@ -8,6 +8,7 @@* Vinayak Holikatti <[email protected]> */ +#include <linux/module.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> #include <linux/of.h>
drivers/scsi/ufs/ufshcd.c +9 -0
@@ -16,7 +16,16 @@#include <linux/bitfield.h> #include <linux/blk-pm.h> #include <linux/blkdev.h> +#include <linux/clk.h> +#include <linux/delay.h> +#include <linux/interrupt.h> +#include <linux/module.h> +#include <linux/nls.h> +#include <linux/regulator/consumer.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_dbg.h> #include <scsi/scsi_driver.h> +#include <scsi/scsi_eh.h> #include "ufshcd.h" #include "ufs_quirks.h" #include "unipro.h"
drivers/scsi/ufs/ufshcd.h +4 -29
@@ -12,38 +12,13 @@#ifndef _UFSHCD_H#define _UFSHCD_H -#include <linux/module.h> -#include <linux/kernel.h> -#include <linux/init.h> -#include <linux/interrupt.h> -#include <linux/io.h> -#include <linux/delay.h> -#include <linux/slab.h> -#include <linux/spinlock.h> -#include <linux/rwsem.h> -#include <linux/workqueue.h> -#include <linux/errno.h> -#include <linux/types.h> -#include <linux/wait.h> -#include <linux/bitops.h> -#include <linux/pm_runtime.h> -#include <linux/clk.h> -#include <linux/completion.h> -#include <linux/regulator/consumer.h> #include <linux/bitfield.h> -#include <linux/devfreq.h> #include <linux/blk-crypto-profile.h> +#include <linux/blk-mq.h> +#include <linux/devfreq.h> +#include <linux/pm_runtime.h> +#include <scsi/scsi_device.h> #include "unipro.h" - -#include <asm/irq.h> -#include <asm/byteorder.h> -#include <scsi/scsi.h> -#include <scsi/scsi_cmnd.h> -#include <scsi/scsi_host.h> -#include <scsi/scsi_tcq.h> -#include <scsi/scsi_dbg.h> -#include <scsi/scsi_eh.h> -#include "ufs.h" #include "ufs_quirks.h" #include "ufshci.h"
drivers/scsi/ufs/ufshci.h +2 -0
@@ -11,6 +11,8 @@#ifndef _UFSHCI_H#define _UFSHCI_H +#include <scsi/scsi_host.h> +enum {TASK_REQ_UPIU_SIZE_DWORDS =8 , TASK_RSP_UPIU_SIZE_DWORDS = 8,
drivers/scsi/ufs/ufshpb.c +4 -0
@@ -10,6 +10,10 @@*/ #include <asm/unaligned.h> +#include <linux/delay.h> +#include <linux/device.h> +#include <linux/module.h> +#include <scsi/scsi_cmnd.h> #include "ufshcd.h" #include "ufshpb.h"
Bart Van Assche
reviewerPATCH v2 26/29 scsi: ufs: Split the ufshcd.h header file
In reply to Bart Van AsscheSplit the ufshcd.h header file into a header file that defines the interface used by UFS drivers and another header file with declarations and data structures only used by the UFS core.
--- drivers/scsi/ufs/ufs-debugfs.c | 1 + drivers/scsi/ufs/ufs-hwmon.c | 1 + drivers/scsi/ufs/ufs-sysfs.c | 2 +- drivers/scsi/ufs/ufs_bsg.c | 1 + drivers/scsi/ufs/ufshcd-crypto.h | 2 + drivers/scsi/ufs/ufshcd-priv.h | 279 +++++++++++++++++++++++++++++++ drivers/scsi/ufs/ufshcd.c | 2 +- drivers/scsi/ufs/ufshcd.h | 222 ------------------------ drivers/scsi/ufs/ufshpb.c | 2 +- 9 files changed, 287 insertions(+), 225 deletions(-) create mode 100644 drivers/scsi/ufs/ufshcd-priv.h
drivers/scsi/ufs/ufs-debugfs.c +1 -0
@@ -5,6 +5,7 @@#include "ufs-debugfs.h" #include "ufshcd.h" +#include "ufshcd-priv.h" static struct dentry *ufs_debugfs_root;
drivers/scsi/ufs/ufs-hwmon.c +1 -0
@@ -8,6 +8,7 @@#include <linux/units.h> #include "ufshcd.h" +#include "ufshcd-priv.h" struct ufs_hwmon_data {struct ufs_hba *hba;
drivers/scsi/ufs/ufs-sysfs.c +1 -1
@@ -8,7 +8,7 @@#include "ufs.h" #include "ufs-sysfs.h" -#include "ufshcd.h" +#include "ufshcd-priv.h" static const char *ufshcd_uic_link_state_to_string (enum uic_link_state state)
drivers/scsi/ufs/ufs_bsg.c +1 -0
@@ -10,6 +10,7 @@#include <scsi/scsi_host.h> #include "ufs_bsg.h" #include "ufshcd.h" +#include "ufshcd-priv.h" static int ufs_bsg_get_query_desc_size (struct ufs_hba *hba,int *desc_len,struct utp_upiu_query *qr)
drivers/scsi/ufs/ufshcd-crypto.h +2 -0
@@ -8,6 +8,8 @@#include <scsi/scsi_cmnd.h> #include "ufshcd.h" +#include "ufshcd-priv.h" +#include "ufshci.h" #ifdef CONFIG_SCSI_UFS_CRYPTO
drivers/scsi/ufs/ufshcd-priv.h new file +279 -0
279 lines not on this page · raw message
drivers/scsi/ufs/ufshcd.c +1 -1
@@ -26,7 +26,7 @@#include <scsi/scsi_dbg.h> #include <scsi/scsi_driver.h> #include <scsi/scsi_eh.h> -#include "ufshcd.h" +#include "ufshcd-priv.h" #include "ufs_quirks.h" #include "unipro.h" #include "ufs-sysfs.h"
drivers/scsi/ufs/ufshcd.h +0 -222
258 lines not on this page · raw message
drivers/scsi/ufs/ufshpb.c +1 -1
@@ -15,7 +15,7 @@#include <linux/module.h> #include <scsi/scsi_cmnd.h> -#include "ufshcd.h" +#include "ufshcd-priv.h" #include "ufshpb.h" #include "../sd.h"
Bart Van Assche
reviewerPATCH v2 27/29 scsi: ufs: Move the struct ufs_ref_clk definition
In reply to Bart Van AsscheMove the definition of this data structure since it is only used in a single source file.
--- drivers/scsi/ufs/ufs.h | 5 ----- drivers/scsi/ufs/ufshcd.c | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/scsi/ufs/ufs.h +0 -5
@@ -415,11 +415,6 @@ enum ufs_ref_clk_freq { REF_CLK_FREQ_INVAL = -1, }; -struct ufs_ref_clk { -unsigned long freq_hz; -enum ufs_ref_clk_freq val; -}; -/* Query response result code */ enum {QUERY_RESULT_SUCCESS =0x00 ,
drivers/scsi/ufs/ufshcd.c +5 -0
@@ -7959,6 +7959,11 @@ static int ufshcd_device_geo_params_init(struct ufs_hba *hba)return err; } +struct ufs_ref_clk { +unsigned long freq_hz; +enum ufs_ref_clk_freq val; +}; +static struct ufs_ref_clk ufs_ref_clk_freqs[] = { {19200000 ,REF_CLK_FREQ_19_2_MHZ }, {26000000 ,REF_CLK_FREQ_26_MHZ },
Bart Van Assche
reviewerPATCH v2 28/29 scsi: ufs: Move the ufs_is_valid_unit_desc_lun() definition
In reply to Bart Van AsscheMove the definition of this function from a public into a private header file since it is only used inside the UFS core.
--- drivers/scsi/ufs/ufs.h | 19 ------------------- drivers/scsi/ufs/ufshcd-priv.h | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 19 deletions(-)
drivers/scsi/ufs/ufs.h +0 -19
@@ -620,23 +620,4 @@ enum ufs_trace_tsf_t {UFS_TSF_CDB ,UFS_TSF_OSF ,UFS_TSF_TM_INPUT ,UFS_TSF_TM_OUTPUT }; -/** -* ufs_is_valid_unit_desc_lun - checks if the given LUN has a unit descriptor -* @dev_info: pointer of instance of struct ufs_dev_info -* @lun: LU number to check -* @return: true if the lun has a matching unit descriptor, false otherwise -*/ -static inline bool ufs_is_valid_unit_desc_lun (struct ufs_dev_info *dev_info, -u8 lun,u8 param_offset) -{ -if (!dev_info || !dev_info->max_lu_supported) { -pr_err ("Max General LU supported by UFS isn't initialized\n" ); -return false; - } -/* WB is available only for the logical unit from 0 to 7 */ -if (param_offset ==UNIT_DESC_PARAM_WB_BUF_ALLOC_UNITS ) -return lun <UFS_UPIU_MAX_WB_LUN_ID ; -return lun ==UFS_UPIU_RPMB_WLUN || (lun < dev_info->max_lu_supported); -} -#endif /* End of Header */
drivers/scsi/ufs/ufshcd-priv.h +19 -0
@@ -276,4 +276,23 @@ static inline int ufshcd_rpm_put(struct ufs_hba *hba) return pm_runtime_put(&hba->ufs_device_wlun->sdev_gendev); } +/** +* ufs_is_valid_unit_desc_lun - checks if the given LUN has a unit descriptor +* @dev_info: pointer of instance of struct ufs_dev_info +* @lun: LU number to check +* @return: true if the lun has a matching unit descriptor, false otherwise +*/ +static inline bool ufs_is_valid_unit_desc_lun (struct ufs_dev_info *dev_info, +u8 lun,u8 param_offset) +{ +if (!dev_info || !dev_info->max_lu_supported) { +pr_err ("Max General LU supported by UFS isn't initialized\n" ); +return false; + } +/* WB is available only for the logical unit from 0 to 7 */ +if (param_offset ==UNIT_DESC_PARAM_WB_BUF_ALLOC_UNITS ) +return lun <UFS_UPIU_MAX_WB_LUN_ID ; +return lun ==UFS_UPIU_RPMB_WLUN || (lun < dev_info->max_lu_supported); +} +#endif /* _UFSHCD_PRIV_H_ */
Re: [PATCH v2 28/29] scsi: ufs: Move the ufs_is_valid_unit_desc_lun() definition
Quoted 34 lines · Bart Van Assche
drivers/scsi/ufs/ufshcd-priv.h +0
-0@@ -276,4 +276,23 @@ static inline int ufshcd_rpm_put(struct ufs_hba *hba) return pm_runtime_put(&hba->ufs_device_wlun->sdev_gendev); }
+/**
+ *ufs_is_valid_unit_desc_lun- checks if the given LUN has a unit descriptor
+ * @dev_info: pointer of instance of structufs_dev_info
+ * @lun: LU number to check
+ * @return: true if the lun has a matching unit descriptor, false otherwise
+ */
+static inline bool ufs_is_valid_unit_desc_lun(structufs_dev_info*dev_info,
+ u8 lun, u8param_offset)
+{
+ if (!dev_info || !dev_info->max_lu_supported) { + pr_err("Max General LU supported by UFS isn't initialized\n");
+ return false;
+ }
+ /* WB is available only for the logical unit from 0 to 7 */ + if (param_offset==UNIT_DESC_PARAM_WB_BUF_ALLOC_UNITS) + return lun <UFS_UPIU_MAX_WB_LUN_ID;
+ return lun ==UFS_UPIU_RPMB_WLUN|| (lun < dev_info-Quoted 1 line
max_lu_supported);drivers/scsi/ufs/ufshcd-priv.h +2
-0+} +
Quoted 1 line
#endif /* _UFSHCD_PRIV_H_ */
You didn't move this function to drivers/ufs/core/ufshcd-priv.h, It is used by the drivers/ufs/core/ufs-sysfs.c. Otherwise, there is no problem in compiling.
Kind regards,
Bean
Bart Van Assche
reviewerRe: [PATCH v2 28/29] scsi: ufs: Move the ufs_is_valid_unit_desc_lun() definition
Quoted 1 line · Bean Huo
You didn't move this function to
drivers/ufs/core/ufshcd-priv.h,
Hmm ... it is not clear why you wrote the above? I think that the diff clearly shows that ufs_is_valid_unit_desc_lun() is moved into drivers/scsi/ufs/ufshcd-priv.h.
Thanks,
Bart.
Bart Van Assche
reviewerPATCH v2 29/29 scsi: ufs: Split the drivers/scsi/ufs directory
In reply to Bart Van AsscheSplit the drivers/scsi/ufs directory into a ufs-core and a ufs-drivers directory. Move shared header files into the include/scsi directory. This separation makes it clear which header files UFS drivers are allowed to include (include/scsi/*.h) and which header files UFS drivers are not allowed to include (drivers/scsi/ufs-core/*.h).
Update the MAINTAINERS file. Add myself as a UFS reviewer.
---
MAINTAINERS | 9 ++-
drivers/Kconfig | 2 +
drivers/Makefile | 1 +
drivers/scsi/Kconfig | 1 -
drivers/scsi/Makefile | 1 -
drivers/ufs/Kconfig | 30 ++++++++
drivers/ufs/Makefile | 5 ++
drivers/ufs/core/Kconfig | 60 +++++++++++++++
drivers/ufs/core/Makefile | 10 +++
drivers/{scsi/ufs => ufs/core}/ufs-debugfs.c | 2 +-
drivers/{scsi/ufs => ufs/core}/ufs-debugfs.h | 0
.../ufs => ufs/core}/ufs-fault-injection.c | 0
.../ufs => ufs/core}/ufs-fault-injection.h | 0
drivers/{scsi/ufs => ufs/core}/ufs-hwmon.c | 2 +-
drivers/{scsi/ufs => ufs/core}/ufs-sysfs.c | 2 +-
drivers/{scsi/ufs => ufs/core}/ufs-sysfs.h | 0
drivers/{scsi/ufs => ufs/core}/ufs_bsg.c | 2 +-
drivers/{scsi/ufs => ufs/core}/ufs_bsg.h | 0
.../{scsi/ufs => ufs/core}/ufshcd-crypto.c | 2 +-
.../{scsi/ufs => ufs/core}/ufshcd-crypto.h | 4 +-
drivers/{scsi/ufs => ufs/core}/ufshcd-priv.h | 2 +-
drivers/{scsi/ufs => ufs/core}/ufshcd.c | 4 +-
drivers/{scsi/ufs => ufs/core}/ufshpb.c | 2 +-
drivers/{scsi/ufs => ufs/core}/ufshpb.h | 0
drivers/{scsi/ufs => ufs/host}/Kconfig | 75 +------------------
drivers/{scsi/ufs => ufs/host}/Makefile | 12 ---
drivers/{scsi/ufs => ufs/host}/cdns-pltfrm.c | 0
.../{scsi/ufs => ufs/host}/tc-dwc-g210-pci.c | 2 +-
.../ufs => ufs/host}/tc-dwc-g210-pltfrm.c | 0
drivers/{scsi/ufs => ufs/host}/tc-dwc-g210.c | 4 +-
drivers/{scsi/ufs => ufs/host}/tc-dwc-g210.h | 0
drivers/{scsi/ufs => ufs/host}/ti-j721e-ufs.c | 0
drivers/{scsi/ufs => ufs/host}/ufs-exynos.c | 6 +-
drivers/{scsi/ufs => ufs/host}/ufs-exynos.h | 0
drivers/{scsi/ufs => ufs/host}/ufs-hisi.c | 8 +-
drivers/{scsi/ufs => ufs/host}/ufs-hisi.h | 0
.../ufs => ufs/host}/ufs-mediatek-trace.h | 2 +-
drivers/{scsi/ufs => ufs/host}/ufs-mediatek.c | 6 +-
drivers/{scsi/ufs => ufs/host}/ufs-mediatek.h | 0
drivers/{scsi/ufs => ufs/host}/ufs-qcom-ice.c | 0
drivers/{scsi/ufs => ufs/host}/ufs-qcom.c | 8 +-
drivers/{scsi/ufs => ufs/host}/ufs-qcom.h | 2 +-
drivers/{scsi/ufs => ufs/host}/ufshcd-dwc.c | 4 +-
drivers/{scsi/ufs => ufs/host}/ufshcd-dwc.h | 2 +-
drivers/{scsi/ufs => ufs/host}/ufshcd-pci.c | 2 +-
.../{scsi/ufs => ufs/host}/ufshcd-pltfrm.c | 4 +-
.../{scsi/ufs => ufs/host}/ufshcd-pltfrm.h | 2 +-
drivers/{scsi/ufs => ufs/host}/ufshci-dwc.h | 0
{drivers/scsi/ufs => include/scsi}/ufs.h | 0
.../scsi/ufs => include/scsi}/ufs_quirks.h | 0
{drivers/scsi/ufs => include/scsi}/ufshcd.h | 8 +-
{drivers/scsi/ufs => include/scsi}/ufshci.h | 0
{drivers/scsi/ufs => include/scsi}/unipro.h | 0
53 files changed, 155 insertions(+), 133 deletions(-)
create mode 100644 drivers/ufs/Kconfig
create mode 100644 drivers/ufs/Makefile
create mode 100644 drivers/ufs/core/Kconfig
create mode 100644 drivers/ufs/core/Makefile
rename drivers/{scsi/ufs => ufs/core}/ufs-debugfs.c (99%)
rename drivers/{scsi/ufs => ufs/core}/ufs-debugfs.h (100%)
rename drivers/{scsi/ufs => ufs/core}/ufs-fault-injection.c (100%)
rename drivers/{scsi/ufs => ufs/core}/ufs-fault-injection.h (100%)
rename drivers/{scsi/ufs => ufs/core}/ufs-hwmon.c (99%)
rename drivers/{scsi/ufs => ufs/core}/ufs-sysfs.c (99%)
rename drivers/{scsi/ufs => ufs/core}/ufs-sysfs.h (100%)
rename drivers/{scsi/ufs => ufs/core}/ufs_bsg.c (99%)
rename drivers/{scsi/ufs => ufs/core}/ufs_bsg.h (100%)
rename drivers/{scsi/ufs => ufs/core}/ufshcd-crypto.c (99%)
rename drivers/{scsi/ufs => ufs/core}/ufshcd-crypto.h (97%)
rename drivers/{scsi/ufs => ufs/core}/ufshcd-priv.h (99%)
rename drivers/{scsi/ufs => ufs/core}/ufshcd.c (99%)
rename drivers/{scsi/ufs => ufs/core}/ufshpb.c (99%)
rename drivers/{scsi/ufs => ufs/core}/ufshpb.h (100%)
rename drivers/{scsi/ufs => ufs/host}/Kconfig (56%)
rename drivers/{scsi/ufs => ufs/host}/Makefile (56%)
rename drivers/{scsi/ufs => ufs/host}/cdns-pltfrm.c (100%)
rename drivers/{scsi/ufs => ufs/host}/tc-dwc-g210-pci.c (99%)
rename drivers/{scsi/ufs => ufs/host}/tc-dwc-g210-pltfrm.c (100%)
rename drivers/{scsi/ufs => ufs/host}/tc-dwc-g210.c (99%)
rename drivers/{scsi/ufs => ufs/host}/tc-dwc-g210.h (100%)
rename drivers/{scsi/ufs => ufs/host}/ti-j721e-ufs.c (100%)
rename drivers/{scsi/ufs => ufs/host}/ufs-exynos.c (99%)
rename drivers/{scsi/ufs => ufs/host}/ufs-exynos.h (100%)
rename drivers/{scsi/ufs => ufs/host}/ufs-hisi.c (99%)
rename drivers/{scsi/ufs => ufs/host}/ufs-hisi.h (100%)
rename drivers/{scsi/ufs => ufs/host}/ufs-mediatek-trace.h (93%)
rename drivers/{scsi/ufs => ufs/host}/ufs-mediatek.c (99%)
rename drivers/{scsi/ufs => ufs/host}/ufs-mediatek.h (100%)
rename drivers/{scsi/ufs => ufs/host}/ufs-qcom-ice.c (100%)
rename drivers/{scsi/ufs => ufs/host}/ufs-qcom.c (99%)
rename drivers/{scsi/ufs => ufs/host}/ufs-qcom.h (99%)
rename drivers/{scsi/ufs => ufs/host}/ufshcd-dwc.c (98%)
rename drivers/{scsi/ufs => ufs/host}/ufshcd-dwc.h (95%)
rename drivers/{scsi/ufs => ufs/host}/ufshcd-pci.c (99%)
rename drivers/{scsi/ufs => ufs/host}/ufshcd-pltfrm.c (99%)
rename drivers/{scsi/ufs => ufs/host}/ufshcd-pltfrm.h (98%)
rename drivers/{scsi/ufs => ufs/host}/ufshci-dwc.h (100%)
rename {drivers/scsi/ufs => include/scsi}/ufs.h (100%)
rename {drivers/scsi/ufs => include/scsi}/ufs_quirks.h (100%)
rename {drivers/scsi/ufs => include/scsi}/ufshcd.h (99%)
rename {drivers/scsi/ufs => include/scsi}/ufshci.h (100%)
rename {drivers/scsi/ufs => include/scsi}/unipro.h (100%)MAINTAINERS +5 -4
@@ -2547,7 +2547,7 @@ F: drivers/pci/controller/dwc/pcie-qcom.c F: drivers/phy/qualcomm/ F: drivers/power/*/msm* F: drivers/reset/reset-qcom-* -F: drivers/scsi/ufs/ufs-qcom* +F: drivers/ufs/host/ufs-qcom* F: drivers/spi/spi-geni-qcom.c F: drivers/spi/spi-qcom-qspi.c F: drivers/spi/spi-qup.c
@@ -20198,24 +20198,25 @@ F: include/linux/visorbus.h UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER R: Alim Akhtar <[email protected]> R: Avri Altman <[email protected]> +R: Bart Van Assche <[email protected]> L: [email protected] S: Supported F: Documentation/devicetree/bindings/ufs/ F: Documentation/scsi/ufs.rst -F: drivers/scsi/ufs/ +F: drivers/ufs/core/ UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER DWC HOOKS M: Pedro Sousa <[email protected]> L: [email protected] S: Supported -F: drivers/scsi/ufs/*dwc* +F: drivers/ufs/host/*dwc* UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER MEDIATEK HOOKS M: Stanley Chu <[email protected]> L: [email protected] L: [email protected] (moderated for non-subscribers) S: Maintained -F: drivers/scsi/ufs/ufs-mediatek* +F: drivers/ufs/host/ufs-mediatek* UNSORTED BLOCK IMAGES (UBI) M: Richard Weinberger <[email protected]>
drivers/Kconfig +2 -0
@@ -107,6 +107,8 @@ source "drivers/usb/Kconfig" source "drivers/mmc/Kconfig" +source "drivers/ufs/Kconfig" + source "drivers/memstick/Kconfig" source "drivers/leds/Kconfig"
drivers/Makefile +1 -0
@@ -128,6 +128,7 @@ obj-$(CONFIG_PM_OPP) += opp/ obj-$(CONFIG_CPU_FREQ) += cpufreq/ obj-$(CONFIG_CPU_IDLE) += cpuidle/ obj-y += mmc/ +obj-y += ufs/ obj-$(CONFIG_MEMSTICK) += memstick/ obj-$(CONFIG_NEW_LEDS) += leds/ obj-$(CONFIG_INFINIBAND) += infiniband/
drivers/scsi/Kconfig +0 -1
@@ -500,7 +500,6 @@ source "drivers/scsi/megaraid/Kconfig.megaraid" source "drivers/scsi/mpt3sas/Kconfig" source "drivers/scsi/mpi3mr/Kconfig" source "drivers/scsi/smartpqi/Kconfig" -source "drivers/scsi/ufs/Kconfig" config SCSI_HPTIOP tristate "HighPoint RocketRAID 3xxx/4xxx Controller support"
drivers/scsi/Makefile +0 -1
@@ -101,7 +101,6 @@ obj-$(CONFIG_MEGARAID_NEWGEN) += megaraid/ obj-$(CONFIG_MEGARAID_SAS) += megaraid/ obj-$(CONFIG_SCSI_MPT3SAS) += mpt3sas/ obj-$(CONFIG_SCSI_MPI3MR) += mpi3mr/ -obj-$(CONFIG_SCSI_UFSHCD) += ufs/ obj-$(CONFIG_SCSI_ACARD) += atp870u.o obj-$(CONFIG_SCSI_SUNESP) += esp_scsi.o sun_esp.o obj-$(CONFIG_SCSI_INITIO) += initio.o
drivers/ufs/Kconfig new file +30 -0
@@ -0,0 +1,30 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# UFS subsystem configuration +# + +menuconfig SCSI_UFSHCD + tristate "Universal Flash Storage Controller" + depends on SCSI && SCSI_DMA + select PM_DEVFREQ + select DEVFREQ_GOV_SIMPLE_ONDEMAND + select NLS + help + Enables support for UFS (Universal Flash Storage) host controllers. + A UFS host controller is an electronic component that is able to + communicate with a UFS card. UFS host controllers occur in + smartphones, laptops, digital cameras and also in cars. + The kernel module will be called ufshcd. + + To compile this driver as a module, choose M here and read + <file:Documentation/scsi/ufs.rst>. + However, do not compile this as a module if your root file system + (the one containing the directory /) is located on a UFS device. + +if SCSI_UFSHCD + +source "drivers/ufs/core/Kconfig" + +source "drivers/ufs/host/Kconfig" + +endif
drivers/ufs/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0 + +# The link order is important here. ufshcd-core must initialize +# before vendor drivers. +obj-$(CONFIG_SCSI_UFSHCD) += core/ host/
drivers/ufs/core/Kconfig new file +60 -0
60 lines not on this page · raw message
drivers/ufs/core/Makefile new file +10 -0
@@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_SCSI_UFSHCD) += ufshcd-core.o +ufshcd-core-y += ufshcd.o ufs-sysfs.o +ufshcd-core-$(CONFIG_DEBUG_FS) += ufs-debugfs.o +ufshcd-core-$(CONFIG_SCSI_UFS_BSG) += ufs_bsg.o +ufshcd-core-$(CONFIG_SCSI_UFS_CRYPTO) += ufshcd-crypto.o +ufshcd-core-$(CONFIG_SCSI_UFS_HPB) += ufshpb.o +ufshcd-core-$(CONFIG_SCSI_UFS_FAULT_INJECTION) += ufs-fault-injection.o +ufshcd-core-$(CONFIG_SCSI_UFS_HWMON) += ufs-hwmon.o
drivers/ufs/core/ufs-debugfs.c renamed from drivers/scsi/ufs/ufs-debugfs.c +1 -1
@@ -4,7 +4,7 @@#include <linux/debugfs.h> #include "ufs-debugfs.h" -#include "ufshcd.h" +#include <scsi/ufshcd.h> #include "ufshcd-priv.h" static struct dentry *ufs_debugfs_root;
drivers/ufs/core/ufs-debugfs.h renamed from drivers/scsi/ufs/ufs-debugfs.h +0 -0
drivers/ufs/core/ufs-fault-injection.c renamed from drivers/scsi/ufs/ufs-fault-injection.c +0 -0
drivers/ufs/core/ufs-fault-injection.h renamed from drivers/scsi/ufs/ufs-fault-injection.h +0 -0
drivers/ufs/core/ufs-hwmon.c renamed from drivers/scsi/ufs/ufs-hwmon.c +1 -1
@@ -7,7 +7,7 @@#include <linux/hwmon.h> #include <linux/units.h> -#include "ufshcd.h" +#include <scsi/ufshcd.h> #include "ufshcd-priv.h" struct ufs_hwmon_data {
drivers/ufs/core/ufs-sysfs.c renamed from drivers/scsi/ufs/ufs-sysfs.c +1 -1
@@ -6,7 +6,7 @@#include <linux/bitfield.h> #include <asm/unaligned.h> -#include "ufs.h" +#include <scsi/ufs.h> #include "ufs-sysfs.h" #include "ufshcd-priv.h"
drivers/ufs/core/ufs-sysfs.h renamed from drivers/scsi/ufs/ufs-sysfs.h +0 -0
drivers/ufs/core/ufs_bsg.c renamed from drivers/scsi/ufs/ufs_bsg.c +1 -1
@@ -9,7 +9,7 @@#include <scsi/scsi.h> #include <scsi/scsi_host.h> #include "ufs_bsg.h" -#include "ufshcd.h" +#include <scsi/ufshcd.h> #include "ufshcd-priv.h" static int ufs_bsg_get_query_desc_size(struct ufs_hba *hba, int *desc_len,
drivers/ufs/core/ufs_bsg.h renamed from drivers/scsi/ufs/ufs_bsg.h +0 -0
drivers/ufs/core/ufshcd-crypto.c renamed from drivers/scsi/ufs/ufshcd-crypto.c +1 -1
@@ -3,7 +3,7 @@* Copyright 2019 Google LLC */ -#include "ufshcd.h" +#include <scsi/ufshcd.h> #include "ufshcd-crypto.h" /* Blk-crypto modes supported by UFS crypto */
drivers/ufs/core/ufshcd-crypto.h renamed from drivers/scsi/ufs/ufshcd-crypto.h +2 -2
@@ -7,9 +7,9 @@#define _UFSHCD_CRYPTO_H#include <scsi/scsi_cmnd.h> -#include "ufshcd.h" +#include <scsi/ufshcd.h> #include "ufshcd-priv.h" -#include "ufshci.h" +#include <scsi/ufshci.h> #ifdef CONFIG_SCSI_UFS_CRYPTO
drivers/ufs/core/ufshcd-priv.h renamed from drivers/scsi/ufs/ufshcd-priv.h +1 -1
@@ -4,7 +4,7 @@#define _UFSHCD_PRIV_H_#include <linux/pm_runtime.h> -#include "ufshcd.h" +#include <scsi/ufshcd.h> static inline bool ufshcd_is_user_access_allowed (struct ufs_hba *hba) {
drivers/ufs/core/ufshcd.c renamed from drivers/scsi/ufs/ufshcd.c +2 -2
@@ -27,8 +27,8 @@#include <scsi/scsi_driver.h> #include <scsi/scsi_eh.h> #include "ufshcd-priv.h" -#include "ufs_quirks.h" -#include "unipro.h" +#include <scsi/ufs_quirks.h> +#include <scsi/unipro.h> #include "ufs-sysfs.h" #include "ufs-debugfs.h" #include "ufs-fault-injection.h"
drivers/ufs/core/ufshpb.c renamed from drivers/scsi/ufs/ufshpb.c +1 -1
@@ -17,7 +17,7 @@#include "ufshcd-priv.h" #include "ufshpb.h" -#include "../sd.h" +#include "../../scsi/sd.h" #define ACTIVATION_THRESHOLD 8/* 8 IOs */ #define READ_TO_MS 1000
drivers/ufs/core/ufshpb.h renamed from drivers/scsi/ufs/ufshpb.h +0 -0
drivers/ufs/host/Kconfig renamed from drivers/scsi/ufs/Kconfig +1 -74
95 lines not on this page · raw message
drivers/ufs/host/Makefile renamed from drivers/scsi/ufs/Makefile +0 -12
@@ -1,16 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 -# UFSHCD makefile - -# The link order is important here. ufshcd-core must initialize -# before vendor drivers. -obj-$(CONFIG_SCSI_UFSHCD) += ufshcd-core.o -ufshcd-core-y += ufshcd.o ufs-sysfs.o -ufshcd-core-$(CONFIG_DEBUG_FS) += ufs-debugfs.o -ufshcd-core-$(CONFIG_SCSI_UFS_BSG) += ufs_bsg.o -ufshcd-core-$(CONFIG_SCSI_UFS_CRYPTO) += ufshcd-crypto.o -ufshcd-core-$(CONFIG_SCSI_UFS_HPB) += ufshpb.o -ufshcd-core-$(CONFIG_SCSI_UFS_FAULT_INJECTION) += ufs-fault-injection.o -ufshcd-core-$(CONFIG_SCSI_UFS_HWMON) += ufs-hwmon.o obj-$(CONFIG_SCSI_UFS_DWC_TC_PCI) += tc-dwc-g210-pci.o ufshcd-dwc.o tc-dwc-g210.o obj-$(CONFIG_SCSI_UFS_DWC_TC_PLATFORM) += tc-dwc-g210-pltfrm.o ufshcd-dwc.o tc-dwc-g210.o
drivers/ufs/host/cdns-pltfrm.c renamed from drivers/scsi/ufs/cdns-pltfrm.c +0 -0
drivers/ufs/host/tc-dwc-g210-pci.c renamed from drivers/scsi/ufs/tc-dwc-g210-pci.c +1 -1
@@ -7,7 +7,7 @@* Authors: Joao Pinto <[email protected]> */ -#include "ufshcd.h" +#include <scsi/ufshcd.h> #include "ufshcd-dwc.h" #include "tc-dwc-g210.h"
drivers/ufs/host/tc-dwc-g210-pltfrm.c renamed from drivers/scsi/ufs/tc-dwc-g210-pltfrm.c +0 -0
drivers/ufs/host/tc-dwc-g210.c renamed from drivers/scsi/ufs/tc-dwc-g210.c +2 -2
@@ -9,8 +9,8 @@#include <linux/module.h> -#include "ufshcd.h" -#include "unipro.h" +#include <scsi/ufshcd.h> +#include <scsi/unipro.h> #include "ufshcd-dwc.h" #include "ufshci-dwc.h"
drivers/ufs/host/tc-dwc-g210.h renamed from drivers/scsi/ufs/tc-dwc-g210.h +0 -0
drivers/ufs/host/ti-j721e-ufs.c renamed from drivers/scsi/ufs/ti-j721e-ufs.c +0 -0
drivers/ufs/host/ufs-exynos.c renamed from drivers/scsi/ufs/ufs-exynos.c +3 -3
@@ -18,10 +18,10 @@#include <linux/platform_device.h> #include <linux/regmap.h> -#include "ufshcd.h" +#include <scsi/ufshcd.h> #include "ufshcd-pltfrm.h" -#include "ufshci.h" -#include "unipro.h" +#include <scsi/ufshci.h> +#include <scsi/unipro.h> #include "ufs-exynos.h"
drivers/ufs/host/ufs-exynos.h renamed from drivers/scsi/ufs/ufs-exynos.h +0 -0
drivers/ufs/host/ufs-hisi.c renamed from drivers/scsi/ufs/ufs-hisi.c +4 -4
@@ -15,12 +15,12 @@#include <linux/platform_device.h> #include <linux/reset.h> -#include "ufshcd.h" +#include <scsi/ufshcd.h> #include "ufshcd-pltfrm.h" -#include "unipro.h" +#include <scsi/unipro.h> #include "ufs-hisi.h" -#include "ufshci.h" -#include "ufs_quirks.h" +#include <scsi/ufshci.h> +#include <scsi/ufs_quirks.h> static int ufs_hisi_check_hibern8 (struct ufs_hba *hba) {
drivers/ufs/host/ufs-hisi.h renamed from drivers/scsi/ufs/ufs-hisi.h +0 -0
drivers/ufs/host/ufs-mediatek-trace.h renamed from drivers/scsi/ufs/ufs-mediatek-trace.h +1 -1
@@ -31,6 +31,6 @@ TRACE_EVENT(ufs_mtk_event,#undef TRACE_INCLUDE_PATH#undef TRACE_INCLUDE_FILE -#define TRACE_INCLUDE_PATH ../../drivers/scsi/ufs/ +#define TRACE_INCLUDE_PATH ../../drivers/ufs/host#define TRACE_INCLUDE_FILE ufs-mediatek-trace#include <trace/define_trace.h>
drivers/ufs/host/ufs-mediatek.c renamed from drivers/scsi/ufs/ufs-mediatek.c +3 -3
@@ -21,10 +21,10 @@#include <linux/sched/clock.h> #include <linux/soc/mediatek/mtk_sip_svc.h> -#include "ufshcd.h" +#include <scsi/ufshcd.h> #include "ufshcd-pltfrm.h" -#include "ufs_quirks.h" -#include "unipro.h" +#include <scsi/ufs_quirks.h> +#include <scsi/unipro.h> #include "ufs-mediatek.h" #define CREATE_TRACE_POINTS
drivers/ufs/host/ufs-mediatek.h renamed from drivers/scsi/ufs/ufs-mediatek.h +0 -0
drivers/ufs/host/ufs-qcom-ice.c renamed from drivers/scsi/ufs/ufs-qcom-ice.c +0 -0
drivers/ufs/host/ufs-qcom.c renamed from drivers/scsi/ufs/ufs-qcom.c +4 -4
@@ -15,12 +15,12 @@#include <linux/reset-controller.h> #include <linux/devfreq.h> -#include "ufshcd.h" +#include <scsi/ufshcd.h> #include "ufshcd-pltfrm.h" -#include "unipro.h" +#include <scsi/unipro.h> #include "ufs-qcom.h" -#include "ufshci.h" -#include "ufs_quirks.h" +#include <scsi/ufshci.h> +#include <scsi/ufs_quirks.h> #define UFS_QCOM_DEFAULT_DBG_PRINT_EN \ (UFS_QCOM_DBG_PRINT_REGS_EN | UFS_QCOM_DBG_PRINT_TEST_BUS_EN)
drivers/ufs/host/ufs-qcom.h renamed from drivers/scsi/ufs/ufs-qcom.h +1 -1
@@ -7,7 +7,7 @@#include <linux/reset-controller.h> #include <linux/reset.h> -#include "ufshcd.h" +#include <scsi/ufshcd.h> #define MAX_UFS_QCOM_HOSTS 1#define MAX_U32 (~(u32)0)
drivers/ufs/host/ufshcd-dwc.c renamed from drivers/scsi/ufs/ufshcd-dwc.c +2 -2
@@ -9,8 +9,8 @@#include <linux/module.h> -#include "ufshcd.h" -#include "unipro.h" +#include <scsi/ufshcd.h> +#include <scsi/unipro.h> #include "ufshcd-dwc.h" #include "ufshci-dwc.h"
drivers/ufs/host/ufshcd-dwc.h renamed from drivers/scsi/ufs/ufshcd-dwc.h +1 -1
@@ -10,7 +10,7 @@ #ifndef _UFSHCD_DWC_H #define _UFSHCD_DWC_H -#include "ufshcd.h" +#include <scsi/ufshcd.h> struct ufshcd_dme_attr_val { u32 attr_sel;
drivers/ufs/host/ufshcd-pci.c renamed from drivers/scsi/ufs/ufshcd-pci.c +1 -1
@@ -9,7 +9,7 @@* Vinayak Holikatti <[email protected]> */ -#include "ufshcd.h" +#include <scsi/ufshcd.h> #include <linux/delay.h> #include <linux/module.h> #include <linux/pci.h>
drivers/ufs/host/ufshcd-pltfrm.c renamed from drivers/scsi/ufs/ufshcd-pltfrm.c +2 -2
@@ -13,9 +13,9 @@#include <linux/pm_runtime.h> #include <linux/of.h> -#include "ufshcd.h" +#include <scsi/ufshcd.h> #include "ufshcd-pltfrm.h" -#include "unipro.h" +#include <scsi/unipro.h> #define UFSHCD_DEFAULT_LANES_PER_DIRECTION 2
drivers/ufs/host/ufshcd-pltfrm.h renamed from drivers/scsi/ufs/ufshcd-pltfrm.h +1 -1
@@ -5,7 +5,7 @@#ifndef UFSHCD_PLTFRM_H_ #define UFSHCD_PLTFRM_H_ -#include "ufshcd.h" +#include <scsi/ufshcd.h> #define UFS_PWM_MODE 1#define UFS_HS_MODE 2
drivers/ufs/host/ufshci-dwc.h renamed from drivers/scsi/ufs/ufshci-dwc.h +0 -0
include/scsi/ufs.h renamed from drivers/scsi/ufs/ufs.h +0 -0
include/scsi/ufs_quirks.h renamed from drivers/scsi/ufs/ufs_quirks.h +0 -0
include/scsi/ufshcd.h renamed from drivers/scsi/ufs/ufshcd.h +4 -4
@@ -18,10 +18,10 @@#include <linux/devfreq.h> #include <linux/pm_runtime.h> #include <scsi/scsi_device.h> -#include "unipro.h" -#include "ufs.h" -#include "ufs_quirks.h" -#include "ufshci.h" +#include <scsi/unipro.h> +#include <scsi/ufs.h> +#include <scsi/ufs_quirks.h> +#include <scsi/ufshci.h> #define UFSHCD "ufshcd"
include/scsi/ufshci.h renamed from drivers/scsi/ufs/ufshci.h +0 -0
include/scsi/unipro.h renamed from drivers/scsi/ufs/unipro.h +0 -0
Bart Van Assche
reviewerRe: [PATCH v2 29/29] scsi: ufs: Split the drivers/scsi/ufs directory
Quoted 7 lines · Bart Van Assche
Split the
drivers/scsi/ufsdirectory into a ufs-core and a ufs-drivers directory. Move shared header files into theinclude/scsidirectory. This separation makes it clear which header files UFS drivers are allowed to include (include/scsi/*.h) and which header files UFS drivers are not allowed to include (drivers/scsi/ufs-core/*.h).Update the
MAINTAINERSfile. Add myself as a UFS reviewer.
Can anyone help with reviewing this patch?
Thanks,
Bart.
Re: [PATCH v2 29/29] scsi: ufs: Split the drivers/scsi/ufs directory
Quoted 5 lines · Bart Van Assche
Can anyone help with reviewing this patch?
Thanks,
Bart.
Bart,
Looks good to us, but we need to verify it on the two platforms, and need some time before add reviewed and tested tag.
Kind regards,
Bean
Bart Van Assche
reviewerRe: [PATCH v2 29/29] scsi: ufs: Split the drivers/scsi/ufs directory
Quoted 2 lines · Bean Huo
Looks good to us, but we need to verify it on the two platforms, and need some time before add reviewed and tested tag.
Thanks for the feedback. I will move this patch to a future patch series such that it does not block merging of the previous patches in this series.
Thanks,
Bart.