diff options
Diffstat (limited to 'drivers/ide/arm/icside.c')
-rw-r--r-- | drivers/ide/arm/icside.c | 69 |
1 files changed, 42 insertions, 27 deletions
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index e816b0ffcfe6..124445c20921 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c | |||
@@ -191,6 +191,10 @@ static void icside_maskproc(ide_drive_t *drive, int mask) | |||
191 | local_irq_restore(flags); | 191 | local_irq_restore(flags); |
192 | } | 192 | } |
193 | 193 | ||
194 | static const struct ide_port_ops icside_v6_no_dma_port_ops = { | ||
195 | .maskproc = icside_maskproc, | ||
196 | }; | ||
197 | |||
194 | #ifdef CONFIG_BLK_DEV_IDEDMA_ICS | 198 | #ifdef CONFIG_BLK_DEV_IDEDMA_ICS |
195 | /* | 199 | /* |
196 | * SG-DMA support. | 200 | * SG-DMA support. |
@@ -266,6 +270,11 @@ static void icside_set_dma_mode(ide_drive_t *drive, const u8 xfer_mode) | |||
266 | ide_xfer_verbose(xfer_mode), 2000 / drive->drive_data); | 270 | ide_xfer_verbose(xfer_mode), 2000 / drive->drive_data); |
267 | } | 271 | } |
268 | 272 | ||
273 | static const struct ide_port_ops icside_v6_port_ops = { | ||
274 | .set_dma_mode = icside_set_dma_mode, | ||
275 | .maskproc = icside_maskproc, | ||
276 | }; | ||
277 | |||
269 | static void icside_dma_host_set(ide_drive_t *drive, int on) | 278 | static void icside_dma_host_set(ide_drive_t *drive, int on) |
270 | { | 279 | { |
271 | } | 280 | } |
@@ -375,32 +384,40 @@ static void icside_dma_lost_irq(ide_drive_t *drive) | |||
375 | printk(KERN_ERR "%s: IRQ lost\n", drive->name); | 384 | printk(KERN_ERR "%s: IRQ lost\n", drive->name); |
376 | } | 385 | } |
377 | 386 | ||
378 | static void icside_dma_init(ide_hwif_t *hwif) | 387 | static int icside_dma_init(ide_hwif_t *hwif, const struct ide_port_info *d) |
379 | { | 388 | { |
380 | hwif->dmatable_cpu = NULL; | 389 | hwif->dmatable_cpu = NULL; |
381 | hwif->dmatable_dma = 0; | 390 | hwif->dmatable_dma = 0; |
382 | hwif->set_dma_mode = icside_set_dma_mode; | 391 | |
383 | 392 | return 0; | |
384 | hwif->dma_host_set = icside_dma_host_set; | ||
385 | hwif->dma_setup = icside_dma_setup; | ||
386 | hwif->dma_exec_cmd = icside_dma_exec_cmd; | ||
387 | hwif->dma_start = icside_dma_start; | ||
388 | hwif->ide_dma_end = icside_dma_end; | ||
389 | hwif->ide_dma_test_irq = icside_dma_test_irq; | ||
390 | hwif->dma_timeout = icside_dma_timeout; | ||
391 | hwif->dma_lost_irq = icside_dma_lost_irq; | ||
392 | } | 393 | } |
394 | |||
395 | static const struct ide_dma_ops icside_v6_dma_ops = { | ||
396 | .dma_host_set = icside_dma_host_set, | ||
397 | .dma_setup = icside_dma_setup, | ||
398 | .dma_exec_cmd = icside_dma_exec_cmd, | ||
399 | .dma_start = icside_dma_start, | ||
400 | .dma_end = icside_dma_end, | ||
401 | .dma_test_irq = icside_dma_test_irq, | ||
402 | .dma_timeout = icside_dma_timeout, | ||
403 | .dma_lost_irq = icside_dma_lost_irq, | ||
404 | }; | ||
393 | #else | 405 | #else |
394 | #define icside_dma_init(hwif) (0) | 406 | #define icside_v6_dma_ops NULL |
395 | #endif | 407 | #endif |
396 | 408 | ||
409 | static int icside_dma_off_init(ide_hwif_t *hwif, const struct ide_port_info *d) | ||
410 | { | ||
411 | return -EOPNOTSUPP; | ||
412 | } | ||
413 | |||
397 | static ide_hwif_t * | 414 | static ide_hwif_t * |
398 | icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *ec) | 415 | icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *ec) |
399 | { | 416 | { |
400 | unsigned long port = (unsigned long)base + info->dataoffset; | 417 | unsigned long port = (unsigned long)base + info->dataoffset; |
401 | ide_hwif_t *hwif; | 418 | ide_hwif_t *hwif; |
402 | 419 | ||
403 | hwif = ide_find_port(port); | 420 | hwif = ide_find_port(); |
404 | if (hwif) { | 421 | if (hwif) { |
405 | int i; | 422 | int i; |
406 | 423 | ||
@@ -408,15 +425,14 @@ icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *e | |||
408 | * Ensure we're using MMIO | 425 | * Ensure we're using MMIO |
409 | */ | 426 | */ |
410 | default_hwif_mmiops(hwif); | 427 | default_hwif_mmiops(hwif); |
411 | hwif->mmio = 1; | ||
412 | 428 | ||
413 | for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { | 429 | for (i = 0; i <= 7; i++) { |
414 | hwif->io_ports[i] = port; | 430 | hwif->io_ports_array[i] = port; |
415 | port += 1 << info->stepping; | 431 | port += 1 << info->stepping; |
416 | } | 432 | } |
417 | hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)base + info->ctrloffset; | 433 | hwif->io_ports.ctl_addr = |
434 | (unsigned long)base + info->ctrloffset; | ||
418 | hwif->irq = ec->irq; | 435 | hwif->irq = ec->irq; |
419 | hwif->noprobe = 0; | ||
420 | hwif->chipset = ide_acorn; | 436 | hwif->chipset = ide_acorn; |
421 | hwif->gendev.parent = &ec->dev; | 437 | hwif->gendev.parent = &ec->dev; |
422 | hwif->dev = &ec->dev; | 438 | hwif->dev = &ec->dev; |
@@ -462,9 +478,10 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec) | |||
462 | } | 478 | } |
463 | 479 | ||
464 | static const struct ide_port_info icside_v6_port_info __initdata = { | 480 | static const struct ide_port_info icside_v6_port_info __initdata = { |
465 | .host_flags = IDE_HFLAG_SERIALIZE | | 481 | .init_dma = icside_dma_off_init, |
466 | IDE_HFLAG_NO_DMA | /* no SFF-style DMA */ | 482 | .port_ops = &icside_v6_no_dma_port_ops, |
467 | IDE_HFLAG_NO_AUTOTUNE, | 483 | .dma_ops = &icside_v6_dma_ops, |
484 | .host_flags = IDE_HFLAG_SERIALIZE, | ||
468 | .mwdma_mask = ATA_MWDMA2, | 485 | .mwdma_mask = ATA_MWDMA2, |
469 | .swdma_mask = ATA_SWDMA2, | 486 | .swdma_mask = ATA_SWDMA2, |
470 | }; | 487 | }; |
@@ -526,21 +543,19 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) | |||
526 | state->hwif[0] = hwif; | 543 | state->hwif[0] = hwif; |
527 | state->hwif[1] = mate; | 544 | state->hwif[1] = mate; |
528 | 545 | ||
529 | hwif->maskproc = icside_maskproc; | ||
530 | hwif->hwif_data = state; | 546 | hwif->hwif_data = state; |
531 | hwif->config_data = (unsigned long)ioc_base; | 547 | hwif->config_data = (unsigned long)ioc_base; |
532 | hwif->select_data = sel; | 548 | hwif->select_data = sel; |
533 | 549 | ||
534 | mate->maskproc = icside_maskproc; | ||
535 | mate->hwif_data = state; | 550 | mate->hwif_data = state; |
536 | mate->config_data = (unsigned long)ioc_base; | 551 | mate->config_data = (unsigned long)ioc_base; |
537 | mate->select_data = sel | 1; | 552 | mate->select_data = sel | 1; |
538 | 553 | ||
539 | if (ec->dma != NO_DMA && !request_dma(ec->dma, hwif->name)) { | 554 | if (ec->dma != NO_DMA && !request_dma(ec->dma, hwif->name)) { |
540 | icside_dma_init(hwif); | 555 | d.init_dma = icside_dma_init; |
541 | icside_dma_init(mate); | 556 | d.port_ops = &icside_v6_port_ops; |
542 | } else | 557 | d.dma_ops = NULL; |
543 | d.mwdma_mask = d.swdma_mask = 0; | 558 | } |
544 | 559 | ||
545 | idx[0] = hwif->index; | 560 | idx[0] = hwif->index; |
546 | idx[1] = mate->index; | 561 | idx[1] = mate->index; |