Stefan Roese | 05b1765 | 2016-05-17 15:00:30 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 Stefan Roese <sr@denx.de> |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <ahci.h> |
| 9 | #include <dm.h> |
| 10 | |
| 11 | DECLARE_GLOBAL_DATA_PTR; |
| 12 | |
| 13 | /* |
| 14 | * Dummy implementation that can be overwritten by a board |
| 15 | * specific function |
| 16 | */ |
| 17 | __weak int board_ahci_enable(void) |
| 18 | { |
| 19 | return 0; |
| 20 | } |
| 21 | |
Stefan Roese | cb41033 | 2016-05-25 08:13:45 +0200 | [diff] [blame] | 22 | #ifdef CONFIG_ARMADA_8K |
| 23 | /* CP110 has different AHCI port addresses */ |
| 24 | void __iomem *ahci_port_base(void __iomem *base, u32 port) |
| 25 | { |
| 26 | return base + 0x10000 + (port * 0x10000); |
| 27 | } |
| 28 | #endif |
| 29 | |
Stefan Roese | 05b1765 | 2016-05-17 15:00:30 +0200 | [diff] [blame] | 30 | static int mvebu_ahci_probe(struct udevice *dev) |
| 31 | { |
| 32 | /* |
| 33 | * Board specific SATA / AHCI enable code, e.g. enable the |
| 34 | * AHCI power or deassert reset |
| 35 | */ |
| 36 | board_ahci_enable(); |
| 37 | |
Simon Glass | ba1dea4 | 2017-05-17 17:18:05 -0600 | [diff] [blame] | 38 | ahci_init(devfdt_get_addr_ptr(dev)); |
Stefan Roese | 05b1765 | 2016-05-17 15:00:30 +0200 | [diff] [blame] | 39 | |
| 40 | return 0; |
| 41 | } |
| 42 | |
| 43 | static const struct udevice_id mvebu_ahci_ids[] = { |
| 44 | { .compatible = "marvell,armada-3700-ahci" }, |
Stefan Roese | cb41033 | 2016-05-25 08:13:45 +0200 | [diff] [blame] | 45 | { .compatible = "marvell,armada-8k-ahci" }, |
Stefan Roese | 05b1765 | 2016-05-17 15:00:30 +0200 | [diff] [blame] | 46 | { } |
| 47 | }; |
| 48 | |
| 49 | U_BOOT_DRIVER(ahci_mvebu_drv) = { |
| 50 | .name = "ahci_mvebu", |
| 51 | .id = UCLASS_AHCI, |
| 52 | .of_match = mvebu_ahci_ids, |
| 53 | .probe = mvebu_ahci_probe, |
| 54 | }; |