aboutsummaryrefslogtreecommitdiff
path: root/drivers/block
AgeCommit message (Collapse)AuthorFilesLines
2024-05-20Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"WIP/20May2024-nextTom Rini11-11/+0
As part of bringing the master branch back in to next, we need to allow for all of these changes to exist here. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-19Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""Tom Rini11-0/+11
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-07block: Remove <common.h> and add needed includesTom Rini11-11/+0
Remove <common.h> from this driver directory and when needed add missing include files directly. Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-02-06blk: host_dev: Fix error code in host_sb_attach_file()WIP/2024-02-06-assorted-fixesDan Carpenter1-0/+1
This error path should return -EINVAL instead of success. Fixes: e261fbf34785 ("blk: host_dev: Sanity check on the size of host backing file") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
2023-11-18blk: blkmap: add ramdisk creation utility functionMasahisa Kojima3-16/+55
User needs to call several functions to create the ramdisk with blkmap. This adds the utility function to create blkmap device and mount the ramdisk. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-11-16blk: Drop reference to DM_SPLSimon Glass1-1/+1
The intent here is to only allow SPL_LEGACY_BLK if !SPL_DM - i.e. that when driver model is enabled in SPL, legacy block cannot be used. However this combination is used by about 240 boards, so we cannot disallow it, at least not yet. So just drop the condition. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-11-07block: rkmtd: select CONFIG_RANDOM_UUID explicitlyAKASHI Takahiro1-0/+1
This option is necessary to compile any way. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2023-10-24rockchip: block: blk-uclass: add bounce buffer flag to blk_descJohan Jonker1-2/+2
Currently bounce buffer support is enabled for all block devices when available. Add a flag to blk_desc to enable only on demand. Signed-off-by: Johan Jonker <jbx6244@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2023-10-24rockchip: block: add rkmtd class and driversJohan Jonker3-0/+1161
Add rkmtd class and drivers to create a virtual block device to transfer Rockchip boot block data to and from NAND with block orientated tools like "ums" and "rockusb". Signed-off-by: Johan Jonker <jbx6244@gmail.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2023-10-24rockchip: dm: prepare rkmtd UCLASSJohan Jonker1-0/+1
Prepare a rkmtd UCLASS in use for writing Rockchip boot blocks in combination with existing userspace tools and rockusb command. Signed-off-by: Johan Jonker <jbx6244@gmail.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-10dm: blk: Drop blk_{read,write}_devnum()Bin Meng1-29/+0
blk_{read,write}_devnum() are no longer used by anywhere in the source tree. Drop them. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-10dm: blk: Rename get_desc() and make it externally visibleBin Meng1-18/+8
get_desc() can be useful outside blk-uclass.c. Let's change it to an API and make it externally visible. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-10blk: blkmap: Support mapping to device of any block sizeBin Meng1-5/+5
At present if a device to map has a block size other than 512, the blkmap map process just fails. There is no reason why we can't just use the block size of the mapped device. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-10blk: blkmap: Make bind/unbind routines staticBin Meng1-2/+2
These 2 are only used in drivers/block/blkmap.c. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-10blk: host_dev: Sanity check on the size of host backing fileBin Meng1-0/+5
Since we are emulating a block device, its size should be multiple of the configured block size. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-10blk: host_dev: Make host_sb_detach_file() and host_sb_ops staticBin Meng1-2/+2
They are only used in drivers/block/host_dev.c. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-10blk: sandbox: Support binding a device with a given logical block sizeBin Meng1-3/+12
Allow optionally set the logical block size of the host device to bind in the "host bind" command. If not given, defaults to 512. Signed-off-by: Bin Meng <bmeng@tinylab.org>
2023-10-10blk: Use a macro for the typical block sizeBin Meng2-2/+2
Avoid using the magic number 512 directly. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-09-14blkcache: Remove unused NEEDS_MANUAL_RELOC code bitsMarek Vasut1-16/+0
The last user of the NEEDS_MANUAL_RELOC has been removed in commit 26af162ac8f8 ("arch: m68k: Implement relocation") Remove now unused NEEDS_MANUAL_RELOC code. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2023-08-22blk: Add bounce buffer support to read/write operationsMarek Vasut1-2/+60
Some devices have limited DMA capabilities and require that the buffers passed to them fit specific properties. Add new optional callback which can be used at driver level to indicate whether a buffer alignment is suitable for the device DMA or not, and trigger use of generic bounce buffer implementation to help use of unsuitable buffers at the expense of performance degradation. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2023-08-22disk: Make blk_get_ops() internal to blk uclassMarek Vasut1-0/+2
Move the macro into blk-uclass.c , since it is only used there. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-08-22disk: Move part_create_block_devices() to blk uclassMarek Vasut1-0/+48
Move part_create_block_devices() to blk uclass and unexpose the function. This can now be internal to the block uclass. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2023-08-21Merge tag 'v2023.10-rc3' into nextTom Rini1-2/+2
Prepare v2023.10-rc3 Signed-off-by: Tom Rini <trini@konsulko.com>
2023-08-09bootstd: Correct creating of bootdev siblingSimon Glass1-2/+2
Use the correct function here, since there may be multiple IDE devices available. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-08-09Kconfigs: Correct default of "0" on hex type entriesTom Rini1-1/+1
It is not a parse error to have a default value of "0" for a "hex" type entry, instead of "0x0". However, "0" and "0x0" are not treated the same even by the tools themselves. Correct this by changing the default value from "0" to "0x0" for all hex type questions that had the incorrect default. Fix one instance (in two configs) of a default of "0" being used on a hex question to be "0x0". Remove the cases where a defconfig had set a value of "0x0" to be used as the default had been "0". Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-06-19spl: blk: Support loading images from fsMayuresh Chitale1-0/+7
Add a generic API to support loading of SPL payload from any supported filesystem on a given partition of a block device. Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
2023-04-28sandbox: fix return type of os_filesize()Heinrich Schuchardt1-1/+2
Given a file ../img of size 4294967296 with GPT partition table and partitions: => host bind 0 ../img => part list host 0 Disk host-0.blk not ready The cause is os_filesize() returning int. File sizes must use off_t. Correct all uses of os_filesize() too. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-27drivers/mtd/nvmxip: introduce NVM XIP block storage emulationAbdellatif El Khlifi1-0/+1
add block storage emulation for NVM XIP flash devices Some paltforms such as Corstone-1000 need to see NVM XIP raw flash as a block storage device with read only capability. Here NVM flash devices are devices with addressable memory (e.g: QSPI NOR flash). The implementation is generic and can be used by different platforms. Two drivers are provided as follows. nvmxip-blk : a generic block driver allowing to read from the XIP flash nvmxip Uclass driver : When a device is described in the DT and associated with UCLASS_NVMXIP, the Uclass creates a block device and binds it with the nvmxip-blk. Platforms can use multiple NVM XIP devices at the same time by defining a DT node for each one of them. Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
2023-04-27ide: Make use of U-Boot typesWIP/2023-04-27-IDE-code-cleanupsSimon Glass1-42/+37
Use standard U-Boot types in the file to make the code less verbose. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-27ide: Simplify expressions and hex valuesSimon Glass1-59/+56
The code has quite a few unnecessary brackets and comparisons to zero, etc. Fix these up as well as some upper-case hex values and use of 0x in printf() strings. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-27ide: Convert to use log_debug()Simon Glass1-40/+40
Avoid the use of the function name in a few of the debug() calls, since this causes a checkpatch warning. Convert all other calls too. Use lower-case hex consistently. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-27ide: Tidy up ide_reset()Simon Glass1-11/+10
Avoid using #ifdef and use a single function declaration, so it is easier to read. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-27ide: Correct LBA settingSimon Glass1-7/+2
Fix a longstanding bug where the LBA is calculated as the size of the media instead of the number of blocks. This was perhaps not noticed earlier since it prints the correct value first, before setting the wrong value. Drop the unnecessary blksz variable while we are here. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: 68e6f221ed0 ("block: ide: Fix block read/write with driver model")
2023-04-27ide: Use a single local blk_desc for ide_ident()Simon Glass1-12/+12
We only use one member of the ide_dev_desc[] array at a time and it does not stick around outside ide_probe(). Use a single element instead. Copy over the missing members of blk_desc at the same, since this was missing from the previous code. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: 68e6f221ed0 ("block: ide: Fix block read/write with driver model")
2023-04-27ide: Move all blk_desc init into ide_ident()Simon Glass1-8/+4
Rather than having the caller fill some of this in, do it all in the ide_ident() function, since it knows all the values. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-27ide: Make ide_ident() return an error codeSimon Glass1-48/+53
Update ide_ident() to indicate whether it finds a device or not. Use that to decide whether to create a block device for it, rather than looking DEV_TYPE_UNKNOWN. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-27ide: Use desc consistently for struct blk_descSimon Glass1-54/+47
Most of the code uses 'desc' as the variable name for a blk descriptor. Change ide to do the same. Tidy up some extra brackets and types while we are here. Leave the code in ide_probe() alone since it is about to be refactored. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-27ide: Combine the two loops in ide_probe()Simon Glass1-6/+6
The two loops in this function operate on the same ide_dev_desc[] array. Combine them to reduce duplication. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-27ide: Move ide_init() entirely within ide_probe()Simon Glass1-46/+38
Now that ide_probe() is the only caller of ide_init(), move all the code into the probe function, so it is easier to refactor it. Move ide_dev_desc[] into ide_probe() to, since it is the only user. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-27ide: Move setting of vendor strings into ide_probe()Simon Glass1-24/+18
The current implementation adds this information in the block device's probe() function, which is called in the blk_probe_or_unbind() in ide_probe(). It is simpler to do this in ide_probe() itself, since the effect is the same. This helps to consolidate use of ide_dev_desc[] which we would like to remove. Use strlcpy() to keep checkpatch happy. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-27ide: Make ide_bus_ok a local variableSimon Glass1-9/+3
This is only used in one place now, so make it a local variable. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-27ide: Move bus init into a functionSimon Glass1-39/+48
Move this code into a separate function which returns whether the bus was found, or not. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-27ide: Avoid preprocessor for CONFIG_LBA48Simon Glass1-37/+20
Use IS_ENABLED() instead for all conditions. Add the 'lba48' flag into struct blk_desc always, since it uses very little space. Use a bool so the meaning is clearer. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-04-27ide: Avoid preprocessor for CONFIG_ATAPISimon Glass1-10/+3
Use IS_ENABLED() instead for all conditions. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-27ide: Simplify success conditionSimon Glass1-19/+17
Change the if() to remove extra brackets and check for the positive case first, i.e. when a device is found. Exit the loop in that case, with the retry logic in the 'else' part. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-27ide: Refactor confusing loop codeSimon Glass1-28/+15
This code is hard to follow as it uses #ifdef in a strange way. Adjust it to avoid the preprocessor. Drop the special return for the non-ATAPI case since we can rely on tries becoming 0 and exiting the loop. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-27ide: Change the retries variableSimon Glass1-5/+5
Use a 'tries' variable which starts at the number of tries we want to do, rather than a 'retries' one that stops at either 1 or 2. This will make it easier to refactor the code to avoid the horrible #ifdefs Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-27ide: Make function staticSimon Glass1-12/+11
Only one function is called from outside this file. Make all the others static. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-27ide: Correct use of ATAPISimon Glass1-3/+17
The use of atapi_read() was incorrect dropped. Fix this so that it will be used when needed. Use a udevice for the first argument of atapi_read() so it is consistent with ide_read(). This requires much of the ATAPI code to be brought out from behind the existing #ifdef. It will still be removed by the compiler if it is not needed. Add an atapi flag to struct blk_desc so the information can be retained. Fixes: 145df842b44 ("dm: ide: Add support for driver-model block devices") Fixes: d0075059e4d ("ide: Drop non-DM code for BLK") Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-27ide: Create a prototype for ide_set_reset()Simon Glass1-2/+0
This is used by a board so should be in the header file. Add it. Signed-off-by: Simon Glass <sjg@chromium.org>