blob: 6e3f17ee276d9c19c69c3058205c2a2c20a02a4a [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
Ken Ma6ac85382018-05-25 15:49:26 +080019static int mvebu_ahci_bind(struct udevice *dev)
20{
21 struct udevice *scsi_dev;
22 int ret;
23
24 ret = ahci_bind_scsi(dev, &scsi_dev);
25 if (ret) {
26 debug("%s: Failed to bind (err=%d\n)", __func__, ret);
27 return ret;
28 }
29
30 return 0;
31}
32
Stefan Roesef61aefc2016-05-17 15:00:30 +020033static int mvebu_ahci_probe(struct udevice *dev)
34{
35 /*
36 * Board specific SATA / AHCI enable code, e.g. enable the
37 * AHCI power or deassert reset
38 */
39 board_ahci_enable();
40
Ken Ma6ac85382018-05-25 15:49:26 +080041 ahci_probe_scsi(dev, (ulong)devfdt_get_addr_ptr(dev));
Stefan Roesef61aefc2016-05-17 15:00:30 +020042
43 return 0;
44}
45
46static const struct udevice_id mvebu_ahci_ids[] = {
47 { .compatible = "marvell,armada-3700-ahci" },
Stefan Roese21b29fc2016-05-25 08:13:45 +020048 { .compatible = "marvell,armada-8k-ahci" },
Stefan Roesef61aefc2016-05-17 15:00:30 +020049 { }
50};
51
52U_BOOT_DRIVER(ahci_mvebu_drv) = {
53 .name = "ahci_mvebu",
54 .id = UCLASS_AHCI,
55 .of_match = mvebu_ahci_ids,
Ken Ma6ac85382018-05-25 15:49:26 +080056 .bind = mvebu_ahci_bind,
Stefan Roesef61aefc2016-05-17 15:00:30 +020057 .probe = mvebu_ahci_probe,
58};