Add SPI support to serprog protocol.
Signed-off-by: Urja Rannikko urjaman@gmail.com
-- Urja Rannikko
hey there and thanks for your patch!
all in all the patch looks ok. the only really problem i see is the opbuf stuff (see details below).
for the record: we now have 2,5 implementations of this laying around (this, Juhana Helovuo's http://www.coreboot.org/InSystemFlasher and my derivative of that). mine includes a command line argument to set the spi frequency which is mapped to another opcode; the rest is almost the same.
On Sun, 15 May 2011 06:58:19 +0300 Urja Rannikko urjaman@gmail.com wrote:
space after ',' imho
those fields are not to indicate limitations of the flash chip but limits of the programmers themselves. since we just relay any spi streams sent, we probably dont need a buffer on the microcontroller or whatever is behind. i would just drop the comment.
you make the read and write commands optional in spi mode and keep them mandatory in non-spi mode, but the opbuf stuff remains mandatory in all modes. why? imho they should also be moved into the "if (buses_supported & CHIP_BUSTYPE_NONSPI)" branch.
i detest single line ifs and fors, but besides that this fixes an unrelated bug (not sure if that's good or bad)
spaces instead of tabs
spaces instead of tabs
what's the purpose of this?
i detest single line ifs
missing spaces after ','s (and i like "parmbuf+6" more).
ok
Meh, I'll change this stuff (just got a better idea for this).
Opbuf is always used to implement the delay command, thus it is always needed.
This has propably creeped in accidentally, I can split it elsewhere, but is that needed?
ok
ok
It will execute anything left behind in the opbuf (just delays if we are in SPI mode) before doing the SPI operation.
ok ( I tend to have a very tight coding style and can't notice these things at all.... :/ )
hey urja!
coding style: the tabs are certainly to be used according to the official coreboot rules, but the rest is just my personal view. i am not sure how the other devs think about it.
opbuf/delay: what's the use of this in spi mode? i dont see why this is needed at all.
patch split: dunno. it might be overlooked if the rest is not committed. therefore i explicitly mentioned this in case someone with commit rights reads the review ;)
Hi,
opbuf/delay: what's the use of this in spi mode? i dont see why this is needed at all.
Well, programmer_delay can be used anywhere in flashrom, and I dont see a need to limit that. I could make it so that these commands are optional if the programmer only supports SPI, and if they are not supported serprog_delay would call internal_delay ?
On Mon, 16 May 2011 16:52:57 +0300 Urja Rannikko urjaman@gmail.com wrote:
if the opbuf stuff is mandatory the firmware of the external programmers would need to implement it although it is never used for spi programming. i would check for S_CMD_O_DELAY support at the start of serprog_delay. what to do if there is no support? calling internal_delay is probably the best option, maybe also issuing a warning or at least a debug message? just issuing a warning in returning would be ok with me too. it should not happen in the current code anyway. *shrug*
the other opbuf stuff should also be optional imho, but if this is done we probably would like to change the functions using it because they often bail out via exit if they read a NAK e.g. sp_flush_stream
maybe we can get a third opinion from someone else. i'll ask carldani when i see him.
Add SPI support to serprog protocol.
Signed-off-by: Urja Rannikko urjaman@gmail.com --- Changed stuff mostly according to review ... and an e-mail that arrived while I was writing this. Added the optimized SPI read function for serprog that I had already done, -r time for 1Mbyte 18s -> 11s.
Now it is mandatory for non-SPI, but optional for SPi. If the programmer is SPI-only we should not get any other than delay calls that would generate opbuf-using commands, will test for this later and report.
On Mon, 16 May 2011 18:16:03 +0300 Urja Rannikko urjaman@gmail.com wrote:
hello urja,
i will port my own avr-based programmer to your serprog implementation and review it on the way so that we can commit it soon. do you have other pending, local changes for this that i should know about? have you tested your stuff further? thanks
i have rebased urja's patch to current HEAD and instead of sending a lengthy "format this, format that" email i fixed the stuff that i thought needs fixing myself. to ease the re-review for urja i am sending my fixup patch separately, everyone else should probably combine 1/3 and 2/3.
urja was right about the delay function. i have also measured a similar speedup with his read function. we should fix spi_read_chunked. everything else slightly intersting is in the commit logs.
Stefan Tauner (3): Add SPI support to serprog protocol. fixup! Add SPI support to serprog protocol. serprog improvements
programmer.h | 9 ++- serprog-protocol.txt | 12 ++- serprog.c | 310 ++++++++++++++++++++++++++++++++++---------------- 3 files changed, 230 insertions(+), 101 deletions(-)