]> Git Repo - u-boot.git/blobdiff - drivers/ata/sata_mv.c
Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"
[u-boot.git] / drivers / ata / sata_mv.c
index dadb2c7c2e7b090112f65b0dc8b455c8bf66d04d..ac78760a33ebabc65e1d97c2e1653c70d3cbd1f6 100644 (file)
@@ -31,9 +31,9 @@
  * No port multiplier support
  */
 
-#include <common.h>
 #include <ahci.h>
 #include <blk.h>
+#include <bootdev.h>
 #include <cpu_func.h>
 #include <dm.h>
 #include <log.h>
@@ -45,6 +45,7 @@
 #include <libata.h>
 #include <malloc.h>
 #include <sata.h>
+#include <time.h>
 #include <linux/bitops.h>
 #include <linux/delay.h>
 #include <linux/errno.h>
@@ -1068,6 +1069,7 @@ static int sata_mv_probe(struct udevice *dev)
        int nr_ports;
        int ret;
        int i;
+       int status = -ENODEV; /* If the probe fails to detected any SATA port */
 
        /* Get number of ports of this SATA controller */
        nr_ports = min(fdtdec_get_int(blob, node, "nr-ports", -1),
@@ -1075,10 +1077,11 @@ static int sata_mv_probe(struct udevice *dev)
 
        for (i = 0; i < nr_ports; i++) {
                ret = blk_create_devicef(dev, "sata_mv_blk", "blk",
-                                        IF_TYPE_SATA, -1, 512, 0, &blk);
+                                        UCLASS_AHCI, -1, DEFAULT_BLKSZ,
+                                        0, &blk);
                if (ret) {
                        debug("Can't create device\n");
-                       return ret;
+                       continue;
                }
 
                priv = dev_get_plat(blk);
@@ -1088,24 +1091,39 @@ static int sata_mv_probe(struct udevice *dev)
                ret = sata_mv_init_sata(blk, i);
                if (ret) {
                        debug("%s: Failed to init bus\n", __func__);
-                       return ret;
+                       continue;
                }
 
                /* Scan SATA port */
                ret = sata_mv_scan_sata(blk, i);
                if (ret) {
                        debug("%s: Failed to scan bus\n", __func__);
-                       return ret;
+                       continue;
                }
+
+               ret = blk_probe_or_unbind(dev);
+               if (ret < 0)
+                       /* TODO: undo create */
+                       continue;
+
+               ret = bootdev_setup_for_sibling_blk(blk, "sata_bootdev");
+               if (ret) {
+                       printf("%s: Failed to create bootdev\n", __func__);
+                       continue;
+               }
+
+               /* If we got here, the current SATA port was probed
+                * successfully, so set the probe status to successful.
+                */
+               status = 0;
        }
 
-       return 0;
+       return status;
 }
 
 static int sata_mv_scan(struct udevice *dev)
 {
        /* Nothing to do here */
-
        return 0;
 }
 
This page took 0.027082 seconds and 4 git commands to generate.