blob: f05150d61ddf4ff5d4c70c53995aeb0caa072cb1 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Stefan Roese05b17652016-05-17 15:00:30 +02002/*
3 * Copyright (C) 2016 Stefan Roese <sr@denx.de>
Stefan Roese05b17652016-05-17 15:00:30 +02004 */
5
6#include <common.h>
7#include <ahci.h>
8#include <dm.h>
Simon Glass0f2af882020-05-10 11:40:05 -06009#include <log.h>
Stefan Roese05b17652016-05-17 15:00:30 +020010
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
Ken Mac3f0ca12018-05-25 15:49:26 +080020static int mvebu_ahci_bind(struct udevice *dev)
21{
22 struct udevice *scsi_dev;
23 int ret;
24
25 ret = ahci_bind_scsi(dev, &scsi_dev);
26 if (ret) {
27 debug("%s: Failed to bind (err=%d\n)", __func__, ret);
28 return ret;
29 }
30
31 return 0;
32}
33
Stefan Roese05b17652016-05-17 15:00:30 +020034static int mvebu_ahci_probe(struct udevice *dev)
35{
36 /*
37 * Board specific SATA / AHCI enable code, e.g. enable the
38 * AHCI power or deassert reset
39 */
40 board_ahci_enable();
41
Stefan Roesec62067b2021-04-07 09:12:34 +020042 ahci_probe_scsi(dev, (ulong)dev_remap_addr(dev));
Stefan Roese05b17652016-05-17 15:00:30 +020043
44 return 0;
45}
46
47static const struct udevice_id mvebu_ahci_ids[] = {
Baruch Siach74765de2019-03-24 13:27:44 +020048 { .compatible = "marvell,armada-380-ahci" },
Stefan Roese05b17652016-05-17 15:00:30 +020049 { .compatible = "marvell,armada-3700-ahci" },
Stefan Roesecb410332016-05-25 08:13:45 +020050 { .compatible = "marvell,armada-8k-ahci" },
Stefan Roesec62067b2021-04-07 09:12:34 +020051 { .compatible = "cavium,octeon-7130-ahci" },
Stefan Roese05b17652016-05-17 15:00:30 +020052 { }
53};
54
55U_BOOT_DRIVER(ahci_mvebu_drv) = {
56 .name = "ahci_mvebu",
57 .id = UCLASS_AHCI,
58 .of_match = mvebu_ahci_ids,
Ken Mac3f0ca12018-05-25 15:49:26 +080059 .bind = mvebu_ahci_bind,
Stefan Roese05b17652016-05-17 15:00:30 +020060 .probe = mvebu_ahci_probe,
61};