Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
ata: Add module parameter
debounce_delay_ms
The 200 ms delay in `sata_resume_lin()` is probably only needed for a few old controllers, so allow users to test this by setting the delay time (preferrably 0). To be able to track defaults, make it a signed integer with negative values being the default, which currently stays at 200 ms. This parameter could also be made boolean, but making the delay configurable adds more flexibility, but also does not directly match the existing boolean flag `ATA_LFLAG_NO_DEBOUNCE_DELAY`. Note, if that flag is set for a board, then the parameter is ignored. History: Commit 4effb65 from October 2003 [1, historical git archive] with the commit message > [libata] Merge Serial ATA core, and drivers for: > > Intel ICH5 (production) > ServerWorks / Apple K2 (beta) > VIA (beta) > Silicon Image 3112 (broken!) > Various Promise (alpha/beta) adds the code below: void sata_phy_reset(struct ata_port *ap) { […] /* wait for phy to become ready, if necessary */ do { msleep(200); sstatus = scr_read(ap, SCR_STATUS); if ((sstatus & 0xf) != 1) break; } while (time_before(jiffies, timeout)); […] } Later on in commit d7bb4cc ([PATCH] libata-hp-prep: implement sata_phy_debounce()) the commit is refactored [2], and the comment clarified. /* * Writes to SControl sometimes get ignored under certain * controllers (ata_piix SIDPR). Make sure DET actually is * cleared. */ do { scontrol = (scontrol & 0x0f0) | 0x300; if ((rc = sata_scr_write(link, SCR_CONTROL, scontrol))) return rc; /* * Some PHYs react badly if SStatus is pounded * immediately after resuming. Delay 200ms before * debouncing. */ if (!(link->flags & ATA_LFLAG_NO_DEBOUNCE_DELAY)) ata_msleep(link->ap, 200); /* is SControl restored correctly? */ if ((rc = sata_scr_read(link, SCR_CONTROL, &scontrol))) return rc; } while ((scontrol & 0xf0f) != 0x300 && --tries); A lot of PHYs do not need a delay though, so delaying 200 ms increases the boot time by 30 percent unnecessarily for a lot of systems, making “instant booting” quite hard. [1]: https://git.kernel.org/pub/scm/linux/kernel/git/history/history.git/commit/?id=4effb658a0f800e159c29a2d881cac76c326087a [2]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d7bb4cc7575929a60b0a718daa1bce87bea9a9cc Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
- Loading branch information