]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - drivers/block/fsl_sata.c
rename CFG_ macros to CONFIG_SYS
[people/ms/u-boot.git] / drivers / block / fsl_sata.c
index d14f5bc6bf8e5de12f78cbe38df1159147d37e7d..2009d1ecdac095cdb2aa7b497833ac21d1909a9c 100644 (file)
 #include <fis.h>
 #include "fsl_sata.h"
 
-extern block_dev_desc_t sata_dev_desc[CFG_SATA_MAX_DEVICE];
+extern block_dev_desc_t sata_dev_desc[CONFIG_SYS_SATA_MAX_DEVICE];
 
-#ifndef CFG_SATA1_FLAGS
-       #define CFG_SATA1_FLAGS FLAGS_DMA
+#ifndef CONFIG_SYS_SATA1_FLAGS
+       #define CONFIG_SYS_SATA1_FLAGS  FLAGS_DMA
 #endif
-#ifndef CFG_SATA2_FLAGS
-       #define CFG_SATA2_FLAGS FLAGS_DMA
+#ifndef CONFIG_SYS_SATA2_FLAGS
+       #define CONFIG_SYS_SATA2_FLAGS  FLAGS_DMA
 #endif
 
 static struct fsl_sata_info fsl_sata_info[] = {
 #ifdef CONFIG_SATA1
-       {CFG_SATA1, CFG_SATA1_FLAGS},
+       {CONFIG_SYS_SATA1, CONFIG_SYS_SATA1_FLAGS},
 #else
        {0, 0},
 #endif
 #ifdef CONFIG_SATA2
-       {CFG_SATA2, CFG_SATA2_FLAGS},
+       {CONFIG_SYS_SATA2, CONFIG_SYS_SATA2_FLAGS},
 #else
        {0, 0},
 #endif
@@ -123,7 +123,7 @@ int init_sata(int dev)
        int i;
        fsl_sata_t *sata;
 
-       if (dev < 0 || dev > (CFG_SATA_MAX_DEVICE - 1)) {
+       if (dev < 0 || dev > (CONFIG_SYS_SATA_MAX_DEVICE - 1)) {
                printf("the sata index %d is out of ranges\n\r", dev);
                return -1;
        }
@@ -248,6 +248,10 @@ int init_sata(int dev)
        else
                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 */
        val32 = in_le32(&reg->hstatus);
        if (val32 & HSTATUS_PHY_RDY) {
@@ -258,6 +262,10 @@ int init_sata(int dev)
                return -1;
        }
 
+       /* Wait for signature updated, which is 1st D2H */
+       ata_wait_register(&reg->hstatus, HSTATUS_SIGNATURE,
+                         HSTATUS_SIGNATURE, 10000);
+
        if (val32 & HSTATUS_SIGNATURE) {
                sig = in_le32(&reg->sig);
                debug("Signature updated, the sig =%08x\n\r", sig);
@@ -502,7 +510,7 @@ static int fsl_sata_exec_cmd(struct fsl_sata *sata, struct cfis *cfis,
        int rc;
 
        if (tag > SATA_HC_MAX_CMD || tag < 0) {
-               printf("tag is out of range, tag=\n\r", tag);
+               printf("tag is out of range, tag=%d\n\r", tag);
                return -1;
        }