Skip to content

Commit d867b95

Browse files
suman-tripathihtejun
authored andcommitted
ata: Remove the AHCI_HFLAG_EDGE_IRQ support from libahci.
The flexibility to override the irq handles in the LLD's are already present, so controllers implementing a edge trigger latch can implement their own interrupt handler inside the driver. This patch removes the AHCI_HFLAG_EDGE_IRQ support from libahci and moves edge irq handling to ahci_xgene. tj: Minor update to description. Signed-off-by: Suman Tripathi <stripathi@apm.com> Signed-off-by: Tejun Heo <tj@kenrel.org>
1 parent f070d67 commit d867b95

File tree

3 files changed

+41
-45
lines changed

3 files changed

+41
-45
lines changed

drivers/ata/ahci.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,7 @@ enum {
240240
error-handling stage) */
241241
AHCI_HFLAG_NO_DEVSLP = (1 << 17), /* no device sleep */
242242
AHCI_HFLAG_NO_FBS = (1 << 18), /* no FBS */
243-
AHCI_HFLAG_EDGE_IRQ = (1 << 19), /* HOST_IRQ_STAT behaves as
244-
Edge Triggered */
243+
245244
#ifdef CONFIG_PCI_MSI
246245
AHCI_HFLAG_MULTI_MSI = (1 << 20), /* multiple PCI MSIs */
247246
AHCI_HFLAG_MULTI_MSIX = (1 << 21), /* per-port MSI-X */

drivers/ata/ahci_xgene.c

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,43 @@ static int xgene_ahci_softreset(struct ata_link *link, unsigned int *class,
548548
return rc;
549549
}
550550

551+
static irqreturn_t xgene_ahci_irq_intr(int irq, void *dev_instance)
552+
{
553+
struct ata_host *host = dev_instance;
554+
struct ahci_host_priv *hpriv;
555+
unsigned int rc = 0;
556+
void __iomem *mmio;
557+
u32 irq_stat, irq_masked;
558+
559+
VPRINTK("ENTER\n");
560+
561+
hpriv = host->private_data;
562+
mmio = hpriv->mmio;
563+
564+
/* sigh. 0xffffffff is a valid return from h/w */
565+
irq_stat = readl(mmio + HOST_IRQ_STAT);
566+
if (!irq_stat)
567+
return IRQ_NONE;
568+
569+
irq_masked = irq_stat & hpriv->port_map;
570+
571+
spin_lock(&host->lock);
572+
573+
/*
574+
* HOST_IRQ_STAT behaves as edge triggered latch meaning that
575+
* it should be cleared before all the port events are cleared.
576+
*/
577+
writel(irq_stat, mmio + HOST_IRQ_STAT);
578+
579+
rc = ahci_handle_port_intr(host, irq_masked);
580+
581+
spin_unlock(&host->lock);
582+
583+
VPRINTK("EXIT\n");
584+
585+
return IRQ_RETVAL(rc);
586+
}
587+
551588
static struct ata_port_operations xgene_ahci_v1_ops = {
552589
.inherits = &ahci_ops,
553590
.host_stop = xgene_ahci_host_stop,
@@ -779,7 +816,8 @@ static int xgene_ahci_probe(struct platform_device *pdev)
779816
hpriv->flags = AHCI_HFLAG_NO_NCQ;
780817
break;
781818
case XGENE_AHCI_V2:
782-
hpriv->flags |= AHCI_HFLAG_YES_FBS | AHCI_HFLAG_EDGE_IRQ;
819+
hpriv->flags |= AHCI_HFLAG_YES_FBS;
820+
hpriv->irq_handler = xgene_ahci_irq_intr;
783821
break;
784822
default:
785823
break;

drivers/ata/libahci.c

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,6 @@ static ssize_t ahci_store_em_buffer(struct device *dev,
113113
const char *buf, size_t size);
114114
static ssize_t ahci_show_em_supported(struct device *dev,
115115
struct device_attribute *attr, char *buf);
116-
static irqreturn_t ahci_single_edge_irq_intr(int irq, void *dev_instance);
117-
118116
static irqreturn_t ahci_single_level_irq_intr(int irq, void *dev_instance);
119117

120118
static DEVICE_ATTR(ahci_host_caps, S_IRUGO, ahci_show_host_caps, NULL);
@@ -517,9 +515,7 @@ void ahci_save_initial_config(struct device *dev, struct ahci_host_priv *hpriv)
517515
hpriv->start_engine = ahci_start_engine;
518516

519517
if (!hpriv->irq_handler)
520-
hpriv->irq_handler = (hpriv->flags & AHCI_HFLAG_EDGE_IRQ) ?
521-
ahci_single_edge_irq_intr :
522-
ahci_single_level_irq_intr;
518+
hpriv->irq_handler = ahci_single_level_irq_intr;
523519
}
524520
EXPORT_SYMBOL_GPL(ahci_save_initial_config);
525521

@@ -1882,43 +1878,6 @@ u32 ahci_handle_port_intr(struct ata_host *host, u32 irq_masked)
18821878
}
18831879
EXPORT_SYMBOL_GPL(ahci_handle_port_intr);
18841880

1885-
static irqreturn_t ahci_single_edge_irq_intr(int irq, void *dev_instance)
1886-
{
1887-
struct ata_host *host = dev_instance;
1888-
struct ahci_host_priv *hpriv;
1889-
unsigned int rc = 0;
1890-
void __iomem *mmio;
1891-
u32 irq_stat, irq_masked;
1892-
1893-
VPRINTK("ENTER\n");
1894-
1895-
hpriv = host->private_data;
1896-
mmio = hpriv->mmio;
1897-
1898-
/* sigh. 0xffffffff is a valid return from h/w */
1899-
irq_stat = readl(mmio + HOST_IRQ_STAT);
1900-
if (!irq_stat)
1901-
return IRQ_NONE;
1902-
1903-
irq_masked = irq_stat & hpriv->port_map;
1904-
1905-
spin_lock(&host->lock);
1906-
1907-
/*
1908-
* HOST_IRQ_STAT behaves as edge triggered latch meaning that
1909-
* it should be cleared before all the port events are cleared.
1910-
*/
1911-
writel(irq_stat, mmio + HOST_IRQ_STAT);
1912-
1913-
rc = ahci_handle_port_intr(host, irq_masked);
1914-
1915-
spin_unlock(&host->lock);
1916-
1917-
VPRINTK("EXIT\n");
1918-
1919-
return IRQ_RETVAL(rc);
1920-
}
1921-
19221881
static irqreturn_t ahci_single_level_irq_intr(int irq, void *dev_instance)
19231882
{
19241883
struct ata_host *host = dev_instance;

0 commit comments

Comments
 (0)