Skip to contentSkip to conversation

arm: mvebu : sata_mv should probe all ports

PATCH In review Tony Dinh 2 participants 2 messages Sep 5, 2021 – Sep 6, 2021 libata

lore
Share & tools
lore

Tony Dinh

author
#0 lore raw

PATCH 1/1 arm: mvebu : sata_mv should probe all ports

While a board could have multiple SATA ports, some of the ports might not have a disk attached to them. So while probing for disks, sata_mv_probe() should continue probing all ports, and skip one with no disk attached.

Tests with:

- Seagate Goflex Net (Marvell Kirkwood 88F6281) out-of-tree u-boot.
- Zyxel NSA325 (Marvell Kirkwood 88F6282 out-of-tree u-boot.

Observation:

If a board has 2 or more SATA ports, and there is only one disk attached to one of the ports, sata_mv_probe() does not return a successful probe status. And if only one disk is attached to the 2nd port (i.e. port 1), it is not probed at all.

Patch Description:

Let sata_mv_probe() continues probing all ports, even if there is error in probing a given port, and then return a successful status if there is at least one port was probed successfully.

---

 drivers/ata/sata_mv.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/ata/sata_mv.c +10 -4
index dadb2c7c2e..003222d47b 100644
@@ -1068,6 +1068,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),
@@ -1078,7 +1079,7 @@ static int sata_mv_probe(struct udevice *dev)
 					 IF_TYPE_SATA, -1, 512, 0, &blk);
 		if (ret) {
 			debug("Can't create device\n");
-			return ret;
+			continue;
 		}
 
 		priv = dev_get_plat(blk);
@@ -1088,18 +1089,23 @@ 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;
 		}
+
+		/* 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)
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Tony Dinh

While a board could have multiple SATA ports, some of the ports might not have a disk attached to them. So while probing for disks, sata_mv_probe() should continue probing all ports, and skip one with no disk attached.

Tests with:

- Seagate Goflex Net (Marvell Kirkwood 88F6281) out-of-tree u-boot.
- Zyxel NSA325 (Marvell Kirkwood 88F6282 out-of-tree u-boot.

Observation:

If a board has 2 or more SATA ports, and there is only one disk attached to one of the ports, sata_mv_probe() does not return a successful probe status. And if only one disk is attached to the 2nd port (i.e. port 1), it is not probed at all.

Quoted 7 lines

Patch Description:

Let sata_mv_probe() continues probing all ports, even if there is error in probing a given port, and then return a successful status if there is at least one port was probed successfully.

Thanks,
Stefan

Quoted 44 lines

---

  drivers/ata/sata_mv.c | 14 ++++++++++----
  1 file changed, 10 insertions(+), 4 deletions(-)
drivers/ata/sata_mv.c +6 -3
index dadb2c7c2e..003222d47b 100644
@@ -1068,6 +1068,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),
@@ -1078,7 +1079,7 @@ static int sata_mv_probe(struct udevice *dev)
  					 IF_TYPE_SATA, -1, 512, 0, &blk);
  		if (ret) {
  			debug("Can't create device\n");
-			return ret;
+			continue;
  		}
 
  		priv = dev_get_plat(blk);
@@ -1088,18 +1089,23 @@ 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;
  		}
+
+		/* If we got here, the current SATA port was probed

drivers/ata/sata_mv.c static int sata_mv_probe(struct udevice *dev) · line 1111

Quoted 10 lines
drivers/ata/sata_mv.c +4 -1
+		 * successfully, so set the probe status to successful.
+		 */
+		status = 0;
  	}
 
-	return 0;
+	return status;
  }
 
  static int sata_mv_scan(struct udevice *dev)

Viele Grüße,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]