mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 23:22:37 +02:00

Add support for the WCH CH347, a high-speed USB to bus converter supporting multiple protocols interfaces including SPI. Currently only mode 1 (vendor defined communication interface) is supported, mode 2 (USB HID communication interface) support will be added later. The code is currently hard coded to use CS1 and a SPI clock of 15 MHz, though there are 2 CS lines and 6 other GPIO lines available, as well as a configurable clock divisor for up to 60MHz operation. Support for these will be exposed through programmer parameters in later commits. This currently uses the synchronous libusb API. Performance seems to be alright so far, if it becomes an issue I may switch to the asynchronous API. Tested with a MX25L1606E flash chip Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com> Change-Id: I31b86c41076cc45d4a416a73fa1131350fb745ba Reviewed-on: https://review.coreboot.org/c/flashrom/+/70573 Reviewed-by: Thomas Heijligen <src@posteo.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
79 lines
2.4 KiB
Bash
Executable File
79 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env sh
|
|
set -e
|
|
|
|
# This script will only work on Linux with all dependencies installed.
|
|
|
|
is_scan_build_env=0
|
|
|
|
make_programmer_opts="INTERNAL INTERNAL_X86 SERPROG RAYER_SPI RAIDEN_DEBUG_SPI PONY_SPI NIC3COM \
|
|
GFXNVIDIA SATASII ATAHPT ATAVIA ATAPROMISE FT2232_SPI USBBLASTER_SPI MSTARDDC_SPI \
|
|
PICKIT2_SPI STLINKV3_SPI PARADE_LSPCON MEDIATEK_I2C_SPI REALTEK_MST_I2C_SPI DUMMY \
|
|
DRKAISER NICREALTEK NICNATSEMI NICINTEL NICINTEL_SPI NICINTEL_EEPROM OGP_SPI \
|
|
BUSPIRATE_SPI DEDIPROG DEVELOPERBOX_SPI SATAMV LINUX_MTD LINUX_SPI IT8212 \
|
|
CH341A_SPI CH347_SPI DIGILENT_SPI DIRTYJTAG_SPI JLINK_SPI ASM106X"
|
|
|
|
meson_programmer_opts="all auto group_ftdi group_i2c group_jlink group_pci group_serial group_usb \
|
|
atahpt atapromise atavia buspirate_spi ch341a_spi ch347_spi dediprog \
|
|
developerbox_spi digilent_spi dirtyjtag_spi drkaiser dummy ft2232_spi \
|
|
gfxnvidia internal it8212 jlink_spi linux_mtd linux_spi parade_lspcon \
|
|
mediatek_i2c_spi mstarddc_spi nic3com nicintel nicintel_eeprom nicintel_spi \
|
|
nicnatsemi nicrealtek ogp_spi pickit2_spi pony_spi raiden_debug_spi rayer_spi \
|
|
realtek_mst_i2c_spi satamv satasii serprog stlinkv3_spi usbblaster_spi asm106x"
|
|
|
|
|
|
if [ "$(basename "${CC}")" = "ccc-analyzer" ] || [ -n "${COVERITY_OUTPUT}" ]; then
|
|
is_scan_build_env=1
|
|
fi
|
|
|
|
|
|
run_linter() {
|
|
./util/lint/lint-extended-020-signed-off-by
|
|
}
|
|
|
|
|
|
build_make () {
|
|
make clean
|
|
make -j $(nproc) CONFIG_EVERYTHING=yes
|
|
|
|
# In case of clang analyzer we don't want to run it on
|
|
# each programmer individually. Thus, just return here.
|
|
if [ ${is_scan_build_env} -eq 1 ]; then
|
|
return
|
|
fi
|
|
|
|
for option in ${make_programmer_opts}; do
|
|
echo "Building ${option}"
|
|
make clean
|
|
make -j $(nproc) CONFIG_NOTHING=yes CONFIG_${option}=yes
|
|
done
|
|
}
|
|
|
|
|
|
build_meson () {
|
|
build_dir=out
|
|
meson_opts="-Dtests=enabled"
|
|
ninja_opts="-j $(nproc)"
|
|
|
|
rm -rf ${build_dir}
|
|
|
|
for programmer in ${meson_programmer_opts}; do
|
|
programmer_dir="${build_dir}/${programmer}"
|
|
|
|
# In case of clang analyzer we don't want to run it on
|
|
# each programmer individually. Thus, just return here.
|
|
if [ ${is_scan_build_env} -eq 1 ] && [ "${programmer}" != "all" ]; then
|
|
return
|
|
fi
|
|
|
|
meson setup ${programmer_dir} ${meson_opts} -Dprogrammer=${programmer}
|
|
ninja ${ninja_opts} -C ${programmer_dir}
|
|
ninja ${ninja_opts} -C ${programmer_dir} test
|
|
done
|
|
}
|
|
|
|
|
|
run_linter
|
|
|
|
build_make
|
|
build_meson
|