caif: SPI-driver bugfix - incorrect padding.
[pandora-kernel.git] / drivers / ata / sata_via.c
index 101d8c2..c215899 100644 (file)
@@ -349,7 +349,7 @@ static int vt6420_prereset(struct ata_link *link, unsigned long deadline)
 
        /* wait for phy to become ready, if necessary */
        do {
-               msleep(200);
+               ata_msleep(link->ap, 200);
                svia_scr_read(link, SCR_STATUS, &sstatus);
                if ((sstatus & 0xf) != 1)
                        break;
@@ -575,6 +575,33 @@ static void svia_configure(struct pci_dev *pdev)
                tmp8 |= NATIVE_MODE_ALL;
                pci_write_config_byte(pdev, SATA_NATIVE_MODE, tmp8);
        }
+
+       /*
+        * vt6421 has problems talking to some drives.  The following
+        * is the fix from Joseph Chan <JosephChan@via.com.tw>.
+        *
+        * When host issues HOLD, device may send up to 20DW of data
+        * before acknowledging it with HOLDA and the host should be
+        * able to buffer them in FIFO.  Unfortunately, some WD drives
+        * send upto 40DW before acknowledging HOLD and, in the
+        * default configuration, this ends up overflowing vt6421's
+        * FIFO, making the controller abort the transaction with
+        * R_ERR.
+        *
+        * Rx52[2] is the internal 128DW FIFO Flow control watermark
+        * adjusting mechanism enable bit and the default value 0
+        * means host will issue HOLD to device when the left FIFO
+        * size goes below 32DW.  Setting it to 1 makes the watermark
+        * 64DW.
+        *
+        * https://bugzilla.kernel.org/show_bug.cgi?id=15173
+        * http://article.gmane.org/gmane.linux.ide/46352
+        */
+       if (pdev->device == 0x3249) {
+               pci_read_config_byte(pdev, 0x52, &tmp8);
+               tmp8 |= 1 << 2;
+               pci_write_config_byte(pdev, 0x52, tmp8);
+       }
 }
 
 static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)