aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-01-27 10:47:22 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-27 10:47:22 -0500
commit8c022fdd5fc1b9949bad21d26e0cb115d045c7f9 (patch)
treec3aeafc3e7f0fc91711b77ab95c018f684a05aea /drivers
parentff2bad5f899421850f7e9bc956450e4c61b0b95d (diff)
parentb98f5046397b9f4c5060e5b73e483bfd9e453dd6 (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: pata-rb532-cf: remove set_irq_type from finish_io [libata] pata_via: support VX855, future chips whose IDE controller use 0x0571 sata_mv: no longer experimental (v2) sata_mv: msi masking fix (v2) sata_mv: Properly initialize main irq mask sata_mv: remove bogus nsect restriction sata_mv: don't read hc_irq_cause sata_mv: fix 8-port timeouts on 508x/6081 chips sata_nv: fix MCP5x reset sata_nv: rename nv_nf2_hardreset() libata: set NODEV_HINT for 0x7f status libata-sff: fix incorrect EH message
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/Kconfig6
-rw-r--r--drivers/ata/libata-sff.c12
-rw-r--r--drivers/ata/pata_rb532_cf.c2
-rw-r--r--drivers/ata/pata_via.c22
-rw-r--r--drivers/ata/sata_mv.c56
-rw-r--r--drivers/ata/sata_nv.c70
6 files changed, 100 insertions, 68 deletions
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 503a908afc80..0bcf26464670 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -112,11 +112,11 @@ config ATA_PIIX
112 If unsure, say N. 112 If unsure, say N.
113 113
114config SATA_MV 114config SATA_MV
115 tristate "Marvell SATA support (HIGHLY EXPERIMENTAL)" 115 tristate "Marvell SATA support"
116 depends on EXPERIMENTAL
117 help 116 help
118 This option enables support for the Marvell Serial ATA family. 117 This option enables support for the Marvell Serial ATA family.
119 Currently supports 88SX[56]0[48][01] chips. 118 Currently supports 88SX[56]0[48][01] PCI(-X) chips,
119 as well as the newer [67]042 PCI-X/PCIe and SOC devices.
120 120
121 If unsure, say N. 121 If unsure, say N.
122 122
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 5a4aad123c42..0b299b0f8172 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -1322,7 +1322,7 @@ fsm_start:
1322 * condition. Mark hint. 1322 * condition. Mark hint.
1323 */ 1323 */
1324 ata_ehi_push_desc(ehi, "ST-ATA: " 1324 ata_ehi_push_desc(ehi, "ST-ATA: "
1325 "DRQ=1 with device error, " 1325 "DRQ=0 without device error, "
1326 "dev_stat 0x%X", status); 1326 "dev_stat 0x%X", status);
1327 qc->err_mask |= AC_ERR_HSM | 1327 qc->err_mask |= AC_ERR_HSM |
1328 AC_ERR_NODEV_HINT; 1328 AC_ERR_NODEV_HINT;
@@ -1358,6 +1358,16 @@ fsm_start:
1358 qc->err_mask |= AC_ERR_HSM; 1358 qc->err_mask |= AC_ERR_HSM;
1359 } 1359 }
1360 1360
1361 /* There are oddball controllers with
1362 * status register stuck at 0x7f and
1363 * lbal/m/h at zero which makes it
1364 * pass all other presence detection
1365 * mechanisms we have. Set NODEV_HINT
1366 * for it. Kernel bz#7241.
1367 */
1368 if (status == 0x7f)
1369 qc->err_mask |= AC_ERR_NODEV_HINT;
1370
1361 /* ata_pio_sectors() might change the 1371 /* ata_pio_sectors() might change the
1362 * state to HSM_ST_LAST. so, the state 1372 * state to HSM_ST_LAST. so, the state
1363 * is changed after ata_pio_sectors(). 1373 * is changed after ata_pio_sectors().
diff --git a/drivers/ata/pata_rb532_cf.c b/drivers/ata/pata_rb532_cf.c
index c2e6fb9f2ef9..ebfcda26d639 100644
--- a/drivers/ata/pata_rb532_cf.c
+++ b/drivers/ata/pata_rb532_cf.c
@@ -63,8 +63,6 @@ static inline void rb532_pata_finish_io(struct ata_port *ap)
63 ata_sff_sync might be sufficient. */ 63 ata_sff_sync might be sufficient. */
64 ata_sff_dma_pause(ap); 64 ata_sff_dma_pause(ap);
65 ndelay(RB500_CF_IO_DELAY); 65 ndelay(RB500_CF_IO_DELAY);
66
67 set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH);
68} 66}
69 67
70static void rb532_pata_exec_command(struct ata_port *ap, 68static void rb532_pata_exec_command(struct ata_port *ap,
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index 681169c9c640..79a6c9a0b721 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -86,6 +86,10 @@ enum {
86 VIA_SATA_PATA = 0x800, /* SATA/PATA combined configuration */ 86 VIA_SATA_PATA = 0x800, /* SATA/PATA combined configuration */
87}; 87};
88 88
89enum {
90 VIA_IDFLAG_SINGLE = (1 << 0), /* single channel controller) */
91};
92
89/* 93/*
90 * VIA SouthBridge chips. 94 * VIA SouthBridge chips.
91 */ 95 */
@@ -97,8 +101,12 @@ static const struct via_isa_bridge {
97 u8 rev_max; 101 u8 rev_max;
98 u16 flags; 102 u16 flags;
99} via_isa_bridges[] = { 103} via_isa_bridges[] = {
104 { "vx855", PCI_DEVICE_ID_VIA_VX855, 0x00, 0x2f,
105 VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA },
100 { "vx800", PCI_DEVICE_ID_VIA_VX800, 0x00, 0x2f, VIA_UDMA_133 | 106 { "vx800", PCI_DEVICE_ID_VIA_VX800, 0x00, 0x2f, VIA_UDMA_133 |
101 VIA_BAD_AST | VIA_SATA_PATA }, 107 VIA_BAD_AST | VIA_SATA_PATA },
108 { "vt8261", PCI_DEVICE_ID_VIA_8261, 0x00, 0x2f,
109 VIA_UDMA_133 | VIA_BAD_AST },
102 { "vt8237s", PCI_DEVICE_ID_VIA_8237S, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 110 { "vt8237s", PCI_DEVICE_ID_VIA_8237S, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
103 { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 111 { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
104 { "cx700", PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA }, 112 { "cx700", PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA },
@@ -122,6 +130,8 @@ static const struct via_isa_bridge {
122 { "vt82c586", PCI_DEVICE_ID_VIA_82C586_0, 0x00, 0x0f, VIA_UDMA_NONE | VIA_SET_FIFO }, 130 { "vt82c586", PCI_DEVICE_ID_VIA_82C586_0, 0x00, 0x0f, VIA_UDMA_NONE | VIA_SET_FIFO },
123 { "vt82c576", PCI_DEVICE_ID_VIA_82C576, 0x00, 0x2f, VIA_UDMA_NONE | VIA_SET_FIFO | VIA_NO_UNMASK }, 131 { "vt82c576", PCI_DEVICE_ID_VIA_82C576, 0x00, 0x2f, VIA_UDMA_NONE | VIA_SET_FIFO | VIA_NO_UNMASK },
124 { "vt82c576", PCI_DEVICE_ID_VIA_82C576, 0x00, 0x2f, VIA_UDMA_NONE | VIA_SET_FIFO | VIA_NO_UNMASK | VIA_BAD_ID }, 132 { "vt82c576", PCI_DEVICE_ID_VIA_82C576, 0x00, 0x2f, VIA_UDMA_NONE | VIA_SET_FIFO | VIA_NO_UNMASK | VIA_BAD_ID },
133 { "vtxxxx", PCI_DEVICE_ID_VIA_ANON, 0x00, 0x2f,
134 VIA_UDMA_133 | VIA_BAD_AST },
125 { NULL } 135 { NULL }
126}; 136};
127 137
@@ -460,6 +470,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
460 static int printed_version; 470 static int printed_version;
461 u8 enable; 471 u8 enable;
462 u32 timing; 472 u32 timing;
473 unsigned long flags = id->driver_data;
463 int rc; 474 int rc;
464 475
465 if (!printed_version++) 476 if (!printed_version++)
@@ -469,9 +480,13 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
469 if (rc) 480 if (rc)
470 return rc; 481 return rc;
471 482
483 if (flags & VIA_IDFLAG_SINGLE)
484 ppi[1] = &ata_dummy_port_info;
485
472 /* To find out how the IDE will behave and what features we 486 /* To find out how the IDE will behave and what features we
473 actually have to look at the bridge not the IDE controller */ 487 actually have to look at the bridge not the IDE controller */
474 for (config = via_isa_bridges; config->id; config++) 488 for (config = via_isa_bridges; config->id != PCI_DEVICE_ID_VIA_ANON;
489 config++)
475 if ((isa = pci_get_device(PCI_VENDOR_ID_VIA + 490 if ((isa = pci_get_device(PCI_VENDOR_ID_VIA +
476 !!(config->flags & VIA_BAD_ID), 491 !!(config->flags & VIA_BAD_ID),
477 config->id, NULL))) { 492 config->id, NULL))) {
@@ -482,10 +497,6 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
482 pci_dev_put(isa); 497 pci_dev_put(isa);
483 } 498 }
484 499
485 if (!config->id) {
486 printk(KERN_WARNING "via: Unknown VIA SouthBridge, disabling.\n");
487 return -ENODEV;
488 }
489 pci_dev_put(isa); 500 pci_dev_put(isa);
490 501
491 if (!(config->flags & VIA_NO_ENABLES)) { 502 if (!(config->flags & VIA_NO_ENABLES)) {
@@ -587,6 +598,7 @@ static const struct pci_device_id via[] = {
587 { PCI_VDEVICE(VIA, 0x1571), }, 598 { PCI_VDEVICE(VIA, 0x1571), },
588 { PCI_VDEVICE(VIA, 0x3164), }, 599 { PCI_VDEVICE(VIA, 0x3164), },
589 { PCI_VDEVICE(VIA, 0x5324), }, 600 { PCI_VDEVICE(VIA, 0x5324), },
601 { PCI_VDEVICE(VIA, 0xC409), VIA_IDFLAG_SINGLE },
590 602
591 { }, 603 { },
592}; 604};
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 86918634a4c5..f2d8a020ea53 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -33,10 +33,6 @@
33 * 33 *
34 * --> ATAPI support (Marvell claims the 60xx/70xx chips can do it). 34 * --> ATAPI support (Marvell claims the 60xx/70xx chips can do it).
35 * 35 *
36 * --> Investigate problems with PCI Message Signalled Interrupts (MSI).
37 *
38 * --> Cache frequently-accessed registers in mv_port_priv to reduce overhead.
39 *
40 * --> Develop a low-power-consumption strategy, and implement it. 36 * --> Develop a low-power-consumption strategy, and implement it.
41 * 37 *
42 * --> [Experiment, low priority] Investigate interrupt coalescing. 38 * --> [Experiment, low priority] Investigate interrupt coalescing.
@@ -72,7 +68,7 @@
72#include <linux/libata.h> 68#include <linux/libata.h>
73 69
74#define DRV_NAME "sata_mv" 70#define DRV_NAME "sata_mv"
75#define DRV_VERSION "1.24" 71#define DRV_VERSION "1.25"
76 72
77enum { 73enum {
78 /* BAR's are enumerated in terms of pci_resource_start() terms */ 74 /* BAR's are enumerated in terms of pci_resource_start() terms */
@@ -351,8 +347,6 @@ enum {
351 347
352 EDMA_HALTCOND_OFS = 0x60, /* GenIIe halt conditions */ 348 EDMA_HALTCOND_OFS = 0x60, /* GenIIe halt conditions */
353 349
354 GEN_II_NCQ_MAX_SECTORS = 256, /* max sects/io on Gen2 w/NCQ */
355
356 /* Host private flags (hp_flags) */ 350 /* Host private flags (hp_flags) */
357 MV_HP_FLAG_MSI = (1 << 0), 351 MV_HP_FLAG_MSI = (1 << 0),
358 MV_HP_ERRATA_50XXB0 = (1 << 1), 352 MV_HP_ERRATA_50XXB0 = (1 << 1),
@@ -883,19 +877,15 @@ static void mv_start_dma(struct ata_port *ap, void __iomem *port_mmio,
883 struct mv_host_priv *hpriv = ap->host->private_data; 877 struct mv_host_priv *hpriv = ap->host->private_data;
884 int hardport = mv_hardport_from_port(ap->port_no); 878 int hardport = mv_hardport_from_port(ap->port_no);
885 void __iomem *hc_mmio = mv_hc_base_from_port( 879 void __iomem *hc_mmio = mv_hc_base_from_port(
886 mv_host_base(ap->host), hardport); 880 mv_host_base(ap->host), ap->port_no);
887 u32 hc_irq_cause, ipending; 881 u32 hc_irq_cause;
888 882
889 /* clear EDMA event indicators, if any */ 883 /* clear EDMA event indicators, if any */
890 writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); 884 writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS);
891 885
892 /* clear EDMA interrupt indicator, if any */ 886 /* clear pending irq events */
893 hc_irq_cause = readl(hc_mmio + HC_IRQ_CAUSE_OFS); 887 hc_irq_cause = ~((DEV_IRQ | DMA_IRQ) << hardport);
894 ipending = (DEV_IRQ | DMA_IRQ) << hardport; 888 writelfl(hc_irq_cause, hc_mmio + HC_IRQ_CAUSE_OFS);
895 if (hc_irq_cause & ipending) {
896 writelfl(hc_irq_cause & ~ipending,
897 hc_mmio + HC_IRQ_CAUSE_OFS);
898 }
899 889
900 mv_edma_cfg(ap, want_ncq); 890 mv_edma_cfg(ap, want_ncq);
901 891
@@ -1099,20 +1089,12 @@ static void mv6_dev_config(struct ata_device *adev)
1099 * 1089 *
1100 * Gen-II does not support NCQ over a port multiplier 1090 * Gen-II does not support NCQ over a port multiplier
1101 * (no FIS-based switching). 1091 * (no FIS-based switching).
1102 *
1103 * We don't have hob_nsect when doing NCQ commands on Gen-II.
1104 * See mv_qc_prep() for more info.
1105 */ 1092 */
1106 if (adev->flags & ATA_DFLAG_NCQ) { 1093 if (adev->flags & ATA_DFLAG_NCQ) {
1107 if (sata_pmp_attached(adev->link->ap)) { 1094 if (sata_pmp_attached(adev->link->ap)) {
1108 adev->flags &= ~ATA_DFLAG_NCQ; 1095 adev->flags &= ~ATA_DFLAG_NCQ;
1109 ata_dev_printk(adev, KERN_INFO, 1096 ata_dev_printk(adev, KERN_INFO,
1110 "NCQ disabled for command-based switching\n"); 1097 "NCQ disabled for command-based switching\n");
1111 } else if (adev->max_sectors > GEN_II_NCQ_MAX_SECTORS) {
1112 adev->max_sectors = GEN_II_NCQ_MAX_SECTORS;
1113 ata_dev_printk(adev, KERN_INFO,
1114 "max_sectors limited to %u for NCQ\n",
1115 adev->max_sectors);
1116 } 1098 }
1117 } 1099 }
1118} 1100}
@@ -1450,7 +1432,8 @@ static void mv_qc_prep(struct ata_queued_cmd *qc)
1450 * only 11 bytes...so we must pick and choose required 1432 * only 11 bytes...so we must pick and choose required
1451 * registers based on the command. So, we drop feature and 1433 * registers based on the command. So, we drop feature and
1452 * hob_feature for [RW] DMA commands, but they are needed for 1434 * hob_feature for [RW] DMA commands, but they are needed for
1453 * NCQ. NCQ will drop hob_nsect. 1435 * NCQ. NCQ will drop hob_nsect, which is not needed there
1436 * (nsect is used only for the tag; feat/hob_feat hold true nsect).
1454 */ 1437 */
1455 switch (tf->command) { 1438 switch (tf->command) {
1456 case ATA_CMD_READ: 1439 case ATA_CMD_READ:
@@ -2214,9 +2197,15 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance)
2214 struct ata_host *host = dev_instance; 2197 struct ata_host *host = dev_instance;
2215 struct mv_host_priv *hpriv = host->private_data; 2198 struct mv_host_priv *hpriv = host->private_data;
2216 unsigned int handled = 0; 2199 unsigned int handled = 0;
2200 int using_msi = hpriv->hp_flags & MV_HP_FLAG_MSI;
2217 u32 main_irq_cause, pending_irqs; 2201 u32 main_irq_cause, pending_irqs;
2218 2202
2219 spin_lock(&host->lock); 2203 spin_lock(&host->lock);
2204
2205 /* for MSI: block new interrupts while in here */
2206 if (using_msi)
2207 writel(0, hpriv->main_irq_mask_addr);
2208
2220 main_irq_cause = readl(hpriv->main_irq_cause_addr); 2209 main_irq_cause = readl(hpriv->main_irq_cause_addr);
2221 pending_irqs = main_irq_cause & hpriv->main_irq_mask; 2210 pending_irqs = main_irq_cause & hpriv->main_irq_mask;
2222 /* 2211 /*
@@ -2230,6 +2219,11 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance)
2230 handled = mv_host_intr(host, pending_irqs); 2219 handled = mv_host_intr(host, pending_irqs);
2231 } 2220 }
2232 spin_unlock(&host->lock); 2221 spin_unlock(&host->lock);
2222
2223 /* for MSI: unmask; interrupt cause bits will retrigger now */
2224 if (using_msi)
2225 writel(hpriv->main_irq_mask, hpriv->main_irq_mask_addr);
2226
2233 return IRQ_RETVAL(handled); 2227 return IRQ_RETVAL(handled);
2234} 2228}
2235 2229
@@ -2821,8 +2815,7 @@ static void mv_eh_thaw(struct ata_port *ap)
2821 writel(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); 2815 writel(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS);
2822 2816
2823 /* clear pending irq events */ 2817 /* clear pending irq events */
2824 hc_irq_cause = readl(hc_mmio + HC_IRQ_CAUSE_OFS); 2818 hc_irq_cause = ~((DEV_IRQ | DMA_IRQ) << hardport);
2825 hc_irq_cause &= ~((DEV_IRQ | DMA_IRQ) << hardport);
2826 writelfl(hc_irq_cause, hc_mmio + HC_IRQ_CAUSE_OFS); 2819 writelfl(hc_irq_cause, hc_mmio + HC_IRQ_CAUSE_OFS);
2827 2820
2828 mv_enable_port_irqs(ap, ERR_IRQ); 2821 mv_enable_port_irqs(ap, ERR_IRQ);
@@ -3075,6 +3068,9 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx)
3075 hpriv->main_irq_mask_addr = mmio + PCI_HC_MAIN_IRQ_MASK_OFS; 3068 hpriv->main_irq_mask_addr = mmio + PCI_HC_MAIN_IRQ_MASK_OFS;
3076 } 3069 }
3077 3070
3071 /* initialize shadow irq mask with register's value */
3072 hpriv->main_irq_mask = readl(hpriv->main_irq_mask_addr);
3073
3078 /* global interrupt mask: 0 == mask everything */ 3074 /* global interrupt mask: 0 == mask everything */
3079 mv_set_main_irq_mask(host, ~0, 0); 3075 mv_set_main_irq_mask(host, ~0, 0);
3080 3076
@@ -3430,9 +3426,9 @@ static int mv_pci_init_one(struct pci_dev *pdev,
3430 if (rc) 3426 if (rc)
3431 return rc; 3427 return rc;
3432 3428
3433 /* Enable interrupts */ 3429 /* Enable message-switched interrupts, if requested */
3434 if (msi && pci_enable_msi(pdev)) 3430 if (msi && pci_enable_msi(pdev) == 0)
3435 pci_intx(pdev, 1); 3431 hpriv->hp_flags |= MV_HP_FLAG_MSI;
3436 3432
3437 mv_dump_pci_cfg(pdev, 0x68); 3433 mv_dump_pci_cfg(pdev, 0x68);
3438 mv_print_info(host); 3434 mv_print_info(host);
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 6f1460614325..c49ad0e61b6f 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -305,10 +305,10 @@ static irqreturn_t nv_ck804_interrupt(int irq, void *dev_instance);
305static int nv_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); 305static int nv_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
306static int nv_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); 306static int nv_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val);
307 307
308static int nv_noclassify_hardreset(struct ata_link *link, unsigned int *class,
309 unsigned long deadline);
308static void nv_nf2_freeze(struct ata_port *ap); 310static void nv_nf2_freeze(struct ata_port *ap);
309static void nv_nf2_thaw(struct ata_port *ap); 311static void nv_nf2_thaw(struct ata_port *ap);
310static int nv_nf2_hardreset(struct ata_link *link, unsigned int *class,
311 unsigned long deadline);
312static void nv_ck804_freeze(struct ata_port *ap); 312static void nv_ck804_freeze(struct ata_port *ap);
313static void nv_ck804_thaw(struct ata_port *ap); 313static void nv_ck804_thaw(struct ata_port *ap);
314static int nv_adma_slave_config(struct scsi_device *sdev); 314static int nv_adma_slave_config(struct scsi_device *sdev);
@@ -352,6 +352,7 @@ enum nv_host_type
352 NFORCE3 = NFORCE2, /* NF2 == NF3 as far as sata_nv is concerned */ 352 NFORCE3 = NFORCE2, /* NF2 == NF3 as far as sata_nv is concerned */
353 CK804, 353 CK804,
354 ADMA, 354 ADMA,
355 MCP5x,
355 SWNCQ, 356 SWNCQ,
356}; 357};
357 358
@@ -363,10 +364,10 @@ static const struct pci_device_id nv_pci_tbl[] = {
363 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA2), CK804 }, 364 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA2), CK804 },
364 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA), CK804 }, 365 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA), CK804 },
365 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2), CK804 }, 366 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2), CK804 },
366 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA), SWNCQ }, 367 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA), MCP5x },
367 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2), SWNCQ }, 368 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2), MCP5x },
368 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA), SWNCQ }, 369 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA), MCP5x },
369 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2), SWNCQ }, 370 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2), MCP5x },
370 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA), GENERIC }, 371 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA), GENERIC },
371 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2), GENERIC }, 372 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2), GENERIC },
372 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3), GENERIC }, 373 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3), GENERIC },
@@ -432,7 +433,7 @@ static struct ata_port_operations nv_nf2_ops = {
432 .inherits = &nv_common_ops, 433 .inherits = &nv_common_ops,
433 .freeze = nv_nf2_freeze, 434 .freeze = nv_nf2_freeze,
434 .thaw = nv_nf2_thaw, 435 .thaw = nv_nf2_thaw,
435 .hardreset = nv_nf2_hardreset, 436 .hardreset = nv_noclassify_hardreset,
436}; 437};
437 438
438/* CK804 finally gets hardreset right */ 439/* CK804 finally gets hardreset right */
@@ -467,8 +468,19 @@ static struct ata_port_operations nv_adma_ops = {
467 .host_stop = nv_adma_host_stop, 468 .host_stop = nv_adma_host_stop,
468}; 469};
469 470
471/* Kernel bz#12351 reports that when SWNCQ is enabled, for hotplug to
472 * work, hardreset should be used and hardreset can't report proper
473 * signature, which suggests that mcp5x is closer to nf2 as long as
474 * reset quirkiness is concerned. Define separate ops for mcp5x with
475 * nv_noclassify_hardreset().
476 */
477static struct ata_port_operations nv_mcp5x_ops = {
478 .inherits = &nv_common_ops,
479 .hardreset = nv_noclassify_hardreset,
480};
481
470static struct ata_port_operations nv_swncq_ops = { 482static struct ata_port_operations nv_swncq_ops = {
471 .inherits = &nv_generic_ops, 483 .inherits = &nv_mcp5x_ops,
472 484
473 .qc_defer = ata_std_qc_defer, 485 .qc_defer = ata_std_qc_defer,
474 .qc_prep = nv_swncq_qc_prep, 486 .qc_prep = nv_swncq_qc_prep,
@@ -531,6 +543,15 @@ static const struct ata_port_info nv_port_info[] = {
531 .port_ops = &nv_adma_ops, 543 .port_ops = &nv_adma_ops,
532 .private_data = NV_PI_PRIV(nv_adma_interrupt, &nv_adma_sht), 544 .private_data = NV_PI_PRIV(nv_adma_interrupt, &nv_adma_sht),
533 }, 545 },
546 /* MCP5x */
547 {
548 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
549 .pio_mask = NV_PIO_MASK,
550 .mwdma_mask = NV_MWDMA_MASK,
551 .udma_mask = NV_UDMA_MASK,
552 .port_ops = &nv_mcp5x_ops,
553 .private_data = NV_PI_PRIV(nv_generic_interrupt, &nv_sht),
554 },
534 /* SWNCQ */ 555 /* SWNCQ */
535 { 556 {
536 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 557 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
@@ -1530,6 +1551,17 @@ static int nv_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
1530 return 0; 1551 return 0;
1531} 1552}
1532 1553
1554static int nv_noclassify_hardreset(struct ata_link *link, unsigned int *class,
1555 unsigned long deadline)
1556{
1557 bool online;
1558 int rc;
1559
1560 rc = sata_link_hardreset(link, sata_deb_timing_hotplug, deadline,
1561 &online, NULL);
1562 return online ? -EAGAIN : rc;
1563}
1564
1533static void nv_nf2_freeze(struct ata_port *ap) 1565static void nv_nf2_freeze(struct ata_port *ap)
1534{ 1566{
1535 void __iomem *scr_addr = ap->host->ports[0]->ioaddr.scr_addr; 1567 void __iomem *scr_addr = ap->host->ports[0]->ioaddr.scr_addr;
@@ -1554,17 +1586,6 @@ static void nv_nf2_thaw(struct ata_port *ap)
1554 iowrite8(mask, scr_addr + NV_INT_ENABLE); 1586 iowrite8(mask, scr_addr + NV_INT_ENABLE);
1555} 1587}
1556 1588
1557static int nv_nf2_hardreset(struct ata_link *link, unsigned int *class,
1558 unsigned long deadline)
1559{
1560 bool online;
1561 int rc;
1562
1563 rc = sata_link_hardreset(link, sata_deb_timing_hotplug, deadline,
1564 &online, NULL);
1565 return online ? -EAGAIN : rc;
1566}
1567
1568static void nv_ck804_freeze(struct ata_port *ap) 1589static void nv_ck804_freeze(struct ata_port *ap)
1569{ 1590{
1570 void __iomem *mmio_base = ap->host->iomap[NV_MMIO_BAR]; 1591 void __iomem *mmio_base = ap->host->iomap[NV_MMIO_BAR];
@@ -2355,14 +2376,9 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2355 if (type == CK804 && adma_enabled) { 2376 if (type == CK804 && adma_enabled) {
2356 dev_printk(KERN_NOTICE, &pdev->dev, "Using ADMA mode\n"); 2377 dev_printk(KERN_NOTICE, &pdev->dev, "Using ADMA mode\n");
2357 type = ADMA; 2378 type = ADMA;
2358 } 2379 } else if (type == MCP5x && swncq_enabled) {
2359 2380 dev_printk(KERN_NOTICE, &pdev->dev, "Using SWNCQ mode\n");
2360 if (type == SWNCQ) { 2381 type = SWNCQ;
2361 if (swncq_enabled)
2362 dev_printk(KERN_NOTICE, &pdev->dev,
2363 "Using SWNCQ mode\n");
2364 else
2365 type = GENERIC;
2366 } 2382 }
2367 2383
2368 ppi[0] = &nv_port_info[type]; 2384 ppi[0] = &nv_port_info[type];