Nikolai Artemiev has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/42796 )
Change subject: ft2232_spi.c: align with Chrome OS flashrom
......................................................................
ft2232_spi.c: align with Chrome OS flashrom
Brings over various changes:
- Limit servo channel selection to valid range
- Use DIS_DIV_5 constant
- Update some comments
- Wrap long lines
Signed-off-by: Nikolai Artemiev <nartemiev(a)google.com>
Change-Id: I24c20e9b5d7e661d0180699bbd0d1447f6bf816f
---
M ft2232_spi.c
1 file changed, 20 insertions(+), 10 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/96/42796/1
diff --git a/ft2232_spi.c b/ft2232_spi.c
index 87e6057..083e58f 100644
--- a/ft2232_spi.c
+++ b/ft2232_spi.c
@@ -110,7 +110,8 @@
{
int i;
for (i = 0; devs_ft2232spi[i].vendor_name != NULL; i++) {
- if ((devs_ft2232spi[i].device_id == ft2232_type) && (devs_ft2232spi[i].vendor_id == ft2232_vid))
+ if ((devs_ft2232spi[i].device_id == ft2232_type)
+ && (devs_ft2232spi[i].vendor_id == ft2232_vid))
return devs_ft2232spi[i].device_name;
}
return "unknown device";
@@ -120,7 +121,8 @@
{
int i;
for (i = 0; devs_ft2232spi[i].vendor_name != NULL; i++) {
- if ((devs_ft2232spi[i].device_id == ft2232_type) && (devs_ft2232spi[i].vendor_id == ft2232_vid))
+ if ((devs_ft2232spi[i].device_id == ft2232_type)
+ && (devs_ft2232spi[i].vendor_id == ft2232_vid))
return devs_ft2232spi[i].vendor_name;
}
return "unknown vendor";
@@ -132,7 +134,8 @@
int r;
r = ftdi_write_data(ftdic, (unsigned char *) buf, size);
if (r < 0) {
- msg_perr("ftdi_write_data: %d, %s\n", r, ftdi_get_error_string(ftdic));
+ msg_perr("ftdi_write_data: %d, %s\n", r,
+ ftdi_get_error_string(ftdic));
return 1;
}
return 0;
@@ -146,7 +149,8 @@
while (size > 0) {
r = ftdi_read_data(ftdic, (unsigned char *) buf, size);
if (r < 0) {
- msg_perr("ftdi_read_data: %d, %s\n", r, ftdi_get_error_string(ftdic));
+ msg_perr("ftdi_read_data: %d, %s\n", r,
+ ftdi_get_error_string(ftdic));
return 1;
}
buf += r;
@@ -183,8 +187,8 @@
enum ftdi_interface ft2232_interface = INTERFACE_A;
/*
* The 'H' chips can run with an internal clock of either 12 MHz or 60 MHz,
- * but the non-H chips can only run at 12 MHz. We enable the divide-by-5
- * prescaler on the former to run on the same speed.
+ * but the non-H chips can only run at 12 MHz. We disable the divide-by-5
+ * prescaler on 'H' chips so they run at 60MHz.
*/
uint8_t clock_5x = 1;
/* In addition to the prescaler mentioned above there is also another
@@ -193,7 +197,8 @@
* div = (1 + x) * 2 <-> x = div / 2 - 1
* Hence the expressible divisors are all even numbers between 2 and
* 2^17 (=131072) resulting in SCK frequencies of 6 MHz down to about
- * 92 Hz for 12 MHz inputs.
+ * 92 Hz for 12 MHz inputs and 30 MHz down to about 458 Hz for 60 MHz
+ * inputs.
*/
uint32_t divisor = DEFAULT_DIVISOR;
int f;
@@ -268,14 +273,17 @@
} else if (!strcasecmp(arg, "google-servo")) {
ft2232_vid = GOOGLE_VID;
ft2232_type = GOOGLE_SERVO_PID;
+ channel_count = 2;
} else if (!strcasecmp(arg, "google-servo-v2")) {
ft2232_vid = GOOGLE_VID;
ft2232_type = GOOGLE_SERVO_V2_PID1;
+ channel_count = 2;
/* Default divisor is too fast, and chip ID fails */
divisor = 6;
} else if (!strcasecmp(arg, "google-servo-v2-legacy")) {
ft2232_vid = GOOGLE_VID;
ft2232_type = GOOGLE_SERVO_V2_PID0;
+ channel_count = 2;
} else if (!strcasecmp(arg, "flyswatter")) {
ft2232_type = FTDI_FT2232H_PID;
channel_count = 2;
@@ -381,7 +389,8 @@
free(arg);
if (f < 0 && f != -5) {
- msg_perr("Unable to open FTDI device: %d (%s).\n", f, ftdi_get_error_string(ftdic));
+ msg_perr("Unable to open FTDI device: %d (%s)\n", f,
+ ftdi_get_error_string(ftdic));
return -4;
}
@@ -408,7 +417,7 @@
if (clock_5x) {
msg_pdbg("Disable divide-by-5 front stage\n");
- buf[0] = 0x8a; /* Disable divide-by-5. DIS_DIV_5 in newer libftdi */
+ buf[0] = DIS_DIV_5;
if (send_buf(ftdic, buf, 1)) {
ret = -5;
goto ftdi_err;
@@ -453,7 +462,8 @@
ftdi_err:
if ((f = ftdi_usb_close(ftdic)) < 0) {
- msg_perr("Unable to close FTDI device: %d (%s)\n", f, ftdi_get_error_string(ftdic));
+ msg_perr("Unable to close FTDI device: %d (%s)\n", f,
+ ftdi_get_error_string(ftdic));
}
return ret;
}
--
To view, visit https://review.coreboot.org/c/flashrom/+/42796
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I24c20e9b5d7e661d0180699bbd0d1447f6bf816f
Gerrit-Change-Number: 42796
Gerrit-PatchSet: 1
Gerrit-Owner: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-MessageType: newchange
Miklós Márton has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/43900 )
Change subject: [stlinkv3_spi]Added missing line ends, and added a note about the first version of the updater which contains the necessary V3 bridge feature.
......................................................................
[stlinkv3_spi]Added missing line ends, and added a note about the
first version of the updater which contains the necessary V3 bridge
feature.
Change-Id: Ib45efa37b192489bdfe26f1f0fd1d81035a08c70
Signed-off-by: Miklós Márton <martonmiklosqdev(a)gmail.com>
---
M stlinkv3_spi.c
1 file changed, 5 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/00/43900/1
diff --git a/stlinkv3_spi.c b/stlinkv3_spi.c
index ae865be..c75f7db 100644
--- a/stlinkv3_spi.c
+++ b/stlinkv3_spi.c
@@ -253,21 +253,22 @@
enum fw_version_check_result fw_check_result;
if (stlinkv3_check_version(&fw_check_result)) {
- msg_perr("Failed to query FW version");
+ msg_perr("Failed to query FW version\n");
return -1;
}
if (fw_check_result != FW_VERSION_OK) {
msg_pinfo("Your STLink V3 has too old version of the bridge interface\n"
- "Please update the firmware with the STSW-LINK007 which can be downloaded from here:\n"
- "https://www.st.com/en/development-tools/stsw-link007.html");
+ "Please update the firmware with version 2.33.25 or newer of the STSW-LINK007\n"
+ "which can be downloaded from here:\n"
+ "https://www.st.com/en/development-tools/stsw-link007.html\n");
return -1;
}
if (stlinkv3_spi_calc_prescaler(reqested_freq_in_kHz,
&prescaler,
&SCK_freq_in_kHz)) {
- msg_perr("Failed to calculate SPI clock prescaler");
+ msg_perr("Failed to calculate SPI clock prescaler\n");
return -1;
}
msg_pinfo("SCK frequency set to %d kHz\n", SCK_freq_in_kHz);
--
To view, visit https://review.coreboot.org/c/flashrom/+/43900
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ib45efa37b192489bdfe26f1f0fd1d81035a08c70
Gerrit-Change-Number: 43900
Gerrit-PatchSet: 1
Gerrit-Owner: Miklós Márton <martonmiklosqdev(a)gmail.com>
Gerrit-MessageType: newchange
Simon Buhrow has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/40477 )
Change subject: ft2232_spi.c: Pack WREN and op in one ftdi_write_data() call
......................................................................
Patch Set 14:
Just a try to show what effect the change has:
To do one PageProgram the Flash needs the following cmds/information (PROG=PageProgramCmd):
Flash-Cmds: JEDEC_WREN + PROG + ADDR + DATA
As flashrom communicates with the FTDI, there are additional FTDI-cmds necessary, of course.
This gives the following calls:
ft2232_spi_send_command(XX, XX, ['JEDEC_WREN'], XX)
before: -> send_buf(XX, [FTDI-CMD + 'JEDEC_WREN' + FTDI-CMD], 10)
now: -> save i and buf as they are static, no further function call; buf = [FTDI-CMD + 'JEDEC_WREN' + FTDI-CMD]
ft2232_spi_send_command(XX, XX, ['PROG', 'ADDR', 'DATA'], XX)
before: -> send_buf(XX, [FTDI-CMD + 'PROG' + 'ADDR' + 'DATA' + FTDI-CMD], 270)
now: -> send_buf(XX, [FTDI-CMD + 'JEDEC_WREN' + FTDI-CMD + FTDI-CMD + 'PROG' + 'ADDR' + 'DATA' + FTDI-CMD], 280)
=> saves one send_buf/ftdi_write_data call every page-program or erase action.
--
To view, visit https://review.coreboot.org/c/flashrom/+/40477
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ie4a07499ec5ef0af23818593f45dc427285a9e8a
Gerrit-Change-Number: 40477
Gerrit-PatchSet: 14
Gerrit-Owner: Simon Buhrow
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-CC: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Comment-Date: Mon, 27 Jul 2020 14:16:39 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/43895 )
Change subject: ichspi.c: Take chromiums flash desc sec override msg
......................................................................
ichspi.c: Take chromiums flash desc sec override msg
Line wrapped and a little more descriptive.
Change-Id: I1043bed042f5507788ed2b417bd44d0fe3dc0aa6
Signed-off-by: Edward O'Callaghan <quasisec(a)google.com>
---
M ichspi.c
1 file changed, 5 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/95/43895/1
diff --git a/ichspi.c b/ichspi.c
index 1cc1cd7..d9f13ef 100644
--- a/ichspi.c
+++ b/ichspi.c
@@ -1849,9 +1849,11 @@
if (tmp2 & HSFS_FDV)
desc_valid = 1;
if (!(tmp2 & HSFS_FDOPSS) && desc_valid)
- msg_pinfo("The Flash Descriptor Override Strap-Pin is set. Restrictions implied by\n"
- "the Master Section of the flash descriptor are NOT in effect. Please note\n"
- "that Protected Range (PR) restrictions still apply.\n");
+ msg_pinfo("The Flash Descriptor Security Override "
+ "Strap-Pin is set. Restrictions implied\n"
+ "by the FRAP and FREG registers are NOT in "
+ "effect. Please note that Protected\n"
+ "Range (PR) restrictions still apply.\n");
ich_init_opcodes(ich_gen);
if (desc_valid) {
--
To view, visit https://review.coreboot.org/c/flashrom/+/43895
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I1043bed042f5507788ed2b417bd44d0fe3dc0aa6
Gerrit-Change-Number: 43895
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-MessageType: newchange
David Hendricks has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/43599 )
Change subject: meson: fix compilation under uClibc-ng
......................................................................
meson: fix compilation under uClibc-ng
fileno requires _POSIX_C_SOURCE to only be defined.
nanosleep requires _POSIX_C_SOURCE to be defined to 199309L.
strndup requires _POSIX_C_SOURCE to be defined to 200809L.
Change-Id: Idb80937bb78e173eb03f2a0c0cdd8925fcd7bfa1
Signed-off-by: Rosen Penev <rosenp(a)gmail.com>
---
M meson.build
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/99/43599/1
diff --git a/meson.build b/meson.build
index 5374e87..ef7ac2c 100644
--- a/meson.build
+++ b/meson.build
@@ -25,7 +25,7 @@
cc = meson.get_compiler('c')
add_project_arguments(cc.get_supported_arguments(warning_flags), language : 'c')
add_project_arguments('-D_DEFAULT_SOURCE', language : 'c')
-add_project_arguments('-D_POSIX_C_SOURCE', language : 'c') # required for fileno
+add_project_arguments('-D_POSIX_C_SOURCE=200809L', language : 'c') # required for fileno, nanosleep, and strndup
add_project_arguments('-D_BSD_SOURCE', language : 'c') # required for glibc < v2.19
add_project_arguments('-DFLASHROM_VERSION="' + meson.project_version() + '"', language : 'c')
--
To view, visit https://review.coreboot.org/c/flashrom/+/43599
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Idb80937bb78e173eb03f2a0c0cdd8925fcd7bfa1
Gerrit-Change-Number: 43599
Gerrit-PatchSet: 1
Gerrit-Owner: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-MessageType: newchange
David Hendricks has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/43598 )
Change subject: endiantest: Fix #if expression
......................................................................
endiantest: Fix #if expression
Without this, `gcc -E endiantest.c` can fail and return the incorrect
endiannes as well as exiting with non-zero. Here is the actual error
shown in the output:
endiantest.c:2:31: error: #if with no expression
#if __FLASHROM_LITTLE_ENDIAN__
I was able to reproduce this using gcc-6.3.0 and clang-4.0.1, but
newer compilers didn't have this issue.
Change-Id: Iba2febd861471ec821a494336e800c2564984332
Signed-off-by: David Hendricks <david.hendricks(a)gmail.com>
---
M endiantest.c
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/98/43598/1
diff --git a/endiantest.c b/endiantest.c
index de44ec5..9766061 100644
--- a/endiantest.c
+++ b/endiantest.c
@@ -1,5 +1,5 @@
#include "platform.h"
-#if __FLASHROM_LITTLE_ENDIAN__
+#if defined __FLASHROM_LITTLE_ENDIAN__
little
#else
big
--
To view, visit https://review.coreboot.org/c/flashrom/+/43598
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Iba2febd861471ec821a494336e800c2564984332
Gerrit-Change-Number: 43598
Gerrit-PatchSet: 1
Gerrit-Owner: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-MessageType: newchange