summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile9
-rw-r--r--flash.h18
-rw-r--r--flashrom.c42
3 files changed, 67 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 6a9beb5..dff5e91 100644
--- a/Makefile
+++ b/Makefile
@@ -110,6 +110,9 @@ CONFIG_DUMMY ?= yes
# Always enable Dr. Kaiser for now.
CONFIG_DRKAISER ?= yes
+# Always enable Realtek NICs for now.
+CONFIG_NICREALTEK ?= yes
+
# Always enable Bus Pirate SPI for now.
CONFIG_BUSPIRATESPI ?= yes
@@ -181,6 +184,12 @@ PROGRAMMER_OBJS += drkaiser.o
NEED_PCI := yes
endif
+ifeq ($(CONFIG_NICREALTEK), yes)
+FEATURE_CFLAGS += -D'NICREALTEK_SUPPORT=1'
+PROGRAMMER_OBJS += nicrealtek.o
+NEED_PCI := yes
+endif
+
ifeq ($(CONFIG_BUSPIRATESPI), yes)
FEATURE_CFLAGS += -D'BUSPIRATE_SPI_SUPPORT=1'
PROGRAMMER_OBJS += buspirate_spi.o
diff --git a/flash.h b/flash.h
index f1ecb21..436a1fe 100644
--- a/flash.h
+++ b/flash.h
@@ -46,6 +46,10 @@ enum programmer {
#if NIC3COM_SUPPORT == 1
PROGRAMMER_NIC3COM,
#endif
+#if NICREALTEK_SUPPORT == 1
+ PROGRAMMER_NICREALTEK,
+ PROGRAMMER_NICREALTEK2,
+#endif
#if GFXNVIDIA_SUPPORT == 1
PROGRAMMER_GFXNVIDIA,
#endif
@@ -330,7 +334,7 @@ uint32_t pcidev_init(uint16_t vendor_id, uint32_t bar, struct pcidev_status *dev
/* print.c */
char *flashbuses_to_text(enum chipbustype bustype);
void print_supported(void);
-#if (NIC3COM_SUPPORT == 1) || (GFXNVIDIA_SUPPORT == 1) || (DRKAISER_SUPPORT == 1) || (SATASII_SUPPORT == 1) || (ATAHPT_SUPPORT == 1)
+#if (NIC3COM_SUPPORT == 1) || (GFXNVIDIA_SUPPORT == 1) || (DRKAISER_SUPPORT == 1) || (SATASII_SUPPORT == 1) || (ATAHPT_SUPPORT == 1) || (NICREALTEK_SUPPORT == 1)
void print_supported_pcidevs(struct pcidev_status *devs);
#endif
void print_supported_wiki(void);
@@ -462,6 +466,18 @@ uint8_t drkaiser_chip_readb(const chipaddr addr);
extern struct pcidev_status drkaiser_pcidev[];
#endif
+/* nicrealtek.c */
+#if NICREALTEK_SUPPORT == 1
+int nicrealtek_init(void);
+int nicsmc1211_init(void);
+int nicrealtek_shutdown(void);
+void nicrealtek_chip_writeb(uint8_t val, chipaddr addr);
+uint8_t nicrealtek_chip_readb(const chipaddr addr);
+extern struct pcidev_status nics_realtek[];
+extern struct pcidev_status nics_realteksmc1211[];
+#endif
+
+
/* satasii.c */
#if SATASII_SUPPORT == 1
int satasii_init(void);
diff --git a/flashrom.c b/flashrom.c
index 1b01381..99b8da5 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -47,13 +47,17 @@ enum programmer programmer = PROGRAMMER_DUMMY;
* if more than one of them is selected. If only one is selected, it is clear
* that the user wants that one to become the default.
*/
-#if NIC3COM_SUPPORT+GFXNVIDIA_SUPPORT+DRKAISER_SUPPORT+SATASII_SUPPORT+ATAHPT_SUPPORT+FT2232_SPI_SUPPORT+SERPROG_SUPPORT+BUSPIRATE_SPI_SUPPORT+DEDIPROG_SUPPORT > 1
+#if NIC3COM_SUPPORT+GFXNVIDIA_SUPPORT+DRKAISER_SUPPORT+SATASII_SUPPORT+ATAHPT_SUPPORT+FT2232_SPI_SUPPORT+SERPROG_SUPPORT+BUSPIRATE_SPI_SUPPORT+DEDIPROG_SUPPORT+NICREALTEK_SUPPORT > 1
#error Please enable either CONFIG_DUMMY or CONFIG_INTERNAL or disable support for all external programmers except one.
#endif
enum programmer programmer =
#if NIC3COM_SUPPORT == 1
PROGRAMMER_NIC3COM
#endif
+#if NICREALTEK_SUPPORT == 1
+ PROGRAMMER_NICREALTEK
+ PROGRAMMER_NICREALTEK2
+#endif
#if GFXNVIDIA_SUPPORT == 1
PROGRAMMER_GFXNVIDIA
#endif
@@ -159,6 +163,42 @@ const struct programmer_entry programmer_table[] = {
},
#endif
+#if NICREALTEK_SUPPORT == 1
+ {
+ .name = "nicrealtek",
+ .init = nicrealtek_init,
+ .shutdown = nicrealtek_shutdown,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .chip_readb = nicrealtek_chip_readb,
+ .chip_readw = fallback_chip_readw,
+ .chip_readl = fallback_chip_readl,
+ .chip_readn = fallback_chip_readn,
+ .chip_writeb = nicrealtek_chip_writeb,
+ .chip_writew = fallback_chip_writew,
+ .chip_writel = fallback_chip_writel,
+ .chip_writen = fallback_chip_writen,
+ .delay = internal_delay,
+ },
+ {
+ .name = "nicsmc1211",
+ .init = nicsmc1211_init,
+ .shutdown = nicrealtek_shutdown,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .chip_readb = nicrealtek_chip_readb,
+ .chip_readw = fallback_chip_readw,
+ .chip_readl = fallback_chip_readl,
+ .chip_readn = fallback_chip_readn,
+ .chip_writeb = nicrealtek_chip_writeb,
+ .chip_writew = fallback_chip_writew,
+ .chip_writel = fallback_chip_writel,
+ .chip_writen = fallback_chip_writen,
+ .delay = internal_delay,
+ },
+#endif
+
+
#if GFXNVIDIA_SUPPORT == 1
{
.name = "gfxnvidia",
OpenPOWER on IntegriCloud