blob: 871f3f50f5caefdb4fc96c720810c337c482cf90 [file] [log] [blame]
Bin Mengcc5801d2023-10-11 21:15:50 +08001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2023 tinylab.org
4 * Author: Bin Meng <bmeng@tinylab.org>
5 */
6
Bin Mengcc5801d2023-10-11 21:15:50 +08007#include <dm.h>
8#include <errno.h>
9#include <pci.h>
10#include <ufs.h>
11#include <dm/device_compat.h>
12#include "ufs.h"
13
14static int ufs_pci_bind(struct udevice *dev)
15{
16 struct udevice *scsi_dev;
17
18 return ufs_scsi_bind(dev, &scsi_dev);
19}
20
21static int ufs_pci_probe(struct udevice *dev)
22{
23 int err;
24
25 err = ufshcd_probe(dev, NULL);
26 if (err)
27 dev_err(dev, "%s failed (ret=%d)\n", __func__, err);
28
29 return err;
30}
31
32U_BOOT_DRIVER(ufs_pci) = {
33 .name = "ufs_pci",
34 .id = UCLASS_UFS,
35 .bind = ufs_pci_bind,
36 .probe = ufs_pci_probe,
37};
38
39static struct pci_device_id ufs_supported[] = {
40 { PCI_DEVICE(PCI_VENDOR_ID_REDHAT, PCI_DEVICE_ID_REDHAT_UFS) },
41 {},
42};
43
44U_BOOT_PCI_DEVICE(ufs_pci, ufs_supported);