Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8fec754f authored by Ram Prakash Gupta's avatar Ram Prakash Gupta
Browse files

mmc: cmdq: trigger get queue status after dcmd



CMDQ spec defines periodic SEND_STATUS mechanism to poll
on READY tasks in the device. When DAT lines are in IDLE
the counter counts from its reset value to '0' and then
triggers SEND_STATUS command. When CMD13 is completed and
also the syncing of the device status to HCLK domain is done
there is a 1 cycle pulse to reload the counter with timer
reset value so that the counting can start over.

In rare cases, when the 'done' pulse for reloading the
counter happens in parallel to a BUSY state of direct
command - the IDLE counter is not reloaded and can't
trigger another CMD13. If this scenario happens when
there are pending tasks which are not 'READY' yet  - it
can lead to a deadlock, since there is no other mechainsm to
send CMD13, and CQE will never get READY on the pending tasks.

Hence, trigger a send status command after DCMD is completed
as a work-around to the above issue.

Change-Id: Ice3d1bdaf94ba198ae6955a0e918de45ff090cd4
Signed-off-by: default avatarAsutosh Das <asutoshd@codeaurora.org>
Signed-off-by: default avatarSahitya Tummala <stummala@codeaurora.org>
Signed-off-by: default avatarRam Prakash Gupta <rampraka@codeaurora.org>
parent 42668750
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -147,6 +147,8 @@ static void cqhci_dumpregs(struct cqhci_host *cq_host)
	CQHCI_DUMP("Resp idx:  0x%08x | Resp arg: 0x%08x\n",
		   cqhci_readl(cq_host, CQHCI_CRI),
		   cqhci_readl(cq_host, CQHCI_CRA));
	CQHCI_DUMP(": Vendor cfg 0x%08x\n",
		   cqhci_readl(cq_host, CQHCI_VENDOR_CFG));

	if (cq_host->ops->dumpregs)
		cq_host->ops->dumpregs(mmc);
@@ -840,6 +842,9 @@ static void cqhci_finish_mrq(struct mmc_host *mmc, unsigned int tag)
			data->bytes_xfered = 0;
		else
			data->bytes_xfered = data->blksz * data->blocks;
	} else {
		cqhci_writel(cq_host, cqhci_readl(cq_host, CQHCI_VENDOR_CFG) |
				CMDQ_SEND_STATUS_TRIGGER, CQHCI_VENDOR_CFG);
	}

	if (!(cq_host->caps & CQHCI_CAP_CRYPTO_SUPPORT) &&
+9 −1
Original line number Diff line number Diff line
/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -116,6 +117,13 @@
/* command response argument */
#define CQHCI_CRA			0x5C

/*
 * Add new macro for updated CQ vendor specific
 * register address for SDHC v5.0 onwards.
 */
#define CQHCI_VENDOR_CFG   0x100
#define CMDQ_SEND_STATUS_TRIGGER (1 << 31)

#define CQHCI_INT_ALL			0xF
#define CQHCI_IC_DEFAULT_ICCTH		31
#define CQHCI_IC_DEFAULT_ICTOVAL	1