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

Commit a3a4fb05 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mmc: cqhci: CQ Register changes for v5.0 onwards"

parents 8ec61229 327fd322
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -102,6 +102,10 @@ static void cqhci_set_irqs(struct cqhci_host *cq_host, u32 set)
static void cqhci_dumpregs(struct cqhci_host *cq_host)
{
	struct mmc_host *mmc = cq_host->mmc;
	int offset = 0;

	if (cq_host->offset_changed)
		offset = CQE_V5_VENDOR_CFG;

	mmc_log_string(mmc,
	"CQHCI_CTL=0x%08x CQHCI_IS=0x%08x CQHCI_ISTE=0x%08x CQHCI_ISGE=0x%08x CQHCI_TDBR=0x%08x CQHCI_TCN=0x%08x CQHCI_DQS=0x%08x CQHCI_DPT=0x%08x CQHCI_TERRI=0x%08x CQHCI_CRI=0x%08x CQHCI_CRA=0x%08x CQHCI_CRDCT=0x%08x\n",
@@ -147,6 +151,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 + offset));

	if (cq_host->ops->dumpregs)
		cq_host->ops->dumpregs(mmc);
@@ -279,6 +285,12 @@ static void __cqhci_enable(struct cqhci_host *cq_host)
		cq_host->caps |= CQHCI_CAP_CRYPTO_SUPPORT |
				CQHCI_TASK_DESC_SZ_128;
		cqcfg |= CQHCI_ICE_ENABLE;
		/*
		 * For SDHC v5.0 onwards, ICE 3.0 specific registers are added
		 * in CQ register space, due to which few CQ registers are
		 * shifted. Set offset_changed boolean to use updated address.
		 */
		 cq_host->offset_changed = true;
	}

	cqhci_writel(cq_host, cqcfg, CQHCI_CFG);
@@ -809,8 +821,10 @@ static void cqhci_finish_mrq(struct mmc_host *mmc, unsigned int tag)
	struct cqhci_slot *slot = &cq_host->slot[tag];
	struct mmc_request *mrq = slot->mrq;
	struct mmc_data *data;
	int err = 0;
	int err = 0, offset = 0;

	if (cq_host->offset_changed)
		offset = CQE_V5_VENDOR_CFG;
	if (!mrq) {
		WARN_ONCE(1, "%s: cqhci: spurious TCN for tag %d\n",
			  mmc_hostname(mmc), tag);
@@ -840,6 +854,11 @@ 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 + offset) |
				CMDQ_SEND_STATUS_TRIGGER,
				CQHCI_VENDOR_CFG + offset);
	}

	if (!(cq_host->caps & CQHCI_CAP_CRYPTO_SUPPORT) &&
+11 −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,14 @@
/* command response argument */
#define CQHCI_CRA			0x5C

/*
 * Add new macro for updated CQ vendor specific
 * register address for SDHC v5.0 onwards.
 */
#define CQE_V5_VENDOR_CFG	0x900
#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
@@ -183,6 +192,7 @@ struct cqhci_host {
	bool activated;
	bool waiting_for_idle;
	bool recovery_halt;
	bool offset_changed;

	size_t desc_size;
	size_t data_size;