]> err.no Git - linux-2.6/blobdiff - drivers/ide/pci/amd74xx.c
sata_sil24: add DID for another adaptec flavor
[linux-2.6] / drivers / ide / pci / amd74xx.c
index 2e8cbcaf3ef5cdff61608d3c039d008922d5b048..efcf54338be7b9c63543f496f3548d71d8825be2 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * Version 2.25
- *
  * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04
  * IDE driver for Linux.
  *
 
 #include <linux/module.h>
 #include <linux/kernel.h>
-#include <linux/ioport.h>
-#include <linux/blkdev.h>
 #include <linux/pci.h>
 #include <linux/init.h>
 #include <linux/ide.h>
-#include <asm/io.h>
 
 #include "ide-timing.h"
 
@@ -86,6 +81,7 @@ static void amd_set_speed(struct pci_dev *dev, u8 dn, u8 udma_mask,
 static void amd_set_drive(ide_drive_t *drive, const u8 speed)
 {
        ide_hwif_t *hwif = drive->hwif;
+       struct pci_dev *dev = to_pci_dev(hwif->dev);
        ide_drive_t *peer = hwif->drives + (~drive->dn & 1);
        struct ide_timing t, p;
        int T, UT;
@@ -104,7 +100,7 @@ static void amd_set_drive(ide_drive_t *drive, const u8 speed)
        if (speed == XFER_UDMA_5 && amd_clock <= 33333) t.udma = 1;
        if (speed == XFER_UDMA_6 && amd_clock <= 33333) t.udma = 15;
 
-       amd_set_speed(hwif->pci_dev, drive->dn, udma_mask, &t);
+       amd_set_speed(dev, drive->dn, udma_mask, &t);
 }
 
 /*
@@ -183,7 +179,7 @@ static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev,
  * Determine the system bus clock.
  */
 
-       amd_clock = system_bus_clock() * 1000;
+       amd_clock = (ide_pci_clk ? ide_pci_clk : system_bus_clock()) * 1000;
 
        switch (amd_clock) {
                case 33000: amd_clock = 33333; break;
@@ -200,33 +196,34 @@ static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev,
        return dev->irq;
 }
 
-static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
+static u8 __devinit amd_cable_detect(ide_hwif_t *hwif)
 {
-       if (hwif->irq == 0) /* 0 is bogus but will do for now */
-               hwif->irq = pci_get_legacy_ide_irq(hwif->pci_dev, hwif->channel);
-
-       hwif->set_pio_mode = &amd_set_pio_mode;
-       hwif->set_dma_mode = &amd_set_drive;
+       if ((amd_80w >> hwif->channel) & 1)
+               return ATA_CBL_PATA80;
+       else
+               return ATA_CBL_PATA40;
+}
 
-       if (!hwif->dma_base)
-               return;
+static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
+{
+       struct pci_dev *dev = to_pci_dev(hwif->dev);
 
-       if (hwif->cbl != ATA_CBL_PATA40_SHORT) {
-               if ((amd_80w >> hwif->channel) & 1)
-                       hwif->cbl = ATA_CBL_PATA80;
-               else
-                       hwif->cbl = ATA_CBL_PATA40;
-       }
+       if (hwif->irq == 0) /* 0 is bogus but will do for now */
+               hwif->irq = pci_get_legacy_ide_irq(dev, hwif->channel);
 }
 
+static const struct ide_port_ops amd_port_ops = {
+       .set_pio_mode           = amd_set_pio_mode,
+       .set_dma_mode           = amd_set_drive,
+       .cable_detect           = amd_cable_detect,
+};
+
 #define IDE_HFLAGS_AMD \
        (IDE_HFLAG_PIO_NO_BLACKLIST | \
-        IDE_HFLAG_PIO_NO_DOWNGRADE | \
         IDE_HFLAG_ABUSE_SET_DMA_MODE | \
         IDE_HFLAG_POST_SET_MODE | \
         IDE_HFLAG_IO_32BIT | \
-        IDE_HFLAG_UNMASK_IRQS | \
-        IDE_HFLAG_BOOTABLE)
+        IDE_HFLAG_UNMASK_IRQS)
 
 #define DECLARE_AMD_DEV(name_str, swdma, udma)                         \
        {                                                               \
@@ -234,6 +231,7 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
                .init_chipset   = init_chipset_amd74xx,                 \
                .init_hwif      = init_hwif_amd74xx,                    \
                .enablebits     = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \
+               .port_ops       = &amd_port_ops,                        \
                .host_flags     = IDE_HFLAGS_AMD,                       \
                .pio_mask       = ATA_PIO5,                             \
                .swdma_mask     = swdma,                                \
@@ -247,6 +245,7 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
                .init_chipset   = init_chipset_amd74xx,                 \
                .init_hwif      = init_hwif_amd74xx,                    \
                .enablebits     = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \
+               .port_ops       = &amd_port_ops,                        \
                .host_flags     = IDE_HFLAGS_AMD,                       \
                .pio_mask       = ATA_PIO5,                             \
                .swdma_mask     = ATA_SWDMA2,                           \