1/* 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 22#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 30static 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(devfdt_get_addr_ptr(dev)); 39 40 return 0; 41} 42 43static const struct udevice_id mvebu_ahci_ids[] = { 44 { .compatible = "marvell,armada-3700-ahci" }, 45 { .compatible = "marvell,armada-8k-ahci" }, 46 { } 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}; 55