From: Alan Cox Date: Wed, 22 Mar 2006 15:52:40 +0000 (+0000) Subject: [PATCH] libata: Fix a drive detection problem X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=09c7ad79dc62c499bb03d1ee92f838db2fc776c5;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git [PATCH] libata: Fix a drive detection problem The current code follows the spec but uses an overlong delay. This would be great if the hardware did. Several vendors however forget the D7 pulldown. Fortunately 0xFF isnt a sane reset state so we can use it to skip detection as is done in drivers/ide. (ie this is a tested solution over a long time) Signed-off-by: Alan Cox Signed-off-by: Jeff Garzik --- diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 5d00bb721e23..477afb4a9255 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c @@ -2001,9 +2001,19 @@ static unsigned int ata_bus_softreset(struct ata_port *ap, * status is checked. Because waiting for "a while" before * checking status is fine, post SRST, we perform this magic * delay here as well. + * + * Old drivers/ide uses the 2mS rule and then waits for ready */ msleep(150); + + /* Before we perform post reset processing we want to see if + the bus shows 0xFF because the odd clown forgets the D7 pulldown + resistor */ + + if (ata_check_status(ap) == 0xFF) + return 1; /* Positive is failure for some reason */ + ata_bus_post_reset(ap, devmask); return 0;