summaryrefslogtreecommitdiff
path: root/drivers/ata/libata-core.c
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-03-25 03:53:42 -0300
committerAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-03-25 03:53:42 -0300
commit03dd4cb26d967f9588437b0fc9cc0e8353322bb7 (patch)
treefa581f6dc1c0596391690d1f67eceef3af8246dc /drivers/ata/libata-core.c
parentd4e493caf788ef44982e131ff9c786546904d934 (diff)
Linux-libre 4.5-gnu
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r--drivers/ata/libata-core.c53
1 files changed, 29 insertions, 24 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index e555e01ec..474f9f473 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -50,6 +50,7 @@
#include <linux/blkdev.h>
#include <linux/delay.h>
#include <linux/timer.h>
+#include <linux/time.h>
#include <linux/interrupt.h>
#include <linux/completion.h>
#include <linux/suspend.h>
@@ -2024,9 +2025,6 @@ retry:
}
}
- if (id[79] & (1 << SATA_DIPM))
- dev->init_dipm = true;
-
*p_class = class;
return 0;
@@ -2089,10 +2087,6 @@ static int ata_dev_config_ncq(struct ata_device *dev,
unsigned int err_mask;
char *aa_desc = "";
- // Liquorix - disable NCQ to improve responsiveness at the cost of throughput.
- snprintf(desc, desc_sz, "NCQ (disabled)");
- return 0;
-
if (!ata_id_has_ncq(dev->id)) {
desc[0] = '\0';
return 0;
@@ -2102,7 +2096,11 @@ static int ata_dev_config_ncq(struct ata_device *dev,
return 0;
}
if (ap->flags & ATA_FLAG_NCQ) {
+#ifdef CONFIG_PCK_INTERACTIVE
+ hdepth = min(ap->scsi_host->can_queue, 8);
+#else
hdepth = min(ap->scsi_host->can_queue, ATA_MAX_QUEUE - 1);
+#endif
dev->flags |= ATA_DFLAG_NCQ;
}
@@ -3604,7 +3602,8 @@ int sata_link_resume(struct ata_link *link, const unsigned long *params,
* immediately after resuming. Delay 200ms before
* debouncing.
*/
- ata_msleep(link->ap, 200);
+ if (!(link->flags & ATA_LFLAG_NO_DB_DELAY))
+ ata_msleep(link->ap, 200);
/* is SControl restored correctly? */
if ((rc = sata_scr_read(link, SCR_CONTROL, &scontrol)))
@@ -3662,11 +3661,6 @@ int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy,
return rc;
switch (policy) {
- case ATA_LPM_FIRMWARE_DEFAULTS:
- /* use the values we read at probe */
- scontrol &= ~(0x7 << 8);
- scontrol |= (link->init_lpm << 8);
- break;
case ATA_LPM_MAX_POWER:
/* disable all LPM transitions */
scontrol |= (0x7 << 8);
@@ -4135,6 +4129,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
{ "SAMSUNG CD-ROM SN-124", "N001", ATA_HORKAGE_NODMA },
{ "Seagate STT20000A", NULL, ATA_HORKAGE_NODMA },
{ " 2GB ATA Flash Disk", "ADMA428M", ATA_HORKAGE_NODMA },
+ { "VRFDFC22048UCHC-TE*", NULL, ATA_HORKAGE_NODMA },
/* Odd clown on sil3726/4726 PMPs */
{ "Config Disk", NULL, ATA_HORKAGE_DISABLE },
@@ -5595,11 +5590,11 @@ void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp)
}
/**
- * sata_link_init_config - Initialize link->sata_spd_limit and init_lpm
- * @link: Link to configure sata_spd_limit and init_lpm for
+ * sata_link_init_spd - Initialize link->sata_spd_limit
+ * @link: Link to configure sata_spd_limit for
*
- * Initialize @link->[hw_]sata_spd_limit and @link->init_lpm to the
- * currently configured value.
+ * Initialize @link->[hw_]sata_spd_limit to the currently
+ * configured value.
*
* LOCKING:
* Kernel thread context (may sleep).
@@ -5607,7 +5602,7 @@ void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp)
* RETURNS:
* 0 on success, -errno on failure.
*/
-int sata_link_init_config(struct ata_link *link)
+int sata_link_init_spd(struct ata_link *link)
{
u8 spd;
int rc;
@@ -5624,8 +5619,6 @@ int sata_link_init_config(struct ata_link *link)
link->sata_spd_limit = link->hw_sata_spd_limit;
- link->init_lpm = (link->saved_scontrol >> 8) & 0x7;
-
return 0;
}
@@ -6175,9 +6168,9 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
ap->cbl = ATA_CBL_SATA;
/* init sata_spd_limit to the current value */
- sata_link_init_config(&ap->link);
+ sata_link_init_spd(&ap->link);
if (ap->slave_link)
- sata_link_init_config(ap->slave_link);
+ sata_link_init_spd(ap->slave_link);
/* print per-port info to dmesg */
xfer_mask = ata_pack_xfermask(ap->pio_mask, ap->mwdma_mask,
@@ -6237,6 +6230,7 @@ int ata_host_activate(struct ata_host *host, int irq,
struct scsi_host_template *sht)
{
int i, rc;
+ char *irq_desc;
rc = ata_host_start(host);
if (rc)
@@ -6248,8 +6242,14 @@ int ata_host_activate(struct ata_host *host, int irq,
return ata_host_register(host, sht);
}
+ irq_desc = devm_kasprintf(host->dev, GFP_KERNEL, "%s[%s]",
+ dev_driver_string(host->dev),
+ dev_name(host->dev));
+ if (!irq_desc)
+ return -ENOMEM;
+
rc = devm_request_irq(host->dev, irq, irq_handler, irq_flags,
- dev_name(host->dev), host);
+ irq_desc, host);
if (rc)
return rc;
@@ -6711,7 +6711,12 @@ void ata_msleep(struct ata_port *ap, unsigned int msecs)
if (owns_eh)
ata_eh_release(ap);
- msleep(msecs);
+ if (msecs < 20) {
+ unsigned long usecs = msecs * USEC_PER_MSEC;
+ usleep_range(usecs, usecs + 50);
+ } else {
+ msleep(msecs);
+ }
if (owns_eh)
ata_eh_acquire(ap);