summaryrefslogtreecommitdiff
path: root/drivers/ufs
AgeCommit message (Collapse)Author
39 hourstreewide: Kconfig: use bool instead of tristateAnshul Dalal
U-Boot does not support modules, so having tristate options is useless. Therefore this patch does a blind replace of all tristate options to bool tree-wide. Signed-off-by: Anshul Dalal <[email protected]> Reviewed-by: Heiko Schocher <[email protected]> Reviewed-by: Quentin Schulz <[email protected]> Reviewed-by: Siddharth Vadapalli <[email protected]> Reviewed-by: Neha Malcom Francis <[email protected]> Reviewed-by: Romain Gantois <[email protected]> Reviewed-by: Simon Glass <[email protected]>
4 daysufs: amd-versal2: Fix missing .priv_auto in driver registrationPranav Tilak
Add missing .priv_auto field to the driver. Without it, struct ufs_versal2_priv is never properly allocated and dev_get_priv() returns NULL, leading to DDR corruption at low DDR addresses. Fixes: b5ac5f030720 ("ufs: ufs-amd-versal2: Add support for AMD UFS controller") Signed-off-by: Pranav Tilak <[email protected]> Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: Michal Simek <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2026-06-25Kconfig: drivers: restyle remainingJohan Jonker
Restyle all Kconfigs for the rest of "drivers": Menu entries : no space left Menu attributes: 1 TAB Help text : 1 TAB + 2 spaces Replace '---help---' by 'help' Signed-off-by: Johan Jonker <[email protected]> [trini: Add missing indentation on a few more multi-paragraph help texts] Signed-off-by: Tom Rini <[email protected]>
2026-05-18ufs: qcom: Remove redundant POST_CHANGE clock setup callBalaji Selvanathan
The ufs_qcom_init() function was calling ufs_qcom_setup_clocks() with POST_CHANGE twice. The first call after setting PA_TXHSADAPTTYPE correctly enables the device reference clock. The second call after ufs_qcom_advertise_quirks() is redundant as the clock is already enabled. Signed-off-by: Balaji Selvanathan <[email protected]> Reviewed-by: Sumit Garg <[email protected]> Reviewed-by: Neha Malcom Francis <[email protected]> Reviewed-by: Casey Connolly <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Casey Connolly <[email protected]>
2026-05-18drivers: ufs: qcom: Initialize and enable clocks before hardware accessBalaji Selvanathan
Move UFS clock initialization and enabling before hardware setup to ensure clocks are running when accessing UFS registers. Previously, U-Boot depended on earlier bootloader stages to initialize UFS clocks. When these bootloaders failed to do so, UFS registers became inaccessible, causing initialization to fail. This change makes U-Boot initialize and enable UFS clocks early in the init sequence, removing the dependency on previous bootloaders. Signed-off-by: Balaji Selvanathan <[email protected]> Reviewed-by: Sumit Garg <[email protected]> Reviewed-by: Casey Connolly <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Casey Connolly <[email protected]>
2026-04-22ufs: rcar-gen5: Update line reset configurationMarek Vasut
Synchronize line reset configuration with SDK 4.28 parameters. These values are programmed into the PHY. Signed-off-by: Marek Vasut <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
2026-04-22ufs: core: Fix heap corruption due to out of bounds writeMarek Vasut
The ufshcd_read_string_desc() can perform out of bounds write and corrupt heap in case the input utf-16 string contains code points which convert to anything more than plain 7-bit ASCII string. This occurs because utf16_to_utf8(dst, src, size) in U-Boot behaves differently than Linux utf16s_to_utf8s(..., maxlen), but the porting process did not take that into consideration. The U-Boot variant of the function converts up to $size utf-16 fixed-length 16-bit input characters into as many 1..4 Byte long variable-length utf-8 output characters. That means for 16 Byte input, the output can be up to 64 Bytes long. The Linux variant converts up utf-16 input into up to $maxlen Bytes worth of utf-8 output, but stops at the $maxlen limit. That means for 16 Byte input with maxlen=32, the processing will stop after writing 32 output Bytes. In case of U-Boot, use of utf16_to_utf8() leads to potential corruption of data past the $size Bytes and therefore corruption of surrounding content on the heap. The fix is as simple, allocate buffer that is sufficient to fit the utf-8 string. The rest of the code in ufshcd_read_string_desc() does correctly limit the buffer to fit into the DMA descriptor afterward. Signed-off-by: Marek Vasut <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
2026-04-22ufs: rockchip: Make use of controller resetsAlexey Charkov
Assert Rockchip UFS controller resets during initialization and HCE enable, as it is done by the Linux driver. This is required to make some UFS chips, such as Foresee FEUDNN064G-C2G0, work properly. Note that the resets were already requested in the probe function, just not used. Signed-off-by: Alexey Charkov <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
2026-04-17ufs: mediatek: clean up zero terminatorDavid Lechner
Remove spurious blank line and trailing comma of the zero terminator at the end of the devicetree compatible list. Reviewed-by: Neil Armstrong <[email protected]> Reviewed-by: Macpaul Lin <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: David Lechner <[email protected]>
2026-04-17ufs: ufs-mediatek: add mt8183-ufshci compatibleDavid Lechner
Add a new compatible match for mediatek,mt8183-ufshci. This compatible is already defined in upstream devicetree bindings. Link: https://patch.msgid.link/[email protected] Signed-off-by: David Lechner <[email protected]>
2026-04-17drivers: ufs: ufs-mediatek: add MT8195 compatibleJulien Stephan
Add MT8195 compatible string. Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: Julien Stephan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: David Lechner <[email protected]>
2026-04-17drivers: ufs: ufs-mediatek: implement clockingJulien Stephan
Implement clocking. Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: Julien Stephan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: David Lechner <[email protected]>
2026-04-17drivers: ufs: ufs-mediatek: fix phy handlingJulien Stephan
Currently mphy is declared as a pointer inside ufs_mtk_host struct, but it is never initialized. Fix this by using a struct phy directly in ufs_mtk_host struct instead of a struct phy*. Update all call to mphy accordingly. Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: Julien Stephan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: David Lechner <[email protected]>
2026-04-08ufs: Remap CPU to bus addresses using dev_phys_to_bus()Marek Vasut
Use dev_phys_to_bus() to convert CPU addresses of DMA descriptors into bus addresses of DMA descriptors. This is necessary on hardware which does not have 1:1 mapping between CPU and memory addressed by the DMA. This has no impact on other hardware which does not need this conversion. Signed-off-by: Marek Vasut <[email protected]>
2026-03-13Merge tag 'u-boot-ufs-20260313' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-ufs into next - ufs_hba_ops callbacks cleanup - Rockchip UFS reset support - UFS support in SPL
2026-03-12ufs: rockchip: Add device reset supportAlexey Charkov
Wire up the GPIO line which Rockchip RK3576 UFS controller uses to reset the connected UFS device. This seems necessary at least for some UFS modules and fixes the following error while enumerating UFS storage: ufshcd-rockchip ufshc@2a2d0000: ufshcd_link_startup: Device not present ufshcd-rockchip ufshc@2a2d0000: link startup failed -6 ufshcd-rockchip ufshc@2a2d0000: ufshcd_pltfrm_init() failed -6 Note that the GPIO descriptor for device resets is already required by the DT binding (link enclosed). Link: https://elixir.bootlin.com/linux/v6.18.5/source/Documentation/devicetree/bindings/ufs/rockchip,rk3576-ufshc.yaml#L70 Fixes: 76465ce21ee4 ("ufs: rockchip: Add initial support") Reviewed-by: Neil Armstrong <[email protected]> Reviewed-by: Shawn Lin <[email protected]> Signed-off-by: Alexey Charkov <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
2026-03-05drivers: ufs: fix typo in struct ufs_dev_cmd kernel-docJulien Stephan
Fix "associated" typo in struct ufs_dev_cmd kernel-doc. Signed-off-by: Julien Stephan <[email protected]> Reviewed-by: Macpaul Lin <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
2026-03-05drivers: ufs: add helper for phy_initialization callbackJulien Stephan
Introduce ufshcd_ops_phy_initialization() as a helper for invoking the phy_initialization callback from ufs_hba_ops. This mirrors the existing helper pattern used for other ufs_hba_ops callbacks and keeps the call sites consistent and easier to maintain. Signed-off-by: Julien Stephan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
2026-03-05drivers: ufs: handle return values of ufs_hba_ops callbacksJulien Stephan
The return values of ufshcd_ops_link_startup_notify(), ufshcd_ops_hce_enable_notify(), ufshcd_ops_init(), and ufshcd_device_reset() are currently ignored. Check and propagate these return values properly and emit appropriate error messages on error. While at it, remove the ufshcd_device_reset() wrapper, which just call ufshcd_device_reset(). Signed-off-by: Julien Stephan <[email protected]> Reviewed-by: Macpaul Lin <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
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 <[email protected]> Reviewed-by: Neil Armstrong <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
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 <[email protected]> Signed-off-by: Michal Simek <[email protected]> Reviewed-by: Neil Armstrong <[email protected]> Link: https://patch.msgid.link/e6deb9086afab9d2bdd53db8ecbc7db93af5204d.1764169598.git.michal.simek@amd.com Signed-off-by: Neil Armstrong <[email protected]>
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 <[email protected]> Signed-off-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/446d67b751a96645799de3aeefec539735aa78c8.1741179611.git.geert+renesas@glider.be Signed-off-by: Martin K. Petersen <[email protected]> Signed-off-by: Marek Vasut <[email protected]> Reviewed-by: Neil Armstrong <[email protected]>
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 <[email protected]> Signed-off-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/110eafd1ee24f9db0285a5e2bca224e35962268a.1741179611.git.geert+renesas@glider.be Signed-off-by: Martin K. Petersen <[email protected]> Signed-off-by: Marek Vasut <[email protected]> Reviewed-by: Neil Armstrong <[email protected]>
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 <[email protected]> Signed-off-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/69500e4c18be1ca1de360f9e797e282ffef04004.1741179611.git.geert+renesas@glider.be Signed-off-by: Martin K. Petersen <[email protected]> Signed-off-by: Marek Vasut <[email protected]> Reviewed-by: Neil Armstrong <[email protected]>
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 <[email protected]> Signed-off-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/9fa240a9dc0308d6675138f8434eccb77f051650.1741179611.git.geert+renesas@glider.be Signed-off-by: Martin K. Petersen <[email protected]> Signed-off-by: Marek Vasut <[email protected]> Reviewed-by: Neil Armstrong <[email protected]>
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 <[email protected]> Signed-off-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/3520e27ac7ff512de6508f630eee3c1689a7c73d.1741179611.git.geert+renesas@glider.be Signed-off-by: Martin K. Petersen <[email protected]> Signed-off-by: Marek Vasut <[email protected]> Reviewed-by: Neil Armstrong <[email protected]>
2026-01-12ufs: amd-versal2: Fix reset names with bindingMichal Simek
Align reset names with DT binding. Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: Michal Simek <[email protected]> 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 <[email protected]> Signed-off-by: Michal Simek <[email protected]> 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 <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
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 <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
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 <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
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 <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
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/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
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 <[email protected]> Acked-by: Marek Vasut <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
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 <[email protected]> Reviewed-by: Igor Belwon <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
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 <[email protected]> Signed-off-by: Tuyen Dang <[email protected]> Signed-off-by: Marek Vasut <[email protected]> Reviewed-by: Neil Armstrong <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
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 <[email protected]> Signed-off-by: Marek Vasut <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
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 <[email protected]> Signed-off-by: Marek Vasut <[email protected]> Link: https://patch.msgid.link/[email protected] [narmstrong: also updated the rockchip and mediatek drivers] Signed-off-by: Neil Armstrong <[email protected]>
2025-10-28ufs: amd-versal2: Fix indentMarek Vasut
Fix indent, use tabs. No functional change. Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: Marek Vasut <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
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 <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
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 <[email protected]> Signed-off-by: Marek Vasut <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
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 <[email protected]> Signed-off-by: Marek Vasut <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
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 <[email protected]> Link: https://patch.msgid.link/20251011-mtk-ufs-uboot-v1-3-a05f991ee150@mentallysanemainliners.org Signed-off-by: Neil Armstrong <[email protected]>
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 <[email protected]> Link: https://patch.msgid.link/20251011-mtk-ufs-uboot-v1-2-a05f991ee150@mentallysanemainliners.org Signed-off-by: Neil Armstrong <[email protected]>
2025-10-28ufs: rockchip: Add initial supportShawn Lin
This patch adds initial support for UFS controller on Rockchip platforms. Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: Shawn Lin <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
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 <[email protected]> Signed-off-by: Shawn Lin <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
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 <[email protected]> Reviewed-by: Bryan Brattlof <[email protected]> Reviewed-by: Udit Kumar <[email protected]> Reviewed-by: Neha Malcom Francis <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
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 <[email protected]> Reviewed-by: Bryan Brattlof <[email protected]> Reviewed-by: Neil Armstrong <[email protected]> Reviewed-by: Udit Kumar <[email protected]> Reviewed-by: Neha Malcom Francis <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>
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 <[email protected]> Reviewed-by: Neil Armstrong <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Neil Armstrong <[email protected]>