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
..
Kconfig mmc: core: Allow building PWRSEQ_SD8787 with LIBERTAS_SDIO 2018-10-08 11:40:43 +02:00
Makefile mmc: core: Move regulator helpers to separate file 2019-02-25 15:20:58 +01:00
block.c Merge branch 'fixes' into next 2019-02-28 09:16:18 +01:00
block.h mmc: block: Remove code no longer needed after the switch to blk-mq 2017-12-11 13:02:22 +01:00
bus.c mmc: core: Remove code no longer needed after the switch to blk-mq 2017-12-11 13:05:58 +01:00
bus.h mmc: core: Move public functions from card.h to private headers 2017-02-13 13:20:24 +01:00
card.h mmc: core: Cleanup BKOPS support 2018-12-17 09:01:15 +01:00
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 mmc: Export host capabilities to debugfs. 2018-03-22 10:36:27 +01:00
host.c mmc: core: Move mmc_of_parse_voltage() to host.c 2019-02-25 15:20:58 +01:00
host.h mmc: core: Don't try UHS-I mode if 4-bit mode isn't supported 2018-03-15 09:30:39 +01:00
mmc.c mmc: core: Add a debug print when the card may have been replaced 2019-02-28 09:28:27 +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: core: Cleanup BKOPS support 2018-12-17 09:01:15 +01:00
mmc_test.c mmc: convert to DEFINE_SHOW_ATTRIBUTE 2018-12-17 08:26:24 +01:00
pwrseq.c mmc: pwrseq: Add reset callback to the struct mmc_pwrseq_ops 2017-06-20 10:30:09 +02:00
pwrseq.h mmc: pwrseq: Add reset callback to the struct mmc_pwrseq_ops 2017-06-20 10:30:09 +02: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 mmc: pwrseq: add support for Marvell SD8787 chip 2017-02-13 13:20:33 +01:00
pwrseq_simple.c mmc: pwrseq_simple: Fix incorrect handling of GPIO bitmap 2018-10-15 16:26:00 +02:00
queue.c for-5.1/block-20190302 2019-03-08 14:12:17 -08:00
queue.h mmc: stop abusing the request queue_lock pointer 2018-11-17 07:20:45 -07:00
quirks.h mmc: core: sdio: Set SDIO clock of SDR104 to 150MHz for Marvell 8887 chip 2018-05-02 15:08:39 +02:00
regulator.c mmc: core: Convert mmc_regulator_get_ocrmask() 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 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +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
sdio.c mmc: core: Add a debug print when the card may have been replaced 2019-02-28 09:28:27 +01:00
sdio_bus.c mmc:sdio: Remove unneeded variable ret 2019-02-25 08:40:58 +01:00
sdio_bus.h mmc: core: First step in cleaning up private mmc header files 2017-02-13 13:20:20 +01:00
sdio_cis.c mmc: core: remove BUG_ONs from sdio 2016-12-05 10:31:08 +01:00
sdio_cis.h mmc: core: First step in cleaning up private mmc header files 2017-02-13 13:20:20 +01:00
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 mmc: update sdio_claim_irq documentation 2018-03-22 10:50:24 +01:00
sdio_ops.c mmc: sdio: improve mmc_io_rw_extended 2017-04-24 21:41:42 +02:00
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 tty: replace ->proc_fops with ->proc_show 2018-05-16 07:24:30 +02:00
slot-gpio.c mmc: slot-gpio: Remove override_active_level on WP 2019-02-25 08:40:58 +01:00
slot-gpio.h mmc: core: First step in cleaning up private mmc header files 2017-02-13 13:20:20 +01:00