Accessing flash directly from User Space

Jonathan Haws Jonathan.Haws at sdl.usu.edu
Fri Oct 30 03:48:15 EST 2009


> On Tue, Oct 27, 2009 at 04:52:40PM -0600, Jonathan Haws wrote:
> > > Will the device respond to 0x1234 being written at offset zero?
> You
> > > generally have to poke these things pretty specifically in order
> to
> > > get
> > > them to go into command mode.
> > >
> >
> > It should because that is the first data location in flash.
> 
> I don't follow.  Even if you have an Intel command set flash (and
> thus don't
> need unlock writes), 0x1234 isn't a valid command that I know of.
> The flash
> doesn't behave as a register that you can read back; it just
> responds in a
> certain way based on what you write to it.
> 
> > Also, just to be sure I am telling the truth, I tried writing to
> one of
> > the registers to setup an erase and got the same results - the
> value did
> > not get written.
> 
> Following the exact sequence that the driver uses?  What did you
> write, what
> did you expect (you're generally not going to get the same thing
> back that
> you wrote), and what did you get?  What kind of command set, bus
> width, and
> interleaving do you have?

I used the erase pattern, then write pattern for my flash device.  When I tried to read back the value that should have been stored, it was what it was previously.

> 
> If you manually do the same exact accesses from a firmware prompt,
> external
> debugger, etc. does it work?
> 
> > > > The driver works perfectly in VxWorks,
> 
> On this exact hardware?

Yes.

> > > Including the 0x1234 thing?
> >
> > Actually, I have not tried that - I have not had to since the
> driver worked.
> 
> What happens without the 0x1234?

Have not bothered to try it.  My guess, after finding out what the problem is that it would not read back 0x1234.  In the test I performed, I intended to erase the sector, prep it for write, then write out 0x1234 to the first two bytes in flash.  However, I failed in include the code to erase and prep the sector for writing in my rush to find out what the heck was going on.

As I mentioned previously, I was just not allowing the correct sequence of operations to take place to erase the sector (that is where my problem began) because when I setup the sector for erasure, the sequencing did not take place correctly because what I would assign to flash was not committed immediately.

I hope that makes sense.

Thanks,

Jonathan




More information about the Linuxppc-dev mailing list