aboutsummaryrefslogtreecommitdiff
path: root/drivers/ufs/ufs-pci.c
blob: ad41358727a5c4c925e0aa96b89e7f0f2b4cd9fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright (C) 2023 tinylab.org
 * Author: Bin Meng <bmeng@tinylab.org>
 */

#include <common.h>
#include <dm.h>
#include <errno.h>
#include <pci.h>
#include <ufs.h>
#include <dm/device_compat.h>
#include "ufs.h"

static int ufs_pci_bind(struct udevice *dev)
{
	struct udevice *scsi_dev;

	return ufs_scsi_bind(dev, &scsi_dev);
}

static int ufs_pci_probe(struct udevice *dev)
{
	int err;

	err = ufshcd_probe(dev, NULL);
	if (err)
		dev_err(dev, "%s failed (ret=%d)\n", __func__, err);

	return err;
}

U_BOOT_DRIVER(ufs_pci) = {
	.name	= "ufs_pci",
	.id	= UCLASS_UFS,
	.bind	= ufs_pci_bind,
	.probe	= ufs_pci_probe,
};

static struct pci_device_id ufs_supported[] = {
	{ PCI_DEVICE(PCI_VENDOR_ID_REDHAT, PCI_DEVICE_ID_REDHAT_UFS) },
	{},
};

U_BOOT_PCI_DEVICE(ufs_pci, ufs_supported);