summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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-19dt-bindings: mmc: spacemit,sdhci: add support for K1 SoCYixun Lan
Add support for the SD/eMMC Host Controller found in SpacemiT K1 SoC, The controller supports data transmission of MMC, SDIO, SD protocol. Reviewed-by: Rob Herring (Arm) <robh@kernel.org> Signed-off-by: Yixun Lan <dlan@gentoo.org> Link: https://lore.kernel.org/r/20250509-20-k1-sdhci-v3-1-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-19dt-binding: mmc: microchip,sdhci-pic32: convert text based binding to json ↵Charan Pedumuru
schema Update text binding to YAML. Changes during conversion: Add appropriate include statements for interrupts and clock-names to resolve errors identified by `dt_binding_check` and `dtbs_check`. Signed-off-by: Charan Pedumuru <charan.pedumuru@gmail.com> Acked-by: Conor Dooley <conor.dooley@microchip.com> Link: https://lore.kernel.org/r/20250507-mchp-sdhci-v1-2-ed29de05295a@gmail.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-14dt-bindings: mmc: vt8500-sdmmc: Convert to YAMLAlexey Charkov
Rewrite the textual description for the WonderMedia SDMMC controller as YAML schema, and switch the filename to follow the compatible string. Signed-off-by: Alexey Charkov <alchark@gmail.com> Reviewed-by: Rob Herring (Arm) <robh@kernel.org> Link: https://lore.kernel.org/r/20250423-vt8500-sdmmc-binding-v2-1-ea4f17fd0638@gmail.com 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-14dt-bindings: mmc: sdhci-msm: Add the SM7150 compatibleDanila Tikhonov
Add compatible for the SDHCI block found in SM7150. Signed-off-by: Danila Tikhonov <danila@jiaxyga.com> Link: https://lore.kernel.org/r/20250422-sm7150-upstream-v1-11-bf9a9081631d@jiaxyga.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14dt-bindings: mmc: fsl,esdhc: add compatible string fsl,ls1021a-esdhcFrank Li
Add compatible string fsl,ls1021a-esdhc for LS1021a SoC. Signed-off-by: Frank Li <Frank.Li@nxp.com> Acked-by: Rob Herring (Arm) <robh@kernel.org> Link: https://lore.kernel.org/r/20250417151300.3570021-1-Frank.Li@nxp.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-14dt-bindings: mmc: mtk-sd: Add support for Dimensity 1200 MT6893AngeloGioacchino Del Regno
Add a compatible for the MediaTek Dimensity 1200 (MT6893) SoC. All of the MMC/SD controllers in this chip are compatible with the ones found in MT8183, but do also make use of an optional crypto clock when enabling HW disk encryption. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Acked-by: Rob Herring (Arm) <robh@kernel.org> Link: https://lore.kernel.org/r/20250416120245.147951-1-angelogioacchino.delregno@collabora.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14dt-bindings: mmc: sdhci-of-dwcmhsc: Add Sophgo SG2044 supportInochi Amaoto
The sdhci IP of SG2044 is similar to it of SG2042. They share the same clock and controller configuration. Add compatible string for SG2044. Signed-off-by: Inochi Amaoto <inochiama@gmail.com> Reviewed-by: Chen Wang <unicorn_wang@outlook.com> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20250413223507.46480-8-inochiama@gmail.com 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-14dt-bindings: mmc: arasan,sdhci: Add Renesas RZ/N1DWolfram Sang
This instance has a wakeup irq defined. It is currently not used by the driver. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Rob Herring (Arm) <robh@kernel.org> Link: https://lore.kernel.org/r/20250405173631.13564-2-wsa+renesas@sang-engineering.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>
2025-05-14mmc: mtk-sd: Aggregate writes for MSDC_PATCH_BIT1/2 setupAngeloGioacchino Del Regno
Instead of continuously reading and writing to the patch bit 1/2 registers, prepare the final values to write to those and write just once per register during the setup phase. This makes the driver slightly smaller and also slightly improves the execution time of the msdc_init_hw function, called not only at probe time, but also when resuming from system suspend. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20250325110701.52623-3-angelogioacchino.delregno@collabora.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: mtk-sd: Clarify patch bit register initialization and layoutAngeloGioacchino Del Regno
In preparation for cleaning up the msdc_init_hw register setting for the patch bit registers, add the necessary definitions for bits in the MSDC_PATCH_BIT and MSDC_PATCH_BIT1 registers and use them in place of "magic numbers" writes during initialization. This commit brings no functional differences. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20250325110701.52623-2-angelogioacchino.delregno@collabora.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: sdhci-esdhc-imx: Save tuning value when card stays powered in suspendLuke Wang
For SoCs like i.MX6UL(L/Z) and i.MX7D, USDHC powers off completely during system power management (PM), causing the internal tuning status to be lost. To address this, save the tuning value when system suspend and restore it for any command issued after system resume when re-tuning is held. A typical case involves SDIO WiFi devices with the MMC_PM_KEEP_POWER and MMC_PM_WAKE_SDIO_IRQ flag, which retain power during system PM. To conserve power, WiFi switches to 1-bit mode and restores 4-bit mode upon resume. As per the specification, tuning commands are not supported in 1-bit mode. When sending CMD52 to restore 4-bit mode, re-tuning must be held. However, CMD52 still requires a correct sample point to avoid CRC errors, necessitating preservation of the previous tuning value. Signed-off-by: Luke Wang <ziniu.wang_1@nxp.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20250328112517.2624806-1-ziniu.wang_1@nxp.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14mmc: core: Add support for graceful host removal for SDUlf Hansson
An mmc host driver may allow to unbind from its corresponding host device. If an SD card is attached to the host, the mmc core will just try to cut the power for it, without obeying to the SD spec that potentially may damage the card. Let's fix this problem by implementing a graceful power-down of the card at host removal. Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Link: https://lore.kernel.org/r/20250407152759.25160-6-ulf.hansson@linaro.org
2025-05-14mmc: core: Add support for graceful host removal for eMMCUlf Hansson
An mmc host driver may allow to unbind from its corresponding host device. If an eMMC card is attached to the host, the mmc core will just try to cut the power for it, without obeying to the eMMC spec. Potentially this may damage the card and it may also prevent us from successfully doing a re-initialization of it, which would typically happen if/when we try to re-bind the mmc host driver. To fix these problems, let's implement a graceful power-down of the card at host removal. Reported-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Link: https://lore.kernel.org/r/20250407152759.25160-5-ulf.hansson@linaro.org
2025-05-14mmc: core: Convert into an enum for the poweroff-type for eMMCUlf Hansson
Currently we are only distinguishing between the suspend and the shutdown scenarios, which make a bool sufficient as in-parameter to the various PM functions for eMMC. However, to prepare for adding support for another scenario in a subsequent change, let's convert into using an enum. Suggested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Link: https://lore.kernel.org/r/20250407152759.25160-4-ulf.hansson@linaro.org
2025-05-14mmc: core: Further avoid re-storing power to the eMMC before a shutdownUlf Hansson
To manage a graceful power-off of the eMMC card during platform shutdown, the prioritized option is to use the poweroff-notification command, if the eMMC card supports it. During a suspend request we may decide to fall back to use the sleep command, instead of the poweroff-notification, unless the mmc host supports a complete power-cycle of the eMMC. For this reason, we may need to restore power and re-initialize the card, if it remains suspended when a shutdown request is received. However, the current condition to restore power and re-initialize the card doesn't take into account MMC_CAP2_FULL_PWR_CYCLE_IN_SUSPEND properly. This may lead to doing a re-initialization when it really isn't needed, as the eMMC may already have been powered-off using the poweroff-notification command. Let's fix the condition to avoid this. Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Link: https://lore.kernel.org/r/20250407152759.25160-3-ulf.hansson@linaro.org
2025-05-14mmc: core: Convert mmc_can_poweroff_notify() into a boolUlf Hansson
It's really a true/false value that matters, let's make it clear by returning a bool instead. Reviewed-by: Avri Altman <avri.altman@sandisk.com> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Link: https://lore.kernel.org/r/20250407152759.25160-2-ulf.hansson@linaro.org