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

ft2232_spi: add an ability to use GPIO for chip selection

Change-Id: I6db05619e0d69ad18549c8556ef69225337b1532
Signed-off-by: Sergey Alirzaev <zl29ah@gmail.com>
Reviewed-on: https://review.coreboot.org/28911
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
Sergey Alirzaev 2018-08-01 16:39:17 +03:00 committed by Nico Huber
parent 73ab88d58e
commit 4acc3f3a89
2 changed files with 26 additions and 6 deletions

View File

@ -722,9 +722,9 @@ Olimex ARM-USB-TINY/-H, Olimex ARM-USB-OCD/-H, OpenMoko Neo1973 Debug board (V2+
Multi-Protocol Adapter (TUMPA), TUMPA Lite, GOEPEL PicoTAP and Google Servo v1/v2. Multi-Protocol Adapter (TUMPA), TUMPA Lite, GOEPEL PicoTAP and Google Servo v1/v2.
.sp .sp
An optional parameter specifies the controller An optional parameter specifies the controller
type and channel/interface/port it should support. For that you have to use the type, channel/interface/port and GPIO-based chip select it should support. For that you have to use the
.sp .sp
.B " flashrom \-p ft2232_spi:type=model,port=interface" .B " flashrom \-p ft2232_spi:type=model,port=interface,csgpiol=gpio"
.sp .sp
syntax where syntax where
.B model .B model
@ -733,14 +733,17 @@ can be
arm-usb-tiny ", " arm-usb-tiny-h ", " arm-usb-ocd ", " arm-usb-ocd-h \ arm-usb-tiny ", " arm-usb-tiny-h ", " arm-usb-ocd ", " arm-usb-ocd-h \
", " tumpa ", " tumpalite ", " picotap ", " google-servo ", " google-servo-v2 \ ", " tumpa ", " tumpalite ", " picotap ", " google-servo ", " google-servo-v2 \
" or " google-servo-v2-legacy " or " google-servo-v2-legacy
and
.B interface .B interface
can be can be
.BR A ", " B ", " C ", or " D . .BR A ", " B ", " C ", or " D
and
.B csgpiol
can be a number between 0 and 3, denoting GPIOL0-GPIOL3 correspondingly.
The default model is The default model is
.B 4232H .B 4232H
and the default interface is the default interface is
.BR A . .BR A
and GPIO is not used by default.
.sp .sp
If there is more than one ft2232_spi-compatible device connected, you can select which one should be used by If there is more than one ft2232_spi-compatible device connected, you can select which one should be used by
specifying its serial number with the specifying its serial number with the

View File

@ -327,6 +327,23 @@ int ft2232_spi_init(void)
} }
free(arg); free(arg);
arg = extract_programmer_param("csgpiol");
if (arg) {
char *endptr;
unsigned int temp = strtoul(arg, &endptr, 10);
if (*endptr || endptr == arg || temp > 3) {
msg_perr("Error: Invalid GPIOL specified: \"%s\".\n"
"Valid values are between 0 and 3.\n", arg);
free(arg);
return -2;
} else {
unsigned int pin = temp + 4;
cs_bits |= 1 << pin;
pindir |= 1 << pin;
}
}
free(arg);
msg_pdbg("Using device type %s %s ", msg_pdbg("Using device type %s %s ",
get_ft2232_vendorname(ft2232_vid, ft2232_type), get_ft2232_vendorname(ft2232_vid, ft2232_type),
get_ft2232_devicename(ft2232_vid, ft2232_type)); get_ft2232_devicename(ft2232_vid, ft2232_type));