On Wed, 30 Jul 2014 10:55:10 -0500 (CDT) Nate Case ncase@xes-inc.com wrote:
For what it's worth as someone new to this project, my initial thought was to stuff the action parameters into struct flashctx as well. However, after glancing at the existing fields within that structure it didn't seem appropriate (that is, everything else there seems to be describing the flash chip or programmer). On the other hand, even though it's arguably abusing the struct, it's still clearly better than the existing solution.
struct flashctx is rather new (fall 2011, r1473, ok... not that new anymore) and was introduced to make runtime data available where needed. Previously the pointers to the chip's memory-mapped contents were stuffed into struct flashchip(!). We just have not used flashctx much further yet, but it is definitely the right place for it IMHO.
A new struct like you described instead of the integer flag seems perfectly reasonable to me also. Ultimately I'm just hoping for *something* resembling this to get merged so that I can base future patches on it. Specifically, I have a patch to add a new "read/write/verify_it"-like parameter, which will of course depend on the resolution of this problem.
Carl-Daniel is going on vacation tomorrow and won't be readily available for at least a week. Also, we have a very bad history of merging patches (not only foreign ones, or own too). So, if you don't hear anything from him soonish, I suggest you either implement my proposition (I believe that has a good probability of getting merged, apart from some name bikeshedding), or continue with what you have so far and be prepared to adapt your changes later. After all, your changes so far are not that bold and have a relatively limited extent. That should not cause to many troubles if changed later.
I am interested in hearing more about your further plans. We had patches for a few related functionalities (e.g. setting the status register of SPI flashes manually) and google is using a very extended CLI for unlocking address ranges of flash chips that you might want to look at first.