Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Michal Simek | c886f35 | 2016-09-08 15:06:45 +0200 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2015 Google, Inc |
| 4 | * Written by Simon Glass <sjg@chromium.org> |
| 5 | * Copyright (c) 2016 Xilinx, Inc |
| 6 | * Written by Michal Simek |
| 7 | * |
| 8 | * Based on ahci-uclass.c |
Michal Simek | c886f35 | 2016-09-08 15:06:45 +0200 | [diff] [blame] | 9 | */ |
| 10 | |
Patrick Delaunay | 8131335 | 2021-04-27 11:02:19 +0200 | [diff] [blame] | 11 | #define LOG_CATEGORY UCLASS_SCSI |
| 12 | |
Michal Simek | c886f35 | 2016-09-08 15:06:45 +0200 | [diff] [blame] | 13 | #include <common.h> |
| 14 | #include <dm.h> |
| 15 | #include <scsi.h> |
| 16 | |
Simon Glass | c4dfa89 | 2017-06-14 21:28:43 -0600 | [diff] [blame] | 17 | int scsi_exec(struct udevice *dev, struct scsi_cmd *pccb) |
| 18 | { |
| 19 | struct scsi_ops *ops = scsi_get_ops(dev); |
| 20 | |
| 21 | if (!ops->exec) |
| 22 | return -ENOSYS; |
| 23 | |
| 24 | return ops->exec(dev, pccb); |
| 25 | } |
| 26 | |
| 27 | int scsi_bus_reset(struct udevice *dev) |
| 28 | { |
| 29 | struct scsi_ops *ops = scsi_get_ops(dev); |
| 30 | |
| 31 | if (!ops->bus_reset) |
| 32 | return -ENOSYS; |
| 33 | |
| 34 | return ops->bus_reset(dev); |
| 35 | } |
| 36 | |
Michal Simek | c886f35 | 2016-09-08 15:06:45 +0200 | [diff] [blame] | 37 | UCLASS_DRIVER(scsi) = { |
| 38 | .id = UCLASS_SCSI, |
| 39 | .name = "scsi", |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 40 | .per_device_plat_auto = sizeof(struct scsi_plat), |
Michal Simek | c886f35 | 2016-09-08 15:06:45 +0200 | [diff] [blame] | 41 | }; |