linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivan Mikhaylov <i.mikhaylov@yadro.com>
Cc: Ivan Mikhaylov <i.mikhaylov@yadro.com>,
	Joel Stanley <joel@jms.id.au>, Andrew Jeffery <andrew@aj.id.au>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	linux-mmc@vger.kernel.org, openbmc@lists.ozlabs.org
Subject: [PATCH v3 3/3] mmc: sdhci-of-aspeed: add inversion signal presence
Date: Mon, 18 Nov 2019 13:46:46 +0300	[thread overview]
Message-ID: <20191118104646.3838-4-i.mikhaylov@yadro.com> (raw)
In-Reply-To: <20191118104646.3838-1-i.mikhaylov@yadro.com>

Add read_l callback in sdhci_ops with flipping of SDHCI_CARD_PRESENT
bit in case of inverted card detection signal.

Signed-off-by: Ivan Mikhaylov <i.mikhaylov@yadro.com>

diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
index 8962f6664381..56912e30c47e 100644
--- a/drivers/mmc/host/sdhci-of-aspeed.c
+++ b/drivers/mmc/host/sdhci-of-aspeed.c
@@ -111,7 +111,19 @@ static void aspeed_sdhci_set_bus_width(struct sdhci_host *host, int width)
 	sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
 }
 
+static u32 aspeed_sdhci_readl(struct sdhci_host *host, int reg)
+{
+	u32 val = readl(host->ioaddr + reg);
+
+	if (unlikely(reg == SDHCI_PRESENT_STATE) &&
+	    (host->mmc->caps2 & MMC_CAP2_CD_ACTIVE_HIGH))
+		val ^= SDHCI_CARD_PRESENT;
+
+	return val;
+}
+
 static const struct sdhci_ops aspeed_sdhci_ops = {
+	.read_l = aspeed_sdhci_readl,
 	.set_clock = aspeed_sdhci_set_clock,
 	.get_max_clock = aspeed_sdhci_get_max_clock,
 	.set_bus_width = aspeed_sdhci_set_bus_width,
-- 
2.20.1

  parent reply	other threads:[~2019-11-18 10:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-18 10:46 [PATCH v3 0/3] add inversion signal presence support Ivan Mikhaylov
2019-11-18 10:46 ` [PATCH v3 1/3] aspeed: dts: add sd card for vesnin Ivan Mikhaylov
2019-11-20  6:09   ` Andrew Jeffery
2019-11-18 10:46 ` [PATCH v3 2/3] mmc: sdhci-of-aspeed: enable CONFIG_MMC_SDHCI_IO_ACCESSORS Ivan Mikhaylov
2019-11-20  6:08   ` Andrew Jeffery
2019-11-20  7:44   ` Adrian Hunter
2019-11-20 12:58   ` Ulf Hansson
2019-11-18 10:46 ` Ivan Mikhaylov [this message]
2019-11-20  6:06   ` [PATCH v3 3/3] mmc: sdhci-of-aspeed: add inversion signal presence Andrew Jeffery
2019-11-20  7:45   ` Adrian Hunter
2019-11-20 12:59   ` Ulf Hansson
2019-12-02 21:57     ` Joel Stanley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191118104646.3838-4-i.mikhaylov@yadro.com \
    --to=i.mikhaylov@yadro.com \
    --cc=adrian.hunter@intel.com \
    --cc=andrew@aj.id.au \
    --cc=devicetree@vger.kernel.org \
    --cc=joel@jms.id.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=robh+dt@kernel.org \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).