[PATCH 4/6] ata: ahci: Allow 'detect' on hardware device

Sascha Hauer s.hauer at pengutronix.de
Thu Jun 6 10:22:37 EDT 2013


Hook the detect callback to the hardware device.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/ata/ahci.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 19d445a..f9cf2d1 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -569,6 +569,20 @@ void ahci_info(struct device_d *dev)
 	ahci_print_info(ahci);
 }
 
+static int ahci_detect(struct device_d *dev)
+{
+	struct ahci_device *ahci = dev->priv;
+	int i;
+
+	for (i = 0; i < ahci->n_ports; i++) {
+		struct ahci_port *ahci_port = &ahci->ports[i];
+
+		ata_port_detect(&ahci_port->ata);
+	}
+
+	return 0;
+}
+
 int ahci_add_host(struct ahci_device *ahci)
 {
 	u8 *mmio = (u8 *)ahci->mmio_base;
@@ -630,6 +644,8 @@ int ahci_add_host(struct ahci_device *ahci)
 	ahci_iowrite(ahci, HOST_CTL, tmp | HOST_IRQ_EN);
 	tmp = ahci_ioread(ahci, HOST_CTL);
 
+	ahci->dev->detect = ahci_detect;
+
 	return 0;
 }
 
-- 
1.8.2.rc2




More information about the barebox mailing list