From: Marcin Wojtas <mw@semihalf.com>
To: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org
Cc: ulf.hansson@linaro.org, sebastian.hesselbarth@gmail.com,
andrew@lunn.ch, jason@lakedaemon.net,
thomas.petazzoni@free-electrons.com,
gregory.clement@free-electrons.com, nadavh@marvell.com,
alior@marvell.com, tawfik@marvell.com, mw@semihalf.com,
jaz@semihalf.com, jszhang@marvell.com
Subject: [PATCH v3 5/5] mmc: sdhci-pxav3: enable modifying MMC_CARD bit during card initialization
Date: Thu, 15 Oct 2015 18:25:46 +0200 [thread overview]
Message-ID: <1444926346-29763-6-git-send-email-mw@semihalf.com> (raw)
In-Reply-To: <1444926346-29763-1-git-send-email-mw@semihalf.com>
On Marvell Armada 38x SoC's the MMC_CARD bit in SD_CE_ATA_1 register must
be set to 0x1 when a MMC card is supposed to work in DDR mode, or when
commands CMD11, CMD14 and CMD20 are used.
This commit enables the above for all MMC cards by modifying the host
registers during card initialization. It is done by using init_card()
callback with pxa->mbus_win_regs as a flag, which notifies if Armada 38x
controller is in use.
Signed-off-by: Marcin Wojtas <mw@semihalf.com>
---
drivers/mmc/host/sdhci-pxav3.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index d813233..8742afd 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -57,6 +57,7 @@
#define SD_SPI_MODE 0x108
#define SD_CE_ATA_1 0x10C
+#define SDCE_MMC_CARD BIT(28)
#define SD_CE_ATA_2 0x10E
#define SDCE_MISC_INT (1<<2)
@@ -230,6 +231,26 @@ static void pxav3_reset(struct sdhci_host *host, u8 mask)
}
}
+static void pxav3_init_card(struct sdhci_host *host, struct mmc_card *card)
+{
+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+ struct sdhci_pxa *pxa = pltfm_host->priv;
+ u32 reg_val;
+
+ /*
+ * Armada 38x SDHCI controller requires update of
+ * MMC_CARD bit depending on inserted card type.
+ */
+ if (pxa->mbus_win_regs) {
+ reg_val = sdhci_readl(host, SD_CE_ATA_1);
+ if (mmc_card_mmc(card))
+ reg_val |= SDCE_MMC_CARD;
+ else
+ reg_val &= ~SDCE_MMC_CARD;
+ sdhci_writel(host, reg_val, SD_CE_ATA_1);
+ }
+}
+
#define MAX_WAIT_COUNT 5
static void pxav3_gen_init_74_clocks(struct sdhci_host *host, u8 power_mode)
{
@@ -347,6 +368,7 @@ static const struct sdhci_ops pxav3_sdhci_ops = {
.set_bus_width = sdhci_set_bus_width,
.reset = pxav3_reset,
.set_uhs_signaling = pxav3_set_uhs_signaling,
+ .init_card = pxav3_init_card,
};
static struct sdhci_pltfm_data sdhci_pxav3_pdata = {
--
1.8.3.1
next prev parent reply other threads:[~2015-10-15 16:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-15 16:25 [PATCH v3 0/5] Armada 38x SDHCI driver improvements Marcin Wojtas
2015-10-15 16:25 ` [PATCH v3 1/5] mmc: sdhci-pxav3: enable proper resuming on Armada 38x SoC Marcin Wojtas
2015-10-22 13:29 ` Ulf Hansson
2015-10-22 13:38 ` Marcin Wojtas
2015-10-15 16:25 ` [PATCH v3 2/5] mmc: sdhci-pxav3: enable usage of DAT3 pin as HW card detect Marcin Wojtas
2015-10-22 13:29 ` Ulf Hansson
2015-10-23 13:43 ` Marcin Wojtas
2015-10-15 16:25 ` [PATCH v3 3/5] ARM: mvebu: set SW polling as SDHCI card detection on A388-GP Marcin Wojtas
2015-10-16 17:19 ` Gregory CLEMENT
2015-10-15 16:25 ` [PATCH v3 4/5] mmc: sdhci: add init_card callback to sdhci Marcin Wojtas
2015-10-15 16:25 ` Marcin Wojtas [this message]
2015-10-21 11:59 ` [PATCH v3 0/5] Armada 38x SDHCI driver improvements Marcin Wojtas
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=1444926346-29763-6-git-send-email-mw@semihalf.com \
--to=mw@semihalf.com \
--cc=alior@marvell.com \
--cc=andrew@lunn.ch \
--cc=gregory.clement@free-electrons.com \
--cc=jason@lakedaemon.net \
--cc=jaz@semihalf.com \
--cc=jszhang@marvell.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=nadavh@marvell.com \
--cc=sebastian.hesselbarth@gmail.com \
--cc=tawfik@marvell.com \
--cc=thomas.petazzoni@free-electrons.com \
--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
all inboxes | Powered by JetHome®