From: "Milton Miller II" <miltonm@us.ibm.com>
To: Ivan Mikhaylov <i.mikhaylov@yadro.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
devicetree@vger.kernel.org, Ulf Hansson <ulf.hansson@linaro.org>,
linux-aspeed@lists.ozlabs.org, Andrew Jeffery <andrew@aj.id.au>,
openbmc@lists.ozlabs.org, linux-mmc@vger.kernel.org,
Adrian Hunter <adrian.hunter@intel.com>,
linux-kernel@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/2] mmc: sdhci-of-aspeed: add inversion signal presence
Date: Thu, 14 Nov 2019 00:04:09 +0000 [thread overview]
Message-ID: <OF20F73C7F.F32D5A9E-ON002584B1.00836403-002584B2.0000614A@notes.na.collabserv.com> (raw)
In-Reply-To: <20191113155237.30646-3-i.mikhaylov@yadro.com>
On 11/13/2019 around 09:57AM in some time zone, Ivan Mikhaylov wrote:
>Change the default .get_cd callback. Add inverted signal card
>detection
>check.
>
>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..8eded8a6ed8d 100644
>--- a/drivers/mmc/host/sdhci-of-aspeed.c
>+++ b/drivers/mmc/host/sdhci-of-aspeed.c
>@@ -31,6 +31,7 @@ struct aspeed_sdc {
> struct aspeed_sdhci {
> struct aspeed_sdc *parent;
> u32 width_mask;
>+ u8 cd_inverted;
The mmc core/host.c checks the device tree and stores the
result as mmc->caps2 & MMC_CAP2_CD_ACTIVE_HIGH
This appears to be accessale as sdhci_host->mmc->caps2.
Please reuse this bit like the other drivers.
> };
>
> static void aspeed_sdc_configure_8bit_mode(struct aspeed_sdc *sdc,
>@@ -143,6 +144,21 @@ static inline int
>aspeed_sdhci_calculate_slot(struct aspeed_sdhci *dev,
> return (delta / 0x100) - 1;
> }
>
>+static int aspeed_get_cd(struct mmc_host *mmc)
>+{
>+ struct aspeed_sdhci *aspeed_sdhci;
>+ struct sdhci_pltfm_host *pltfm_priv;
>+ struct sdhci_host *host = mmc_priv(mmc);
>+
>+ int presence = !!(sdhci_readl(host, SDHCI_PRESENT_STATE)
>+ & SDHCI_CARD_PRESENT);
>+
>+ pltfm_priv = sdhci_priv(host);
>+ aspeed_sdhci = sdhci_pltfm_priv(pltfm_priv);
>+
>+ return presence ^ aspeed_sdhci->cd_inverted;
>+}
>+
> static int aspeed_sdhci_probe(struct platform_device *pdev)
> {
> struct sdhci_pltfm_host *pltfm_host;
>@@ -183,6 +199,13 @@ static int aspeed_sdhci_probe(struct
>platform_device *pdev)
> goto err_pltfm_free;
> }
>
>+ dev->cd_inverted = 0;
>+ host->mmc_host_ops.get_cd = aspeed_get_cd;
>+ if (of_property_read_bool(pdev->dev.of_node, "cd-inverted")) {
>+ dev->cd_inverted = 1;
>+ dev_info(&pdev->dev, "aspeed: sdhci: presence signal inversion
>enabled\n");
>+ }
>+
> ret = mmc_of_parse(host->mmc);
> if (ret)
> goto err_sdhci_add;
>--
>2.20.1
>
>
prev parent reply other threads:[~2019-11-14 0:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-13 15:52 [PATCH 0/2] add inversion signal presence support Ivan Mikhaylov
2019-11-13 15:52 ` [PATCH 1/2] aspeed: dts: add sd card for vesnin Ivan Mikhaylov
2019-11-13 15:52 ` [PATCH 2/2] mmc: sdhci-of-aspeed: add inversion signal presence Ivan Mikhaylov
2019-11-14 0:04 ` Milton Miller II [this message]
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=OF20F73C7F.F32D5A9E-ON002584B1.00836403-002584B2.0000614A@notes.na.collabserv.com \
--to=miltonm@us.ibm.com \
--cc=adrian.hunter@intel.com \
--cc=andrew@aj.id.au \
--cc=devicetree@vger.kernel.org \
--cc=i.mikhaylov@yadro.com \
--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).