linux/drivers/mmc/core
Andrea Merello 002ee28e8b mmc: core: make pwrseq_emmc (partially) support sleepy GPIO controllers
pwrseq_emmc.c implements a HW reset procedure for eMMC chip by driving a
GPIO line.

It registers the .reset() cb on mmc_pwrseq_ops and it registers a system
restart notification handler; both of them perform reset by unconditionally
calling gpiod_set_value().

If the eMMC reset line is tied to a GPIO controller whose driver can sleep
(i.e. I2C GPIO controller), then the kernel would spit warnings when trying
to reset the eMMC chip by means of .reset() mmc_pwrseq_ops cb (that is
exactly what I'm seeing during boot).

Furthermore, on system reset we would gets to the system restart
notification handler with disabled interrupts - local_irq_disable() is
called in machine_restart() at least on ARM/ARM64 - and we would be in
trouble when the GPIO driver tries to sleep (which indeed doesn't happen
here, likely because in my case the machine specific code doesn't call
do_kernel_restart(), I guess..).

This patch fixes the .reset() cb to make use of gpiod_set_value_cansleep(),
so that the eMMC gets reset on boot without complaints, while, since there
isn't that much we can do, we avoid register the restart handler if the
GPIO controller has a sleepy driver (and we spit a dev_notice() message to
let people know)..

This had been tested on a downstream 4.9 kernel with backported
commit 83f37ee7ba33 ("mmc: pwrseq: Add reset callback to the struct
mmc_pwrseq_ops") and commit ae60fb031cf2 ("mmc: core: Don't do eMMC HW
reset when resuming the eMMC card"), because I couldn't boot my board
otherwise. Maybe worth to RFT.

Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2019-04-15 11:55:54 +02:00
..
block.c Merge branch 'fixes' into next 2019-02-28 09:16:18 +01:00
block.h
bus.c
bus.h
card.h
core.c mmc:fix a bug when max_discard is 0 2019-03-01 09:50:10 +01:00
core.h mmc: core: Move regulator helpers to separate file 2019-02-25 15:20:58 +01:00
debugfs.c
host.c mmc: core: Move mmc_of_parse_voltage() to host.c 2019-02-25 15:20:58 +01:00
host.h
Kconfig
Makefile mmc: core: Move regulator helpers to separate file 2019-02-25 15:20:58 +01:00
mmc_ops.c mmc: core: do not retry CMD6 in __mmc_switch() 2019-02-28 09:16:12 +01:00
mmc_ops.h
mmc_test.c
mmc.c mmc: core: Add a debug print when the card may have been replaced 2019-02-28 09:28:27 +01:00
pwrseq_emmc.c mmc: core: make pwrseq_emmc (partially) support sleepy GPIO controllers 2019-04-15 11:55:54 +02:00
pwrseq_sd8787.c
pwrseq_simple.c
pwrseq.c
pwrseq.h
queue.c for-5.1/block-20190302 2019-03-08 14:12:17 -08:00
queue.h
quirks.h
regulator.c mmc: core: Convert mmc_regulator_get_ocrmask() to static 2019-02-25 15:20:58 +01:00
sd_ops.c mmc: core: Drop retries as in-parameter to mmc_wait_for_app_cmd() 2019-02-25 15:20:58 +01:00
sd_ops.h mmc: core: Convert mmc_wait_for_app_cmd() to static 2019-02-25 15:20:58 +01:00
sd.c mmc: core: Add a debug print when the card may have been replaced 2019-02-28 09:28:27 +01:00
sd.h
sdio_bus.c mmc:sdio: Remove unneeded variable ret 2019-02-25 08:40:58 +01:00
sdio_bus.h
sdio_cis.c
sdio_cis.h
sdio_io.c mmc: core: Convert mmc_align_data_size() into an SDIO specific function 2019-02-25 17:20:21 +01:00
sdio_irq.c
sdio_ops.c
sdio_ops.h mmc: core: Convert mmc_align_data_size() into an SDIO specific function 2019-02-25 17:20:21 +01:00
sdio_uart.c
sdio.c mmc: core: Add a debug print when the card may have been replaced 2019-02-28 09:28:27 +01:00
slot-gpio.c mmc: slot-gpio: Remove override_active_level on WP 2019-02-25 08:40:58 +01:00
slot-gpio.h