ata: libata-sata: improve sata_link_debounce()
sata_link_debounce() polls the SStatus register DET field to ensure that
a stable value is provided, to reliably detect device presence and PHY
readiness.
Polling is done for at least timing->duration if there is no device or
if the PHY is not ready and for at least timing->deadline if a device is
present with PHY being ready.
For the PHY-ready AND device-present case, the link can be considered
stable and polling can be shortened (really ?).
While at it, cleanup the code by renaming the variables cur and last
to cur_det and last_det to clarify that these variables hold the DET
field value of the STATUS register. Also add comments to complement the
function kdoc description and make the code easier to understand.
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
1 file changed