aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-01-11scsi: fcoe: Fix unsigned comparison with zero in store_ctlr_mode()Harshit Mogalapalli1-2/+4
ctlr->mode is of unsigned type, it is never less than zero. Fix this by using an extra variable called 'res', to store return value from sysfs_match_string() and assign that to ctlr->mode on the success path. Fixes: edc22a7c8688 ("scsi: fcoe: Use sysfs_match_string() over fcoe_parse_mode()") Signed-off-by: Harshit Mogalapalli <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2024-01-03scsi: mpi3mr: Fix mpi3mr_fw.c kernel-doc warningsRandy Dunlap1-4/+2
Use correct format for function return values. Delete blank lines that are reported as "bad line:". mpi3mr_fw.c:482: warning: No description found for return value of 'mpi3mr_get_reply_desc' mpi3mr_fw.c:1066: warning: bad line: mpi3mr_fw.c:1109: warning: bad line: mpi3mr_fw.c:1249: warning: No description found for return value of 'mpi3mr_revalidate_factsdata' Signed-off-by: Randy Dunlap <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: Sathya Prakash Veerichetty <[email protected]> Cc: Kashyap Desai <[email protected]> Cc: Sumit Saxena <[email protected]> Cc: Sreekanth Reddy <[email protected]> Cc: <[email protected]> Cc: James E.J. Bottomley <[email protected]> Cc: Martin K. Petersen <[email protected]> Cc: <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2024-01-03scsi: smartpqi: Bump driver version to 2.1.26-030Don Brace1-3/+3
Reviewed-by: Mahesh Rajashekhara <[email protected]> Reviewed-by: Murthy Bhat <[email protected]> Reviewed-by: Scott Benesh <[email protected]> Reviewed-by: Scott Teel <[email protected]> Reviewed-by: Mike McGowen <[email protected]> Reviewed-by: Kevin Barnett <[email protected]> Signed-off-by: Don Brace <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2024-01-03scsi: smartpqi: Fix logical volume rescan race conditionMahesh Rajashekhara2-8/+36
Correct rescan flag race condition. Multiple conditions are being evaluated before notifying OS to do a rescan. Driver will skip rescanning the device if any one of the following conditions are met: - Devices that have not yet been added to the OS or devices that have been removed. - Devices which are already marked for removal or in the phase of removal. Under very rare conditions, after logical volume size expansion, the OS still sees the size of the logical volume which was before expansion. The rescan flag in the driver is used to signal the need for a logical volume rescan. A race condition can occur in the driver, and it leads to one thread overwriting the flag inadvertently. As a result, driver is not notifying the OS SML to rescan the logical volume. Move device->rescan update into new function pqi_mark_volumes_for_rescan() and protect with a spin lock. Move check for device->rescan into new function pqi_volume_rescan_needed() and protect function call with a spin_lock. Reviewed-by: Scott Teel <[email protected]> Reviewed-by: Scott Benesh <[email protected]> Reviewed-by: Mike McGowen <[email protected]> Reviewed-by: Kevin Barnett <[email protected]> Co-developed-by: Murthy Bhat <[email protected]> Signed-off-by: Murthy Bhat <[email protected]> Signed-off-by: Mahesh Rajashekhara <[email protected]> Signed-off-by: Don Brace <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2024-01-03scsi: smartpqi: Add new controller PCI IDsDavid Strahan1-0/+40
All PCI ID entries in Hex. Add PCI IDs for Cisco controllers: VID / DID / SVID / SDID ---- ---- ---- ---- Cisco 24G TriMode M1 RAID 4GB FBWC 32D 9005 / 028f / 1137 / 02f8 Cisco 24G TriMode M1 RAID 4GB FBWC 16D 9005 / 028f / 1137 / 02f9 Cisco 24G TriMode M1 HBA 16D 9005 / 028f / 1137 / 02fa Add PCI IDs for CloudNine controllers: VID / DID / SVID / SDID ---- ---- ---- ---- SmartRAID P7604N-16i 9005 / 028f / 1f51 / 100e SmartRAID P7604N-8i 9005 / 028f / 1f51 / 100f SmartRAID P7504N-16i 9005 / 028f / 1f51 / 1010 SmartRAID P7504N-8i 9005 / 028f / 1f51 / 1011 SmartRAID P7504N-8i 9005 / 028f / 1f51 / 1043 SmartHBA P6500-8i 9005 / 028f / 1f51 / 1044 SmartRAID P7504-8i 9005 / 028f / 1f51 / 1045 Reviewed-by: Murthy Bhat <[email protected]> Reviewed-by: Mahesh Rajashekhara <[email protected]> Reviewed-by: Scott Teel <[email protected]> Reviewed-by: Scott Benesh <[email protected]> Reviewed-by: Mike McGowen <[email protected]> Reviewed-by: Kevin Barnett <[email protected]> Signed-off-by: David Strahan <[email protected]> Signed-off-by: Don Brace <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2024-01-03scsi: ufs: qcom: Remove unnecessary goto statement from ufs_qcom_config_esi()ChanWoo Lee1-5/+2
There is only one place where goto is used, and it is unnecessary to check the ret value through 'goto out' because the ret value is already true. Therefore, remove the goto statement and integrate the '!ret' condition into the existing code. Signed-off-by: ChanWoo Lee <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Christophe JAILLET <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2024-01-03scsi: ufs: core: Remove the ufshcd_hba_exit() call from ufshcd_async_scan()Bart Van Assche1-5/+2
Calling ufshcd_hba_exit() from a function that is called asynchronously from ufshcd_init() is wrong because this triggers multiple race conditions. Instead of calling ufshcd_hba_exit(), log an error message. Reported-by: Daniel Mentz <[email protected]> Fixes: 1d337ec2f35e ("ufs: improve init sequence") Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Can Guo <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2024-01-03scsi: ufs: core: Simplify power management during async scanBart Van Assche1-4/+3
ufshcd_init() calls pm_runtime_get_sync() before it calls async_schedule(). ufshcd_async_scan() calls pm_runtime_put_sync() directly or indirectly from ufshcd_add_lus(). Simplify ufshcd_async_scan() by always calling pm_runtime_put_sync() from ufshcd_async_scan(). Cc: <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Can Guo <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-18scsi: ufs: core: Simplify ufshcd_auto_hibern8_update()Bart Van Assche1-12/+4
Calls to ufshcd_auto_hibern8_update() are already serialized: this function is either called if user space software is not running (preparing to suspend) or from a single sysfs store callback function. Kernfs serializes sysfs .store() callbacks. No functionality is changed. Reviewed-by: Bao D. Nguyen <[email protected]> Reviewed-by: Can Guo <[email protected]> Cc: Avri Altman <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-18scsi: ufs: core: Rename ufshcd_auto_hibern8_enable() and make it staticBart Van Assche2-14/+11
Rename ufshcd_auto_hibern8_enable() into ufshcd_configure_auto_hibern8() since this function can enable or disable auto-hibernation. Since ufshcd_auto_hibern8_enable() is only used inside the UFSHCI driver core, declare it static. Additionally, move the definition of this function to just before its first caller. Suggested-by: Bao D. Nguyen <[email protected]> Reviewed-by: Bao D. Nguyen <[email protected]> Reviewed-by: Can Guo <[email protected]> Cc: Avri Altman <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Peter Wang <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-18scsi: ufs: qcom: Fix ESI vector maskManivannan Sadhasivam2-1/+4
While cleaning up the code to use ufshcd_rmwl() helper, the ESI vector mask was changed incorrectly. Fix it and also define a proper macro for the value together with FIELD_PREP(). Reported-by: Andrew Halaney <[email protected]> Fixes: 0e9f4375db1c ("scsi: ufs: qcom: Use ufshcd_rmwl() where applicable") Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Konrad Dybcio <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-18scsi: ufs: host: Fix kernel-doc warningMartin K. Petersen1-1/+1
Commit fa3dca8251c4 ("scsi: ufs: host: Rename structure ufs_dev_params to ufs_host_params") inadvertently introduced a comment line without '*' prefix. Format the comment section correctly. Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Fixes: fa3dca8251c4 ("scsi: ufs: host: Rename structure ufs_dev_params to ufs_host_params") Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13Merge patch series "scsi: hisi_sas: Minor fixes and cleanups"Martin K. Petersen2-11/+19
chenxiang <[email protected]> says: This series contain some fixes and cleanups including: - Set .phy_attached before notifying phyup event HISI_PHYEE_PHY_UP_PM; - Use standard error code instead of hardcode; - Check before using pointer variable; - Rollback some operations if FLR failed; - Correct the number of global debugfs registers; Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: hisi_sas: Correct the number of global debugfs registersYihang Li1-1/+1
In function debugfs_debugfs_snapshot_global_reg_v3_hw() it uses debugfs_axi_reg.count (which is the number of axi debugfs registers) to acquire the number of global debugfs registers. Use debugfs_global_reg.count to acquire the number of global debugfs registers instead. Fixes: 623a4b6d5c2a ("scsi: hisi_sas: Move debugfs code to v3 hw driver") Signed-off-by: Yihang Li <[email protected]> Signed-off-by: Xiang Chen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: hisi_sas: Rollback some operations if FLR failedYihang Li1-0/+5
We obtain the semaphore and set HISI_SAS_RESETTING_BIT in hisi_sas_reset_prepare_v3_hw(), block the scsi host and set HISI_SAS_REJECT_CMD_BIT in hisi_sas_controller_reset_prepare(), released them in hisi_sas_controller_reset_done(). However, if the HW reset failure in FLR results in early return, the semaphore and flag bits will not be release. Rollback some operations including clearing flags / releasing semaphore when FLR is failed. Fixes: e5ea48014adc ("scsi: hisi_sas: Implement handlers of PCIe FLR for v3 hw") Signed-off-by: Yihang Li <[email protected]> Signed-off-by: Xiang Chen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: hisi_sas: Check before using pointer variablesYihang Li1-2/+5
In commit 4b329abc9180 ("scsi: hisi_sas: Move slot variable definition in hisi_sas_abort_task()"), we move the variables slot to the function head. However, the variable slot may be NULL, we should check it in each branch. Fixes: 4b329abc9180 ("scsi: hisi_sas: Move slot variable definition in hisi_sas_abort_task()") Signed-off-by: Yihang Li <[email protected]> Signed-off-by: Xiang Chen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: hisi_sas: Replace with standard error code return valueYihang Li2-3/+3
In function hisi_sas_controller_prereset(), -ENOSYS (Function not implemented) should be returned if the driver does not support .soft_reset. Returns -EPERM (Operation not permitted) if HISI_SAS_RESETTING_BIT is already be set. In function _suspend_v3_hw(), returns -EPERM (Operation not permitted) if HISI_SAS_RESETTING_BIT is already be set. Fixes: 4522204ab218 ("scsi: hisi_sas: tidy host controller reset function a bit") Signed-off-by: Yihang Li <[email protected]> Signed-off-by: Xiang Chen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: hisi_sas: Set .phy_attached before notifing phyup event ↵Yihang Li1-5/+5
HISI_PHYE_PHY_UP_PM Currently in directly attached scenario, the phyup event HISI_PHYE_PHY_UP_PM is notified before .phy_attached is set - this may cause the phyup work hisi_sas_bytes_dmaed() execution failed and the attached device will not be found. To fix it, set .phy_attached before notifing phyup event. Signed-off-by: Yihang Li <[email protected]> Signed-off-by: Xiang Chen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13Merge patch series "Add UFS RTC support"Martin K. Petersen5-6/+151
Bean Huo <[email protected]> says: Adding RTC support for embedded storage device UFS in its driver, it is important for a few key reasons: 1. Helps with Regular Maintenance: The RTC provides a basic way to keep track of time, making it useful for scheduling routine maintenance tasks in the storage device. This includes things like making sure data is spread evenly across the storage to extend its life. 2. Figuring Out How Old Data Is: The RTC helps the device estimate how long ago certain parts of the storage were last used. This is handy for deciding when to do maintenance tasks to keep the storage working well over time. 3. Making Devices Last Longer: By using the RTC for regular upkeep, we can make sure the storage device lasts longer and stays reliable. This is especially important for devices that need to work well for a long time. 4.Fitting In with Other Devices: The inclusion of RTC support aligns with existing UFS specifications (starting from UFS Spec 2.0) and is consistent with the prevalent industry practice. Many UFS devices currently on the market utilize RTC for internal timekeeping. By ensuring compatibility with this widely adopted standard, the embedded storage device becomes seamlessly integrable with existing hardware and software ecosystems, reducing the risk of compatibility issues. In short, adding RTC support to embedded storage device UFS helps with regular upkeep, extends the device's life, ensures compatibility, and keeps everything running smoothly with the rest of the system. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: core: Add sysfs node for UFS RTC updateBean Huo4-2/+48
Introduce a sysfs node named 'rtc_update_ms' within the kernel, enabling user to adjust the RTC periodic update frequency to suit the specific requirements of the system and UFS. Also, this patch allows the user to disable/enable periodic update RTC in the UFS idle time. Signed-off-by: Bean Huo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: Avri Altman <[email protected]> Reviewed-by: Thomas Weißschuh <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: core: Add UFS RTC supportBean Huo3-2/+98
Add Real Time Clock (RTC) support for UFS device. This enhancement is crucial for the internal maintenance operations of the UFS device. The patch enables the device to handle both absolute and relative time information. Furthermore, it includes periodic task to update the RTC in accordance with the UFS Spec, ensuring the accuracy of RTC information for the device's internal processes. RTC and qTimestamp serve distinct purposes. The RTC provides a coarse level of granularity with, at best, approximate single-second resolution. This makes the RTC well-suited for the device to determine the approximate age of programmed blocks after being updated by the host. On the other hand, qTimestamp offers nanosecond granularity and is specifically designed for synchronizing Device Error Log entries with corresponding host-side logs. Given that the RTC has been a standard feature since UFS Spec 2.0, and qTimestamp was introduced in UFS Spec 4.0, the majority of UFS devices currently on the market rely on RTC. Therefore, it is advisable to continue supporting RTC in the Linux kernel. This ensures compatibility with the prevailing UFS device implementations and facilitates seamless integration with existing hardware. By maintaining support for RTC, we ensure broad compatibility and avoid potential issues arising from deviations in device specifications across different UFS versions. Signed-off-by: Bean Huo <[email protected]> Signed-off-by: Mike Bi <[email protected]> Signed-off-by: Luca Porzio <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: Avri Altman <[email protected]> Reviewed-by: Thomas Weißschuh <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: core: Add ufshcd_is_ufs_dev_busy()Bean Huo1-4/+7
Add helper inline for retrieving whether UFS device is busy or not. Signed-off-by: Bean Huo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Avri Altman <[email protected]> Reviewed-by: Thomas Weißschuh <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13Merge patch series "scsi: ufs: qcom: Code cleanups"Martin K. Petersen4-371/+67
Manivannan Sadhasivam <[email protected]> says: Hello, This series has code some cleanups to the Qcom UFS driver. No functional change. In this version, I've removed code supporting legacy controllers ver < 2.0, as the respective platforms were never supported in upstream. Tested on: RB5 development board based on Qcom SM8250 SoC. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: qcom: Remove unused definitionsManivannan Sadhasivam1-6/+0
Remove unused definitions. Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Andrew Halaney <[email protected]> Tested-by: Andrew Halaney <[email protected]> # sa8775p-ride Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: qcom: Use ufshcd_rmwl() where applicableManivannan Sadhasivam2-8/+7
Instead of using both ufshcd_readl() and ufshcd_writel() to read/modify/ write a register, let's make use of the existing helper. Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Andrew Halaney <[email protected]> # sa8775p-ride Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: qcom: Remove support for host controllers older than v2.0Manivannan Sadhasivam2-212/+11
The legacy platforms making use of host controllers older than version 2.0 are not supported in upstream. So there is no need to carry code to support them. Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Andrew Halaney <[email protected]> # sa8775p-ride Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: qcom: Simplify ufs_qcom_{assert/deassert}_resetManivannan Sadhasivam1-7/+2
In both the functions, UFS_PHY_SOFT_RESET contains the mask of the reset bit. So this can be passed directly as the value to be written for asserting the reset. For deasserting, 0 can be passed. This gets rid of the FIELD_PREP() inside these functions and also UFS_PHY_RESET_{ENABLE/DISABLE} definitions. Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Andrew Halaney <[email protected]> Tested-by: Andrew Halaney <[email protected]> # sa8775p-ride Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: qcom: Initialize cycles_in_1us variable in ↵Manivannan Sadhasivam1-1/+1
ufs_qcom_set_core_clk_ctrl() In case the "core_clk_unipro" clock is not provided, "cycles_in_1us" variable will be used as uninitialized. So initialize it with 0. Issue reported by Smatch tool: drivers/ufs/host/ufs-qcom.c:1336 ufs_qcom_set_core_clk_ctrl() error: uninitialized symbol 'cycles_in_1us'. drivers/ufs/host/ufs-qcom.c:1341 ufs_qcom_set_core_clk_ctrl() error: uninitialized symbol 'cycles_in_1us'. Reviewed-by: Nitin Rawat <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Andrew Halaney <[email protected]> # sa8775p-ride Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: qcom: Sort includes alphabeticallyManivannan Sadhasivam1-7/+7
Sort includes alphabetically. Reviewed-by: Nitin Rawat <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Andrew Halaney <[email protected]> # sa8775p-ride Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: qcom: Remove unused ufs_qcom_hosts struct arrayManivannan Sadhasivam2-6/+0
ufs_qcom_hosts array is assigned, but not used anywhere. So let's remove it. Reviewed-by: Andrew Halaney <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Andrew Halaney <[email protected]> # sa8775p-ride Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: qcom: Use dev_err_probe() to simplify error handling of ↵Manivannan Sadhasivam1-3/+2
devm_gpiod_get_optional() As done in other places, let's use dev_err_probe() to simplify the error handling while acquiring the device reset gpio using devm_gpiod_get_optional(). While at it, let's reword the error message to make it clear that the failure is due to acquiring "device reset gpio". Reviewed-by: Andrew Halaney <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Andrew Halaney <[email protected]> # sa8775p-ride Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: qcom: Remove redundant error print for devm_kzalloc() failureManivannan Sadhasivam1-3/+1
devm_kzalloc() will itself print the error message on failure. So let's get rid of the redundant error message in ufs_qcom_init(). Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Nitin Rawat <[email protected]> Tested-by: Andrew Halaney <[email protected]> # sa8775p-ride Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: qcom: Check the return value of ufs_qcom_power_up_sequence()Manivannan Sadhasivam1-1/+4
If ufs_qcom_power_up_sequence() fails, then it makes no sense to enable the lane clocks and continue ufshcd_hba_enable(). So let's check the return value of ufs_qcom_power_up_sequence(). Reviewed-by: Andrew Halaney <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Andrew Halaney <[email protected]> # sa8775p-ride Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: qcom: Fail ufs_qcom_power_up_sequence() when core_reset failsManivannan Sadhasivam1-3/+4
Even though core_reset is optional, a failure during assert/deassert should be considered fatal, if core_reset is available. So fail ufs_qcom_power_up_sequence() if an error happens during reset and also get rid of the redundant warning as the ufs_qcom_host_reset() function itself prints error messages. Reviewed-by: Andrew Halaney <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Andrew Halaney <[email protected]> # sa8775p-ride Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: qcom: Export ufshcd_{enable/disable}_irq helpers and make use of themManivannan Sadhasivam3-8/+9
Instead of duplicating the enable/disable IRQ part, let's export the helpers available in ufshcd driver and make use of them. This also fixes the possible redundant IRQ disable before asserting reset (when IRQ was already disabled). Fixes: 4a791574a0cc ("scsi: ufs: ufs-qcom: Disable interrupt in reset path") Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Andrew Halaney <[email protected]> # sa8775p-ride Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: qcom: Remove the warning message when core_reset is not availableManivannan Sadhasivam1-3/+1
core_reset is optional, so there is no need to warn the user if it is not available. Reviewed-by: Andrew Halaney <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Andrew Halaney <[email protected]> # sa8775p-ride Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: qcom: Remove superfluous variable assignmentsManivannan Sadhasivam1-8/+8
There are many instances where the variable assignments are not needed. Remove them. Reviewed-by: Andrew Halaney <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Andrew Halaney <[email protected]> # sa8775p-ride Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: qcom: Fix the return value when platform_get_resource_byname() failsManivannan Sadhasivam1-1/+1
The return value should be -ENODEV indicating that the resource is not provided in DT, not -ENOMEM. Fix it! Fixes: c263b4ef737e ("scsi: ufs: core: mcq: Configure resource regions") Reviewed-by: Andrew Halaney <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Andrew Halaney <[email protected]> # sa8775p-ride Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: qcom: Fix the return value of ufs_qcom_ice_program_key()Manivannan Sadhasivam1-1/+1
Currently, the function returns -EINVAL if algorithm other than AES-256-XTS is requested. But the correct error code is -EOPNOTSUPP. Fix it! Cc: Abel Vesa <[email protected]> Fixes: 56541c7c4468 ("scsi: ufs: ufs-qcom: Switch to the new ICE API") Reviewed-by: Abel Vesa <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Andrew Halaney <[email protected]> # sa8775p-ride Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: qcom: Use clk_bulk APIs for managing lane clocksManivannan Sadhasivam2-93/+7
Lane clock handling can be simplified by using the clk_bulk APIs. So let's make use of them. This also get's rid of the clock validation in the driver as kernel should just rely on the firmware (DT/ACPI) to provide the clocks required for proper functioning. Reviewed-by: Andrew Halaney <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Andrew Halaney <[email protected]> # sa8775p-ride Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: qcom: dt-bindings: Add SC7280 compatible stringNitin Rawat1-0/+2
Document the compatible string for the UFS found on SC7280. Signed-off-by: Nitin Rawat <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Bao D. Nguyen <[email protected]> Acked-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Luca Weiss <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13Merge patch series "Enable HS-G5 support on SM8550"Martin K. Petersen7-80/+133
Can Guo <[email protected]> says: This series enables HS-G5 support on SM8550. This series is rebased on below changes from Mani - https://patchwork.kernel.org/project/linux-scsi/patch/[email protected]/ https://patchwork.kernel.org/project/linux-scsi/patch/[email protected]/ This series is tested on below HW combinations - SM8550 MTP + UFS4.0 SM8550 QRD + UFS3.1 SM8450 MTP + UFS3.1 (for regression test) SM8350 MTP + UFS3.1 (for regression test) Note that during reboot test on above platforms, I occasinally hit PA (PHY) error during the 2nd init, this is not related with this series. A fix for this is mentioned in below patchwork - https://patchwork.kernel.org/project/linux-scsi/patch/[email protected]/ Also note that on platforms, which have two sets of UFS PHY settings are provided (say G4 and no-G4, G5 and no-G5). The two sets of PHY settings are basically programming different values to different registers, mixing the two sets and/or overwriting one set with another set is definitely not blessed by UFS PHY designers. For SM8550, this series will make sure we honor the rule. However, for old targets Mani and I will fix them in another series in future. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: ufs-qcom: Add support for UFS device version detectionBao D. Nguyen2-7/+32
Start from HW ver 5, a spare register in UFS host controller is added and used to indicate the UFS device version. The spare register is populated by bootloader for now, but in future it will be populated by HW automatically during link startup with its best efforts in any boot stage prior to Linux. During host driver init, read the spare register, if it is not populated with a UFS device version, go ahead with the dual init mechanism. If a UFS device version is in there, use the UFS device version together with host controller's HW version to decide the proper PHY gear which should be used to configure the UFS PHY without going through the second init. Signed-off-by: Bao D. Nguyen <[email protected]> Signed-off-by: Can Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Nitin Rawat <[email protected]> Tested-by: Neil Armstrong <[email protected]> # on SM8550-QRD Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: ufs-qcom: Check return value of phy_set_mode_ext()Can Guo1-1/+3
In ufs_qcom_power_up_sequence(), check return value of phy_set_mode_ext() and stop proceeding if phy_set_mode_ext() fails. Reviewed-by: Nitin Rawat <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Can Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Neil Armstrong <[email protected]> # on SM8550-QRD Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: ufs-qcom: Set initial PHY gear to max HS gear for HW ver 4 and newerCan Guo1-6/+17
Since HW ver 4, max HS gear can be get from UFS host controller's register, use the max HS gear as the initial PHY gear instead of UFS_HS_G2, so that we don't need to update the hard code for newer targets in future. Reviewed-by: Nitin Rawat <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Can Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Neil Armstrong <[email protected]> # on SM8550-QRD Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: ufs-qcom: Limit HS-G5 Rate-A to hosts with HW version 5Can Guo1-1/+17
Qcom UFS hosts, with HW ver 5, can only support up to HS-G5 Rate-A due to HW limitations. If the HS-G5 PHY gear is used, update host_params->hs_rate to Rate-A, so that the subsequent power mode changes shall stick to Rate-A. Reviewed-by: Nitin Rawat <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Can Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Neil Armstrong <[email protected]> # on SM8550-QRD Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: ufs-qcom: Allow the first init start with the maximum supported gearCan Guo1-4/+5
During host driver init, the phy_gear is set to the minimum supported gear (HS_G2). Then, during the first power mode change, the negotiated gear, say HS-G4, is updated to the phy_gear variable so that in the second init the updated phy_gear can be used to program the PHY. But the current code only allows update the phy_gear to a higher value. If one wants to start the first init with the maximum support gear, say HS-G4, the phy_gear is not updated to HS-G3 if the device only supports HS-G3. The original check added there is intend to make sure the phy_gear won't be updated when gear is scaled down (during clock scaling). Update the check so that one can start the first init with the maximum support gear without breaking the original fix by checking the ufshcd_state, that is, allow update to phy_gear only if power mode change is invoked from ufshcd_probe_hba(). Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Nitin Rawat <[email protected]> Signed-off-by: Can Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Neil Armstrong <[email protected]> # on SM8550-QRD Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: ufs-qcom: Setup host power mode during initCan Guo2-7/+15
Setup host power mode and its limitations during UFS host driver init to avoid repetitive work during every power mode change. Acked-by: Andrew Halaney <[email protected]> Reviewed-by: Nitin Rawat <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Co-developed-by: Bao D. Nguyen <[email protected]> Signed-off-by: Bao D. Nguyen <[email protected]> Signed-off-by: Can Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Neil Armstrong <[email protected]> # on SM8550-QRD Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: ufs-qcom: No need to set hs_rate after ufshcd_init_host_param()Can Guo2-3/+0
In ufs_qcom_pwr_change_notify(), host_params.hs_rate has been set to PA_HS_MODE_B by ufshcd_init_host_param(), hence remove the duplicated line of work. Meanwhile, removed the macro UFS_QCOM_LIMIT_HS_RATE as it is only used here. Reviewed-by: Nitin Rawat <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Andrew Halaney <[email protected]> Signed-off-by: Can Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Neil Armstrong <[email protected]> # on SM8550-QRD Signed-off-by: Martin K. Petersen <[email protected]>
2023-12-13scsi: ufs: host: Rename structure ufs_dev_params to ufs_host_paramsCan Guo6-64/+57
Structure ufs_dev_params is actually used in UFS host drivers to declare host specific power mode parameters, like ufs_<vendor>_params or host_cap, which makes the code not very straightforward to read. Rename the structure ufs_dev_params to ufs_host_params and unify the declarations in all drivers to host_params. In addition, rename the two functions ufshcd_init_pwr_dev_param() and ufshcd_get_pwr_dev_param() which work based on the ufs_host_params to ufshcd_init_host_params() and ufshcd_negotiate_pwr_params() respectively to avoid confusions. This change does not change any functionalities or logic. Acked-by: Andrew Halaney <[email protected]> Reviewed-by: Nitin Rawat <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Can Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Peter Wang <[email protected]> Tested-by: Neil Armstrong <[email protected]> # on SM8550-QRD Signed-off-by: Martin K. Petersen <[email protected]>