summaryrefslogtreecommitdiffstats
path: root/drivers/scsi
Commit message (Collapse)AuthorAgeFilesLines
* scsi: Add dma direction member to command structureFaiz Abbas2019-10-231-0/+4
| | | | | | | | Some SCSI devices like UFS use DMA for executing scsi commands and hence need to know the direction of transfer of the dma. Add a dma_dir element to the command structure to facilitate this. Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
* scsi: Retry inquiry 3 times to overcome Unit Attention conditionFaiz Abbas2019-10-231-3/+9
| | | | | | | | The UFS SCSI device LUNs are observed to return failure the first time a unit ready inquiry is sent and pass on the second try. Send this inquiry 3 times to make sure device is ready. Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
* scsi: Add max_bytes_per_req to scsi_platdataFaiz Abbas2019-10-231-19/+26
| | | | | | | Add max_bytes_per_req to scsi_platdata to enable the host driver to limit the number of bytes that can be read/written per request. Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
* scsi: Simplify scsi_read()/_write()Faiz Abbas2019-10-231-37/+17
| | | | | | | | | | With no non-DM driver using scsi_read()/_write() APIs, remove the legacy implementations. Signed-off-by: Faiz Abbas <faiz_abbas@ti.com> [trini: Reorder slightly and mark scsi_read/write behind BLK test to avoid warnings] Signed-off-by: Tom Rini <trini@konsulko.com>
* env: Move env_set_ulong() to env.hSimon Glass2019-08-111-0/+1
| | | | | | | Move env_set_ulong() over to the new header file. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* dm: scsi: report correct device numberHeinrich Schuchardt2019-02-191-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | Before the patch scsi would report the same device number for all SCSI devices, e.g. Device 0: (1:0) Vendor: ATA Prod.: Crucial_CT128M55 Rev: MU01 Type: Hard Disk Capacity: 122104.3 MB = 119.2 GB (250069680 x 512) Device 0: (1:0) Vendor: ATA Prod.: Rev: Type: Hard Disk Capacity: not available With the patch the same device number is reported as is used in scsi_read(): Device 0: (1:0) Vendor: ATA Prod.: Crucial_CT128M55 Rev: MU01 Type: Hard Disk Capacity: 122104.3 MB = 119.2 GB (250069680 x 512) Device 1: (1:0) Vendor: ATA Prod.: Rev: Type: Hard Disk Capacity: not available Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* blk: Call part_init() in the post_probe() methodBin Meng2018-11-141-1/+0
| | | | | | | | | | | part_init() is currently called in every DM BLK driver, either in its bind() or probe() method. However we can use the BLK uclass driver's post_probe() method to do it automatically. Update all DM BLK drivers to adopt this change. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* Remove <inttypes.h> includes and PRI* usages in printf() entirelyMasahiro Yamada2018-09-101-5/+4
| | | | | | | | | | | | | | | | In int-ll64.h, we always use the following typedefs: typedef unsigned int u32; typedef unsigned long uintptr_t; typedef unsigned long long u64; This does not need to match to the compiler's <inttypes.h>. Do not include it. The use of PRI* makes the code super-ugly. You can simply use "l" for printing uintptr_t, "ll" for u64, and no modifier for u32. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
* SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini2018-05-074-9/+4
| | | | | | | | | | | | | | | | | | | | When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
* Move most CONFIG_HAVE_BLOCK_DEVICE to KconfigAdam Ford2018-02-081-0/+1
| | | | | | | | | | | config_fallbacks.h has some logic that sets HAVE_BLOCK_DEVICE based on a list of enabled options. Moving HAVE_BLOCK_DEVICE to Kconfig allows us to drastically shrink the logic in config_fallbacks.h Signed-off-by: Adam Ford <aford173@gmail.com> [trini: Rename HAVE_BLOCK_DEVICE to CONFIG_BLOCK_DEVICE] Signed-off-by: Tom Rini <trini@konsulko.com>
* blk: dm: make blk_create_device() take a number of block instead of a sizeJean-Jacques Hiblot2017-09-111-1/+1
| | | | | | | | | | | There is an overflow problem when taking the size instead of the number of blocks in blk_create_device(). This results in a wrong device size: the device apparent size is its real size modulo 4GB. Using the number of blocks instead of the device size fixes the problem and is more coherent with the internals of the block layer. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* env: Rename common functions related to setenv()Simon Glass2017-08-161-1/+1
| | | | | | | | | We are now using an env_ prefix for environment functions. Rename these commonly used functions, for consistency. Also add function comments in common.h. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: mmc: Allow disabling driver model in SPLSimon Glass2017-08-011-1/+1
| | | | | | | | | | | | | | At present if U-Boot proper uses driver model for MMC, then SPL has to also. While this is desirable, it places a significant barrier to moving to driver model in some cases. For example, with a space-constrained SPL it may be necessary to enable CONFIG_SPL_OF_PLATDATA which involves adjusting some drivers. Add new SPL versions of the options for DM_MMC, DM_MMC_OPS and BLK. By default these follow their non-SPL versions, but this can be changed by boards which need it. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: scsi: Drop scsi_init() when driver model is usedSimon Glass2017-07-111-2/+4
| | | | | | | | This function should not be used with driver model. Update the code to reflect this. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: scsi: Split out the bus scanning codeSimon Glass2017-07-111-12/+23
| | | | | | | | Split out the code that scans a single SCSI bus into a separate function. This will allow it to be used from driver model. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: scsi: Adjust return value of scsi_exec()Simon Glass2017-07-111-4/+4
| | | | | | | | Change this function to return an error number instead of true/false. This allows us to return a proper error number. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: scsi: Add operations for SCSI devicesSimon Glass2017-07-111-0/+20
| | | | | | | | | | The SCSI uclass currently has no operations. It just uses the global SCSI functions. Fix this by adding operations to the only two drivers that use the uclass, and replacing the global functions with those defined locally in the SCSI code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: scsi: Document and rename the scsi_scan() parameterSimon Glass2017-07-111-10/+10
| | | | | | | | | The 'mode' parameter is actually a flag to determine whether to display a list of devices found during the scan. Rename it to reflect this, add a function comment and adjust callers to use a boolean. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: scsi: Add a device pointer to scan_exec(), scsi_bus_reset()Simon Glass2017-07-112-14/+22
| | | | | | | | | | With driver model these functions need a device pointer. Add one even when CONFIG_DM_SCSI is not defined. This avoids having ugly conditional function prototypes, When CONFIG_DM_SCSI is not defined we can just ignore the pointer. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: ahci: Unwind the confusing init codeSimon Glass2017-07-111-8/+0
| | | | | | | | | | | | | | | | | | | Two AHCI drivers use SCSI with CONFIG_DM_SCSI. The SCSI uclass calls scsi_low_level_init() which is implemented by ahci.c. If CONFIG_SCSI_AHCI_PLAT is defined it does one thing and if it is not it does something else. We don't need to call through scsi_low_level_init() to get the init completed. Instead, adjust the two drivers to call into AHCI directly. Drop the post-probe init in the SCSI uclass. This means that driver model doesn't need to use scsi_low_level_init(). It is a legacy function and driver model should use a driver's probe() method instead. While we are here, add a comment to the top of the file explaining what ahci.c does. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: scsi: Indent the confusing #ifdefsSimon Glass2017-07-111-13/+13
| | | | | | | | These are very confusing without some sort of indentation. At some point we will be able to remove them, but for now, indent them. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: scsi: Use the uclass platform dataSimon Glass2017-07-112-1/+2
| | | | | | | | | At present the two driver-model SCSI drivers use device platform data to store information that relates to the uclass. It is better to use uclass platform data in this situation. Update the code to do this. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: scsi: Drop the ccb typedefSimon Glass2017-07-112-12/+13
| | | | | | | | | We should not be using typedefs in U-Boot and 'ccb' is a pretty short name. It is also used with variables. Drop the typedef and use 'struct' instead. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* scsi: Move drivers into new drivers/scsi directorySimon Glass2017-07-115-0/+777
At present we have the SCSI drivers in the drivers/block and common/ directories. It is better to split them out into their own place. Use drivers/scsi which is what Linux does. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>