Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Stefan Roese | 05b1765 | 2016-05-17 15:00:30 +0200 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2016 Stefan Roese <sr@denx.de> |
Stefan Roese | 05b1765 | 2016-05-17 15:00:30 +0200 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <common.h> |
| 7 | #include <ahci.h> |
| 8 | #include <dm.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 9 | #include <log.h> |
Stefan Roese | 05b1765 | 2016-05-17 15:00:30 +0200 | [diff] [blame] | 10 | |
Stefan Roese | 05b1765 | 2016-05-17 15:00:30 +0200 | [diff] [blame] | 11 | /* |
| 12 | * Dummy implementation that can be overwritten by a board |
| 13 | * specific function |
| 14 | */ |
| 15 | __weak int board_ahci_enable(void) |
| 16 | { |
| 17 | return 0; |
| 18 | } |
| 19 | |
Ken Ma | c3f0ca1 | 2018-05-25 15:49:26 +0800 | [diff] [blame] | 20 | static int mvebu_ahci_bind(struct udevice *dev) |
| 21 | { |
| 22 | struct udevice *scsi_dev; |
| 23 | int ret; |
| 24 | |
| 25 | ret = ahci_bind_scsi(dev, &scsi_dev); |
| 26 | if (ret) { |
| 27 | debug("%s: Failed to bind (err=%d\n)", __func__, ret); |
| 28 | return ret; |
| 29 | } |
| 30 | |
| 31 | return 0; |
| 32 | } |
| 33 | |
Stefan Roese | 05b1765 | 2016-05-17 15:00:30 +0200 | [diff] [blame] | 34 | static int mvebu_ahci_probe(struct udevice *dev) |
| 35 | { |
| 36 | /* |
| 37 | * Board specific SATA / AHCI enable code, e.g. enable the |
| 38 | * AHCI power or deassert reset |
| 39 | */ |
| 40 | board_ahci_enable(); |
| 41 | |
Stefan Roese | c62067b | 2021-04-07 09:12:34 +0200 | [diff] [blame] | 42 | ahci_probe_scsi(dev, (ulong)dev_remap_addr(dev)); |
Stefan Roese | 05b1765 | 2016-05-17 15:00:30 +0200 | [diff] [blame] | 43 | |
| 44 | return 0; |
| 45 | } |
| 46 | |
| 47 | static const struct udevice_id mvebu_ahci_ids[] = { |
Baruch Siach | 74765de | 2019-03-24 13:27:44 +0200 | [diff] [blame] | 48 | { .compatible = "marvell,armada-380-ahci" }, |
Stefan Roese | 05b1765 | 2016-05-17 15:00:30 +0200 | [diff] [blame] | 49 | { .compatible = "marvell,armada-3700-ahci" }, |
Stefan Roese | cb41033 | 2016-05-25 08:13:45 +0200 | [diff] [blame] | 50 | { .compatible = "marvell,armada-8k-ahci" }, |
Stefan Roese | c62067b | 2021-04-07 09:12:34 +0200 | [diff] [blame] | 51 | { .compatible = "cavium,octeon-7130-ahci" }, |
Stefan Roese | 05b1765 | 2016-05-17 15:00:30 +0200 | [diff] [blame] | 52 | { } |
| 53 | }; |
| 54 | |
| 55 | U_BOOT_DRIVER(ahci_mvebu_drv) = { |
| 56 | .name = "ahci_mvebu", |
| 57 | .id = UCLASS_AHCI, |
| 58 | .of_match = mvebu_ahci_ids, |
Ken Ma | c3f0ca1 | 2018-05-25 15:49:26 +0800 | [diff] [blame] | 59 | .bind = mvebu_ahci_bind, |
Stefan Roese | 05b1765 | 2016-05-17 15:00:30 +0200 | [diff] [blame] | 60 | .probe = mvebu_ahci_probe, |
| 61 | }; |