Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 130817
b: refs/heads/master
c: 9062712
h: refs/heads/master
i:
  130815: 2fdfc7c
v: v3
  • Loading branch information
Tejun Heo authored and Jeff Garzik committed Feb 3, 2009
1 parent 9b9ec8d commit af391c9
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cf9a590a9eae3b99ca77d8db17afd2d7dbdd0986
refs/heads/master: 9062712fa9ed13b531dfc2228086650b8bd6a255
41 changes: 41 additions & 0 deletions trunk/drivers/ata/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2232,6 +2232,40 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
return rc;
}

static int ata_do_link_spd_horkage(struct ata_device *dev)
{
struct ata_link *plink = ata_dev_phys_link(dev);
u32 target, target_limit;

if (!sata_scr_valid(plink))
return 0;

if (dev->horkage & ATA_HORKAGE_1_5_GBPS)
target = 1;
else
return 0;

target_limit = (1 << target) - 1;

/* if already on stricter limit, no need to push further */
if (plink->sata_spd_limit <= target_limit)
return 0;

plink->sata_spd_limit = target_limit;

/* Request another EH round by returning -EAGAIN if link is
* going faster than the target speed. Forward progress is
* guaranteed by setting sata_spd_limit to target_limit above.
*/
if (plink->sata_spd > target) {
ata_dev_printk(dev, KERN_INFO,
"applying link speed limit horkage to %s\n",
sata_spd_string(target));
return -EAGAIN;
}
return 0;
}

static inline u8 ata_dev_knobble(struct ata_device *dev)
{
struct ata_port *ap = dev->link->ap;
Expand Down Expand Up @@ -2322,6 +2356,10 @@ int ata_dev_configure(struct ata_device *dev)
return 0;
}

rc = ata_do_link_spd_horkage(dev);
if (rc)
return rc;

/* let ACPI work its magic */
rc = ata_acpi_on_devcfg(dev);
if (rc)
Expand Down Expand Up @@ -4223,6 +4261,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
/* Devices that do not need bridging limits applied */
{ "MTRON MSP-SATA*", NULL, ATA_HORKAGE_BRIDGE_OK, },

/* Devices which aren't very happy with higher link speeds */
{ "WD My Book", NULL, ATA_HORKAGE_1_5_GBPS, },

/* End Marker */
{ }
};
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/libata.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ enum {
ATA_HORKAGE_ATAPI_MOD16_DMA = (1 << 11), /* use ATAPI DMA for commands
not multiple of 16 bytes */
ATA_HORKAGE_FIRMWARE_WARN = (1 << 12), /* firwmare update warning */
ATA_HORKAGE_1_5_GBPS = (1 << 13), /* force 1.5 Gbps */

/* DMA mask for user DMA control: User visible values; DO NOT
renumber */
Expand Down

0 comments on commit af391c9

Please sign in to comment.