|
|
@ -528,9 +528,10 @@ static int waiting_for_cmd_completed(volatile u8 * offset, |
|
|
|
{ |
|
|
|
int i; |
|
|
|
u32 status; |
|
|
|
timeout_msec *= 2000; |
|
|
|
|
|
|
|
for (i = 0; ((status = readl(offset)) & sign) && i < timeout_msec; i++) |
|
|
|
; |
|
|
|
delay(1); |
|
|
|
|
|
|
|
return (i < timeout_msec) ? 0 : -1; |
|
|
|
} |
|
|
@ -771,20 +772,33 @@ static int get_ahci_device_data(struct ahci_sata_softc *sc, u8 * fis, int fis_le |
|
|
|
printf("AHCI SATA error: CI is set when START is zero!\n"); |
|
|
|
}; |
|
|
|
writel_with_flush(1, port_mmio + PORT_CMD_ISSUE); |
|
|
|
if (waiting_for_cmd_completed(port_mmio + PORT_CMD_ISSUE, 20000000, 0x1)) { |
|
|
|
if (waiting_for_cmd_completed(port_mmio + PORT_CMD_ISSUE, 200, 0x1)) { |
|
|
|
printf("%s <line%d>: timeout exit! %d bytes transferred.\n", __func__, __LINE__, |
|
|
|
pp->cmd_slot->status); |
|
|
|
|
|
|
|
printf("PxIS: 0x%08x, PxSERR: 0x%08x\n", readl(port_mmio + PORT_IRQ_STAT), readl(port_mmio + PORT_SCR_ERR)); |
|
|
|
printf("PxTFD: 0x%08x, PxSSTS: 0x%08x\n", readl(port_mmio + PORT_TFDATA), readl(port_mmio + PORT_SCR_STAT)); |
|
|
|
|
|
|
|
if (waiting_for_cmd_completed(port_mmio + PORT_CMD_ISSUE, 2000000, 0x1)) { |
|
|
|
if (waiting_for_cmd_completed(port_mmio + PORT_CMD_ISSUE, 200, 0x1)) { |
|
|
|
printf("Waiting another 2s is useless.\n"); |
|
|
|
}else{ |
|
|
|
#ifdef CONFIG_LS2K_FIX_SATA_PHY |
|
|
|
*(volatile unsigned int *)(0xbfe10454) = 0x80001fff; |
|
|
|
msleep(100); |
|
|
|
*(volatile unsigned int *)(0xbfe10454) = 0x0001fff; |
|
|
|
msleep(100); |
|
|
|
#endif |
|
|
|
}else{ |
|
|
|
printf("Waiting another 2s is usefull.\n"); |
|
|
|
} |
|
|
|
|
|
|
|
#ifndef CONFIG_LS2K_FIX_SATA_PHY |
|
|
|
return -1; |
|
|
|
#else |
|
|
|
*(volatile unsigned int *)(0xbfe10454) = 0x80001fff; |
|
|
|
msleep(100); |
|
|
|
*(volatile unsigned int *)(0xbfe10454) = 0x0001fff; |
|
|
|
msleep(100); |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
ahci_debug("%d byte transferred.\n", pp->cmd_slot->status); |
|
|
|