blob: 526c4a61ef97e0624b3e4e3fa32d81473148f4ac [file] [log] [blame]
Stefan Roese05b17652016-05-17 15:00:30 +02001/*
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
Stefan Roese05b17652016-05-17 15:00:30 +020011/*
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
Stefan Roesecb410332016-05-25 08:13:45 +020020#ifdef CONFIG_ARMADA_8K
21/* CP110 has different AHCI port addresses */
22void __iomem *ahci_port_base(void __iomem *base, u32 port)
23{
24 return base + 0x10000 + (port * 0x10000);
25}
26#endif
27
Stefan Roese05b17652016-05-17 15:00:30 +020028static int mvebu_ahci_probe(struct udevice *dev)
29{
30 /*
31 * Board specific SATA / AHCI enable code, e.g. enable the
32 * AHCI power or deassert reset
33 */
34 board_ahci_enable();
35
Simon Glassba1dea42017-05-17 17:18:05 -060036 ahci_init(devfdt_get_addr_ptr(dev));
Stefan Roese05b17652016-05-17 15:00:30 +020037
38 return 0;
39}
40
41static const struct udevice_id mvebu_ahci_ids[] = {
42 { .compatible = "marvell,armada-3700-ahci" },
Stefan Roesecb410332016-05-25 08:13:45 +020043 { .compatible = "marvell,armada-8k-ahci" },
Stefan Roese05b17652016-05-17 15:00:30 +020044 { }
45};
46
47U_BOOT_DRIVER(ahci_mvebu_drv) = {
48 .name = "ahci_mvebu",
49 .id = UCLASS_AHCI,
50 .of_match = mvebu_ahci_ids,
51 .probe = mvebu_ahci_probe,
52};