[U-Boot] [RFC 19/22] ahci: add support for ThunderX AHCI

Tim Harvey tharvey at gateworks.com
Fri Feb 22 18:03:16 UTC 2019


Signed-off-by: Tim Harvey <tharvey at gateworks.com>
---
 configs/thunderx_81xx_defconfig |  7 +++++++
 drivers/ata/ahci.c              | 12 +++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/configs/thunderx_81xx_defconfig b/configs/thunderx_81xx_defconfig
index bb374b741a..dbdadde5fc 100644
--- a/configs/thunderx_81xx_defconfig
+++ b/configs/thunderx_81xx_defconfig
@@ -6,6 +6,7 @@ CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_IDENT_STRING=" for Cavium Thunder CN81XX ARM v8 Multi-Core"
 CONFIG_THUNDERX_81XX=y
 CONFIG_DEBUG_UART=y
+CONFIG_AHCI=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_BOOTDELAY=5
 CONFIG_USE_BOOTARGS=y
@@ -29,6 +30,10 @@ CONFIG_CMD_USB=y
 # CONFIG_CMD_NET is not set
 CONFIG_DEFAULT_DEVICE_TREE="thunderx-81xx"
 CONFIG_DM=y
+CONFIG_SATA=y
+CONFIG_SCSI_AHCI=y
+CONFIG_AHCI_PCI=y
+CONFIG_BLK=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_LED=y
@@ -38,6 +43,8 @@ CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCI_THUNDERX=y
+CONFIG_SCSI=y
+CONFIG_DM_SCSI=y
 CONFIG_DM_SERIAL=y
 CONFIG_DEBUG_UART_PL011=y
 CONFIG_DEBUG_UART_SKIP_INIT=y
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index e7d590f69a..efbd509807 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1199,9 +1199,15 @@ int ahci_probe_scsi_pci(struct udevice *ahci_dev)
 {
 	ulong base;
 	size_t size;
-
-	base = (ulong)dm_pci_map_bar(ahci_dev, PCI_BASE_ADDRESS_5, &size,
-				     PCI_REGION_MEM);
+	u16 vendor, device;
+	int bar = PCI_BASE_ADDRESS_5;
+
+	dm_pci_read_config16(ahci_dev, PCI_VENDOR_ID, &vendor);
+	dm_pci_read_config16(ahci_dev, PCI_DEVICE_ID, &device);
+	if ((vendor == PCI_VENDOR_ID_CAVIUM) &&
+	    (device == PCI_DEVICE_ID_THUNDERX_AHCI))
+		bar = 0;
+	base = (ulong)dm_pci_map_bar(ahci_dev, bar, &size, PCI_REGION_MEM);
 
 	return ahci_probe_scsi(ahci_dev, base);
 }
-- 
2.17.1



More information about the U-Boot mailing list