diff options
author | Alexandre Boeglin <alex@boeglin.org> | 2014-12-20 20:25:19 +0000 |
---|---|---|
committer | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2014-12-20 20:25:19 +0000 |
commit | 80e647158800d927c776d1278d8817f0ed8f17cd (patch) | |
tree | b5b0f8f09acac5f114c80ac1ed2ff316c7c0eb12 /Makefile | |
parent | 5859ced80f17217e7e829b61b02bb18b66b4f8e4 (diff) | |
download | ast2050-flashrom-80e647158800d927c776d1278d8817f0ed8f17cd.zip ast2050-flashrom-80e647158800d927c776d1278d8817f0ed8f17cd.tar.gz |
Add support for the MSTAR I2C ISP protocol
Basically, among other chips, MSTAR manufactures SoCs that equip TV sets
and computer screens, and it seems that all of their products use the
same in-system programming protocol. Basically, they use the DDC channel
of VGA or DVI connectors, which is actually an I2C bus, to encapsulate
SPI frames (the flash chip is connected to the SoC through an SPI bus).
I wrote this patch since the screen I bought had a software bug, and the
manufacturer only released a new firmware binary, but no tool or
instructions on flashing it.
More details can be found here:
http://boeglin.org/blog/index.php?entry=Flashing-a-BenQ-Z-series-for-free(dom)
I only read code from Linux kernel archives published by Acer to figure
out the protocol (for a touchscreen controller and an NFC chip, both by
MSTAR, that share the same ISP protocol), so I don't think there are
any legal problems with it.
Compilation is currently disabled by default in the Makefile.
If in doubt, additional Makefile bugs were added by Stefan.
Corresponding to flashrom svn r1860.
Signed-off-by: Alexandre Boeglin <alex@boeglin.org>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -300,6 +300,11 @@ UNSUPPORTED_FEATURES += CONFIG_LINUX_SPI=yes else override CONFIG_LINUX_SPI = no endif +ifeq ($(CONFIG_MSTARDDC_SPI), yes) +UNSUPPORTED_FEATURES += CONFIG_MSTARDDC_SPI=yes +else +override CONFIG_MSTARDDC_SPI = no +endif endif ############################################################################### @@ -413,6 +418,9 @@ CONFIG_FT2232_SPI ?= yes # Always enable Altera USB-Blaster dongles for now. CONFIG_USBBLASTER_SPI ?= yes +# MSTAR DDC support needs more tests/reviews/cleanups. +CONFIG_MSTARDDC_SPI ?= no + # Always enable dummy tracing for now. CONFIG_DUMMY ?= yes @@ -670,6 +678,13 @@ FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "LINUX_SPI_SUPPORT := yes" .features PROGRAMMER_OBJS += linux_spi.o endif +ifeq ($(CONFIG_MSTARDDC_SPI), yes) +# This is a totally ugly hack. +FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "LINUX_I2C_SUPPORT := yes" .features && printf "%s" "-D'CONFIG_MSTARDDC_SPI=1'") +NEED_LINUX_I2C := yes +PROGRAMMER_OBJS += mstarddc_spi.o +endif + ifeq ($(NEED_SERIAL), yes) LIB_OBJS += serial.o endif @@ -927,6 +942,19 @@ int main(int argc, char **argv) endef export LINUX_SPI_TEST +define LINUX_I2C_TEST +#include <linux/i2c-dev.h> +#include <linux/i2c.h> + +int main(int argc, char **argv) +{ + (void) argc; + (void) argv; + return 0; +} +endef +export LINUX_I2C_TEST + features: compiler @echo "FEATURES := yes" > .features.tmp ifeq ($(NEED_FTDI), yes) @@ -948,6 +976,13 @@ ifeq ($(CONFIG_LINUX_SPI), yes) ( echo "yes."; echo "LINUX_SPI_SUPPORT := yes" >> .features.tmp ) || \ ( echo "no."; echo "LINUX_SPI_SUPPORT := no" >> .features.tmp ) endif +ifeq ($(NEED_LINUX_I2C), yes) + @printf "Checking if Linux I2C headers are present... " + @echo "$$LINUX_I2C_TEST" > .featuretest.c + @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >/dev/null 2>&1 && \ + ( echo "yes."; echo "LINUX_I2C_SUPPORT := yes" >> .features.tmp ) || \ + ( echo "no."; echo "LINUX_I2C_SUPPORT := no" >> .features.tmp ) +endif @printf "Checking for utsname support... " @echo "$$UTSNAME_TEST" > .featuretest.c @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >/dev/null 2>&1 && \ |