summaryrefslogtreecommitdiff
path: root/drivers/ufs
AgeCommit message (Collapse)Author
2026-03-02drivers: ufs: remove unused ufs_post_bind() declarationJulien Stephan
Commit 067c1b033282 ("ufs: Call ufs_scsi_bind() from uclass .post_bind") inlined ufs_scsi_bind() into ufs_post_bind() as trivial device_bind_driver() call. ufs_scsi_bind() is no longer referenced anywhere in the codebase, so drop its declaration from include/ufs.h. Drivers used to include <ufs.h> to include prototype of ufs_scsi_bind() function, so we can now safely remove such includes. Fixes: 067c1b033282 ("ufs: Call ufs_scsi_bind() from uclass .post_bind") Signed-off-by: Julien Stephan <jstephan@baylibre.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://patch.msgid.link/20260203-cleanup-ufs-header-v1-1-4c10424485f0@baylibre.com Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2026-03-02ufs: Disable UTP command timeout in slow modePadmarao Begari
When the UFS controller is operating in slow (PWM) mode, the driver is disabled the timeout for UTP send commands. In high-speed mode, the timeout remains enabled to detect stalled or failed transfers. This change ensures reliable operation in slow mode, where command completion may take longer and timeouts are not required. Signed-off-by: Padmarao Begari <padmarao.begari@amd.com> Signed-off-by: Michal Simek <michal.simek@amd.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://patch.msgid.link/e6deb9086afab9d2bdd53db8ecbc7db93af5204d.1764169598.git.michal.simek@amd.com Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2026-01-27scsi: ufs: renesas: Add reusable functionsYoshihiro Shimoda
Since some settings can be reused on other UFS controller (R-Car S4-8 ES1.2), add reusable functions. Ported from Linux kernel commit 44ca16f4970e ("scsi: ufs: renesas: Add reusable functions") Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/446d67b751a96645799de3aeefec539735aa78c8.1741179611.git.geert+renesas@glider.be Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
2026-01-27scsi: ufs: renesas: Refactor 0x10ad/0x10af PHY settingsYoshihiro Shimoda
Extract specific PHY setting of the 0x10a[df] registers into a new function. Ported from Linux kernel commit cca2b807c227 ("scsi: ufs: renesas: Refactor 0x10ad/0x10af PHY settings") Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/110eafd1ee24f9db0285a5e2bca224e35962268a.1741179611.git.geert+renesas@glider.be Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
2026-01-27scsi: ufs: renesas: Remove register control helper functionYoshihiro Shimoda
After refactoring the code, ufs_renesas_reg_control() is no longer needed, because all operations are simple and can be called directly. Remove the ufs_renesas_reg_control() helper function, and call udelay() directly. Ported from Linux kernel commit 855bde8ce5bc ("scsi: ufs: renesas: Remove register control helper function") with replaced readl_poll_timeout_atomic() with readl_poll_sleep_timeout(). Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/69500e4c18be1ca1de360f9e797e282ffef04004.1741179611.git.geert+renesas@glider.be Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
2026-01-27scsi: ufs: renesas: Add register read to remove save/set/restoreYoshihiro Shimoda
Add support for returning read register values from ufs_renesas_reg_control(), so ufs_renesas_set_phy() can use the existing ufs_renesas_write_phy() helper. Remove the now unused code to save to, set, and restore from a static array inside ufs_renesas_reg_control(). Ported from Linux kernel commit 5129aa627599 ("scsi: ufs: renesas: Add register read to remove save/set/restore") Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/9fa240a9dc0308d6675138f8434eccb77f051650.1741179611.git.geert+renesas@glider.be Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
2026-01-27scsi: ufs: renesas: Replace init data by init codeYoshihiro Shimoda
Since initialization of the UFS controller on R-Car S4-8 ES1.0 requires only static values, the driver uses initialization data stored in the const ufs_param[] array. However, other UFS controller variants (R-Car S4-8 ES1.2) require dynamic values, like those obtained from E-FUSE. Refactor the initialization code to prepare for this. This also reduces kernel size by almost 30 KiB. Ported from Linux kernel commit c4e83573c3d0 ("scsi: ufs: renesas: Replace init data by init code") Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/3520e27ac7ff512de6508f630eee3c1689a7c73d.1741179611.git.geert+renesas@glider.be Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
2026-01-12ufs: amd-versal2: Fix reset names with bindingMichal Simek
Align reset names with DT binding. Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/e1082054610fe73d4487d12f4274315030592c77.1765813212.git.michal.simek@amd.com
2026-01-12ufs: amd-versal2: Fix clock name with bindingMichal Simek
Align clockt name with DT binding. Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/eadc8d159b6d822077549722c9ec5a96a4d16c2a.1765973221.git.michal.simek@amd.com
2025-11-25ufs: ti: Rename CONFIG_TI_J721E_UFS to CONFIG_UFS_TI_J721EMarek Vasut
Align the Kconfig option with the rest of the subsystem, use CONFIG_UFS_<vendor> format for the Kconfig option. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Link: https://patch.msgid.link/20251030223626.20005-4-marek.vasut+renesas@mailbox.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-11-25ufs: rockchip: Rename CONFIG_ROCKCHIP_UFS to CONFIG_UFS_ROCKCHIPMarek Vasut
Align the Kconfig option with the rest of the subsystem, use CONFIG_UFS_<vendor> format for the Kconfig option. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Link: https://patch.msgid.link/20251030223626.20005-3-marek.vasut+renesas@mailbox.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-11-25ufs: qcom: Rename CONFIG_QCOM_UFS to CONFIG_UFS_QCOMMarek Vasut
Align the Kconfig option with the rest of the subsystem, use CONFIG_UFS_<vendor> format for the Kconfig option. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Link: https://patch.msgid.link/20251030223626.20005-2-marek.vasut+renesas@mailbox.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-11-25ufs: cadence: Rename CONFIG_CADENCE_UFS to CONFIG_UFS_CADENCEMarek Vasut
Align the Kconfig option with the rest of the subsystem, use CONFIG_UFS_<vendor> format for the Kconfig option. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Link: https://patch.msgid.link/20251030223626.20005-1-marek.vasut+renesas@mailbox.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-11-24Merge tag 'v2026.01-rc3' into nextTom Rini
Prepare v2026.01-rc3
2025-11-20ufs: qcom: vote for interconnect bandwidth on probeNeil Armstrong
Add Interconnect voting on the UFS probe to ask for the largest bandwidth possible. Link: https://patch.msgid.link/20251120-topic-interconnect-next-v5-6-e8a82720da5d@linaro.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-11-17ufs: rcar-gen5: Use a unique U_BOOT_DRIVER nameTom Rini
All instances of U_BOOT_DRIVER must be unique or we will have link time failures. It is possible to enable both ufs-renesas-rcar.c and ufs-renesas-rcar-gen5.c at the same time, so give ufs-renesas-rcar-gen5.c a new unique U_BOOT_DRIVER name. Fixes: 3351fe7ecc1a ("ufs: Add UFS driver for Renesas R-Car X5H") Signed-off-by: Tom Rini <trini@konsulko.com> Acked-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Link: https://patch.msgid.link/20251112211841.1428696-1-trini@konsulko.com Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-11-17ufs: Keep Makefile and Kconfig sorted one more timeMarek Vasut
Sort the Makefile and Kconfig alphabetically again. No functional change. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Igor Belwon <igor.belwon@mentallysanemainliners.org> Link: https://patch.msgid.link/20251029201435.215966-1-marek.vasut+renesas@mailbox.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-10-28ufs: Add UFS driver for Renesas R-Car X5HTuyen Dang
Add UFS driver for UFS controller present on Renesas R-Car X5H R8A78000. The controller uses different initialization code compared to previous generation UFS controller present in Renesas R-Car S4 R8A779F0, and the majority of the driver is the initialization, hence a new driver. [Marek: Clean driver up, add SCMI reset handling, use read_poll_timeout(), pass error values out of ufs_renesas_pre_init(), change the compatible string to "renesas,r8a78000-ufs" to align with previous generation "renesas,r8a779f0-ufs"] Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Tuyen Dang <tuyen.dang.xa@renesas.com> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://patch.msgid.link/20251028142335.18125-7-marek.vasut+renesas@mailbox.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-10-28ufs: renesas: Update Kconfig entry help textMarek Vasut
The current Renesas UFS driver contains initialization code that is specific to R-Car S4 R8A779F0. The upcoming R-Car X5H initialization code is different and contained in a separate driver. Update the Kconfig entry help text for the current driver to help discern it from the X5H driver. No functional change. Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Link: https://patch.msgid.link/20251028142335.18125-6-marek.vasut+renesas@mailbox.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-10-28ufs: Call ufs_scsi_bind() from uclass .post_bindMarek Vasut
Instead of duplicating the ufs_scsi_bind() call in every driver, call it from UFS uclass .post_bind callback for every driver in one place. While doing so, inline ufs_scsi_bind() directly into ufs_post_bind() as trivial device_bind_driver() call. Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Link: https://patch.msgid.link/20251028142335.18125-5-marek.vasut+renesas@mailbox.org [narmstrong: also updated the rockchip and mediatek drivers] Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-10-28ufs: amd-versal2: Fix indentMarek Vasut
Fix indent, use tabs. No functional change. Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Link: https://patch.msgid.link/20251028142335.18125-4-marek.vasut+renesas@mailbox.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-10-28ufs: core: Rename ufs.c to ufs-uclass.cMarek Vasut
Previous commit folded existing ufs-uclass.c into ufs.c , which produced a nice and reviewable change , but also broke the UCLASS should be in *-uclass.c pattern. Fix it. Keep the change separate from the previous one to make this reviewable. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Link: https://patch.msgid.link/20251028142335.18125-3-marek.vasut+renesas@mailbox.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-10-28ufs: core: Fold ufs-uclass into ufsMarek Vasut
Move the few lines of ufs-uclass.c into ufs.c and remove the ufs-uclass.c . No functional change. Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Link: https://patch.msgid.link/20251028142335.18125-2-marek.vasut+renesas@mailbox.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-10-28ufs: core: Keep Makefile and Kconfig list sortedMarek Vasut
Sort the Makefile and Kconfig lists alphabetically. No functional change. Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Link: https://patch.msgid.link/20251028142335.18125-1-marek.vasut+renesas@mailbox.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-10-28ufs: Add MediaTek UFS driverIgor Belwon
Add the UFS driver for MediaTek platforms. Loosely based on the Linux driver, this UFS driver can successfully get a link and R/W access to the UFS chip on the MediaTek MT6878 mobile SoC, when U-Boot is running as lk, or as the kernel (Secure world access is not tested) Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org> Link: https://patch.msgid.link/20251011-mtk-ufs-uboot-v1-3-a05f991ee150@mentallysanemainliners.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-10-28ufs: unipro: Add PA_SCRAMBLING propertyIgor Belwon
This property is required for proper I/O access on the MediaTek MT6878 UFS controller, and is part of UniPro specifications. Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org> Link: https://patch.msgid.link/20251011-mtk-ufs-uboot-v1-2-a05f991ee150@mentallysanemainliners.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-10-28ufs: rockchip: Add initial supportShawn Lin
This patch adds initial support for UFS controller on Rockchip platforms. Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Link: https://patch.msgid.link/1760948182-128561-2-git-send-email-shawn.lin@rock-chips.com Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-10-28ufs: core: Add ufshcd_dme_enable() and ufshcd_dme_reset()Shawn Lin
In order for host drivers to use. Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Link: https://patch.msgid.link/1760948182-128561-1-git-send-email-shawn.lin@rock-chips.com Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-10-28ufs: Add bRefClkFreq attribute settingJared McArthur
A UFS device needs its bRefClkFreq attribute set to the correct value before switching to high speed. If bRefClkFreq is set to the wrong value, all transactions after the power mode change will fail. The bRefClkFreq depends on the host controller and the device. Query the device's current bRefClkFreq and compare with the ref_clk specified in the device-tree. If the two differ, set the bRefClkFreq to the device-tree's ref_clk frequency. Taken from Linux kernel v6.17 (drivers/ufs/core/ufshcd.c and include/ufs/ufs.h) and ported to U-Boot. Signed-off-by: Jared McArthur <j-mcarthur@ti.com> Reviewed-by: Bryan Brattlof <bb@ti.com> Reviewed-by: Udit Kumar <u-kumar1@ti.com> Reviewed-by: Neha Malcom Francis <n-francis@ti.com> Link: https://patch.msgid.link/20251010195556.1772611-3-j-mcarthur@ti.com Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-10-28ufs: Add support for sending UFS attribute requestsJared McArthur
Some UFS attributes must be set before a UFS device is initialized. Add ufshcd_query_attr and ufshcd_query_attr_retry to send UFS attribute requests. Taken from Linux Kernel v6.17 (drivers/ufs/core/ufshcd.c) and ported to U-Boot. Signed-off-by: Jared McArthur <j-mcarthur@ti.com> Reviewed-by: Bryan Brattlof <bb@ti.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Udit Kumar <u-kumar1@ti.com> Reviewed-by: Neha Malcom Francis <n-francis@ti.com> Link: https://patch.msgid.link/20251010195556.1772611-2-j-mcarthur@ti.com Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-10-28ufs: Fix wrong bitfield usage for Data Direction in Transfer RequestKunihiko Hayashi
Commit d232d7fdbf6f ("ufs: core: sync ufshci.h with Linux v6.12") updated the Data Direction values from bitmask values to simple enumerations. Before: enum { UTP_NO_DATA_TRANSFER = 0x00000000, UTP_HOST_TO_DEVICE = 0x02000000, UTP_DEVICE_TO_HOST = 0x04000000, }; Updated: enum utp_data_direction { UTP_NO_DATA_TRANSFER = 0, UTP_HOST_TO_DEVICE = 1, UTP_DEVICE_TO_HOST = 2, }; However, the U-Boot code still uses these values directly without shifting, and resulting in wrong bitfield placement in the Transfer Request Descriptor. This fixes the issue by applying the necessary shift to align the value. Fixes: d232d7fdbf6f ("ufs: core: sync ufshci.h with Linux v6.12") Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://patch.msgid.link/20251010024557.673787-1-hayashi.kunihiko@socionext.com Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-10-28ufs: ti-j721e: Correct error detectionAndrew Goodbody
In ti_j721e_ufs_probe there is a call to clk_get_rate but the code after that attempts to detect an error from that call incorrectly uses IS_ERR_VALUE. Instead the test should just be for regular error codes. The call returns an unsigned long so that needs to be cast to a signed type first of all. This issue was found by Smatch. Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org> Reviewed-by: Anshul Dalal <anshuld@ti.com> Link: https://patch.msgid.link/20251007-ufs_ti-v2-1-501f575b6947@linaro.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-08-26ufs: amd-versal2: Configure RMMI and M-PHY registers for HS modeVenkatesh Yadav Abbarapu
Configure RMMI and M-PHY registers for HS mode required for selection of bit rate series A or B. If it is not a calibrated part, then switch back to SLOWAUTO_MODE and skip all these configurations. Implemented below sequence as per the DWC RMMI databook. 1. Override RMMI CBRATESEL with the desired rate. 2. Set TX_CFGUPDT_0 to 1'b1 for one TX_CFGCLK_0 cycle. 3. Override PHY rx_req to 1, then poll on PHY rx_ack register till it goes 1(both lanes). 4. Override PHY rx_req to 0, then poll on PHY rx_ack register till it goes 0(both lanes). 5. Remove PHY rx_req override(both lanes). 6. Start the LS PMC. Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://lore.kernel.org/r/20250724044402.260149-1-venkatesh.abbarapu@amd.com Signed-off-by: Michal Simek <michal.simek@amd.com>
2025-04-16ufs: amd-versal2: Use raw read/write for SLCR/CACHE registersVenkatesh Yadav Abbarapu
Update the firmware driver UFS APIs zynqmp_pm_ufs_* to directly read/write to the pmc_iou_slcr and efuse_cache registers. Replace these raw reads/writes with the xilinx_pm_request() API with the correct arguments once the PM related changes are done. Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com> Signed-off-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/ee2d1ad2e07e96f1948ab6ffe8f3c50a3b8f9be9.1742462001.git.michal.simek@amd.com
2025-03-18ufs: core: sync ufshci.h with Linux v6.12Neil Armstrong
Sync ufshci.h with the version found in the Linux v6.12 version commit adc218676eef ("Linux 6.12"). It adds new defines, and moves defines to the same place as the Linux header. No functional changes intended. Acked-by: Neha Malcom Francis <n-francis@ti.com> Tested-by: Love Kumar <love.kumar@amd.com> [narmstrong: do not rename CFG_RESULT_CODE_MASK] Link: https://lore.kernel.org/r/20241230-topic-ufs-cleanup-v2-6-4c6d7994a45d@linaro.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-03-18ufs: core: sync unipro.h with Linux v6.12Neil Armstrong
Sync unipro.h with the version found in the Linux v6.12 version commit adc218676eef ("Linux 6.12"). It adds new defines, and moves defines to the same place as the Linux header. No functional changes intended. Acked-by: Neha Malcom Francis <n-francis@ti.com> Tested-by: Love Kumar <love.kumar@amd.com> Link: https://lore.kernel.org/r/20241230-topic-ufs-cleanup-v2-5-4c6d7994a45d@linaro.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-03-18ufs: core: move ufshci defines in a separate headerNeil Armstrong
Splitting the header will help synchronizing the defines again with Linux. Acked-by: Neha Malcom Francis <n-francis@ti.com> Tested-by: Love Kumar <love.kumar@amd.com> Link: https://lore.kernel.org/r/20241230-topic-ufs-cleanup-v2-4-4c6d7994a45d@linaro.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-03-18ufs: core: cosmetic fixupsNeil Armstrong
Fixes some alignment warnings, missing comments on write barrier, missing parenthesis around macro parameters and a comment typo. No functional changes intended. Reviewed-by: Neha Malcom Francis <n-francis@ti.com> Tested-by: Love Kumar <love.kumar@amd.com> Link: https://lore.kernel.org/r/20241230-topic-ufs-cleanup-v2-3-4c6d7994a45d@linaro.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-03-18ufs: core: mark unexported functions as staticNeil Armstrong
Mark the remaining local functions as static to avoid build warnings. Also drop the EXPORT_SYMBOL of ufshcd_map_desc_id_to_length. Tested-by: Love Kumar <love.kumar@amd.com> Link: https://lore.kernel.org/r/20241230-topic-ufs-cleanup-v2-2-4c6d7994a45d@linaro.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-03-18ufs: core: include missing include/ufs.hNeil Armstrong
Add missing ufs.h causing build warning on some symbols. Tested-by: Love Kumar <love.kumar@amd.com> Reviewed-by: Neha Malcom Francis <n-francis@ti.com> Link: https://lore.kernel.org/r/20241230-topic-ufs-cleanup-v2-1-4c6d7994a45d@linaro.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2024-10-14ufs: Add Support for Qualcomm UFS HC driverBhupesh Sharma
Add Support for the Host Controller driver for UFS HC present on Qualcomm Snapdragon SoCs. It has been successfully tested on SDM845, SM8250, SM8550 ant SM8650 SoCs. Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org> Tested-by: Julius Lehmann <lehmanju@devpi.de> Tested-by: Caleb Connolly <caleb.connolly@linaro.org> #rb3gen2 Link: https://lore.kernel.org/r/20240910-topic-ufs-qcom-controller-v1-4-54c0d2231b10@linaro.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2024-10-14ufs: allow UFSHCI version 4.0Neil Armstrong
Add UFSHCI version 4.0 found on the recent Qualcomm UFS Controllers. Tested-by: Julius Lehmann <lehmanju@devpi.de> Tested-by: Caleb Connolly <caleb.connolly@linaro.org> #rb3gen2 Link: https://lore.kernel.org/r/20240910-topic-ufs-qcom-controller-v1-3-54c0d2231b10@linaro.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2024-10-14ufs: add get_max_pwr_mode callbackNeil Armstrong
Add a new get_max_pwr_mode callback to permit the UFS controller driver manipulate the max_pwr_mode struct right before setting the new pwr_mode to the UFS device. It can be used to limit the HS Gear with errata and hardware limitations on some UFS controllers. Tested-by: Julius Lehmann <lehmanju@devpi.de> Tested-by: Caleb Connolly <caleb.connolly@linaro.org> #rb3gen2 Link: https://lore.kernel.org/r/20240910-topic-ufs-qcom-controller-v1-2-54c0d2231b10@linaro.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2024-10-14ufs: add device_reset callbackNeil Armstrong
Add device_reset op to permit resetting the UFS device if the UFS controller drivers supports the operation. Tested-by: Julius Lehmann <lehmanju@devpi.de> Tested-by: Caleb Connolly <caleb.connolly@linaro.org> #rb3gen2 Link: https://lore.kernel.org/r/20240910-topic-ufs-qcom-controller-v1-1-54c0d2231b10@linaro.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2024-10-14ufs: ufs-amd-versal2: Add support for AMD UFS controllerVenkatesh Yadav Abbarapu
Add UFS AMD platform support on top of the UFS DWC and UFS platform driver. UFS AMD platform requires some platform specific configurations like M-PHY/RMMI/UniPro and vendor specific registers programming before doing the LINKSTARTUP. Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://lore.kernel.org/r/20240920041651.18173-3-venkatesh.abbarapu@amd.com Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2024-10-14ufs: add support for DesignWare ControllerVenkatesh Yadav Abbarapu
This patch has the goal to add support for DesignWare UFS Controller specific operations. This is based on linux kernel commit: "drivers/scsi/ufs/ufshcd-dwc.c: ufs: add support for DesignWare Controller" (sha1: 4b9ffb5a353bdee49f1f477ffe2b95ab3f9cbc0c) It is ported from linux kernel 6.11-rc1. Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://lore.kernel.org/r/20240920041651.18173-2-venkatesh.abbarapu@amd.com Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2024-10-14ufs: core: remove link_startup_again logicNeil Armstrong
The link_startup_again logic was added in Linux to handle device that were set in LinkDown state, which should not be the case since U-boot doesn't set LinkDown state are init, and Linux sets the device active in ufshcd_init() for the first link startup. ufshcd_set_ufs_dev_active(hba) is called at ufshcd_init() right before scheduling an ufshcd_async_scan that will call ufshcd_device_init() then ufshcd_link_startup(). The comment in probe says: /* * We are assuming that device wasn't put in sleep/power-down * state exclusively during the boot stage before kernel. * This assumption helps avoid doing link startup twice during * ufshcd_probe_hba(). */ we can assume the same from U-Boot. While it worked to far, it breaks link startup for Qualcomm Controllers v5, let's just remove the logic. Tested-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com> Tested-by: Julius Lehmann <lehmanju@devpi.de> Link: https://lore.kernel.org/r/20240930-topic-ufs-enhancements-v3-12-58234f84ab89@linaro.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2024-10-14ufs: Fix debug message in 'ufs_start'Bhupesh Sharma
Minor typo fix and rewording of printf message inside 'ufs_start' which announces the availability of the UFS device. Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org> Tested-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com> Tested-by: Julius Lehmann <lehmanju@devpi.de> Link: https://lore.kernel.org/r/20240930-topic-ufs-enhancements-v3-11-58234f84ab89@linaro.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2024-10-14ufs: Add missing memory barriersBhupesh Sharma
Add missing wmb() and mb() barriers in the u-boot UFS core framework driver to allow registers updates to happen before follow-up read operations. This makes the barrier placement similar to the Linux UFS driver, synced from the Linux v6.9 release. Starting from the v6.10 release, the barriers were replaced with a register read-back in [1], this will ported to u-boot in a second time. [1] https://lore.kernel.org/all/20240329-ufs-reset-ensure-effect-before-delay-v5-0-181252004586@redhat.com/ Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org> Tested-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com> Tested-by: Julius Lehmann <lehmanju@devpi.de> Link: https://lore.kernel.org/r/20240930-topic-ufs-enhancements-v3-10-58234f84ab89@linaro.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2024-10-14ufs: Sync possible UFS Quirks with Linux UFS driverBhupesh Sharma
Sync u-boot UFS driver to add all possible UFS Quirks as supported by Linux UFS driver as well. Synced with include/ufs/ufshcd.h from Linux v6.11 release Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org> Tested-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com> Tested-by: Julius Lehmann <lehmanju@devpi.de> Link: https://lore.kernel.org/r/20240930-topic-ufs-enhancements-v3-9-58234f84ab89@linaro.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>