summaryrefslogtreecommitdiff
path: root/drivers/ata/ahci.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-06-14 21:28:37 -0600
committerSimon Glass <sjg@chromium.org>2017-07-11 10:08:19 -0600
commit7cf1afce7fa3fe64189020fe14b93f7326dd0758 (patch)
tree5ebfa4fe9113898c4bb7ae87df1f21ede879fbdf /drivers/ata/ahci.c
parent62b4ec8e302c7d616e37f2c2c2836edfea712309 (diff)
dm: ahci: Unwind the confusing init code
Two AHCI drivers use SCSI with CONFIG_DM_SCSI. The SCSI uclass calls scsi_low_level_init() which is implemented by ahci.c. If CONFIG_SCSI_AHCI_PLAT is defined it does one thing and if it is not it does something else. We don't need to call through scsi_low_level_init() to get the init completed. Instead, adjust the two drivers to call into AHCI directly. Drop the post-probe init in the SCSI uclass. This means that driver model doesn't need to use scsi_low_level_init(). It is a legacy function and driver model should use a driver's probe() method instead. While we are here, add a comment to the top of the file explaining what ahci.c does. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'drivers/ata/ahci.c')
-rw-r--r--drivers/ata/ahci.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 4830bcdca0..e9867656a9 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -6,6 +6,8 @@
* SPDX-License-Identifier: GPL-2.0+
*
* with the reference on libata and ahci drvier in kernel
+ *
+ * This driver provides a SCSI interface to SATA.
*/
#include <common.h>
@@ -990,11 +992,8 @@ static int ahci_start_ports(struct ahci_uc_priv *uc_priv)
return 0;
}
-#if defined(CONFIG_DM_SCSI)
-void scsi_low_level_init(int busdevfunc, struct udevice *dev)
-#else
+#ifndef CONFIG_DM_SCSI
void scsi_low_level_init(int busdevfunc)
-#endif
{
struct ahci_uc_priv *uc_priv;
@@ -1007,8 +1006,6 @@ void scsi_low_level_init(int busdevfunc)
if (ret)
return;
ahci_init_one(dev);
-# elif defined(CONFIG_DM_SCSI)
- ahci_init_one(dev);
# else
ahci_init_one(busdevfunc);
# endif
@@ -1017,6 +1014,23 @@ void scsi_low_level_init(int busdevfunc)
ahci_start_ports(uc_priv);
}
+#endif
+
+#ifndef CONFIG_SCSI_AHCI_PLAT
+# if defined(CONFIG_DM_PCI) || defined(CONFIG_DM_SCSI)
+int achi_init_one_dm(struct udevice *dev)
+{
+ return ahci_init_one(dev);
+}
+#endif
+#endif
+
+int achi_start_ports_dm(struct udevice *dev)
+{
+ struct ahci_uc_priv *uc_priv = probe_ent;
+
+ return ahci_start_ports(uc_priv);
+}
#ifdef CONFIG_SCSI_AHCI_PLAT
int ahci_init(void __iomem *base)