]> err.no Git - linux-2.6/blobdiff - drivers/ata/pata_via.c
[PATCH] user of the jiffies rounding patch: ATA subsystem
[linux-2.6] / drivers / ata / pata_via.c
index ee93dd0169bee478c5f2ce46382dc9757c7f47a0..2addce11000af973ee3c6210ac75101d7108297d 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);
 }
 
@@ -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);
@@ -418,7 +427,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
        /* Early VIA without UDMA support */
        static struct ata_port_info via_mwdma_info = {
                .sht = &via_sht,
-               .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
+               .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING,
                .pio_mask = 0x1f,
                .mwdma_mask = 0x07,
                .port_ops = &via_port_ops
@@ -426,7 +435,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
        /* Ditto with IRQ masking required */
        static struct ata_port_info via_mwdma_info_borked = {
                .sht = &via_sht,
-               .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
+               .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING,
                .pio_mask = 0x1f,
                .mwdma_mask = 0x07,
                .port_ops = &via_port_ops_noirq,
@@ -434,7 +443,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
        /* VIA UDMA 33 devices (and borked 66) */
        static struct ata_port_info via_udma33_info = {
                .sht = &via_sht,
-               .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
+               .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING,
                .pio_mask = 0x1f,
                .mwdma_mask = 0x07,
                .udma_mask = 0x7,
@@ -443,7 +452,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
        /* VIA UDMA 66 devices */
        static struct ata_port_info via_udma66_info = {
                .sht = &via_sht,
-               .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
+               .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING,
                .pio_mask = 0x1f,
                .mwdma_mask = 0x07,
                .udma_mask = 0x1f,
@@ -452,7 +461,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
        /* VIA UDMA 100 devices */
        static struct ata_port_info via_udma100_info = {
                .sht = &via_sht,
-               .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
+               .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING,
                .pio_mask = 0x1f,
                .mwdma_mask = 0x07,
                .udma_mask = 0x3f,
@@ -461,7 +470,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
        /* UDMA133 with bad AST (All current 133) */
        static struct ata_port_info via_udma133_info = {
                .sht = &via_sht,
-               .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
+               .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING,
                .pio_mask = 0x1f,
                .mwdma_mask = 0x07,
                .udma_mask = 0x7f,      /* FIXME: should check north bridge */
@@ -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[] = {