linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Florian Effenberger <florian@effenberger.org>
Cc: linux-ide@vger.kernel.org, jeff@garzik.org
Subject: Re: libata interface fatal error
Date: Thu, 07 Jun 2007 18:50:45 +0900	[thread overview]
Message-ID: <4667D4F5.1060302@gmail.com> (raw)
In-Reply-To: <466725E5.9030405@effenberger.org>

[-- Attachment #1: Type: text/plain, Size: 612 bytes --]

Florian Effenberger wrote:
> Hi,
> 
>> Currently, there is no mechanism to do that but hard drives usually have
>> dip switch to force 1.5Gbps.  Please try that.  If your harddrive
>> doesn't have that, please lemme know.  I'll prepare a simple patch.
> 
> unfortunately, the disks have a jumper board, but the jumpers are
> missing... could you write a patch for me? Would be much appreciated!

Okay, there was a bug in link speed limit logic.  That's probably why
speed down to 1.5Gbps didn't kick in.  The attached patch contains the
fix and hack to force 1.5Gbps.  Please give it a shot.

Thanks.

-- 
tejun

[-- Attachment #2: ahci-force-1_5.patch --]
[-- Type: text/x-patch, Size: 2156 bytes --]

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 7baeaff..f9550f1 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -219,6 +219,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc);
 static void ahci_irq_clear(struct ata_port *ap);
 static int ahci_port_start(struct ata_port *ap);
+static int ahci_vt8251_port_start(struct ata_port *ap);
 static void ahci_port_stop(struct ata_port *ap);
 static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
 static void ahci_qc_prep(struct ata_queued_cmd *qc);
@@ -284,7 +285,7 @@ static const struct ata_port_operations ahci_ops = {
 	.port_resume		= ahci_port_resume,
 #endif
 
-	.port_start		= ahci_port_start,
+	.port_start		= ahci_vt8251_port_start,
 	.port_stop		= ahci_port_stop,
 };
 
@@ -318,7 +319,7 @@ static const struct ata_port_operations ahci_vt8251_ops = {
 	.port_resume		= ahci_port_resume,
 #endif
 
-	.port_start		= ahci_port_start,
+	.port_start		= ahci_vt8251_port_start,
 	.port_stop		= ahci_port_stop,
 };
 
@@ -1558,6 +1559,19 @@ static int ahci_port_start(struct ata_port *ap)
 	return 0;
 }
 
+static int ahci_vt8251_port_start(struct ata_port *ap)
+{
+	struct ahci_host_priv *hpriv = ap->host->private_data;
+
+	if (((hpriv->cap >> 20) & 0xf) != 1) {
+		printk("limiting SATA link speed to 1.5Gbps\n");
+		ap->hw_sata_spd_limit = 1;
+		ap->eh_info.action |= ATA_EH_HARDRESET;
+	}
+
+	return ahci_port_start(ap);
+}
+
 static void ahci_port_stop(struct ata_port *ap)
 {
 	const char *emsg = NULL;
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 4733f00..57940ba 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6313,7 +6313,8 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
 		/* init sata_spd_limit to the current value */
 		if (sata_scr_read(ap, SCR_CONTROL, &scontrol) == 0) {
 			int spd = (scontrol >> 4) & 0xf;
-			ap->hw_sata_spd_limit &= (1 << spd) - 1;
+			if (spd)
+				ap->hw_sata_spd_limit &= (1 << spd) - 1;
 		}
 		ap->sata_spd_limit = ap->hw_sata_spd_limit;
 

  reply	other threads:[~2007-06-07  9:50 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-26  9:43 libata interface fatal error Florian Effenberger
2007-05-29  9:16 ` Tejun Heo
2007-05-29 14:16   ` Florian Effenberger
2007-06-06 21:23   ` Florian Effenberger
2007-06-07  9:50     ` Tejun Heo [this message]
2007-06-07 14:08       ` Florian Effenberger
2007-06-13 10:37       ` Florian Effenberger
2007-06-14  9:43         ` Tejun Heo
2007-06-14 11:12           ` Florian Effenberger
2007-06-14 12:25             ` Tejun Heo
2007-06-14 15:12               ` Florian Effenberger
2007-06-18  3:10                 ` Tejun Heo
2007-06-18  6:08                   ` Tomi Orava
2007-06-18  6:28                     ` Tejun Heo
2007-06-18 10:38                   ` Florian Effenberger
2007-06-18 10:44                     ` Tejun Heo
2007-06-16 10:23       ` Florian Effenberger
2007-06-18  3:13         ` Tejun Heo
2007-06-18 10:44           ` Florian Effenberger
2007-06-18 10:56             ` Tejun Heo
2007-06-18 11:28               ` Florian Effenberger
2007-06-18 11:30                 ` Tejun Heo
2007-06-18 11:32                   ` Florian Effenberger
2007-06-24 11:32               ` Florian Effenberger
2007-06-25  2:49                 ` Tejun Heo
2007-06-25  8:47                   ` Florian Effenberger
  -- strict thread matches above, loose matches on Subject: below --
2007-06-18  7:05 Mikael Pettersson
2007-06-18  7:13 ` Tejun Heo
2007-06-18 10:47   ` Florian Effenberger
2007-06-18 17:14 ` Ansgar Knappheide
2007-06-18 18:54 ` Tomi Orava
2007-05-24 13:25 Florian Effenberger
2007-05-24 13:45 ` Tejun Heo
2007-05-24 14:08   ` Florian Effenberger
2007-05-24 14:21     ` Tejun Heo
2007-05-24 14:47       ` Florian Effenberger
2007-05-24 14:53         ` Tejun Heo
2007-05-24 15:28           ` Florian Effenberger
2007-05-24 14:55         ` Greg Freemyer
2007-05-24 14:59           ` Tejun Heo
2007-05-24 15:00           ` Florian Effenberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4667D4F5.1060302@gmail.com \
    --to=htejun@gmail.com \
    --cc=florian@effenberger.org \
    --cc=jeff@garzik.org \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).