• Ondrej Zary's avatar
    sata_via: Apply WD workaround only when needed on VT6421 · 44a9b494
    Ondrej Zary authored
    Currently, workaround for broken WD drives is applied always, slowing
    down all drives. And it has a bug - it's not applied after resume.
    
    Apply the workaround only if the error really appears
    (SErr == 0x1000500). This allows unaffected drives to run at full speed
    (provided that no affected drive is connected to the controller).
    Also make sure the workaround is re-applied on resume.
    
    Tested on VT6421.
    As SCR registers access is known to cause problems on VT6420 (and I
    don't have it to test), keep the workaround applied always on VT6420.
    
    Unaffected drive (Hitachi HDS721680PLA380):
    Before:
    $ hdparm -t --direct /dev/sdb
    /dev/sdb:
     Timing O_DIRECT disk reads: 160 MB in  3.01 seconds =  53.16 MB/sec
    
    After:
    $ hdparm -t --direct /dev/sdb
    /dev/sdb:
     Timing O_DIRECT disk reads: 200 MB in  3.01 seconds =  66.47 MB/sec
    
    Affected drive (WDC WD5003ABYX-18WERA0):
    Before:
    $ hdparm -t --direct /dev/sda
    
    /dev/sda:
     Timing O_DIRECT disk reads: 180 MB in  3.02 seconds =  59.51 MB/sec
    
    After:
    $ hdparm -t --direct /dev/sdb
    /dev/sdb:
     Timing O_DIRECT disk reads: 156 MB in  3.03 seconds =  51.48 MB/sec
    $ hdparm -t --direct /dev/sdb
    /dev/sdb:
     Timing O_DIRECT disk reads: 180 MB in  3.02 seconds =  59.64 MB/sec
    
    The first hdparm is slower because of the error:
    [   50.408042] ata5: Incompatible drive: enabling workaround. This slows down transfer rate to ~60 MB/s
    [   50.728052] ata5: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
    [   50.744834] ata5.00: configured for UDMA/133
    Signed-off-by: default avatarOndrej Zary <linux@rainbow-software.org>
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    44a9b494
sata_via.c 19.2 KB