diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:51 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:51 -0400 |
commit | c6dfa867bb45f4bff2e48f3bc89ab1d6a7ab4c21 (patch) | |
tree | 54d9322fad75e48fb548e182fbb87d06a06cd048 /drivers/ide | |
parent | ebb00fb55d0566bb3e81518122a57b4b3bedf1e4 (diff) |
ide: add ->exec_command method
Add ->exec_command method for writing ATA Command register
and use it instead of ->OUTBSYNC.
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/ide-io.c | 3 | ||||
-rw-r--r-- | drivers/ide/ide-iops.c | 19 | ||||
-rw-r--r-- | drivers/ide/ide-probe.c | 6 | ||||
-rw-r--r-- | drivers/ide/ide-taskfile.c | 2 | ||||
-rw-r--r-- | drivers/ide/pci/scc_pata.c | 9 | ||||
-rw-r--r-- | drivers/ide/ppc/pmac.c | 9 |
6 files changed, 37 insertions, 11 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 661b75a89d4d..ca0c04a919cb 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -437,8 +437,7 @@ static ide_startstop_t ide_atapi_error(ide_drive_t *drive, struct request *rq, u | |||
437 | 437 | ||
438 | if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT)) | 438 | if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT)) |
439 | /* force an abort */ | 439 | /* force an abort */ |
440 | hwif->OUTBSYNC(hwif, WIN_IDLEIMMEDIATE, | 440 | hwif->exec_command(hwif, WIN_IDLEIMMEDIATE); |
441 | hwif->io_ports.command_addr); | ||
442 | 441 | ||
443 | if (rq->errors >= ERROR_MAX) { | 442 | if (rq->errors >= ERROR_MAX) { |
444 | ide_kill_rq(drive, rq); | 443 | ide_kill_rq(drive, rq); |
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index 17cad6c39ee3..d8db25581909 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -103,6 +103,14 @@ void SELECT_MASK(ide_drive_t *drive, int mask) | |||
103 | port_ops->maskproc(drive, mask); | 103 | port_ops->maskproc(drive, mask); |
104 | } | 104 | } |
105 | 105 | ||
106 | static void ide_exec_command(ide_hwif_t *hwif, u8 cmd) | ||
107 | { | ||
108 | if (hwif->host_flags & IDE_HFLAG_MMIO) | ||
109 | writeb(cmd, (void __iomem *)hwif->io_ports.command_addr); | ||
110 | else | ||
111 | outb(cmd, hwif->io_ports.command_addr); | ||
112 | } | ||
113 | |||
106 | static u8 ide_read_sff_dma_status(ide_hwif_t *hwif) | 114 | static u8 ide_read_sff_dma_status(ide_hwif_t *hwif) |
107 | { | 115 | { |
108 | if (hwif->host_flags & IDE_HFLAG_MMIO) | 116 | if (hwif->host_flags & IDE_HFLAG_MMIO) |
@@ -331,6 +339,7 @@ static void ata_output_data(ide_drive_t *drive, struct request *rq, | |||
331 | 339 | ||
332 | void default_hwif_transport(ide_hwif_t *hwif) | 340 | void default_hwif_transport(ide_hwif_t *hwif) |
333 | { | 341 | { |
342 | hwif->exec_command = ide_exec_command; | ||
334 | hwif->read_sff_dma_status = ide_read_sff_dma_status; | 343 | hwif->read_sff_dma_status = ide_read_sff_dma_status; |
335 | 344 | ||
336 | hwif->tf_load = ide_tf_load; | 345 | hwif->tf_load = ide_tf_load; |
@@ -696,7 +705,7 @@ int ide_driveid_update(ide_drive_t *drive) | |||
696 | SELECT_MASK(drive, 1); | 705 | SELECT_MASK(drive, 1); |
697 | ide_set_irq(drive, 0); | 706 | ide_set_irq(drive, 0); |
698 | msleep(50); | 707 | msleep(50); |
699 | hwif->OUTBSYNC(hwif, WIN_IDENTIFY, hwif->io_ports.command_addr); | 708 | hwif->exec_command(hwif, WIN_IDENTIFY); |
700 | timeout = jiffies + WAIT_WORSTCASE; | 709 | timeout = jiffies + WAIT_WORSTCASE; |
701 | do { | 710 | do { |
702 | if (time_after(jiffies, timeout)) { | 711 | if (time_after(jiffies, timeout)) { |
@@ -783,7 +792,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
783 | ide_set_irq(drive, 0); | 792 | ide_set_irq(drive, 0); |
784 | hwif->OUTB(speed, io_ports->nsect_addr); | 793 | hwif->OUTB(speed, io_ports->nsect_addr); |
785 | hwif->OUTB(SETFEATURES_XFER, io_ports->feature_addr); | 794 | hwif->OUTB(SETFEATURES_XFER, io_ports->feature_addr); |
786 | hwif->OUTBSYNC(hwif, WIN_SETFEATURES, io_ports->command_addr); | 795 | hwif->exec_command(hwif, WIN_SETFEATURES); |
787 | if (drive->quirk_list == 2) | 796 | if (drive->quirk_list == 2) |
788 | ide_set_irq(drive, 1); | 797 | ide_set_irq(drive, 1); |
789 | 798 | ||
@@ -891,7 +900,7 @@ void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler, | |||
891 | 900 | ||
892 | spin_lock_irqsave(&ide_lock, flags); | 901 | spin_lock_irqsave(&ide_lock, flags); |
893 | __ide_set_handler(drive, handler, timeout, expiry); | 902 | __ide_set_handler(drive, handler, timeout, expiry); |
894 | hwif->OUTBSYNC(hwif, cmd, hwif->io_ports.command_addr); | 903 | hwif->exec_command(hwif, cmd); |
895 | /* | 904 | /* |
896 | * Drive takes 400nS to respond, we must avoid the IRQ being | 905 | * Drive takes 400nS to respond, we must avoid the IRQ being |
897 | * serviced before that. | 906 | * serviced before that. |
@@ -909,7 +918,7 @@ void ide_execute_pkt_cmd(ide_drive_t *drive) | |||
909 | unsigned long flags; | 918 | unsigned long flags; |
910 | 919 | ||
911 | spin_lock_irqsave(&ide_lock, flags); | 920 | spin_lock_irqsave(&ide_lock, flags); |
912 | hwif->OUTBSYNC(hwif, WIN_PACKETCMD, hwif->io_ports.command_addr); | 921 | hwif->exec_command(hwif, WIN_PACKETCMD); |
913 | ndelay(400); | 922 | ndelay(400); |
914 | spin_unlock_irqrestore(&ide_lock, flags); | 923 | spin_unlock_irqrestore(&ide_lock, flags); |
915 | } | 924 | } |
@@ -1116,7 +1125,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) | |||
1116 | pre_reset(drive); | 1125 | pre_reset(drive); |
1117 | SELECT_DRIVE(drive); | 1126 | SELECT_DRIVE(drive); |
1118 | udelay (20); | 1127 | udelay (20); |
1119 | hwif->OUTBSYNC(hwif, WIN_SRST, io_ports->command_addr); | 1128 | hwif->exec_command(hwif, WIN_SRST); |
1120 | ndelay(400); | 1129 | ndelay(400); |
1121 | hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; | 1130 | hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; |
1122 | hwgroup->polling = 1; | 1131 | hwgroup->polling = 1; |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index ec5f58c6f19a..d1e834a1c5cd 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -295,7 +295,7 @@ static int actual_try_to_identify (ide_drive_t *drive, u8 cmd) | |||
295 | hwif->OUTB(0, io_ports->feature_addr); | 295 | hwif->OUTB(0, io_ports->feature_addr); |
296 | 296 | ||
297 | /* ask drive for ID */ | 297 | /* ask drive for ID */ |
298 | hwif->OUTBSYNC(hwif, cmd, hwif->io_ports.command_addr); | 298 | hwif->exec_command(hwif, cmd); |
299 | 299 | ||
300 | timeout = ((cmd == WIN_IDENTIFY) ? WAIT_WORSTCASE : WAIT_PIDENTIFY) / 2; | 300 | timeout = ((cmd == WIN_IDENTIFY) ? WAIT_WORSTCASE : WAIT_PIDENTIFY) / 2; |
301 | timeout += jiffies; | 301 | timeout += jiffies; |
@@ -482,7 +482,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd) | |||
482 | msleep(50); | 482 | msleep(50); |
483 | SELECT_DRIVE(drive); | 483 | SELECT_DRIVE(drive); |
484 | msleep(50); | 484 | msleep(50); |
485 | hwif->OUTBSYNC(hwif, WIN_SRST, io_ports->command_addr); | 485 | hwif->exec_command(hwif, WIN_SRST); |
486 | (void)ide_busy_sleep(hwif); | 486 | (void)ide_busy_sleep(hwif); |
487 | rc = try_to_identify(drive, cmd); | 487 | rc = try_to_identify(drive, cmd); |
488 | } | 488 | } |
@@ -518,7 +518,7 @@ static void enable_nest (ide_drive_t *drive) | |||
518 | printk("%s: enabling %s -- ", hwif->name, drive->id->model); | 518 | printk("%s: enabling %s -- ", hwif->name, drive->id->model); |
519 | SELECT_DRIVE(drive); | 519 | SELECT_DRIVE(drive); |
520 | msleep(50); | 520 | msleep(50); |
521 | hwif->OUTBSYNC(hwif, EXABYTE_ENABLE_NEST, hwif->io_ports.command_addr); | 521 | hwif->exec_command(hwif, EXABYTE_ENABLE_NEST); |
522 | 522 | ||
523 | if (ide_busy_sleep(hwif)) { | 523 | if (ide_busy_sleep(hwif)) { |
524 | printk(KERN_CONT "failed (timeout)\n"); | 524 | printk(KERN_CONT "failed (timeout)\n"); |
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 1fbdb746dc88..c56be289417e 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -88,7 +88,7 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task) | |||
88 | switch (task->data_phase) { | 88 | switch (task->data_phase) { |
89 | case TASKFILE_MULTI_OUT: | 89 | case TASKFILE_MULTI_OUT: |
90 | case TASKFILE_OUT: | 90 | case TASKFILE_OUT: |
91 | hwif->OUTBSYNC(hwif, tf->command, hwif->io_ports.command_addr); | 91 | hwif->exec_command(hwif, tf->command); |
92 | ndelay(400); /* FIXME */ | 92 | ndelay(400); /* FIXME */ |
93 | return pre_task_out_intr(drive, task->rq); | 93 | return pre_task_out_intr(drive, task->rq); |
94 | case TASKFILE_MULTI_IN: | 94 | case TASKFILE_MULTI_IN: |
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index fc163a7772a7..d140dfd565a4 100644 --- a/drivers/ide/pci/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c | |||
@@ -126,6 +126,14 @@ static u8 scc_ide_inb(unsigned long port) | |||
126 | return (u8)data; | 126 | return (u8)data; |
127 | } | 127 | } |
128 | 128 | ||
129 | static void scc_exec_command(ide_hwif_t *hwif, u8 cmd) | ||
130 | { | ||
131 | out_be32((void *)hwif->io_ports.command_addr, cmd); | ||
132 | eieio(); | ||
133 | in_be32((void *)(hwif->dma_base + 0x01c)); | ||
134 | eieio(); | ||
135 | } | ||
136 | |||
129 | static u8 scc_read_sff_dma_status(ide_hwif_t *hwif) | 137 | static u8 scc_read_sff_dma_status(ide_hwif_t *hwif) |
130 | { | 138 | { |
131 | return (u8)in_be32((void *)(hwif->dma_base + 4)); | 139 | return (u8)in_be32((void *)(hwif->dma_base + 4)); |
@@ -779,6 +787,7 @@ static void __devinit init_mmio_iops_scc(ide_hwif_t *hwif) | |||
779 | 787 | ||
780 | ide_set_hwifdata(hwif, ports); | 788 | ide_set_hwifdata(hwif, ports); |
781 | 789 | ||
790 | hwif->exec_command = scc_exec_command; | ||
782 | hwif->read_sff_dma_status = scc_read_sff_dma_status; | 791 | hwif->read_sff_dma_status = scc_read_sff_dma_status; |
783 | 792 | ||
784 | hwif->tf_load = scc_tf_load; | 793 | hwif->tf_load = scc_tf_load; |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index e68e33bb2c35..7c3a84f8fbed 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -495,6 +495,13 @@ static void pmac_outbsync(ide_hwif_t *hwif, u8 value, unsigned long port) | |||
495 | + IDE_TIMING_CONFIG)); | 495 | + IDE_TIMING_CONFIG)); |
496 | } | 496 | } |
497 | 497 | ||
498 | static void pmac_exec_command(ide_hwif_t *hwif, u8 cmd) | ||
499 | { | ||
500 | writeb(cmd, (void __iomem *)hwif->io_ports.command_addr); | ||
501 | (void)readl((void __iomem *)(hwif->io_ports.data_addr | ||
502 | + IDE_TIMING_CONFIG)); | ||
503 | } | ||
504 | |||
498 | /* | 505 | /* |
499 | * Old tuning functions (called on hdparm -p), sets up drive PIO timings | 506 | * Old tuning functions (called on hdparm -p), sets up drive PIO timings |
500 | */ | 507 | */ |
@@ -1092,6 +1099,8 @@ static int __devinit pmac_ide_setup_device(pmac_ide_hwif_t *pmif, hw_regs_t *hw) | |||
1092 | if (hwif == NULL) | 1099 | if (hwif == NULL) |
1093 | return -ENOENT; | 1100 | return -ENOENT; |
1094 | 1101 | ||
1102 | hwif->exec_command = pmac_exec_command; | ||
1103 | |||
1095 | /* Setup MMIO ops */ | 1104 | /* Setup MMIO ops */ |
1096 | default_hwif_mmiops(hwif); | 1105 | default_hwif_mmiops(hwif); |
1097 | hwif->OUTBSYNC = pmac_outbsync; | 1106 | hwif->OUTBSYNC = pmac_outbsync; |