<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/mmc, branch master</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>mmc: sdhci-of-aspeed: Remove children before releasing SDC resources</title>
<updated>2026-09-14T10:04:29+00:00</updated>
<author>
<name>Myeonghun Pak</name>
<email>mhun512@gmail.com</email>
</author>
<published>2026-09-13T22:35:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=4396d70bb7fec531bcf934fed016b2f3300c670b'/>
<id>4396d70bb7fec531bcf934fed016b2f3300c670b</id>
<content type='text'>
Probe failure and removal leave SDHCI child devices registered after the
parent clock and managed resources are released.

Unregister the OF children in reverse order before disabling the parent
clock on both paths. Use of_platform_device_destroy() because manual
child creation does not set the flag required by of_platform_depopulate().

This issue was identified during our ongoing static-analysis research
while reviewing kernel code.

Fixes: bb7b8ec62dfb ("mmc: sdhci-of-aspeed: Add support for the ASPEED SD controller")
Co-developed-by: Ijae Kim &lt;ae878000@gmail.com&gt;
Signed-off-by: Ijae Kim &lt;ae878000@gmail.com&gt;
Signed-off-by: Myeonghun Pak &lt;mhun512@gmail.com&gt;
Assisted-by: OpenAI:GPT-5.6
Cc: stable@vger.kernel.org
Signed-off-by: Ulf Hansson &lt;ulfh@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Probe failure and removal leave SDHCI child devices registered after the
parent clock and managed resources are released.

Unregister the OF children in reverse order before disabling the parent
clock on both paths. Use of_platform_device_destroy() because manual
child creation does not set the flag required by of_platform_depopulate().

This issue was identified during our ongoing static-analysis research
while reviewing kernel code.

Fixes: bb7b8ec62dfb ("mmc: sdhci-of-aspeed: Add support for the ASPEED SD controller")
Co-developed-by: Ijae Kim &lt;ae878000@gmail.com&gt;
Signed-off-by: Ijae Kim &lt;ae878000@gmail.com&gt;
Signed-off-by: Myeonghun Pak &lt;mhun512@gmail.com&gt;
Assisted-by: OpenAI:GPT-5.6
Cc: stable@vger.kernel.org
Signed-off-by: Ulf Hansson &lt;ulfh@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mmc: sh_mmcif: initialize IRQ-thread mutex before requesting interrupt</title>
<updated>2026-09-11T15:12:01+00:00</updated>
<author>
<name>Runyu Xiao</name>
<email>runyu.xiao@seu.edu.cn</email>
</author>
<published>2026-09-02T14:09:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d5ea0d226e8f0801d78702142a124d78c317d822'/>
<id>d5ea0d226e8f0801d78702142a124d78c317d822</id>
<content type='text'>
The threaded IRQ handler can run before devm_request_threaded_irq()
returns, but thread_lock was initialized afterwards. Initialize it before
requesting either interrupt.

Fixes: 8047310ee984 ("mmc: sh_mmcif: fix a race, causing an Oops on SMP")
Cc: stable@vger.kernel.org
Assisted-by: Codex:GPT-5
Signed-off-by: Runyu Xiao &lt;runyu.xiao@seu.edu.cn&gt;
Signed-off-by: Ulf Hansson &lt;ulfh@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The threaded IRQ handler can run before devm_request_threaded_irq()
returns, but thread_lock was initialized afterwards. Initialize it before
requesting either interrupt.

Fixes: 8047310ee984 ("mmc: sh_mmcif: fix a race, causing an Oops on SMP")
Cc: stable@vger.kernel.org
Assisted-by: Codex:GPT-5
Signed-off-by: Runyu Xiao &lt;runyu.xiao@seu.edu.cn&gt;
Signed-off-by: Ulf Hansson &lt;ulfh@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mmc: core: Fix OF node reference leak on card add failure</title>
<updated>2026-09-10T12:20:54+00:00</updated>
<author>
<name>Zhu Ling</name>
<email>zhuling0805@qq.com</email>
</author>
<published>2026-09-04T09:07:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=08b54e16d547d5c1aa61bf7a3595bb1620975eeb'/>
<id>08b54e16d547d5c1aa61bf7a3595bb1620975eeb</id>
<content type='text'>
mmc_of_find_child_device() returns a device node with its reference count
incremented. mmc_add_card() stores the reference before calling
device_add(), while the card is marked present only after device_add()
succeeds.

If device_add() fails, the callers release the card through
mmc_remove_card(). However, mmc_remove_card() only drops the OF node
reference for a present card, leaking the reference on this error path.

Move of_node_put() outside the present-card conditional so the reference
is released for both registered cards and card-add failures.

Fixes: 25185f3f31c9 ("mmc: Add SDIO function devicetree subnode parsing")
Cc: stable@vger.kernel.org
Signed-off-by: Zhu Ling &lt;zhuling0805@qq.com&gt;
Reviewed-by: Shawn Lin &lt;shawn.lin@linux.dev&gt;
Signed-off-by: Ulf Hansson &lt;ulfh@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
mmc_of_find_child_device() returns a device node with its reference count
incremented. mmc_add_card() stores the reference before calling
device_add(), while the card is marked present only after device_add()
succeeds.

If device_add() fails, the callers release the card through
mmc_remove_card(). However, mmc_remove_card() only drops the OF node
reference for a present card, leaking the reference on this error path.

Move of_node_put() outside the present-card conditional so the reference
is released for both registered cards and card-add failures.

Fixes: 25185f3f31c9 ("mmc: Add SDIO function devicetree subnode parsing")
Cc: stable@vger.kernel.org
Signed-off-by: Zhu Ling &lt;zhuling0805@qq.com&gt;
Reviewed-by: Shawn Lin &lt;shawn.lin@linux.dev&gt;
Signed-off-by: Ulf Hansson &lt;ulfh@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mmc: rtsx_pci_sdmmc: ignore broken write-protect on ThinkPad X260</title>
<updated>2026-09-10T11:33:39+00:00</updated>
<author>
<name>Florian Maillard</name>
<email>florian.maillard@mailoo.org</email>
</author>
<published>2026-08-24T06:57:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9c182bc5d7817437a7d04ab96133f9191846d93d'/>
<id>9c182bc5d7817437a7d04ab96133f9191846d93d</id>
<content type='text'>
The Realtek RTS522A card reader in the Lenovo ThinkPad X260
(subsystem 17aa:504a) incorrectly reports inserted SD cards as
write-protected.

This causes the MMC core to expose the card as read-only:

  mmcblk0: mmc0:aaaa SN256 238 GiB (ro)

and /sys/block/mmcblk0/ro reports 1.

Setting MMC_CAP2_NO_WRITE_PROTECT makes the card writable again.
Limit the quirk to the affected Lenovo subsystem.

Assisted-by: ChatGPT:GPT-5.6 Sol
Signed-off-by: Florian Maillard &lt;florian.maillard@mailoo.org&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Ulf Hansson &lt;ulfh@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The Realtek RTS522A card reader in the Lenovo ThinkPad X260
(subsystem 17aa:504a) incorrectly reports inserted SD cards as
write-protected.

This causes the MMC core to expose the card as read-only:

  mmcblk0: mmc0:aaaa SN256 238 GiB (ro)

and /sys/block/mmcblk0/ro reports 1.

Setting MMC_CAP2_NO_WRITE_PROTECT makes the card writable again.
Limit the quirk to the affected Lenovo subsystem.

Assisted-by: ChatGPT:GPT-5.6 Sol
Signed-off-by: Florian Maillard &lt;florian.maillard@mailoo.org&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Ulf Hansson &lt;ulfh@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mmc: sdio_uart: fix xmit_fifo leak when the port table is full</title>
<updated>2026-09-09T11:27:04+00:00</updated>
<author>
<name>Felix Gu</name>
<email>ustc.gu@gmail.com</email>
</author>
<published>2026-08-21T18:58:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=53823e25793a97d07e6e98e0904bbf74cac8bc76'/>
<id>53823e25793a97d07e6e98e0904bbf74cac8bc76</id>
<content type='text'>
sdio_uart_add_port() allocates the transmit fifo before claiming a
slot in sdio_uart_table[].  When all UART_NR slots are taken, it
returns -EBUSY with the fifo still allocated, but the probe error
path only kfree()s the port, leaking the transmit fifo.

Free the fifo in the failure path of sdio_uart_add_port() itself so
the function retains nothing on error.

Fixes: 8b197a5ce7a7 ("sdio_uart: Use kfifo instead of the messy circ stuff")
Signed-off-by: Felix Gu &lt;ustc.gu@gmail.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Ulf Hansson &lt;ulfh@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
sdio_uart_add_port() allocates the transmit fifo before claiming a
slot in sdio_uart_table[].  When all UART_NR slots are taken, it
returns -EBUSY with the fifo still allocated, but the probe error
path only kfree()s the port, leaking the transmit fifo.

Free the fifo in the failure path of sdio_uart_add_port() itself so
the function retains nothing on error.

Fixes: 8b197a5ce7a7 ("sdio_uart: Use kfifo instead of the messy circ stuff")
Signed-off-by: Felix Gu &lt;ustc.gu@gmail.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Ulf Hansson &lt;ulfh@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mmc: spi: reset bytes_xfered before retrying CRC failures</title>
<updated>2026-09-08T15:59:42+00:00</updated>
<author>
<name>Xu Rao</name>
<email>raoxu@uniontech.com</email>
</author>
<published>2026-08-18T11:31:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8b0cc8707f65e0f51912e764e1b309b2559db1ec'/>
<id>8b0cc8707f65e0f51912e764e1b309b2559db1ec</id>
<content type='text'>
mmc_spi_data_do() updates data-&gt;bytes_xfered after each block has been
transferred successfully.  If a later block in the same data request
fails with a CRC error, data-&gt;bytes_xfered may therefore contain the
number of bytes completed before the failing block.

mmc_spi_request() has a private recovery path for such CRC failures.  It
sends STOP_TRANSMISSION, clears data-&gt;error and jumps back to
crc_recover to issue the same command and data request again.  However,
it does not clear data-&gt;bytes_xfered before the retry.

If the retry succeeds, the request is completed with the bytes from the
failed attempt still included in data-&gt;bytes_xfered.  For a multi-block
request this can make the completed request report more bytes than were
transferred by the successful retry, and can even exceed the request size
when most blocks completed before the CRC error.

This is most likely to be observed on MMC-over-SPI systems where long
multi-block transfers occasionally hit a data CRC error but the
mmc_spi-internal retry succeeds.  The data itself is retried, but the
completion accounting is not.

Clear data-&gt;bytes_xfered together with data-&gt;error before repeating the
request so the final completion reports only the bytes transferred by the
successful attempt.

Fixes: 061c6c847eeb ("mmc_spi: Recover from CRC errors for r/w operation over SPI.")
Cc: stable@vger.kernel.org
Signed-off-by: Xu Rao &lt;raoxu@uniontech.com&gt;
Signed-off-by: Ulf Hansson &lt;ulfh@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
mmc_spi_data_do() updates data-&gt;bytes_xfered after each block has been
transferred successfully.  If a later block in the same data request
fails with a CRC error, data-&gt;bytes_xfered may therefore contain the
number of bytes completed before the failing block.

mmc_spi_request() has a private recovery path for such CRC failures.  It
sends STOP_TRANSMISSION, clears data-&gt;error and jumps back to
crc_recover to issue the same command and data request again.  However,
it does not clear data-&gt;bytes_xfered before the retry.

If the retry succeeds, the request is completed with the bytes from the
failed attempt still included in data-&gt;bytes_xfered.  For a multi-block
request this can make the completed request report more bytes than were
transferred by the successful retry, and can even exceed the request size
when most blocks completed before the CRC error.

This is most likely to be observed on MMC-over-SPI systems where long
multi-block transfers occasionally hit a data CRC error but the
mmc_spi-internal retry succeeds.  The data itself is retried, but the
completion accounting is not.

Clear data-&gt;bytes_xfered together with data-&gt;error before repeating the
request so the final completion reports only the bytes transferred by the
successful attempt.

Fixes: 061c6c847eeb ("mmc_spi: Recover from CRC errors for r/w operation over SPI.")
Cc: stable@vger.kernel.org
Signed-off-by: Xu Rao &lt;raoxu@uniontech.com&gt;
Signed-off-by: Ulf Hansson &lt;ulfh@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mmc: sdhci_am654: Fallback to DT-provided itap delay on DDR50 tuning failure</title>
<updated>2026-09-04T09:07:27+00:00</updated>
<author>
<name>Diogo Ivo (Schneider Electric)</name>
<email>diogo.ivo@bootlin.com</email>
</author>
<published>2026-08-07T11:07:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=308d05225281d86150d88141990d6caf8c902349'/>
<id>308d05225281d86150d88141990d6caf8c902349</id>
<content type='text'>
DDR50 mode is not required to support the tuning command CMD19, meaning
that calibration may fail on cards that do not implement it, in which
case a known-good itap delay value should be programmed into the host
controller.

Do this by reading the (already defined) itap delay DT property for DDR50
and, if tuning fails for this mode, fall back to the DT-provided itap delay
value. If the DT does not provide a value for DDR50 fallback then this
simply disables using itapdly.

Fixes: 901d16e46296 ("mmc: sdhci_am654: Add retry tuning")
Cc: stable@vger.kernel.org
Signed-off-by: Diogo Ivo (Schneider Electric) &lt;diogo.ivo@bootlin.com&gt;
Acked-by: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Reviewed-by: Judith Mendez &lt;jm@ti.com&gt;
Signed-off-by: Ulf Hansson &lt;ulfh@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
DDR50 mode is not required to support the tuning command CMD19, meaning
that calibration may fail on cards that do not implement it, in which
case a known-good itap delay value should be programmed into the host
controller.

Do this by reading the (already defined) itap delay DT property for DDR50
and, if tuning fails for this mode, fall back to the DT-provided itap delay
value. If the DT does not provide a value for DDR50 fallback then this
simply disables using itapdly.

Fixes: 901d16e46296 ("mmc: sdhci_am654: Add retry tuning")
Cc: stable@vger.kernel.org
Signed-off-by: Diogo Ivo (Schneider Electric) &lt;diogo.ivo@bootlin.com&gt;
Acked-by: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Reviewed-by: Judith Mendez &lt;jm@ti.com&gt;
Signed-off-by: Ulf Hansson &lt;ulfh@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mmc: sdhci_am654: Clear ITAPDLY on tuning failure</title>
<updated>2026-09-04T09:07:27+00:00</updated>
<author>
<name>Diogo Ivo (Schneider Electric)</name>
<email>diogo.ivo@bootlin.com</email>
</author>
<published>2026-08-07T11:06:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=c9f47cc8c37f7659897142ffe216c250fbc1d4ed'/>
<id>c9f47cc8c37f7659897142ffe216c250fbc1d4ed</id>
<content type='text'>
When tuning fails, stale ITAPDLY values can persist and interfere with
subsequent I/O accesses, for example in DDR50 mode in cards with no tuning
support. Move the ITAPDLY enable setting out of the tuning loop to after
successful tuning, and explicitly clear ITAPDLY (delay and enable) when
tuning fails so that we are sure only working values are actually left in
hardware.

Fixes: 901d16e46296 ("mmc: sdhci_am654: Add retry tuning")
Cc: stable@vger.kernel.org
Signed-off-by: Diogo Ivo (Schneider Electric) &lt;diogo.ivo@bootlin.com&gt;
Reviewed-by: Judith Mendez &lt;jm@ti.com&gt;
Acked-by: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Signed-off-by: Ulf Hansson &lt;ulfh@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When tuning fails, stale ITAPDLY values can persist and interfere with
subsequent I/O accesses, for example in DDR50 mode in cards with no tuning
support. Move the ITAPDLY enable setting out of the tuning loop to after
successful tuning, and explicitly clear ITAPDLY (delay and enable) when
tuning fails so that we are sure only working values are actually left in
hardware.

Fixes: 901d16e46296 ("mmc: sdhci_am654: Add retry tuning")
Cc: stable@vger.kernel.org
Signed-off-by: Diogo Ivo (Schneider Electric) &lt;diogo.ivo@bootlin.com&gt;
Reviewed-by: Judith Mendez &lt;jm@ti.com&gt;
Acked-by: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Signed-off-by: Ulf Hansson &lt;ulfh@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mmc: sdhci_am654: Reset command and data lines on failed tuning</title>
<updated>2026-09-04T09:07:27+00:00</updated>
<author>
<name>Diogo Ivo (Schneider Electric)</name>
<email>diogo.ivo@bootlin.com</email>
</author>
<published>2026-08-07T11:06:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=7197d9107d9545730153b82ea5a411c5208b443f'/>
<id>7197d9107d9545730153b82ea5a411c5208b443f</id>
<content type='text'>
The CMD/DATA reset after tuning should be performed regardless of
whether tuning succeeded or failed, since tuning data may remain in
the buffer in either case. Move the error return after the reset so
that the controller is always cleaned up.

Fixes: de31f6ab68a3 ("mmc: sdhci_am654: Reset Command and Data line after tuning")
Cc: stable@vger.kernel.org
Signed-off-by: Diogo Ivo (Schneider Electric) &lt;diogo.ivo@bootlin.com&gt;
Reviewed-by: Judith Mendez &lt;jm@ti.com&gt;
Acked-by: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Signed-off-by: Ulf Hansson &lt;ulfh@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The CMD/DATA reset after tuning should be performed regardless of
whether tuning succeeded or failed, since tuning data may remain in
the buffer in either case. Move the error return after the reset so
that the controller is always cleaned up.

Fixes: de31f6ab68a3 ("mmc: sdhci_am654: Reset Command and Data line after tuning")
Cc: stable@vger.kernel.org
Signed-off-by: Diogo Ivo (Schneider Electric) &lt;diogo.ivo@bootlin.com&gt;
Reviewed-by: Judith Mendez &lt;jm@ti.com&gt;
Acked-by: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Signed-off-by: Ulf Hansson &lt;ulfh@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mmc: sdhci_am654: Move tuning_loop to local variable</title>
<updated>2026-09-04T09:06:44+00:00</updated>
<author>
<name>Diogo Ivo (Schneider Electric)</name>
<email>diogo.ivo@bootlin.com</email>
</author>
<published>2026-08-07T11:06:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=ff894dced1a7ad7523f9c65dbdb53d02474cca0f'/>
<id>ff894dced1a7ad7523f9c65dbdb53d02474cca0f</id>
<content type='text'>
The tuning_loop field in struct sdhci_am654_data is only used within
sdhci_am654_platform_execute_tuning() as a loop counter that is
initialized to 0 in sdhci_am654_init(). Since it shouldn't persist across
function calls, otherwise every failure expends its "budget", move it to a
local variable and remove the struct field along with the now-unnecessary
initialization.

Signed-off-by: Diogo Ivo (Schneider Electric) &lt;diogo.ivo@bootlin.com&gt;
Reviewed-by: Judith Mendez &lt;jm@ti.com&gt;
Acked-by: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Fixes: de31f6ab68a3 ("mmc: sdhci_am654: Reset Command and Data line after tuning")
Cc: stable@vger.kernel.org
Signed-off-by: Ulf Hansson &lt;ulfh@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The tuning_loop field in struct sdhci_am654_data is only used within
sdhci_am654_platform_execute_tuning() as a loop counter that is
initialized to 0 in sdhci_am654_init(). Since it shouldn't persist across
function calls, otherwise every failure expends its "budget", move it to a
local variable and remove the struct field along with the now-unnecessary
initialization.

Signed-off-by: Diogo Ivo (Schneider Electric) &lt;diogo.ivo@bootlin.com&gt;
Reviewed-by: Judith Mendez &lt;jm@ti.com&gt;
Acked-by: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Fixes: de31f6ab68a3 ("mmc: sdhci_am654: Reset Command and Data line after tuning")
Cc: stable@vger.kernel.org
Signed-off-by: Ulf Hansson &lt;ulfh@kernel.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
