1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2017 NXP Semiconductors
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, 0, 0,
32 PCI_REGION_TYPE, PCI_REGION_MEM);
34 /* Turn on bus-mastering */
35 dm_pci_clrset_config16(udev, PCI_COMMAND, 0, PCI_COMMAND_MASTER);
37 return nvme_init(udev);
40 U_BOOT_DRIVER(nvme) = {
45 .priv_auto = sizeof(struct nvme_dev),
48 struct pci_device_id nvme_supported[] = {
49 { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, ~0) },
53 U_BOOT_PCI_DEVICE(nvme, nvme_supported);