summaryrefslogtreecommitdiffstats
path: root/drivers/ata/ahci.c
Commit message (Collapse)AuthorAgeFilesLines
* ata: ahci: fix ahci_link_up() type mismatch for LTOMarek BehĂșn2021-05-241-1/+1
| | | | | | | | | | | | | | | | | When building highbank_defconfig with LTO, the compiler complains about type mismatch of function ahci_link_up(). The third parameter of this function is of type u8 in drivers/ata/ahci.c, but of type int in board/highbank/ahci.c. There is no reason in using u8, and the code using this function actually passes an int variable into the function (so it is implicitly converted to u8). Change the type of this parameter to int in drivers/ata/ahci.c. Signed-off-by: Marek BehĂșn <marek.behun@nic.cz> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* ata: ahci: Fix usage on big-endian platformsStefan Roese2021-04-231-12/+11
| | | | | | | | | | | | | | | This patch adds a few missing virt_to_phys() to use the correct physical address for DMA operations in the common AHCI code. This is done to support the big-endian MIPS Octeon platform. Additionally the code a cleaned up a bit (remove some empty lines) and made a bit better readable. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Aaron Williams <awilliams@marvell.com> Cc: Chandrakala Chavva <cchavva@marvell.com> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
* drivers: ata: ahci: update max id if it is more than available portsSuneel Garapati2021-04-201-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After check for maximum between max id and available ports, also check if available port count is less than max id and update. In the case of the CN8030 OcteonTX SoC max_id needs to be reduced to the number of ports found otherwise the following occurs on a scan: GW6404-B> scsi scan scanning bus for devices... Target spinup took 0 ms. AHCI 0001.0300 32 slots 1 ports 6 Gbps 0x1 impl SATA mode flags: 64bit ncq ilck stag pm led clo only pmp fbss pio slum part ccc apst Device 0: (0:0) Vendor: ATA Prod.: SanDisk SD8SFAT0 Rev: Z233 Type: Hard Disk Capacity: 61057.3 MB = 59.6 GB (125045424 x 512) "Synchronous Abort" handler, esr 0x96000006 elr: 000000000052f824 lr : 000000000052fa10 (reloc) elr: 000000007fee9824 lr : 000000007fee9a10 x0 : 0000000000000001 x1 : 0000000000000001 x2 : 000000007bea3528 x3 : 000000007bea3580 x4 : 0000000000000200 x5 : 0000000000000000 x6 : 0000000000000002 x7 : 000000007bea3540 x8 : 00000000fffffff8 x9 : 0000000000000008 x10: 00000000000186a0 x11: 000000000000000d x12: 0000000000000006 x13: 000000000001869f x14: 0000000000000007 x15: 00000000ffffffff x16: 000000007ff439a5 x17: 000000007ff5730c x18: 000000007bea9de0 x19: 000000007ff7a580 x20: 000000007bec79f8 x21: 0000000000000000 x22: 000000007bea3580 x23: 0000000000000000 x24: 0000000000000000 x25: 000000007bec7a00 x26: 00000000ffffffc0 x27: 000000007bec79d0 x28: 000000007beb51c0 x29: 000000007bea3480 Code: 91246800 940130c2 12800000 1400004f (b9402ae0) Resetting CPU ... Signed-off-by: Suneel Garapati <sgarapati@marvell.com> Reviewed-by: Stefan Roese <sr@denx.de>
* dm: treewide: Rename ..._platdata variables to just ..._platSimon Glass2020-12-131-3/+3
| | | | | | | Try to maintain some consistency between these variables by using _plat as a suffix for them. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: treewide: Rename 'platdata' variables to just 'plat'Simon Glass2020-12-131-3/+3
| | | | | | | | | | 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 <sjg@chromium.org>
* ata: ahci: Add BAR index quirk for Cavium PCI SATA deviceSuneel Garapati2020-08-251-0/+15
| | | | | | | | For SATA controller found on OcteonTX SoC's, use non-standard PCI BAR0 instead of BAR5. Signed-off-by: Suneel Garapati <sgarapati@marvell.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* common: Drop linux/bitops.h from common headerSimon Glass2020-05-181-0/+1
| | | | | | Move this uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
* common: Drop linux/delay.h from common headerSimon Glass2020-05-181-0/+1
| | | | | | Move this uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
* common: Drop log.h from common headerSimon Glass2020-05-181-0/+1
| | | | | | Move this header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
* common: Drop part.h from common headerSimon Glass2020-05-181-0/+1
| | | | | | Move this uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
* common: Move ARM cache operations out of common.hSimon Glass2019-12-021-0/+1
| | | | | | | | | These functions are CPU-related and do not use driver model. Move them to cpu_func.h Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* ata: ahci allow 64-bit DMA for SATARoman Kapl2019-10-311-3/+11
| | | | | | | Allow 64-bit DMA on AHCI. If not supported by the host controller, at least print a message and fail. Signed-off-by: Roman Kapl <rka@sysgo.com>
* ata: ahci: Don't forget to clear upper address regs.Oleksandr Rybalko2019-10-111-4/+7
| | | | | | | | | In 32bits mode upper bits need to be set to 0, otherwise controller will try to DMA into not existing memory and stops with error. Tested-by: Frank Wunderlich <frank-w@public-files.de> Signed-off-by: Frank Wunderlich <frank-w@public-files.de> Signed-off-by: Oleksandr Rybalko <ray@ddteam.net>
* dm: scsi: Scan the actual number of portsPark, Aiden2019-08-261-0/+8
| | | | | | | | | The scsi_scan_dev() is looping over the number of uc_plat->max_id. The number of actual ports a AHCI controller has can be greater than max_id. Update uc_plat->max_id to make SCSI scan all detected ports. Signed-off-by: Aiden Park <aiden.park@intel.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* ata: ahci: drop read-only ahci_ioports membersChristian Gmeiner2019-05-181-12/+0
| | | | | | Also get rid of ahci_setup_port(..). Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
* ata: ahci: fix memory leakChristian Gmeiner2019-05-091-4/+1
| | | | | | | | malloc(..) and memalign(..) are both allocating memory and as a result we leak the memory allocated with malloc(..). Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* ata: ahci: Don't cap AHCI port count under CONFIG_DM_SCSITuomas Tynkkynen2018-09-251-0/+2
| | | | | | | | When using device model this sort of hardcoded limits aren't used or necessary. Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> Reviewed-by: Simon Glass <sjg@chromium.org>
* ata: ahci: Loop over the actual number of ports, not the maximumTuomas Tynkkynen2018-09-251-1/+1
| | | | | | | | | | | | The loop in ahci_start_ports() is looping over the maximum number of SCSI devices in the system, which can be larger than the amount of ports a particular AHCI controller has. The extra looping isn't directly harmful because the link_port_map bitmap won't have the bit set for a nonexistent port, but it is wasteful. Replace the loop limit with the port count of the AHCI controller instead. Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> Reviewed-by: Simon Glass <sjg@chromium.org>
* SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini2018-05-071-2/+1
| | | | | | | | | | | | | | | | | | | | When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
* ata: Fix ahci wordingMichal Simek2017-11-281-2/+2
| | | | | | | s/achi_/ahci_/g Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* dm: ahci: Correct uclass private dataSimon Glass2017-08-011-1/+1
| | | | | | | | | This is expected to be attached to the uclass and the code operates that way, but the uclass has not been updated. Fix it to avoid using memory at address 0. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: 47fc61a (dm: ahci: Drop use of probe_ent)
* ahci: Support non-PCI controllersSimon Glass2017-08-011-9/+17
| | | | | | | | At present the AHCI SCSI driver only supports PCI with driver model. Rename the existing function to indicate this and add support for adding a non-PCI controller . Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: ahci: Avoid scsi_scan_dev() in ahci_probe_scsi()Bin Meng2017-07-281-5/+0
| | | | | | | | | | | | Running 'scsi scan' command causes scsi_scan_dev() to be called, from which device_probe() is called and consequently AHCI driver probe routine will be called as SCSI driver's parent, and finally ahci_probe_scsi() calls scsi_scan_dev() again. Remove the call to scsi_scan_dev() in ahci_probe_scsi(). Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* dm: ahci: Add a driver for SCSI on AHCISimon Glass2017-07-111-0/+57
| | | | | | | | | | | | | Some AHCI drivers use SCSI under the hood. Rather than making the AHCI driver be in the SCSI uclass it makes sense to have the AHCI device create a SCSI device as a child. That way we can handle any AHCI-specific operations rather than trying to pretend tha the device is just SCSI. To handle this we need to provide a way for AHCI drivers to bind a SCSI device as its child, and probe it. Add functions for this. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: scsi: Adjust return value of scsi_exec()Simon Glass2017-07-111-3/+3
| | | | | | | | Change this function to return an error number instead of true/false. This allows us to return a proper error number. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: scsi: Add operations for SCSI devicesSimon Glass2017-07-111-0/+7
| | | | | | | | | | The SCSI uclass currently has no operations. It just uses the global SCSI functions. Fix this by adding operations to the only two drivers that use the uclass, and replacing the global functions with those defined locally in the SCSI code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: ahci: Create a local version of two SCSI functionsSimon Glass2017-07-111-2/+13
| | | | | | | | | | With driver model we need to define implementations of exec() and bus_reset() separately for each SCSI driver. As a first step, create a local version of each function in the AHCI driver and call each from its global version. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: scsi: Add a device pointer to scan_exec(), scsi_bus_reset()Simon Glass2017-07-111-3/+12
| | | | | | | | | | With driver model these functions need a device pointer. Add one even when CONFIG_DM_SCSI is not defined. This avoids having ugly conditional function prototypes, When CONFIG_DM_SCSI is not defined we can just ignore the pointer. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: ahci: Drop use of probe_entSimon Glass2017-07-111-29/+44
| | | | | | | | | | | With driver model we cannot have static data or assume that there is only one device of each time. Adjust the code so that 'probe_ent' is not needed with driver model. Add a new ahci_init_dm() function which can init AHCI for driver model without re-allocating the uclass data. Move over the only existing driver to use this new function. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: ahci: Unwind the confusing init codeSimon Glass2017-07-111-6/+20
| | | | | | | | | | | | | | | | | | | Two AHCI drivers use SCSI with CONFIG_DM_SCSI. The SCSI uclass calls scsi_low_level_init() which is implemented by ahci.c. If CONFIG_SCSI_AHCI_PLAT is defined it does one thing and if it is not it does something else. We don't need to call through scsi_low_level_init() to get the init completed. Instead, adjust the two drivers to call into AHCI directly. Drop the post-probe init in the SCSI uclass. This means that driver model doesn't need to use scsi_low_level_init(). It is a legacy function and driver model should use a driver's probe() method instead. While we are here, add a comment to the top of the file explaining what ahci.c does. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: ahci: Move common code for starting ports into a functionSimon Glass2017-07-111-23/+22
| | | | | | | | This code is duplicated. Create a ahci_start_ports() function to handle this and call it from both places. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: ahci: Refactor to avoid static variablesSimon Glass2017-07-111-68/+76
| | | | | | | | | | With driver model we need each device to have its own state. As a step towards this, restrict use of the global 'probe_ent' to just a few places in the file. This will allow us to add driver-model functions which can pass the correct data around. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: sata: Move ataid into struct ahci_uc_privSimon Glass2017-07-111-23/+27
| | | | | | | | | This array relates to the AHCI controller so should be exist out on its own in the file. Move it into the structure. Adjust functions that need access to this to take the structure as a parameter. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: ahci: Rename struct ahci_probe_entSimon Glass2017-07-111-8/+8
| | | | | | | | | This is not a very useful name since once it is probed it still hangs around. With driver model we will use uclass data for this, so rename the struct. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: scsi: Use the uclass platform dataSimon Glass2017-07-111-1/+1
| | | | | | | | | At present the two driver-model SCSI drivers use device platform data to store information that relates to the uclass. It is better to use uclass platform data in this situation. Update the code to do this. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: scsi: Drop the ccb typedefSimon Glass2017-07-111-6/+6
| | | | | | | | | We should not be using typedefs in U-Boot and 'ccb' is a pretty short name. It is also used with variables. Drop the typedef and use 'struct' instead. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* sata: Move drivers into new drivers/ata directorySimon Glass2017-07-111-0/+1094
At present we have the SATA and PATA drivers mixed up in the drivers/block directory. It is better to split them out into their own place. Use drivers/ata which is what Linux does. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>