dm: scsi: Add operations for SCSI devices

The SCSI uclass currently has no operations. It just uses the global SCSI
functions. Fix this by adding operations to the only two drivers that use
the uclass, and replacing the global functions with those defined locally
in the SCSI code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 9c7b043..5a20b97 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1141,6 +1141,12 @@
 	return 0;
 }
 
+#ifdef CONFIG_DM_SCSI
+struct scsi_ops scsi_ops = {
+	.exec		= ahci_scsi_exec,
+	.bus_reset	= ahci_scsi_bus_reset,
+};
+#else
 int scsi_exec(struct udevice *dev, struct scsi_cmd *pccb)
 {
 	return ahci_scsi_exec(dev, pccb);
@@ -1152,3 +1158,4 @@
 
 	return 0;
 }
+#endif
diff --git a/drivers/ata/dwc_ahci.c b/drivers/ata/dwc_ahci.c
index 4012017..f614798 100644
--- a/drivers/ata/dwc_ahci.c
+++ b/drivers/ata/dwc_ahci.c
@@ -98,6 +98,7 @@
 	.id	= UCLASS_SCSI,
 	.of_match = dwc_ahci_ids,
 	.ofdata_to_platdata = dwc_ahci_ofdata_to_platdata,
+	.ops	= &scsi_ops,
 	.probe	= dwc_ahci_probe,
 	.priv_auto_alloc_size = sizeof(struct dwc_ahci_priv),
 	.flags = DM_FLAG_ALLOC_PRIV_DMA,
diff --git a/drivers/ata/sata_ceva.c b/drivers/ata/sata_ceva.c
index 7d61a54..d582e5b 100644
--- a/drivers/ata/sata_ceva.c
+++ b/drivers/ata/sata_ceva.c
@@ -144,6 +144,7 @@
 	.name = "ceva_sata",
 	.id = UCLASS_SCSI,
 	.of_match = sata_ceva_ids,
+	.ops = &scsi_ops,
 	.probe = sata_ceva_probe,
 	.ofdata_to_platdata = sata_ceva_ofdata_to_platdata,
 };