summaryrefslogtreecommitdiffstats
path: root/ft2232_spi.c
diff options
context:
space:
mode:
authorSergey Alirzaev <zl29ah@gmail.com>2018-08-01 16:39:17 +0300
committerNico Huber <nico.h@gmx.de>2018-10-08 14:01:08 +0000
commit4acc3f3a8990cda15f04e5eabf028c5cda0d6619 (patch)
treece763d072afff4636de2c9fc9f8622ebfc67cc18 /ft2232_spi.c
parent73ab88d58ee6ca1f0a822faafe0b14996e65ddbf (diff)
downloadflashrom-4acc3f3a8990cda15f04e5eabf028c5cda0d6619.tar.gz
flashrom-4acc3f3a8990cda15f04e5eabf028c5cda0d6619.tar.bz2
flashrom-4acc3f3a8990cda15f04e5eabf028c5cda0d6619.zip
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>
Diffstat (limited to 'ft2232_spi.c')
-rw-r--r--ft2232_spi.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/ft2232_spi.c b/ft2232_spi.c
index 819744c3f..95584aa40 100644
--- a/ft2232_spi.c
+++ b/ft2232_spi.c
@@ -327,6 +327,23 @@ int ft2232_spi_init(void)
}
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 ",
get_ft2232_vendorname(ft2232_vid, ft2232_type),
get_ft2232_devicename(ft2232_vid, ft2232_type));