* 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>
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;
if (ret)
return;
ahci_init_one(dev);
-# elif defined(CONFIG_DM_SCSI)
- ahci_init_one(dev);
# else
ahci_init_one(busdevfunc);
# endif
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)
writel(val, priv->wrapper_base + TI_SATA_SYSCONFIG);
}
- return ahci_init(priv->base);
+ ret = ahci_init(priv->base);
+ if (ret)
+ return ret;
+
+ return achi_start_ports_dm(dev);
}
static const struct udevice_id dwc_ahci_ids[] = {
struct scsi_platdata *plat = dev_get_uclass_platdata(dev);
ceva_init_sata(plat->base);
- return 0;
+
+ return achi_init_one_dm(dev);
}
static const struct udevice_id sata_ceva_ids[] = {
#include <dm.h>
#include <scsi.h>
-static int scsi_post_probe(struct udevice *dev)
-{
- debug("%s: device %p\n", __func__, dev);
- scsi_low_level_init(0, dev);
- return 0;
-}
-
UCLASS_DRIVER(scsi) = {
.id = UCLASS_SCSI,
.name = "scsi",
- .post_probe = scsi_post_probe,
.per_device_platdata_auto_alloc_size = sizeof(struct scsi_platdata),
};
int ahci_init(void __iomem *base);
int ahci_reset(void __iomem *base);
+/**
+ * achi_init_one_dm() - set up a single AHCI port
+ *
+ * @dev: Controller to init
+ */
+int achi_init_one_dm(struct udevice *dev);
+
+/**
+ * achi_start_ports_dm() - start all AHCI ports for a controller
+ *
+ * @dev: Controller containing ports to start
+ */
+int achi_start_ports_dm(struct udevice *dev);
+
#endif
unsigned long max_id;
};
-#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);
void scsi_init(void);
#endif