Bin Meng | cc5801d | 2023-10-11 21:15:50 +0800 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright (C) 2023 tinylab.org |
| 4 | * Author: Bin Meng <bmeng@tinylab.org> |
| 5 | */ |
| 6 | |
Bin Meng | cc5801d | 2023-10-11 21:15:50 +0800 | [diff] [blame] | 7 | #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 | |
| 14 | static int ufs_pci_bind(struct udevice *dev) |
| 15 | { |
| 16 | struct udevice *scsi_dev; |
| 17 | |
| 18 | return ufs_scsi_bind(dev, &scsi_dev); |
| 19 | } |
| 20 | |
| 21 | static 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 | |
| 32 | U_BOOT_DRIVER(ufs_pci) = { |
| 33 | .name = "ufs_pci", |
| 34 | .id = UCLASS_UFS, |
| 35 | .bind = ufs_pci_bind, |
| 36 | .probe = ufs_pci_probe, |
| 37 | }; |
| 38 | |
| 39 | static struct pci_device_id ufs_supported[] = { |
| 40 | { PCI_DEVICE(PCI_VENDOR_ID_REDHAT, PCI_DEVICE_ID_REDHAT_UFS) }, |
| 41 | {}, |
| 42 | }; |
| 43 | |
| 44 | U_BOOT_PCI_DEVICE(ufs_pci, ufs_supported); |