Commit 178210847f7d8492c6aa1d39867d99538be0e7d4
Committed by
Tom Rini
1 parent
124e9fa132
Exists in
master
and in
56 other branches
ahci: handle COMINIT received during spin-up
Some Intel SSDs can send a COMINIT after the initial COMRESET. This causes the link to go down and we need to re-initialize the link. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Showing 1 changed file with 12 additions and 0 deletions Side-by-side Diff
drivers/block/ahci.c
| ... | ... | @@ -243,8 +243,20 @@ |
| 243 | 243 | if (!(tmp & (ATA_STAT_BUSY | ATA_STAT_DRQ))) |
| 244 | 244 | break; |
| 245 | 245 | udelay(1000); |
| 246 | + tmp = readl(port_mmio + PORT_SCR_STAT); | |
| 247 | + tmp &= PORT_SCR_STAT_DET_MASK; | |
| 248 | + if (tmp == PORT_SCR_STAT_DET_PHYRDY) | |
| 249 | + break; | |
| 246 | 250 | j++; |
| 247 | 251 | } |
| 252 | + | |
| 253 | + tmp = readl(port_mmio + PORT_SCR_STAT) & PORT_SCR_STAT_DET_MASK; | |
| 254 | + if (tmp == PORT_SCR_STAT_DET_COMINIT) { | |
| 255 | + debug("SATA link %d down (COMINIT received), retrying...\n", i); | |
| 256 | + i--; | |
| 257 | + continue; | |
| 258 | + } | |
| 259 | + | |
| 248 | 260 | printf("Target spinup took %d ms.\n", j); |
| 249 | 261 | if (j == WAIT_MS_SPINUP) |
| 250 | 262 | debug("timeout.\n"); |