From: Andrea Merello <andrea.merello@gmail.com>
To: ulf.hansson@linaro.org, mcoquelin.stm32@gmail.com,
alexandre.torgue@st.com
Cc: linux-mmc@vger.kernel.org, bruherrera@gmail.com,
Andrea Merello <andrea.merello@gmail.com>
Subject: [PATCH v2 1/9] mmc: mmci: don't pretend IP variants with only one IRQ to have two mask regs
Date: Tue, 10 Jan 2017 09:42:08 +0100 [thread overview]
Message-ID: <1484037736-25029-2-git-send-email-andrea.merello@gmail.com> (raw)
In-Reply-To: <1484037736-25029-1-git-send-email-andrea.merello@gmail.com>
Currently the driver supports both devices with one and two IRQ lines.
Two mask registers are used in order to select which events have to
actually generate an interrupt on each IRQ line.
It seems that in the single-IRQ case it's assumed that the IRQs lines
are simply OR-ed, while the two mask registers are still present. The
driver still programs the two mask registers separately.
However the STM32 variant has only one IRQ, and also has only one mask
register.
This patch prepares for STM32 variant support by making the driver using
only one mask register when only one IRQ is available.
Tested only on STM32 variant. RFT for variants other than STM32
Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
---
drivers/mmc/host/mmci.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 01a8047..597fab8 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -404,9 +404,9 @@ static void mmci_set_mask1(struct mmci_host *host, unsigned int mask)
mask0 |= mask;
writel(mask0, base + MMCIMASK0);
+ } else {
+ writel(mask, base + MMCIMASK1);
}
-
- writel(mask, base + MMCIMASK1);
}
static void mmci_stop_data(struct mmci_host *host)
@@ -1274,12 +1274,10 @@ static irqreturn_t mmci_irq(int irq, void *dev_id)
do {
status = readl(host->base + MMCISTATUS);
+ status &= readl(host->base + MMCIMASK0);
if (host->singleirq) {
- if (status & readl(host->base + MMCIMASK1))
- mmci_pio_irq(irq, dev_id);
-
- status &= ~MCI_IRQ1MASK;
+ mmci_pio_irq(irq, dev_id);
}
/*
@@ -1287,7 +1285,6 @@ static irqreturn_t mmci_irq(int irq, void *dev_id)
* enabled) since the HW seems to be triggering the IRQ on both
* edges while monitoring DAT0 for busy completion.
*/
- status &= readl(host->base + MMCIMASK0);
writel(status, host->base + MMCICLEAR);
dev_dbg(mmc_dev(host->mmc), "irq0 (data+cmd) %08x\n", status);
@@ -1710,7 +1707,8 @@ static int mmci_probe(struct amba_device *dev,
spin_lock_init(&host->lock);
writel(0, host->base + MMCIMASK0);
- writel(0, host->base + MMCIMASK1);
+ if (!host->singleirq)
+ writel(0, host->base + MMCIMASK1);
writel(0xfff, host->base + MMCICLEAR);
/*
@@ -1800,7 +1798,8 @@ static int mmci_remove(struct amba_device *dev)
mmc_remove_host(mmc);
writel(0, host->base + MMCIMASK0);
- writel(0, host->base + MMCIMASK1);
+ if (!host->singleirq)
+ writel(0, host->base + MMCIMASK1);
writel(0, host->base + MMCICOMMAND);
writel(0, host->base + MMCIDATACTRL);
--
2.7.4
next prev parent reply other threads:[~2017-01-10 8:42 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-10 8:42 [PATCH v2 0/9] mmc: mmci: add support for STM32 SD controller Andrea Merello
2017-01-10 8:42 ` Andrea Merello [this message]
2017-01-10 8:42 ` [PATCH v2 2/9] mmc: mmci: add support for not-amba, but still compatible, variants Andrea Merello
2017-01-10 8:42 ` [PATCH v2 3/9] mmc: mmci: don't pretend all variants to have MCI_STARBITERR flag Andrea Merello
2017-01-10 8:42 ` [PATCH v2 4/9] mmc: mmci: add support for setting pad type via pinctrl Andrea Merello
2017-01-10 8:42 ` [PATCH v2 5/9] mmc: mmci: add STM32 variant Andrea Merello
2017-01-10 8:42 ` [PATCH v2 6/9] DT: stm32f429: add pin map for SDIO controller Andrea Merello
2017-01-10 9:06 ` Alexandre Torgue
2017-01-10 8:42 ` [PATCH v2 7/9] DT: stm32f429: add node " Andrea Merello
2017-01-10 9:15 ` Alexandre Torgue
2017-01-10 8:42 ` [PATCH v2 8/9] DT: stm32f469-disco: " Andrea Merello
2017-01-10 9:18 ` Alexandre Torgue
2017-01-12 7:25 ` Andrea Merello
2017-01-12 8:34 ` Alexandre Torgue
2017-01-12 8:53 ` Andrea Merello
2017-01-13 15:01 ` Andrea Merello
2017-01-13 15:52 ` Alexandre Torgue
2017-01-13 16:12 ` Andrea Merello
2017-01-13 16:28 ` Alexandre Torgue
2017-01-13 18:40 ` Andrea Merello
2017-01-10 8:42 ` [PATCH v2 9/9] Documentation: document mmci STM32 DT binding Andrea Merello
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=1484037736-25029-2-git-send-email-andrea.merello@gmail.com \
--to=andrea.merello@gmail.com \
--cc=alexandre.torgue@st.com \
--cc=bruherrera@gmail.com \
--cc=linux-mmc@vger.kernel.org \
--cc=mcoquelin.stm32@gmail.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