Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

libata: skip debounce delay on link resume

The link resume logic uses a 200msec delay while debouncing
the SControl register. The rationale behind that delay is
to accommodate some PHYs that behave badly if their SStatus/
SControl registers are pounded immediately on resume.
The Broadcom STB SATA PHY does not seem to have this issue.
This patch introduces a new link flag that allows platforms
to skip the debounce delay if it isn't needed.

Signed-off-by: Danesh Petigara <dpetigara@broadcom.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

authored by

Danesh Petigara and committed by
Tejun Heo
e39b2bb3 6ca92dd7

+4 -1
+1
drivers/ata/ahci_brcmstb.c
··· 85 85 86 86 static const struct ata_port_info ahci_brcm_port_info = { 87 87 .flags = AHCI_FLAG_COMMON | ATA_FLAG_NO_DIPM, 88 + .link_flags = ATA_LFLAG_NO_DB_DELAY, 88 89 .pio_mask = ATA_PIO4, 89 90 .udma_mask = ATA_UDMA6, 90 91 .port_ops = &ahci_platform_ops,
+2 -1
drivers/ata/libata-core.c
··· 3598 3598 * immediately after resuming. Delay 200ms before 3599 3599 * debouncing. 3600 3600 */ 3601 - ata_msleep(link->ap, 200); 3601 + if (!(link->flags & ATA_LFLAG_NO_DB_DELAY)) 3602 + ata_msleep(link->ap, 200); 3602 3603 3603 3604 /* is SControl restored correctly? */ 3604 3605 if ((rc = sata_scr_read(link, SCR_CONTROL, &scontrol)))
+1
include/linux/libata.h
··· 205 205 ATA_LFLAG_NO_LPM = (1 << 8), /* disable LPM on this link */ 206 206 ATA_LFLAG_RST_ONCE = (1 << 9), /* limit recovery to one reset */ 207 207 ATA_LFLAG_CHANGED = (1 << 10), /* LPM state changed on this link */ 208 + ATA_LFLAG_NO_DB_DELAY = (1 << 11), /* no debounce delay on link resume */ 208 209 209 210 /* struct ata_port flags */ 210 211 ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */