diff options
author | Mark Lord <liml@rtr.ca> | 2008-04-25 11:24:24 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-04-29 02:17:14 -0400 |
commit | 7368f91926a2870a8c3f9546d86535ce71ae0757 (patch) | |
tree | 3b7bd0afd98bb1344114fea79b69f6e97cec5875 /drivers/ata | |
parent | 87340e98345155631f7a1a4d8d66cf0ab286cb1b (diff) |
sata_mv: Improve naming of main_irq cause/mask identifiers
Tidy up naming of things associated with the PCI / SOC chip
"main irq cause/mask" registers, as inspired by Jeff.
Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/sata_mv.c | 77 |
1 files changed, 39 insertions, 38 deletions
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 26a6337195b3..842b1a15b78c 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -172,10 +172,11 @@ enum { | |||
172 | PCIE_IRQ_MASK_OFS = 0x1910, | 172 | PCIE_IRQ_MASK_OFS = 0x1910, |
173 | PCIE_UNMASK_ALL_IRQS = 0x40a, /* assorted bits */ | 173 | PCIE_UNMASK_ALL_IRQS = 0x40a, /* assorted bits */ |
174 | 174 | ||
175 | HC_MAIN_IRQ_CAUSE_OFS = 0x1d60, | 175 | /* Host Controller Main Interrupt Cause/Mask registers (1 per-chip) */ |
176 | HC_MAIN_IRQ_MASK_OFS = 0x1d64, | 176 | PCI_HC_MAIN_IRQ_CAUSE_OFS = 0x1d60, |
177 | HC_SOC_MAIN_IRQ_CAUSE_OFS = 0x20020, | 177 | PCI_HC_MAIN_IRQ_MASK_OFS = 0x1d64, |
178 | HC_SOC_MAIN_IRQ_MASK_OFS = 0x20024, | 178 | SOC_HC_MAIN_IRQ_CAUSE_OFS = 0x20020, |
179 | SOC_HC_MAIN_IRQ_MASK_OFS = 0x20024, | ||
179 | ERR_IRQ = (1 << 0), /* shift by port # */ | 180 | ERR_IRQ = (1 << 0), /* shift by port # */ |
180 | DONE_IRQ = (1 << 1), /* shift by port # */ | 181 | DONE_IRQ = (1 << 1), /* shift by port # */ |
181 | HC0_IRQ_PEND = 0x1ff, /* bits 0-8 = HC0's ports */ | 182 | HC0_IRQ_PEND = 0x1ff, /* bits 0-8 = HC0's ports */ |
@@ -445,8 +446,8 @@ struct mv_host_priv { | |||
445 | const struct mv_hw_ops *ops; | 446 | const struct mv_hw_ops *ops; |
446 | int n_ports; | 447 | int n_ports; |
447 | void __iomem *base; | 448 | void __iomem *base; |
448 | void __iomem *main_cause_reg_addr; | 449 | void __iomem *main_irq_cause_addr; |
449 | void __iomem *main_mask_reg_addr; | 450 | void __iomem *main_irq_mask_addr; |
450 | u32 irq_cause_ofs; | 451 | u32 irq_cause_ofs; |
451 | u32 irq_mask_ofs; | 452 | u32 irq_mask_ofs; |
452 | u32 unmask_all_irqs; | 453 | u32 unmask_all_irqs; |
@@ -727,8 +728,8 @@ static inline unsigned int mv_hardport_from_port(unsigned int port) | |||
727 | * Simple code, with two return values, so macro rather than inline. | 728 | * Simple code, with two return values, so macro rather than inline. |
728 | * | 729 | * |
729 | * port is the sole input, in range 0..7. | 730 | * port is the sole input, in range 0..7. |
730 | * shift is one output, for use with the main_cause and main_mask registers. | 731 | * shift is one output, for use with main_irq_cause / main_irq_mask registers. |
731 | * hardport is the other output, in range 0..3 | 732 | * hardport is the other output, in range 0..3. |
732 | * | 733 | * |
733 | * Note that port and hardport may be the same variable in some cases. | 734 | * Note that port and hardport may be the same variable in some cases. |
734 | */ | 735 | */ |
@@ -1679,12 +1680,12 @@ static void mv_process_crpb_entries(struct ata_port *ap, struct mv_port_priv *pp | |||
1679 | /** | 1680 | /** |
1680 | * mv_host_intr - Handle all interrupts on the given host controller | 1681 | * mv_host_intr - Handle all interrupts on the given host controller |
1681 | * @host: host specific structure | 1682 | * @host: host specific structure |
1682 | * @main_cause: Main interrupt cause register for the chip. | 1683 | * @main_irq_cause: Main interrupt cause register for the chip. |
1683 | * | 1684 | * |
1684 | * LOCKING: | 1685 | * LOCKING: |
1685 | * Inherited from caller. | 1686 | * Inherited from caller. |
1686 | */ | 1687 | */ |
1687 | static int mv_host_intr(struct ata_host *host, u32 main_cause) | 1688 | static int mv_host_intr(struct ata_host *host, u32 main_irq_cause) |
1688 | { | 1689 | { |
1689 | struct mv_host_priv *hpriv = host->private_data; | 1690 | struct mv_host_priv *hpriv = host->private_data; |
1690 | void __iomem *mmio = hpriv->base, *hc_mmio = NULL; | 1691 | void __iomem *mmio = hpriv->base, *hc_mmio = NULL; |
@@ -1705,7 +1706,7 @@ static int mv_host_intr(struct ata_host *host, u32 main_cause) | |||
1705 | * Do nothing if port is not interrupting or is disabled: | 1706 | * Do nothing if port is not interrupting or is disabled: |
1706 | */ | 1707 | */ |
1707 | MV_PORT_TO_SHIFT_AND_HARDPORT(port, shift, hardport); | 1708 | MV_PORT_TO_SHIFT_AND_HARDPORT(port, shift, hardport); |
1708 | port_cause = (main_cause >> shift) & (DONE_IRQ | ERR_IRQ); | 1709 | port_cause = (main_irq_cause >> shift) & (DONE_IRQ | ERR_IRQ); |
1709 | if (!port_cause || !ap || (ap->flags & ATA_FLAG_DISABLED)) | 1710 | if (!port_cause || !ap || (ap->flags & ATA_FLAG_DISABLED)) |
1710 | continue; | 1711 | continue; |
1711 | /* | 1712 | /* |
@@ -1811,20 +1812,20 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance) | |||
1811 | struct ata_host *host = dev_instance; | 1812 | struct ata_host *host = dev_instance; |
1812 | struct mv_host_priv *hpriv = host->private_data; | 1813 | struct mv_host_priv *hpriv = host->private_data; |
1813 | unsigned int handled = 0; | 1814 | unsigned int handled = 0; |
1814 | u32 main_cause, main_mask; | 1815 | u32 main_irq_cause, main_irq_mask; |
1815 | 1816 | ||
1816 | spin_lock(&host->lock); | 1817 | spin_lock(&host->lock); |
1817 | main_cause = readl(hpriv->main_cause_reg_addr); | 1818 | main_irq_cause = readl(hpriv->main_irq_cause_addr); |
1818 | main_mask = readl(hpriv->main_mask_reg_addr); | 1819 | main_irq_mask = readl(hpriv->main_irq_mask_addr); |
1819 | /* | 1820 | /* |
1820 | * Deal with cases where we either have nothing pending, or have read | 1821 | * Deal with cases where we either have nothing pending, or have read |
1821 | * a bogus register value which can indicate HW removal or PCI fault. | 1822 | * a bogus register value which can indicate HW removal or PCI fault. |
1822 | */ | 1823 | */ |
1823 | if ((main_cause & main_mask) && (main_cause != 0xffffffffU)) { | 1824 | if ((main_irq_cause & main_irq_mask) && (main_irq_cause != 0xffffffffU)) { |
1824 | if (unlikely((main_cause & PCI_ERR) && HAS_PCI(host))) | 1825 | if (unlikely((main_irq_cause & PCI_ERR) && HAS_PCI(host))) |
1825 | handled = mv_pci_error(host, hpriv->base); | 1826 | handled = mv_pci_error(host, hpriv->base); |
1826 | else | 1827 | else |
1827 | handled = mv_host_intr(host, main_cause); | 1828 | handled = mv_host_intr(host, main_irq_cause); |
1828 | } | 1829 | } |
1829 | spin_unlock(&host->lock); | 1830 | spin_unlock(&host->lock); |
1830 | return IRQ_RETVAL(handled); | 1831 | return IRQ_RETVAL(handled); |
@@ -2027,7 +2028,7 @@ static void mv_reset_pci_bus(struct ata_host *host, void __iomem *mmio) | |||
2027 | ZERO(MV_PCI_DISC_TIMER); | 2028 | ZERO(MV_PCI_DISC_TIMER); |
2028 | ZERO(MV_PCI_MSI_TRIGGER); | 2029 | ZERO(MV_PCI_MSI_TRIGGER); |
2029 | writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT); | 2030 | writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT); |
2030 | ZERO(HC_MAIN_IRQ_MASK_OFS); | 2031 | ZERO(PCI_HC_MAIN_IRQ_MASK_OFS); |
2031 | ZERO(MV_PCI_SERR_MASK); | 2032 | ZERO(MV_PCI_SERR_MASK); |
2032 | ZERO(hpriv->irq_cause_ofs); | 2033 | ZERO(hpriv->irq_cause_ofs); |
2033 | ZERO(hpriv->irq_mask_ofs); | 2034 | ZERO(hpriv->irq_mask_ofs); |
@@ -2404,7 +2405,7 @@ static void mv_eh_freeze(struct ata_port *ap) | |||
2404 | { | 2405 | { |
2405 | struct mv_host_priv *hpriv = ap->host->private_data; | 2406 | struct mv_host_priv *hpriv = ap->host->private_data; |
2406 | unsigned int shift, hardport, port = ap->port_no; | 2407 | unsigned int shift, hardport, port = ap->port_no; |
2407 | u32 main_mask; | 2408 | u32 main_irq_mask; |
2408 | 2409 | ||
2409 | /* FIXME: handle coalescing completion events properly */ | 2410 | /* FIXME: handle coalescing completion events properly */ |
2410 | 2411 | ||
@@ -2412,9 +2413,9 @@ static void mv_eh_freeze(struct ata_port *ap) | |||
2412 | MV_PORT_TO_SHIFT_AND_HARDPORT(port, shift, hardport); | 2413 | MV_PORT_TO_SHIFT_AND_HARDPORT(port, shift, hardport); |
2413 | 2414 | ||
2414 | /* disable assertion of portN err, done events */ | 2415 | /* disable assertion of portN err, done events */ |
2415 | main_mask = readl(hpriv->main_mask_reg_addr); | 2416 | main_irq_mask = readl(hpriv->main_irq_mask_addr); |
2416 | main_mask &= ~((DONE_IRQ | ERR_IRQ) << shift); | 2417 | main_irq_mask &= ~((DONE_IRQ | ERR_IRQ) << shift); |
2417 | writelfl(main_mask, hpriv->main_mask_reg_addr); | 2418 | writelfl(main_irq_mask, hpriv->main_irq_mask_addr); |
2418 | } | 2419 | } |
2419 | 2420 | ||
2420 | static void mv_eh_thaw(struct ata_port *ap) | 2421 | static void mv_eh_thaw(struct ata_port *ap) |
@@ -2423,7 +2424,7 @@ static void mv_eh_thaw(struct ata_port *ap) | |||
2423 | unsigned int shift, hardport, port = ap->port_no; | 2424 | unsigned int shift, hardport, port = ap->port_no; |
2424 | void __iomem *hc_mmio = mv_hc_base_from_port(hpriv->base, port); | 2425 | void __iomem *hc_mmio = mv_hc_base_from_port(hpriv->base, port); |
2425 | void __iomem *port_mmio = mv_ap_base(ap); | 2426 | void __iomem *port_mmio = mv_ap_base(ap); |
2426 | u32 main_mask, hc_irq_cause; | 2427 | u32 main_irq_mask, hc_irq_cause; |
2427 | 2428 | ||
2428 | /* FIXME: handle coalescing completion events properly */ | 2429 | /* FIXME: handle coalescing completion events properly */ |
2429 | 2430 | ||
@@ -2438,9 +2439,9 @@ static void mv_eh_thaw(struct ata_port *ap) | |||
2438 | writelfl(hc_irq_cause, hc_mmio + HC_IRQ_CAUSE_OFS); | 2439 | writelfl(hc_irq_cause, hc_mmio + HC_IRQ_CAUSE_OFS); |
2439 | 2440 | ||
2440 | /* enable assertion of portN err, done events */ | 2441 | /* enable assertion of portN err, done events */ |
2441 | main_mask = readl(hpriv->main_mask_reg_addr); | 2442 | main_irq_mask = readl(hpriv->main_irq_mask_addr); |
2442 | main_mask |= ((DONE_IRQ | ERR_IRQ) << shift); | 2443 | main_irq_mask |= ((DONE_IRQ | ERR_IRQ) << shift); |
2443 | writelfl(main_mask, hpriv->main_mask_reg_addr); | 2444 | writelfl(main_irq_mask, hpriv->main_irq_mask_addr); |
2444 | } | 2445 | } |
2445 | 2446 | ||
2446 | /** | 2447 | /** |
@@ -2654,15 +2655,15 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx) | |||
2654 | goto done; | 2655 | goto done; |
2655 | 2656 | ||
2656 | if (HAS_PCI(host)) { | 2657 | if (HAS_PCI(host)) { |
2657 | hpriv->main_cause_reg_addr = mmio + HC_MAIN_IRQ_CAUSE_OFS; | 2658 | hpriv->main_irq_cause_addr = mmio + PCI_HC_MAIN_IRQ_CAUSE_OFS; |
2658 | hpriv->main_mask_reg_addr = mmio + HC_MAIN_IRQ_MASK_OFS; | 2659 | hpriv->main_irq_mask_addr = mmio + PCI_HC_MAIN_IRQ_MASK_OFS; |
2659 | } else { | 2660 | } else { |
2660 | hpriv->main_cause_reg_addr = mmio + HC_SOC_MAIN_IRQ_CAUSE_OFS; | 2661 | hpriv->main_irq_cause_addr = mmio + SOC_HC_MAIN_IRQ_CAUSE_OFS; |
2661 | hpriv->main_mask_reg_addr = mmio + HC_SOC_MAIN_IRQ_MASK_OFS; | 2662 | hpriv->main_irq_mask_addr = mmio + SOC_HC_MAIN_IRQ_MASK_OFS; |
2662 | } | 2663 | } |
2663 | 2664 | ||
2664 | /* global interrupt mask: 0 == mask everything */ | 2665 | /* global interrupt mask: 0 == mask everything */ |
2665 | writel(0, hpriv->main_mask_reg_addr); | 2666 | writel(0, hpriv->main_irq_mask_addr); |
2666 | 2667 | ||
2667 | n_hc = mv_get_hc_count(host->ports[0]->flags); | 2668 | n_hc = mv_get_hc_count(host->ports[0]->flags); |
2668 | 2669 | ||
@@ -2712,23 +2713,23 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx) | |||
2712 | writelfl(hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); | 2713 | writelfl(hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); |
2713 | if (IS_GEN_I(hpriv)) | 2714 | if (IS_GEN_I(hpriv)) |
2714 | writelfl(~HC_MAIN_MASKED_IRQS_5, | 2715 | writelfl(~HC_MAIN_MASKED_IRQS_5, |
2715 | hpriv->main_mask_reg_addr); | 2716 | hpriv->main_irq_mask_addr); |
2716 | else | 2717 | else |
2717 | writelfl(~HC_MAIN_MASKED_IRQS, | 2718 | writelfl(~HC_MAIN_MASKED_IRQS, |
2718 | hpriv->main_mask_reg_addr); | 2719 | hpriv->main_irq_mask_addr); |
2719 | 2720 | ||
2720 | VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x " | 2721 | VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x " |
2721 | "PCI int cause/mask=0x%08x/0x%08x\n", | 2722 | "PCI int cause/mask=0x%08x/0x%08x\n", |
2722 | readl(hpriv->main_cause_reg_addr), | 2723 | readl(hpriv->main_irq_cause_addr), |
2723 | readl(hpriv->main_mask_reg_addr), | 2724 | readl(hpriv->main_irq_mask_addr), |
2724 | readl(mmio + hpriv->irq_cause_ofs), | 2725 | readl(mmio + hpriv->irq_cause_ofs), |
2725 | readl(mmio + hpriv->irq_mask_ofs)); | 2726 | readl(mmio + hpriv->irq_mask_ofs)); |
2726 | } else { | 2727 | } else { |
2727 | writelfl(~HC_MAIN_MASKED_IRQS_SOC, | 2728 | writelfl(~HC_MAIN_MASKED_IRQS_SOC, |
2728 | hpriv->main_mask_reg_addr); | 2729 | hpriv->main_irq_mask_addr); |
2729 | VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x\n", | 2730 | VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x\n", |
2730 | readl(hpriv->main_cause_reg_addr), | 2731 | readl(hpriv->main_irq_cause_addr), |
2731 | readl(hpriv->main_mask_reg_addr)); | 2732 | readl(hpriv->main_irq_mask_addr)); |
2732 | } | 2733 | } |
2733 | done: | 2734 | done: |
2734 | return rc; | 2735 | return rc; |