1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2017 NXP Semiconductors
4 * Copyright (C) 2017 Bin Meng <bmeng.cn@gmail.com>
12 static int nvme_bind(struct udevice
*udev
)
17 sprintf(name
, "nvme#%d", ndev_num
++);
19 return device_set_name(udev
, name
);
22 static int nvme_probe(struct udevice
*udev
)
24 struct nvme_dev
*ndev
= dev_get_priv(udev
);
25 struct pci_child_plat
*pplat
;
27 pplat
= dev_get_parent_plat(udev
);
28 sprintf(ndev
->vendor
, "0x%.4x", pplat
->vendor
);
30 ndev
->instance
= trailing_strtol(udev
->name
);
31 ndev
->bar
= dm_pci_map_bar(udev
, PCI_BASE_ADDRESS_0
,
33 return nvme_init(udev
);
36 U_BOOT_DRIVER(nvme
) = {
41 .priv_auto
= sizeof(struct nvme_dev
),
44 struct pci_device_id nvme_supported
[] = {
45 { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS
, ~0) },
49 U_BOOT_PCI_DEVICE(nvme
, nvme_supported
);