From: suman Tripathi <stripathi@apm.com>
To: olof@lixom.net, tj@kernel.org, arnd@arndb.de
Cc: linux-ide@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, mlangsdo@redhat.com,
jcm@redhat.com, patches@apm.com,
Suman Tripathi <stripathi@apm.com>
Subject: [PATCH v4 1/3] libahci: Implement the capability to override the generic ahci interrupt handler.
Date: Sat, 6 Feb 2016 11:25:22 +0530 [thread overview]
Message-ID: <1454738124-9351-2-git-send-email-stripathi@apm.com> (raw)
In-Reply-To: <1454738124-9351-1-git-send-email-stripathi@apm.com>
From: Suman Tripathi <stripathi@apm.com>
This patch implements the capability to override the generic AHCI
interrupt handler so that the LDD drivers can implement their own
custom interrupt handler routines.
Signed-off-by: Suman Tripathi <stripathi@apm.com>
---
drivers/ata/ahci.h | 2 ++
drivers/ata/libahci.c | 29 +++++++++++++++++++++--------
2 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index a4faa43..e64bdad 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -360,6 +360,7 @@ struct ahci_host_priv {
* be overridden anytime before the host is activated.
*/
void (*start_engine)(struct ata_port *ap);
+ irqreturn_t (*ahci_irq_handler)(int irq, void *dev_instance);
};
#ifdef CONFIG_PCI_MSI
@@ -423,6 +424,7 @@ int ahci_reset_em(struct ata_host *host);
void ahci_print_info(struct ata_host *host, const char *scc_s);
int ahci_host_activate(struct ata_host *host, struct scsi_host_template *sht);
void ahci_error_handler(struct ata_port *ap);
+u32 ahci_handle_port_intr(struct ata_host *host, u32 irq_masked);
static inline void __iomem *__ahci_port_base(struct ata_host *host,
unsigned int port_no)
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index eda3cf2..d45a7a5 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -113,6 +113,9 @@ static ssize_t ahci_store_em_buffer(struct device *dev,
const char *buf, size_t size);
static ssize_t ahci_show_em_supported(struct device *dev,
struct device_attribute *attr, char *buf);
+static irqreturn_t ahci_single_edge_irq_intr(int irq, void *dev_instance);
+
+static irqreturn_t ahci_single_level_irq_intr(int irq, void *dev_instance);
static DEVICE_ATTR(ahci_host_caps, S_IRUGO, ahci_show_host_caps, NULL);
static DEVICE_ATTR(ahci_host_cap2, S_IRUGO, ahci_show_host_cap2, NULL);
@@ -512,6 +515,11 @@ void ahci_save_initial_config(struct device *dev, struct ahci_host_priv *hpriv)
if (!hpriv->start_engine)
hpriv->start_engine = ahci_start_engine;
+
+ if (!hpriv->ahci_irq_handler)
+ hpriv->ahci_irq_handler = (hpriv->flags & AHCI_HFLAG_EDGE_IRQ) ?
+ ahci_single_edge_irq_intr :
+ ahci_single_level_irq_intr;
}
EXPORT_SYMBOL_GPL(ahci_save_initial_config);
@@ -1816,7 +1824,7 @@ static irqreturn_t ahci_multi_irqs_intr_hard(int irq, void *dev_instance)
return IRQ_HANDLED;
}
-static u32 ahci_handle_port_intr(struct ata_host *host, u32 irq_masked)
+u32 ahci_handle_port_intr(struct ata_host *host, u32 irq_masked)
{
unsigned int i, handled = 0;
@@ -1842,6 +1850,7 @@ static u32 ahci_handle_port_intr(struct ata_host *host, u32 irq_masked)
return handled;
}
+EXPORT_SYMBOL_GPL(ahci_handle_port_intr);
static irqreturn_t ahci_single_edge_irq_intr(int irq, void *dev_instance)
{
@@ -2505,14 +2514,18 @@ int ahci_host_activate(struct ata_host *host, struct scsi_host_template *sht)
int irq = hpriv->irq;
int rc;
- if (hpriv->flags & (AHCI_HFLAG_MULTI_MSI | AHCI_HFLAG_MULTI_MSIX))
+ if (hpriv->flags & (AHCI_HFLAG_MULTI_MSI | AHCI_HFLAG_MULTI_MSIX)) {
+ if (hpriv->ahci_irq_handler)
+ dev_warn(host->dev, "both AHCI_HFLAG_MULTI_MSI flag set \
+ and custom irq handler implemented\n");
+
rc = ahci_host_activate_multi_irqs(host, sht);
- else if (hpriv->flags & AHCI_HFLAG_EDGE_IRQ)
- rc = ata_host_activate(host, irq, ahci_single_edge_irq_intr,
- IRQF_SHARED, sht);
- else
- rc = ata_host_activate(host, irq, ahci_single_level_irq_intr,
- IRQF_SHARED, sht);
+ } else {
+ rc = ata_host_activate(host, irq, hpriv->ahci_irq_handler,
+ IRQF_SHARED, sht);
+ }
+
+
return rc;
}
EXPORT_SYMBOL_GPL(ahci_host_activate);
--
1.7.1
next prev parent reply other threads:[~2016-02-06 5:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-06 5:55 [PATCH v4 0/3] ata: Fixes related to edge trigger latch for the ahci_xgene_driver suman Tripathi
2016-02-06 5:55 ` suman Tripathi [this message]
2016-02-06 5:55 ` [PATCH v4 2/3] ata: Remove the AHCI_HFLAG_EDGE_IRQ support from libahci suman Tripathi
2016-02-06 5:55 ` [PATCH v4 3/3] ahci_xgene: Implement the workaround to fix the missing of the edge interrupt for the HOST_IRQ_STAT suman Tripathi
[not found] ` <1454738124-9351-1-git-send-email-stripathi-qTEPVZfXA3Y@public.gmane.org>
2016-02-10 16:25 ` [PATCH v4 0/3] ata: Fixes related to edge trigger latch for the ahci_xgene_driver Tejun Heo
[not found] ` <20160210162547.GJ3741-qYNAdHglDFBN0TnZuCh8vA@public.gmane.org>
2016-02-10 18:59 ` Suman Tripathi
2016-02-10 19:05 ` Tejun Heo
2016-02-10 19:08 ` Suman Tripathi
[not found] ` <CAOHikRDcChOdP9v2_0a515XAXeG3kZOaLe==mymTJTpmog-6Ow-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-02-10 19:24 ` Tejun Heo
2016-02-10 19:34 ` Suman Tripathi
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=1454738124-9351-2-git-send-email-stripathi@apm.com \
--to=stripathi@apm.com \
--cc=arnd@arndb.de \
--cc=devicetree@vger.kernel.org \
--cc=jcm@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-ide@vger.kernel.org \
--cc=mlangsdo@redhat.com \
--cc=olof@lixom.net \
--cc=patches@apm.com \
--cc=tj@kernel.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