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> |
| 9 | |
Stefan Roese | 05b1765 | 2016-05-17 15:00:30 +0200 | [diff] [blame] | 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 | |
Stefan Roese | cb41033 | 2016-05-25 08:13:45 +0200 | [diff] [blame] | 19 | #ifdef CONFIG_ARMADA_8K |
| 20 | /* CP110 has different AHCI port addresses */ |
| 21 | void __iomem *ahci_port_base(void __iomem *base, u32 port) |
| 22 | { |
| 23 | return base + 0x10000 + (port * 0x10000); |
| 24 | } |
| 25 | #endif |
| 26 | |
Stefan Roese | 05b1765 | 2016-05-17 15:00:30 +0200 | [diff] [blame] | 27 | static int mvebu_ahci_probe(struct udevice *dev) |
| 28 | { |
| 29 | /* |
| 30 | * Board specific SATA / AHCI enable code, e.g. enable the |
| 31 | * AHCI power or deassert reset |
| 32 | */ |
| 33 | board_ahci_enable(); |
| 34 | |
Simon Glass | ba1dea4 | 2017-05-17 17:18:05 -0600 | [diff] [blame] | 35 | ahci_init(devfdt_get_addr_ptr(dev)); |
Stefan Roese | 05b1765 | 2016-05-17 15:00:30 +0200 | [diff] [blame] | 36 | |
| 37 | return 0; |
| 38 | } |
| 39 | |
| 40 | static const struct udevice_id mvebu_ahci_ids[] = { |
| 41 | { .compatible = "marvell,armada-3700-ahci" }, |
Stefan Roese | cb41033 | 2016-05-25 08:13:45 +0200 | [diff] [blame] | 42 | { .compatible = "marvell,armada-8k-ahci" }, |
Stefan Roese | 05b1765 | 2016-05-17 15:00:30 +0200 | [diff] [blame] | 43 | { } |
| 44 | }; |
| 45 | |
| 46 | U_BOOT_DRIVER(ahci_mvebu_drv) = { |
| 47 | .name = "ahci_mvebu", |
| 48 | .id = UCLASS_AHCI, |
| 49 | .of_match = mvebu_ahci_ids, |
| 50 | .probe = mvebu_ahci_probe, |
| 51 | }; |