blob: ad41358727a5c4c925e0aa96b89e7f0f2b4cd9fd [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
Tom Riniabb9a042024-05-18 20:20:43 -06007#include <common.h>
Bin Mengcc5801d2023-10-11 21:15:50 +08008#include <dm.h>
9#include <errno.h>
10#include <pci.h>
11#include <ufs.h>
12#include <dm/device_compat.h>
13#include "ufs.h"
14
15static int ufs_pci_bind(struct udevice *dev)
16{
17 struct udevice *scsi_dev;
18
19 return ufs_scsi_bind(dev, &scsi_dev);
20}
21
22static int ufs_pci_probe(struct udevice *dev)
23{
24 int err;
25
26 err = ufshcd_probe(dev, NULL);
27 if (err)
28 dev_err(dev, "%s failed (ret=%d)\n", __func__, err);
29
30 return err;
31}
32
33U_BOOT_DRIVER(ufs_pci) = {
34 .name = "ufs_pci",
35 .id = UCLASS_UFS,
36 .bind = ufs_pci_bind,
37 .probe = ufs_pci_probe,
38};
39
40static struct pci_device_id ufs_supported[] = {
41 { PCI_DEVICE(PCI_VENDOR_ID_REDHAT, PCI_DEVICE_ID_REDHAT_UFS) },
42 {},
43};
44
45U_BOOT_PCI_DEVICE(ufs_pci, ufs_supported);