aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-06-07 20:09:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-06-07 20:09:03 -0400
commit4d3d769c605ebdf9fbb5a9d63827598b48351861 (patch)
treeb71d8faa40a026b2ed68a24ab25ccfd514cf45f3 /drivers
parentcfca31ce789963c0dd6ca2e9cc13b90cc2802fbd (diff)
parent0ee719527229fa86ace8e3abccae3c2a8bbfd6db (diff)
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev: ahci: redo stopping DMA engines on empty ports sata_sil24: fix kernel panic on ARM caused by unaligned access in sata_sil24 ahci: add pci quirk for JMB362 sata_via: explain the magic fix
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/libahci.c21
-rw-r--r--drivers/ata/sata_sil24.c12
-rw-r--r--drivers/ata/sata_via.c18
-rw-r--r--drivers/pci/quirks.c5
4 files changed, 29 insertions, 27 deletions
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 1984a6e89e84..261f86d102e8 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -541,29 +541,11 @@ static int ahci_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
541 return -EINVAL; 541 return -EINVAL;
542} 542}
543 543
544static int ahci_is_device_present(void __iomem *port_mmio)
545{
546 u8 status = readl(port_mmio + PORT_TFDATA) & 0xff;
547
548 /* Make sure PxTFD.STS.BSY and PxTFD.STS.DRQ are 0 */
549 if (status & (ATA_BUSY | ATA_DRQ))
550 return 0;
551
552 /* Make sure PxSSTS.DET is 3h */
553 status = readl(port_mmio + PORT_SCR_STAT) & 0xf;
554 if (status != 3)
555 return 0;
556 return 1;
557}
558
559void ahci_start_engine(struct ata_port *ap) 544void ahci_start_engine(struct ata_port *ap)
560{ 545{
561 void __iomem *port_mmio = ahci_port_base(ap); 546 void __iomem *port_mmio = ahci_port_base(ap);
562 u32 tmp; 547 u32 tmp;
563 548
564 if (!ahci_is_device_present(port_mmio))
565 return;
566
567 /* start DMA */ 549 /* start DMA */
568 tmp = readl(port_mmio + PORT_CMD); 550 tmp = readl(port_mmio + PORT_CMD);
569 tmp |= PORT_CMD_START; 551 tmp |= PORT_CMD_START;
@@ -1892,6 +1874,9 @@ static void ahci_error_handler(struct ata_port *ap)
1892 } 1874 }
1893 1875
1894 sata_pmp_error_handler(ap); 1876 sata_pmp_error_handler(ap);
1877
1878 if (!ata_dev_enabled(ap->link.device))
1879 ahci_stop_engine(ap);
1895} 1880}
1896 1881
1897static void ahci_post_internal_cmd(struct ata_queued_cmd *qc) 1882static void ahci_post_internal_cmd(struct ata_queued_cmd *qc)
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index e9250514734b..70b58fe9e5b1 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -539,12 +539,12 @@ static void sil24_config_port(struct ata_port *ap)
539 writel(PORT_CS_IRQ_WOC, port + PORT_CTRL_CLR); 539 writel(PORT_CS_IRQ_WOC, port + PORT_CTRL_CLR);
540 540
541 /* zero error counters. */ 541 /* zero error counters. */
542 writel(0x8000, port + PORT_DECODE_ERR_THRESH); 542 writew(0x8000, port + PORT_DECODE_ERR_THRESH);
543 writel(0x8000, port + PORT_CRC_ERR_THRESH); 543 writew(0x8000, port + PORT_CRC_ERR_THRESH);
544 writel(0x8000, port + PORT_HSHK_ERR_THRESH); 544 writew(0x8000, port + PORT_HSHK_ERR_THRESH);
545 writel(0x0000, port + PORT_DECODE_ERR_CNT); 545 writew(0x0000, port + PORT_DECODE_ERR_CNT);
546 writel(0x0000, port + PORT_CRC_ERR_CNT); 546 writew(0x0000, port + PORT_CRC_ERR_CNT);
547 writel(0x0000, port + PORT_HSHK_ERR_CNT); 547 writew(0x0000, port + PORT_HSHK_ERR_CNT);
548 548
549 /* always use 64bit activation */ 549 /* always use 64bit activation */
550 writel(PORT_CS_32BIT_ACTV, port + PORT_CTRL_CLR); 550 writel(PORT_CS_32BIT_ACTV, port + PORT_CTRL_CLR);
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index 0ecd0f6aa2c0..4730c42a5ee5 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -578,10 +578,24 @@ static void svia_configure(struct pci_dev *pdev)
578 578
579 /* 579 /*
580 * vt6421 has problems talking to some drives. The following 580 * vt6421 has problems talking to some drives. The following
581 * is the magic fix from Joseph Chan <JosephChan@via.com.tw>. 581 * is the fix from Joseph Chan <JosephChan@via.com.tw>.
582 * Please add proper documentation if possible. 582 *
583 * When host issues HOLD, device may send up to 20DW of data
584 * before acknowledging it with HOLDA and the host should be
585 * able to buffer them in FIFO. Unfortunately, some WD drives
586 * send upto 40DW before acknowledging HOLD and, in the
587 * default configuration, this ends up overflowing vt6421's
588 * FIFO, making the controller abort the transaction with
589 * R_ERR.
590 *
591 * Rx52[2] is the internal 128DW FIFO Flow control watermark
592 * adjusting mechanism enable bit and the default value 0
593 * means host will issue HOLD to device when the left FIFO
594 * size goes below 32DW. Setting it to 1 makes the watermark
595 * 64DW.
583 * 596 *
584 * https://bugzilla.kernel.org/show_bug.cgi?id=15173 597 * https://bugzilla.kernel.org/show_bug.cgi?id=15173
598 * http://article.gmane.org/gmane.linux.ide/46352
585 */ 599 */
586 if (pdev->device == 0x3249) { 600 if (pdev->device == 0x3249) {
587 pci_read_config_byte(pdev, 0x52, &tmp8); 601 pci_read_config_byte(pdev, 0x52, &tmp8);
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index b7512cf08c58..477345d41641 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1457,7 +1457,8 @@ static void quirk_jmicron_ata(struct pci_dev *pdev)
1457 conf5 &= ~(1 << 24); /* Clear bit 24 */ 1457 conf5 &= ~(1 << 24); /* Clear bit 24 */
1458 1458
1459 switch (pdev->device) { 1459 switch (pdev->device) {
1460 case PCI_DEVICE_ID_JMICRON_JMB360: 1460 case PCI_DEVICE_ID_JMICRON_JMB360: /* SATA single port */
1461 case PCI_DEVICE_ID_JMICRON_JMB362: /* SATA dual ports */
1461 /* The controller should be in single function ahci mode */ 1462 /* The controller should be in single function ahci mode */
1462 conf1 |= 0x0002A100; /* Set 8, 13, 15, 17 */ 1463 conf1 |= 0x0002A100; /* Set 8, 13, 15, 17 */
1463 break; 1464 break;
@@ -1493,12 +1494,14 @@ static void quirk_jmicron_ata(struct pci_dev *pdev)
1493} 1494}
1494DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB360, quirk_jmicron_ata); 1495DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB360, quirk_jmicron_ata);
1495DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361, quirk_jmicron_ata); 1496DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361, quirk_jmicron_ata);
1497DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB362, quirk_jmicron_ata);
1496DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363, quirk_jmicron_ata); 1498DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363, quirk_jmicron_ata);
1497DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365, quirk_jmicron_ata); 1499DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365, quirk_jmicron_ata);
1498DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366, quirk_jmicron_ata); 1500DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366, quirk_jmicron_ata);
1499DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB368, quirk_jmicron_ata); 1501DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB368, quirk_jmicron_ata);
1500DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB360, quirk_jmicron_ata); 1502DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB360, quirk_jmicron_ata);
1501DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361, quirk_jmicron_ata); 1503DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361, quirk_jmicron_ata);
1504DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB362, quirk_jmicron_ata);
1502DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363, quirk_jmicron_ata); 1505DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363, quirk_jmicron_ata);
1503DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365, quirk_jmicron_ata); 1506DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365, quirk_jmicron_ata);
1504DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366, quirk_jmicron_ata); 1507DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366, quirk_jmicron_ata);