Author: hailfinger Date: Fri May 21 23:54:07 2010 New Revision: 1002 URL: http://flashrom.org/trac/coreboot/changeset/1002
Log: Support for Realtek RTL8139 network card flashing.
Signed-off-by: Joerg Fischer turboj@gmx.de Acked-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Modified: trunk/Makefile trunk/flash.h trunk/flashrom.c
Modified: trunk/Makefile ============================================================================== --- trunk/Makefile Wed May 19 18:55:43 2010 (r1001) +++ trunk/Makefile Fri May 21 23:54:07 2010 (r1002) @@ -110,6 +110,9 @@ # 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 @@ 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
Modified: trunk/flash.h ============================================================================== --- trunk/flash.h Wed May 19 18:55:43 2010 (r1001) +++ trunk/flash.h Fri May 21 23:54:07 2010 (r1002) @@ -46,6 +46,10 @@ #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 @@ /* 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 @@ 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);
Modified: trunk/flashrom.c ============================================================================== --- trunk/flashrom.c Wed May 19 18:55:43 2010 (r1001) +++ trunk/flashrom.c Fri May 21 23:54:07 2010 (r1002) @@ -47,13 +47,17 @@ * 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 @@ }, #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",