Split spi.c into programmer and chip drivers. Make it so flash.h doesn't include any other flashrom-related headers. Fix includes in files.
Signed-off-by: Sean Nelson audiohacked@gmail.com
---
Made as minimal changes as I could, and split sli.c where it was clearly programmer code where the rest was moved to spi25.c. Names and Ideas as suggested by carldani.
On 25.02.2010 08:55, Sean Nelson wrote:
Thanks for preparing this patch. It brings us a step closer to a good separation and abstraction.
Hmmm... PCI accesses are hardware as well. Can you move them to hwaccess.h or include them where needed?
Side note: In a perfect abstraction, the SPI programmer drivers should not know anything about flash chips. Unfortunately, this still needs a lot of work. I have a preliminary patch, but it's not ready for consumption yet. It's not something you need to address, though.
The two functions above need to stay in spi.c because they are generic programmer code, not chip driver code.
And even if this function looks programmer specific, it is chip driver code. The only reason we perform any programmer differentiation is that we don't have a generic can_run_this_command() function which would check if the hardware supports the command in question. I have some code to restructure this function from back when I attempted to extend the SPI abstraction, but the code has bitrotted quite a bit, so it might be faster to just rewrite it.
Hm yes, this one is very special. I can see arguments for declaring it both as programmer code and as chip code. IMHO it is chip code because it implies a certain read command. OTOH, it is a very specific programmer operation which programmers can short-circuit. It would definitely benefit from a can_run_this_command() function.
Why did you move this function a few lines up? Just a cosmetic question because the move makes tracking code history harder.
Please make sure this file is created with "svn cp spi.c spi25.c" and then modified as needed before committing. git-svn may or may not do that. I just want to make sure the code history stays intact.
Contains the common SPI chip driver functions
The two functions above belong in spi.c (see above).
Comment doesn't belong to function. It seems something got lost in the shuffle.
What I could not check was function ordering. Did you keep the old order while moving code from spi.c to spi25.c? If not, please do so because it makes tracking history a lot easier.
Looks good otherwise.
Regards, Carl-Daniel
Updated against svn with suggestions.
On 25.02.2010 21:50, Sean Nelson wrote:
Updated against svn with suggestions.
I really like this patch, but I noticed we're doing two things at once, and some of my suggestions (which you followed) has unintended side effects (which are note really desirable). This is my fault and I'll take the blame. One part of this patch splits the include files (including all the nasty hwaccess.h stuff), and another part makes all chip drivers use chipdrivers.h and splits spi.c into spi.c and spi25.c.
Could you split off the chipdriver stuff (including the spi.c split) and send it as separate patch? All the chipdriver stuff is committable and looks fine. Here's a file list you can supply to svn diff (svn diff takes multiple files as arguments which makes splitting easy): 82802ab.c flashchips.c jedec.c m29f400bt.c Makefile pm49fl00x.c sharplhf00l04.c spi25.c spi.c sst28sf040.c sst49lfxxxc.c sst_fwhub.c stm50flw0x0x.c w29ee011.c w39v040c.c w39v080fa.c I checked that the chipdriver stuff is standalone and compiles just fine. That part is immediately ackable.
The programmer/hwaccess stuff turned out to be more complicated than I had hoped. I'd like to postpone that part until we know how to keep all programmer stuff in one header file... If you want to svn revert those files (keep the diff around, I believe the work you did was valuable), here's a list: board_enable.c buspirate_spi.c chipset_enable.c dediprog.c drkaiser.c flash.h flashrom.c hwaccess.c hwaccess.h ichspi.c internal.c it87spi.c nic3com.c pcidev.c physmap.c print.c satasii.c sb600spi.c wbsio_spi.c
Sorry for not seeing the PCI splitoff mess before.
Regards, Carl-Daniel
Chipdriver and spi split patch. Some of the spi programmer drivers required chipdrivers.h (needs fixing later) : it87spi.c ichspi.c sb600spi.c wbsio_spi.c buspirate_spi.c
Signed-off-by: Sean Nelson audiohacked@gmail.com
Chipdriver and spi split patch. Some of the spi programmer drivers required chipdrivers.h (needs fixing later) : it87spi.c ichspi.c sb600spi.c wbsio_spi.c buspirate_spi.c
Signed-off-by: Sean Nelson audiohacked@gmail.com
On 26.02.2010 03:07, Sean Nelson wrote:
Chipdriver and spi split patch.
Thanks for doing this work, it gets us closer to our goal.
You forgot ft2232spi.c and bitbang_spi.c and dediprog.c, probably because they are not compiled by default.
Signed-off-by: Sean Nelson audiohacked@gmail.com
Acked-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Regards, Carl-Daniel
You forgot ft2232spi.c and bitbang_spi.c and dediprog.c, probably because they are not compiled by default.
Patch fixed for mailinglist.
---
Split spi.c into programmer and chip code Remove chipdriver.h from flash.h Some of the spi programmer drivers required chipdrivers.h, needs fixing later: it87spi.c ichspi.c sb600spi.c wbsio_spi.c buspirate_spi.c ft2232spi.c bitbang_spi.c dediprog.c
Signed-off-by: Sean Nelson audiohacked@gmail.com Acked-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
On 2/25/10 9:47 PM, Sean Nelson wrote:
Signed-off-by: Sean Nelson audiohacked@gmail.com Acked-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Thanks for the Ack. Committed in r914.