summaryrefslogtreecommitdiff
path: root/drivers/scsi
Commit message (Collapse)AuthorAgeFilesLines
* scsi: call device_probe() after scanningAKASHI Takahiro2022-04-091-0/+5
| | | | | | | | | | | Every time a scsi bus/port is scanned and a new block device is detected, we want to call device_probe() as it will give us a chance to run additional post-processings for some purposes. In particular, support for creating partitions on a device will be added. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* Convert CONFIG_SCSI_AHCI_PLAT et al to KconfigSimon Glass2022-02-092-0/+32
| | | | | | | | | | | | | | This converts the following to Kconfig: CONFIG_SCSI_AHCI_PLAT CONFIG_SYS_SCSI_MAX_SCSI_ID CONFIG_SYS_SCSI_MAX_LUN CONFIG_SYS_SATA_MAX_DEVICE Drop CONFIG_SCSI for everything except the sandbox build. We only need one build for tests. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Roese <sr@denx.de>
* scsi: Drop CONFIG_SYS_SCSI_MAX_DEVICESimon Glass2022-02-091-3/+3
| | | | | | | | | | | | | | This is defined based on two other CONFIGs for all boards except sandbox and durian. For sandbox the value does not matter. For durian the value seems excessive. Drop the option completely, to simplify configuration and reduce the number of things we need to convert to Kconfig. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Roese <sr@denx.de>
* sata: Rename SATA_SUPPORT to SATASimon Glass2021-09-041-1/+1
| | | | | | Rename this options so that CONFIG_IS_ENABLED can be used with it. Signed-off-by: Simon Glass <sjg@chromium.org>
* pci: scsi: pci: Drop DM_PCI check from scsiSimon Glass2021-08-051-6/+0
| | | | | | | | | We don't need this check anymore since when PCI is enabled, driver model is always used. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: define LOG_CATEGORY for all uclassPatrick Delaunay2021-07-061-0/+2
| | | | | | | | Define LOG_CATEGORY for all uclass to allow filtering with log command. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* scsi: Add ata_swap_buf_le16() to support big-endian platformsStefan Roese2021-04-231-0/+6
| | | | | | | | | | | | | | | | | | | | Otherwise the output will look like this on MIPS Octeon NIC23: Device 0: (0:0) Vendor: ATA Prod.: aSDnsi klUrt aII Rev: 4X11 Type: Hard Disk Capacity: 457862.8 MB = 447.1 GB (937703088 x 512) instead of this version: Device 0: (0:0) Vendor: TA Prod.: SanDisk Ultra II Rev: X411 Type: Hard Disk Capacity: 457862.8 MB = 447.1 GB (937703088 x 512) Signed-off-by: Stefan Roese <sr@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Aaron Williams <awilliams@marvell.com> Cc: Chandrakala Chavva <cchavva@marvell.com> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
* dm: treewide: Rename ..._platdata variables to just ..._platSimon Glass2020-12-132-4/+4
| | | | | | | Try to maintain some consistency between these variables by using _plat as a suffix for them. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: treewide: Rename 'platdata' variables to just 'plat'Simon Glass2020-12-132-9/+9
| | | | | | | | | | We use 'priv' for private data but often use 'platdata' for platform data. We can't really use 'pdata' since that is ambiguous (it could mean private or platform data). Rename some of the latter variables to end with 'plat' for consistency. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: treewide: Rename auto_alloc_size members to be shorterSimon Glass2020-12-131-1/+1
| | | | | | | | | | | | This construct is quite long-winded. In earlier days it made some sense since auto-allocation was a strange concept. But with driver model now used pretty universally, we can shorten this to 'auto'. This reduces verbosity and makes it easier to read. Coincidentally it also ensures that every declaration is on one line, thus making dtoc's job easier. Signed-off-by: Simon Glass <sjg@chromium.org>
* common: Drop log.h from common headerSimon Glass2020-05-181-0/+1
| | | | | | Move this header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
* common: Drop bootstage.h from common headerSimon Glass2020-05-181-0/+1
| | | | | | Move this fairly uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
* common: Drop part.h from common headerSimon Glass2020-05-181-0/+2
| | | | | | Move this uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
* 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>