diff options
author | Tom Rini <trini@konsulko.com> | 2022-02-10 17:38:04 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-02-10 17:38:04 -0500 |
commit | fe203a05fb663fa9bc42a9ef9ae51a6ed01a4a90 (patch) | |
tree | 635b4c3019d51684bdb98a52e20aaeb893c5c40a /drivers/nvme/nvme_pci.c | |
parent | c4408291bfff9622f2d3817a13c997debd0e8200 (diff) | |
parent | ad41ed120893522e23cc24550bb2d1dfb745a075 (diff) |
Merge branch '2022-02-10-platform-updates'
- Assorted Apple M1 platform updates
- Drop CONFIG_SYS_RESET_ADDR, update k3-am64-sk memory values in dts
Diffstat (limited to 'drivers/nvme/nvme_pci.c')
-rw-r--r-- | drivers/nvme/nvme_pci.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/drivers/nvme/nvme_pci.c b/drivers/nvme/nvme_pci.c new file mode 100644 index 00000000000..5f60fb884fb --- /dev/null +++ b/drivers/nvme/nvme_pci.c @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2017 NXP Semiconductors + * Copyright (C) 2017 Bin Meng <bmeng.cn@gmail.com> + */ + +#include <common.h> +#include <dm.h> +#include <pci.h> +#include "nvme.h" + +static int nvme_bind(struct udevice *udev) +{ + static int ndev_num; + char name[20]; + + sprintf(name, "nvme#%d", ndev_num++); + + return device_set_name(udev, name); +} + +static int nvme_probe(struct udevice *udev) +{ + struct nvme_dev *ndev = dev_get_priv(udev); + struct pci_child_plat *pplat; + + pplat = dev_get_parent_plat(udev); + sprintf(ndev->vendor, "0x%.4x", pplat->vendor); + + ndev->instance = trailing_strtol(udev->name); + ndev->bar = dm_pci_map_bar(udev, PCI_BASE_ADDRESS_0, + PCI_REGION_MEM); + return nvme_init(udev); +} + +U_BOOT_DRIVER(nvme) = { + .name = "nvme", + .id = UCLASS_NVME, + .bind = nvme_bind, + .probe = nvme_probe, + .priv_auto = sizeof(struct nvme_dev), +}; + +struct pci_device_id nvme_supported[] = { + { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, ~0) }, + {} +}; + +U_BOOT_PCI_DEVICE(nvme, nvme_supported); |