aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 12:16:07 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 12:16:07 -0500
commit2fd8507d14ef7af3ae05316b3277044cf6daa381 (patch)
tree8dc061d6c983f9be9a75109b2caef373cd7dfd80
parent1c1afa3c053d4ccdf44e5a4e159005cdfd48bfc6 (diff)
parentfd3367af3d1212f645094c4b5c4d458bdd061475 (diff)
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev: [PATCH] libata: Incorrect timing computation for PIO5/6 [PATCH] sata_promise: new EH conversion, take 2 [PATCH] libata: let ATA_FLAG_PIO_POLLING use polling pio for ATA_PROT_NODATA [PATCH] sata_promise: cleanups, take 2
-rw-r--r--drivers/ata/libata-core.c3
-rw-r--r--drivers/ata/sata_promise.c120
2 files changed, 79 insertions, 44 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 8816e30fb7a4..011c0a8a2dcc 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2303,7 +2303,7 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed,
2303 * DMA cycle timing is slower/equal than the fastest PIO timing. 2303 * DMA cycle timing is slower/equal than the fastest PIO timing.
2304 */ 2304 */
2305 2305
2306 if (speed > XFER_PIO_4) { 2306 if (speed > XFER_PIO_6) {
2307 ata_timing_compute(adev, adev->pio_mode, &p, T, UT); 2307 ata_timing_compute(adev, adev->pio_mode, &p, T, UT);
2308 ata_timing_merge(&p, t, t, ATA_TIMING_ALL); 2308 ata_timing_merge(&p, t, t, ATA_TIMING_ALL);
2309 } 2309 }
@@ -4960,6 +4960,7 @@ unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc)
4960 if (ap->flags & ATA_FLAG_PIO_POLLING) { 4960 if (ap->flags & ATA_FLAG_PIO_POLLING) {
4961 switch (qc->tf.protocol) { 4961 switch (qc->tf.protocol) {
4962 case ATA_PROT_PIO: 4962 case ATA_PROT_PIO:
4963 case ATA_PROT_NODATA:
4963 case ATA_PROT_ATAPI: 4964 case ATA_PROT_ATAPI:
4964 case ATA_PROT_ATAPI_NODATA: 4965 case ATA_PROT_ATAPI_NODATA:
4965 qc->tf.flags |= ATA_TFLAG_POLLING; 4966 qc->tf.flags |= ATA_TFLAG_POLLING;
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index a2778cf016bc..f055874a6ec5 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -66,15 +66,17 @@ enum {
66 board_2037x = 0, /* FastTrak S150 TX2plus */ 66 board_2037x = 0, /* FastTrak S150 TX2plus */
67 board_20319 = 1, /* FastTrak S150 TX4 */ 67 board_20319 = 1, /* FastTrak S150 TX4 */
68 board_20619 = 2, /* FastTrak TX4000 */ 68 board_20619 = 2, /* FastTrak TX4000 */
69 board_20771 = 3, /* FastTrak TX2300 */ 69 board_2057x = 3, /* SATAII150 Tx2plus */
70 board_2057x = 4, /* SATAII150 Tx2plus */ 70 board_40518 = 4, /* SATAII150 Tx4 */
71 board_40518 = 5, /* SATAII150 Tx4 */
72 71
73 PDC_HAS_PATA = (1 << 1), /* PDC20375/20575 has PATA */ 72 PDC_HAS_PATA = (1 << 1), /* PDC20375/20575 has PATA */
74 73
74 /* PDC_CTLSTAT bit definitions */
75 PDC_DMA_ENABLE = (1 << 7),
76 PDC_IRQ_DISABLE = (1 << 10),
75 PDC_RESET = (1 << 11), /* HDMA reset */ 77 PDC_RESET = (1 << 11), /* HDMA reset */
76 78
77 PDC_COMMON_FLAGS = ATA_FLAG_NO_LEGACY | ATA_FLAG_SRST | 79 PDC_COMMON_FLAGS = ATA_FLAG_NO_LEGACY |
78 ATA_FLAG_MMIO | ATA_FLAG_NO_ATAPI | 80 ATA_FLAG_MMIO | ATA_FLAG_NO_ATAPI |
79 ATA_FLAG_PIO_POLLING, 81 ATA_FLAG_PIO_POLLING,
80 82
@@ -90,7 +92,6 @@ struct pdc_port_priv {
90 92
91struct pdc_host_priv { 93struct pdc_host_priv {
92 unsigned long flags; 94 unsigned long flags;
93 int hotplug_offset;
94}; 95};
95 96
96static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg); 97static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg);
@@ -101,13 +102,16 @@ static void pdc_eng_timeout(struct ata_port *ap);
101static int pdc_port_start(struct ata_port *ap); 102static int pdc_port_start(struct ata_port *ap);
102static void pdc_port_stop(struct ata_port *ap); 103static void pdc_port_stop(struct ata_port *ap);
103static void pdc_pata_phy_reset(struct ata_port *ap); 104static void pdc_pata_phy_reset(struct ata_port *ap);
104static void pdc_sata_phy_reset(struct ata_port *ap);
105static void pdc_qc_prep(struct ata_queued_cmd *qc); 105static void pdc_qc_prep(struct ata_queued_cmd *qc);
106static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf); 106static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
107static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf); 107static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
108static void pdc_irq_clear(struct ata_port *ap); 108static void pdc_irq_clear(struct ata_port *ap);
109static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc); 109static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc);
110static void pdc_host_stop(struct ata_host *host); 110static void pdc_host_stop(struct ata_host *host);
111static void pdc_freeze(struct ata_port *ap);
112static void pdc_thaw(struct ata_port *ap);
113static void pdc_error_handler(struct ata_port *ap);
114static void pdc_post_internal_cmd(struct ata_queued_cmd *qc);
111 115
112 116
113static struct scsi_host_template pdc_ata_sht = { 117static struct scsi_host_template pdc_ata_sht = {
@@ -136,11 +140,12 @@ static const struct ata_port_operations pdc_sata_ops = {
136 .exec_command = pdc_exec_command_mmio, 140 .exec_command = pdc_exec_command_mmio,
137 .dev_select = ata_std_dev_select, 141 .dev_select = ata_std_dev_select,
138 142
139 .phy_reset = pdc_sata_phy_reset,
140
141 .qc_prep = pdc_qc_prep, 143 .qc_prep = pdc_qc_prep,
142 .qc_issue = pdc_qc_issue_prot, 144 .qc_issue = pdc_qc_issue_prot,
143 .eng_timeout = pdc_eng_timeout, 145 .freeze = pdc_freeze,
146 .thaw = pdc_thaw,
147 .error_handler = pdc_error_handler,
148 .post_internal_cmd = pdc_post_internal_cmd,
144 .data_xfer = ata_mmio_data_xfer, 149 .data_xfer = ata_mmio_data_xfer,
145 .irq_handler = pdc_interrupt, 150 .irq_handler = pdc_interrupt,
146 .irq_clear = pdc_irq_clear, 151 .irq_clear = pdc_irq_clear,
@@ -198,23 +203,13 @@ static const struct ata_port_info pdc_port_info[] = {
198 /* board_20619 */ 203 /* board_20619 */
199 { 204 {
200 .sht = &pdc_ata_sht, 205 .sht = &pdc_ata_sht,
201 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS, 206 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SRST | ATA_FLAG_SLAVE_POSS,
202 .pio_mask = 0x1f, /* pio0-4 */ 207 .pio_mask = 0x1f, /* pio0-4 */
203 .mwdma_mask = 0x07, /* mwdma0-2 */ 208 .mwdma_mask = 0x07, /* mwdma0-2 */
204 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 209 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
205 .port_ops = &pdc_pata_ops, 210 .port_ops = &pdc_pata_ops,
206 }, 211 },
207 212
208 /* board_20771 */
209 {
210 .sht = &pdc_ata_sht,
211 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA,
212 .pio_mask = 0x1f, /* pio0-4 */
213 .mwdma_mask = 0x07, /* mwdma0-2 */
214 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
215 .port_ops = &pdc_sata_ops,
216 },
217
218 /* board_2057x */ 213 /* board_2057x */
219 { 214 {
220 .sht = &pdc_ata_sht, 215 .sht = &pdc_ata_sht,
@@ -244,6 +239,7 @@ static const struct pci_device_id pdc_ata_pci_tbl[] = {
244 { PCI_VDEVICE(PROMISE, 0x3570), board_2057x }, 239 { PCI_VDEVICE(PROMISE, 0x3570), board_2057x },
245 { PCI_VDEVICE(PROMISE, 0x3571), board_2057x }, 240 { PCI_VDEVICE(PROMISE, 0x3571), board_2057x },
246 { PCI_VDEVICE(PROMISE, 0x3574), board_2057x }, 241 { PCI_VDEVICE(PROMISE, 0x3574), board_2057x },
242 { PCI_VDEVICE(PROMISE, 0x3577), board_2057x },
247 { PCI_VDEVICE(PROMISE, 0x3d73), board_2057x }, 243 { PCI_VDEVICE(PROMISE, 0x3d73), board_2057x },
248 { PCI_VDEVICE(PROMISE, 0x3d75), board_2057x }, 244 { PCI_VDEVICE(PROMISE, 0x3d75), board_2057x },
249 245
@@ -256,15 +252,6 @@ static const struct pci_device_id pdc_ata_pci_tbl[] = {
256 252
257 { PCI_VDEVICE(PROMISE, 0x6629), board_20619 }, 253 { PCI_VDEVICE(PROMISE, 0x6629), board_20619 },
258 254
259/* TODO: remove all associated board_20771 code, as it completely
260 * duplicates board_2037x code, unless reason for separation can be
261 * divined.
262 */
263#if 0
264 { PCI_VDEVICE(PROMISE, 0x3570), board_20771 },
265#endif
266 { PCI_VDEVICE(PROMISE, 0x3577), board_20771 },
267
268 { } /* terminate list */ 255 { } /* terminate list */
269}; 256};
270 257
@@ -366,12 +353,6 @@ static void pdc_reset_port(struct ata_port *ap)
366 readl(mmio); /* flush */ 353 readl(mmio); /* flush */
367} 354}
368 355
369static void pdc_sata_phy_reset(struct ata_port *ap)
370{
371 pdc_reset_port(ap);
372 sata_phy_reset(ap);
373}
374
375static void pdc_pata_cbl_detect(struct ata_port *ap) 356static void pdc_pata_cbl_detect(struct ata_port *ap)
376{ 357{
377 u8 tmp; 358 u8 tmp;
@@ -439,6 +420,61 @@ static void pdc_qc_prep(struct ata_queued_cmd *qc)
439 } 420 }
440} 421}
441 422
423static void pdc_freeze(struct ata_port *ap)
424{
425 void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr;
426 u32 tmp;
427
428 tmp = readl(mmio + PDC_CTLSTAT);
429 tmp |= PDC_IRQ_DISABLE;
430 tmp &= ~PDC_DMA_ENABLE;
431 writel(tmp, mmio + PDC_CTLSTAT);
432 readl(mmio + PDC_CTLSTAT); /* flush */
433}
434
435static void pdc_thaw(struct ata_port *ap)
436{
437 void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr;
438 u32 tmp;
439
440 /* clear IRQ */
441 readl(mmio + PDC_INT_SEQMASK);
442
443 /* turn IRQ back on */
444 tmp = readl(mmio + PDC_CTLSTAT);
445 tmp &= ~PDC_IRQ_DISABLE;
446 writel(tmp, mmio + PDC_CTLSTAT);
447 readl(mmio + PDC_CTLSTAT); /* flush */
448}
449
450static void pdc_error_handler(struct ata_port *ap)
451{
452 ata_reset_fn_t hardreset;
453
454 if (!(ap->pflags & ATA_PFLAG_FROZEN))
455 pdc_reset_port(ap);
456
457 hardreset = NULL;
458 if (sata_scr_valid(ap))
459 hardreset = sata_std_hardreset;
460
461 /* perform recovery */
462 ata_do_eh(ap, ata_std_prereset, ata_std_softreset, hardreset,
463 ata_std_postreset);
464}
465
466static void pdc_post_internal_cmd(struct ata_queued_cmd *qc)
467{
468 struct ata_port *ap = qc->ap;
469
470 if (qc->flags & ATA_QCFLAG_FAILED)
471 qc->err_mask |= AC_ERR_OTHER;
472
473 /* make DMA engine forget about the failed command */
474 if (qc->err_mask)
475 pdc_reset_port(ap);
476}
477
442static void pdc_eng_timeout(struct ata_port *ap) 478static void pdc_eng_timeout(struct ata_port *ap)
443{ 479{
444 struct ata_host *host = ap->host; 480 struct ata_host *host = ap->host;
@@ -645,9 +681,14 @@ static void pdc_host_init(unsigned int chip_id, struct ata_probe_ent *pe)
645{ 681{
646 void __iomem *mmio = pe->mmio_base; 682 void __iomem *mmio = pe->mmio_base;
647 struct pdc_host_priv *hp = pe->private_data; 683 struct pdc_host_priv *hp = pe->private_data;
648 int hotplug_offset = hp->hotplug_offset; 684 int hotplug_offset;
649 u32 tmp; 685 u32 tmp;
650 686
687 if (hp->flags & PDC_FLAG_GEN_II)
688 hotplug_offset = PDC2_SATA_PLUG_CSR;
689 else
690 hotplug_offset = PDC_SATA_PLUG_CSR;
691
651 /* 692 /*
652 * Except for the hotplug stuff, this is voodoo from the 693 * Except for the hotplug stuff, this is voodoo from the
653 * Promise driver. Label this entire section 694 * Promise driver. Label this entire section
@@ -742,8 +783,6 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
742 goto err_out_free_ent; 783 goto err_out_free_ent;
743 } 784 }
744 785
745 /* Set default hotplug offset */
746 hp->hotplug_offset = PDC_SATA_PLUG_CSR;
747 probe_ent->private_data = hp; 786 probe_ent->private_data = hp;
748 787
749 probe_ent->sht = pdc_port_info[board_idx].sht; 788 probe_ent->sht = pdc_port_info[board_idx].sht;
@@ -767,8 +806,6 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
767 switch (board_idx) { 806 switch (board_idx) {
768 case board_40518: 807 case board_40518:
769 hp->flags |= PDC_FLAG_GEN_II; 808 hp->flags |= PDC_FLAG_GEN_II;
770 /* Override hotplug offset for SATAII150 */
771 hp->hotplug_offset = PDC2_SATA_PLUG_CSR;
772 /* Fall through */ 809 /* Fall through */
773 case board_20319: 810 case board_20319:
774 probe_ent->n_ports = 4; 811 probe_ent->n_ports = 4;
@@ -780,10 +817,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
780 probe_ent->port[3].scr_addr = base + 0x700; 817 probe_ent->port[3].scr_addr = base + 0x700;
781 break; 818 break;
782 case board_2057x: 819 case board_2057x:
783 case board_20771:
784 hp->flags |= PDC_FLAG_GEN_II; 820 hp->flags |= PDC_FLAG_GEN_II;
785 /* Override hotplug offset for SATAII150 */
786 hp->hotplug_offset = PDC2_SATA_PLUG_CSR;
787 /* Fall through */ 821 /* Fall through */
788 case board_2037x: 822 case board_2037x:
789 probe_ent->n_ports = 2; 823 probe_ent->n_ports = 2;