Luc Verhaegen has uploaded this change for review.
ati: initial commit
Change-Id: Ia5f755ae7a0723372933216516625bc156b1f4bc
Signed-off-by: Luc Verhaegen <libv@skynet.be>
---
M Makefile
A ati_spi.c
M flashrom.c
M programmer.h
4 files changed, 77 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/85/29085/1
diff --git a/Makefile b/Makefile
index b13cf7e..1e924af 100644
--- a/Makefile
+++ b/Makefile
@@ -656,6 +656,9 @@
# Digilent Development board JTAG
CONFIG_DIGILENT_SPI ?= yes
+# ATI Radeon SPI
+CONFIG_ATI_SPI ?= yes
+
# Disable wiki printing by default. It is only useful if you have wiki access.
CONFIG_PRINT_WIKI ?= no
@@ -703,6 +706,7 @@
override CONFIG_NICINTEL_EEPROM = no
override CONFIG_OGP_SPI = no
override CONFIG_SATAMV = no
+override CONFIG_ATI_SPI = no
endif
# Bitbanging SPI infrastructure, default off unless needed.
@@ -964,6 +968,12 @@
NEED_LIBUSB1 += CONFIG_DIGILENT_SPI
endif
+ifeq ($(CONFIG_ATI_SPI), yes)
+FEATURE_CFLAGS += -D'CONFIG_ATI_SPI=1'
+PROGRAMMER_OBJS += ati_spi.o
+NEED_LIBPCI += CONFIG_ATI_SPI
+endif
+
ifneq ($(NEED_SERIAL), )
LIB_OBJS += serial.o custom_baud.o
endif
diff --git a/ati_spi.c b/ati_spi.c
new file mode 100644
index 0000000..ba672f7
--- /dev/null
+++ b/ati_spi.c
@@ -0,0 +1,46 @@
+/*
+ * This file is part of the flashrom project.
+ *
+ * Copyright (C) 2018 Luc Verhaegen <libv@skynet.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/*
+ * This adds support for the ATI/AMD Radeon SPI interfaces.
+ */
+
+#include "programmer.h"
+#include "spi.h"
+
+struct ati_spi_pci_private {
+ int io_bar;
+};
+
+static const struct ati_spi_pci_private r600_spi_pci_private = {
+ .io_bar = 2,
+};
+
+const struct flashrom_pci_match ati_spi_pci_devices[] = {
+ {0x1002, 0x958d, NT, &r600_spi_pci_private},
+ {},
+};
+
+int
+ati_spi_init(void)
+{
+ struct flashrom_pci_device *device;
+
+ device = flashrom_pci_init(ati_spi_pci_devices);
+ if (!device)
+ return 1;
+
+ return 0;
+}
diff --git a/flashrom.c b/flashrom.c
index 3b3e9bb..30c605d 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -437,6 +437,18 @@
},
#endif
+#if CONFIG_ATI_SPI == 1
+ {
+ .name = "ati_spi",
+ .type = PCI2,
+ .devs.pci_match = ati_spi_pci_devices,
+ .init = ati_spi_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+ },
+#endif
+
{0}, /* This entry corresponds to PROGRAMMER_INVALID. */
};
diff --git a/programmer.h b/programmer.h
index a5a1360..3398427 100644
--- a/programmer.h
+++ b/programmer.h
@@ -118,6 +118,9 @@
#if CONFIG_DIGILENT_SPI == 1
PROGRAMMER_DIGILENT_SPI,
#endif
+#if CONFIG_ATI_SPI == 1
+ PROGRAMMER_ATI_SPI,
+#endif
PROGRAMMER_INVALID /* This must always be the last entry. */
};
@@ -582,6 +585,12 @@
extern const struct dev_entry devs_digilent_spi[];
#endif
+/* ati_spi.c */
+#if CONFIG_ATI_SPI == 1
+int ati_spi_init(void);
+extern const struct flashrom_pci_match ati_spi_pci_devices[];
+#endif
+
/* flashrom.c */
struct decode_sizes {
uint32_t parallel;
To view, visit change 29085. To unsubscribe, or for help writing mail filters, visit settings.