vmscan: prevent get_scan_ratio() rounding errors
[safe/jmp/linux-2.6] / drivers / ata / pata_it8213.c
index 84ab89e..f971f0d 100644 (file)
@@ -22,7 +22,7 @@
 #define DRV_VERSION    "0.0.3"
 
 /**
- *     it8213_pre_reset        -       check for 40/80 pin
+ *     it8213_pre_reset        -       probe begin
  *     @link: link
  *     @deadline: deadline jiffies for the operation
  *
@@ -40,7 +40,7 @@ static int it8213_pre_reset(struct ata_link *link, unsigned long deadline)
        if (!pci_test_config_bits(pdev, &it8213_enable_bits[ap->port_no]))
                return -ENOENT;
 
-       return ata_std_prereset(link, deadline);
+       return ata_sff_prereset(link, deadline);
 }
 
 /**
@@ -92,18 +92,17 @@ static void it8213_set_piomode (struct ata_port *ap, struct ata_device *adev)
                            { 2, 1 },
                            { 2, 3 }, };
 
-       if (pio > 2)
-               control |= 1;   /* TIME1 enable */
+       if (pio > 1)
+               control |= 1;   /* TIME */
        if (ata_pio_need_iordy(adev))   /* PIO 3/4 require IORDY */
-               control |= 2;   /* IORDY enable */
+               control |= 2;   /* IE */
        /* Bit 2 is set for ATAPI on the IT8213 - reverse of ICH/PIIX */
        if (adev->class != ATA_DEV_ATA)
-               control |= 4;
+               control |= 4;   /* PPE */
 
        pci_read_config_word(dev, idetm_port, &idetm_data);
 
-       /* Enable PPE, IE and TIME as appropriate */
-
+       /* Set PPE, IE, and TIME as appropriate */
        if (adev->devno == 0) {
                idetm_data &= 0xCCF0;
                idetm_data |= control;
@@ -112,17 +111,17 @@ static void it8213_set_piomode (struct ata_port *ap, struct ata_device *adev)
        } else {
                u8 slave_data;
 
-               idetm_data &= 0xCC0F;
+               idetm_data &= 0xFF0F;
                idetm_data |= (control << 4);
 
                /* Slave timing in separate register */
                pci_read_config_byte(dev, 0x44, &slave_data);
                slave_data &= 0xF0;
-               slave_data |= ((timings[pio][0] << 2) | timings[pio][1]) << 4;
+               slave_data |= (timings[pio][0] << 2) | timings[pio][1];
                pci_write_config_byte(dev, 0x44, slave_data);
        }
 
-       idetm_data |= 0x4000;   /* Ensure SITRE is enabled */
+       idetm_data |= 0x4000;   /* Ensure SITRE is set */
        pci_write_config_word(dev, idetm_port, idetm_data);
 }
 
@@ -173,10 +172,10 @@ static void it8213_set_dmamode (struct ata_port *ap, struct ata_device *adev)
 
                udma_enable |= (1 << devid);
 
-               /* Load the UDMA mode number */
+               /* Load the UDMA cycle time */
                pci_read_config_word(dev, 0x4A, &udma_timing);
                udma_timing &= ~(3 << (4 * devid));
-               udma_timing |= (udma & 3) << (4 * devid);
+               udma_timing |= u_speed << (4 * devid);
                pci_write_config_word(dev, 0x4A, udma_timing);
 
                /* Load the clock selection */
@@ -211,7 +210,7 @@ static void it8213_set_dmamode (struct ata_port *ap, struct ata_device *adev)
                        master_data &= 0xFF4F;  /* Mask out IORDY|TIME1|DMAONLY */
                        master_data |= control << 4;
                        pci_read_config_byte(dev, 0x44, &slave_data);
-                       slave_data &= (0x0F + 0xE1 * ap->port_no);
+                       slave_data &= 0xF0;
                        /* Load the matching timing */
                        slave_data |= ((timings[pio][0] << 2) | timings[pio][1]) << (ap->port_no ? 4 : 0);
                        pci_write_config_byte(dev, 0x44, slave_data);
@@ -262,8 +261,8 @@ static int it8213_init_one (struct pci_dev *pdev, const struct pci_device_id *en
        static int printed_version;
        static const struct ata_port_info info = {
                .flags          = ATA_FLAG_SLAVE_POSS,
-               .pio_mask       = 0x1f, /* pio0-4 */
-               .mwdma_mask     = 0x07, /* mwdma0-2 */
+               .pio_mask       = ATA_PIO4,
+               .mwdma_mask     = ATA_MWDMA12_ONLY,
                .udma_mask      = ATA_UDMA4, /* FIXME: want UDMA 100? */
                .port_ops       = &it8213_ops,
        };
@@ -274,7 +273,7 @@ static int it8213_init_one (struct pci_dev *pdev, const struct pci_device_id *en
                dev_printk(KERN_DEBUG, &pdev->dev,
                           "version " DRV_VERSION "\n");
 
-       return ata_pci_init_one(pdev, ppi, &it8213_sht, NULL);
+       return ata_pci_sff_init_one(pdev, ppi, &it8213_sht, NULL, 0);
 }
 
 static const struct pci_device_id it8213_pci_tbl[] = {