aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/icside.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/icside.c')
-rw-r--r--drivers/ide/icside.c77
1 files changed, 11 insertions, 66 deletions
diff --git a/drivers/ide/icside.c b/drivers/ide/icside.c
index 36da913cc553..5af3d0ffaf0a 100644
--- a/drivers/ide/icside.c
+++ b/drivers/ide/icside.c
@@ -65,8 +65,6 @@ static struct cardinfo icside_cardinfo_v6_2 = {
65}; 65};
66 66
67struct icside_state { 67struct icside_state {
68 unsigned int channel;
69 unsigned int enabled;
70 void __iomem *irq_port; 68 void __iomem *irq_port;
71 void __iomem *ioc_base; 69 void __iomem *ioc_base;
72 unsigned int sel; 70 unsigned int sel;
@@ -116,18 +114,11 @@ static void icside_irqenable_arcin_v6 (struct expansion_card *ec, int irqnr)
116 struct icside_state *state = ec->irq_data; 114 struct icside_state *state = ec->irq_data;
117 void __iomem *base = state->irq_port; 115 void __iomem *base = state->irq_port;
118 116
119 state->enabled = 1; 117 writeb(0, base + ICS_ARCIN_V6_INTROFFSET_1);
118 readb(base + ICS_ARCIN_V6_INTROFFSET_2);
120 119
121 switch (state->channel) { 120 writeb(0, base + ICS_ARCIN_V6_INTROFFSET_2);
122 case 0: 121 readb(base + ICS_ARCIN_V6_INTROFFSET_1);
123 writeb(0, base + ICS_ARCIN_V6_INTROFFSET_1);
124 readb(base + ICS_ARCIN_V6_INTROFFSET_2);
125 break;
126 case 1:
127 writeb(0, base + ICS_ARCIN_V6_INTROFFSET_2);
128 readb(base + ICS_ARCIN_V6_INTROFFSET_1);
129 break;
130 }
131} 122}
132 123
133/* Prototype: icside_irqdisable_arcin_v6 (struct expansion_card *ec, int irqnr) 124/* Prototype: icside_irqdisable_arcin_v6 (struct expansion_card *ec, int irqnr)
@@ -137,8 +128,6 @@ static void icside_irqdisable_arcin_v6 (struct expansion_card *ec, int irqnr)
137{ 128{
138 struct icside_state *state = ec->irq_data; 129 struct icside_state *state = ec->irq_data;
139 130
140 state->enabled = 0;
141
142 readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_1); 131 readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_1);
143 readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_2); 132 readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_2);
144} 133}
@@ -160,44 +149,6 @@ static const expansioncard_ops_t icside_ops_arcin_v6 = {
160 .irqpending = icside_irqpending_arcin_v6, 149 .irqpending = icside_irqpending_arcin_v6,
161}; 150};
162 151
163/*
164 * Handle routing of interrupts. This is called before
165 * we write the command to the drive.
166 */
167static void icside_maskproc(ide_drive_t *drive, int mask)
168{
169 ide_hwif_t *hwif = drive->hwif;
170 struct expansion_card *ec = ECARD_DEV(hwif->dev);
171 struct icside_state *state = ecard_get_drvdata(ec);
172 unsigned long flags;
173
174 local_irq_save(flags);
175
176 state->channel = hwif->channel;
177
178 if (state->enabled && !mask) {
179 switch (hwif->channel) {
180 case 0:
181 writeb(0, state->irq_port + ICS_ARCIN_V6_INTROFFSET_1);
182 readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_2);
183 break;
184 case 1:
185 writeb(0, state->irq_port + ICS_ARCIN_V6_INTROFFSET_2);
186 readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_1);
187 break;
188 }
189 } else {
190 readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_2);
191 readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_1);
192 }
193
194 local_irq_restore(flags);
195}
196
197static const struct ide_port_ops icside_v6_no_dma_port_ops = {
198 .maskproc = icside_maskproc,
199};
200
201#ifdef CONFIG_BLK_DEV_IDEDMA_ICS 152#ifdef CONFIG_BLK_DEV_IDEDMA_ICS
202/* 153/*
203 * SG-DMA support. 154 * SG-DMA support.
@@ -275,7 +226,6 @@ static void icside_set_dma_mode(ide_drive_t *drive, const u8 xfer_mode)
275 226
276static const struct ide_port_ops icside_v6_port_ops = { 227static const struct ide_port_ops icside_v6_port_ops = {
277 .set_dma_mode = icside_set_dma_mode, 228 .set_dma_mode = icside_set_dma_mode,
278 .maskproc = icside_maskproc,
279}; 229};
280 230
281static void icside_dma_host_set(ide_drive_t *drive, int on) 231static void icside_dma_host_set(ide_drive_t *drive, int on)
@@ -320,11 +270,6 @@ static int icside_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd)
320 BUG_ON(dma_channel_active(ec->dma)); 270 BUG_ON(dma_channel_active(ec->dma));
321 271
322 /* 272 /*
323 * Ensure that we have the right interrupt routed.
324 */
325 icside_maskproc(drive, 0);
326
327 /*
328 * Route the DMA signals to the correct interface. 273 * Route the DMA signals to the correct interface.
329 */ 274 */
330 writeb(state->sel | hwif->channel, state->ioc_base); 275 writeb(state->sel | hwif->channel, state->ioc_base);
@@ -381,7 +326,7 @@ static int icside_dma_off_init(ide_hwif_t *hwif, const struct ide_port_info *d)
381 return -EOPNOTSUPP; 326 return -EOPNOTSUPP;
382} 327}
383 328
384static void icside_setup_ports(hw_regs_t *hw, void __iomem *base, 329static void icside_setup_ports(struct ide_hw *hw, void __iomem *base,
385 struct cardinfo *info, struct expansion_card *ec) 330 struct cardinfo *info, struct expansion_card *ec)
386{ 331{
387 unsigned long port = (unsigned long)base + info->dataoffset; 332 unsigned long port = (unsigned long)base + info->dataoffset;
@@ -398,11 +343,11 @@ static void icside_setup_ports(hw_regs_t *hw, void __iomem *base,
398 343
399 hw->irq = ec->irq; 344 hw->irq = ec->irq;
400 hw->dev = &ec->dev; 345 hw->dev = &ec->dev;
401 hw->chipset = ide_acorn;
402} 346}
403 347
404static const struct ide_port_info icside_v5_port_info = { 348static const struct ide_port_info icside_v5_port_info = {
405 .host_flags = IDE_HFLAG_NO_DMA, 349 .host_flags = IDE_HFLAG_NO_DMA,
350 .chipset = ide_acorn,
406}; 351};
407 352
408static int __devinit 353static int __devinit
@@ -410,7 +355,7 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
410{ 355{
411 void __iomem *base; 356 void __iomem *base;
412 struct ide_host *host; 357 struct ide_host *host;
413 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; 358 struct ide_hw hw, *hws[] = { &hw };
414 int ret; 359 int ret;
415 360
416 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); 361 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
@@ -431,7 +376,7 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
431 376
432 icside_setup_ports(&hw, base, &icside_cardinfo_v5, ec); 377 icside_setup_ports(&hw, base, &icside_cardinfo_v5, ec);
433 378
434 host = ide_host_alloc(&icside_v5_port_info, hws); 379 host = ide_host_alloc(&icside_v5_port_info, hws, 1);
435 if (host == NULL) 380 if (host == NULL)
436 return -ENODEV; 381 return -ENODEV;
437 382
@@ -452,11 +397,11 @@ err_free:
452 397
453static const struct ide_port_info icside_v6_port_info __initdata = { 398static const struct ide_port_info icside_v6_port_info __initdata = {
454 .init_dma = icside_dma_off_init, 399 .init_dma = icside_dma_off_init,
455 .port_ops = &icside_v6_no_dma_port_ops,
456 .dma_ops = &icside_v6_dma_ops, 400 .dma_ops = &icside_v6_dma_ops,
457 .host_flags = IDE_HFLAG_SERIALIZE | IDE_HFLAG_MMIO, 401 .host_flags = IDE_HFLAG_SERIALIZE | IDE_HFLAG_MMIO,
458 .mwdma_mask = ATA_MWDMA2, 402 .mwdma_mask = ATA_MWDMA2,
459 .swdma_mask = ATA_SWDMA2, 403 .swdma_mask = ATA_SWDMA2,
404 .chipset = ide_acorn,
460}; 405};
461 406
462static int __devinit 407static int __devinit
@@ -466,7 +411,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
466 struct ide_host *host; 411 struct ide_host *host;
467 unsigned int sel = 0; 412 unsigned int sel = 0;
468 int ret; 413 int ret;
469 hw_regs_t hw[2], *hws[] = { &hw[0], &hw[1], NULL, NULL }; 414 struct ide_hw hw[2], *hws[] = { &hw[0], &hw[1] };
470 struct ide_port_info d = icside_v6_port_info; 415 struct ide_port_info d = icside_v6_port_info;
471 416
472 ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); 417 ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
@@ -506,7 +451,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
506 icside_setup_ports(&hw[0], easi_base, &icside_cardinfo_v6_1, ec); 451 icside_setup_ports(&hw[0], easi_base, &icside_cardinfo_v6_1, ec);
507 icside_setup_ports(&hw[1], easi_base, &icside_cardinfo_v6_2, ec); 452 icside_setup_ports(&hw[1], easi_base, &icside_cardinfo_v6_2, ec);
508 453
509 host = ide_host_alloc(&d, hws); 454 host = ide_host_alloc(&d, hws, 2);
510 if (host == NULL) 455 if (host == NULL)
511 return -ENODEV; 456 return -ENODEV;
512 457