linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "ernest.zhang" <ernest.zhang@bayhubtech.com>
To: Adrian Hunter <adrian.hunter@intel.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: xiaoguang.yu@bayhubtech.com, shirley.her@bayhubtech.com,
	yuxiang.wan@bayhubtech.com
Subject: [PATCH V4 3/3] mmc: sdhci: Add MSI interrupt support for O2 SD host
Date: Fri,  9 Mar 2018 22:04:25 +0800	[thread overview]
Message-ID: <1520604265-4430-3-git-send-email-ernest.zhang@bayhubtech.com> (raw)
In-Reply-To: <1520604265-4430-1-git-send-email-ernest.zhang@bayhubtech.com>

Add MSI interrupt support if the SD host device can support MSI interrupt.

Changes: Enable MSI interrupt if the MSI capability bit is set in 
capability register.

Signed-off-by: ernest.zhang <ernest.zhang@bayhubtech.com>
---
 drivers/mmc/host/sdhci-pci-o2micro.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/mmc/host/sdhci-pci-o2micro.c b/drivers/mmc/host/sdhci-pci-o2micro.c
index a918984..7d04f4b 100644
--- a/drivers/mmc/host/sdhci-pci-o2micro.c
+++ b/drivers/mmc/host/sdhci-pci-o2micro.c
@@ -391,6 +391,23 @@ int sdhci_pci_o2_probe_slot(struct sdhci_pci_slot *slot)
 		if (reg & 0x1)
 			host->quirks |= SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12;
 
+#if defined(CONFIG_PCI_MSI)
+		if (pci_find_capability(chip->pdev, PCI_CAP_ID_MSI)) {
+			ret = pci_enable_msi(chip->pdev);
+			if (!ret) {
+				host->irq = chip->pdev->irq;
+				pr_info("%s: use MSI irq, irq=%d\n",
+					mmc_hostname(host->mmc), host->irq);
+			} else {
+				pr_err("%s: enable PCI MSI failed, err=%d\n",
+					mmc_hostname(host->mmc), ret);
+			}
+		} else {
+			pr_info("%s: unsupport msi, use INTx irq\n",
+				mmc_hostname(host->mmc));
+		}
+#endif
+
 		if (chip->pdev->device == PCI_DEVICE_ID_O2_SEABIRD0) {
 			ret = pci_read_config_dword(chip->pdev,
 						    O2_SD_MISC_SETTING, &reg);
-- 
2.7.4

  parent reply	other threads:[~2018-03-09 14:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-09 14:04 [PATCH V4 1/3] mmc: sdhci: Add support for O2 eMMC HS200 mode ernest.zhang
2018-03-09 14:04 ` [PATCH V4 2/3] mmc: sdhci: Add support for O2 hardware tuning ernest.zhang
2018-03-29 12:21   ` Adrian Hunter
2018-03-09 14:04 ` ernest.zhang [this message]
2018-03-29 12:44   ` [PATCH V4 3/3] mmc: sdhci: Add MSI interrupt support for O2 SD host Adrian Hunter
2018-03-29 12:25 ` [PATCH V4 1/3] mmc: sdhci: Add support for O2 eMMC HS200 mode Adrian Hunter

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=1520604265-4430-3-git-send-email-ernest.zhang@bayhubtech.com \
    --to=ernest.zhang@bayhubtech.com \
    --cc=adrian.hunter@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=shirley.her@bayhubtech.com \
    --cc=ulf.hansson@linaro.org \
    --cc=xiaoguang.yu@bayhubtech.com \
    --cc=yuxiang.wan@bayhubtech.com \
    /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).