FROMGIT: mmc: host: sdhci: Implement the request_atomic() API

Implement the request_atomic() ops for the sdhci driver to process
one request in the atomic context if the card is nonremovable.

Moreover, we should return BUSY flag if controller has not released
the inhibit bits to allow HSQ trying to send request again in non-atomic
context.

Suggested-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Baolin Wang <baolin.wang7@gmail.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/9ed34afa9fb42e0c234065cac5401d7826942b55.1586744073.git.baolin.wang7@gmail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Bug: 156552982
(cherry picked from commit fc832e3a9996c6a1d981e0c57fe8de8594561d12
 https://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git next)
Change-Id: Ib291257cc6b1d31f08e513c9b42106acd4a1b9c1
Signed-off-by: Chunyan Zhang <zhang.lyra@gmail.com>
This commit is contained in:
Baolin Wang 2020-04-13 10:46:04 +08:00 • committed by Greg Kroah-Hartman
commit 00c0cd436f
2 changed files with 35 additions and 0 deletions

View file

@ -1923,6 +1923,40 @@ out_finish:
}
EXPORT_SYMBOL_GPL(sdhci_request);
int sdhci_request_atomic(struct mmc_host *mmc, struct mmc_request *mrq)
{
struct sdhci_host *host = mmc_priv(mmc);
struct mmc_command *cmd;
unsigned long flags;
int ret = 0;
spin_lock_irqsave(&host->lock, flags);
if (sdhci_present_error(host, mrq->cmd, true)) {
sdhci_finish_mrq(host, mrq);
goto out_finish;
}
cmd = sdhci_manual_cmd23(host, mrq) ? mrq->sbc : mrq->cmd;
/*
* The HSQ may send a command in interrupt context without polling
* the busy signaling, which means we should return BUSY if controller
* has not released inhibit bits to allow HSQ trying to send request
* again in non-atomic context. So we should not finish this request
* here.
*/
if (!sdhci_send_command(host, cmd))
ret = -EBUSY;
else
sdhci_led_activate(host);
out_finish:
spin_unlock_irqrestore(&host->lock, flags);
return ret;
}
EXPORT_SYMBOL_GPL(sdhci_request_atomic);
void sdhci_set_bus_width(struct sdhci_host *host, int width)
{
u8 ctrl;

View file

@ -767,6 +767,7 @@ void sdhci_set_power(struct sdhci_host *host, unsigned char mode,
void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode,
unsigned short vdd);
void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq);
int sdhci_request_atomic(struct mmc_host *mmc, struct mmc_request *mrq);
void sdhci_set_bus_width(struct sdhci_host *host, int width);
void sdhci_reset(struct sdhci_host *host, u8 mask);
void sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned timing);