blob: 5d8032bd8944957260875a724f9dc06b9cc9a8a1 [file] [log] [blame]
Stefan Roesef61aefc2016-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 Roese21b29fc2016-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 Roesef61aefc2016-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
Simon Glassa821c4a2017-05-17 17:18:05 -060038 ahci_init(devfdt_get_addr_ptr(dev));
Stefan Roesef61aefc2016-05-17 15:00:30 +020039
40 return 0;
41}
42
43static const struct udevice_id mvebu_ahci_ids[] = {
44 { .compatible = "marvell,armada-3700-ahci" },
Stefan Roese21b29fc2016-05-25 08:13:45 +020045 { .compatible = "marvell,armada-8k-ahci" },
Stefan Roesef61aefc2016-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};