Author: uwe Date: 2009-09-03 01:00:46 +0200 (Thu, 03 Sep 2009) New Revision: 712
Modified: trunk/Makefile trunk/flash.h trunk/flashrom.8 trunk/flashrom.c trunk/nic3com.c trunk/pcidev.c trunk/satasii.c Log: Add support for parallel flash on Dr. Kaiser PC-Waechter PCI devices.
The vendor sold different designs under that name, the patch works with the one that has an Actel FPGA as PCI-to-Flash bridge.
The Flash chip is a "Macronix MX29F001B" (128 KB, parallel) soldered directly to the PCB. Flash operations (PROBE, READ, ERASE, WRITE) work as expected.
Signed-off-by: TURBO J turboj@gmx.de Acked-by: Uwe Hermann uwe@hermann-uwe.de
Modified: trunk/Makefile =================================================================== --- trunk/Makefile 2009-09-02 22:09:00 UTC (rev 711) +++ trunk/Makefile 2009-09-02 23:00:46 UTC (rev 712) @@ -50,7 +50,7 @@ flashrom.o w39v080fa.o sharplhf00l04.o w29ee011.o spi.o it87spi.o \ ichspi.o w39v040c.o sb600spi.o wbsio_spi.o m29f002.o internal.o \ dummyflasher.o pcidev.o nic3com.o satasii.o ft2232_spi.o \ - print.o + print.o drkaiser.o
all: pciutils features dep $(PROGRAM)
Modified: trunk/flash.h =================================================================== --- trunk/flash.h 2009-09-02 22:09:00 UTC (rev 711) +++ trunk/flash.h 2009-09-02 23:00:46 UTC (rev 712) @@ -84,6 +84,7 @@ PROGRAMMER_INTERNAL, PROGRAMMER_DUMMY, PROGRAMMER_NIC3COM, + PROGRAMMER_DRKAISER, PROGRAMMER_SATASII, PROGRAMMER_IT87SPI, #if FT2232_SPI_SUPPORT == 1 @@ -281,8 +282,8 @@ const char *vendor_name; const char *device_name; }; -uint32_t pcidev_validate(struct pci_dev *dev, struct pcidev_status *devs); -uint32_t pcidev_init(uint16_t vendor_id, struct pcidev_status *devs, char *pcidev_bdf); +uint32_t pcidev_validate(struct pci_dev *dev, uint32_t bar, struct pcidev_status *devs); +uint32_t pcidev_init(uint16_t vendor_id, uint32_t bar, struct pcidev_status *devs, char *pcidev_bdf);
/* print.c */ char *flashbuses_to_text(enum chipbustype bustype); @@ -387,6 +388,13 @@ uint8_t nic3com_chip_readb(const chipaddr addr); extern struct pcidev_status nics_3com[];
+/* drkaiser.c */ +int drkaiser_init(void); +int drkaiser_shutdown(void); +void drkaiser_chip_writeb(uint8_t val, chipaddr addr); +uint8_t drkaiser_chip_readb(const chipaddr addr); +extern struct pcidev_status drkaiser_pcidev[]; + /* satasii.c */ int satasii_init(void); int satasii_shutdown(void);
Modified: trunk/flashrom.8 =================================================================== --- trunk/flashrom.8 2009-09-02 22:09:00 UTC (rev 711) +++ trunk/flashrom.8 2009-09-02 23:00:46 UTC (rev 712) @@ -140,6 +140,8 @@ .sp .BR "* nic3com" " (for flash ROMs on 3COM network cards)" .sp +.BR "* drkaiser" " (for flash ROMs on Dr. Kaiser PC-Waechter PCI cards)" +.sp .BR "* satasii" " (for flash ROMs on Silicon Image SATA/IDE controllers)" .sp .BR "* it87spi" " (for flash ROMs behind an ITE IT87xx Super I/O LPC/SPI translation unit)"
Modified: trunk/flashrom.c =================================================================== --- trunk/flashrom.c 2009-09-02 22:09:00 UTC (rev 711) +++ trunk/flashrom.c 2009-09-02 23:00:46 UTC (rev 712) @@ -89,6 +89,23 @@ },
{ + .name = "drkaiser", + .init = drkaiser_init, + .shutdown = drkaiser_shutdown, + .map_flash_region = fallback_map, + .unmap_flash_region = fallback_unmap, + .chip_readb = drkaiser_chip_readb, + .chip_readw = fallback_chip_readw, + .chip_readl = fallback_chip_readl, + .chip_readn = fallback_chip_readn, + .chip_writeb = drkaiser_chip_writeb, + .chip_writew = fallback_chip_writew, + .chip_writel = fallback_chip_writel, + .chip_writen = fallback_chip_writen, + .delay = internal_delay, + }, + + { .name = "satasii", .init = satasii_init, .shutdown = satasii_shutdown, @@ -747,6 +764,7 @@ printf("\nSupported PCI devices flashrom can use " "as programmer:\n\n"); print_supported_pcidevs(nics_3com); + print_supported_pcidevs(drkaiser_pcidev); print_supported_pcidevs(satas_sii); exit(0); }
Modified: trunk/nic3com.c =================================================================== --- trunk/nic3com.c 2009-09-02 22:09:00 UTC (rev 711) +++ trunk/nic3com.c 2009-09-02 23:00:46 UTC (rev 712) @@ -58,7 +58,8 @@ { get_io_perms();
- io_base_addr = pcidev_init(PCI_VENDOR_ID_3COM, nics_3com, programmer_param); + io_base_addr = pcidev_init(PCI_VENDOR_ID_3COM, PCI_BASE_ADDRESS_0, + nics_3com, programmer_param); id = pcidev_dev->device_id;
/* 3COM 3C90xB cards need a special fixup. */
Modified: trunk/pcidev.c =================================================================== --- trunk/pcidev.c 2009-09-02 22:09:00 UTC (rev 711) +++ trunk/pcidev.c 2009-09-02 23:00:46 UTC (rev 712) @@ -28,7 +28,7 @@ struct pci_filter filter; struct pci_dev *pcidev_dev = NULL;
-uint32_t pcidev_validate(struct pci_dev *dev, struct pcidev_status *devs) +uint32_t pcidev_validate(struct pci_dev *dev, uint32_t bar, struct pcidev_status *devs) { int i; uint32_t addr; @@ -37,9 +37,9 @@ if (dev->device_id != devs[i].device_id) continue;
- /* Don't use dev->base_addr[0], won't work on older libpci. */ - addr = pci_read_long(dev, PCI_BASE_ADDRESS_0) & ~0x03; - + /* Don't use dev->base_addr[x] (as value for 'bar'), won't work on older libpci. */ + addr = pci_read_long(dev, bar) & ~0x03; + printf("Found "%s %s" (%04x:%04x, BDF %02x:%02x.%x).\n", devs[i].vendor_name, devs[i].device_name, dev->vendor_id, dev->device_id, dev->bus, dev->dev, dev->func); @@ -57,7 +57,7 @@ return 0; }
-uint32_t pcidev_init(uint16_t vendor_id, struct pcidev_status *devs, char *pcidev_bdf) +uint32_t pcidev_init(uint16_t vendor_id, uint32_t bar, struct pcidev_status *devs, char *pcidev_bdf) { struct pci_dev *dev; char *msg = NULL; @@ -80,7 +80,7 @@
for (dev = pacc->devices; dev; dev = dev->next) { if (pci_filter_match(&filter, dev)) { - if ((addr = pcidev_validate(dev, devs)) != 0) { + if ((addr = pcidev_validate(dev, bar, devs)) != 0) { curaddr = addr; pcidev_dev = dev; found++;
Modified: trunk/satasii.c =================================================================== --- trunk/satasii.c 2009-09-02 22:09:00 UTC (rev 711) +++ trunk/satasii.c 2009-09-02 23:00:46 UTC (rev 712) @@ -47,7 +47,8 @@
get_io_perms();
- pcidev_init(PCI_VENDOR_ID_SII, satas_sii, programmer_param); + pcidev_init(PCI_VENDOR_ID_SII, PCI_BASE_ADDRESS_0, satas_sii, + programmer_param); id = pcidev_dev->device_id;
if ((id == 0x3132) || (id == 0x3124)) {