1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2017 NXP Semiconductors
4 * Copyright (C) 2017 Bin Meng <bmeng.cn@gmail.com>
10 #include <dm/device.h>
13 static int nvme_uclass_post_probe(struct udevice *udev)
16 struct udevice *ns_udev;
18 struct nvme_dev *ndev = dev_get_priv(udev);
20 /* Create a blk device for each namespace */
21 for (i = 0; i < ndev->nn; i++) {
23 * Encode the namespace id to the device name so that
24 * we can extract it when doing the probe.
26 sprintf(name, "blk#%d", i);
28 /* The real blksz and size will be set by nvme_blk_probe() */
29 ret = blk_create_devicef(udev, "nvme-blk", name, IF_TYPE_NVME,
30 -1, 512, 0, &ns_udev);
38 UCLASS_DRIVER(nvme) = {
41 .post_probe = nvme_uclass_post_probe,