blob: 140a2952c32556fb8e80062940b47c0ae24adf51 [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
11DECLARE_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 Roesecb410332016-05-25 08:13:45 +020022#ifdef CONFIG_ARMADA_8K
23/* CP110 has different AHCI port addresses */
24void __iomem *ahci_port_base(void __iomem *base, u32 port)
25{
26 return base + 0x10000 + (port * 0x10000);
27}
28#endif
29
Stefan Roese05b17652016-05-17 15:00:30 +020030static 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
38 ahci_init(dev_get_addr_ptr(dev));
39
40 return 0;
41}
42
43static const struct udevice_id mvebu_ahci_ids[] = {
44 { .compatible = "marvell,armada-3700-ahci" },
Stefan Roesecb410332016-05-25 08:13:45 +020045 { .compatible = "marvell,armada-8k-ahci" },
Stefan Roese05b17652016-05-17 15:00:30 +020046 { }
47};
48
49U_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};