Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Michal Simek | e8a016b | 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 | e8a016b | 2016-09-08 15:06:45 +0200 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | #include <common.h> |
| 12 | #include <dm.h> |
| 13 | #include <scsi.h> |
| 14 | |
Simon Glass | f6ab5a9 | 2017-06-14 21:28:43 -0600 | [diff] [blame] | 15 | int scsi_exec(struct udevice *dev, struct scsi_cmd *pccb) |
| 16 | { |
| 17 | struct scsi_ops *ops = scsi_get_ops(dev); |
| 18 | |
| 19 | if (!ops->exec) |
| 20 | return -ENOSYS; |
| 21 | |
| 22 | return ops->exec(dev, pccb); |
| 23 | } |
| 24 | |
| 25 | int scsi_bus_reset(struct udevice *dev) |
| 26 | { |
| 27 | struct scsi_ops *ops = scsi_get_ops(dev); |
| 28 | |
| 29 | if (!ops->bus_reset) |
| 30 | return -ENOSYS; |
| 31 | |
| 32 | return ops->bus_reset(dev); |
| 33 | } |
| 34 | |
Michal Simek | e8a016b | 2016-09-08 15:06:45 +0200 | [diff] [blame] | 35 | UCLASS_DRIVER(scsi) = { |
| 36 | .id = UCLASS_SCSI, |
| 37 | .name = "scsi", |
Simon Glass | 1dc64f6 | 2017-06-14 21:28:31 -0600 | [diff] [blame] | 38 | .per_device_platdata_auto_alloc_size = sizeof(struct scsi_platdata), |
Michal Simek | e8a016b | 2016-09-08 15:06:45 +0200 | [diff] [blame] | 39 | }; |