Commit graph

1656 commits

Author SHA1 Message Date
Linus Torvalds
854ff79237 MMC core:
- Remove redundant pm_runtime_mark_last_busy() calls
 
 MMC host:
  - Convert drivers to use devm_mmc_alloc_host()
  - Remove redundant pm_runtime_mark_last_busy() calls
  - renesas_sdhi: Add support for the RZ/T2H and RZ/N2H variants
  - renesas_sdhi: Fix incorrect auto retuning for an SDIO card
  - rtsx_usb_sdmmc: Add 74 clocks in poweron flow
  - rtsx_usb_sdmmc: Re-work the code in sd_set_power_mode()
  - loongson2: Add driver for the Loongson-2K SD/SDIO controller
  - loongson2: Add support for the Loongson-2K2000 SD/SDIO/eMMC controller
  - sdhci: Drop sdhci_free_host()/sdhci_pltfm_free() interface
  - sdhci: Remove the sdhci_free_host() and sdhci_pltfm_free() helpers
  - sdhci-cadence: Add support for the Mobileye EyeQ controller
  - sdhci-esdhc-imx: Optimize clock loopback selection
  - sdhci-esdhc-imx: Don't change pinctrl in suspend if wakeup source
  - sdhci-msm: Add support for the Milos variant
  - sdhci-msm: Add support for the qcs8300 variant
  - sdhci-msm: Ensure SD card power isn't ON when card gets removed
  - sdhci-of-k1: Disable HW busy detection
 -----BEGIN PGP SIGNATURE-----
 
 iQJLBAABCgA1FiEEugLDXPmKSktSkQsV/iaEJXNYjCkFAmiIs7gXHHVsZi5oYW5z
 c29uQGxpbmFyby5vcmcACgkQ/iaEJXNYjCmLpA/+PS/xQxbNKpTp8xxGiVNTYjr8
 QodSjlj/v0U+4P5OKgdfPtCfXSdw3qqJXdDExBiciWDk/oP+s6QtijT/kJTaGvF8
 KcY/vWzuuNxqc6B1fcIyxWUwe5u2IZOfAy+eacD+fkjyr2NZN+F45g5Z+3zDGE/X
 792ireOKUFvB8R05SOSOjC4rrNqair+s1ANbVNqjfO5V+iWD6mJPkzy53dM6qeYc
 JaTuELNML51Iv6zFS8cKMLnWaxTb6rDe59oFMDCJF+vvzgj7v0eOUbWUjPUPHShm
 0vxjAAu6EPaWEj0z+PDMeFSrMjCr8QsfD/gixsDJ5mJZnyi0BgAatzJcPZTiZG8H
 WjOR69A68cI2LTvILQ7Juj4GPAMVIqQ1oqsF8Gtq1koV1FdWKAL1Qa7Mzt1ILJun
 lpmPlQfb1sYtUqERVrUspf9xtlrbOcIv6T1VL5k5S0DzkjL05VWH2zPws3IrVSlE
 a25oyfvPKhbvn8csfumk9cSFF9LfTedA21RP6tZWofKZgOBZ5zKqDAggvLM1f9uq
 41Q5i0CEWiq5+C6oK2RbfLzHgqKHbiA0DDCpB+W5Qtbl0mxKpV9Y6iYHzV2SgJp1
 JACfTKOb//lHXN+eMA0JJXBe6OP/5AbeT8+V8dCoRyT1pRJgXHb1UO6wHZ94X2Ho
 j3VDmefy5lOaA4od2bg=
 =bC9D
 -----END PGP SIGNATURE-----

Merge tag 'mmc-v6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc

Pull MMC updates from Ulf Hansson:
 "MMC core:
   - Remove redundant pm_runtime_mark_last_busy() calls

  MMC host:
   - Convert drivers to use devm_mmc_alloc_host()
   - Remove redundant pm_runtime_mark_last_busy() calls
   - renesas_sdhi:
      - Add support for the RZ/T2H and RZ/N2H variants
      - Fix incorrect auto retuning for an SDIO card
   - rtsx_usb_sdmmc:
      - Add 74 clocks in poweron flow
      - Re-work the code in sd_set_power_mode()
   - loongson2:
      - Add driver for the Loongson-2K SD/SDIO controller
      -  Add support for the Loongson-2K2000 SD/SDIO/eMMC controller
   - sdhci:
      - Drop sdhci_free_host()/sdhci_pltfm_free() interface
      - Remove the sdhci_free_host() and sdhci_pltfm_free() helpers
   - sdhci-cadence: Add support for the Mobileye EyeQ controller
   - sdhci-esdhc-imx:
      - Optimize clock loopback selection
      - Don't change pinctrl in suspend if wakeup source
   - sdhci-msm:
      - Add support for the Milos variant
      - Add support for the qcs8300 variant
      - Ensure SD card power isn't ON when card gets removed
   - sdhci-of-k1: Disable HW busy detection"

* tag 'mmc-v6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (102 commits)
  mmc: loongson2: Unify the function prefixes for loongson2_mmc_pdata
  mmc: loongson2: Fix error code in loongson2_mmc_resource_request()
  dt-bindings: mmc: sdhci-msm: document the Milos SDHCI Controller
  mmc: loongson2: prevent integer overflow in ret variable
  mmc: Remove redundant pm_runtime_mark_last_busy() calls
  mmc: sdhci-msm: Ensure SD card power isn't ON when card removed
  dt-bindings: mmc: Add sdhci compatible for qcs8300
  mmc: sdhci-cadence: use of_property_present
  mmc: loongson2: Add Loongson-2K2000 SD/SDIO/eMMC controller driver
  dt-bindings: mmc: loongson,ls2k0500-mmc: Add compatible for Loongson-2K2000
  mmc: loongson2: Add Loongson-2K SD/SDIO controller driver
  dt-bindings: mmc: Add Loongson-2K SD/SDIO/eMMC controller binding
  mmc: Convert ternary operator to str_true_false() helper
  dt-bindings: mmc: renesas,sdhi: Document RZ/T2H and RZ/N2H support
  mmc: sdhci-cadence: add Mobileye eyeQ support
  dt-bindings: mmc: cdns: add Mobileye EyeQ MMC/SDHCI controller
  mmc: rtsx_usb_sdmmc: Fix clang -Wimplicit-fallthrough in sd_set_power_mode()
  mmc: cb710-mmc: Convert ternary operator to str_plural() helper
  mmc: rtsx_usb_sdmmc: Add 74 clocks in poweron flow
  mmc: rtsx_usb_sdmmc: Re-work the code in sd_set_power_mode()
  ...
2025-07-29 12:05:38 -07:00
Rafael J. Wysocki
40c2819955 Merge branches 'pm-misc' and 'pm-tools'
Merge miscellaneous power management updates and cpupower utility
updates for 6.17-rc1:

 - Update contact information in the PM ABI docs and maintainer
   information in the power domains DT binding (Rafael Wysocki)

 - Update PM header inclusions to follow the IWYU (Include What You Use)
   principle (Andy Shevchenko)

 - Add flags to specify power on attach/detach for PM domains, make the
   driver core detach PM domains in device_unbind_cleanup(), and drop
   the dev_pm_domain_detach() call from the platform bus type (Claudiu
   Beznea)

 - Improve Python binding's Makefile for cpupower (John B. Wyatt IV)

 - Fix printing of CORE, CPU fields in cpupower-monitor (Gautham Shenoy)

* pm-misc:
  PM: docs: Use my kernel.org address in ABI docs and DT bindings
  driver core: platform: Drop dev_pm_domain_detach() call
  PM: domains: Detach on device_unbind_cleanup()
  PM: domains: Add flags to specify power on attach/detach
  PM: Don't use "proxy" headers

* pm-tools:
  cpupower: Improve Python binding's Makefile
  pm: cpupower: Fix printing of CORE, CPU fields in cpupower-monitor
  pm: cpupower: Fix the snapshot-order of tsc,mperf, clock in mperf_stop()
2025-07-22 18:07:11 +02:00
Sakari Ailus
c2ac67b5b1 mmc: Remove redundant pm_runtime_mark_last_busy() calls
pm_runtime_put_autosuspend(), pm_runtime_put_sync_autosuspend(),
pm_runtime_autosuspend() and pm_request_autosuspend() now include a call
to pm_runtime_mark_last_busy(). Remove the now-reduntant explicit call to
pm_runtime_mark_last_busy().

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Link: https://lore.kernel.org/r/20250704075434.3220506-1-sakari.ailus@linux.intel.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-07-09 15:54:06 +02:00
Claudiu Beznea
d42c7c6fd6 PM: domains: Add flags to specify power on attach/detach
Calling dev_pm_domain_attach()/dev_pm_domain_detach() in bus driver
probe/remove functions can affect system behavior when the drivers
attached to the bus use devres-managed resources. Since devres actions
may need to access device registers, calling dev_pm_domain_detach() too
early, i.e., before these actions complete, can cause failures on some
systems. One such example is Renesas RZ/G3S SoC-based platforms.

If the device clocks are managed via PM domains, invoking
dev_pm_domain_detach() in the bus driver's remove function removes the
device's clocks from the PM domain, preventing any subsequent
pm_runtime_resume*() calls from enabling those clocks.

The second argument of dev_pm_domain_attach() specifies whether the PM
domain should be powered on during attachment. Likewise, the second
argument of dev_pm_domain_detach() indicates whether the domain should be
powered off during detachment.

Upcoming changes address the issue described above (initially for the
platform bus only) by deferring the call to dev_pm_domain_detach() until
after devres_release_all() in device_unbind_cleanup(). The detach_power_off
field in struct dev_pm_info stores the detach power off info from the
second argument of dev_pm_domain_attach().

Because there are cases where the device's PM domain power-on/off behavior
must be conditional (e.g., in i2c_device_probe()), the patch introduces
PD_FLAG_ATTACH_POWER_ON and PD_FLAG_DETACH_POWER_OFF flags to be passed
to dev_pm_domain_attach().

Finally, dev_pm_domain_attach() and its users are updated to use the newly
introduced PD_FLAG_ATTACH_POWER_ON and PD_FLAG_DETACH_POWER_OFF macros.

This change is preparatory.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com> # I2C
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Link: https://patch.msgid.link/20250703112708.1621607-2-claudiu.beznea.uj@bp.renesas.com
[ rjw: Changelog adjustments ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-07-07 20:41:20 +02:00
Victor Shih
14633da0f4 mmc: core: Adjust some error messages for SD UHS-II cards
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: 9a9f7e1395 ("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-24 12:38:02 +02:00
Avri Altman
009c3a4bc4 mmc: core: sd: Apply BROKEN_SD_DISCARD quirk earlier
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: 07d2872bf4 ("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-09 15:19:12 +02:00
Ingo Molnar
41cb08555c treewide, timers: Rename from_timer() to timer_container_of()
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-06-08 09:07:37 +02:00
Loic Poulain
f0534aace3 mmc: core: Scan the eMMC boot areas for partition table
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-19 13:22:10 +02:00
Wolfram Sang
9e654f2bf3 mmc: rename mmc_boot_partition_access() to mmc_host_can_access_boot()
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-14 17:07:48 +02:00
Wolfram Sang
f55f7da621 mmc: rename mmc_host_uhs() to mmc_host_can_uhs()
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-14 17:07:48 +02:00
Wolfram Sang
dc03e2e9f0 mmc: rename mmc_host_done_complete() to mmc_host_can_done_complete()
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-14 17:07:48 +02:00
Wolfram Sang
03b31a0638 mmc: rename mmc_host_cmd23() to mmc_host_can_cmd23()
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-14 17:07:48 +02:00
Wolfram Sang
2e1a26ed6b mmc: rename mmc_can_gpio_ro() to mmc_host_can_gpio_ro()
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-14 16:59:17 +02:00
Wolfram Sang
da012e1eb5 mmc: rename mmc_can_gpio_cd() to mmc_host_can_gpio_cd()
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-14 16:59:17 +02:00
Wolfram Sang
b89d05f654 mmc: rename mmc_can_trim() to mmc_card_can_trim()
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-14 16:59:17 +02:00
Wolfram Sang
e3df5ae476 mmc: rename mmc_can_sleep() to mmc_card_can_sleep()
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-14 16:59:17 +02:00
Wolfram Sang
55e0961a8b mmc: rename mmc_can_secure_erase_trim() to mmc_card_can_secure_erase_trim()
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-14 16:59:17 +02:00
Wolfram Sang
2abda04856 mmc: rename mmc_can_sanitize() to mmc_card_can_sanitize()
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-14 16:59:17 +02:00
Wolfram Sang
07dd2b3204 mmc: rename mmc_can_reset() to mmc_card_can_reset()
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-14 16:59:17 +02:00
Wolfram Sang
d872c26741 mmc: rename mmc_can_poweroff_notify() to mmc_card_can_poweroff_notify()
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-14 16:59:17 +02:00
Wolfram Sang
ceb5d3acb0 mmc: rename mmc_can_ext_csd() to mmc_card_can_ext_csd()
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-14 16:59:17 +02:00
Wolfram Sang
5513d9bebb mmc: rename mmc_can_erase() to mmc_card_can_erase()
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-14 16:59:17 +02:00
Wolfram Sang
76d62cde68 mmc: rename mmc_can_discard() to mmc_card_can_discard()
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-14 16:59:17 +02:00
Ulf Hansson
dfc29a10c4 mmc: core: Add support for graceful host removal for SD
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-14 16:59:16 +02:00
Ulf Hansson
5b79352290 mmc: core: Add support for graceful host removal for eMMC
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-14 16:59:16 +02:00
Ulf Hansson
900ef53558 mmc: core: Convert into an enum for the poweroff-type for eMMC
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-14 16:59:16 +02:00
Ulf Hansson
fa34c940e8 mmc: core: Further avoid re-storing power to the eMMC before a shutdown
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-14 16:59:16 +02:00
Ulf Hansson
3953e7e8c1 mmc: core: Convert mmc_can_poweroff_notify() into a bool
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
2025-05-14 16:59:16 +02:00
Erick Shepherd
9510b38dc0 mmc: Add quirk to disable DDR50 tuning
Adds the MMC_QUIRK_NO_UHS_DDR50_TUNING quirk and updates
mmc_execute_tuning() to return 0 if that quirk is set. This fixes an
issue on certain Swissbit SD cards that do not support DDR50 tuning
where tuning requests caused I/O errors to be thrown.

Signed-off-by: Erick Shepherd <erick.shepherd@ni.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20250331221337.1414534-1-erick.shepherd@ni.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-05-14 16:59:16 +02:00
Thomas Gleixner
8fa7292fee treewide: Switch/rename to timer_delete[_sync]()
timer_delete[_sync]() replaces del_timer[_sync](). Convert the whole tree
over and remove the historical wrapper inlines.

Conversion was done with coccinelle plus manual fixups where necessary.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2025-04-05 10:30:12 +02:00
Linus Torvalds
9b960d8cd6 for-6.15/block-20250322
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmfe8BkQHGF4Ym9lQGtl
 cm5lbC5kawAKCRD301j7KXHgpvTqD/4pOeGi/QfLyocn4TcJcidRGZAvBxecTVuM
 upeyr+dCyCi9Wk+EJKeAFooGe15upzxDxKj06HhCixaLx4etDK78uGV4FMM1Z4oa
 2dtchz1Zd0HyBPgQIUY8OuOgbS7tstMS/KdvL+gr5IjfapeTF+54WVLCD8eVyvO/
 vUIppgJBhrqy2qui4xF2lw4t2COt+/PqinGQuYALn4V4Po9NWA7lSh3ZI4F/byj1
 v68jXyt2fqCAyxwkzRDv4GxhN8c6W+TPJpzivrEAuSkLacovESKztinOrafrBnLR
 zdyO4n0V0yGOXbAcxRbADVA4HUsqhLl4JRnvE5P5zIaD7rkE0UqggF7vrSeCvVA1
 hsi1BhkAMNimKX7CZMnT3dJpxRQj1eDJxpwUAusLHWjMyQbNFhV7WAtthMtVJon8
 lAS4e5+xzjqKhF15GpVg5Lzy8SAwdqgNXwwq2zbM8OaPKG0FpajG8DXAqqcj4fpy
 WXnwg72KZDmRcSNJhVZK6B9xSAwIMXPgH4ClCMP9/xlw8EDpM38MDmzrs35TAVtI
 HGE3Qv9CjFjVj/OG3el+bTGIQJFVgYEVPV5TYfNCpKoxpj5cLn5OQY5u6MJawtgK
 HeDgKv3jw3lHatDALMVfwJqqVlUht0R6SIxtP9WHV+CcFrqN1LJKmdhDQbm7b4XK
 EbbawIsdxw==
 =Ci5m
 -----END PGP SIGNATURE-----

Merge tag 'for-6.15/block-20250322' of git://git.kernel.dk/linux

Pull block updates from Jens Axboe:

 - Fixes for integrity handling

 - NVMe pull request via Keith:
      - Secure concatenation for TCP transport (Hannes)
      - Multipath sysfs visibility (Nilay)
      - Various cleanups (Qasim, Baruch, Wang, Chen, Mike, Damien, Li)
      - Correct use of 64-bit BARs for pci-epf target (Niklas)
      - Socket fix for selinux when used in containers (Peijie)

 - MD pull request via Yu:
      - fix recovery can preempt resync (Li Nan)
      - fix md-bitmap IO limit (Su Yue)
      - fix raid10 discard with REQ_NOWAIT (Xiao Ni)
      - fix raid1 memory leak (Zheng Qixing)
      - fix mddev uaf (Yu Kuai)
      - fix raid1,raid10 IO flags (Yu Kuai)
      - some refactor and cleanup (Yu Kuai)

 - Series cleaning up and fixing bugs in the bad block handling code

 - Improve support for write failure simulation in null_blk

 - Various lock ordering fixes

 - Fixes for locking for debugfs attributes

 - Various ublk related fixes and improvements

 - Cleanups for blk-rq-qos wait handling

 - blk-throttle fixes

 - Fixes for loop dio and sync handling

 - Fixes and cleanups for the auto-PI code

 - Block side support for hardware encryption keys in blk-crypto

 - Various cleanups and fixes

* tag 'for-6.15/block-20250322' of git://git.kernel.dk/linux: (105 commits)
  nvmet: replace max(a, min(b, c)) by clamp(val, lo, hi)
  nvme-tcp: fix selinux denied when calling sock_sendmsg
  nvmet: pci-epf: Always configure BAR0 as 64-bit
  nvmet: Remove duplicate uuid_copy
  nvme: zns: Simplify nvme_zone_parse_entry()
  nvmet: pci-epf: Remove redundant 'flush_workqueue()' calls
  nvmet-fc: Remove unused functions
  nvme-pci: remove stale comment
  nvme-fc: Utilise min3() to simplify queue count calculation
  nvme-multipath: Add visibility for queue-depth io-policy
  nvme-multipath: Add visibility for numa io-policy
  nvme-multipath: Add visibility for round-robin io-policy
  nvmet: add tls_concat and tls_key debugfs entries
  nvmet-tcp: support secure channel concatenation
  nvmet: Add 'sq' argument to alloc_ctrl_args
  nvme-fabrics: reset admin connection for secure concatenation
  nvme-tcp: request secure channel concatenation
  nvme-keyring: add nvme_tls_psk_refresh()
  nvme: add nvme_auth_derive_tls_psk()
  nvme: add nvme_auth_generate_digest()
  ...
2025-03-26 18:08:55 -07:00
Linus Torvalds
0163c8864b MMC host:
- atmel-mci: Convert DT bindings to json schema
  - dw_mmc: Add support for the Exynos7870 variant
  - dw_mmc-rockchip: Add support for the RK3562/3528 variants
  - omap: Fix potential memory leak in the probe error path
  - renesas_sdhi: Add support for RZ/G3E variants
  - sdhci: Disable SD card clock before changing parameters
  - sdhci-esdhc-imx: Add support for the i.MX94 variant
  - sdhci-of-dwcmshc: Add support for the RK3562/RK3528 variants
  - sdhci-omap: Disable aggressive PM for eMMC/SD-cards
  - sdhci-pci-core: Wait for VDD to settle on card power off
  - sdhci-pxav3: Fix busy-signalling by using MMC_CAP_NEED_RSP_BUSY
  - sunxi-mmc: Add support for the A523 variant
 
 MEMSTICK:
  - rtsx_usb_ms: Fix potential use-after-free during remove
 -----BEGIN PGP SIGNATURE-----
 
 iQJLBAABCgA1FiEEugLDXPmKSktSkQsV/iaEJXNYjCkFAmfifpgXHHVsZi5oYW5z
 c29uQGxpbmFyby5vcmcACgkQ/iaEJXNYjCl/pxAAuvv6EAxxz/kt5iZJoxxBxp6V
 TCBYNOKxxgHaD/fyWERCi9ON4+W2fJoghVolNblBFAxrdl/VdEzHAyB8YOHsQcno
 chFccV8n0bhxWzl5O2UTRTszP+3Fa/AdiQb5FR8NoAoNuDXwn673gxJUWT24pRcm
 8swMDQJiWLtJ5QskW+OWJXsdcuYa89FLOHgBnn+NVLTDUBqFgRuuVMhJA+td1rW4
 Pv5EMeFw3+AcUlBlHXUlFjq08I92kcDxxBXRpIvUwC586aKyire/quVOX+CmQquK
 i27RdU+UjCzbJp0FLK9+4DEm6uRK3EzQxUtNx8qGmj6xqkTj5jOj3/lMV7oOepOR
 bLBrmdXsOCSzIHuAYQSrVi1sBClSmnRSBgLgrouUo3AP9h+IAWtD928LeVZxD82Q
 mmDGh9EwStodEyZMwqbT41lsj33BEeXAWThNsZW+savFisfAMKBgrk3H2l8Qn+71
 MKUiA5OaXhTM8n6ihLIv26KCrdipBS31X1hIWWj7yJBNkNd0LIYnSzPyp126BFLT
 AwrR+CglTpEIc+0e8UMb9S8YgNgW3OCnYeF5BzVtyrZR7qNj96VaYyORTP+GkDhl
 S4+Jrsi+qjVoNDvgJ8htNkH0HyZj+qYJBNz7AIqdT4AW7TCCE4BVGQNWGPeUTTx6
 lGQtJkfT4nG+G0XmXGQ=
 =a9PQ
 -----END PGP SIGNATURE-----

Merge tag 'mmc-v6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc

Pull MMC updates from Ulf Hansson:
 "MMC host:
   - atmel-mci: Convert DT bindings to json schema
   - dw_mmc: Add support for the Exynos7870 variant
   - dw_mmc-rockchip: Add support for the RK3562/3528 variants
   - omap: Fix potential memory leak in the probe error path
   - renesas_sdhi: Add support for RZ/G3E variants
   - sdhci: Disable SD card clock before changing parameters
   - sdhci-esdhc-imx: Add support for the i.MX94 variant
   - sdhci-of-dwcmshc: Add support for the RK3562/RK3528 variants
   - sdhci-omap: Disable aggressive PM for eMMC/SD-cards
   - sdhci-pci-core: Wait for VDD to settle on card power off
   - sdhci-pxav3: Fix busy-signalling by using MMC_CAP_NEED_RSP_BUSY
   - sunxi-mmc: Add support for the A523 variant

  MEMSTICK:
   - rtsx_usb_ms: Fix potential use-after-free during remove"

* tag 'mmc-v6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (27 commits)
  mmc: core: Remove redundant null check
  mmc: host: Wait for Vdd to settle on card power off
  mmc: omap: Fix memory leak in mmc_omap_new_slot
  memstick: rtsx_usb_ms: Fix slab-use-after-free in rtsx_usb_ms_drv_remove
  mmc: renesas_sdhi: fix error code in renesas_sdhi_probe()
  mmc: sdhci-pxav3: set NEED_RSP_BUSY capability
  mmc: sdhci-omap: Disable MMC_CAP_AGGRESSIVE_PM for eMMC/SD
  tty: mmc: sdio: use bool for cts and remove parentheses
  dt-bindings: mmc: sunxi: add compatible strings for Allwinner A523
  dt-bindings: mmc: sunxi: Simplify compatible string listing
  dt-bindings: mmc: sdhci-of-dwcmhsc: Add compatible string for RK3528
  dt-bindings: mmc: rockchip-dw-mshc: Add compatible string for RK3528
  mmc: renesas_sdhi: Add support for RZ/G3E SoC
  dt-bindings: mmc: renesas,sdhi: Document RZ/G3E support
  dt-bindings: mmc: rockchip-dw-mshc: Add support for rk3562
  dt-bindings: mmc: Add support for rk3562 eMMC
  mmc: core: Trim trailing whitespace from card product names
  dt-bindings: mmc: atmel,hsmci: Convert to json schema
  dt-bindings: mmc: mmc-slot: Make compatible property optional
  dt-bindings: mmc: fsl-imx-esdhc: Add i.MX94 support
  ...
2025-03-25 20:36:29 -07:00
Avri Altman
c48e13e835 mmc: core: Remove redundant null check
This change removes a redundant null check found by Smatch.

Fixes: 403a0293f1 ("mmc: core: Add open-ended Ext memory addressing")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/linux-mmc/345be6cd-f2f3-472e-a897-ca4b7c4cf826@stanley.mountain/
Signed-off-by: Avri Altman <avri.altman@sandisk.com>
Link: https://lore.kernel.org/r/20250319203642.778016-1-avri.altman@sandisk.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-03-21 09:48:37 +01:00
Jiri Slaby (SUSE)
38e7047a4d tty: mmc: sdio: use bool for cts and remove parentheses
'cts' in sdio_uart_check_modem_status() is considered a 'bool', but
typed as signed 'int'. Make it 'bool' so it is clear the code does not
care about the masked value, but true/false.

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20250317070046.24386-18-jirislaby@kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-03-17 11:22:06 +01:00
Anuj Gupta
75618ac6e9 block: remove unused parameter 'q' parameter in __blk_rq_map_sg()
request_queue param is no longer used by blk_rq_map_sg and
__blk_rq_map_sg. Remove it.

Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20250313035322.243239-1-anuj20.g@samsung.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-03-13 05:46:19 -06:00
Dragan Simic
3b791214c8 mmc: core: Trim trailing whitespace from card product names
Product names for some eMMC chips can include trailing whitespace, which
seems to be rather uncommon, but makes emitted messages and /sys properties
somewhat unsightly.  Here's such an example from a Pine64 PineNote, in which
"Biwin ", as the eMMC product name, contains trailing whitespace:

  mmc0: new HS200 MMC card at address 0001
  mmcblk0: mmc0:0001 Biwin  115 GiB
  mmcblk0: p1 p2 p3 p4 p5 p6 p7
  mmcblk0boot0: mmc0:0001 Biwin  4.00 MiB
  mmcblk0boot1: mmc0:0001 Biwin  4.00 MiB
  mmcblk0rpmb: mmc0:0001 Biwin  4.00 MiB, chardev (249:0)

Trailing whitespace in /sys properties may even cause some unforeseen issues
with some scripts, so let's have the trailing whitespace trimmed in product
names for eMMC chips.  Although not observed yet by the author of these
changes, the same trailing whitespace may appear in SD card product names,
so let's trim them as well, which can't hurt.

Touch-up one comment as well, by using proper capitalization.

Signed-off-by: Dragan Simic <dsimic@manjaro.org>
Acked-by: Avri Altman <avri.altman@sandisk.com>
Link: https://lore.kernel.org/r/fb7fcecae737f3e8b279854d7c853000527cba9a.1740597891.git.dsimic@manjaro.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-03-12 11:30:22 +01:00
Dr. David Alan Gilbert
6bc022653d mmc: slot-gpio: Remove unused mmc_gpio_set_cd_isr
mmc_gpio_set_cd_isr() last use was removed in 2018 by
commit 7838a8ddc8 ("mmc: omap_hsmmc: Kill off cover detection")

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250129214335.125292-1-linux@treblig.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-03-11 18:08:26 +01:00
David Lechner
aac4be9341 mmc: pwrseq_simple: use gpiod_multi_set_value_cansleep
Reduce verbosity by using gpiod_multi_set_value_cansleep() instead of
gpiod_set_array_value_cansleep().

Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20250210-gpio-set-array-helper-v3-11-d6a673674da8@baylibre.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-02-17 14:27:34 +01:00
Linus Torvalds
2bf717b079 MMC core:
- Share a helper to convert from crypto_profile to mmc_host
  - Respect quirk_max_rate for non-UHS SDIO card too
 
 MMC host:
  - Add DT bindings for the mmc-slot
  - Clarify DT bindings for the mmc-controller
  - bcm2835: Add support for system-wide suspend/resume PM
  - dw_mmc-exynos: Add support for the exynos8895 variant
  - meson-mx-sdio: Convert DT bindings to dtschema
  - mtk-sd: Fixup use of two register ranges
  - mtk-sd: Add support for ignoring cmd response CRC
  - sdhci-esdhc-imx: enable 'SDHCI_QUIRK_NO_LED' quirk for S32G
  - sdhci-msm: Correctly set the load for the regulator
  - sdhci-msm: Convert to use custom crypto profile
  - sdhci-of-at91: Add support for the microchip sama7d65 variant
 -----BEGIN PGP SIGNATURE-----
 
 iQJLBAABCgA1FiEEugLDXPmKSktSkQsV/iaEJXNYjCkFAmeOYOYXHHVsZi5oYW5z
 c29uQGxpbmFyby5vcmcACgkQ/iaEJXNYjClhzxAAsytG5oxMbCNEbLV00CqX58n3
 BJTpDVaG6CYy+pr6lgNBljswl1kzX36sHuBsD6nUve8ZP145UU3PC8tEgdYTDzx1
 oLog+ObTTkHlVK2X9XWfhuv6EDhqBN5z3Z43yKVCAfFgti/amSgevv1DKJSZ5Q3W
 4ybo/4sttXL2PaShLkAUnm+w50Iq+D7i2vq6mvXyw90vsS/wvO//hljW3tLTKA5G
 Xsb3jNZt48F+AKFrIbB2V2c2SgiyyCR+po+5ZGCAIPwwC/SCJBjkmDzPd0+5aAVU
 HQudyUC6vdB/gODYJtsyV4q5YHOLqP4hLaN46hwD0SZHmQPgTIMxOlQCZDUqxwUn
 GlZsN5nBwEl+eKVDiiiS3b8wO0geXjUVvw5+qvb1mXeHULBFlYxksJGE+eUfrW9D
 ldouNLggHN6gtIFlPIS98D3ly2WPBGC/xMs3pvWaOK+hMeH1IpjZw+b8kcuojVIh
 7mODdyxZGGaqGyhaWQHvwtHgGJKMbqm5sr2amVZkoChgNysomGpR/bMvBpv0HMC8
 oUTGF8CaC8W4auTc6Jx7NtdAaHtPY9URN6Cdyuc8JeBDuKpG9B1m50lrUW3f3PZu
 7njzBMdUQ+IBZ5WyimM06qREyFVQEJHiNVb1EnPTWctPoKVj1ZKmS5QeEOYUbUWi
 9sC4TwrD2N2Rpuvl5MU=
 =KHab
 -----END PGP SIGNATURE-----

Merge tag 'mmc-v6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc

Pull MMC updates from Ulf Hansson:
 "MMC core:
   - Share a helper to convert from crypto_profile to mmc_host
   - Respect quirk_max_rate for non-UHS SDIO card too

  MMC host:
   - Add DT bindings for the mmc-slot
   - Clarify DT bindings for the mmc-controller
   - bcm2835: Add support for system-wide suspend/resume PM
   - dw_mmc-exynos: Add support for the exynos8895 variant
   - meson-mx-sdio: Convert DT bindings to dtschema
   - mtk-sd: Fixup use of two register ranges
   - mtk-sd: Add support for ignoring cmd response CRC
   - sdhci-esdhc-imx: enable 'SDHCI_QUIRK_NO_LED' quirk for S32G
   - sdhci-msm: Correctly set the load for the regulator
   - sdhci-msm: Convert to use custom crypto profile
   - sdhci-of-at91: Add support for the microchip sama7d65 variant"

* tag 'mmc-v6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (25 commits)
  mmc: sdhci-msm: Correctly set the load for the regulator
  mmc: hi3798mv200: Use syscon_regmap_lookup_by_phandle_args
  mmc: Use of_property_present() for non-boolean properties
  dt-bindings: mmc: samsung,exynos-dw-mshc: add specific compatible for exynos8895
  mmc: sdhci-msm: convert to use custom crypto profile
  mmc: crypto: add mmc_from_crypto_profile()
  mmc: mtk-sd: Limit getting top_base to SoCs that require it
  dt-bindings: mmc: mtk-sd: Document compatibles that need two register ranges
  mmc: sdhci-acpi: Use devm_platform_ioremap_resource()
  mmc: sdhci-acpi: Remove not so useful error message
  dt-bindings: mmc: convert amlogic,meson-mx-sdio.txt to dtschema
  dt-bindings: mmc: document mmc-slot
  dt-bindings: mmc: controller: remove '|' when not needed
  dt-bindings: mmc: controller: move properties common with slot out to mmc-controller-common
  dt-bindings: mmc: controller: clarify the address-cells description
  mmc: bcm2835: add suspend/resume pm support
  dt-bindings: Drop Bhupesh Sharma from maintainers
  mmc: core: don't include 'pm_wakeup.h' directly
  mmc: mtk-sd: Add support for ignoring cmd response CRC
  mmc: core: Introduce the MMC_RSP_R1B_NO_CRC response
  ...
2025-01-22 10:39:17 -08:00
Christoph Hellwig
cc76ace465 block: remove BLK_MQ_F_SHOULD_MERGE
BLK_MQ_F_SHOULD_MERGE is set for all tag_sets except those that purely
process passthrough commands (bsg-lib, ufs tmf, various nvme admin
queues) and thus don't even check the flag.  Remove it to simplify the
driver interface.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20241219060214.1928848-1-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2024-12-23 08:17:23 -07:00
Wolfram Sang
65169604e8 mmc: core: don't include 'pm_wakeup.h' directly
The header clearly states that it does not want to be included directly,
only via 'device.h'. 'platform_device.h' works equally well. Remove the
direct inclusion.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Message-ID: <20241118072917.3853-9-wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-12-10 11:18:45 +01:00
Andy-ld Lu
ed97550d47 mmc: core: Introduce the MMC_RSP_R1B_NO_CRC response
The R1B response type with ignoring CRC is used in the mmc_cqe_recovery(),
introduce the MMC_RSP_R1B_NO_CRC response type to simplify the code.

Signed-off-by: Andy-ld Lu <andy-ld.lu@mediatek.com>
Message-ID: <20241126125041.16071-2-andy-ld.lu@mediatek.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-12-10 11:18:45 +01:00
Shawn Lin
a2a44f8da2 mmc: core: Respect quirk_max_rate for non-UHS SDIO card
The card-quirk was added to limit the clock-rate for a card with UHS-mode
support, although let's respect the quirk for non-UHS mode too, to make the
behaviour consistent.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Message-ID: <1732268242-72799-1-git-send-email-shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-12-10 11:18:45 +01:00
Ulf Hansson
87a0d90fcd mmc: core: Further prevent card detect during shutdown
Disabling card detect from the host's ->shutdown_pre() callback turned out
to not be the complete solution. More precisely, beyond the point when the
mmc_bus->shutdown() has been called, to gracefully power off the card, we
need to prevent card detect. Otherwise the mmc_rescan work may poll for the
card with a CMD13, to see if it's still alive, which then will fail and
hang as the card has already been powered off.

To fix this problem, let's disable mmc_rescan prior to power off the card
during shutdown.

Reported-by: Anthony Pighin <anthony.pighin@nokia.com>
Fixes: 66c915d09b ("mmc: core: Disable card detect during shutdown")
Cc: stable@vger.kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
Closes: https://lore.kernel.org/all/BN0PR08MB695133000AF116F04C3A9FFE83212@BN0PR08MB6951.namprd08.prod.outlook.com/
Tested-by: Anthony Pighin <anthony.pighin@nokia.com>
Message-ID: <20241125122446.18684-1-ulf.hansson@linaro.org>
2024-12-02 15:37:16 +01:00
Linus Torvalds
38556294b8 MMC core:
- Add support for Ultra Capacity SD cards (SDUC, 2TB to 128TB)
  - Add support for Ultra High-Speed II SD cards (UHS-II)
  - Use a reset control for pwrseq_simple
  - Add SD card quirk for broken poweroff notification
  - Use GFP_NOIO for SD ACMD22
 
 MMC host:
  - bcm2835: Introduce proper clock handling
  - mtk-sd: Add support for the Host-Software-Queue interface
  - mtk-sd: Add support for the mt7988/mt8196 variants
  - mtk-sd: Fix a couple of error paths in ->probe()
  - sdhci: Add interface to support UHS-II SD cards
  - sdhci_am654: Fixup support for changing the signal voltage level
  - sdhci-cadence: Add support for the Microchip PIC64GX variant
  - sdhci-esdhc-imx: Add support for eMMC HW-reset
  - sdhci-msm: Add support for the X1E80100/IPQ5424/SAR2130P/QCS615 variants
  - sdhci-of-arasan: Add support for eMMC HW-reset
  - sdhci-pci-gli: Add UHS-II support for the GL9767/GL9755 variants
 
 MEMSTICK:
  - A couple of minor updates
 -----BEGIN PGP SIGNATURE-----
 
 iQJLBAABCgA1FiEEugLDXPmKSktSkQsV/iaEJXNYjCkFAmc7NnoXHHVsZi5oYW5z
 c29uQGxpbmFyby5vcmcACgkQ/iaEJXNYjCnQPRAAkxvhptCjKuLBIMBrNZglQElp
 Ncm8fXDiS72CvLwC3bp7rxognCKLVQGWc8GrxcBOxMSB5eiDyPe6xcLLQ2Zrm4l/
 msnfP29VDtmWw3K1iC2Uzo0vlMWYyRFX0OK3fz3d6WL0dE6TXy5adsdy9BmdxGXk
 vpDgiTWkSZcoT/upuXs8/0N87eSgLUFzZ8uPNP+aHtF4AVWIwhJ3Y1MKqdfGrUlw
 7b9bFeh6DelA+jGDxsPsqSwDBh2CDDP3YaPFYf4yyaeTRJmp6DMSEqjDifBa+hDn
 wkwNGj9bN05HeRN3TfsF/Z22LcaPcbWlLYh8p06h+Ws+R/2KxAXdV3oWnKNLQB9R
 5WIdgb7HBD2OS2RymPeHygPPGt6zgxk55UfTBwchg7fHyugXvpcT/JDS2mbPQT4w
 Ty4s217wBn6Kkt4/8fWhHyG/rKBTq02Etmdery4AAM49M2iPvf+edio53FLnskrq
 xB8kYn5UZkk9dQ+GseC4+tXe8A1G/sxh/E2aJ/b15Mc9Mh1/BqL3g2532A+z6x5Q
 8o4nyztCJhKWtfYxo1slnWzF+Axrz6ZXgVYh5MecMk9EjKVcX6oN+FGpiK/cg3dQ
 7FFyzf+YGwdnOhuHhdBG0NTbvKvIRA0rMQ3xvhsfXqCI206j7FZNpWOxXYn36Lgt
 oZlprarw04AoECCg5Ko=
 =LGdl
 -----END PGP SIGNATURE-----

Merge tag 'mmc-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc

Pull MMC updates from Ulf Hansson:
 "MMC core:
   - Add support for Ultra Capacity SD cards (SDUC, 2TB to 128TB)
   - Add support for Ultra High-Speed II SD cards (UHS-II)
   - Use a reset control for pwrseq_simple
   - Add SD card quirk for broken poweroff notification
   - Use GFP_NOIO for SD ACMD22

  MMC host:
   - bcm2835: Introduce proper clock handling
   - mtk-sd: Add support for the Host-Software-Queue interface
   - mtk-sd: Add support for the mt7988/mt8196 variants
   - mtk-sd: Fix a couple of error paths in ->probe()
   - sdhci: Add interface to support UHS-II SD cards
   - sdhci_am654: Fixup support for changing the signal voltage level
   - sdhci-cadence: Add support for the Microchip PIC64GX variant
   - sdhci-esdhc-imx: Add support for eMMC HW-reset
   - sdhci-msm: Add support for the X1E80100/IPQ5424/SAR2130P/QCS615 variants
   - sdhci-of-arasan: Add support for eMMC HW-reset
   - sdhci-pci-gli: Add UHS-II support for the GL9767/GL9755 variants

  MEMSTICK:
   - A couple of minor updates"

* tag 'mmc-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (78 commits)
  mmc: pwrseq_simple: Handle !RESET_CONTROLLER properly
  mmc: mtk-sd: Fix MMC_CAP2_CRYPTO flag setting
  mmc: mtk-sd: Fix error handle of probe function
  mmc: core: Correction a warning caused by incorrect type in assignment for UHS-II
  mmc: sdhci-esdhc-imx: Update esdhc sysctl dtocv bitmask
  mmc: sdhci-esdhc-imx: Implement emmc hardware reset
  mmc: core: Correct type in variable assignment for UHS-II
  mmc: sdhci-uhs2: correction a warning caused by incorrect type in argument
  mmc: sdhci-uhs2: Remove unnecessary variables
  mmc: sdhci-uhs2: Correct incorrect type in argument
  mmc: sdhci: Make MMC_SDHCI_UHS2 config symbol invisible
  mmc: sdhci-uhs2: Remove unnecessary NULL check
  mmc: core: Fix error paths for UHS-II card init and re-init
  mmc: core: Add error handling of sd_uhs2_power_up()
  mmc: core: Simplify sd_uhs2_power_up()
  mmc: bcm2835: Introduce proper clock handling
  mmc: bcm2835: Fix type of current clock speed
  dt-bindings: mmc: Add sdhci compatible for QCS615
  mmc: core: Use GFP_NOIO in ACMD22
  dt-bindings: mmc: sdhci-msm: Add SAR2130P compatible
  ...
2024-11-20 12:51:32 -08:00
Stefan Wahren
3f31337cf2 mmc: pwrseq_simple: Handle !RESET_CONTROLLER properly
The recent introduction of reset control in pwrseq_simple introduced
a regression for platforms without RESET_CONTROLLER support, because
devm_reset_control_get_optional_shared() would return NULL and make all
resets no-ops. Instead of enforcing this dependency, rely on this behavior
to determine reset support. As a benefit we can get the rid of the
use_reset flag.

Fixes: 73bf4b7381 ("mmc: pwrseq_simple: add support for one reset control")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Message-ID: <20241108130647.8281-1-wahrenst@gmx.net>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-11-12 19:38:47 +01:00
Victor Shih
7f083e4b9b mmc: core: Correction a warning caused by incorrect type in assignment for UHS-II
There is a type issue in the assignment in the sd_uhs2_dev_init()
that will generate a warning when building the kernel.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202411051248.wvjHSFNj-lkp@intel.com/
Signed-off-by: Ben Chuang <ben.chuang@genesyslogic.com.tw>
Signed-off-by: Victor Shih <victor.shih@genesyslogic.com.tw>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Message-ID: <20241105102901.351429-1-victorshihgli@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-11-12 17:49:00 +01:00
Victor Shih
53857ced9f mmc: core: Correct type in variable assignment for UHS-II
There is a type issue in assignment in the sd_uhs2_dev_init(),
sd_uhs2_enum() and sd_uhs2_config_write() that will generate
a warning when building the kernel. Let's fix it.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202410260423.15jvE6qc-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202410261827.7h8YK8u2-lkp@intel.com/
Suggested-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ben Chuang <ben.chuang@genesyslogic.com.tw>
Signed-off-by: Victor Shih <victor.shih@genesyslogic.com.tw>
Message-ID: <20241101104416.4954-2-victorshihgli@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-11-04 12:11:37 +01:00
Ulf Hansson
88df25ad0c mmc: core: Fix error paths for UHS-II card init and re-init
The error path didn't manage the removal of the allocated mmc_card
correctly. Let's fix this to avoid potential memory leaks.

While at it, move the assignment of host->card to slightly later in the
init process and drop also a somewhat silly dev_warn() when CMD8 fails.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
Message-ID: <20241029131752.226764-4-ulf.hansson@linaro.org>
2024-10-30 12:02:15 +01:00
Ulf Hansson
7acbd2da48 mmc: core: Add error handling of sd_uhs2_power_up()
In sd_uhs2_reinit() the call to sd_uhs2_power_up() lacks error handling, so
let's add it.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
Message-ID: <20241029131752.226764-3-ulf.hansson@linaro.org>
2024-10-30 12:02:11 +01:00