aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/gayle.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-06-20 13:11:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-20 13:11:11 -0400
commite6423407d01168f7760cdee7270d9f51d1240301 (patch)
tree979795cfa8f6946238ab31f544159142f3e7df93 /drivers/ide/gayle.c
parent7f8189068726492950bf1a2dcfd9b51314560abf (diff)
parent39c58f37a10198054c656c28202fb1e6d22fd505 (diff)
Merge branch 'for-2.6.31' of git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* 'for-2.6.31' of git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (34 commits) ide-cd: prevent null pointer deref via cdrom_newpc_intr ide: BUG() on unknown requests ide: filter out invalid DMA xfer mode changes in HDIO_DRIVE_CMD ioctl handler ide: do not access ide_drive_t 'drive_data' field directly sl82c105: implement test_irq() method siimage: implement test_irq() method pdc202xx_old: implement test_irq() method (take 2) cmd64x: implement test_irq() method cmd640: implement test_irq() method ide: move ack_intr() method into 'struct ide_port_ops' (take 2) ide: move IRQ clearing from ack_intr() method to clear_irq() method (take 2) siimage: use ide_dma_test_irq() (take 2) cmd64x: implement clear_irq() method (take 2) ide: call clear_irq() method in ide_timer_expiry() sgiioc4: coding style cleanup ide: don't enable IORDY at a probe time ide: IORDY handling fixes ata: add ata_id_pio_need_iordy() helper (v2) ide-tape: fix build issue ide: unify interrupt reason checking ...
Diffstat (limited to 'drivers/ide/gayle.c')
-rw-r--r--drivers/ide/gayle.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/drivers/ide/gayle.c b/drivers/ide/gayle.c
index 4451a6a5dfe0..b9e517de6a82 100644
--- a/drivers/ide/gayle.c
+++ b/drivers/ide/gayle.c
@@ -66,7 +66,7 @@ MODULE_PARM_DESC(doubler, "enable support for IDE doublers");
66 * Check and acknowledge the interrupt status 66 * Check and acknowledge the interrupt status
67 */ 67 */
68 68
69static int gayle_ack_intr_a4000(ide_hwif_t *hwif) 69static int gayle_test_irq(ide_hwif_t *hwif)
70{ 70{
71 unsigned char ch; 71 unsigned char ch;
72 72
@@ -76,21 +76,16 @@ static int gayle_ack_intr_a4000(ide_hwif_t *hwif)
76 return 1; 76 return 1;
77} 77}
78 78
79static int gayle_ack_intr_a1200(ide_hwif_t *hwif) 79static void gayle_a1200_clear_irq(ide_drive_t *drive)
80{ 80{
81 unsigned char ch; 81 ide_hwif_t *hwif = drive->hwif;
82 82
83 ch = z_readb(hwif->io_ports.irq_addr);
84 if (!(ch & GAYLE_IRQ_IDE))
85 return 0;
86 (void)z_readb(hwif->io_ports.status_addr); 83 (void)z_readb(hwif->io_ports.status_addr);
87 z_writeb(0x7c, hwif->io_ports.irq_addr); 84 z_writeb(0x7c, hwif->io_ports.irq_addr);
88 return 1;
89} 85}
90 86
91static void __init gayle_setup_ports(struct ide_hw *hw, unsigned long base, 87static void __init gayle_setup_ports(struct ide_hw *hw, unsigned long base,
92 unsigned long ctl, unsigned long irq_port, 88 unsigned long ctl, unsigned long irq_port)
93 ide_ack_intr_t *ack_intr)
94{ 89{
95 int i; 90 int i;
96 91
@@ -105,9 +100,17 @@ static void __init gayle_setup_ports(struct ide_hw *hw, unsigned long base,
105 hw->io_ports.irq_addr = irq_port; 100 hw->io_ports.irq_addr = irq_port;
106 101
107 hw->irq = IRQ_AMIGA_PORTS; 102 hw->irq = IRQ_AMIGA_PORTS;
108 hw->ack_intr = ack_intr;
109} 103}
110 104
105static const struct ide_port_ops gayle_a4000_port_ops = {
106 .test_irq = gayle_test_irq,
107};
108
109static const struct ide_port_ops gayle_a1200_port_ops = {
110 .clear_irq = gayle_a1200_clear_irq,
111 .test_irq = gayle_test_irq,
112};
113
111static const struct ide_port_info gayle_port_info = { 114static const struct ide_port_info gayle_port_info = {
112 .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_SERIALIZE | 115 .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_SERIALIZE |
113 IDE_HFLAG_NO_DMA, 116 IDE_HFLAG_NO_DMA,
@@ -123,9 +126,9 @@ static int __init gayle_init(void)
123{ 126{
124 unsigned long phys_base, res_start, res_n; 127 unsigned long phys_base, res_start, res_n;
125 unsigned long base, ctrlport, irqport; 128 unsigned long base, ctrlport, irqport;
126 ide_ack_intr_t *ack_intr;
127 int a4000, i, rc; 129 int a4000, i, rc;
128 struct ide_hw hw[GAYLE_NUM_HWIFS], *hws[GAYLE_NUM_HWIFS]; 130 struct ide_hw hw[GAYLE_NUM_HWIFS], *hws[GAYLE_NUM_HWIFS];
131 struct ide_port_info d = gayle_port_info;
129 132
130 if (!MACH_IS_AMIGA) 133 if (!MACH_IS_AMIGA)
131 return -ENODEV; 134 return -ENODEV;
@@ -148,11 +151,11 @@ found:
148 if (a4000) { 151 if (a4000) {
149 phys_base = GAYLE_BASE_4000; 152 phys_base = GAYLE_BASE_4000;
150 irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_4000); 153 irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_4000);
151 ack_intr = gayle_ack_intr_a4000; 154 d.port_ops = &gayle_a4000_port_ops;
152 } else { 155 } else {
153 phys_base = GAYLE_BASE_1200; 156 phys_base = GAYLE_BASE_1200;
154 irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_1200); 157 irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_1200);
155 ack_intr = gayle_ack_intr_a1200; 158 d.port_ops = &gayle_a1200_port_ops;
156 } 159 }
157 160
158 res_start = ((unsigned long)phys_base) & ~(GAYLE_NEXT_PORT-1); 161 res_start = ((unsigned long)phys_base) & ~(GAYLE_NEXT_PORT-1);
@@ -165,12 +168,12 @@ found:
165 base = (unsigned long)ZTWO_VADDR(phys_base + i * GAYLE_NEXT_PORT); 168 base = (unsigned long)ZTWO_VADDR(phys_base + i * GAYLE_NEXT_PORT);
166 ctrlport = GAYLE_HAS_CONTROL_REG ? (base + GAYLE_CONTROL) : 0; 169 ctrlport = GAYLE_HAS_CONTROL_REG ? (base + GAYLE_CONTROL) : 0;
167 170
168 gayle_setup_ports(&hw[i], base, ctrlport, irqport, ack_intr); 171 gayle_setup_ports(&hw[i], base, ctrlport, irqport);
169 172
170 hws[i] = &hw[i]; 173 hws[i] = &hw[i];
171 } 174 }
172 175
173 rc = ide_host_add(&gayle_port_info, hws, i, NULL); 176 rc = ide_host_add(&d, hws, i, NULL);
174 if (rc) 177 if (rc)
175 release_mem_region(res_start, res_n); 178 release_mem_region(res_start, res_n);
176 179