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

Commit 2e2095bc authored by Ram Prakash Gupta's avatar Ram Prakash Gupta
Browse files

mmc: cqhci: Set task descriptor size capability before allocation



If cypto is supported by mmc controller, task descriptor length
should be 128 bit independent of architecture.
But currently without this fix, for 32bit architecture task
descriptor length is set as 64 bit only as capability is checked
after allocation of descriptor memory.

To fix this, set task descriptor size capability before allocating
descriptor table.

Change-Id: I144080fdf2ecc074dfe48f375546570856795b42
Signed-off-by: default avatarRam Prakash Gupta <rampraka@codeaurora.org>
parent a0e0de01
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -279,11 +279,9 @@ static void __cqhci_enable(struct cqhci_host *cq_host)
	if (cqcap & CQHCI_CAP_CS) {
		/*
		 * In case host controller supports cryptographic operations
		 * then, it uses 128bit task descriptor. Upper 64 bits of task
		 * descriptor would be used to pass crypto specific informaton.
		 * then, enable crypro support.
		 */
		cq_host->caps |= CQHCI_CAP_CRYPTO_SUPPORT |
				CQHCI_TASK_DESC_SZ_128;
		cq_host->caps |= CQHCI_CAP_CRYPTO_SUPPORT;
		cqcfg |= CQHCI_ICE_ENABLE;
		/*
		 * For SDHC v5.0 onwards, ICE 3.0 specific registers are added
@@ -1258,6 +1256,7 @@ int cqhci_init(struct cqhci_host *cq_host, struct mmc_host *mmc,
	      bool dma64)
{
	int err;
	u32 cqcap = 0;

	cq_host->dma64 = dma64;
	cq_host->mmc = mmc;
@@ -1272,6 +1271,16 @@ int cqhci_init(struct cqhci_host *cq_host, struct mmc_host *mmc,
	if (mmc->caps2 & MMC_CAP2_CQE_DCMD)
		mmc->cqe_qdepth -= 1;

	cqcap = cqhci_readl(cq_host, CQHCI_CAP);
	if (cqcap & CQHCI_CAP_CS) {
		/*
		 * In case host controller supports cryptographic operations
		 * then, it uses 128bit task descriptor. Upper 64 bits of task
		 * descriptor would be used to pass crypto specific informaton.
		 */
		cq_host->caps |= CQHCI_TASK_DESC_SZ_128;
	}

	cq_host->slot = devm_kcalloc(mmc_dev(mmc), cq_host->num_slots,
				     sizeof(*cq_host->slot), GFP_KERNEL);
	if (!cq_host->slot) {