ARM: OMAP2+: omap_device: fix idling of devices during probe
authorAndreas Kemnade <andreas@kemnade.info>
Fri, 4 Dec 2020 09:55:39 +0000 (10:55 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 Jan 2021 12:58:59 +0000 (13:58 +0100)
commit ec76c2eea903947202098090bbe07a739b5246e9 upstream.

On the GTA04A5 od->_driver_status was not set to BUS_NOTIFY_BIND_DRIVER
during probe of the second mmc used for wifi. Therefore
omap_device_late_idle idled the device during probing causing oopses when
accessing the registers.

It was not set because od->_state was set to OMAP_DEVICE_STATE_IDLE
in the notifier callback. Therefore set od->_driver_status also in that
case.

This came apparent after commit 21b2cec61c04 ("mmc: Set
PROBE_PREFER_ASYNCHRONOUS for drivers that existed in v4.4") causing this
oops:

omap_hsmmc 480b4000.mmc: omap_device_late_idle: enabled but no driver.  Idling
8<--- cut here ---
Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0b402c
...
(omap_hsmmc_set_bus_width) from [<c07996bc>] (omap_hsmmc_set_ios+0x11c/0x258)
(omap_hsmmc_set_ios) from [<c077b2b0>] (mmc_power_up.part.8+0x3c/0xd0)
(mmc_power_up.part.8) from [<c077c14c>] (mmc_start_host+0x88/0x9c)
(mmc_start_host) from [<c077d284>] (mmc_add_host+0x58/0x84)
(mmc_add_host) from [<c0799190>] (omap_hsmmc_probe+0x5fc/0x8c0)
(omap_hsmmc_probe) from [<c0666728>] (platform_drv_probe+0x48/0x98)
(platform_drv_probe) from [<c066457c>] (really_probe+0x1dc/0x3b4)

Fixes: 04abaf07f6d5 ("ARM: OMAP2+: omap_device: Sync omap_device and pm_runtime after probe defer")
Fixes: 21b2cec61c04 ("mmc: Set PROBE_PREFER_ASYNCHRONOUS for drivers that existed in v4.4")
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
[tony@atomide.com: left out extra parens, trimmed description stack trace]
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm/mach-omap2/omap_device.c

index acbede082b5b54f29a36e2cfd08f9bd23d1d7246..79a59fe0e773bdc6d5efc079dc69205c79dd1ff8 100644 (file)
@@ -224,10 +224,12 @@ static int _omap_device_notifier_call(struct notifier_block *nb,
                break;
        case BUS_NOTIFY_BIND_DRIVER:
                od = to_omap_device(pdev);
-               if (od && (od->_state == OMAP_DEVICE_STATE_ENABLED) &&
-                   pm_runtime_status_suspended(dev)) {
+               if (od) {
                        od->_driver_status = BUS_NOTIFY_BIND_DRIVER;
-                       pm_runtime_set_active(dev);
+                       if (od->_state == OMAP_DEVICE_STATE_ENABLED &&
+                           pm_runtime_status_suspended(dev)) {
+                               pm_runtime_set_active(dev);
+                       }
                }
                break;
        case BUS_NOTIFY_ADD_DEVICE: