diff options
author | Michal Simek <michal.simek@xilinx.com> | 2018-04-06 13:32:52 +0200 |
---|---|---|
committer | Michal Simek <michal.simek@xilinx.com> | 2018-05-11 09:23:43 +0200 |
commit | c3898a8891883f1ec3b7c029054927e7be9369a7 (patch) | |
tree | 1188cdadd6832fed8c972365145c14a703d48bf7 /drivers | |
parent | 0b4b82ad1461cc37434e7e0c1de00a61193a95db (diff) |
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>
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, }; |