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