aboutsummaryrefslogtreecommitdiff
path: root/drivers/mmc/host
AgeCommit message (Collapse)AuthorFilesLines
25 hoursMerge tag 'mmc-v7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmcLinus Torvalds11-51/+301
Pull MMC updates from Ulf Hansson: "MMC core: - Validate host's max_segs to fail gracefully MMC host: - davinci: - Avoid potential NULL dereference in the IRQ handler - Call mmc_add_host() in the correct order during probe - dw_mmc-exynos: - Increase DMA threshold for exynos7870 - renesas_sdhi: - Add support for RZ/G2E, RZ/G2N and R-Car M3Le variants - sdhci-msm: - Add support for Hawi, Eliza and Shikra variants - sdhci-of-k1: - Add support for SD UHS-I modes - Add support for tuning for eMMC HS200 and SD UHS-I" * tag 'mmc-v7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (24 commits) mmc: dw_mmc: Add desc_num field for clarity dt-bindings: mmc: sdhci-msm: Rename the binding to include 'qcom' prefix mmc: sdhci-of-dwcmshc: use dev_err_probe() to simplify error paths mmc: sdhci-of-dwcmshc: remove redundant IS_ERR() check dt-bindings: mmc: sdhci-msm: qcom: Add Hawi compatible mmc: renesas_sdhi: Add OF entry for RZ/G2E SoC mmc: renesas_sdhi: Add OF entry for RZ/G2N SoC dt-bindings: mmc: sdhci-msm: Add Eliza compatible mmc: davinci: fix mmc_add_host order in probe dt-bindings: mmc: sdhci-msm: Document the Shikra compatible mmc: sdhci-of-k1: add comprehensive SDR tuning support mmc: sdhci-of-k1: add regulator and pinctrl voltage switching support mmc: sdhci-of-k1: enable essential clock infrastructure for SD operation dt-bindings: mmc: spacemit,sdhci: add pinctrl support for voltage switching mmc: via-sdmmc: Simplify initialisation of pci_device_id array mmc: davinci: avoid NULL deref of host->data in IRQ handler memstick: Constify the driver id_table mmc: host: Move MODULE_DEVICE_TABLE next to the table itself mmc: renesas_sdhi: add R-Car M3Le compatibility string dt-bindings: mmc: renesas,sdhi: Document R-Car M3Le support ...
13 daysMerge tag 'mmc-v7.1-rc3' of ↵Linus Torvalds5-25/+58
git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc Pull MMC fixes from Ulf Hansson: "MMC core: - Fix host controller programming for eMMC fixed driver type MMC host: - dw_mmc-rockchip: Add missing private data for very old controllers - litex_mmc: Fix clock management - renesas_sdhi: Add OF entry for RZ/G2H SoC - sdhci: Manage signal voltage switch during system resume for some hosts - sdhci-of-dwcmshc: Fix reset, clk and SDIO support for Eswin EIC7700" * tag 'mmc-v7.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: mmc: sdhci: add signal voltage switch in sdhci_resume_host mmc: dw_mmc-rockchip: Add missing private data for very old controllers mmc: litex_mmc: Set mandatory idle clocks before CMD0 mmc: litex_mmc: Use DIV_ROUND_UP for more accurate clock calculation mmc: renesas_sdhi: Add OF entry for RZ/G2H SoC mmc: sdhci-of-dwcmshc: Fix reset, clk, and SDIO support for Eswin EIC7700 mmc: core: Fix host controller programming for fixed driver type
2026-05-29mmc: Merge branch fixes into nextUlf Hansson3-3/+35
Merge the mmc fixes for v7.1-rc[n] into the next branch, to allow them to get tested together with the mmc changes that are targeted for the next release. Signed-off-by: Ulf Hansson <ulfh@kernel.org>
2026-05-29mmc: dw_mmc: Add desc_num field for clarityShawn Lin2-10/+10
The ring_size field in struct dw_mci is misleadingly named. Despite its name, it does not represent the size of the descriptor ring buffer in bytes, but rather the number of descriptors allocated within the fixed-size ring buffer. The actual ring buffer size is fixed at PAGE_SIZE (or DESC_RING_BUF_SZ, which equals PAGE_SIZE). Within this buffer, we allocate either struct idmac_desc or struct idmac_desc_64addr descriptors, and ring_size stores the count of these descriptors. This naming has caused confusion, as it's also used to set mmc->max_segs (the maximum number of scatter-gather segments), which logically corresponds to the number of descriptors, not a size in bytes. No functional change is introduced by this naming-only patch. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Ulf Hansson <ulfh@kernel.org>
2026-05-29mmc: sdhci: add signal voltage switch in sdhci_resume_hostJisheng Zhang1-0/+1
I met one suspend/resume issue with sdr104 capable sdio wifi card (with "keep-power-in-suspend" set in DT property): After resuming from suspend to ram, the sdio wifi card stops working. Further debug shows that although ios shows the sdio card is at sdr104 mode, the voltage is still at 3V3. This is due to missing the calling of ->start_signal_voltage_switch() in sdhci_resume_host(). Fix this issue by adding ->start_signal_voltage_switch() in sdhci_resume_host(). This also matches what we do for sdhci_runtime_resume_host(). Then the question is: why this issue hasn't reported and fixed for so long time. IMHO, several reasons: Some host controllers just kick off the runtime resume for system resume, so they benefit from the well supported runtime pm code; Some platforms just use the old sdio wifi card which doesn't need signal voltage switch at all, the default voltage is 3v3 after resuming. Fixes: 6308d2905bd3 ("mmc: sdhci: add quirk for keeping card power during suspend") Signed-off-by: Jisheng Zhang <jszhang@kernel.org> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson <ulfh@kernel.org>
2026-05-29mmc: dw_mmc-rockchip: Add missing private data for very old controllersHeiko Stuebner1-0/+17
The really old controllers (rk2928, rk3066, rk3188) do not support UHS speeds at all, and thus never handled phase data. For that reason it never had a parse_dt callback and no driver private data at all. Commit ff6f0286c896 ("mmc: dw_mmc-rockchip: Add memory clock auto-gating support") makes the private data sort of mandatory, because the init function checks whether phases are configured internally or through the clock controller. This results in the old SoCs then experiencing NULL-pointer dereferences when they try to access that private-data struct. While we could have if (priv) conditionals in all places, it's way less cluttery to just give the old types their private-data struct. Fixes: ff6f0286c896 ("mmc: dw_mmc-rockchip: Add memory clock auto-gating support") Cc: stable@vger.kernel.org Signed-off-by: Heiko Stuebner <heiko@sntech.de> Acked-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Ulf Hansson <ulfh@kernel.org>
2026-05-29mmc: sdhci-of-dwcmshc: use dev_err_probe() to simplify error pathsArtem Shimko1-19/+11
Replace common pattern of dev_err() + return with dev_err_probe() in probe functions and their callees. This macro provides standardized error message format with symbolic error names and adds deferred probe debugging information. The conversion makes the code more compact and ensures consistent error logging across all initialization paths. Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Artem Shimko <a.shimko.dev@gmail.com> Signed-off-by: Ulf Hansson <ulfh@kernel.org>
2026-05-29mmc: sdhci-of-dwcmshc: remove redundant IS_ERR() checkArtem Shimko1-4/+2
The clk_disable_unprepare() function has internal protection against ERR_PTR and NULL pointers (IS_ERR_OR_NULL). Remove the redundant IS_ERR() check for bus_clk in dwcmshc_suspend() and in the error path of dwcmshc_resume() to simplify the code. Note that the clk_prepare_enable() call in dwcmshc_resume() must retain its IS_ERR() check because clk_prepare() only handles NULL pointers, not ERR_PTR. No functional change intended. Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Artem Shimko <a.shimko.dev@gmail.com> Signed-off-by: Ulf Hansson <ulfh@kernel.org>
2026-05-29mmc: litex_mmc: Set mandatory idle clocks before CMD0Inochi Amaoto1-0/+14
The litex_mmc driver assumes the card is already probed in the BIOS and skip the phy initialization. This will cause the command fail like the following when the old card is unplugged and then insert a new card: [ 62.923593] litex-mmc f0004000.mmc: Command (cmd 8) error, status -110 [ 62.949717] litex-mmc f0004000.mmc: Command (cmd 55) error, status -110 [ 62.976606] litex-mmc f0004000.mmc: Command (cmd 55) error, status -110 [ 63.002516] litex-mmc f0004000.mmc: Command (cmd 55) error, status -110 [ 63.028442] litex-mmc f0004000.mmc: Command (cmd 55) error, status -110 Add required clock settings and initialization for the CMD 0, so it can probe the new card. Fixes: 92e099104729 ("mmc: Add driver for LiteX's LiteSDCard interface") Signed-off-by: Inochi Amaoto <inochiama@gmail.com> Reviewed-by: Gabriel Somlo <gsomlo@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson <ulfh@kernel.org>
2026-05-29mmc: litex_mmc: Use DIV_ROUND_UP for more accurate clock calculationInochi Amaoto1-3/+3
The previous clock uses roundup_pow_of_two() to calculate the core clock frequency. It does not meet the actual hardware meaning. The actual frequency is calculated by "ref_clk / ((div >> 1) << 1)". Fix the clock divider calculation. Fixes: 92e099104729 ("mmc: Add driver for LiteX's LiteSDCard interface") Signed-off-by: Inochi Amaoto <inochiama@gmail.com> Reviewed-by: Gabriel Somlo <gsomlo@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson <ulfh@kernel.org>
2026-05-29mmc: renesas_sdhi: Add OF entry for RZ/G2E SoCLad Prabhakar1-0/+1
The RZ/G2E (R8A774C0) SoC was previously handled via the generic "renesas,rcar-gen3-sdhi" fallback compatible string. However, because the SDHI IP on RZ/G2E is identical with the R-Car E3 (R8A77990), it requires the specific quirks and configuration defined in `of_r8a77990_compatible` rather than the generic Gen3 data. Add the explicit "renesas,sdhi-r8a774c0" match entry to map it correctly. Note that the DT binding file renesas,sdhi.yaml does not need an update as the entry for this SoC is already present. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Ulf Hansson <ulfh@kernel.org>
2026-05-29mmc: renesas_sdhi: Add OF entry for RZ/G2N SoCLad Prabhakar1-0/+1
The RZ/G2N (R8A774B1) SoC was previously handled via the generic "renesas,rcar-gen3-sdhi" fallback compatible string. However, because the SDHI IP on RZ/G2N is identical with the R-Car M3-N (R8A77965), it requires the specific quirks and configuration defined in `of_r8a77965_compatible` rather than the generic Gen3 data. Add the explicit "renesas,sdhi-r8a774b1" match entry to map it correctly. Note that the DT binding file renesas,sdhi.yaml does not need an update as the entry for this SoC is already present. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Ulf Hansson <ulfh@kernel.org>
2026-05-29mmc: Merge branch fixes into nextUlf Hansson2-22/+23
Merge the mmc fixes for v7.1-rc[n] into the next branch, to allow them to get tested together with the mmc changes that are targeted for the next release. Signed-off-by: Ulf Hansson <ulfh@kernel.org>
2026-05-29mmc: renesas_sdhi: Add OF entry for RZ/G2H SoCLad Prabhakar1-0/+1
The RZ/G2H (R8A774E1) SoC was previously handled via the generic "renesas,rcar-gen3-sdhi" fallback compatible string. However, because the SDHI IP on RZ/G2H is identical with the R-Car H3-N (R8A77951), it requires the specific quirks and configuration defined in `of_r8a7795_compatible` rather than the generic Gen3 data. Add the explicit "renesas,sdhi-r8a774e1" match entry to map it correctly. Note that the DT binding file renesas,sdhi.yaml does not need an update as the entry for this SoC is already present. Fixes: 31941342888d ("arm64: dts: renesas: r8a774e1: Add SDHI nodes") Cc: stable@vger.kernel.org Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Ulf Hansson <ulfh@kernel.org>
2026-05-29mmc: davinci: fix mmc_add_host order in probeOsama Abdelkader1-7/+5
mmc_add_host() makes the host visible to the MMC core. Register the interrupt handlers and advertise MMC_CAP_SDIO_IRQ before that, so the core cannot start using the host before IRQ handling is set up. Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com> Signed-off-by: Ulf Hansson <ulfh@kernel.org>
2026-05-29mmc: sdhci-of-dwcmshc: Fix reset, clk, and SDIO support for Eswin EIC7700Huan He1-22/+22
The EIC7700 code in sdhci-of-dwcmshc uses host->mmc->caps2 to select different configuration paths for different card types. The current logic distinguishes eMMC and SD, but does not handle SDIO separately. Update the EIC7700 card-type checks so that eMMC, SD and SDIO are distinguished explicitly. Switch the reset path to dwcmshc_reset() so that pending interrupt state is cleared consistently, and use sdhci_enable_clk() so the clock enable sequence follows the standard SDHCI flow. Fixes: 32b2633219d3 ("mmc: sdhci-of-dwcmshc: Add support for Eswin EIC7700") Signed-off-by: Huan He <hehuan1@eswincomputing.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson <ulfh@kernel.org>
2026-05-18mmc: sdhci-msm: Remove NULL check from devm_of_qcom_ice_get()Manivannan Sadhasivam1-5/+5
Now since the devm_of_qcom_ice_get() API never returns NULL, remove the NULL check and also simplify the error handling. Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Tested-by: Sumit Garg <sumit.garg@oss.qualcomm.com> # OP-TEE as TZ Acked-by: Sumit Garg <sumit.garg@oss.qualcomm.com> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260518-qcom-ice-fix-v7-4-2a595382185b@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-05-11mmc: sdhci-of-k1: add comprehensive SDR tuning supportIker Pedrosa1-0/+172
Implement software tuning algorithm to enable UHS-I SDR modes for SD card operation and HS200 mode for eMMC. This adds both TX and RX delay line tuning based on the SpacemiT K1 controller capabilities. Algorithm features: - Add tuning register definitions (RX_CFG, DLINE_CTRL, DLINE_CFG) - Conditional tuning: only for high-speed modes (≥100MHz) - TX tuning: configure transmit delay line with optimal values (dline_reg=0, delaycode=127) to ensure optimal signal output timing - RX tuning: single-pass window detection algorithm testing full delay range (0-255) to find optimal receive timing window - Retry mechanism: multiple fallback delays within optimal window for improved reliability Tested-by: Anand Moon <linux.amoon@gmail.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Tested-by: Trevor Gamblin <tgamblin@baylibre.com> Tested-by: Vincent Legoll <legoll@online.fr> Signed-off-by: Iker Pedrosa <ikerpedrosam@gmail.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-05-11mmc: sdhci-of-k1: add regulator and pinctrl voltage switching supportIker Pedrosa1-0/+72
Add voltage switching infrastructure for UHS-I modes by integrating both regulator framework (for supply voltage control) and pinctrl state switching (for pin drive strength optimization). - Add regulator supply parsing and voltage switching callback - Add optional pinctrl state switching between "default" (3.3V) and "state_uhs" (1.8V) configurations - Enable coordinated voltage and pin configuration changes for UHS modes This provides complete voltage switching support while maintaining backward compatibility when pinctrl states are not defined. Tested-by: Anand Moon <linux.amoon@gmail.com> Tested-by: Trevor Gamblin <tgamblin@baylibre.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Reviewed-by: Troy Mitchell <troy.mitchell@linux.dev> Tested-by: Vincent Legoll <legoll@online.fr> Signed-off-by: Iker Pedrosa <ikerpedrosam@gmail.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-05-11mmc: sdhci-of-k1: enable essential clock infrastructure for SD operationIker Pedrosa1-0/+13
Ensure SD card pins receive clock signals by enabling pad clock generation and overriding automatic clock gating. Required for all SD operation modes. The SDHC_GEN_PAD_CLK_ON setting in LEGACY_CTRL_REG is safe for both SD and eMMC operation as both protocols use the same physical MMC interface pins and require proper clock signal generation at the hardware level for signal integrity and timing. Additional SD-specific clock overrides (SDHC_OVRRD_CLK_OEN and SDHC_FORCE_CLK_ON) are conditionally applied only for SD-only controllers to handle removable card scenarios. Tested-by: Anand Moon <linux.amoon@gmail.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Tested-by: Trevor Gamblin <tgamblin@baylibre.com> Reviewed-by: Troy Mitchell <troy.mitchell@linux.dev> Tested-by: Vincent Legoll <legoll@online.fr> Signed-off-by: Iker Pedrosa <ikerpedrosam@gmail.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-05-11mmc: via-sdmmc: Simplify initialisation of pci_device_id arrayUwe Kleine-König (The Capable Hub)1-3/+2
Instead of assigning the pci_device_id members using a list (which is hard to read as you need to look at the order of the members in that struct in parallel) use the PCI_VDEVICE() convenience macro to compact the initialisation while improving readability. Also drop trailing zeros that the compiler will care about then. The change doesn't introduce binary changes to the compiled driver, verified on both ARCH=x86 and ARCH=arm64. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-05-11mmc: davinci: avoid NULL deref of host->data in IRQ handlerStepan Ionichev1-2/+2
mmc_davinci_irq() returns early only when both host->cmd and host->data are NULL: if (host->cmd == NULL && host->data == NULL) { ... return IRQ_NONE; } So we may legitimately reach the rest of the handler with host->data == NULL (and therefore data == NULL). The DATDNE branch already guards against this with an explicit "if (data != NULL)" check, but the subsequent TOUTRD ("read data timeout") and CRCWR/CRCRD ("data CRC error") branches dereference data unconditionally: if (qstatus & MMCST0_TOUTRD) { data->error = -ETIMEDOUT; <-- NULL deref ... davinci_abort_data(host, data); } if (qstatus & (MMCST0_CRCWR | MMCST0_CRCRD)) { data->error = -EILSEQ; <-- NULL deref ... } If either bit is set in qstatus while host->data is NULL, the kernel will crash inside the IRQ handler. smatch flags this: drivers/mmc/host/davinci_mmc.c:933 mmc_davinci_irq() error: we previously assumed 'data' could be null (see line 914) Gate both branches on a non-NULL data, matching the existing pattern used by the DATDNE branch. No functional change for callers where data is non-NULL, which is the only case in which these branches did meaningful work before this change. Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-05-11memstick: Constify the driver id_tableKrzysztof Kozlowski1-1/+1
Just like all other driver structures, the id_table should never be modified by core subsystem parts. Constify this member and actual data structures for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-05-11mmc: host: Move MODULE_DEVICE_TABLE next to the table itselfKrzysztof Kozlowski3-3/+3
By convention MODULE_DEVICE_TABLE() immediately follows the ID table it exports, because this is easier to read and verify. It also makes more sense since #ifdef for ACPI or OF could hide both of them. Most of the privers already have this correctly placed, so adjust the missing ones. No functional impact. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-05-11mmc: renesas_sdhi: add R-Car M3Le compatibility stringMarek Vasut1-0/+1
Add support for the SD Card/MMC Interface in the Renesas R-Car M3Le (R8A779MD) SoC. R19UH0260EJ0100 Rev.1.00 , Dec 25, 2025 Notes 7.70. indicates that HS400 mode is not supported. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-05-11mmc: dw_mmc: exynos: increase DMA threshold value for exynos7870Kaustabh Chakraborty1-0/+1
Exynos 7870 compatible controllers, such as SDIO ones are not able to perform DMA transfers for small sizes of data (~16 to ~512 bytes), resulting in cache issues in subsequent transfers. Increase the DMA transfer threshold to 512 to allow the shorter transfers to take place, bypassing DMA. Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org> Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-05-11mmc: dw_mmc: implement option for configuring DMA thresholdKaustabh Chakraborty2-2/+4
Some controllers, such as certain Exynos SDIO ones, are unable to perform DMA transfers of small amount of bytes properly. Following the device tree schema, implement the property to define the DMA transfer threshold (from a hard coded value of 16 bytes) so that lesser number of bytes can be transferred safely skipping DMA in such controllers. The value of 16 bytes stays as the default for controllers which do not define it. This value can be overridden by implementation-specific init sequences. Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org> Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-05-11mmc: dw_mmc: Move misplaced commentShawn Lin1-1/+1
It was originally part of the @cmd_status field description but became separated and now appears between @ring_size and @dms without proper context. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-04-10mmc: sdhci-msm: Fix the wrapped key handlingNeeraj Soni1-5/+0
Inline Crypto Engine (ICE) supports wrapped key generation. While registering crypto profile the supported key types are queried from ICE driver. So the explicit check for RAW key is not needed. Fixes: fd78e2b582a0 ("mmc: sdhci-msm: Add support for wrapped keys") Signed-off-by: Neeraj Soni <neeraj.soni@oss.qualcomm.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-04-09mmc: sdhci-of-dwcmshc: Disable clock before DLL configurationShawn Lin1-3/+16
According to the ASIC design recommendations, the clock must be disabled before operating the DLL to prevent glitches that could affect the internal digital logic. In extreme cases, failing to do so may cause the controller to malfunction completely. Adds a step to disable the clock before DLL configuration and re-enables it at the end. Fixes: 08f3dff799d4 ("mmc: sdhci-of-dwcmshc: add rockchip platform support") Cc: stable@vger.kernel.org Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-03-31mmc: vub300: clean up module initJohan Hovold1-17/+16
Clean up module init by dropping redundant error messages (e.g. allocation and USB driver registration failure will already have been logged) and naming error labels after what they do. Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-03-31mmc: vub300: rename probe error labelsJohan Hovold1-8/+10
Error labels should be named after what they do. Rename the probe error labels. Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-03-31mmc: Merge branch fixes into nextUlf Hansson1-7/+12
Merge the mmc fixes for v7.0-rc[n] into the next branch, to allow them to get tested together with the mmc changes that are targeted for the next release. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-03-31mmc: vub300: fix use-after-free on disconnectJohan Hovold1-6/+11
The vub300 driver maintains an explicit reference count for the controller and its driver data and the last reference can in theory be dropped after the driver has been unbound. This specifically means that the controller allocation must not be device managed as that can lead to use-after-free. Note that the lifetime is currently also incorrectly tied the parent USB device rather than interface, which can lead to memory leaks if the driver is unbound without its device being physically disconnected (e.g. on probe deferral). Fix both issues by reverting to non-managed allocation of the controller. Fixes: dcfdd698dc52 ("mmc: vub300: Use devm_mmc_alloc_host() helper") Cc: stable@vger.kernel.org # 6.17+ Cc: Binbin Zhou <zhoubinbin@loongson.cn> Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-03-31mmc: vub300: fix NULL-deref on disconnectJohan Hovold1-1/+1
Make sure to deregister the controller before dropping the reference to the driver data on disconnect to avoid NULL-pointer dereferences or use-after-free. Fixes: 88095e7b473a ("mmc: Add new VUB300 USB-to-SD/SDIO/MMC driver") Cc: stable@vger.kernel.org # 3.0+ Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-03-31mmc: dw_mmc: Remove dw_mci_start_request wrapper and rename core functionShawn Lin1-13/+5
The function dw_mci_start_request() was just a thin wrapper around __dw_mci_start_request(). Since it serves almost no functional purpose, remove the wrapper to simplify the code flow. Consequently, rename __dw_mci_start_request() to dw_mci_start_request() so that the core implementation uses the primary name. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-03-31mmc: dw_mmc: Inline dw_mci_queue_request() into dw_mci_request()Shawn Lin1-27/+19
With the removal of queue support, the function dw_mci_queue_request() is now just a wrapper with a confusing name that doesn't suggest anything about queue. Removes the function and moves its body into dw_mci_request(). No functional changes intended. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-03-31mmc: sdhci-dwcmshc: Refactor Rockchip platform data for controller revisionsShawn Lin1-35/+57
The driver previously used an enum (dwcmshc_rk_type) to distinguish platforms like the RK3568 and RK3588 based on DT compatible names. This approach is inflexible, scales poorly for future revisions or mixed-revision platforms, and conflates SoC names with controller revisions. One example is RK3576 which lists "rockchip,rk3588-dwcmshc" as a secondary compatible string just in order to claim it uses the same controller revision as RK3588. This is confusing and makes it error-prone to add new SoC support. Introduces a new struct rockchip_pltfm_data containing a dedicated revision field. The old enum is removed, and all code paths are updated to use the revision-based data. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-03-26mmc: mtk-sd: disable new_tx/rx and modify related settings for mt8189Cathy Xu1-5/+5
Disable new_tx/rx to avoid data transmission instability, and adjust .data_tune, .stop_dly_sel, and .pop_en_cnt to fit the overall configuration after disabling new_tx/rx, making it more compatible with mt8189. Fixes: 846a3a2fdff5 ("mmc: mtk-sd: add support for MT8189 SoC") Tested-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com> Signed-off-by: Cathy Xu <ot_cathy.xu@mediatek.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-03-26mmc: sdhci-of-arasan: Use standard mmc_clk_phase_map infrastructureShawn Lin1-61/+12
Convert the Arasan SDHCI driver to use the mainline standard mmc_clk_phase_map infrastructure instead of custom clk_phase_in/out arrays as well as arasan_dt_read_clk_phase(). The phase values for ZynqMP, Versal, and Versal-NET platforms are still initialized from the predefined tables. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Reviewed-by: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-03-25mmc: sdhci-of-aspeed: Handle optional controller resetRyan Chen1-0/+6
Get the optional reset line for the ASPEED SD controller during probe by using devm_reset_control_get_optional_exclusive_deasserted(). This allows platforms such as AST2700, which require the SD controller to be taken out of reset before use, to work with the existing driver. Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-03-23mmc: sdhci-pci: Drop unused includeAndy Shevchenko1-1/+0
This driver includes the legacy header <linux/gpio.h> but does not use any symbols from it. Drop the inclusion. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-03-23mmc: sdhci-dwcmshc: Add Canaan K230 DWCMSHC controller supportJiayu Du1-0/+260
Add SDHCI controller driver for Canaan k230 SoC. Implement custom sdhci_ops for set_clock, phy init, init and reset. Tested-by: Junhui Liu <junhui.liu@pigmoral.tech> Signed-off-by: Jiayu Du <jiayu.riscv@isrc.iscas.ac.cn> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-03-23mmc: sdhci-of-dwcmshc: Add HPE GSC eMMC supportNick Hawkins1-0/+146
Add support for the eMMC controller integrated in the HPE GSC (ARM64 Cortex-A53) BMC SoC under the new 'hpe,gsc-dwcmshc' compatible string. The HPE GSC eMMC controller is based on the DesignWare Cores MSHC IP but requires several platform-specific adjustments: Clock mux (dwcmshc_hpe_set_clock): The GSC SoC wires SDHCI_CLOCK_CONTROL.freq_sel directly to a clock mux rather than a divider. Forcing freq_sel = 1 when the requested clock is 200 MHz (HS200) selects the correct high-speed clock source. Using the generic sdhci_set_clock() would otherwise leave the mux on the wrong source after tuning. Auto-tuning / vendor config (dwcmshc_hpe_vendor_specific): Disables the command-conflict check (DWCMSHC_HOST_CTRL3 BIT(0)) and programs the ATCTRL register using existing AT_CTRL_* macros: AT_CTRL_AT_EN auto-tuning circuit enable AT_CTRL_SWIN_TH_EN sampling window threshold enable AT_CTRL_TUNE_CLK_STOP_EN tune-clock-stop enable PRE_CHANGE_DLY = 3 pre-change delay POST_CHANGE_DLY = 3 post-change delay SWIN_TH_VAL = 2 sampling window threshold This combination is required for reliable HS200 signal integrity on the GSC PCB trace topology. eMMC mode (dwcmshc_hpe_set_emmc): Helper that sets DWCMSHC_CARD_IS_EMMC unconditionally. Called from both the reset and UHS-signaling paths. Reset (dwcmshc_hpe_reset): Calls dwcmshc_reset(), re-applies the vendor config above via dwcmshc_hpe_vendor_specific(), and then calls dwcmshc_hpe_set_emmc(). The GSC controller clears the CARD_IS_EMMC bit on every reset; leaving it clear causes card-detect mis-identification on an eMMC-only slot. UHS signaling (dwcmshc_hpe_set_uhs_signaling): Wraps dwcmshc_set_uhs_signaling() and calls dwcmshc_hpe_set_emmc() to ensure CARD_IS_EMMC is set for all timing modes, not just HS400. Init (dwcmshc_hpe_gsc_init): Obtains the SoC register block and MSHCCS offset via the 'hpe,gxp-sysreg' syscon phandle argument and sets SCGSyncDis (BIT(18)) to allow the HS200 RX delay lines to settle while the card clock is stopped during auto-tuning. Enables SDHCI v4 mode. Quirks: SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN: base clock not advertised in capabilities; must be obtained from the DTS 'clocks' property. SDHCI_QUIRK2_PRESET_VALUE_BROKEN: preset-value registers are not populated in the GSC ROM. All HPE-specific code is isolated to the new hpe_gsc_init / hpe_ops / hpe_gsc_pdata symbols. No existing platform (Rockchip, T-Head, sg2042, etc.) is affected. Signed-off-by: Nick Hawkins <nick.hawkins@hpe.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-03-23mmc: dw_mmc-pltfm: Use phase_map for SoCFPGA clock phase configurationShawn Lin1-7/+8
This change aligns the SoCFPGA driver with the current dw_mmc core, which now manages clock phases through host->phase_map. The phase values are still scaled by SOCFPGA_DW_MMC_CLK_PHASE_STEP before being written to the system manager registers. No functional changes intended. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-03-23mmc: sdhci-msm: Add support for wrapped keysNeeraj Soni1-1/+41
Add the wrapped key support for sdhci-msm by implementing the needed methods in struct blk_crypto_ll_ops and setting the appropriate flag in blk_crypto_profile::key_types_supported. Tested on SC7280 eMMC variant. How to test: Use the "v1.3.0" tag from https://github.com/google/fscryptctl and build fscryptctl that supports generating wrapped keys. Enable the following config options: CONFIG_BLK_INLINE_ENCRYPTION=y CONFIG_QCOM_INLINE_CRYPTO_ENGINE=y CONFIG_FS_ENCRYPTION_INLINE_CRYPT=y CONFIG_MMC_CRYPTO=y Enable "qcom_ice.use_wrapped_keys" via kernel command line. $ mkfs.ext4 -F -O encrypt,stable_inodes /dev/disk/by-partlabel/vm-data $ mount /dev/disk/by-partlabel/vm-data -o inlinecrypt /mnt $ fscryptctl generate_hw_wrapped_key /dev/disk/by-partlabel/vm-data > /mnt/key.longterm $ fscryptctl prepare_hw_wrapped_key /dev/disk/by-partlabel/vm-data < /mnt/key.longterm > /tmp/key.ephemeral $ KEYID=$(fscryptctl add_key --hw-wrapped-key < /tmp/key.ephemeral /mnt) $ rm -rf /mnt/dir $ mkdir /mnt/dir $ fscryptctl set_policy --iv-ino-lblk-32 "$KEYID" /mnt/dir $ dmesg > /mnt/dir/test.txt $ sync Reboot the board $ mount /dev/disk/by-partlabel/vm-data -o inlinecrypt /mnt $ ls /mnt/dir # File should be encrypted $ fscryptctl prepare_hw_wrapped_key /dev/disk/by-partlabel/vm-data < /mnt/key.longterm > /tmp/key.ephemeral $ KEYID=$(fscryptctl add_key --hw-wrapped-key < /tmp/key.ephemeral /mnt) $ fscryptctl set_policy --iv-ino-lblk-32 "$KEYID" /mnt/dir $ cat /mnt/dir/test.txt # File should now be decrypted Tested-by: Wenjia Zhang <wenjia.zhang@oss.qualcomm.com> Signed-off-by: Neeraj Soni <neeraj.soni@oss.qualcomm.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Reviewed-by: Eric Biggers <ebiggers@kernel.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-03-16mmc: sdhci-pltfm: remove duplicate DTS property parsingLuke Wang1-7/+0
The "keep-power-in-suspend", "wakeup-source" and "enable-sdio-wakeup" properties are already parsed in mmc_of_parse(). All sdhci drivers that call sdhci_get_property() also call mmc_of_parse(). The only exception is sdhci-of-hlwd, which does not call mmc_of_parse(), but its devicetree does not use these properties anyway. Signed-off-by: Luke Wang <ziniu.wang_1@nxp.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-03-16mmc: sdhci-esdhc-imx: remove duplicate HS400 bus width validationLuke Wang1-4/+0
mmc_validate_host_caps() already validates that HS400/HS400ES requires 8-bit bus width. Remove the duplicate validation. Signed-off-by: Luke Wang <ziniu.wang_1@nxp.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Reviewed-by: Haibo Chen <haibo.chen@nxp.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-03-16mmc: sdhci-esdhc-imx: add 1-bit bus width supportLuke Wang1-2/+2
Add sdhci_get_property() call to parse common SDHCI DT properties, including "bus-width = <1>" which sets SDHCI_QUIRK_FORCE_1_BIT_DATA quirk for 1-bit data bus width configuration. Remove the duplicate "no-1-8-v" property parsing since sdhci_get_property() already handles it. Signed-off-by: Luke Wang <ziniu.wang_1@nxp.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Reviewed-by: Haibo Chen <haibo.chen@nxp.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2026-03-16mmc: Merge branch fixes into nextUlf Hansson1-1/+8
Merge the mmc fixes for v7.0-rc[n] into the next branch, to allow them to get tested together with the mmc changes that are targeted for the next release. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>