summaryrefslogtreecommitdiffstats
path: root/drivers/ata
Commit message (Collapse)AuthorAgeFilesLines
* block: record block device typeAhmad Fatoum2024-03-052-0/+2
| | | | | | | | | | Software running under EFI can query the type of a block device. For barebox to be able to report this, start assigning types to all block devices it can create. No functional change yet. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240304190038.3486881-24-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/state'Sascha Hauer2023-06-221-5/+0
|\
| * block: parse partition table on block device registrationAhmad Fatoum2023-06-121-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Every instance of block device registration is followed by an attempt to parse the partition table. Thus move partition table parsing into blockdevice_register. We do away with the warning print as it's superfluous: parse_partition_table doesn't return an error if partition table is missing and all other errors already result in an error message. Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230607120714.3083182-13-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ata: ide-sff: fix warnings when compiling as 64-bitAhmad Fatoum2023-06-131-4/+4
| | | | | | | | | | | | | | | | | | | | | | Driver is applicable to both IDEs with I/O port and MMIO control. This is differentiated by ide->io.mmio. Compiler can't follow that and criticizes casting pointers to 32-bit integers on 64-bit architectures. Adjust the casts to silence this false positive. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230612130239.1087599-6-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | treewide: add MODULE_DEVICE_TABLE markersAhmad Fatoum2023-06-135-0/+5
|/ | | | | | | | | | | | | | | | Syncing device trees with Linux upstream can lead to breakage, when the device trees are switched to newer bindings, which are not yet supported in barebox. To make it easier to spot such issues, we want to start applying some heuristics to flag possibly problematic DT changes. One step towards being able to do that is to know what nodes barebox actually consumes. Most of the nodes have a compatible entry, which is matched by an array of of_device_id, so let's have MODULE_DEVICE_TABLE point at it for future extraction. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230612125908.1087340-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX: Move mach header files to include/mach/imxSascha Hauer2023-03-061-2/+2
| | | | | | | | | | | Currently arch specific headers can be included with #include <mach/xxx.h>. With upcoming multi-arch support this is no longer possible as there won't be a single mach anymore. Move all i.MX specific header files to include/mach/imx/ to prepare for multi-arch support. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct driver_d to driverSascha Hauer2023-01-105-5/+5
| | | | | | | | | | | The '_d' suffix was originally meant to distinguish barebox struct names from Linux struct names. struct driver doesn't exist in Linux, so we can rename it and remove the meaningless suffix. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-4-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct device_d to deviceSascha Hauer2023-01-107-13/+13
| | | | | | | | | | | | | The '_d' suffix was originally introduced in case we want to import Linux struct device as a separate struct into barebox. Over time it became clear that this won't happen, instead barebox struct device_d is basically the same as Linux struct device. Rename the struct name accordingly to make porting Linux code easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename device_d::device_node to device_d::of_nodeSascha Hauer2023-01-102-2/+2
| | | | | | | | | | | | | | | | | | | | Linux struct device has the member of_node for the device_node pointer. Rename this in barebox accordingly to minimize the necessary changes when porting Linux code. This was done with the semantic patch: @@ struct device_d E; @@ - E.device_node + E.of_node @@ struct device_d *E; @@ - E->device_node + E->of_node Plus some manual adjustments. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ata: ahci: Fix format stringAlexander Shiyan2022-06-101-5/+5
| | | | | | | | | | drivers/ata/ahci.c: In function 'ahci_print_info': drivers/ata/ahci.c:517:9: warning: too many arguments for format [-Wformat-extra-args] Fixes: b5da6970bf23 ("ata: ahci: add missing capability in ahci_print_info()") Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com> Link: https://lore.barebox.org/20220610054051.4911-3-eagle.alexander923@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2022-05-191-10/+13
|\
| * ata: disk_ata_drive: clean up code in ata_dump_id()Denis Orlov2022-04-291-10/+13
| | | | | | | | | | | | | | | | Add missing macros and fix misspellings. Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20220426123434.18865-1-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ata: ahci: use correct macro when calculating offsets in dma memoryDenis Orlov2022-05-111-4/+4
| | | | | | | | | | | | | | | | | | | | The macro that indicates the size of a single element in the command list was incorrectly used instead of the macro that stands for the size of the whole list. Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20220505144440.29188-1-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ata: ahci: allocate memory in one call in ahci_init_port()Denis Orlov2022-05-051-26/+14
| | | | | | | | | | | | | | | | | | | | | | Memory allocated with dma_alloc_coherent() is aligned by page size. Calling it multiple times leads to unnecessary fragmentation and overhead considering that we are actually able to allocate all the memory that we need at once by issuing only one call. Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20220504092553.27961-16-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ata: ahci: register only implemented portsDenis Orlov2022-05-051-3/+12
| | | | | | | | | | | | | | | | | | The value from the "ports implemented" register should be kept in mind when registering ports or detecting devices on them. Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20220504092553.27961-15-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ata: ahci: remove redundant cast in ahci_io()Denis Orlov2022-05-051-1/+1
| | | | | | | | | | | | Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20220504092553.27961-14-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ata: ahci: add missing capability in ahci_print_info()Denis Orlov2022-05-051-0/+1
| | | | | | | | | | | | Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20220504092553.27961-13-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ata: ahci: make rx_fis field in ahci_port of type void*Denis Orlov2022-05-052-4/+3
| | | | | | | | | | | | | | | | It is supposed to represent a pointer so make it actually be one. Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20220504092553.27961-12-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ata: ahci: use 64-bit addressing if availableDenis Orlov2022-05-051-6/+13
| | | | | | | | | | | | Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20220504092553.27961-11-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ata: ahci: map buffers properlyDenis Orlov2022-05-051-19/+18
| | | | | | | | | | | | | | | | | | | | Using dma_sync_single_for_*() does not make sense in there - we are given a cpu side address of a buffer and need to actually map it for the device. Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20220504092553.27961-10-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ata: ahci: use named constants for capabilities bitsDenis Orlov2022-05-052-29/+52
| | | | | | | | | | | | Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20220504092553.27961-9-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ata: ahci: properly fill scatter/gather tableDenis Orlov2022-05-051-0/+1
| | | | | | | | | | | | | | | | | | We are supposed to populate a table, but instead we were just overwriting the same entry over and over in a loop. Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20220504092553.27961-8-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ata: ahci: correct named constants values and namesDenis Orlov2022-05-052-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This gives more clear names to some of the macros that designate the sizes of various memory structures and fixes a mistake in one of them. The command table item was regarded as taking 32 bytes in size while it is actually supposed to only take 16 bytes according to the spec. This also changes a somewhat misleading comment that calls the command list a command table. There is a cmt_tbl field that actually holds a pointer to a different structure that is called a command table in the specification, so it seems better to more clearly disambiguate them. Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20220504092553.27961-7-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ata: ahci: adjust debug messages in ahci_init_port()Denis Orlov2022-05-051-2/+4
| | | | | | | | | | | | | | | | | | | | The output was a bit misleading, not displaying physical addresses while for some reason using "dma" to specify a variable in one case. Make it print both types of addresses. Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20220504092553.27961-6-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ata: ahci: do not ignore dma handlesDenis Orlov2022-05-052-9/+15
| | | | | | | | | | | | | | | | | | They represent addresses from the device side and should be used instead of cpu side ones when populating device registers than hold addresses. Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20220504092553.27961-5-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ata: ahci: simplify fis structure creationDenis Orlov2022-05-051-14/+9
| | | | | | | | | | | | Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20220504092553.27961-4-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ata: ahci: fix missing whitespace in ahci_add_host()Denis Orlov2022-05-051-1/+1
| | | | | | | | | | | | Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20220504092553.27961-3-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ata: ahci: replace magic numbers with named constantsDenis Orlov2022-05-052-10/+23
| | | | | | | | | | | | Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20220504092553.27961-2-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ata: ahci: use abstract read/write functions uniformlyDenis Orlov2022-05-051-11/+7
|/ | | | | | | | | | Currently those are used in some routines side by side with underlying functions with no apparent reason for it. Make their usage uniform, this cleans up code a bit and allows to remove unneeded variables. Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20220504092553.27961-1-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ata: ide-sff: fix integer overflow in ata_wait_busy()Denis Orlov2022-04-011-1/+1
| | | | | | Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20220329073218.10656-1-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ata: sata_mv: try probing multiple timesSteffen Trumtrar2022-01-201-0/+30
| | | | | | | | | In case of an un-recoverable probe error, try the whole sequence again, starting with the hard-reset of the core. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Link: https://lore.barebox.org/20220118140453.1860909-7-s.trumtrar@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ata: sata_mv: issue hard-reset on probeSteffen Trumtrar2022-01-201-0/+2
| | | | | | | | | | When strobing the EATARST signal, the core will generate a hard-reset instead of a soft-reset. Use this to have the core and ATA drive in a better defined state. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Link: https://lore.barebox.org/20220118140453.1860909-6-s.trumtrar@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ata: sata_mv: enable Generation 2 speed supportSteffen Trumtrar2022-01-201-0/+10
| | | | | | | | The ARMADA-XP core supports the Gen2 speed. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Link: https://lore.barebox.org/20220118140453.1860909-5-s.trumtrar@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ata: sata_mv: handle the phy errataSteffen Trumtrar2022-01-201-0/+36
| | | | | | | | Copied from Linux v5.15 Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Link: https://lore.barebox.org/20220118140453.1860909-4-s.trumtrar@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ata: sata_mv: clear SERROR and en/disable EDMASteffen Trumtrar2022-01-201-0/+19
| | | | | | | | | | SControl registers shouldn't be accessed when EDMA is enabled. Also clear SError before any accesses. This register will show if anything went wrong with the phy accesses. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Link: https://lore.barebox.org/20220118140453.1860909-3-s.trumtrar@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ata: sata_mv: cleanup alignmentSteffen Trumtrar2022-01-201-6/+6
| | | | | | | | Clean up the alignment of the defines. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Link: https://lore.barebox.org/20220118140453.1860909-2-s.trumtrar@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: migrate "GPL-2.0" license identifiers to SPDX 2.0Roland Hieber2021-11-225-5/+5
| | | | | | | | | | "GPL-2.0-only" was introduced in SPDX 2.0, and the old identifier "GPL-2.0" is now considered deprecated; see <https://spdx.org/licenses>. Fixes: 28f4a6a4df76f0f1581d (2021-10-30, "drivers: add missing SPDX-License-Identifier") Signed-off-by: Roland Hieber <rhi@pengutronix.de> Link: https://lore.barebox.org/20211117113851.2022669-2-rhi@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: add missing SPDX-License-IdentifierAhmad Fatoum2021-11-0110-60/+11
| | | | | | | | | | | | | | | | | | | | This adds the suitable SPDX-License-Identifier to all files in drivers/ that previously lacked one. To aid manual inspection, following heuristics can be used: * No changes outside of comments/whitespace: git show -U0 HEAD | rg -v '^(@@|diff|index)|[-+]([-+]|//|#|[\s/]\*)' * -or-later come in pairs: git show --inter-hunk-context=19 HEAD | \ perl -0777 -F'/^@/gm' -ne 'for (@F) { @m = /later/g; print if @m & 1 }' Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211030175632.2276077-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* x86: drop legacy (PC BIOS) boot in favor of EFIAhmad Fatoum2021-03-253-312/+0
| | | | | | | | | | | | | The 16-bit port has experienced bitrot and failed to compile with more recent linkers for at least a year. Fixing the linker error is insufficient to restore a barebox that can boot to shell. This continued breakage likely means that there are no users interested in updating. As new x86 projects should be using MACH_EFI_GENERIC anyway, retire support for 16-bit legacy boot (MACH_X86_GENERIC). Acked-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/virtio'Sascha Hauer2021-02-221-0/+2
|\
| * block: add VirtIO block device driverAhmad Fatoum2021-02-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this driver enabled, -device virtio-blk-device can now be passed to Qemu for barebox to detect a VirtIO block device mapping a host file or block device. If barebox is passed as argument to the Qemu -kernel option, no device tree changes are necessary. Example: $ qemu-system-arm -m 256M -M virt -nographic \ -kernel build/images/barebox-dt-2nd.img \ -device virtio-rng-device \ -drive if=none,file=/tmp/first.hdimg,format=raw,id=hd0 \ -device virtio-blk-device,drive=hd0 \ -drive if=none,file=/tmp/second.hdimg,format=raw,id=hd1 \ -device virtio-blk-device,drive=hd1 Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | block: use 64-bit types for sector offset and count on all platformsAhmad Fatoum2021-02-184-25/+25
|/ | | | | | | | | | | barebox' use of int for the sector offset puts an upper bound of 1TB on the size of supported block devices, which is already exceeded by common place USB mass storage. Increasing the sizes involved to 64 bit like Linux does won't magically add missing driver support, but it gives us at least a fighting chance. Do so. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: remove references to CREDITSUwe Kleine-König2020-04-272-6/+0
| | | | | | | | The CREDITS file was removed from barebox in 2015 by commit 6570288f2d97 ("Remove the CREDITS file"). Remove references to it from several files. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ahci: Do not zero out DMA coherent memoryAndrey Smirnov2019-05-281-4/+0
| | | | | | | | Memory returned by dma_alloc_coherent() should already be zeroed out, so there's no need to do this explicitly. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ata: ahci: Do not include <scsi.h>Andrey Smirnov2019-03-111-1/+0
| | | | | | | No symbols found in <scsi.h> are used in this file. Drop it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: Introduce dev_set_name()Andrey Smirnov2018-10-181-2/+2
| | | | | | | | Introduce dev_set_name() in order to hide implementation details of setting device's name so it'd be easier to change it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ata: ide-sff: add LBA48 supportAntony Pavlov2017-03-302-11/+46
| | | | | | | See http://wiki.osdev.org/ATA_PIO_Mode#48_bit_PIO for details. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ATA: mvebu: select DISK_ATALucas Stach2017-03-221-0/+1
| | | | | | | The already selected DISK_IDE_SFF depends on it. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ata: new driver to support the internal sata controller on Armada-XPUwe Kleine-König2017-03-023-0/+132
| | | | | Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ata: ide-sff: don't call free for ide_port in error pathUwe Kleine-König2017-01-181-5/+4
| | | | | | | | | The ide_port is provided by the caller so it's not in the responsibility of this function to free this memory in case of error. Actually all callers do the free themselves, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>