amd74xx: don't change UDMA settings when programming PIO timings
[safe/jmp/linux-2.6] / drivers / ide / scc_pata.c
index 6ba4983..1104bb3 100644 (file)
@@ -337,7 +337,6 @@ static void scc_dma_start(ide_drive_t *drive)
 
        /* start DMA */
        scc_ide_outb(dma_cmd | 1, hwif->dma_base);
-       wmb();
 }
 
 static int __scc_dma_end(ide_drive_t *drive)
@@ -354,7 +353,6 @@ static int __scc_dma_end(ide_drive_t *drive)
        /* clear the INTR & ERROR bits */
        scc_ide_outb(dma_stat | 6, hwif->dma_base + 4);
        /* verify good DMA status */
-       wmb();
        return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0;
 }
 
@@ -561,7 +559,7 @@ static int scc_ide_setup_pci_device(struct pci_dev *dev,
 {
        struct scc_ports *ports = pci_get_drvdata(dev);
        struct ide_host *host;
-       hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
+       struct ide_hw hw, *hws[] = { &hw };
        int i, rc;
 
        memset(&hw, 0, sizeof(hw));
@@ -569,9 +567,8 @@ static int scc_ide_setup_pci_device(struct pci_dev *dev,
                hw.io_ports_array[i] = ports->dma + 0x20 + i * 4;
        hw.irq = dev->irq;
        hw.dev = &dev->dev;
-       hw.chipset = ide_pci;
 
-       rc = ide_host_add(d, hws, &host);
+       rc = ide_host_add(d, hws, 1, &host);
        if (rc)
                return rc;
 
@@ -647,88 +644,40 @@ static int __devinit init_setup_scc(struct pci_dev *dev,
        return rc;
 }
 
-static void scc_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
+static void scc_tf_load(ide_drive_t *drive, struct ide_taskfile *tf, u8 valid)
 {
        struct ide_io_ports *io_ports = &drive->hwif->io_ports;
-       struct ide_taskfile *tf = &cmd->tf;
-       u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF;
-
-       if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
-               HIHI = 0xFF;
-
-       if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA)
-               out_be32((void *)io_ports->data_addr,
-                        (tf->hob_data << 8) | tf->data);
-
-       if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
-               scc_ide_outb(tf->hob_feature, io_ports->feature_addr);
-       if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
-               scc_ide_outb(tf->hob_nsect, io_ports->nsect_addr);
-       if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL)
-               scc_ide_outb(tf->hob_lbal, io_ports->lbal_addr);
-       if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM)
-               scc_ide_outb(tf->hob_lbam, io_ports->lbam_addr);
-       if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH)
-               scc_ide_outb(tf->hob_lbah, io_ports->lbah_addr);
-
-       if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE)
+
+       if (valid & IDE_VALID_FEATURE)
                scc_ide_outb(tf->feature, io_ports->feature_addr);
-       if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT)
+       if (valid & IDE_VALID_NSECT)
                scc_ide_outb(tf->nsect, io_ports->nsect_addr);
-       if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL)
+       if (valid & IDE_VALID_LBAL)
                scc_ide_outb(tf->lbal, io_ports->lbal_addr);
-       if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM)
+       if (valid & IDE_VALID_LBAM)
                scc_ide_outb(tf->lbam, io_ports->lbam_addr);
-       if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH)
+       if (valid & IDE_VALID_LBAH)
                scc_ide_outb(tf->lbah, io_ports->lbah_addr);
-
-       if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE)
-               scc_ide_outb((tf->device & HIHI) | drive->select,
-                            io_ports->device_addr);
+       if (valid & IDE_VALID_DEVICE)
+               scc_ide_outb(tf->device, io_ports->device_addr);
 }
 
-static void scc_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
+static void scc_tf_read(ide_drive_t *drive, struct ide_taskfile *tf, u8 valid)
 {
        struct ide_io_ports *io_ports = &drive->hwif->io_ports;
-       struct ide_taskfile *tf = &cmd->tf;
-
-       if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
-               u16 data = (u16)in_be32((void *)io_ports->data_addr);
-
-               tf->data = data & 0xff;
-               tf->hob_data = (data >> 8) & 0xff;
-       }
-
-       /* be sure we're looking at the low order bits */
-       scc_ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
 
-       if (cmd->tf_flags & IDE_TFLAG_IN_FEATURE)
-               tf->feature = scc_ide_inb(io_ports->feature_addr);
-       if (cmd->tf_flags & IDE_TFLAG_IN_NSECT)
+       if (valid & IDE_VALID_ERROR)
+               tf->error  = scc_ide_inb(io_ports->feature_addr);
+       if (valid & IDE_VALID_NSECT)
                tf->nsect  = scc_ide_inb(io_ports->nsect_addr);
-       if (cmd->tf_flags & IDE_TFLAG_IN_LBAL)
+       if (valid & IDE_VALID_LBAL)
                tf->lbal   = scc_ide_inb(io_ports->lbal_addr);
-       if (cmd->tf_flags & IDE_TFLAG_IN_LBAM)
+       if (valid & IDE_VALID_LBAM)
                tf->lbam   = scc_ide_inb(io_ports->lbam_addr);
-       if (cmd->tf_flags & IDE_TFLAG_IN_LBAH)
+       if (valid & IDE_VALID_LBAH)
                tf->lbah   = scc_ide_inb(io_ports->lbah_addr);
-       if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE)
+       if (valid & IDE_VALID_DEVICE)
                tf->device = scc_ide_inb(io_ports->device_addr);
-
-       if (cmd->tf_flags & IDE_TFLAG_LBA48) {
-               scc_ide_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr);
-
-               if (cmd->tf_flags & IDE_TFLAG_IN_HOB_FEATURE)
-                       tf->hob_feature = scc_ide_inb(io_ports->feature_addr);
-               if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT)
-                       tf->hob_nsect   = scc_ide_inb(io_ports->nsect_addr);
-               if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL)
-                       tf->hob_lbal    = scc_ide_inb(io_ports->lbal_addr);
-               if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM)
-                       tf->hob_lbam    = scc_ide_inb(io_ports->lbam_addr);
-               if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH)
-                       tf->hob_lbah    = scc_ide_inb(io_ports->lbah_addr);
-       }
 }
 
 static void scc_input_data(ide_drive_t *drive, struct ide_cmd *cmd,
@@ -836,6 +785,7 @@ static const struct ide_tp_ops scc_tp_ops = {
        .read_altstatus         = scc_read_altstatus,
        .write_devctl           = scc_write_devctl,
 
+       .dev_select             = ide_dev_select,
        .tf_load                = scc_tf_load,
        .tf_read                = scc_tf_read,
 
@@ -872,6 +822,7 @@ static const struct ide_port_info scc_chipset __devinitdata = {
        .host_flags     = IDE_HFLAG_SINGLE,
        .irq_flags      = IRQF_SHARED,
        .pio_mask       = ATA_PIO4,
+       .chipset        = ide_pci,
 };
 
 /**