diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-28 17:44:40 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-28 17:44:40 -0400 |
commit | 6dbceb8c8083634ed4f5006deac12f0a45e6a7bc (patch) | |
tree | 51edf9252f5e785c0c004f9c0ad17de605b9daa4 | |
parent | 94cd5b62ff9bb07ef065333eb97438f115a75890 (diff) |
ide-cris: add ->tf_{load,read} methods
Add ->tf_{load,read} methods so cris_ide_{outb,outw,inb,inw}()
can be used directly.
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r-- | drivers/ide/cris/ide-cris.c | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c index 72ff63ed5f2b..d628141098c2 100644 --- a/drivers/ide/cris/ide-cris.c +++ b/drivers/ide/cris/ide-cris.c | |||
@@ -775,6 +775,90 @@ static void __init cris_setup_ports(hw_regs_t *hw, unsigned long base) | |||
775 | hw->ack_intr = cris_ide_ack_intr; | 775 | hw->ack_intr = cris_ide_ack_intr; |
776 | } | 776 | } |
777 | 777 | ||
778 | static void cris_tf_load(ide_drive_t *drive, ide_task_t *task) | ||
779 | { | ||
780 | struct ide_io_ports *io_ports = &drive->hwif->io_ports; | ||
781 | struct ide_taskfile *tf = &task->tf; | ||
782 | u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; | ||
783 | |||
784 | if (task->tf_flags & IDE_TFLAG_FLAGGED) | ||
785 | HIHI = 0xFF; | ||
786 | |||
787 | ide_set_irq(drive, 1); | ||
788 | |||
789 | if (task->tf_flags & IDE_TFLAG_OUT_DATA) | ||
790 | cris_ide_outw((tf->hob_data << 8) | tf->data, | ||
791 | io_ports->data_addr); | ||
792 | |||
793 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) | ||
794 | cris_ide_outb(tf->hob_feature, io_ports->feature_addr); | ||
795 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) | ||
796 | cris_ide_outb(tf->hob_nsect, io_ports->nsect_addr); | ||
797 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) | ||
798 | cris_ide_outb(tf->hob_lbal, io_ports->lbal_addr); | ||
799 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) | ||
800 | cris_ide_outb(tf->hob_lbam, io_ports->lbam_addr); | ||
801 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) | ||
802 | cris_ide_outb(tf->hob_lbah, io_ports->lbah_addr); | ||
803 | |||
804 | if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) | ||
805 | cris_ide_outb(tf->feature, io_ports->feature_addr); | ||
806 | if (task->tf_flags & IDE_TFLAG_OUT_NSECT) | ||
807 | cris_ide_outb(tf->nsect, io_ports->nsect_addr); | ||
808 | if (task->tf_flags & IDE_TFLAG_OUT_LBAL) | ||
809 | cris_ide_outb(tf->lbal, io_ports->lbal_addr); | ||
810 | if (task->tf_flags & IDE_TFLAG_OUT_LBAM) | ||
811 | cris_ide_outb(tf->lbam, io_ports->lbam_addr); | ||
812 | if (task->tf_flags & IDE_TFLAG_OUT_LBAH) | ||
813 | cris_ide_outb(tf->lbah, io_ports->lbah_addr); | ||
814 | |||
815 | if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) | ||
816 | cris_ide_outb((tf->device & HIHI) | drive->select.all, | ||
817 | io_ports->device_addr); | ||
818 | } | ||
819 | |||
820 | static void cris_tf_read(ide_drive_t *drive, ide_task_t *task) | ||
821 | { | ||
822 | struct ide_io_ports *io_ports = &drive->hwif->io_ports; | ||
823 | struct ide_taskfile *tf = &task->tf; | ||
824 | |||
825 | if (task->tf_flags & IDE_TFLAG_IN_DATA) { | ||
826 | u16 data = cris_ide_inw(io_ports->data_addr); | ||
827 | |||
828 | tf->data = data & 0xff; | ||
829 | tf->hob_data = (data >> 8) & 0xff; | ||
830 | } | ||
831 | |||
832 | /* be sure we're looking at the low order bits */ | ||
833 | cris_ide_outb(drive->ctl & ~0x80, io_ports->ctl_addr); | ||
834 | |||
835 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) | ||
836 | tf->nsect = cris_ide_inb(io_ports->nsect_addr); | ||
837 | if (task->tf_flags & IDE_TFLAG_IN_LBAL) | ||
838 | tf->lbal = cris_ide_inb(io_ports->lbal_addr); | ||
839 | if (task->tf_flags & IDE_TFLAG_IN_LBAM) | ||
840 | tf->lbam = cris_ide_inb(io_ports->lbam_addr); | ||
841 | if (task->tf_flags & IDE_TFLAG_IN_LBAH) | ||
842 | tf->lbah = cris_ide_inb(io_ports->lbah_addr); | ||
843 | if (task->tf_flags & IDE_TFLAG_IN_DEVICE) | ||
844 | tf->device = cris_ide_inb(io_ports->device_addr); | ||
845 | |||
846 | if (task->tf_flags & IDE_TFLAG_LBA48) { | ||
847 | cris_ide_outb(drive->ctl | 0x80, io_ports->ctl_addr); | ||
848 | |||
849 | if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) | ||
850 | tf->hob_feature = cris_ide_inb(io_ports->feature_addr); | ||
851 | if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) | ||
852 | tf->hob_nsect = cris_ide_inb(io_ports->nsect_addr); | ||
853 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) | ||
854 | tf->hob_lbal = cris_ide_inb(io_ports->lbal_addr); | ||
855 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) | ||
856 | tf->hob_lbam = cris_ide_inb(io_ports->lbam_addr); | ||
857 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) | ||
858 | tf->hob_lbah = cris_ide_inb(io_ports->lbah_addr); | ||
859 | } | ||
860 | } | ||
861 | |||
778 | static const struct ide_port_ops cris_port_ops = { | 862 | static const struct ide_port_ops cris_port_ops = { |
779 | .set_pio_mode = cris_set_pio_mode, | 863 | .set_pio_mode = cris_set_pio_mode, |
780 | .set_dma_mode = cris_set_dma_mode, | 864 | .set_dma_mode = cris_set_dma_mode, |
@@ -812,6 +896,9 @@ static int __init init_e100_ide(void) | |||
812 | ide_init_port_data(hwif, hwif->index); | 896 | ide_init_port_data(hwif, hwif->index); |
813 | ide_init_port_hw(hwif, &hw); | 897 | ide_init_port_hw(hwif, &hw); |
814 | 898 | ||
899 | hwif->tf_load = cris_tf_load; | ||
900 | hwif->tf_read = cris_tf_read; | ||
901 | |||
815 | hwif->input_data = cris_input_data; | 902 | hwif->input_data = cris_input_data; |
816 | hwif->output_data = cris_output_data; | 903 | hwif->output_data = cris_output_data; |
817 | 904 | ||