aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrett Russ <russb@emc.com>2005-03-28 15:10:27 -0500
committerJeff Garzik <jgarzik@pobox.com>2005-05-15 19:00:51 -0400
commitcdcca89e1a90fa9112260bd6384f20fcc4280e21 (patch)
tree303ddceb3a324067c6a18ec00b8643d313eb71e4
parent21b1ed74ee3667dcabcba92e486988ea9119a085 (diff)
[PATCH] libata: flush COMRESET set and clear
Updated patch to fix erroneous flush of COMRESET set and missing flush of COMRESET clear. Created a new routine scr_write_flush() to try to prevent this in the future. Also, this patch is based on libata-2.6 instead of the previous libata-dev-2.6 based patch. Signed-off-by: Brett Russ <russb@emc.com> Index: libata-2.6/drivers/scsi/libata-core.c ===================================================================
-rw-r--r--drivers/scsi/libata-core.c6
-rw-r--r--include/linux/libata.h7
2 files changed, 10 insertions, 3 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index f70935cba173..ee9b96da841e 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -1253,11 +1253,11 @@ void __sata_phy_reset(struct ata_port *ap)
1253 unsigned long timeout = jiffies + (HZ * 5); 1253 unsigned long timeout = jiffies + (HZ * 5);
1254 1254
1255 if (ap->flags & ATA_FLAG_SATA_RESET) { 1255 if (ap->flags & ATA_FLAG_SATA_RESET) {
1256 scr_write(ap, SCR_CONTROL, 0x301); /* issue phy wake/reset */ 1256 /* issue phy wake/reset */
1257 scr_read(ap, SCR_STATUS); /* dummy read; flush */ 1257 scr_write_flush(ap, SCR_CONTROL, 0x301);
1258 udelay(400); /* FIXME: a guess */ 1258 udelay(400); /* FIXME: a guess */
1259 } 1259 }
1260 scr_write(ap, SCR_CONTROL, 0x300); /* issue phy wake/clear reset */ 1260 scr_write_flush(ap, SCR_CONTROL, 0x300); /* phy wake/clear reset */
1261 1261
1262 /* wait for phy to become ready, if necessary */ 1262 /* wait for phy to become ready, if necessary */
1263 do { 1263 do {
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 505160ab472b..1f7e2039a04e 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -584,6 +584,13 @@ static inline void scr_write(struct ata_port *ap, unsigned int reg, u32 val)
584 ap->ops->scr_write(ap, reg, val); 584 ap->ops->scr_write(ap, reg, val);
585} 585}
586 586
587static inline void scr_write_flush(struct ata_port *ap, unsigned int reg,
588 u32 val)
589{
590 ap->ops->scr_write(ap, reg, val);
591 (void) ap->ops->scr_read(ap, reg);
592}
593
587static inline unsigned int sata_dev_present(struct ata_port *ap) 594static inline unsigned int sata_dev_present(struct ata_port *ap)
588{ 595{
589 return ((scr_read(ap, SCR_STATUS) & 0xf) == 0x3) ? 1 : 0; 596 return ((scr_read(ap, SCR_STATUS) & 0xf) == 0x3) ? 1 : 0;