diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ata/libata-core.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 76aa94f55af9..047eabd75363 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -3061,22 +3061,28 @@ static int ata_bus_post_reset(struct ata_port *ap, unsigned int devmask, | |||
3061 | } | 3061 | } |
3062 | } | 3062 | } |
3063 | 3063 | ||
3064 | /* if device 1 was found in ata_devchk, wait for | 3064 | /* if device 1 was found in ata_devchk, wait for register |
3065 | * register access, then wait for BSY to clear | 3065 | * access briefly, then wait for BSY to clear. |
3066 | */ | 3066 | */ |
3067 | while (dev1) { | 3067 | if (dev1) { |
3068 | u8 nsect, lbal; | 3068 | int i; |
3069 | 3069 | ||
3070 | ap->ops->dev_select(ap, 1); | 3070 | ap->ops->dev_select(ap, 1); |
3071 | nsect = ioread8(ioaddr->nsect_addr); | 3071 | |
3072 | lbal = ioread8(ioaddr->lbal_addr); | 3072 | /* Wait for register access. Some ATAPI devices fail |
3073 | if ((nsect == 1) && (lbal == 1)) | 3073 | * to set nsect/lbal after reset, so don't waste too |
3074 | break; | 3074 | * much time on it. We're gonna wait for !BSY anyway. |
3075 | if (time_after(jiffies, deadline)) | 3075 | */ |
3076 | return -EBUSY; | 3076 | for (i = 0; i < 2; i++) { |
3077 | msleep(50); /* give drive a breather */ | 3077 | u8 nsect, lbal; |
3078 | } | 3078 | |
3079 | if (dev1) { | 3079 | nsect = ioread8(ioaddr->nsect_addr); |
3080 | lbal = ioread8(ioaddr->lbal_addr); | ||
3081 | if ((nsect == 1) && (lbal == 1)) | ||
3082 | break; | ||
3083 | msleep(50); /* give drive a breather */ | ||
3084 | } | ||
3085 | |||
3080 | rc = ata_wait_ready(ap, deadline); | 3086 | rc = ata_wait_ready(ap, deadline); |
3081 | if (rc) { | 3087 | if (rc) { |
3082 | if (rc != -ENODEV) | 3088 | if (rc != -ENODEV) |