소스 검색

sata: wait for device updating signature to host

The driver need wait for the device updating signature to host.
If we don't wait for it, the driver can not detect the device(disk)
when the system powers up.

Signed-off-by: Dave Liu <daveliu@freescale.com>
Dave Liu 17 년 전
부모
커밋
9810263afe
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 8 0
      drivers/block/fsl_sata.c

+ 8 - 0
drivers/block/fsl_sata.c

@@ -248,6 +248,10 @@ int init_sata(int dev)
 	else
 	else
 		printf("       %s ", sata->name);
 		printf("       %s ", sata->name);
 
 
+	/* Wait PHY RDY signal changed for 500ms */
+	ata_wait_register(&reg->hstatus, HSTATUS_PHY_RDY,
+			  HSTATUS_PHY_RDY, 500);
+
 	/* Check PHYRDY */
 	/* Check PHYRDY */
 	val32 = in_le32(&reg->hstatus);
 	val32 = in_le32(&reg->hstatus);
 	if (val32 & HSTATUS_PHY_RDY) {
 	if (val32 & HSTATUS_PHY_RDY) {
@@ -258,6 +262,10 @@ int init_sata(int dev)
 		return -1;
 		return -1;
 	}
 	}
 
 
+	/* Wait for signature updated, which is 1st D2H */
+	ata_wait_register(&reg->hstatus, HSTATUS_SIGNATURE,
+			  HSTATUS_SIGNATURE, 10000);
+
 	if (val32 & HSTATUS_SIGNATURE) {
 	if (val32 & HSTATUS_SIGNATURE) {
 		sig = in_le32(&reg->sig);
 		sig = in_le32(&reg->sig);
 		debug("Signature updated, the sig =%08x\n\r", sig);
 		debug("Signature updated, the sig =%08x\n\r", sig);