summaryrefslogtreecommitdiff
path: root/drivers/block/ide.c
AgeCommit message (Collapse)Author
2024-07-22drivers: block: Remove duplicate newlinesMarek Vasut
Drop all duplicate newlines. No functional change. Signed-off-by: Marek Vasut <[email protected]>
2024-05-20Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"Tom Rini
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 <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2024-05-19Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""Tom Rini
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 <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2024-05-07block: Remove <common.h> and add needed includesTom Rini
Remove <common.h> from this driver directory and when needed add missing include files directly. Reviewed-by: Mattijs Korpershoek <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2023-08-09bootstd: Correct creating of bootdev siblingSimon Glass
Use the correct function here, since there may be multiple IDE devices available. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Bin Meng <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]>
2023-04-27ide: Make use of U-Boot typesSimon Glass
Use standard U-Boot types in the file to make the code less verbose. Signed-off-by: Simon Glass <[email protected]>
2023-04-27ide: Simplify expressions and hex valuesSimon Glass
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 <[email protected]>
2023-04-27ide: Convert to use log_debug()Simon Glass
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 <[email protected]>
2023-04-27ide: Tidy up ide_reset()Simon Glass
Avoid using #ifdef and use a single function declaration, so it is easier to read. Signed-off-by: Simon Glass <[email protected]>
2023-04-27ide: Correct LBA settingSimon Glass
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 <[email protected]> Fixes: 68e6f221ed0 ("block: ide: Fix block read/write with driver model")
2023-04-27ide: Use a single local blk_desc for ide_ident()Simon Glass
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 <[email protected]> Fixes: 68e6f221ed0 ("block: ide: Fix block read/write with driver model")
2023-04-27ide: Move all blk_desc init into ide_ident()Simon Glass
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 <[email protected]>
2023-04-27ide: Make ide_ident() return an error codeSimon Glass
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 <[email protected]>
2023-04-27ide: Use desc consistently for struct blk_descSimon Glass
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 <[email protected]>
2023-04-27ide: Combine the two loops in ide_probe()Simon Glass
The two loops in this function operate on the same ide_dev_desc[] array. Combine them to reduce duplication. Signed-off-by: Simon Glass <[email protected]>
2023-04-27ide: Move ide_init() entirely within ide_probe()Simon Glass
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 <[email protected]>
2023-04-27ide: Move setting of vendor strings into ide_probe()Simon Glass
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 <[email protected]>
2023-04-27ide: Make ide_bus_ok a local variableSimon Glass
This is only used in one place now, so make it a local variable. Signed-off-by: Simon Glass <[email protected]>
2023-04-27ide: Move bus init into a functionSimon Glass
Move this code into a separate function which returns whether the bus was found, or not. Signed-off-by: Simon Glass <[email protected]>
2023-04-27ide: Avoid preprocessor for CONFIG_LBA48Simon Glass
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 <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]>
2023-04-27ide: Avoid preprocessor for CONFIG_ATAPISimon Glass
Use IS_ENABLED() instead for all conditions. Signed-off-by: Simon Glass <[email protected]>
2023-04-27ide: Simplify success conditionSimon Glass
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 <[email protected]>
2023-04-27ide: Refactor confusing loop codeSimon Glass
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 <[email protected]>
2023-04-27ide: Change the retries variableSimon Glass
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 <[email protected]>
2023-04-27ide: Make function staticSimon Glass
Only one function is called from outside this file. Make all the others static. Signed-off-by: Simon Glass <[email protected]>
2023-04-27ide: Correct use of ATAPISimon Glass
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 <[email protected]> Signed-off-by: Simon Glass <[email protected]>
2023-04-27ide: Create a prototype for ide_set_reset()Simon Glass
This is used by a board so should be in the header file. Add it. Signed-off-by: Simon Glass <[email protected]>
2023-04-27ide: Drop weak functionsSimon Glass
These are not used from outside this file anymore. Make them static and remove them from the header file. Signed-off-by: Simon Glass <[email protected]>
2023-04-27ide: Move a few functions further up the fileSimon Glass
Move these functions so they appear before they are used. Signed-off-by: Simon Glass <[email protected]>
2023-04-27ide: Drop ide_device_present()Simon Glass
This function is not used anymore. Drop it. Signed-off-by: Simon Glass <[email protected]>
2023-04-27ide: Move ide_init() into probingSimon Glass
At present the code does ide_init() as a separate operation, then calls device_probe() to copy over the information. We can call ide_init() from probe just as easily. The only difference is that using 'ide init' twice will do nothing. However it already fails to copy over the new data in that case, so the effect is the same. For now, unbind the block devices and remove the IDE device, which causes the bus to be probed again. Later patches will fix this up fully, so that all blk_desc data is copied across. Since ide_reset() is only called from ide_init(), there is no need to init the ide_dev_desc[] array. This is already done at the end of ide_init() so drop this code. The call to uclass_first_device() is now within the probe() function of the same device, so does nothing. Drop it. Signed-off-by: Simon Glass <[email protected]>
2023-04-27ide: Use mdelay() for long delaysSimon Glass
Rather than using very large numbers with udelay(), use mdelay(), which is easier to follow. Signed-off-by: Simon Glass <[email protected]>
2023-04-27ide: Move ATA_CURR_BASE to C fileSimon Glass
This is not used outside one C file. Move it out of the header to reduce its visbility. Signed-off-by: Simon Glass <[email protected]>
2023-01-23bootstd: Add a new pre-scan priority for bootdevsSimon Glass
We need extensions to be set up before we start trying to boot any of the bootdevs. Add a new priority before all the others for tht sort of thing. Also add a 'none' option, so that the first one is not 0. While we are here, comment enum bootdev_prio_t fully and expand the test for the 'bootdev hunt' command. Signed-off-by: Simon Glass <[email protected]>
2023-01-23bootstd: Add an IDE bootdevSimon Glass
Add a bootdev for IDE so that these devices can be used with standard boot. Signed-off-by: Simon Glass <[email protected]>
2023-01-23ide: Drop non-DM code for BLKSimon Glass
We require CONFIG_BLK to be enabled now, so this code is unused. Drop it. Signed-off-by: Simon Glass <[email protected]>
2022-09-25blk: Rename if_type to uclass_idSimon Glass
Use the word 'uclass' instead of 'if_type' to complete the conversion. Signed-off-by: Simon Glass <[email protected]>
2022-09-18cyclic: Use schedule() instead of WATCHDOG_RESET()Stefan Roese
Globally replace all occurances of WATCHDOG_RESET() with schedule(), which handles the HW_WATCHDOG functionality and the cyclic infrastructure. Signed-off-by: Stefan Roese <[email protected]> Reviewed-by: Simon Glass <[email protected]> Tested-by: Tom Rini <[email protected]> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]
2022-09-16blk: Switch over to using uclass IDsSimon Glass
We currently have an if_type (interface type) and a uclass id. These are closely related and we don't need to have both. Drop the if_type values and use the uclass ones instead. Maintain the existing, subtle, one-way conversion between UCLASS_USB and UCLASS_MASS_STORAGE for now, and add a comment. Signed-off-by: Simon Glass <[email protected]>
2022-09-16ide: Use a flag for an ATAPI deviceSimon Glass
Rather than setting a different interface type, use a flag to indicate that a device is ATAPI. Signed-off-by: Simon Glass <[email protected]>
2022-06-28block: ide: Remove ide_preinit functionTom Rini
The only platform currently that defines an ide_preinit function has an empty one that immediately returns. Remove this hook. Signed-off-by: Tom Rini <[email protected]>
2022-04-09block: ide: call device_probe() after scanningAKASHI Takahiro
Every time an ide bus/port is scanned and a new 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 <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2022-02-09ide: Drop CONFIG_IDE_AHBSimon Glass
This is not used in U-Boot anymore. Drop it. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-12-05ide: Drop ATA_PORT_ADDRSimon Glass
This is not needed anymore. Drop it to simplify the code. Signed-off-by: Simon Glass <[email protected]> Suggested-by: Heinrich Schuchardt <[email protected]>
2021-12-05ide: Drop unused CONFIG optionsSimon Glass
CONFIG_SYS_ATA_PORT_ADDR is not used in the code anymore. Drop it and use ATA_PORT_ADDR() locally instead. Drop CONFIG_IDE_RESET_ROUTINE and CONFIG_IDE_SWAP_IO which are also unused. Signed-off-by: Simon Glass <[email protected]>
2021-07-06dm: define LOG_CATEGORY for all uclassPatrick Delaunay
Define LOG_CATEGORY for all uclass to allow filtering with log command. Signed-off-by: Patrick Delaunay <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2021-04-20Fix IDE commands issued, fix endian issues, fix non MMIOReinoud Zandijk
Fixes IDE issues found on the Malta board under Qemu: 1) DMA implied commands were sent to the controller in stead of the PIO variants. The rest of the code is DMA free and written for PIO operation. 2) direct pointer access was used to read and write the registers instead of the inb/inw/outb/outw functions/macros. Registers don't have to be memory mapped and ATA_CURR_BASE() does not have to return an offset from address zero. 3) Endian isues in ide_ident() and reading/writing data in general. Names were corrupted and sizes misreported. Tested malta_defconfig and maltael_defconfig to work again in Qemu. Signed-off-by: Reinoud Zandijk <[email protected]> Tested-by: Heinrich Schuchardt <[email protected]>
2020-12-13dm: treewide: Rename 'platdata' variables to just 'plat'Simon Glass
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 <[email protected]>
2020-05-18common: Drop linux/delay.h from common headerSimon Glass
Move this uncommon header out of the common header. Signed-off-by: Simon Glass <[email protected]>
2020-05-18common: Drop log.h from common headerSimon Glass
Move this header out of the common header. Signed-off-by: Simon Glass <[email protected]>