diff mbox series

mmc patches for v5.4.y, v5.5.y

Message ID 20200218171857.GA25822@roeck-us.net
State New
Headers show
Series mmc patches for v5.4.y, v5.5.y | expand

Commit Message

Guenter Roeck Feb. 18, 2020, 5:18 p.m. UTC
Hi Greg,

please apply the following two patches to v5.4.y and v5.5.y to fix a
problem when trying to boot various pxa machines from MMC.

d3a5bcb4a17f gpio: add gpiod_toggle_active_low()
9073d10b0989 mmc: core: Rework wp-gpio handling

The second patch fixes the problem, the first patch is necessary for the
second patch to compile.

Background: Commit 9073d10b0989 claims "No functional changes intended".
However, it does include the following functional code change.

effect of making the the card read-only, thus preventing the system
from booting if it was mounted (and expected to be mounted) read-write.
This is seen when trying to boot "spitz" and similar qemu machines from
mmc.

I bisected the problem to commit c914a27c92f91 ("mmc: pxamci: Support
getting GPIO descs for RO and WP), affecting v5.0 and later kernels.

Thanks,
Guenter
diff mbox series

Patch

--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -740,16 +740,16 @@  static int pxamci_probe(struct platform_device *pdev)
                        goto out;
                }

+               if (!host->pdata->gpio_card_ro_invert)
+                       mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH;
+
                ret = mmc_gpiod_request_ro(mmc, "wp", 0, 0, NULL);
                if (ret && ret != -ENOENT) {
                        dev_err(dev, "Failed requesting gpio_ro\n");
                        goto out;
                }
-               if (!ret) {
+               if (!ret)
                        host->use_ro_gpio = true;
-                       mmc->caps2 |= host->pdata->gpio_card_ro_invert ?
-                               0 : MMC_CAP2_RO_ACTIVE_HIGH;
-               }

This _is_ a functional change: Previously, if there was no "ro" gpio
pin, caps2 was never updated to active-high. This can have the practical