libata: add 150ms between completion of hardreset and status checking
[safe/jmp/linux-2.6] / drivers / ata / pata_via.c
index a9077b6..220fcd6 100644 (file)
@@ -23,6 +23,8 @@
  *     VIA VT8233c     -       UDMA100
  *     VIA VT8235      -       UDMA133
  *     VIA VT8237      -       UDMA133
+ *     VIA VT8237S     -       UDMA133
+ *     VIA VT8251      -       UDMA133
  *
  *     Most registers remain compatible across chips. Others start reserved
  *     and acquire sensible semantics if set to 1 (eg cable detect). A few
@@ -60,7 +62,7 @@
 #include <linux/libata.h>
 
 #define DRV_NAME "pata_via"
-#define DRV_VERSION "0.2.0"
+#define DRV_VERSION "0.2.1"
 
 /*
  *     The following comes directly from Vojtech Pavlik's ide/pci/via82cxxx
@@ -94,6 +96,8 @@ static const struct via_isa_bridge {
        u8 rev_max;
        u16 flags;
 } via_isa_bridges[] = {
+       { "vt8237s",    PCI_DEVICE_ID_VIA_8237S,    0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
+       { "vt8251",     PCI_DEVICE_ID_VIA_8251,     0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
        { "cx700",      PCI_DEVICE_ID_VIA_CX700,    0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
        { "vt6410",     PCI_DEVICE_ID_VIA_6410,     0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES},
        { "vt8237a",    PCI_DEVICE_ID_VIA_8237A,    0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
@@ -159,10 +163,15 @@ static int via_pre_reset(struct ata_port *ap)
                        return -ENOENT;
        }
 
-       if ((config->flags & VIA_UDMA) >= VIA_UDMA_66)
+       if ((config->flags & VIA_UDMA) >= VIA_UDMA_100)
                ap->cbl = via_cable_detect(ap);
-       else
+       /* The UDMA66 series has no cable detect so do drive side detect */
+       else if ((config->flags & VIA_UDMA) < VIA_UDMA_66)
                ap->cbl = ATA_CBL_PATA40;
+       else
+               ap->cbl = ATA_CBL_PATA_UNK;
+               
+
        return ata_std_prereset(ap);
 }
 
@@ -325,14 +334,14 @@ static struct ata_port_operations via_port_ops = {
        .qc_prep        = ata_qc_prep,
        .qc_issue       = ata_qc_issue_prot,
 
-       .data_xfer      = ata_pio_data_xfer,
+       .data_xfer      = ata_data_xfer,
 
        .irq_handler    = ata_interrupt,
        .irq_clear      = ata_bmdma_irq_clear,
+       .irq_on         = ata_irq_on,
+       .irq_ack        = ata_irq_ack,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static struct ata_port_operations via_port_ops_noirq = {
@@ -360,14 +369,14 @@ static struct ata_port_operations via_port_ops_noirq = {
        .qc_prep        = ata_qc_prep,
        .qc_issue       = ata_qc_issue_prot,
 
-       .data_xfer      = ata_pio_data_xfer_noirq,
+       .data_xfer      = ata_data_xfer_noirq,
 
        .irq_handler    = ata_interrupt,
        .irq_clear      = ata_bmdma_irq_clear,
+       .irq_on         = ata_irq_on,
+       .irq_ack        = ata_irq_ack,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 /**
@@ -382,13 +391,13 @@ static struct ata_port_operations via_port_ops_noirq = {
 static void via_config_fifo(struct pci_dev *pdev, unsigned int flags)
 {
        u8 enable;
-       
+
        /* 0x40 low bits indicate enabled channels */
        pci_read_config_byte(pdev, 0x40 , &enable);
        enable &= 3;
-       
+
        if (flags & VIA_SET_FIFO) {
-               u8 fifo_setting[4] = {0x00, 0x60, 0x00, 0x20};
+               static const u8 fifo_setting[4] = {0x00, 0x60, 0x00, 0x20};
                u8 fifo;
 
                pci_read_config_byte(pdev, 0x43, &fifo);
@@ -507,7 +516,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 
        /* Initialise the FIFO for the enabled channels. */
        via_config_fifo(pdev, config->flags);
-       
+
        /* Clock set up */
        switch(config->flags & VIA_UDMA) {
                case VIA_UDMA_NONE:
@@ -566,7 +575,7 @@ static int via_reinit_one(struct pci_dev *pdev)
        u32 timing;
        struct ata_host *host = dev_get_drvdata(&pdev->dev);
        const struct via_isa_bridge *config = host->private_data;
-       
+
        via_config_fifo(pdev, config->flags);
 
        if ((config->flags & VIA_UDMA) == VIA_UDMA_66) {
@@ -581,7 +590,7 @@ static int via_reinit_one(struct pci_dev *pdev)
                timing &= ~0x80008;
                pci_write_config_dword(pdev, 0x50, timing);
        }
-       return ata_pci_device_resume(pdev);     
+       return ata_pci_device_resume(pdev);
 }
 
 static const struct pci_device_id via[] = {