mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/4] ata: implement detect callback
@ 2013-06-17  8:59 Sascha Hauer
  2013-06-17  8:59 ` [PATCH 2/4] ata: Add detect callback for hardware device Sascha Hauer
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sascha Hauer @ 2013-06-17  8:59 UTC (permalink / raw)
  To: barebox

This makes it possible to use the 'detect' command for ata devices.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/ata/disk_ata_drive.c | 24 +++++++++++++++++++-----
 include/ata_drive.h          |  1 +
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/ata/disk_ata_drive.c b/drivers/ata/disk_ata_drive.c
index 2cff584..4ad7564 100644
--- a/drivers/ata/disk_ata_drive.c
+++ b/drivers/ata/disk_ata_drive.c
@@ -325,14 +325,10 @@ on_error:
 	return rc;
 }
 
-static int ata_set_probe(struct param_d *param, void *priv)
+int ata_port_detect(struct ata_port *port)
 {
-	struct ata_port *port = priv;
 	int ret;
 
-	if (!port->probe)
-		return 0;
-
 	if (port->initialized) {
 		dev_info(&port->class_dev, "already initialized\n");
 		return 0;
@@ -347,6 +343,23 @@ static int ata_set_probe(struct param_d *param, void *priv)
 	return 0;
 }
 
+static int ata_set_probe(struct param_d *param, void *priv)
+{
+	struct ata_port *port = priv;
+
+	if (!port->probe)
+		return 0;
+
+	return ata_port_detect(port);
+}
+
+static int ata_detect(struct device_d *dev)
+{
+	struct ata_port *port = container_of(dev, struct ata_port, class_dev);
+
+	return ata_port_detect(port);
+}
+
 /**
  * Register an ATA drive behind an IDE like interface
  * @param dev The interface device
@@ -360,6 +373,7 @@ int ata_port_register(struct ata_port *port)
 	port->class_dev.id = DEVICE_ID_DYNAMIC;
 	strcpy(port->class_dev.name, "ata");
 	port->class_dev.parent = port->dev;
+	port->class_dev.detect = ata_detect;
 
 	ret = register_device(&port->class_dev);
 	if (ret)
diff --git a/include/ata_drive.h b/include/ata_drive.h
index 049082f..fcb3a3c 100644
--- a/include/ata_drive.h
+++ b/include/ata_drive.h
@@ -100,6 +100,7 @@ struct ata_port {
 
 int ide_port_register(struct device_d *, struct ata_ioports *);
 int ata_port_register(struct ata_port *port);
+int ata_port_detect(struct ata_port *port);
 
 struct device_d;
 
-- 
1.8.3.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-06-17  8:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-17  8:59 [PATCH 1/4] ata: implement detect callback Sascha Hauer
2013-06-17  8:59 ` [PATCH 2/4] ata: Add detect callback for hardware device Sascha Hauer
2013-06-17  8:59 ` [PATCH 3/4] ata: ide: Allow to set the devicename Sascha Hauer
2013-06-17  8:59 ` [PATCH 4/4] ata: i.MX pata: Add devicetree probe support Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox