Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion drivers/ata/libata-pmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,23 @@ int sata_pmp_scr_read(struct ata_link *link, int reg, u32 *r_val)

if (reg > SATA_PMP_PSCR_CONTROL)
return -EINVAL;

/* For some PMP cards, we need to delay some time */
if (link>flags & ATA_LFLAG_DELAY) {
set_current_state(TASK_INTERRUPTIBLE);
/* sleep 50 msecond */
schedule_timeout(msecs_to_jiffies(50));
}

err_mask = sata_pmp_read(link, reg, r_val);
if (err_mask) {
ata_link_warn(link, "failed to read SCR %d (Emask=0x%x)\n",
reg, err_mask);
return -EIO;
} else if (vendor== 0x197b && devid == 0x0325) {
ata_for_each_link(link, ap, EDGE) {
link->flags |= ATA_LFLAG_DELAY;
}
}
return 0;
}
Expand All @@ -176,13 +187,15 @@ int sata_pmp_scr_write(struct ata_link *link, int reg, u32 val)

if (reg > SATA_PMP_PSCR_CONTROL)
return -EINVAL;



err_mask = sata_pmp_write(link, reg, val);
if (err_mask) {
ata_link_warn(link, "failed to write SCR %d (Emask=0x%x)\n",
reg, err_mask);
return -EIO;
}
}
return 0;
}

Expand Down
1 change: 1 addition & 0 deletions include/linux/libata.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ enum {
ATA_LFLAG_NO_LPM = (1 << 8), /* disable LPM on this link */
ATA_LFLAG_RST_ONCE = (1 << 9), /* limit recovery to one reset */
ATA_LFLAG_CHANGED = (1 << 10), /* LPM state changed on this link */
ATA_LFLAG_DELAY = (1 << 9), /* Delay some time for PMP */

/* struct ata_port flags */
ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */
Expand Down