summaryrefslogtreecommitdiff
path: root/common/scsi.c
AgeCommit message (Collapse)Author
2017-01-09scsi: dm: Unbind all scsi based block devices before new scanMichal Simek
New scan should unbind all block devices not to be listed again. Without this patch if scsi reset or scan is called new block devices are created which point to the same id and lun. For example: ZynqMP> scsi scan scsi_scan: if_type=2, devnum=0: sdhci@ff170000.blk, 6, 0 scsi_scan: if_type=2, devnum=0: ahci@fd0c0000.id1lun0, 2, 0 scsi_scan: if_type=2, devnum=0: ahci@fd0c0000.id1lun0, 2, 1 scsi_scan: if_type=2, devnum=0: ahci@fd0c0000.id1lun0, 2, 2 scsi_scan: if_type=2, devnum=0: ahci@fd0c0000.id1lun0, 2, 3 scsi_scan: if_type=2, devnum=0: ahci@fd0c0000.id1lun0, 2, 4 scanning bus for devices... Device 0: (1:0) Vendor: ATA Prod.: KINGSTON SVP200S Rev: 501A Type: Hard Disk Capacity: 57241.8 MB = 55.9 GB (117231408 x 512) Reported-by: Ken Ma <make@marvell.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Simon Glass <sjg@chromium.org>
2016-12-20dm: Add support for scsi/sata based devicesMichal Simek
All sata based drivers are bind and corresponding block device is created. Based on this find_scsi_device() is able to get back block device based on scsi_curr_dev pointer. intr_scsi() is commented now but it can be replaced by calling find_scsi_device() and scsi_scan(). scsi_dev_desc[] is commented out but common/scsi.c heavily depends on it. That's why CONFIG_SYS_SCSI_MAX_DEVICE is hardcoded to 1 and symbol is reassigned to a block description allocated by uclass. There is only one block description by device now but it doesn't need to be correct when more devices are present. scsi_bind() ensures corresponding block device creation. uclass post_probe (scsi_post_probe()) is doing low level init. SCSI/SATA DM based drivers requires to have 64bit base address as the first entry in platform data structure to setup mmio_base. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2016-12-09Revert "Merge branch 'master' of git://www.denx.de/git/u-boot-microblaze"Tom Rini
This reverts commit 3edc0c252257e4afed163a3a74aba24a5509b198, reversing changes made to bb135a0180c31fbd7456021fb9700b49bba7f533.
2016-12-08dm: Add support for scsi/sata based devicesMichal Simek
All sata based drivers are bind and corresponding block device is created. Based on this find_scsi_device() is able to get back block device based on scsi_curr_dev pointer. intr_scsi() is commented now but it can be replaced by calling find_scsi_device() and scsi_scan(). scsi_dev_desc[] is commented out but common/scsi.c heavily depends on it. That's why CONFIG_SYS_SCSI_MAX_DEVICE is hardcoded to 1 and symbol is reassigned to a block description allocated by uclass. There is only one block description by device now but it doesn't need to be correct when more devices are present. scsi_bind() ensures corresponding block device creation. uclass post_probe (scsi_post_probe()) is doing low level init. SCSI/SATA DM based drivers requires to have 64bit base address as the first entry in platform data structure to setup mmio_base. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org> Series-changes: 2 - Use CONFIG_DM_SCSI instead of mix of DM_SCSI and DM_SATA Ceva sata has never used sata commands that's why keep it in SCSI part only. - Separate scsi_scan() for DM_SCSI and do not change cmd/scsi.c - Extend platdata Series-changes: 3 - Fix scsi_scan return path - Fix header location uclass-internal.h - Add scsi_max_devs under !DM_SCSI - Add new header device-internal because of device_probe() - Redesign block device creation algorithm - Use device_unbind in error path - Create block device with id and lun numbers (lun was there in v2) - Cleanup dev_num initialization in block device description with fixing parameters in blk_create_devicef - Create new Kconfig menu for SATA/SCSI drivers - Extend description for DM_SCSI - Fix Kconfig dependencies - Fix kernel doc format in scsi_platdata - Fix ahci_init_one - vendor variable Series-changes: 4 - Fix Kconfig entry - Remove SPL ifdef around SCSI uclass - Clean ahci_print_info() ifdef logic
2016-12-02scsi: Separate SCSI private block description initializationMichal Simek
When blk_create_device() is called some parameters in blk_desc are automatically filled. Separate SCSI private initialization and SCSI full block device initialization not to rewrite already prepared data. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2016-12-02scsi: Change scsi_scan() to be able to return valueMichal Simek
With DM_SCSI this function will return more than one return value to cover errors. Suggested-by: Simon Glass <sjg@chromium.org> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2016-12-02scsi: Make private functions staticMichal Simek
Several functions should be static because they are not exported to any other file. Warnings were reported by sparse C=1. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2016-12-02scsi: Remove completely unused functionsMichal Simek
These functions are not called for any location. This patch removes them scsi_trim_trail(), scsi_get_disk_count() and scsi_setup_read6(). Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2016-12-02scsi: Simplify scsi_read/scsi_write()Michal Simek
There is no reason to directly point to static allocated array when we have proper block_dev pointer available via parameter in !CONFIG_BLK. For CONFIG_BLK this is read directly from uclass platdata. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2016-12-02scsi: Move pccb buffer initalization directly to scsi_detect_devMichal Simek
pccb is pointer to temporary buffer which is used only for sending command. Make it local as is done in scsi_read/scsi_write. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2016-12-02scsi: Take lun from device block descriptionMichal Simek
Prepare LUN(Logical unit number) directly in block description structure and reuse it. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2016-12-02scsi: Extract device detection algorithmMichal Simek
The patch enables running detection algorithm on block device description structure. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2016-12-02scsi: Extract block device initializationMichal Simek
Extract block device initialization to specific function. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2016-06-06dm: scsi: if_typename should be scsiEd Swarthout
Fixes: => ext2ls scsi 0:1 ** Bad device scsi 0:1 ** for boards which use the scsi legacy driver (such as ls1043ardb). Signed-off-by: Ed Swarthout <Ed.Swarthout@nxp.com> Tested-by: George McCollister <george.mccollister@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: scsi: Add support for driver-model block devicesSimon Glass
Add driver-model block-device support to the SCSI implementation. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: scsi: Drop the get_dev() functionSimon Glass
This function is implemented by the legacy block functions now. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: scsi: Separate the non-command code into its own fileSimon Glass
At present the SCSI command code includes both the command-processing code and the core SCSI functions and data structures. Separate the latter into its own file, adding functions as needed to avoid the command code accessing data structures directly. This functions use the new legacy block functions. With this commit: - There is no CONFIG option referenced from the command code - The concept of a 'current SCSI device' is confined to the command code This will make it easier to convert this code to driver model. Signed-off-by: Simon Glass <sjg@chromium.org>