There are some programmer_delay values in ichspi.c, here is one which says
something about frequency:

timeout = 100 * 60; /* 60 ms are 9.6 million cycles at 16 MHz. */
while ((REGREAD16(ICH7_REG_SPIS) & SPIS_SCIP) && --timeout) {
programmer_delay(10);

So I just need to increase programmer_delay, for example to 20 and maybe
the timeout to 200 * 60?

I can try another method too as the KB9012 datasheet says "To enable EDI,
it is by detecting any SPI command with EDI_CLK frequency between 1MHz to 8
MHz.", so maybe after probing with flashrom in DIP8 socket, and connecting
it to rayer_spi LPT it will detect and flash KB9012 correctly with lower
SPI frequency.

And yes, I know getting a CH341A would be the easiest way to solve my
problem, but I'm currently not at home, so I should wait with it for some
months, that's a long story. :/ I'm just trying what I can do to spend the
waiting time useful and maybe as result with solving this earlier.

Mike Banon <[email protected]> ezt írta (időpont: 2019. jan. 20., V, 9:39):

> Maybe try inserting some extra programmer_delay(n) to your ichspi.c ?
> Also I had a patch for the unreliable flashing environments -
> https://review.coreboot.org/c/flashrom/+/23840 - but didn't improve it
> yet so it haven't been merged, and already incompatible with the
> latest flashrom. Also maybe it doesn't affect KB9012 if its' flashing
> functions are different, but maybe it could be useful somehow. Still I
> hope that you've already ordered that CH341A since it costs very
> cheap, just $2-$3, and could save a lot of your time.
>
> On Sun, Jan 20, 2019 at 3:35 AM Nyúlós Lónyál <[email protected]>
> wrote:
> >
> > Thanks for replying at my noob questions. :) The spispeed parameter,
> yea, I thought about it after looking into flashrom's source on GitHub.
> Sadly it's not in the code of ICH7 chipset (ichspi.c), so the spispeed
> option in flashrom command is unavailable. Someone already did that for AMD
> SB600 chipset (sb600spi.c), found a link about it:
> https://mail.coreboot.org/pipermail/flashrom/2013-August/011410.html
> >
> > I don't know much about C programming language, so I can't transform
> that code for ICH7. I have no more ideas, maybe it's possible to modify the
> default SPI frequency in ichspi.c, I'm not sure.
> >
> > Mike Banon <[email protected]> ezt írta (időpont: 2019. jan. 19., Szo,
> 23:25):
> >>
> >> Sorry for a long reply, I just watched your video and - unless you
> >> changed its' speed - it seems to me that your KB9012 operations are
> >> going faster than expected, e.g. it reached 0x4*** address almost
> >> instantly while in my CH341A case it was almost certainly slower. So
> >> maybe you could experiment with spispeed parameter, like flashrom -p
> >> internal:spispeed=frequency , please look it up online ( I can't at
> >> the moment )
> >>
> >>
> >> On Wed, Jan 16, 2019 at 5:01 PM Nyúlós Lónyál <
> [email protected]> wrote:
> >> >
> >> > Same problem with 5cm long copper wires. Here is a video of what's
> happening: https://www.youtube.com/watch?v=JlbRGK9_gPg
> >> >
> >> > Nyúlós Lónyál <[email protected]> ezt írta (időpont: 2019.
> jan. 16., Sze, 1:38):
> >> >>
> >> >> The wires are ~20-25cm made of aluminium, but I have some broken USB
> cables with copper wires. I can reduce the distance of laptop's keyboard
> connector and DIP8 socket to about 5cm wire length, will give it a try
> tomorrow. And something that I've noticed at verifying with flashrom, it
> always gives a random hex number after "failed byte count from
> 0x00000000-0x0001ffff". Maybe the "Timed out waiting for SPI not busy!"
> error is caused by the wires too. Thanks for the idea, I will reply back
> with results.
> >> >>
> >> >> Mike Banon <[email protected]> ezt írta (időpont: 2019. jan. 16.,
> Sze, 1:09):
> >> >>>
> >> >>> Sorry if I've already asked this question, but how long are your
> >> >>> wires? Ideally they should be about 10cm length and made of good
> >> >>> copper. Although it could work even for 30cm poor aluminum wires,
> >> >>> still when there are read/write errors - the first suggestion which
> >> >>> comes to my mind is to shorten the wires. I understand that it could
> >> >>> be difficult to use short wires at your flashing setup, but hope it
> is
> >> >>> possible for you to try. And also I hope that you've ordered CH341A
> >> >>> just in case our suggestions wouldn't work.
> >> >>> > The laptop can't boot, doesn't even react to power button or
> recovery key combination, and no charging LED lighting up
> >> >>> Everything from this list is expected if there is a corrupted KB9012
> >> >>> firmware, because it is KB9012 which listens for your power button
> >> >>> keypresses / controls the LEDs / etc
> >> >>>
> >> >>> On Tue, Jan 15, 2019 at 2:44 PM Nyúlós Lónyál <
> [email protected]> wrote:
> >> >>> >
> >> >>> > Sorry for the confusion. :( I think you have misunderstood me.
> >> >>> >
> >> >>> > My laptop's motherboard is taken out of the laptop. I have
> another machine, a desktop PC which I've used for trying rayer_spi
> programmer. Now I connect the laptop's KB9012's debug pins into the desktop
> PC motherboard's DIP8 BIOS socket with wires, after it booted the linux
> distribution with flashrom installed and removing it's original BIOS SPI
> chip. The two machine's GND, DIP8 socket's GND, and KB9012's pin 42 are
> united.
> >> >>> >
> >> >>> > Like when recovering a regular motherboard BIOS with hot-swapping
> chips, just the only difference I connect the laptop's KBC instead of
> another BIOS chip: https://www.coreboot.org/FAQ#Developers
> >> >>> >
> >> >>> > I think the desktop motherboard's BIOS socket can be used as an
> SPI programmer this way, originally it has W25Q80BVAIG DIP8 chip which can
> be removed. That gave me these results, read and write errors which I sent
> before, but at least it can detect KB9012. I've tested with the original
> BIOS chip, flashrom can read, erase, and write it. The motherboard is an
> Asrock G41C-GS first generation, rev 1.0.2.
> >> >>> >
> >> >>> > The laptop can't boot, doesn't even react to power button or
> recovery key combination, and no charging LED lighting up, since it got
> bricked with a wrong BIOS update, this is why I want to reflash KB9012 with
> an external tool, like the desktop PC motherboard's DIP8 socket.
> >> >>> >
> >> >>> > Mike Banon <[email protected]> ezt írta (időpont: 2019. jan.
> 14., H, 22:43):
> >> >>> >>
> >> >>> >> That is because KB9012 is active after your laptop has booted
> and not
> >> >>> >> in debug state where it is possible to reflash it without a
> problem.
> >> >>> >>
> >> >>> >> Have you double checked your laptop's datasheet to make sure your
> >> >>> >> connection is correct, and also that your laptop's corner ground
> is
> >> >>> >> really connected to its' ground? (what if not all its' copper
> circles
> >> >>> >> are the grounds in your case)
> >> >>> >>
> >> >>> >> On Fri, Jan 11, 2019 at 5:01 PM Nyúlós Lónyál <
> [email protected]> wrote:
> >> >>> >> >
> >> >>> >> > Sorry for double mail. Erasing and writing fails too.
> >> >>> >> >
> >> >>> >> > xubuntu@xubuntu:~/flashrom$ sudo ./flashrom -p internal -c
> "KB9012 (EDI)" -w /home/xubuntu/Desktop/EC-FD-Extract.bin
> >> >>> >> > flashrom p1.0-141-g9cecc7e on Linux 4.15.0-20-generic (x86_64)
> >> >>> >> > flashrom is free software, get the source code at
> https://flashrom.org
> >> >>> >> >
> >> >>> >> > Using clock_gettime for delay loops (clk_id: 1, resolution:
> 1ns).
> >> >>> >> > Found chipset "Intel ICH7/ICH7R".
> >> >>> >> > Enabling flash write... OK.
> >> >>> >> > edi_read: Retrying read with greater buffer length!
> >> >>> >> > edi_read: Retrying read with greater buffer length!
> >> >>> >> > Found ENE flash chip "KB9012 (EDI)" (128 kB, SPI) mapped at
> physical address 0x00000000fffe0000.
> >> >>> >> > Reading old flash chip contents... done.
> >> >>> >> > Erasing and writing flash chip... edi_chip_block_erase: Timed
> out waiting for SPI not busy!
> >> >>> >> > Reading current flash chip contents... done. Looking for
> another erase function.
> >> >>> >> > Looking for another erase function.
> >> >>> >> > Looking for another erase function.
> >> >>> >> > Looking for another erase function.
> >> >>> >> > Looking for another erase function.
> >> >>> >> > Looking for another erase function.
> >> >>> >> > Looking for another erase function.
> >> >>> >> > No usable erase functions left.
> >> >>> >> > FAILED!
> >> >>> >> > Uh oh. Erase/write failed. Checking if anything has changed.
> >> >>> >> > Reading current flash chip contents... done.
> >> >>> >> > Apparently at least some data has changed.
> >> >>> >> > Your flash chip is in an unknown state.
> >> >>> >> > Get help on IRC at chat.freenode.net (channel #flashrom) or
> >> >>> >> > mail [email protected] with the subject "FAILED: <your
> board name>"!
> >> >>> >> >
> -------------------------------------------------------------------------------
> >> >>> >> > DO NOT REBOOT OR POWEROFF!
> >> >>> >> >
> >> >>> >> > xubuntu@xubuntu:~/flashrom$ sudo ./flashrom -p internal -c
> "KB9012 (EDI)" -E
> >> >>> >> > flashrom p1.0-141-g9cecc7e on Linux 4.15.0-20-generic (x86_64)
> >> >>> >> > flashrom is free software, get the source code at
> https://flashrom.org
> >> >>> >> >
> >> >>> >> > Using clock_gettime for delay loops (clk_id: 1, resolution:
> 1ns).
> >> >>> >> > Found chipset "Intel ICH7/ICH7R".
> >> >>> >> > Enabling flash write... OK.
> >> >>> >> > edi_read: Retrying read with greater buffer length!
> >> >>> >> > edi_read: Retrying read with greater buffer length!
> >> >>> >> > Found ENE flash chip "KB9012 (EDI)" (128 kB, SPI) mapped at
> physical address 0x00000000fffe0000.
> >> >>> >> > Erasing and writing flash chip... edi_chip_block_erase: Timed
> out waiting for SPI not busy!
> >> >>> >> > Looking for another erase function.
> >> >>> >> > Looking for another erase function.
> >> >>> >> > Looking for another erase function.
> >> >>> >> > Looking for another erase function.
> >> >>> >> > Looking for another erase function.
> >> >>> >> > Looking for another erase function.
> >> >>> >> > Looking for another erase function.
> >> >>> >> > No usable erase functions left.
> >> >>> >> > FAILED!
> >> >>> >> > Your flash chip is in an unknown state.
> >> >>> >> > Get help on IRC at chat.freenode.net (channel #flashrom) or
> >> >>> >> > mail [email protected] with the subject "FAILED: <your
> board name>"!
> >> >>> >> >
> -------------------------------------------------------------------------------
> >> >>> >> > DO NOT REBOOT OR POWEROFF!
> >> >>> >> >
> >> >>> >> > Nyúlós Lónyál <[email protected]> ezt írta (időpont:
> 2019. jan. 11., P, 13:49):
> >> >>> >> >>
> >> >>> >> >> Finally managed it to detect KBC's internal flash using the
> motherboard's BIOS socket with removing it's SPI chip after boot, and
> connecting KB9012 in there. But the read always gives me different files,
> so I can't backup the current content of KB9012.
> >> >>> >> >>
> >> >>> >> >> xubuntu@xubuntu:~/flashrom$ sudo ./flashrom -p internal -c
> "KB9012 (EDI)" -r /home/xubuntu/Desktop/ene1.bin
> >> >>> >> >> flashrom p1.0-141-g9cecc7e on Linux 4.15.0-20-generic (x86_64)
> >> >>> >> >> flashrom is free software, get the source code at
> https://flashrom.org
> >> >>> >> >>
> >> >>> >> >> Using clock_gettime for delay loops (clk_id: 1, resolution:
> 1ns).
> >> >>> >> >> Found chipset "Intel ICH7/ICH7R".
> >> >>> >> >> Enabling flash write... OK.
> >> >>> >> >> edi_read: Retrying read with greater buffer length!
> >> >>> >> >> edi_read: Retrying read with greater buffer length!
> >> >>> >> >> Found ENE flash chip "KB9012 (EDI)" (128 kB, SPI) mapped at
> physical address 0x00000000fffe0000.
> >> >>> >> >> Reading flash... done.
> >> >>> >> >> xubuntu@xubuntu:~/flashrom$ sudo ./flashrom -p internal -c
> "KB9012 (EDI)" -v /home/xubuntu/Desktop/ene1.bin
> >> >>> >> >> flashrom p1.0-141-g9cecc7e on Linux 4.15.0-20-generic (x86_64)
> >> >>> >> >> flashrom is free software, get the source code at
> https://flashrom.org
> >> >>> >> >>
> >> >>> >> >> Using clock_gettime for delay loops (clk_id: 1, resolution:
> 1ns).
> >> >>> >> >> Found chipset "Intel ICH7/ICH7R".
> >> >>> >> >> Enabling flash write... OK.
> >> >>> >> >> edi_read: Retrying read with greater buffer length!
> >> >>> >> >> edi_read: Retrying read with greater buffer length!
> >> >>> >> >> Found ENE flash chip "KB9012 (EDI)" (128 kB, SPI) mapped at
> physical address 0x00000000fffe0000.
> >> >>> >> >> Verifying flash... FAILED at 0x000034c2! Expected=0xff,
> Found=0x78, failed byte count from 0x00000000-0x0001ffff: 0x6c52
> >> >>> >> >>
> >> >>> >> >>
> >> >>> >> >> Nyúlós Lónyál <[email protected]> ezt írta (időpont:
> 2019. jan. 10., Cs, 12:14):
> >> >>> >> >>>
> >> >>> >> >>> Yea, tried to discharge the motherboard, taken out CMOS
> battery too, it didn't help. I don't know if this is programmer related or
> not, I have reflashed 2 types of BIOS SPI chips with it, EN25QH16 and
> W25Q32BV. But these chips are maybe different from KB9012's debug
> interface. I can't get a CH341A for now, maybe some months later. It would
> be good to recover the laptop if it's possible with the tools I have
> currently, but not very urgent. Here is the programmer's config, if it
> helps: https://github.com/flashrom/flashrom/blob/master/rayer_spi.c
> >> >>> >> >>>
> >> >>> >> >>> Mike Banon <[email protected]> ezt írta (időpont: 2019.
> jan. 9., Sze, 18:59):
> >> >>> >> >>>>
> >> >>> >> >>>> Just to double-check: please discharge the motherboard
> completely by
> >> >>> >> >>>> trying to turn it on while there is no power adapter
> connected, then
> >> >>> >> >>>> unite three grounds (KB9012 / programmer / motherboard )
> and only then
> >> >>> >> >>>> connect the board's power adapter . After doing all that,
> please check
> >> >>> >> >>>> if you could read it now. Also, what if your issues are
> programmer
> >> >>> >> >>>> related? Is it possible for you to try another programmer,
> like CH341A
> >> >>> >> >>>> ? (because it costs like $2-$3 with free shipping from
> china, just
> >> >>> >> >>>> prefer to get a green PCB version because there were some
> 3.3/5V
> >> >>> >> >>>> issues with some black PCB CH341A , and blue PCB version
> costs the
> >> >>> >> >>>> same low price while having fewer pins) Or maybe you could
> get it
> >> >>> >> >>>> locally for a (hopefully) small premium if you're in hurry
> >> >>> >> >>>>
> >> >>> >> >>>> On Wed, Jan 9, 2019 at 3:20 PM Nyúlós Lónyál <
> [email protected]> wrote:
> >> >>> >> >>>> >
> >> >>> >> >>>> > Hi Mike!
> >> >>> >> >>>> >
> >> >>> >> >>>> > I've followed the linked guide, it gave me these results.
> The grounds are united, still the same error happens. I have tried to GND
> pin 42 of KB9012 as mentioned in the guide, and tried to connect both pin
> 41 and 42 to GND, as in KBC's datasheet at EDI related part, still no
> success, flashrom doesn't detect it.
> >> >>> >> >>>> >
> >> >>> >> >>>> > Mike Banon <[email protected]> ezt írta (időpont: 2019.
> jan. 8., K, 16:08):
> >> >>> >> >>>> >>
> >> >>> >> >>>> >> Hi Nyulos,
> >> >>> >> >>>> >> Have you tried following the KB9012 flashing
> instructions at
> >> >>> >> >>>> >> DangerousPrototypes wiki?
> >> >>> >> >>>> >>
> http://dangerousprototypes.com/docs/Flashing_KB9012_with_Bus_Pirate
> >> >>> >> >>>> >> Although that is for Bus Pirate / CH341A programmers and
> LA-A091P,
> >> >>> >> >>>> >> should be similar for your Rayer programmer and LA-8241P
> motherboard.
> >> >>> >> >>>> >> Most importantly, before plugging the power adapter you
> should unite
> >> >>> >> >>>> >> three grounds:
> >> >>> >> >>>> >> 1) GND of laptop's motherboard
> >> >>> >> >>>> >> 2) GND of your programmer
> >> >>> >> >>>> >> 3) GND of KB9012
> >> >>> >> >>>> >> Best regards,
> >> >>> >> >>>> >> Mike Banon
> >> >>> >> >>>> >>
> >> >>> >> >>>> >> On Tue, Jan 8, 2019 at 3:30 PM Nyúlós Lónyál <
> [email protected]> wrote:
> >> >>> >> >>>> >> >
> >> >>> >> >>>> >> > Hi!
> >> >>> >> >>>> >> >
> >> >>> >> >>>> >> > I'm trying to flash an ENE KB9012QF A3 KBC on LA-8241P
> motherboard. The problem is flashrom can't detect the internal SPI of it,
> fails with error.
> >> >>> >> >>>> >> >
> >> >>> >> >>>> >> > flashrom p1.0-141-g9cecc7e on Linux 4.15.0-20-generic
> (x86_64)
> >> >>> >> >>>> >> > flashrom is free software, get the source code at
> https://flashrom.org
> >> >>> >> >>>> >> >
> >> >>> >> >>>> >> > flashrom was built with libpci 3.5.2, GCC 7.3.0,
> little endian
> >> >>> >> >>>> >> > Command line (5 args): ./flashrom -p rayer_spi -c
> KB9012 (EDI) -V
> >> >>> >> >>>> >> > Using clock_gettime for delay loops (clk_id: 1,
> resolution: 1ns).
> >> >>> >> >>>> >> > Initializing rayer_spi programmer
> >> >>> >> >>>> >> > Using address 0x378 as I/O base for parallel port
> access.
> >> >>> >> >>>> >> > Using RayeR SPIPGM pinout.
> >> >>> >> >>>> >> > The following protocols are supported: SPI.
> >> >>> >> >>>> >> > Probing for ENE KB9012 (EDI), 128 kB: edi_chip_probe:
> reading hwversion failed
> >> >>> >> >>>> >> > No EEPROM/flash device found.
> >> >>> >> >>>> >> > Note: flashrom can never write if the flash chip isn't
> found automatically.
> >> >>> >> >>>> >> >
> >> >>> >> >>>> >> > How to get it working? Thanks a lot for help!
> >> >>> >> >>>> >> > _______________________________________________
> >> >>> >> >>>> >> > flashrom mailing list -- [email protected]
> >> >>> >> >>>> >> > To unsubscribe send an email to
> [email protected]
>
_______________________________________________
flashrom mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to