Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5270222f96608818e431b5c4029b1f12020ab719
Commit:     5270222f96608818e431b5c4029b1f12020ab719
Parent:     db64bcf387aae6c7afad122a529d7d0513d3c5db
Author:     Tejun Heo <[EMAIL PROTECTED]>
AuthorDate: Wed Oct 31 10:17:07 2007 +0900
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Sat Nov 3 08:47:27 2007 -0400

    libata: don't configure downstream links faster than the upstream link
    
    There's nothing to be gained by configuring downstream links faster
    than the upstream link and such configurations cause problems on
    certain PMPs.  Limit downstream link speed by the upstream link speed.
    
    Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
    Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 drivers/ata/libata-core.c |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 3a1ec4e..164c7d9 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2751,17 +2751,27 @@ int sata_down_spd_limit(struct ata_link *link)
 
 static int __sata_set_spd_needed(struct ata_link *link, u32 *scontrol)
 {
-       u32 spd, limit;
+       struct ata_link *host_link = &link->ap->link;
+       u32 limit, target, spd;
 
-       if (link->sata_spd_limit == UINT_MAX)
-               limit = 0;
+       limit = link->sata_spd_limit;
+
+       /* Don't configure downstream link faster than upstream link.
+        * It doesn't speed up anything and some PMPs choke on such
+        * configuration.
+        */
+       if (!ata_is_host_link(link) && host_link->sata_spd)
+               limit &= (1 << host_link->sata_spd) - 1;
+
+       if (limit == UINT_MAX)
+               target = 0;
        else
-               limit = fls(link->sata_spd_limit);
+               target = fls(limit);
 
        spd = (*scontrol >> 4) & 0xf;
-       *scontrol = (*scontrol & ~0xf0) | ((limit & 0xf) << 4);
+       *scontrol = (*scontrol & ~0xf0) | ((target & 0xf) << 4);
 
-       return spd != limit;
+       return spd != target;
 }
 
 /**
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to