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 | |
Tom Rini | abb9a04 | 2024-05-18 20:20:43 -0600 | [diff] [blame] | 7 | #include <common.h> |
Bin Meng | cc5801d | 2023-10-11 21:15:50 +0800 | [diff] [blame] | 8 | #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 | |
| 15 | static int ufs_pci_bind(struct udevice *dev) |
| 16 | { |
| 17 | struct udevice *scsi_dev; |
| 18 | |
| 19 | return ufs_scsi_bind(dev, &scsi_dev); |
| 20 | } |
| 21 | |
| 22 | static 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 | |
| 33 | U_BOOT_DRIVER(ufs_pci) = { |
| 34 | .name = "ufs_pci", |
| 35 | .id = UCLASS_UFS, |
| 36 | .bind = ufs_pci_bind, |
| 37 | .probe = ufs_pci_probe, |
| 38 | }; |
| 39 | |
| 40 | static struct pci_device_id ufs_supported[] = { |
| 41 | { PCI_DEVICE(PCI_VENDOR_ID_REDHAT, PCI_DEVICE_ID_REDHAT_UFS) }, |
| 42 | {}, |
| 43 | }; |
| 44 | |
| 45 | U_BOOT_PCI_DEVICE(ufs_pci, ufs_supported); |