aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_promise.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2007-03-08 18:06:47 -0500
committerJeff Garzik <jeff@garzik.org>2007-04-28 14:15:57 -0400
commite2a9752a21df4407a2094fb3345878d18a6c6d68 (patch)
tree86d9831afaba23506e5c7cb229c7bda0d15c1800 /drivers/ata/sata_promise.c
parent2e41e8e67af4cb0917793922fc8f55d3eeb6fa43 (diff)
sata_promise: Switch to cable method, clean up some bits as a result
Signed-off-by: Alan Cox <number6@the-village.bc.nu> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/sata_promise.c')
-rw-r--r--drivers/ata/sata_promise.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index 2339813ce9f6..78df5464e015 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -45,7 +45,7 @@
45#include "sata_promise.h" 45#include "sata_promise.h"
46 46
47#define DRV_NAME "sata_promise" 47#define DRV_NAME "sata_promise"
48#define DRV_VERSION "2.00" 48#define DRV_VERSION "2.01"
49 49
50 50
51enum { 51enum {
@@ -131,7 +131,7 @@ static void pdc_freeze(struct ata_port *ap);
131static void pdc_thaw(struct ata_port *ap); 131static void pdc_thaw(struct ata_port *ap);
132static void pdc_error_handler(struct ata_port *ap); 132static void pdc_error_handler(struct ata_port *ap);
133static void pdc_post_internal_cmd(struct ata_queued_cmd *qc); 133static void pdc_post_internal_cmd(struct ata_queued_cmd *qc);
134 134static int pdc_cable_detect(struct ata_port *ap);
135 135
136static struct scsi_host_template pdc_ata_sht = { 136static struct scsi_host_template pdc_ata_sht = {
137 .module = THIS_MODULE, 137 .module = THIS_MODULE,
@@ -166,6 +166,7 @@ static const struct ata_port_operations pdc_sata_ops = {
166 .thaw = pdc_thaw, 166 .thaw = pdc_thaw,
167 .error_handler = pdc_error_handler, 167 .error_handler = pdc_error_handler,
168 .post_internal_cmd = pdc_post_internal_cmd, 168 .post_internal_cmd = pdc_post_internal_cmd,
169 .cable_detect = pdc_cable_detect,
169 .data_xfer = ata_data_xfer, 170 .data_xfer = ata_data_xfer,
170 .irq_handler = pdc_interrupt, 171 .irq_handler = pdc_interrupt,
171 .irq_clear = pdc_irq_clear, 172 .irq_clear = pdc_irq_clear,
@@ -374,18 +375,18 @@ static void pdc_reset_port(struct ata_port *ap)
374 readl(mmio); /* flush */ 375 readl(mmio); /* flush */
375} 376}
376 377
377static void pdc_pata_cbl_detect(struct ata_port *ap) 378static int pdc_cable_detect(struct ata_port *ap)
378{ 379{
379 u8 tmp; 380 u8 tmp;
380 void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_CTLSTAT + 0x03; 381 void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_CTLSTAT + 0x03;
381 382
382 tmp = readb(mmio); 383 if (!sata_scr_valid(ap)) {
383 384 tmp = readb(mmio);
384 if (tmp & 0x01) { 385 if (tmp & 0x01)
385 ap->cbl = ATA_CBL_PATA40; 386 return ATA_CBL_PATA40;
386 ap->udma_mask &= ATA_UDMA_MASK_40C; 387 return ATA_CBL_PATA80;
387 } else 388 }
388 ap->cbl = ATA_CBL_PATA80; 389 return ATA_CBL_SATA;
389} 390}
390 391
391static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg) 392static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg)
@@ -555,13 +556,6 @@ static void pdc_thaw(struct ata_port *ap)
555 readl(mmio + PDC_CTLSTAT); /* flush */ 556 readl(mmio + PDC_CTLSTAT); /* flush */
556} 557}
557 558
558static int pdc_pre_reset(struct ata_port *ap)
559{
560 if (!sata_scr_valid(ap))
561 pdc_pata_cbl_detect(ap);
562 return ata_std_prereset(ap);
563}
564
565static void pdc_error_handler(struct ata_port *ap) 559static void pdc_error_handler(struct ata_port *ap)
566{ 560{
567 ata_reset_fn_t hardreset; 561 ata_reset_fn_t hardreset;
@@ -574,7 +568,7 @@ static void pdc_error_handler(struct ata_port *ap)
574 hardreset = sata_std_hardreset; 568 hardreset = sata_std_hardreset;
575 569
576 /* perform recovery */ 570 /* perform recovery */
577 ata_do_eh(ap, pdc_pre_reset, ata_std_softreset, hardreset, 571 ata_do_eh(ap, ata_std_prereset, ata_std_softreset, hardreset,
578 ata_std_postreset); 572 ata_std_postreset);
579} 573}
580 574