scsi: ceva: Convert driver to use UCLASS_AHCI instead of SCSI
In v2018 the patch
"dm: ahci: Correct uclass private data"
(sha1: bfc1c6b4838501d10aa48c0e92eaf70976f4b2dd)
was causing an issue for ceva_sata.
But this issue is not in v2018.05-rc1 but still converting to
UCLASS_AHCI would make more sense.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
diff --git a/drivers/ata/sata_ceva.c b/drivers/ata/sata_ceva.c
index 1544097..a7d45e8 100644
--- a/drivers/ata/sata_ceva.c
+++ b/drivers/ata/sata_ceva.c
@@ -72,6 +72,10 @@
#define DRV_NAME "ahci-ceva"
#define CEVA_FLAG_BROKEN_GEN2 1
+struct ceva_sata_priv {
+ ulong base;
+};
+
static int ceva_init_sata(ulong mmio)
{
ulong tmp;
@@ -110,18 +114,20 @@
return 0;
}
-static int sata_ceva_probe(struct udevice *dev)
+static int sata_ceva_bind(struct udevice *dev)
{
- int ret;
- struct scsi_platdata *plat = dev_get_uclass_platdata(dev);
+ struct udevice *scsi_dev;
+
+ return ahci_bind_scsi(dev, &scsi_dev);
+}
- ceva_init_sata(plat->base);
+static int sata_ceva_probe(struct udevice *dev)
+{
+ struct ceva_sata_priv *priv = dev_get_priv(dev);
- ret = ahci_init_one_dm(dev);
- if (ret)
- return ret;
+ ceva_init_sata(priv->base);
- return ahci_start_ports_dm(dev);
+ return ahci_probe_scsi(dev, priv->base);
}
static const struct udevice_id sata_ceva_ids[] = {
@@ -131,24 +137,22 @@
static int sata_ceva_ofdata_to_platdata(struct udevice *dev)
{
- struct scsi_platdata *plat = dev_get_uclass_platdata(dev);
+ struct ceva_sata_priv *priv = dev_get_priv(dev);
- plat->base = devfdt_get_addr(dev);
- if (plat->base == FDT_ADDR_T_NONE)
+ priv->base = devfdt_get_addr(dev);
+ if (priv->base == FDT_ADDR_T_NONE)
return -EINVAL;
- /* Hardcode number for ceva sata controller */
- plat->max_lun = 1; /* Actually two but untested */
- plat->max_id = 2;
-
return 0;
}
U_BOOT_DRIVER(ceva_host_blk) = {
.name = "ceva_sata",
- .id = UCLASS_SCSI,
+ .id = UCLASS_AHCI,
.of_match = sata_ceva_ids,
+ .bind = sata_ceva_bind,
.ops = &scsi_ops,
+ .priv_auto_alloc_size = sizeof(struct ceva_sata_priv),
.probe = sata_ceva_probe,
.ofdata_to_platdata = sata_ceva_ofdata_to_platdata,
};