diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ata/sata_ceva.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/drivers/ata/sata_ceva.c b/drivers/ata/sata_ceva.c index 1544097c52..a7d45e81cf 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 @@ static int ceva_init_sata(ulong mmio) 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 const struct udevice_id sata_ceva_ids[] = { 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, }; |