]> Git Repo - J-u-boot.git/blobdiff - drivers/ata/dwc_ahsata.c
common: Drop log.h from common header
[J-u-boot.git] / drivers / ata / dwc_ahsata.c
index afced8e7e3f8aa9d7fccb053335985bc9f74ae9f..7334129c0f13e4c50e27b0df2582d9e1f323cbab 100644 (file)
@@ -6,13 +6,18 @@
 
 #include <common.h>
 #include <ahci.h>
+#include <blk.h>
+#include <cpu_func.h>
 #include <dm.h>
 #include <dwc_ahsata.h>
 #include <fis.h>
 #include <libata.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
+#include <part.h>
 #include <sata.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
@@ -222,7 +227,7 @@ static int ahci_host_init(struct ahci_uc_priv *uc_priv)
 
                /* Wait for COMINIT bit 26 (DIAG_X) in SERR */
                timeout = 1000;
-               while (!(readl(&port_mmio->serr) | SATA_PORT_SERR_DIAG_X)
+               while (!(readl(&port_mmio->serr) & SATA_PORT_SERR_DIAG_X)
                        && --timeout)
                        ;
                if (timeout <= 0) {
@@ -449,7 +454,6 @@ static int ahci_port_start(struct ahci_uc_priv *uc_priv, u8 port)
 
        mem = (u32)malloc(AHCI_PORT_PRIV_DMA_SZ + 1024);
        if (!mem) {
-               free(pp);
                printf("No mem for table!\n");
                return -ENOMEM;
        }
@@ -846,6 +850,9 @@ static int ahci_init_one(int pdev)
        struct ahci_uc_priv *uc_priv = NULL;
 
        uc_priv = malloc(sizeof(struct ahci_uc_priv));
+       if (!uc_priv)
+               return -ENOMEM;
+
        memset(uc_priv, 0, sizeof(struct ahci_uc_priv));
        uc_priv->dev = pdev;
 
@@ -870,6 +877,8 @@ static int ahci_init_one(int pdev)
        return 0;
 
 err_out:
+       if (uc_priv)
+               free(uc_priv);
        return rc;
 }
 
@@ -913,6 +922,9 @@ int reset_sata(int dev)
        while (readl(&host_mmio->ghc) & SATA_HOST_GHC_HR)
                udelay(100);
 
+       free(uc_priv);
+       memset(&sata_dev_desc[dev], 0, sizeof(struct blk_desc));
+
        return 0;
 }
 
This page took 0.022993 seconds and 4 git commands to generate.