1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-02 14:33:18 +02:00

lspcon_i2c_spi.c: Add SPI-master support for PS17{5,6}

This adds support for the Parade lspcon usb-c to HDMI protocol
translater part that is i2c-controlled. The support allows the
host to reach the SPI ROM that hangs off the part where it
stores its firmware.

Usage is as follows:
	flashrom -p lspcon_i2c_spi:bus=X
	where X is the bus number.

BUG=b:148746232
BRANCH=none
TEST=tested with following commands, read/write/erase works good.
	flashrom -p lspcon_i2c_spi:bus=7 -r /tmp/foo;
	flashrom -p lspcon_i2c_spi:bus=7 -E;
	flashrom -p lspcon_i2c_spi:bus=7 -w /tmp/foo;

Change-Id: I039e683252cfaf1ffef8694a3e8081b1b6b944f7
Signed-off-by: Shiyu Sun <sshiyu@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/39687
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
This commit is contained in:
Shiyu Sun
2020-03-19 14:37:57 +11:00
committed by Edward O'Callaghan
parent dc2c83bbc7
commit 13a2ef6cbd
6 changed files with 556 additions and 0 deletions

View File

@ -195,6 +195,11 @@ UNSUPPORTED_FEATURES += CONFIG_STLINKV3_SPI=yes
else
override CONFIG_STLINKV3_SPI = no
endif
ifeq ($(CONFIG_LSPCON_I2C_SPI), yes)
UNSUPPORTED_FEATURES += CONFIG_LSPCON_I2C_SPI=yes
else
override CONFIG_LSPCON_I2C_SPI = no
endif
# libjaylink is also not available for DOS
ifeq ($(CONFIG_JLINK_SPI), yes)
UNSUPPORTED_FEATURES += CONFIG_JLINK_SPI=yes
@ -306,6 +311,11 @@ UNSUPPORTED_FEATURES += CONFIG_SATAMV=yes
else
override CONFIG_SATAMV = no
endif
ifeq ($(CONFIG_LSPCON_I2C_SPI), yes)
UNSUPPORTED_FEATURES += CONFIG_LSPCON_I2C_SPI=yes
else
override CONFIG_LSPCON_I2C_SPI = no
endif
endif
ifneq ($(TARGET_OS), MinGW)
@ -381,6 +391,11 @@ UNSUPPORTED_FEATURES += CONFIG_STLINKV3_SPI=yes
else
override CONFIG_STLINKV3_SPI = no
endif
ifeq ($(CONFIG_LSPCON_I2C_SPI), yes)
UNSUPPORTED_FEATURES += CONFIG_LSPCON_I2C_SPI=yes
else
override CONFIG_LSPCON_I2C_SPI = no
endif
ifeq ($(CONFIG_CH341A_SPI), yes)
UNSUPPORTED_FEATURES += CONFIG_CH341A_SPI=yes
else
@ -656,6 +671,9 @@ CONFIG_PICKIT2_SPI ?= yes
# Always enable STLink V3
CONFIG_STLINKV3_SPI ?= yes
# Disables LSPCON support until the i2c helper supports multiple systems.
CONFIG_LSPCON_I2C_SPI ?= no
# Always enable dummy tracing for now.
CONFIG_DUMMY ?= yes
@ -736,6 +754,7 @@ override CONFIG_DEVELOPERBOX_SPI = no
override CONFIG_PICKIT2_SPI = no
override CONFIG_RAIDEN = no
override CONFIG_STLINKV3_SPI = no
override CONFIG_LSPCON_I2C_SPI = no
endif
ifeq ($(CONFIG_ENABLE_LIBPCI_PROGRAMMERS), no)
override CONFIG_INTERNAL = no
@ -914,6 +933,12 @@ PROGRAMMER_OBJS += stlinkv3_spi.o
NEED_LIBUSB1 += CONFIG_STLINKV3_SPI
endif
ifeq ($(CONFIG_LSPCON_I2C_SPI), yes)
FEATURE_CFLAGS += -D'CONFIG_LSPCON_I2C_SPI=1'
PROGRAMMER_OBJS += lspcon_i2c_spi.o
NEED_LIBUSB1 += CONFIG_LSPCON_I2C_SPI
endif
ifneq ($(NEED_LIBFTDI), )
FTDILIBS := $(call debug_shell,[ -n "$(PKG_CONFIG_LIBDIR)" ] && export PKG_CONFIG_LIBDIR="$(PKG_CONFIG_LIBDIR)" ; $(PKG_CONFIG) --libs libftdi1 || $(PKG_CONFIG) --libs libftdi || printf "%s" "-lftdi -lusb")
FEATURE_CFLAGS += $(call debug_shell,grep -q "FT232H := yes" .features && printf "%s" "-D'HAVE_FT232H=1'")