blob: 3ae8dae4ddc379bf5e2edcc198dad1d1016a660c [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Stefan Roesef61aefc2016-05-17 15:00:30 +02002/*
3 * Copyright (C) 2016 Stefan Roese <sr@denx.de>
Stefan Roesef61aefc2016-05-17 15:00:30 +02004 */
5
6#include <common.h>
7#include <ahci.h>
8#include <dm.h>
9
Stefan Roesef61aefc2016-05-17 15:00:30 +020010/*
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 Roese21b29fc2016-05-25 08:13:45 +020019#ifdef CONFIG_ARMADA_8K
20/* CP110 has different AHCI port addresses */
21void __iomem *ahci_port_base(void __iomem *base, u32 port)
22{
23 return base + 0x10000 + (port * 0x10000);
24}
25#endif
26
Stefan Roesef61aefc2016-05-17 15:00:30 +020027static 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 Glassa821c4a2017-05-17 17:18:05 -060035 ahci_init(devfdt_get_addr_ptr(dev));
Stefan Roesef61aefc2016-05-17 15:00:30 +020036
37 return 0;
38}
39
40static const struct udevice_id mvebu_ahci_ids[] = {
41 { .compatible = "marvell,armada-3700-ahci" },
Stefan Roese21b29fc2016-05-25 08:13:45 +020042 { .compatible = "marvell,armada-8k-ahci" },
Stefan Roesef61aefc2016-05-17 15:00:30 +020043 { }
44};
45
46U_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};