summaryrefslogtreecommitdiff
path: root/drivers/mmc
AgeCommit message (Collapse)Author
9 daysmtk-sd: reset host->mrq on prepare_data() errorSergey Senozhatsky
Do not leave host with dangling ->mrq pointer if we hit the msdc_prepare_data() error out path. Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org> Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Fixes: f5de469990f1 ("mtk-sd: Prevent memory corruption from DMA map failure") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20250625052106.584905-1-senozhatsky@chromium.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
10 daysRevert "mmc: sdhci: Disable SD card clock before changing parameters"Ulf Hansson
It has turned out the trying to strictly conform to the SDHCI specification is causing problems. Let's revert and start over. This reverts commit fb3bbc46c94f261b6156ee863c1b06c84cf157dc. Cc: Erick Shepherd <erick.shepherd@ni.com> Cc: stable@vger.kernel.org Fixes: fb3bbc46c94f ("mmc: sdhci: Disable SD card clock before changing parameters") Suggested-by: Adrian Hunter <adrian.hunter@intel.com> Reported-by: Jonathan Liu <net147@gmail.com> Reported-by: Salvatore Bonaccorso <carnil@debian.org> Closes: https://bugs.debian.org/1108065 Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Link: https://lore.kernel.org/r/20250624110932.176925-1-ulf.hansson@linaro.org
10 daysmmc: sdhci-uhs2: Adjust some error messages and register dump for SD UHS-II cardVictor Shih
Adjust some error messages to debug mode and register dump to dynamic debug mode to avoid causing misunderstanding it is an error. Signed-off-by: Victor Shih <victor.shih@genesyslogic.com.tw> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20250606110121.96314-4-victorshihgli@gmail.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
10 daysmmc: sdhci: Add a helper function for dump register in dynamic debug modeVictor Shih
Add a helper function for dump register in dynamic debug mode. Signed-off-by: Victor Shih <victor.shih@genesyslogic.com.tw> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20250606110121.96314-3-victorshihgli@gmail.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
10 daysmmc: core: Adjust some error messages for SD UHS-II cardsVictor Shih
Adjust some error messages to debug mode to avoid causing misunderstanding it is an error. Signed-off-by: Victor Shih <victor.shih@genesyslogic.com.tw> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Fixes: 9a9f7e13952b ("mmc: core: Support UHS-II card control and access") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20250606110121.96314-2-victorshihgli@gmail.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-06-19mtk-sd: Prevent memory corruption from DMA map failureMasami Hiramatsu (Google)
If msdc_prepare_data() fails to map the DMA region, the request is not prepared for data receiving, but msdc_start_data() proceeds the DMA with previous setting. Since this will lead a memory corruption, we have to stop the request operation soon after the msdc_prepare_data() fails to prepare it. Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Fixes: 208489032bdd ("mmc: mediatek: Add Mediatek MMC driver") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/174972756982.3337526.6755001617701603082.stgit@mhiramat.tok.corp.google.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-06-09mtk-sd: Fix a pagefault in dma_unmap_sg() for not prepared dataMasami Hiramatsu (Google)
When swiotlb buffer is full, the dma_map_sg() returns 0 to msdc_prepare_data(), but it does not check it and sets the MSDC_PREPARE_FLAG. swiotlb_tbl_map_single() /* prints "swiotlb buffer is full" */ <-swiotlb_map() <-dma_direct_map_page() <-dma_direct_map_sg() <-__dma_map_sg_attrs() <-dma_map_sg_attrs() <-dma_map_sg() /* returns 0 (pages mapped) */ <-msdc_prepare_data() Then, the msdc_unprepare_data() checks MSDC_PREPARE_FLAG and calls dma_unmap_sg() with unmapped pages. It causes a page fault. To fix this problem, Do not set MSDC_PREPARE_FLAG if dma_map_sg() fails because this is not prepared. Fixes: 208489032bdd ("mmc: mediatek: Add Mediatek MMC driver") Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Tested-by: Sergey Senozhatsky <senozhatsky@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/174908565814.4056588.769599127120955383.stgit@mhiramat.tok.corp.google.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-06-09mmc: sdhci-of-k1: Fix error code in probe()Dan Carpenter
If spacemit_sdhci_get_clocks() fails, then propagate the error code. Don't return success. Fixes: e5502d15b0f3 ("mmc: sdhci-of-k1: add support for SpacemiT K1 SoC") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Yixun Lan <dlan@gentoo.org> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/aDVTtQdXVtRhxOrb@stanley.mountain Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-06-09mmc: core: sd: Apply BROKEN_SD_DISCARD quirk earlierAvri Altman
Move the BROKEN_SD_DISCARD quirk for certain SanDisk SD cards from the `mmc_blk_fixups[]` to `mmc_sd_fixups[]`. This ensures the quirk is applied earlier in the device initialization process, aligning with the reasoning in [1]. Applying the quirk sooner prevents the kernel from incorrectly enabling discard support on affected cards during initial setup. [1] https://lore.kernel.org/all/20240820230631.GA436523@sony.com Fixes: 07d2872bf4c8 ("mmc: core: Add SD card quirk for broken discard") Signed-off-by: Avri Altman <avri.altman@sandisk.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20250526114445.675548-1-avri.altman@sandisk.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-06-08treewide, timers: Rename from_timer() to timer_container_of()Ingo Molnar
Move this API to the canonical timer_*() namespace. [ tglx: Redone against pre rc1 ] Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/aB2X0jCKQO56WdMt@gmail.com
2025-05-29Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsiLinus Torvalds
Pull SCSI updates from James Bottomley: "Updates to the usual drivers (smartpqi, ufs, lpfc, scsi_debug, target, hisi_sas) with the only substantive core change being the removal of the stream_status member from the scsi_stream_status_header (to get rid of flex array members)" * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (77 commits) scsi: target: core: Constify struct target_opcode_descriptor scsi: target: core: Constify enabled() in struct target_opcode_descriptor scsi: hisi_sas: Fix warning detected by sparse scsi: mpt3sas: Fix _ctl_get_mpt_mctp_passthru_adapter() to return IOC pointer scsi: sg: Remove unnecessary NULL check before unregister_sysctl_table() scsi: ufs: mcq: Delete ufshcd_release_scsi_cmd() in ufshcd_mcq_abort() scsi: ufs: qcom: dt-bindings: Document the SM8750 UFS Controller scsi: mvsas: Fix typos in SAS/SATA VSP register comments scsi: fnic: Replace memset() with eth_zero_addr() scsi: ufs: core: Support updating device command timeout scsi: ufs: core: Change hwq_id type and value scsi: ufs: core: Increase the UIC command timeout further scsi: zfcp: Simplify workqueue allocation scsi: ufs: core: Print error value as hex format in ufshcd_err_handler() scsi: sd: Remove the stream_status member from scsi_stream_status_header scsi: docs: Clean up some style in scsi_mid_low_api scsi: core: Remove unused scsi_dev_info_list_del_keyed() scsi: isci: Remove unused sci_remote_device_reset() scsi: scsi_debug: Reduce DEF_ATOMIC_WR_MAX_LENGTH scsi: smartpqi: Delete a stray tab in pqi_is_parity_write_stream() ...
2025-05-19mmc: Merge branch fixes into nextUlf Hansson
Merge the mmc fixes for v6.15-rc[n] into the next branch, to allow them to get tested together with the new mmc changes that are targeted for v6.16. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-19mmc: sdhci_am654: Add SDHCI_QUIRK2_SUPPRESS_V1P8_ENA quirk to am62 compatibleJudith Mendez
Add a new struct for platform data for the ti,am62-sdhci compatible to apply additional quirks, namely "SDHCI_QUIRK2_SUPPRESS_V1P8_ENA", to host controllers with am62 compatible. Note, the fix was originally introduced by commit 941a7abd4666 ("mmc: sdhci_am654: Add sdhci_am654_start_signal_voltage_switch") but was found to be applied too broadly and had to be reverted. This fixes MMC init failures seen across am62x boards. Fixes: ac5a41b472b4 ("Revert "mmc: sdhci_am654: Add sdhci_am654_start_signal_voltage_switch"") Fixes: 941a7abd4666 ("mmc: sdhci_am654: Add sdhci_am654_start_signal_voltage_switch") Cc: stable@vger.kernel.org Suggested-by: Nishanth Menon <nm@ti.com> Signed-off-by: Judith Mendez <jm@ti.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20250516203121.3736379-1-jm@ti.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-19mmc: sdhci-esdhc-imx: fix few build warningsHaibo Chen
drivers/mmc/host/sdhci-esdhc-imx.c:1566 sdhci_esdhc_imx_hwinit() warn: inconsistent indenting drivers/mmc/host/sdhci-esdhc-imx.c:1251 esdhc_executing_tuning() error: uninitialized symbol 'target_min'. drivers/mmc/host/sdhci-esdhc-imx.c:1251 esdhc_executing_tuning() error: uninitialized symbol 'target_max'. Fixes: be953af79cc6 ("mmc: sdhci-esdhc-imx: widen auto-tuning window for standard tuning") Fixes: 541a95e64d76 ("mmc: sdhci-esdhc-imx: optimize the manual tuing logic to get the best timing") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/all/202505160225.Csr5USfq-lkp@intel.com/ Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Haibo Chen <haibo.chen@nxp.com> Link: https://lore.kernel.org/r/20250516-b4-usdhc-v2-1-3fccd02f5602@nxp.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-19mmc: bcm2835: Use str_read_write() helperYumeng Fang
Remove hard-coded strings by using the str_read_write() helper. Signed-off-by: Yumeng Fang <fang.yumeng@zte.com.cn> Link: https://lore.kernel.org/r/20250515204201502Kzmj4I6k5Fv2FjqyEjF6n@zte.com.cn Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-19mmc: host: sdhci-esdhc-imx: refactor the system PM logicLuke Wang
Current suspend/resume logic has one issue. In suspend, will config register when call sdhci_suspend_host(), but at this time, can't guarantee host in runtime resume state. If not, the per clock is gate off, access register will hang. In sdhci_esdhc_suspend/sdhci_esdhc_resume, remove sdhci_suspend_host() and sdhci_resume_host(), all are handled in runtime PM callbacks except the wakeup irq setting. For wakeup irq setting, use pm_runtime_get_sync() in sdhci_esdhc_suspend() to make sure clock gate on. Remove pinctrl_pm_select_default_state() in sdhci_esdhc_resume, because pm_runtime_force_resume() already config the pinctrl state according to ios timing, and here config the default pinctrl state again is wrong for SDIO3.0 device if it keep power in suspend. Signed-off-by: Haibo Chen <haibo.chen@nxp.com> Signed-off-by: Luke Wang <ziniu.wang_1@nxp.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20250514094903.1771642-2-ziniu.wang_1@nxp.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-19mmc: sdhci: export APIs for sdhci irq wakeupLuke Wang
Export the sdhci_enable_irq_wakeups() and sdhci_disable_irq_wakeups, so other driver can use them. Signed-off-by: Haibo Chen <haibo.chen@nxp.com> Signed-off-by: Luke Wang <ziniu.wang_1@nxp.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20250514094903.1771642-1-ziniu.wang_1@nxp.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-19mmc: sdhci-of-k1: add support for SpacemiT K1 SoCYixun Lan
The SDHCI controller found in SpacemiT K1 SoC features SD, SDIO, eMMC support, such as: - Compatible for 4-bit SDIO 3.0 UHS-I protocol, up to SDR104 - Compatible for 4-bit SD 3.0 UHS-I protocol, up to SDR104 - Compatible for 8bit eMMC5.1, up to HS400 Signed-off-by: Yixun Lan <dlan@gentoo.org> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20250509-20-k1-sdhci-v3-2-526c35feaa20@gentoo.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-19mmc: core: Scan the eMMC boot areas for partition tableLoic Poulain
It appears that some vendors provision the boot areas with valid part tables (GPT) in order to have identifiable partitions for device and firmware specific data, such has the qualcomm CDT (Qualcomm Config Data Table). Additionally, these boot areas can be utilized to host device-specific IDs, calibration data, and other critical information. Signed-off-by: Loic Poulain <loic.poulain@oss.qualcomm.com> Link: https://lore.kernel.org/r/20250507134538.575912-1-loic.poulain@oss.qualcomm.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: Merge branch fixes into nextUlf Hansson
Merge the mmc fixes for v6.15-rc[n] into the next branch, to allow them to get tested together with the new mmc changes that are targeted for v6.16. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: rename mmc_boot_partition_access() to mmc_host_can_access_boot()Wolfram Sang
It is not obvious that this functions checks capabilities. Rename it to include '_can' like other capability helpers and reword it slightly. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250501063325.7262-10-wsa+renesas@sang-engineering.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: rename mmc_host_uhs() to mmc_host_can_uhs()Wolfram Sang
It is not obvious that this functions checks capabilities. Rename it to include '_can' like other capability helpers. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250501063325.7262-9-wsa+renesas@sang-engineering.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: rename mmc_host_done_complete() to mmc_host_can_done_complete()Wolfram Sang
It is not obvious that this functions checks capabilities. Rename it to include '_can' like other capability helpers. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250501063325.7262-8-wsa+renesas@sang-engineering.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: rename mmc_host_cmd23() to mmc_host_can_cmd23()Wolfram Sang
It is not obvious that this functions checks capabilities. Rename it to include '_can' like other capability helpers. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250501063325.7262-7-wsa+renesas@sang-engineering.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: sdhci-esdhc-imx: fix defined but not used warningsRandy Dunlap
Fix warnings when CONFIG_PM=y and CONFIG_PM_SLEEP is not set by surrounding the 2 functions with #ifdef CONFIG_PM_SLEEP. drivers/mmc/host/sdhci-esdhc-imx.c:1659:13: warning: 'sdhc_esdhc_tuning_restore' defined but not used [-Wunused-function] 1659 | static void sdhc_esdhc_tuning_restore(struct sdhci_host *host) drivers/mmc/host/sdhci-esdhc-imx.c:1637:13: warning: 'sdhc_esdhc_tuning_save' defined but not used [-Wunused-function] 1637 | static void sdhc_esdhc_tuning_save(struct sdhci_host *host) Fixes: 3d1eea493894 ("mmc: sdhci-esdhc-imx: Save tuning value when card stays powered in suspend") Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Reviewed-by: Haibo Chen <haibo.chen@nxp.com> Link: https://lore.kernel.org/r/20250424034610.441532-1-rdunlap@infradead.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: sdhci-of-dwcmshc: add PD workaround on RK3576Nicolas Frattaroli
RK3576's power domains have a peculiar design where the PD_NVM power domain, of which the sdhci controller is a part, seemingly does not have idempotent runtime disable/enable. The end effect is that if PD_NVM gets turned off by the generic power domain logic because all the devices depending on it are suspended, then the next time the sdhci device is unsuspended, it'll hang the SoC as soon as it tries accessing the CQHCI registers. RK3576's UFS support needed a new dev_pm_genpd_rpm_always_on function added to the generic power domains API to handle what appears to be a similar hardware design. Use this new function to ask for the same treatment in the sdhci controller by giving rk3576 its own platform data with its own postinit function. The benefit of doing this instead of marking the power domains always on in the power domain core is that we only do this if we know the platform we're running on actually uses the sdhci controller. For others, keeping PD_NVM always on would be a waste, as they won't run into this specific issue. The only other IP in PD_NVM that could be affected is FSPI0. If it gets a mainline driver, it will probably want to do the same thing. Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com> Fixes: cfee1b507758 ("pmdomain: rockchip: Add support for RK3576 SoC") Cc: <stable@vger.kernel.org> # v6.15+ Link: https://lore.kernel.org/r/20250423-rk3576-emmc-fix-v3-1-0bf80e29967f@collabora.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: cavium-thunderx: Use non-hybrid PCI devres APIPhilipp Stanner
cavium-thunderx enables its PCI device with pcim_enable_device(). This, implicitly, switches the function pci_request_regions() into managed mode, where it becomes a devres function. The PCI subsystem wants to remove this hybrid nature from its interfaces. To do so, users of the aforementioned combination of functions must be ported to non-hybrid functions. Moreover, since both functions are already managed in this driver, the calls to pci_release_regions() are unnecessary. Remove the calls to pci_release_regions(). Replace the call to sometimes-managed pci_request_regions() with one to the always-managed pcim_request_all_regions(). Signed-off-by: Philipp Stanner <phasta@kernel.org> Link: https://lore.kernel.org/r/20250417092742.27887-2-phasta@kernel.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: mtk-sd: Add condition to enable 'single' burst typeAxe Yang
This change add a condition for 'single' burst type selection. Read AXI_LEN field from EMMC50_CFG2(AHB2AXI wrapper) register, if the value is not 0, it means the HWIP is using AXI as AMBA bus, which do not support 'single' burst type. Suggested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Axe Yang <axe.yang@mediatek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20250411054134.31822-1-axe.yang@mediatek.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: sdhci-esdhc-imx: switch standard tuning to manual tuningLuke Wang
Current standard tuning has some limitations: 1. Standard tuning only try 40 times to find first pass window, but this pass window maybe not the best pass window. 2. Sometimes there are two tuning pass windows and the gap between those two windows may only have one cell. If tuning step > 1, the gap may just be skipped and host assumes those two windows as a continuous windows. This will cause a bad delay cell near the gap to be selected. 3. Standard tuning logic need to detect at least one success and failure to pass the tuning. If all cells in the tuning window pass, the hardware will not set the SDHCI_CTRL_TUNED_CLK bit, causing tuning failed. 4. Standard tuning logic only check the CRC, do not really compare the data pattern. If data pins are connected incorrectly, standard will not detect this kind of issue. Switch to manual tuning to avoid those limitations Signed-off-by: Luke Wang <ziniu.wang_1@nxp.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20250409075550.3413032-7-ziniu.wang_1@nxp.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: sdhci-esdhc-imx: verify tuning control status after configurationLuke Wang
Enhance manual tuning configuration reliability by adding tuning control status checks per the i.MX Reference Manual recommendations. Signed-off-by: Luke Wang <ziniu.wang_1@nxp.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20250409075550.3413032-6-ziniu.wang_1@nxp.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: sdhci-esdhc-imx: widen auto-tuning window for manual tuningHaibo Chen
Expand the auto-tuning window width from 0 to 3 for manual tuning to account for sampling point shifts caused by temperature change. This change is based on hardware recommendation, providing enough margin for the auto-tuning logic to locate valid sampling points. When config the manual tuning final sample delay, need deduct the auto tuning window width according to the IP logic. Signed-off-by: Haibo Chen <haibo.chen@nxp.com> Signed-off-by: Luke Wang <ziniu.wang_1@nxp.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20250409075550.3413032-5-ziniu.wang_1@nxp.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: sdhci-esdhc-imx: widen auto-tuning window for standard tuningHaibo Chen
Expand the auto-tuning window width from 2 to 3 for standard tuning to account for sampling point shifts caused by temperature change. This change is based on hardware recommendation, providing 50% more margin for the auto-tuning logic to locate valid sampling points. Signed-off-by: Haibo Chen <haibo.chen@nxp.com> Signed-off-by: Luke Wang <ziniu.wang_1@nxp.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20250409075550.3413032-4-ziniu.wang_1@nxp.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: sdhci-esdhc-imx: reset async FIFO before sending manual tuning commandHaibo Chen
During manual tuning, residual data in the async FIFO from previous commands may impact with the tuning process. To ensure a clean state: 1. Set the RST_FIFO bit (SYS_CTRL[22]) to reset the async FIFO. 2. Poll the bit until self-cleared, confirming reset completion. This hardening ensures the tuning command starts with a clean FIFO state, improving the reliability of the manual tuning procedure. Signed-off-by: Haibo Chen <haibo.chen@nxp.com> Signed-off-by: Luke Wang <ziniu.wang_1@nxp.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20250409075550.3413032-3-ziniu.wang_1@nxp.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: sdhci-esdhc-imx: explicitly reset tuning circuit via RSTT bitHaibo Chen
According to the i.MX Reference Manual, the RSTT bit (SYS_CTRL[28]) is designed to reset the tuning circuit. While the Reference Manual states that clearing EXECUTE_TUNING bit from 1 to 0 in AUTOCMD12_ERR_STATUS can also set RSTT, this mechanism only works when the original EXECUTE_TUNING bit was 1. When the bit is already 0, the tuning circuit reset will not be triggered. This explicit reset approach strengthens the tuning reliability and aligns with the Reference Manual recommendations. Signed-off-by: Haibo Chen <haibo.chen@nxp.com> Signed-off-by: Luke Wang <ziniu.wang_1@nxp.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20250409075550.3413032-2-ziniu.wang_1@nxp.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: sdhci-esdhc-imx: calculate data timeout value based on clockLuke Wang
Calculate data timeout value based on clock instead of using max value. Signed-off-by: Luke Wang <ziniu.wang_1@nxp.com> Reviewed-by: Haibo Chen <haibo.chen@nxp.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20250409072604.3410459-1-ziniu.wang_1@nxp.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: rename mmc_can_gpio_ro() to mmc_host_can_gpio_ro()Wolfram Sang
mmc_can_* functions sometimes relate to the card and sometimes to the host. Make it obvious by renaming this function to include 'host'. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250401095847.29271-12-wsa+renesas@sang-engineering.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: rename mmc_can_gpio_cd() to mmc_host_can_gpio_cd()Wolfram Sang
mmc_can_* functions sometimes relate to the card and sometimes to the host. Make it obvious by renaming this function to include 'host'. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250401095847.29271-11-wsa+renesas@sang-engineering.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: rename mmc_can_trim() to mmc_card_can_trim()Wolfram Sang
mmc_can_* functions sometimes relate to the card and sometimes to the host. Make it obvious by renaming this function to include 'card'. Also, convert to proper bool type while we are here. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250401095847.29271-10-wsa+renesas@sang-engineering.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: rename mmc_can_sleep() to mmc_card_can_sleep()Wolfram Sang
mmc_can_* functions sometimes relate to the card and sometimes to the host. Make it obvious by renaming this function to include 'card'. Also, convert to proper bool type while we are here. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250401095847.29271-9-wsa+renesas@sang-engineering.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: rename mmc_can_secure_erase_trim() to mmc_card_can_secure_erase_trim()Wolfram Sang
mmc_can_* functions sometimes relate to the card and sometimes to the host. Make it obvious by renaming this function to include 'card'. Also, convert to proper bool type while we are here. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250401095847.29271-8-wsa+renesas@sang-engineering.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: rename mmc_can_sanitize() to mmc_card_can_sanitize()Wolfram Sang
mmc_can_* functions sometimes relate to the card and sometimes to the host. Make it obvious by renaming this function to include 'card'. Also, convert to proper bool type while we are here. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250401095847.29271-7-wsa+renesas@sang-engineering.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: rename mmc_can_reset() to mmc_card_can_reset()Wolfram Sang
mmc_can_* functions sometimes relate to the card and sometimes to the host. Make it obvious by renaming this function to include 'card'. Also, convert to proper bool type while we are here. Conversion was simplified by inverting the logic. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250401095847.29271-6-wsa+renesas@sang-engineering.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: rename mmc_can_poweroff_notify() to mmc_card_can_poweroff_notify()Wolfram Sang
mmc_can_* functions sometimes relate to the card and sometimes to the host. Make it obvious by renaming this function to include 'card'. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250401095847.29271-5-wsa+renesas@sang-engineering.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: rename mmc_can_ext_csd() to mmc_card_can_ext_csd()Wolfram Sang
mmc_can_* functions sometimes relate to the card and sometimes to the host. Make it obvious by renaming this function to include 'card'. Also, convert to proper bool type while we are here. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250401095847.29271-4-wsa+renesas@sang-engineering.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: rename mmc_can_erase() to mmc_card_can_erase()Wolfram Sang
mmc_can_* functions sometimes relate to the card and sometimes to the host. Make it obvious by renaming this function to include 'card'. Also, convert to proper bool type while we are here. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250401095847.29271-3-wsa+renesas@sang-engineering.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: rename mmc_can_discard() to mmc_card_can_discard()Wolfram Sang
mmc_can_* functions sometimes relate to the card and sometimes to the host. Make it obvious by renaming this function to include 'card'. Also, convert to proper bool type while we are here. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250401095847.29271-2-wsa+renesas@sang-engineering.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: alcor: Use str_read_write() helperFeng Wei
Remove hard-coded strings by using the str_read_write() helper. Signed-off-by: Feng Wei <feng.wei8@zte.com.cn> Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn> Link: https://lore.kernel.org/r/20250401195751834zbm34YDvwPeQf7ooZBCdh@zte.com.cn Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: renesas_sdhi: Use of_get_available_child_by_name()Biju Das
Use the helper of_get_available_child_by_name() to simplify renesas_sdhi_probe(). Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250407092144.35268-1-biju.das.jz@bp.renesas.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: mtk-sd: Aggregate R/W for top_base iospace case where possibleAngeloGioacchino Del Regno
In case the controller uses the top_base iospace, most register read/writes can be changed from multiple RWs to a single read and a single write. Where possible, and where it makes sense, aggregate the multiple reads and writes to just one. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20250325110701.52623-5-angelogioacchino.delregno@collabora.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: mtk-sd: Do single write in function msdc_new_tx_settingAngeloGioacchino Del Regno
Instead of reading and writing the LOOP_TEST_CONTROL register for each set or cleared bit, read it once, modify the contents in a local variable, and then write once. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20250325110701.52623-4-angelogioacchino.delregno@collabora.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>