aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/gayle.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/gayle.c')
-rw-r--r--drivers/ide/gayle.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/ide/gayle.c b/drivers/ide/gayle.c
index 4451a6a5dfe0..c5dd1e5cca4d 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_ack_intr(ide_hwif_t *hwif)
70{ 70{
71 unsigned char ch; 71 unsigned char ch;
72 72
@@ -76,16 +76,12 @@ 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,
@@ -108,6 +104,10 @@ static void __init gayle_setup_ports(struct ide_hw *hw, unsigned long base,
108 hw->ack_intr = ack_intr; 104 hw->ack_intr = ack_intr;
109} 105}
110 106
107static const struct ide_port_ops gayle_a1200_port_ops = {
108 .clear_irq = gayle_a1200_clear_irq,
109};
110
111static const struct ide_port_info gayle_port_info = { 111static const struct ide_port_info gayle_port_info = {
112 .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_SERIALIZE | 112 .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_SERIALIZE |
113 IDE_HFLAG_NO_DMA, 113 IDE_HFLAG_NO_DMA,
@@ -123,9 +123,9 @@ static int __init gayle_init(void)
123{ 123{
124 unsigned long phys_base, res_start, res_n; 124 unsigned long phys_base, res_start, res_n;
125 unsigned long base, ctrlport, irqport; 125 unsigned long base, ctrlport, irqport;
126 ide_ack_intr_t *ack_intr;
127 int a4000, i, rc; 126 int a4000, i, rc;
128 struct ide_hw hw[GAYLE_NUM_HWIFS], *hws[GAYLE_NUM_HWIFS]; 127 struct ide_hw hw[GAYLE_NUM_HWIFS], *hws[GAYLE_NUM_HWIFS];
128 struct ide_port_info d = gayle_port_info;
129 129
130 if (!MACH_IS_AMIGA) 130 if (!MACH_IS_AMIGA)
131 return -ENODEV; 131 return -ENODEV;
@@ -148,11 +148,10 @@ found:
148 if (a4000) { 148 if (a4000) {
149 phys_base = GAYLE_BASE_4000; 149 phys_base = GAYLE_BASE_4000;
150 irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_4000); 150 irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_4000);
151 ack_intr = gayle_ack_intr_a4000;
152 } else { 151 } else {
153 phys_base = GAYLE_BASE_1200; 152 phys_base = GAYLE_BASE_1200;
154 irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_1200); 153 irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_1200);
155 ack_intr = gayle_ack_intr_a1200; 154 d.port_ops = &gayle_a1200_port_ops;
156 } 155 }
157 156
158 res_start = ((unsigned long)phys_base) & ~(GAYLE_NEXT_PORT-1); 157 res_start = ((unsigned long)phys_base) & ~(GAYLE_NEXT_PORT-1);
@@ -165,12 +164,12 @@ found:
165 base = (unsigned long)ZTWO_VADDR(phys_base + i * GAYLE_NEXT_PORT); 164 base = (unsigned long)ZTWO_VADDR(phys_base + i * GAYLE_NEXT_PORT);
166 ctrlport = GAYLE_HAS_CONTROL_REG ? (base + GAYLE_CONTROL) : 0; 165 ctrlport = GAYLE_HAS_CONTROL_REG ? (base + GAYLE_CONTROL) : 0;
167 166
168 gayle_setup_ports(&hw[i], base, ctrlport, irqport, ack_intr); 167 gayle_setup_ports(&hw[i], base, ctrlport, irqport, gayle_ack_intr);
169 168
170 hws[i] = &hw[i]; 169 hws[i] = &hw[i];
171 } 170 }
172 171
173 rc = ide_host_add(&gayle_port_info, hws, i, NULL); 172 rc = ide_host_add(&d, hws, i, NULL);
174 if (rc) 173 if (rc)
175 release_mem_region(res_start, res_n); 174 release_mem_region(res_start, res_n);
176 175