]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
f61aefc1 SR |
2 | /* |
3 | * Copyright (C) 2016 Stefan Roese <[email protected]> | |
f61aefc1 SR |
4 | */ |
5 | ||
6 | #include <common.h> | |
7 | #include <ahci.h> | |
8 | #include <dm.h> | |
9 | ||
f61aefc1 SR |
10 | /* |
11 | * Dummy implementation that can be overwritten by a board | |
12 | * specific function | |
13 | */ | |
14 | __weak int board_ahci_enable(void) | |
15 | { | |
16 | return 0; | |
17 | } | |
18 | ||
6ac8538b KM |
19 | static int mvebu_ahci_bind(struct udevice *dev) |
20 | { | |
21 | struct udevice *scsi_dev; | |
22 | int ret; | |
23 | ||
24 | ret = ahci_bind_scsi(dev, &scsi_dev); | |
25 | if (ret) { | |
26 | debug("%s: Failed to bind (err=%d\n)", __func__, ret); | |
27 | return ret; | |
28 | } | |
29 | ||
30 | return 0; | |
31 | } | |
32 | ||
f61aefc1 SR |
33 | static int mvebu_ahci_probe(struct udevice *dev) |
34 | { | |
35 | /* | |
36 | * Board specific SATA / AHCI enable code, e.g. enable the | |
37 | * AHCI power or deassert reset | |
38 | */ | |
39 | board_ahci_enable(); | |
40 | ||
6ac8538b | 41 | ahci_probe_scsi(dev, (ulong)devfdt_get_addr_ptr(dev)); |
f61aefc1 SR |
42 | |
43 | return 0; | |
44 | } | |
45 | ||
46 | static const struct udevice_id mvebu_ahci_ids[] = { | |
5903b919 | 47 | { .compatible = "marvell,armada-380-ahci" }, |
f61aefc1 | 48 | { .compatible = "marvell,armada-3700-ahci" }, |
21b29fc6 | 49 | { .compatible = "marvell,armada-8k-ahci" }, |
f61aefc1 SR |
50 | { } |
51 | }; | |
52 | ||
53 | U_BOOT_DRIVER(ahci_mvebu_drv) = { | |
54 | .name = "ahci_mvebu", | |
55 | .id = UCLASS_AHCI, | |
56 | .of_match = mvebu_ahci_ids, | |
6ac8538b | 57 | .bind = mvebu_ahci_bind, |
f61aefc1 SR |
58 | .probe = mvebu_ahci_probe, |
59 | }; |