libata: skip debounce delay on link resume
authorDanesh Petigara <dpetigara@broadcom.com>
Fri, 8 Jan 2016 00:03:33 +0000 (16:03 -0800)
committerTejun Heo <tj@kernel.org>
Fri, 8 Jan 2016 16:50:14 +0000 (11:50 -0500)
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>
drivers/ata/ahci_brcmstb.c
drivers/ata/libata-core.c
include/linux/libata.h

index f61cbe30786f38810e1b6148aa0536979904656c..b36cae2fd04b2b2969cfefcfe54f63beadef48e2 100644 (file)
@@ -85,6 +85,7 @@ struct brcm_ahci_priv {
 
 static const struct ata_port_info ahci_brcm_port_info = {
        .flags          = AHCI_FLAG_COMMON | ATA_FLAG_NO_DIPM,
+       .link_flags     = ATA_LFLAG_NO_DB_DELAY,
        .pio_mask       = ATA_PIO4,
        .udma_mask      = ATA_UDMA6,
        .port_ops       = &ahci_platform_ops,
index f5ae6f43b65970ff2966fcf48acacfaad50947e2..cbb74719d2c1b80d61590ddf3fb2f9c71a31ce06 100644 (file)
@@ -3598,7 +3598,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)))
index 83577f8fd15bcd0f8693ef6a1a2a9fb216b32b2b..088ed924fa662e6b675c9a06f4f04baa6b679533 100644 (file)
@@ -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_NO_DB_DELAY   = (1 << 11), /* no debounce delay on link resume */
 
        /* struct ata_port flags */
        ATA_FLAG_SLAVE_POSS     = (1 << 0), /* host supports slave dev */