aboutsummaryrefslogtreecommitdiff
path: root/drivers/block
AgeCommit message (Collapse)AuthorFilesLines
2017-06-01dm: blk: Improve block device claimingSimon Glass1-3/+31
The intention with block devices is that the device number (devnum field in its descriptor) matches the alias of its parent device. For example, with: aliases { mmc0 = "/sdhci@700b0600"; mmc1 = "/sdhci@700b0400"; } we expect that the block devices for mmc0 and mmc1 would have device numbers of 0 and 1 respectively. Unfortunately this does not currently always happen. If there is another MMC device earlier in the driver model data structures its block device will be created first. It will therefore get device number 0 and mmc0 will therefore miss out. In this case the MMC device will have sequence number 0 but its block device will not. To avoid this, allow a device to request a device number and bump any existing device number that is using it. This all happens during the binding phase so it is safe to change these numbers around. This allows device numbers to match the aliases in all circumstances. Add a test to verify the behaviour. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01dm: blk: Add a function to find the next block device numberSimon Glass1-6/+16
At present this code is inline. Move it into a function to allow it to be used elsewhere. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01dm: blk: Allow finding block devices without probingSimon Glass1-2/+13
Sometimes it is useful to be able to find a block device without also probing it. Add a function for this as well as the associated test. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01dm: core: Replace of_offset with accessor (part 2)Simon Glass1-3/+3
At present devices use a simple integer offset to record the device tree node associated with the device. In preparation for supporting a live device tree, which uses a node pointer instead, refactor existing code to access this field through an inline function. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01dm: Rename dev_addr..() functionsSimon Glass2-3/+3
These support the flat device tree. We want to use the dev_read_..() prefix for functions that support both flat tree and live tree. So rename the existing functions to avoid confusion. In the end we will have: 1. dev_read_addr...() - works on devices, supports flat/live tree 2. devfdt_get_addr...() - current functions, flat tree only 3. of_get_address() etc. - new functions, live tree only All drivers will be written to use 1. That function will in turn call either 2 or 3 depending on whether the flat or live tree is in use. Note this involves changing some dead code - the imx_lpi2c.c file. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-05-22Kconfig: Add a CONFIG_IDE optionSimon Glass4-1/+1241
At present IDE support is controlled by CONFIG_CMD_IDE. Add a separate CONFIG_IDE option so that IDE support can be enabled without requiring the 'ide' command. Update existing users and move the ide driver into drivers/block since it should not be in common/. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-05-09drivers: block: dwc_ahci: Implement a driver for Synopsys DWC sata deviceJean-Jacques Hiblot3-0/+112
Implement a sata driver for Synopsys DWC sata device based on U-boot driver model. Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-04-18fsl/sata: correctly identify failed mallocxypron.glpk@gmx.de1-1/+1
After allocating sata->cmd_hdr_tbl_offset we have to check this variable and not variable sata. The problem was indicated by cppcheck. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Tom Rini <trini@konsulko.com>
2017-04-18drivers: remove Blackfin specific driversMasahiro Yamada3-1380/+0
These drivers have no user since commit ea3310e8aafa ("Blackfin: Remove"). Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
2017-04-04dm: core: Add flags parameter to device_remove()Stefan Roese2-2/+2
This patch adds the flags parameter to device_remove() and changes all calls to this function to provide the default value of DM_REMOVE_NORMAL for "normal" device removal. This is in preparation for the driver specific pre-OS (e.g. DMA cancelling) remove support. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Simon Glass <sjg@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
2016-12-20block: Move ceva driver to DMMichal Simek2-2/+48
This patch also includes ARM64 zynqmp changes: - Remove platform non DM initialization - Remove hardcoded sata base address Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2016-12-20dm: Add support for scsi/sata based devicesMichal Simek5-9/+64
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 Rini6-112/+11
This reverts commit 3edc0c252257e4afed163a3a74aba24a5509b198, reversing changes made to bb135a0180c31fbd7456021fb9700b49bba7f533.
2016-12-08block: Move ceva driver to DMMichal Simek2-2/+48
This patch also includes ARM64 zynqmp changes: - Remove platform non DM initialization - Remove hardcoded sata base address Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org> Series-to: sjg, agraf@suse.de Series-cc: uboot Series-version: 4 Series-changes: 2 - make ceva_init_sata static - Move SATA_CEVA to defconfig - Initalized max_lun and max_id platdata Series-changes: 3 - Extend Kconfig help description - sort dm.h - Remove SPL undefinition from board file - Fix Kconfig dependecies
2016-12-08dm: Add support for scsi/sata based devicesMichal Simek5-9/+64
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-05sata: sata_mv: Fix misaligned cache warningsStefan Roese1-3/+9
This patch fixes the warnings about misaligned cache on Armada XP: CACHE: Misaligned operation at range [7facb400, 7facb460] Signed-off-by: Stefan Roese <sr@denx.de>
2016-12-02dm: blk: Fix get_desc to return block device descriptorMichal Simek1-0/+2
Current get_desc() implementation is not able to succesfully finish and return pointer to block device descriptor. Also function always return non zero value even device is found. The patch fills block device descriptor and return 0 if device is found. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2016-10-11dm: blk: Enable CONFIG_BLK if DM_MMC is enabledSimon Glass1-0/+1
To speed up conversion to CONFIG_BLK, enable it by default when DM_MMC is enabled. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-09-27ahci: Make ahci_port_base() non-static to enable overwriteStefan Roese1-1/+1
To allow a board- / platform-specific ahci_port_base() function, this patch removes "static inline" and adds __weak to this function. This will be used by the upcoming Armada 7K/8K SATA / AHCI support, which unfortunately needs a different port base address calculation. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Nadav Haklai <nadavh@marvell.com> Cc: Neta Zur Hershkovits <neta@marvell.com> Cc: Kostya Porotchkin <kostap@marvell.com> Cc: Omri Itach <omrii@marvell.com> Cc: Igal Liberman <igall@marvell.com> Cc: Haim Boot <hayim@marvell.com> Cc: Hanna Hawa <hannah@marvell.com>
2016-09-23treewide: replace #include <asm/errno.h> with <linux/errno.h>Masahiro Yamada6-6/+6
Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have the same content. (both just wrap <asm-generic/errno.h>) Replace all include directives for <asm/errno.h> with <linux/errno.h>. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> [trini: Fixup include/clk.] Signed-off-by: Tom Rini <trini@konsulko.com>
2016-09-23drivers: squash lines for immediate returnMasahiro Yamada1-3/+2
Remove unneeded variables and assignments. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2016-05-24block: dwc_ahsata: support i.MX6DQPlusPeng Fan1-1/+1
i.MX6DQPlus support sata interface, so not return failure when CPU is i.MX6DQPlus. In this patch, also use simpler runtime cpu dections macros to replace is_cpu_type. Signed-off-by: Peng Fan <van.freenix@gmail.com> Cc: Stefano Babic <sbabic@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Tang Yuantian <Yuantian.Tang@freescale.com> Cc: Shaohui Xie <Shaohui.Xie@freescale.com> Cc: Bin Meng <bmeng.cn@gmail.com>
2016-05-17dm: blk: Add functions to select a hardware partitionSimon Glass1-0/+29
The block device uclass does not currently support selecting a particular hardware partition but this is needed for MMC. Add it so that the blk API can support MMC properly. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: blk: Free the block device name when unboundSimon Glass1-2/+10
Mark the device name as allocated so that it will be freed correctly when the device is unbound. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: blk: Fix allocation of block-device numberingSimon Glass1-9/+9
Due to code ordering the block devices are not numbered sequentially. Fix this. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: systemace: Add driver-mode block-device supportSimon Glass1-0/+44
Add support for CONFIG_BLK to the systemace driver. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: systemace: Reorder function to avoid forward declarataionsSimon Glass1-31/+26
Move the systemace_get_dev() function below systemace_read() so that we can avoid a forward declaration. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: blk: Add a easier way to create a named block deviceSimon Glass1-0/+15
Add a function that automatically builds the device name given the parent and a supplied string. Most callers will want to do this, so putting this functionality in one place makes more sense. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: blk: Allow blk_create_device() to allocate the device numberSimon Glass1-0/+29
Allow a devnum parameter of -1 to indicate that the device number should be alocated automatically. The next highest available device number for that interface type is used. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: sandbox: Drop the host_get_dev() functionSimon Glass1-10/+0
This function is implemented by the legacy block functions now. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: blk: Drop the systemace.h headerSimon Glass1-1/+0
This has nothing of consequence. Remove it and its only inclusion site. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: systemace: Drop the get_dev() functionSimon Glass1-11/+3
This function is implemented by the legacy block functions now. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: mmc: Add an implementation of the 'devnum' functionsSimon Glass1-0/+280
Now that the MMC code accesses devices by number, we can implement this same interface for driver model, allowing MMC to support using driver model for block devices. Add the required functions to the uclass. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: sandbox: Add a legacy host block interfaceSimon Glass1-0/+7
Add a legacy block interface for sandbox host. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: systemace: Add a legacy block interfaceSimon Glass1-0/+14
Add a legacy block interface for systemace. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: blk: Add a legacy block interfaceSimon Glass2-0/+265
There is quite a bit of duplicated common code related to block devices in the IDE and SCSI implementations. Create some helper functions that can be used to reduce the duplication. These rely on a linker list of interface-type drivers Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: scsi: Rename CONFIG_CMD_SCSI to CONFIG_SCSISimon Glass1-1/+1
This option currently enables both the command and the SCSI functionality. Rename the existing option to CONFIG_SCSI since most of the code relates to the feature. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17sandbox: Add dummy SATA functionsSimon Glass2-1/+34
Add some functions needed by the SATA code. This allows it to be compiled for sandbox, thus increasing build coverage. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17sandbox: Add dummy SCSI functionsSimon Glass2-1/+30
Add some functions needed by the SCSI code. This allows it to be compiled for sandbox, thus increasing build coverage. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: Rename disk uclass to ahciSimon Glass3-7/+6
This started as 'ahci' and was renamed to 'disk' during code review. But it seems that this is too generic. Now that we have a 'blk' uclass, we can use that as the generic piece, and revert to ahci for this. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17Revert "dm: sandbox: Drop the pre-DM host implementation"Simon Glass1-0/+90
Bring this support back so that sandbox can be compiled with CONFIG_BLK. This allows sandbox to have greater build coverage during the block-device transition. This can be removed again later. This reverts commit 33cf727b1634dbd9cd68a6ebc444a88f053822d7. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-04-18ahci: flush dcache before issuing commandTang Yuantian1-0/+1
Ensure data the following sata command used is flushed out of dcache and written to physical memory or timeout error may happen. Signed-off-by: Tang Yuantian <yuantian.tang@nxp.com>
2016-04-04block: Add support for Ceva sataMichal Simek2-0/+114
Initial Ceva Sata init code. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2016-04-01drivers: block: add block device cacheEric Nelson4-1/+195
Add a block device cache to speed up repeated reads of block devices by various filesystems. This small amount of cache can dramatically speed up filesystem operations by skipping repeated reads of common areas of a block device (typically directory structures). This has shown to have some benefit on FAT filesystem operations of loading a kernel and RAM disk, but more dramatic benefits on ext4 filesystems when the kernel and/or RAM disk are spread across multiple extent header structures as described in commit fc0fc50. The cache is implemented through a minimal list (block_cache) maintained in most-recently-used order and count of the current number of entries (cache_count). It uses a maximum block count setting to prevent copies of large block reads and an upper bound on the number of cached areas. The maximum number of entries in the cache defaults to 32 and the maximum number of blocks per cache entry has a default of 2, which has shown to produce the best results on testing of ext4 and FAT filesystems. The 'blkcache' command (enabled through CONFIG_CMD_BLOCK_CACHE) allows changing these values and can be used to tune for a particular filesystem layout. Signed-off-by: Eric Nelson <eric@nelint.com>
2016-03-22Fix spelling of "transferred".Vagrant Cascadian1-2/+2
Signed-off-by: Vagrant Cascadian <vagrant@debian.org> Acked-by: Marek Vasut <marex@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2016-03-17dm: sandbox: Drop the pre-DM host implementationSimon Glass1-90/+0
Driver model is used for host device block devices now, so we don't need the old code. Remove it. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Stephen Warren <swarren@nvidia.com>
2016-03-14dm: sandbox: Add driver-model block-device support for sandboxSimon Glass1-1/+117
Update the host driver to support driver model for block devices. A future commit will remove the old code, but for now it is useful to be able to use it both with and without CONFIG_BLK. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Stephen Warren <swarren@nvidia.com>
2016-03-14dm: sandbox: Prepare block driver for driver-model conversionSimon Glass1-16/+14
Make a few minor changes to make it easier to add driver-model support. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Stephen Warren <swarren@nvidia.com>
2016-03-14dm: blk: Add a block-device uclassSimon Glass3-0/+188
Add a uclass for block devices. These provide block-oriented data access, supporting reading, writing and erasing of whole blocks. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Stephen Warren <swarren@nvidia.com>
2016-03-14dm: block: Rename device number member dev to devnumSimon Glass2-4/+4
This is a device number, and we want to use 'dev' to mean a driver model device. Rename the member. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Stephen Warren <swarren@nvidia.com>