<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/mmc/core/sdio.c, branch linux-5.9.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.9.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.9.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2020-07-13T10:18:24Z</updated>
<entry>
<title>mmc: sdio: fix clock rate setting for SDR12/SDR25 mode</title>
<updated>2020-07-13T10:18:24Z</updated>
<author>
<name>Haibo Chen</name>
</author>
<published>2020-06-22T08:19:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e81515556d76cc00272bded98ec8d1def6eb9e2c'/>
<id>urn:sha1:e81515556d76cc00272bded98ec8d1def6eb9e2c</id>
<content type='text'>
In current code logic, when work in SDR12/SDR25 mode, the final clock
rate is incorrect, just the legancy 400KHz, because the
card-&gt;sw_caps.sd3_bus_mode do not has the flag SD_MODE_UHS_SDR12 or
SD_MODE_UHS_SDR25. Besides, SDIO_SPEED_SDR12 is actually value 0, and
every mode need to config the timing and clock rate, so remove the
‘if’ operator.

Signed-off-by: Haibo Chen &lt;haibo.chen@nxp.com&gt;
Tested-by: Pali Rohár &lt;pali@kernel.org&gt;
Link: https://lore.kernel.org/r/1592813959-5914-1-git-send-email-haibo.chen@nxp.com
Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
</content>
</entry>
<entry>
<title>mmc: sdio: Fix 1-bit mode for SD-combo cards during suspend</title>
<updated>2020-07-13T10:18:23Z</updated>
<author>
<name>Yue Hu</name>
</author>
<published>2020-06-09T08:14:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=40e6c479e9250808ff19ccfb6d48979ecb2377bd'/>
<id>urn:sha1:40e6c479e9250808ff19ccfb6d48979ecb2377bd</id>
<content type='text'>
Commit 6b5eda369ac3 ("sdio: put active devices into 1-bit mode during
suspend") disabled 4-bit mode during system suspend. After this patch,
commit 7310ece86ad7 ("mmc: implement SD-combo (IO+mem) support") used
new sdio_enable_4bit_bus() instead of sdio_enable_wide() to support
SD-combo cards, also for card resume. However, no corresponding support
added during suspend. That is not correct. Let's fix it.

Signed-off-by: Yue Hu &lt;huyue2@yulong.com&gt;
Link: https://lore.kernel.org/r/20200609081431.6376-1-zbestahu@gmail.com
Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
</content>
</entry>
<entry>
<title>mmc: sdio: Enable SDIO 4-bit bus if not support SD_SCR_BUS_WIDTH_4 for SD combo card</title>
<updated>2020-07-13T10:18:23Z</updated>
<author>
<name>Yue Hu</name>
</author>
<published>2020-06-08T10:30:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ec97863cac3e36e877cc326b12568a237865ee69'/>
<id>urn:sha1:ec97863cac3e36e877cc326b12568a237865ee69</id>
<content type='text'>
If the card type is SD combo(MMC_TYPE_SD_COMBO) and the memory part does
not support wider bus(SD_SCR_BUS_WIDTH_4), nothing will be done except
return 0. However, we should check whether IO part support wider bus or
not. We should use available IO ability if supported.

In addition, there's a duplicated check to MMC_CAP_4_BIT_DATA since
sdio_enable_wide() will include that check. And we can also save one
call site to sdio_enable_wide() after this change.

Signed-off-by: Yue Hu &lt;huyue2@yulong.com&gt;
Link: https://lore.kernel.org/r/20200608103009.5000-1-zbestahu@gmail.com
Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
</content>
</entry>
<entry>
<title>mmc: core: Export device/vendor ids from Common CIS for SDIO cards</title>
<updated>2020-05-29T10:38:00Z</updated>
<author>
<name>Pali Rohár</name>
</author>
<published>2020-05-27T11:08:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=254e175448b7dc2f40e41d8941ac925f07c5862b'/>
<id>urn:sha1:254e175448b7dc2f40e41d8941ac925f07c5862b</id>
<content type='text'>
Device/vendor ids from Common CIS (Card Information Structure) may be
different as device/vendor ids from CIS on particular SDIO function.

Kernel currently exports only device/vendor ids from SDIO functions and not
"main" device/vendor ids from Common CIS.

This patch exports "main" device/vendor ids for SDIO and SD combo cards at
top level mmc device in sysfs hierarchy.

Userspace can use e.g. udev rules to correctly match whole SDIO card based
on Common CIS device/vendor id and not only one particular SDIO function.
Having this information in userspace also helps developers to debug whole
SDIO card as e.g. kernel mmc quirks use device/vendor ids from Common CIS
and not from particular SDIO function. Also it allows to write userspace
applications which list all connected SDIO cards based on CIS ids.

Signed-off-by: Pali Rohár &lt;pali@kernel.org&gt;
Reviewed-by: Marek Behún &lt;marek.behun@nic.cz&gt;
Link: https://lore.kernel.org/r/20200527110858.17504-2-pali@kernel.org
Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
</content>
</entry>
<entry>
<title>mmc: sdio: Align the initialization commands in retry path for UHS-I</title>
<updated>2020-05-28T09:21:03Z</updated>
<author>
<name>Ulf Hansson</name>
</author>
<published>2020-04-30T09:16:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1dc5a61559e73472cd84bc8aa5b297ec0deba4de'/>
<id>urn:sha1:1dc5a61559e73472cd84bc8aa5b297ec0deba4de</id>
<content type='text'>
According to the comment in mmc_sdio_reinit_card(), some SDIO cards may
require a "[CMD5,5,3,7] init sequence", which isn't always obeyed in
mmc_sdio_init_card(). Especially, when we end up retrying the UHS-I
specific initialization, there is a missing CMD5.

Let's update the code to make the behaviour consistent and let's also take
the opportunity to clean up the code a bit, to avoid open coding.

Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Link: https://lore.kernel.org/r/20200430091640.455-5-ulf.hansson@linaro.org
</content>
</entry>
<entry>
<title>mmc: sdio: Re-use negotiated OCR mask when re-sending CMD8</title>
<updated>2020-05-28T09:21:03Z</updated>
<author>
<name>Ulf Hansson</name>
</author>
<published>2020-04-30T09:16:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fa1e3191922bb6b59a64a1a03e461cde07ae1e62'/>
<id>urn:sha1:fa1e3191922bb6b59a64a1a03e461cde07ae1e62</id>
<content type='text'>
While initializing an SDIO card in mmc_sdio_init_card(), we may need to
retry the UHS-I specific initialization, in case the first attempt fails.

This leads to resending a CMD8, but also to restart from scratch with the
so called OCR mask negotiations. This is unnecessary as we already have a
negotiated OCR mask, so let's use that instead. In this way, the behaviour
also becomes more consistent with other similar paths.

Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Link: https://lore.kernel.org/r/20200430091640.455-4-ulf.hansson@linaro.org
</content>
</entry>
<entry>
<title>mmc: sdio: Fix several potential memory leaks in mmc_sdio_init_card()</title>
<updated>2020-05-28T09:21:03Z</updated>
<author>
<name>Ulf Hansson</name>
</author>
<published>2020-04-30T09:16:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a94a59f43749b4f8cd81b8be87c95f9ef898d19d'/>
<id>urn:sha1:a94a59f43749b4f8cd81b8be87c95f9ef898d19d</id>
<content type='text'>
Over the years, the code in mmc_sdio_init_card() has grown to become quite
messy. Unfortunate this has also lead to that several paths are leaking
memory in form of an allocated struct mmc_card, which includes additional
data, such as initialized struct device for example.

Unfortunate, it's a too complex task find each offending commit. Therefore,
this change fixes all memory leaks at once.

Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Link: https://lore.kernel.org/r/20200430091640.455-3-ulf.hansson@linaro.org
</content>
</entry>
<entry>
<title>mmc: sdio: Fix potential NULL pointer error in mmc_sdio_init_card()</title>
<updated>2020-05-28T09:21:02Z</updated>
<author>
<name>Ulf Hansson</name>
</author>
<published>2020-04-30T09:16:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f04086c225da11ad16d7f9a2fbca6483ab16dded'/>
<id>urn:sha1:f04086c225da11ad16d7f9a2fbca6483ab16dded</id>
<content type='text'>
During some scenarios mmc_sdio_init_card() runs a retry path for the UHS-I
specific initialization, which leads to removal of the previously allocated
card. A new card is then re-allocated while retrying.

However, in one of the corresponding error paths we may end up to remove an
already removed card, which likely leads to a NULL pointer exception. So,
let's fix this.

Fixes: 5fc3d80ef496 ("mmc: sdio: don't use rocr to check if the card could support UHS mode")
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Link: https://lore.kernel.org/r/20200430091640.455-2-ulf.hansson@linaro.org
</content>
</entry>
<entry>
<title>mmc: core: Re-work HW reset for SDIO cards</title>
<updated>2019-11-14T15:28:56Z</updated>
<author>
<name>Ulf Hansson</name>
</author>
<published>2019-10-17T13:25:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2ac55d5e5ec9ad0a07e194f0eaca865fe5aa3c40'/>
<id>urn:sha1:2ac55d5e5ec9ad0a07e194f0eaca865fe5aa3c40</id>
<content type='text'>
It have turned out that it's not a good idea to unconditionally do a power
cycle and then to re-initialize the SDIO card, as currently done through
mmc_hw_reset() -&gt; mmc_sdio_hw_reset(). This because there may be multiple
SDIO func drivers probed, who also shares the same SDIO card.

To address these scenarios, one may be tempted to use a notification
mechanism, as to allow the core to inform each of the probed func drivers,
about an ongoing HW reset. However, supporting such an operation from the
func driver point of view, may not be entirely trivial.

Therefore, let's use a more simplistic approach to solve the problem, by
instead forcing the card to be removed and re-detected, via scheduling a
rescan-work. In this way, we can rely on existing infrastructure, as the
func driver's -&gt;remove() and -&gt;probe() callbacks, becomes invoked to deal
with the cleanup and the re-initialization.

This solution may be considered as rather heavy, especially if a func
driver doesn't share its card with other func drivers. To address this,
let's keep the current immediate HW reset option as well, but run it only
when there is one func driver probed for the card.

Finally, to allow the caller of mmc_hw_reset(), to understand if the reset
is being asynchronously managed from a scheduled work, it returns 1
(propagated from mmc_sdio_hw_reset()). If the HW reset is executed
successfully and synchronously it returns 0, which maintains the existing
behaviour.

Reviewed-by: Douglas Anderson &lt;dianders@chromium.org&gt;
Tested-by: Douglas Anderson &lt;dianders@chromium.org&gt;
Cc: stable@vger.kernel.org # v5.4+
Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
</content>
</entry>
<entry>
<title>mmc: core: Fixup processing of SDIO IRQs during system suspend/resume</title>
<updated>2019-09-11T14:10:19Z</updated>
<author>
<name>Ulf Hansson</name>
</author>
<published>2019-09-08T10:12:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=51133850bce2a9e5060c6931ee58ceb685578dbf'/>
<id>urn:sha1:51133850bce2a9e5060c6931ee58ceb685578dbf</id>
<content type='text'>
System suspend/resume of SDIO cards, with SDIO IRQs enabled and when using
MMC_CAP2_SDIO_IRQ_NOTHREAD is unfortunate still suffering from a fragile
behaviour. Some problems have been taken care of so far, but more issues
remains.

For example, calling the -&gt;ack_sdio_irq() callback to let host drivers
re-enable the SDIO IRQs is a bad idea, unless the IRQ have been consumed,
which may not be the case during system suspend/resume. This may lead to
that a host driver re-signals the same SDIO IRQ over and over again,
causing a storm of IRQs and gives a ping-pong effect towards the
sdio_irq_work().

Moreover, calling the -&gt;enable_sdio_irq() callback at system resume to
re-enable already enabled SDIO IRQs for the host, causes the runtime PM
count for some host drivers to become in-balanced. This then leads to the
host to remain runtime resumed, no matter if it's needed or not.

To fix these problems, let's check if process_sdio_pending_irqs() actually
consumed the SDIO IRQ, before we continue to ack the IRQ by invoking the
-&gt;ack_sdio_irq() callback.

Additionally, there should be no need to re-enable SDIO IRQs as the host
driver already knows if they were enabled at system suspend, thus also
whether it needs to re-enable them at system resume. For this reason, drop
the call to -&gt;enable_sdio_irq() during system resume.

In regards to these changes there is yet another issue, which is when there
is an SDIO IRQ being signaled by the host driver, but after the SDIO card
has been system suspended. Currently these IRQs are just thrown away, while
we should at least make sure to try to consume them when the SDIO card has
been system resumed. Fix this by queueing a sdio_irq_work() after we system
resumed the SDIO card.

Tested-by: Matthias Kaehlcke &lt;mka@chromium.org&gt;
Reviewed-by: Matthias Kaehlcke &lt;mka@chromium.org&gt;
Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Reviewed-by: Douglas Anderson &lt;dianders@chromium.org&gt;
Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
</content>
</entry>
</feed>
