On Mon, 9 May 2016 20:46:18 -0700
David Hendricks <dhendrix(a)google.com> wrote:
> Hi Victor,
> From Flashrom's software perspective all chips with the same ID are
> indistinguishable.
>
> Part number often includes characteristics such as package and thermal
> tolerance which do not affect software compatibility.
However, we will add the new names to the in-program (and hence
wiki) database so that this new information becomes public. Thanks for
the heads up, Victor.
--
Kind regards/Mit freundlichen Grüßen, Stefan Tauner
Hi,
we're hitting the 80 column limit in our code in ways which actually
reduce readability for the code. Examples are various multiline messages
and complicated nested code where refactoring to a separate function
doesn't make sense.
Keeping the old 80 column limit is not really an option anymore.
Standard terminal sizes have one of 80, 100 or 132 columns.
Given the monitor resolutions many people have nowadays, I think it is
safe to say that you can fit two xterms with 100 columns horizonally
next to each other. 100 columns should also be sufficient for a msg_p*
of roughly 80 columns of text.
132 columns provide more leeway, but IMHO that would be too wide for
good readability (and my screen can't fit two xterms side-by-side anymore).
Of course some files have sections where any column limit is not
acceptable (board lists etc.), but the column limit violations should be
limited to the affected file sections, not whole files.
Comments?
I'd like to get this decided today or tomorrow so we know where we need
line breaks in Stefan Tauner's new struct flashchip patch.
Regards,
Carl-Daniel
--
http://www.hailfinger.org/
I have a spansion S25FL128P......X chip and can do some tests.
The "problem" is that i don't know if its an 0 or an 1.
On the chip i see only "FL128PIF" and one line lower i see "00299012 C".
Probing works (id1 0x01, id2 0x2018):
Calibrating delay loop... OK.
serprog: Programmer name is "serprog-duino"
Found Spansion flash chip "S25FL128P......0" (16384 kB, SPI) on serprog.
Found Spansion flash chip "S25FL128P......1" (16384 kB, SPI) on serprog.
Found Spansion flash chip "S25FL128S......0" (16384 kB, SPI) on serprog.
Found Spansion flash chip "S25FL128S......1" (16384 kB, SPI) on serprog.
Found Spansion flash chip "S25FL129P......0" (16384 kB, SPI) on serprog.
Found Spansion flash chip "S25FL129P......1" (16384 kB, SPI) on serprog.
Multiple flash chip definitions match the detected chip(s):
"S25FL128P......0", "S25FL128P......1", "S25FL128S......0",
"S25FL128S......1", "S25FL129P......0", "S25FL129P......1"
Please specify which chip definition to use with the -c <chipname> option.
BTW: Chip was fund on a Dell-Systemboard.
flashrom v0.9.7-r1850 on Linux 4.9.4-201.fc25.x86_64 (x86_64)
flashrom is free software, get the source code at http://www.flashrom.org
flashrom was built with libpci 3.4.1, GCC 6.0.0 20160201 (Red Hat
6.0.0-0.9), little endian
Command line (3 args): flashrom -V -p internal
Calibrating delay loop... OS timer resolution is 2 usecs, 370M loops per
second, 10 myus = 10 us, 100 myus = 132 us, 1000 myus = 1015 us, 10000
myus = 13591 us, 8 myus = 13 us, OK.
Initializing internal programmer
No coreboot table found.
Using External DMI decoder.
DMI string chassis-type: "Notebook"
Laptop detected via DMI.
DMI string system-manufacturer: "Hewlett-Packard"
DMI string system-product-name: "HP Mini 110-3100 "
DMI string system-version: "058F110000202B00000300100"
DMI string baseboard-manufacturer: "Hewlett-Packard"
DMI string baseboard-product-name: "148A"
DMI string baseboard-version: "79.49"
W836xx enter config mode worked or we were already in config mode.
W836xx leave config mode had no effect.
Active config mode, unknown reg 0x20 ID: 85.
Please send the output of "flashrom -V -p internal" to
flashrom(a)flashrom.org with W836xx: your board name: flashrom -V
as the subject to help us finish support for your Super I/O. Thanks.
Found ITE EC, ID 0x8500, Rev 0x01 on port 0x4e.
========================================================================
WARNING! You seem to be running flashrom on an unsupported laptop.
Laptops, notebooks and netbooks are difficult to support and we
recommend to use the vendor flashing utility. The embedded controller
(EC) in these machines often interacts badly with flashing.
See the manpage and http://www.flashrom.org/Laptops for details.
If flash is shared with the EC, erase is guaranteed to brick your laptop
and write may brick your laptop.
Read and probe may irritate your EC and cause fan failure, backlight
failure and sudden poweroff.
You have been warned.
========================================================================
Aborting.
Error: Programmer initialization failed.
I know that in general we should be able to build flashrom for windows. From previous posts it looks like the https://www.flashrom.org/Windows page is out of date. But I have a few questions on how to proceed:
1. Has anyone had luck with building a working flashrom for windows with one of the newer versions (flashrom 0.9.7 or later...) and preferably newer libusb 1.0 and libftdi 1.0?
2. Is there any reason to think the build task would be easier on linux crosscompiling for windows rather than building thru mingw on windows?
Any helpful recommendations appreciated.
Thanks,
-Phil
> >
> > - libusb_set_debug(NULL, 3); // Enable information, warning and error messages (only).
> > + libusb_set_debug(NULL, 4); // Enable information, warning and error messages (only).
> >
> Was this supposed to be a part of this patch? ;)
Ah no, of course not. Was doing some debugging and forgot to set it back ;).
Thanks for catching that.
My programmer with this chip has a jumper to select between
USB <-> UART translation and USB <-> SPI translation. Only the latter
is applicable for use as an SPI programmer of course, but it's an
easy and non-obvious mistake to make. The UART mode (and a printer mode
not exposed on my programmer, but available on the chip according
to the datasheet), are indicated through different USB IDs, which we
can easily detect. Do so, and print an informative warning when
such a device is detected.
Signed-off-by: Keno Fischer <keno(a)juliacomputing.com>
---
ch341a_spi.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 54 insertions(+), 5 deletions(-)
diff --git a/ch341a_spi.c b/ch341a_spi.c
index 6eb2804..7eba6b1 100644
--- a/ch341a_spi.c
+++ b/ch341a_spi.c
@@ -93,6 +93,16 @@ const struct dev_entry devs_ch341a_spi[] = {
{0},
};
+/* The CH341A has alternate modes, indicated as different USB device IDs and
+ * generally selectible on programmers via jumpers. Those alternate modes are
+ * unsuitable for use as a programmer, but we want to be able to detect them,
+ * to give a nice error message to the user. */
+const struct dev_entry devs_ch341a_spi_alternate[] = {
+ {0x1A86, 0x5523, OK, "Winchiphead (WCH)", "CH341A Serial"},
+ {0x1A86, 0x5584, OK, "Winchiphead (WCH)", "CH341A Printer"},
+ {0},
+};
+
enum trans_state {TRANS_ACTIVE = -2, TRANS_ERR = -1, TRANS_IDLE = 0};
static void print_hex(const void *buf, size_t len)
@@ -431,6 +441,47 @@ static int ch341a_spi_shutdown(void *data)
return 0;
}
+static bool device_matches(const struct libusb_device_descriptor *desc, const struct dev_entry *entry)
+{
+ return desc->idVendor == entry->vendor_id && desc->idProduct == entry->device_id;
+}
+
+static struct libusb_device_handle *ch341a_find_device()
+{
+ struct libusb_device *dev, **devs;
+ struct libusb_device_handle *dev_handle = NULL;
+ size_t i = 0;
+
+ if (libusb_get_device_list(NULL, &devs) < 0)
+ return dev_handle;
+
+ while ((dev = devs[i++]) != NULL) {
+ struct libusb_device_descriptor desc;
+ const struct dev_entry *entry;
+ if (libusb_get_device_descriptor(dev, &desc) < 0)
+ goto out;
+ for (entry = devs_ch341a_spi_alternate; entry->vendor_id != 0; ++entry) {
+ if (device_matches(&desc, entry)) {
+ msg_pwarn("CH341A device in alternate mode detected.\n"
+ "There may be a jumper on your programmer to switch modes.\n");
+ }
+ }
+ for (entry = devs_ch341a_spi; entry->vendor_id != 0; ++entry) {
+ if (device_matches(&desc, entry)) {
+ if (dev_handle) {
+ msg_pwarn("Multiple CH341A devices detected. Selecting the first.\n");
+ goto out;
+ }
+ libusb_open(dev, &dev_handle);
+ }
+ }
+ }
+
+out:
+ libusb_free_device_list(devs, 1);
+ return dev_handle;
+}
+
int ch341a_spi_init(void)
{
if (handle != NULL) {
@@ -444,13 +495,11 @@ int ch341a_spi_init(void)
return -1;
}
- libusb_set_debug(NULL, 3); // Enable information, warning and error messages (only).
+ libusb_set_debug(NULL, 4); // Enable information, warning and error messages (only).
- uint16_t vid = devs_ch341a_spi[0].vendor_id;
- uint16_t pid = devs_ch341a_spi[0].device_id;
- handle = libusb_open_device_with_vid_pid(NULL, vid, pid);
+ handle = ch341a_find_device();
if (handle == NULL) {
- msg_perr("Couldn't open device %04x:%04x.\n", vid, pid);
+ msg_perr("No usable CH341A USB device found.\n");
return -1;
}
--
1.7.10.4