ide: allow host drivers to specify IRQ flags

* Add ->irq_flags field to struct ide_port_info and struct ide_host.

* Update host drivers and IDE PCI code to use ->irq_flags field.

* Convert init_irq() and ide_intr() to use host->irq_flags.

This fixes handling of shared IRQs for non-PCI hosts
and removes ugly ifdeffery from core IDE code.
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent c7db966b
...@@ -145,6 +145,7 @@ static void __init buddha_setup_ports(hw_regs_t *hw, unsigned long base, ...@@ -145,6 +145,7 @@ static void __init buddha_setup_ports(hw_regs_t *hw, unsigned long base,
static const struct ide_port_info buddha_port_info = { static const struct ide_port_info buddha_port_info = {
.host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
.irq_flags = IRQF_SHARED,
}; };
/* /*
......
...@@ -66,6 +66,7 @@ static const struct ide_port_info delkin_cb_port_info = { ...@@ -66,6 +66,7 @@ static const struct ide_port_info delkin_cb_port_info = {
.port_ops = &delkin_cb_port_ops, .port_ops = &delkin_cb_port_ops,
.host_flags = IDE_HFLAG_IO_32BIT | IDE_HFLAG_UNMASK_IRQS | .host_flags = IDE_HFLAG_IO_32BIT | IDE_HFLAG_UNMASK_IRQS |
IDE_HFLAG_NO_DMA, IDE_HFLAG_NO_DMA,
.irq_flags = IRQF_SHARED,
.init_chipset = delkin_cb_init_chipset, .init_chipset = delkin_cb_init_chipset,
}; };
......
...@@ -105,6 +105,7 @@ static const struct ide_port_info falconide_port_info = { ...@@ -105,6 +105,7 @@ static const struct ide_port_info falconide_port_info = {
.tp_ops = &falconide_tp_ops, .tp_ops = &falconide_tp_ops,
.host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_SERIALIZE | .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_SERIALIZE |
IDE_HFLAG_NO_DMA, IDE_HFLAG_NO_DMA,
.irq_flags = IRQF_SHARED,
}; };
static void __init falconide_setup_ports(hw_regs_t *hw) static void __init falconide_setup_ports(hw_regs_t *hw)
......
...@@ -120,6 +120,7 @@ static void __init gayle_setup_ports(hw_regs_t *hw, unsigned long base, ...@@ -120,6 +120,7 @@ static void __init gayle_setup_ports(hw_regs_t *hw, unsigned long base,
static const struct ide_port_info gayle_port_info = { static const struct ide_port_info gayle_port_info = {
.host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_SERIALIZE | .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_SERIALIZE |
IDE_HFLAG_NO_DMA, IDE_HFLAG_NO_DMA,
.irq_flags = IRQF_SHARED,
}; };
/* /*
......
...@@ -154,6 +154,7 @@ static const struct ide_port_ops idecs_port_ops = { ...@@ -154,6 +154,7 @@ static const struct ide_port_ops idecs_port_ops = {
static const struct ide_port_info idecs_port_info = { static const struct ide_port_info idecs_port_info = {
.port_ops = &idecs_port_ops, .port_ops = &idecs_port_ops,
.host_flags = IDE_HFLAG_NO_DMA, .host_flags = IDE_HFLAG_NO_DMA,
.irq_flags = IRQF_SHARED,
}; };
static struct ide_host *idecs_register(unsigned long io, unsigned long ctl, static struct ide_host *idecs_register(unsigned long io, unsigned long ctl,
......
...@@ -841,6 +841,7 @@ static void unexpected_intr(int irq, ide_hwif_t *hwif) ...@@ -841,6 +841,7 @@ static void unexpected_intr(int irq, ide_hwif_t *hwif)
irqreturn_t ide_intr (int irq, void *dev_id) irqreturn_t ide_intr (int irq, void *dev_id)
{ {
ide_hwif_t *hwif = (ide_hwif_t *)dev_id; ide_hwif_t *hwif = (ide_hwif_t *)dev_id;
struct ide_host *host = hwif->host;
ide_drive_t *uninitialized_var(drive); ide_drive_t *uninitialized_var(drive);
ide_handler_t *handler; ide_handler_t *handler;
unsigned long flags; unsigned long flags;
...@@ -848,8 +849,8 @@ irqreturn_t ide_intr (int irq, void *dev_id) ...@@ -848,8 +849,8 @@ irqreturn_t ide_intr (int irq, void *dev_id)
irqreturn_t irq_ret = IRQ_NONE; irqreturn_t irq_ret = IRQ_NONE;
int plug_device = 0; int plug_device = 0;
if (hwif->host->host_flags & IDE_HFLAG_SERIALIZE) { if (host->host_flags & IDE_HFLAG_SERIALIZE) {
if (hwif != hwif->host->cur_port) if (hwif != host->cur_port)
goto out_early; goto out_early;
} }
...@@ -872,27 +873,19 @@ irqreturn_t ide_intr (int irq, void *dev_id) ...@@ -872,27 +873,19 @@ irqreturn_t ide_intr (int irq, void *dev_id)
* *
* For PCI, we cannot tell the difference, * For PCI, we cannot tell the difference,
* so in that case we just ignore it and hope it goes away. * so in that case we just ignore it and hope it goes away.
*
* FIXME: unexpected_intr should be hwif-> then we can
* remove all the ifdef PCI crap
*/ */
#ifdef CONFIG_BLK_DEV_IDEPCI if ((host->irq_flags & IRQF_SHARED) == 0) {
if (hwif->chipset != ide_pci)
#endif /* CONFIG_BLK_DEV_IDEPCI */
{
/* /*
* Probably not a shared PCI interrupt, * Probably not a shared PCI interrupt,
* so we can safely try to do something about it: * so we can safely try to do something about it:
*/ */
unexpected_intr(irq, hwif); unexpected_intr(irq, hwif);
#ifdef CONFIG_BLK_DEV_IDEPCI
} else { } else {
/* /*
* Whack the status register, just in case * Whack the status register, just in case
* we have a leftover pending IRQ. * we have a leftover pending IRQ.
*/ */
(void)hwif->tp_ops->read_status(hwif); (void)hwif->tp_ops->read_status(hwif);
#endif /* CONFIG_BLK_DEV_IDEPCI */
} }
goto out; goto out;
} }
......
...@@ -837,20 +837,13 @@ static int ide_port_setup_devices(ide_hwif_t *hwif) ...@@ -837,20 +837,13 @@ static int ide_port_setup_devices(ide_hwif_t *hwif)
static int init_irq (ide_hwif_t *hwif) static int init_irq (ide_hwif_t *hwif)
{ {
struct ide_io_ports *io_ports = &hwif->io_ports; struct ide_io_ports *io_ports = &hwif->io_ports;
irq_handler_t irq_handler; struct ide_host *host = hwif->host;
int sa = 0; irq_handler_t irq_handler = host->irq_handler;
int sa = host->irq_flags;
irq_handler = hwif->host->irq_handler;
if (irq_handler == NULL) if (irq_handler == NULL)
irq_handler = ide_intr; irq_handler = ide_intr;
#if defined(__mc68000__)
sa = IRQF_SHARED;
#endif /* __mc68000__ */
if (hwif->chipset == ide_pci)
sa = IRQF_SHARED;
if (io_ports->ctl_addr) if (io_ports->ctl_addr)
hwif->tp_ops->set_irq(hwif, 1); hwif->tp_ops->set_irq(hwif, 1);
......
...@@ -82,6 +82,7 @@ static void __init macide_setup_ports(hw_regs_t *hw, unsigned long base, ...@@ -82,6 +82,7 @@ static void __init macide_setup_ports(hw_regs_t *hw, unsigned long base,
static const struct ide_port_info macide_port_info = { static const struct ide_port_info macide_port_info = {
.host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
.irq_flags = IRQF_SHARED,
}; };
static const char *mac_ide_name[] = static const char *mac_ide_name[] =
......
...@@ -112,6 +112,7 @@ static const struct ide_tp_ops q40ide_tp_ops = { ...@@ -112,6 +112,7 @@ static const struct ide_tp_ops q40ide_tp_ops = {
static const struct ide_port_info q40ide_port_info = { static const struct ide_port_info q40ide_port_info = {
.tp_ops = &q40ide_tp_ops, .tp_ops = &q40ide_tp_ops,
.host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
.irq_flags = IRQF_SHARED,
}; };
/* /*
......
...@@ -891,6 +891,7 @@ static const struct ide_port_info scc_chipset __devinitdata = { ...@@ -891,6 +891,7 @@ static const struct ide_port_info scc_chipset __devinitdata = {
.port_ops = &scc_port_ops, .port_ops = &scc_port_ops,
.dma_ops = &scc_dma_ops, .dma_ops = &scc_dma_ops,
.host_flags = IDE_HFLAG_SINGLE, .host_flags = IDE_HFLAG_SINGLE,
.irq_flags = IRQF_SHARED,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
}; };
......
...@@ -558,6 +558,8 @@ int ide_pci_init_one(struct pci_dev *dev, const struct ide_port_info *d, ...@@ -558,6 +558,8 @@ int ide_pci_init_one(struct pci_dev *dev, const struct ide_port_info *d,
host->host_priv = priv; host->host_priv = priv;
host->irq_flags = IRQF_SHARED;
pci_set_drvdata(dev, host); pci_set_drvdata(dev, host);
ret = do_ide_setup_pci_device(dev, d, 1); ret = do_ide_setup_pci_device(dev, d, 1);
...@@ -606,6 +608,8 @@ int ide_pci_init_two(struct pci_dev *dev1, struct pci_dev *dev2, ...@@ -606,6 +608,8 @@ int ide_pci_init_two(struct pci_dev *dev1, struct pci_dev *dev2,
host->host_priv = priv; host->host_priv = priv;
host->irq_flags = IRQF_SHARED;
pci_set_drvdata(pdev[0], host); pci_set_drvdata(pdev[0], host);
pci_set_drvdata(pdev[1], host); pci_set_drvdata(pdev[1], host);
......
...@@ -557,6 +557,7 @@ static const struct ide_port_info sgiioc4_port_info __devinitconst = { ...@@ -557,6 +557,7 @@ static const struct ide_port_info sgiioc4_port_info __devinitconst = {
.port_ops = &sgiioc4_port_ops, .port_ops = &sgiioc4_port_ops,
.dma_ops = &sgiioc4_dma_ops, .dma_ops = &sgiioc4_dma_ops,
.host_flags = IDE_HFLAG_MMIO, .host_flags = IDE_HFLAG_MMIO,
.irq_flags = IRQF_SHARED,
.mwdma_mask = ATA_MWDMA2_ONLY, .mwdma_mask = ATA_MWDMA2_ONLY,
}; };
......
...@@ -839,6 +839,9 @@ struct ide_host { ...@@ -839,6 +839,9 @@ struct ide_host {
irq_handler_t irq_handler; irq_handler_t irq_handler;
unsigned long host_flags; unsigned long host_flags;
int irq_flags;
void *host_priv; void *host_priv;
ide_hwif_t *cur_port; /* for hosts requiring serialization */ ide_hwif_t *cur_port; /* for hosts requiring serialization */
...@@ -1371,6 +1374,9 @@ struct ide_port_info { ...@@ -1371,6 +1374,9 @@ struct ide_port_info {
u16 max_sectors; /* if < than the default one */ u16 max_sectors; /* if < than the default one */
u32 host_flags; u32 host_flags;
int irq_flags;
u8 pio_mask; u8 pio_mask;
u8 swdma_mask; u8 swdma_mask;
u8 mwdma_mask; u8 mwdma_mask;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment