+// SPDX-License-Identifier: GPL-2.0+
/*
* DWC SATA platform driver
*
* Texas Instruments Incorporated, <www.ti.com>
*
* Author: Mugunthan V N <mugunthanvnm@ti.com>
- *
- * SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
#include <asm/io.h>
#include <generic-phy.h>
-DECLARE_GLOBAL_DATA_PTR;
-
struct dwc_ahci_priv {
void *base;
void *wrapper_base;
};
+static int dwc_ahci_bind(struct udevice *dev)
+{
+ struct udevice *scsi_dev;
+
+ return ahci_bind_scsi(dev, &scsi_dev);
+}
+
static int dwc_ahci_ofdata_to_platdata(struct udevice *dev)
{
struct dwc_ahci_priv *priv = dev_get_priv(dev);
- struct scsi_platdata *plat = dev_get_platdata(dev);
fdt_addr_t addr;
- plat->max_id = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
- "max-id", CONFIG_SYS_SCSI_MAX_SCSI_ID);
- plat->max_lun = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
- "max-lun", CONFIG_SYS_SCSI_MAX_LUN);
-
priv->base = map_physmem(devfdt_get_addr(dev), sizeof(void *),
MAP_NOCACHE);
ret = generic_phy_get_by_name(dev, "sata-phy", &phy);
if (ret) {
- error("can't get the phy from DT\n");
+ pr_err("can't get the phy from DT\n");
return ret;
}
ret = generic_phy_init(&phy);
if (ret) {
- error("unable to initialize the sata phy\n");
+ pr_err("unable to initialize the sata phy\n");
return ret;
}
ret = generic_phy_power_on(&phy);
if (ret) {
- error("unable to power on the sata phy\n");
+ pr_err("unable to power on the sata phy\n");
return ret;
}
writel(val, priv->wrapper_base + TI_SATA_SYSCONFIG);
}
- return ahci_init(priv->base);
+ return ahci_probe_scsi(dev, (ulong)priv->base);
}
static const struct udevice_id dwc_ahci_ids[] = {
U_BOOT_DRIVER(dwc_ahci) = {
.name = "dwc_ahci",
- .id = UCLASS_SCSI,
+ .id = UCLASS_AHCI,
.of_match = dwc_ahci_ids,
+ .bind = dwc_ahci_bind,
.ofdata_to_platdata = dwc_ahci_ofdata_to_platdata,
+ .ops = &scsi_ops,
.probe = dwc_ahci_probe,
.priv_auto_alloc_size = sizeof(struct dwc_ahci_priv),
- .platdata_auto_alloc_size = sizeof(struct scsi_platdata),
- .flags = DM_FLAG_ALLOC_PRIV_DMA,
};