Add FT4222H support
The FT4222H features a very different engine compared to what we are
used to from other FTDI USB/serial chips. It doesn't do UART (at least
not officially), doesn't have the MPSSE engine, but has a quad-SPI
master, and SPI/I2C slave support.
A few similarities exist, though, so this could probably make use of
libftdi in the future.
There are two config-mode straps that select one of four modes:
0. 1 data interface + 1 GPIO interface
1. 3 data interfaces + 1 GPIO interface
2. 4 data interfaces
3. 1 data interface
With multiple data interfaces, GPIO pins are muxed as additional CS
lines. The advantage of mode 0 and 3 is that apparently a bigger buffer
is available for the data interface. Only in these modes, it gets to
its full speed (52.8MBps according to the datasheet[1]). The CS line is
automatically selected based on the USB interface used. No test using
multiple interfaces at once were performed, though.
All the USB commands and transfer protocols were derived from traces
gathered with the proprietary LibFT4222. The results are summarized
in the flashprog wiki[2].
[1] https://www.ftdichip.com/old2020/Support/Documents/DataSheets/ICs/DS_FT4222H.pdf
[2] https://flashprog.org/wiki/FT4222H
Change-Id: I9ee1287e13113ccf8b5ea2be4a25866413a94844
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/50
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/Makefile b/Makefile
index 6da3458..6d993e7 100644
--- a/Makefile
+++ b/Makefile
@@ -160,6 +160,7 @@
CONFIG_DEDIPROG \
CONFIG_DEVELOPERBOX_SPI \
CONFIG_DIGILENT_SPI \
+ CONFIG_FT4222_SPI \
CONFIG_PICKIT2_SPI \
CONFIG_RAIDEN_DEBUG_SPI \
CONFIG_STLINKV3_SPI \
@@ -317,7 +318,7 @@
$(call mark_unsupported,CONFIG_DUMMY)
# libpayload does not provide the romsize field in struct pci_dev that the atapromise code requires.
$(call mark_unsupported,CONFIG_ATAPROMISE)
-# Dediprog, Developerbox, USB-Blaster, PICkit2, CH341A and FT2232 are not supported with libpayload (missing libusb support).
+# Dediprog, Developerbox, USB-Blaster, PICkit2, CH341A, FT2232 and FT4222 are not supported with libpayload (missing libusb support).
$(call mark_unsupported,$(DEPENDS_ON_LIBUSB1) $(DEPENDS_ON_LIBFTDI1) $(DEPENDS_ON_LIBJAYLINK))
endif
@@ -452,6 +453,9 @@
# Always enable FT2232 SPI dongles for now.
CONFIG_FT2232_SPI ?= yes
+# Always enable FT4222 SPI dongles for now.
+CONFIG_FT4222_SPI ?= yes
+
# Always enable Altera USB-Blaster dongles for now.
CONFIG_USBBLASTER_SPI ?= yes
@@ -679,6 +683,11 @@
PROGRAMMER_OBJS += ft2232_spi.o
endif
+ifeq ($(CONFIG_FT4222_SPI), yes)
+FEATURE_FLAGS += -D'CONFIG_FT4222_SPI=1'
+PROGRAMMER_OBJS += ft4222_spi.o
+endif
+
ifeq ($(CONFIG_USBBLASTER_SPI), yes)
FEATURE_FLAGS += -D'CONFIG_USBBLASTER_SPI=1'
PROGRAMMER_OBJS += usbblaster_spi.o