Add UFS Host driver support for SpacemiT K3 SoC
Subsystems (5)
Yixun Lan
maintainerv10 cover Add UFS Host driver support for SpacemiT K3 SoC
This series try to add UFS support for SpacemiT K3 SoC, the controller components consists of System Bus Interface Unit, UFS Host Controller Interface, UFS Transport Protocol Layer, UFS Host Registers, Device Management Entity (DME), Transport Layer, Network Layer, Data Link Layer, PHY Adapter Layer, and M-PHY Interface. A more detail functional block diagram can be found in SpacemiT website, chapter 9.7.3 [1]
The DTS patch has been dropped in this series [2], and will send in separate series once this patch accepted. For people who want to test UFS driver, please grab the DT patch from version v5 [3].
Enable UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND, This allows the device auto-bkops to be always enabled except during suspend (both runtime and suspend), with this feature, the BKOPS interrupt (log below) isn't reported anymore.
[ 806.710763] ufshcd-spacemit c0e00000.ufshc: ufshcd_bkops_exception_event_handler: device raised urgent BKOPS exception for bkops status 1
---
Changes in v10:
- clean up some unncessary documentation comments
- fix check of ufs_spacemit_uniprov1p6_init()
- drop header files and macros
- drop a duplicate tag
- Link to v9: https://patch.msgid.link/[email protected]
Changes in v9:
- return check of ufs_spacemit_dme_set()
- drop spacemit_ufs_set_dev_cap()
- log ->saved_err
- sort macro definition
- Link to v8: https://patch.msgid.link/[email protected]
Changes in v8:
- enable UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND
- rename to "ref_clk", see explanation in patch
- add delay between enable clk & deassert reset
- respect bRefClkGatingWaitTime, add wait delay
- drop comment of ufs_hba_spacemit_vops, which got CI complaint
- rebase to v7.4-rc1
- Link to v7: https://patch.msgid.link/[email protected]
Changes in v7:
- check err return value of ufs_spacemit_quirk_host_pa_saveconfigtime()
- Link to v6: https://patch.msgid.link/[email protected]
Changes in v6:
- drop unused macro and dev_req_params
- use global PX_xx macros
- fix axi clock name
- drop dts patch
- collect tags
- Link to v5: https://patch.msgid.link/[email protected]
Changes in v5:
- adjust clock names
- add runtime power support
- collect tags
- Link to v4: https://patch.msgid.link/[email protected]
Changes in v4:
- fix clock and reset settings
- drop function which retrieve value of tx_lanes
- propagate return error of ufs_spacemit_dme_set()
- check return value ufs_spacemit_check_hibern8()
- drop call to ufshcd_vops_phy_initialization()
- handle compiling warning if CONFIG_OF not enabled
add __maybe_unused to ufs_spacemit_of_match
- Link to v3: https://patch.msgid.link/[email protected]
Changes in v3:
- collect tags
- fix dt-binding warning reported-by sashiko
- fix low freq in opp-2 table
- fix err checking in check_hibern8()
- propagate err code in link_startup_notify()
- update documents for event_notify()
- ufs clock driver is merged into v7.3-rc1, update cover letter
- Link to v2: https://patch.msgid.link/[email protected]
Changes in v2:
- fix missing interrupts property
- move ufs node to k3-com260.dtsi
- convert freq-table-hz to operating-points-v2
- rework reset_control, fix header and drop global variable
- drop dump_host_regs() debug interface
- converge and refactor dme_set() operations
- massive reduce of busy delay() loops
- drop vendor specific hce_enable_notify(), fallback to default
- drop unused member from struct ufs_spacemit_host
- add COMPILE_TEST support to Kconfig
- comment style fix
- Link to v1: https://patch.msgid.link/[email protected]
---
Yixun Lan (2):
scsi: ufs: spacemit: dt-bindings: Add UFS controller for K3 SoC
scsi: ufs: spacemit: k3: Add UFS Host Controller driver
.../devicetree/bindings/ufs/spacemit,k3-ufshc.yaml | 56 ++ drivers/ufs/host/Kconfig | 12 + drivers/ufs/host/Makefile | 1 + drivers/ufs/host/ufs-spacemit.c | 602 +++++++++++++++++++++ drivers/ufs/host/ufs-spacemit.h | 60 ++ 5 files changed, 731 insertions(+)
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20260605-08-k3-ufs-support-c8b308e415e2
Best regards,
Signature · 1 line
Yixun Lan <[email protected]>
Yixun Lan
maintainerPATCH v10 1/2 scsi: ufs: spacemit: dt-bindings: Add UFS controller for K3 SoC
Document the compatible for UFS (Universal Flash Storage) Host Controller which found in SpacemiT K3 SoC chip. Its features are listed below:
- Compliant with MIPI UniPro v1.61 specification.
- Compliant with M-PHY v3.0 specification.
- Compliant with UFS HCI v2.1 specification.
- Supports up to 2 Tx and 2 Rx lanes, up to HS-GEAR3 5.8 Gbps per lane.
- Supports standard low-power hibernate to reduce power consumption.
---
Changes in v8:
- rename to "ref_clk" clock
UFS core will search specific "ref_clk" clock, retrieve the frequency, and then set bRefClkFreq, see ufshcd_parse_dev_ref_clk_freq() and ufshcd_set_dev_ref_clk(). It will also set keep_link_active feature.
--- .../devicetree/bindings/ufs/spacemit,k3-ufshc.yaml | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+)
Documentation/devicetree/bindings/ufs/spacemit,k3-ufshc.yaml new file +56 -0
@@ -0,0 +1,56 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/ufs/spacemit,k3-ufshc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: SpacemiT K3 SoC UFS Host Controller + +maintainers: + - Yixun Lan <[email protected]> + +properties: + compatible: + const: spacemit,k3-ufshc + + reg: + maxItems: 1 + + clocks: + maxItems: 2 + + clock-names: + items: + - const: axi + - const: ref_clk + + resets: + maxItems: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - resets + +allOf: + - $ref: ufs-common.yaml + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/clock/spacemit,k3-clocks.h> + #include <dt-bindings/reset/spacemit,k3-resets.h> + #include <dt-bindings/interrupt-controller/irq.h> + ufs@c0e00000 { + compatible = "spacemit,k3-ufshc"; + reg = <0xc0e00000 0x40000>; + clocks = <&syscon_apmu CLK_APMU_UFS_ACLK>, + <&syscon_apmu CLK_APMU_UFS_REFCLK>; + clock-names = "axi", "ref_clk"; + resets = <&syscon_apmu RESET_APMU_UFS_ACLK>; + interrupts = <135 IRQ_TYPE_LEVEL_HIGH>; + lanes-per-direction = <2>; + };
Signature · 1 line
2.56.0
Yixun Lan
maintainerPATCH v10 2/2 scsi: ufs: spacemit: k3: Add UFS Host Controller driver
In reply to Yixun LanSpacemiT K3 SoC consist of UFS (Universal Flash Storage) Host Controller which has features compatible with JEDEC UFS 2.2, MIPI UniPro v1.61 and M-PHY v3.0 standard.
--- drivers/ufs/host/Kconfig | 12 + drivers/ufs/host/Makefile | 1 + drivers/ufs/host/ufs-spacemit.c | 602 ++++++++++++++++++++++++++++++++++++++++ drivers/ufs/host/ufs-spacemit.h | 60 ++++ 4 files changed, 675 insertions(+)
drivers/ufs/host/Kconfig +12 -0
@@ -132,6 +132,18 @@ config SCSI_UFS_VARIABLE_SG_ENTRY_SIZE bool default y if SCSI_UFS_EXYNOS && SCSI_UFS_CRYPTO +config SCSI_UFS_SPACEMIT + tristate "SpacemiT UFS controller driver" + depends on SCSI_UFSHCD_PLATFORM && (ARCH_SPACEMIT || COMPILE_TEST) + help + This selects the SpacemiT specific additions to UFSHCD platform driver. + UFS host on SpacemiT needs some vendor specific configuration before + accessing the hardware which includes PHY configuration and vendor + specific registers. + + Select this if you have UFS controller on SpacemiT chipset. + If unsure, say N. + config SCSI_UFS_SPRD tristate "Unisoc specific hooks to UFS controller platform driver" depends on SCSI_UFSHCD_PLATFORM && (ARCH_SPRD || COMPILE_TEST)
drivers/ufs/host/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_SCSI_UFS_HISI) += ufs-hisi.o obj-$(CONFIG_SCSI_UFS_MEDIATEK) += ufs-mediatek.o obj-$(CONFIG_SCSI_UFS_RENESAS) += ufs-renesas.o obj-$(CONFIG_SCSI_UFS_ROCKCHIP) += ufs-rockchip.o +obj-$(CONFIG_SCSI_UFS_SPACEMIT) += ufs-spacemit.o obj-$(CONFIG_SCSI_UFS_SPRD) += ufs-sprd.o obj-$(CONFIG_SCSI_UFS_TI_J721E) += ti-j721e-ufs.o obj-$(CONFIG_SCSI_UFS_AMD_VERSAL2) += ufs-amd-versal2.o ufshcd-dwc.o
drivers/ufs/host/ufs-spacemit.c new file +602 -0
602 lines not on this page · raw message
drivers/ufs/host/ufs-spacemit.h new file +60 -0
60 lines not on this page · raw message
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH v10 2/2] scsi: ufs: spacemit: k3: Add UFS Host Controller driver
Thank you for your contribution! Sashiko AI review found 9 potential issues to consider: - [Medium] scsi: ufs: spacemit: missing RESET_CONTROLLER Kconfig dependency - [Medium] scsi: ufs: spacemit…
Thank you for your contribution! Sashiko AI review found 9 potential issues to consider:
- [Medium] scsi: ufs: spacemit: missing RESET_CONTROLLER Kconfig dependency
- [Medium] scsi: ufs: spacemit: broken ufs_spacemit_pwr_change_notify() state handling
- [Medium] scsi: ufs: spacemit: hardcoded 2-lane poll in ufs_spacemit_check_hibern8()
- [Medium] scsi: ufs: spacemit: zero clk_gating_wait_us passed to fsleep() on UFS 2.x
- [Medium] ufs: spacemit: unratelimited dev_warn() in ufs_spacemit_event_notify()
- [Low] scsi: ufs: spacemit: negative err check misses positive UIC DME errors
- [Low] scsi: ufs: spacemit: struct ufshcd_dme_attr_val collides with ufshcd-dwc.h
- [Low] scsi: ufs: spacemit: unused struct ufs_spacemit_host in ufs_spacemit_init()
- [Low] ufs: raw UniPro hex IDs and RX selectors in ufs_spacemit_uniprov1p6_init()
--
commit 941ff806ad9ca814afb140eeccebd9435ce81e1c
Author: Yixun Lan <[email protected]>
scsi: ufs: spacemit: k3: Add UFS Host Controller driver
This commit adds the platform UFS host controller driver for the SpacemiT K3 SoC, including M-PHY and UniPro initialization, power mode negotiation, hibern8 handling, and Kconfig/Makefile wiring.
drivers/ufs/host/Kconfig config SCSI_UFS_VARIABLE_SG_ENTRY_SIZE · line 137
Quoted 11 lines
drivers/ufs/host/Kconfig +3
-0@@ -132,6 +132,18 @@ config SCSI_UFS_VARIABLE_SG_ENTRY_SIZE bool default y if SCSI_UFS_EXYNOS && SCSI_UFS_CRYPTO +config SCSI_UFS_SPACEMIT + tristate "SpacemiT UFS controller driver" + depends on SCSI_UFSHCD_PLATFORM && (ARCH_SPACEMIT || COMPILE_TEST)
[Severity: Medium]
Should SCSI_UFS_SPACEMIT also depend on RESET_CONTROLLER?
ufs_spacemit_init() requests a non-optional reset control via devm_reset_control_get_exclusive_deasserted(), which always returns -ENOTSUPP when CONFIG_RESET_CONTROLLER is disabled. Neither ARCH_SPACEMIT nor SCSI_UFSHCD_PLATFORM selects RESET_CONTROLLER, so a SpacemiT-only config without it compiles cleanly but fails probe on every boot.
Quoted 5 lines
drivers/ufs/host/ufs-spacemit.c new file +0
-0
[ ... ]
Quoted 15 lines
drivers/ufs/host/ufs-spacemit.c new file +15
-0+static int ufs_spacemit_check_hibern8 (struct ufs_hba *hba) +{ +u32 tx_fsm_val_0 =0 ; +u32 tx_fsm_val_1 =0 ; +int retries =DIV_ROUND_UP (HBRN8_POLL_TOUT_MS *1000 ,100 ); +int err =0 ; + + do { + err = ufshcd_dme_get(hba, + UIC_ARG_MIB_SEL(MPHY_TX_FSM_STATE, + UIC_ARG_MPHY_TX_GEN_SEL_INDEX(0)), + &tx_fsm_val_0); + if (err) + break; +
drivers/ufs/host/ufs-spacemit.c line 65
Quoted 10 lines
drivers/ufs/host/ufs-spacemit.c new file +10
-0+ err =ufshcd_dme_get (hba, +UIC_ARG_MIB_SEL (MPHY_TX_FSM_STATE , +UIC_ARG_MPHY_TX_GEN_SEL_INDEX (1 )), + &tx_fsm_val_1); +if (err || (tx_fsm_val_0 ==TX_FSM_HIBERN8 && + tx_fsm_val_1 ==TX_FSM_HIBERN8 )) +break ; + +usleep_range (100 ,200 ); + }while (--retries >0 );
[Severity: Medium]
Does ufs_spacemit_check_hibern8() time out on every Hibern8 entry for a 1-lane UFS device?
Both the DT binding (via ufs-common.yaml) and ufshcd_negotiate_pwr_params() allow 1-lane links, where unconnected TX lane 1 stays disabled instead of entering TX_FSM_HIBERN8. Because this loop unconditionally requires lane 1 to report TX_FSM_HIBERN8, every runtime autosuspend and system suspend stalls for the full poll loop and logs -ETIMEDOUT errors.
Separately, counting retries with usleep_range(100, 200) and two synchronous ufshcd_dme_get() calls per iteration stretches the nominal 100 ms HBRN8_POLL_TOUT_MS bound past 200 ms; polling against a jiffies or ktime deadline avoids that overshoot.
[ ... ]
Quoted 11 lines
drivers/ufs/host/ufs-spacemit.c new file +11
-0+ { UIC_ARG_MIB(0x15A8), 0x64 }, /* PA_TACTIVATE */ + { UIC_ARG_MIB(0x1564), 0x64 }, /* PA_TXTRAILINGCLOCKS */ + { UIC_ARG_MIB_SEL(0x008D, 4), 0x0B }, /* RX_LS_PREPARELEN_TIME RX0 */ + { UIC_ARG_MIB_SEL(0x008D, 5), 0x0B }, /* RX_LS_PREPARELEN_TIME RX1 */ + +/* RX_HIBERNATE_BKEN RX0 */ + { UIC_ARG_MIB_SEL(0x00F4, UIC_ARG_MPHY_RX_GEN_SEL_INDEX(0)), 0x9F }, +/* RX_HIBERNATE_BKEN RX1 */ + { UIC_ARG_MIB_SEL(0x00F4, UIC_ARG_MPHY_RX_GEN_SEL_INDEX(1)), 0x9F }, +/* PWM_BURST_closure_length */ + { UIC_ARG_MIB_SEL(0x008E, UIC_ARG_MPHY_RX_GEN_SEL_INDEX(0)), 15 },
drivers/ufs/host/ufs-spacemit.c line 203
Quoted 10 lines
drivers/ufs/host/ufs-spacemit.c new file +10
-0+ { UIC_ARG_MIB_SEL(0x008E, UIC_ARG_MPHY_RX_GEN_SEL_INDEX(1)), 15 }, +/* min_stall_not_config_time */ + { UIC_ARG_MIB_SEL(0x0088, UIC_ARG_MPHY_RX_GEN_SEL_INDEX(0)), 0xFF }, + { UIC_ARG_MIB_SEL(0x0088, UIC_ARG_MPHY_RX_GEN_SEL_INDEX(1)), 0xFF }, +/* TX HB8_TIME CAP */ + { UIC_ARG_MIB_SEL(0x000F, UIC_ARG_MPHY_TX_GEN_SEL_INDEX(0)), 0x64 }, + { UIC_ARG_MIB_SEL(0x000F, UIC_ARG_MPHY_TX_GEN_SEL_INDEX(1)), 0x64 }, +/* RX HB8_TIME CAP */ + { UIC_ARG_MIB_SEL(0x0092, UIC_ARG_MPHY_RX_GEN_SEL_INDEX(0)), 0x64 }, + { UIC_ARG_MIB_SEL(0x0092, UIC_ARG_MPHY_RX_GEN_SEL_INDEX(1)), 0x64 },
[Severity: Low]
Can ufs_spacemit_uniprov1p6_init() use the existing UniPro macros from include/ufs/unipro.h instead of raw hex literals? PA_TACTIVATE (0x15A8), PA_TXTRAILINGCLOCKS (0x1564), TX_HIBERN8TIME_CAPABILITY (0x000F), and RX_HIBERN8TIME_CAPABILITY (0x0092) are already defined there, and the hardcoded selectors 4 and 5 on 0x008D can use UIC_ARG_MPHY_RX_GEN_SEL_INDEX(0) and UIC_ARG_MPHY_RX_GEN_SEL_INDEX(1) like the entries below them.
[ ... ]
Quoted 19 lines
drivers/ufs/host/ufs-spacemit.c new file +19
-0+static int ufs_spacemit_pwr_change_notify (struct ufs_hba *hba, +enum ufs_notify_change_status status, +struct ufs_pa_layer_attr *dev_req_params) +{ +int ret =0 ; + +if (!dev_req_params) { +dev_err (hba->dev,"Invalid Parameters\n" ); +return -EINVAL ; + } + +switch (status) { +case PRE_CHANGE : +break ; +case POST_CHANGE : + ret =ufs_spacemit_wait_mphy_pll_lock (hba); +if (ret <0 ) +return ret; +
drivers/ufs/host/ufs-spacemit.c line 333
Quoted 10 lines
drivers/ufs/host/ufs-spacemit.c new file +10
-0+dev_dbg (hba->dev,"M-PHY PLL locked after power mode change\n" ); +/* Set ANA_HSGEAR_CTRL_ATTR back to default value */ +ufshcd_dme_set (hba,UIC_ARG_MIB (ANA_HSGEAR_CTRL_ATTR ),0x00 ); +break ; +default : +return -EINVAL ; + } + +return ret; +}
[Severity: Medium]
Can rejecting a NULL dev_req_params here leave ANA_HSGEAR_CTRL_ATTR stuck at 0x25 when a power mode change fails?
ufshcd_change_power_mode() always invokes POST_CHANGE to pair with PRE_CHANGE and passes dev_req_params = NULL when ufshcd_dme_change_power_mode() fails. Because this callback never uses dev_req_params, returning -EINVAL on NULL logs a spurious error and skips resetting ANA_HSGEAR_CTRL_ATTR back to 0x00.
Also, ANA_HSGEAR_CTRL_ATTR is only set to 0x25 in ufs_spacemit_apply_dev_quirks(), while PRE_CHANGE is a no-op. When ufshcd_err_handler() restores HS mode via ufshcd_config_pwr_mode() after a LINERESET without re-running apply_dev_quirks(), the power mode change runs with ANA_HSGEAR_CTRL_ATTR still at 0x00. Programming ANA_HSGEAR_CTRL_ATTR in PRE_CHANGE would keep both transitions paired.
[ ... ]
drivers/ufs/host/ufs-spacemit.c line 366
Quoted 5 lines
drivers/ufs/host/ufs-spacemit.c new file +5
-0+if (hba->dev_quirks &UFS_DEVICE_QUIRK_HOST_PA_SAVECONFIGTIME ) { + err =ufs_spacemit_quirk_host_pa_saveconfigtime (hba); +if (err <0 ) +return err; + }
[Severity: Low]
Does checking err < 0 here miss UniPro DME errors from ufs_spacemit_quirk_host_pa_saveconfigtime()?
When a DME_GET or DME_SET command fails at the UniPro layer, ufshcd_wait_for_uic_cmd() returns a positive 8-bit ConfigResultCode (uic_cmd->argument2 & MASK_UIC_COMMAND_RESULT). Checking if (err) instead of if (err < 0) matches the rest of the driver; similarly, ufs_spacemit_pwr_change_notify() discards the return value of ufshcd_dme_set() for ANA_HSGEAR_CTRL_ATTR instead of assigning it to ret.
[ ... ]
Quoted 6 lines
drivers/ufs/host/ufs-spacemit.c new file +6
-0+static int ufs_spacemit_init (struct ufs_hba *hba) +{ +struct device *dev = hba->dev; +struct ufs_spacemit_host *host; +struct reset_control *rst; +
drivers/ufs/host/ufs-spacemit.c line 398
Quoted 10 lines
drivers/ufs/host/ufs-spacemit.c new file +10
-0+ host =devm_kzalloc (dev,sizeof (*host),GFP_KERNEL ); +if (!host) +return -ENOMEM ; + + rst =devm_reset_control_get_exclusive_deasserted (dev,NULL ); +if (IS_ERR (rst)) +return dev_err_probe (dev,PTR_ERR (rst),"Failed to get reset control\n" ); + + host->hba = hba; +ufshcd_set_variant (hba, host);
[Severity: Low]
Is struct ufs_spacemit_host needed yet? Nothing in this driver or the UFS core reads hba->priv or calls ufshcd_get_variant(), so the struct definition and devm_kzalloc() allocation in ufs_spacemit_init() are dead code until a feature actually requires per-instance private state.
[ ... ]
Quoted 5 lines
drivers/ufs/host/ufs-spacemit.c new file +5
-0+static void ufs_spacemit_event_notify (struct ufs_hba *hba,enum ufs_event_type evt,void *data) +{ +switch (evt) { +case UFS_EVT_PA_ERR : +if (data)
drivers/ufs/host/ufs-spacemit.c line 457
Quoted 10 lines
drivers/ufs/host/ufs-spacemit.c new file +10
-0+dev_warn (hba->dev,"PA error event, INT errors:0x%x, PA_ERR_CODE:0x%x\n" , + hba->errors, *(u32 *)data); + +break ; +case UFS_EVT_DL_ERR : +if (data) +dev_warn (hba->dev,"DL error event, INT errors:0x%x, DL_ERR:0x%x\n" , + hba->errors, *(u32 *)data); + +break ;
[Severity: Medium]
Can these unratelimited dev_warn() calls cause printk storms and host_lock stalls on a noisy link?
ufshcd_intr() -> ufshcd_check_errors() -> ufshcd_update_uic_error() -> ufshcd_update_evt_hist() invokes event_notify synchronously in hardirq context while holding hba->host->host_lock with local IRQs disabled. For non-fatal PA or DL errors, the core does not mask UIC_ERROR or schedule error recovery, so repeated link errors can flood serial consoles, stall SCSI command handling, and risk soft lockups. Switching to dev_warn_ratelimited() or dev_dbg() avoids this.
[ ... ]
drivers/ufs/host/ufs-spacemit.c line 533
Quoted 8 lines
drivers/ufs/host/ufs-spacemit.c new file +8
-0+/* Power down M-PHY */ +ufshcd_writel (hba,0x0 ,UFS_PHY_MNG_BASE +UFS_MPHY_PU_CTRL ); + +fsleep (hba->dev_info.clk_gating_wait_us); + +/* Disable reference clock, keep device reset deasserted */ +ufshcd_writel (hba,MPHY_DEVICE_HW_RESET , +UFS_PHY_MNG_BASE +UFS_DEVICE_IO_CTRL );
[Severity: Medium]
Does fsleep(hba->dev_info.clk_gating_wait_us) turn into a zero-delay no-op on UFS 2.x devices?
ufshcd_get_ref_clk_gating_wait() only populates clk_gating_wait_us when wspecversion >= 0x300, leaving it at 0 for all UFS 2.0/2.1/2.2 devices. On devices that require 30-100 us of REF_CLK hold time after Hibern8 entry (or when an early UIC error skips the preceding DME commands), clearing MPHY_DEVICE_REFCLK_OE without a non-zero fallback delay can cause Hibern8 exit failures or link errors during runtime autosuspend. Other host drivers such as ufs-qcom and ufs-mediatek guard against a zero value with an explicit fallback delay.
Quoted 5 lines
drivers/ufs/host/ufs-spacemit.h new file +0
-0
[ ... ]
drivers/ufs/host/ufs-spacemit.h line 59
Quoted 4 lines
drivers/ufs/host/ufs-spacemit.h new file +4
-0+struct ufshcd_dme_attr_val { +u32 attr_sel; +u32 mib_val; +};
[Severity: Low]
Does struct ufshcd_dme_attr_val collide with the existing three-field struct ufshcd_dme_attr_val in drivers/ufs/host/ufshcd-dwc.h? Renaming this to a driver-private tag such as struct ufs_spacemit_dme_attr_val avoids type-identity confusion in BTF/DWARF tooling and potential header inclusion conflicts.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2