New Flash-Driver for singleChipDevice

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

New Flash-Driver for singleChipDevice

oliver munz @ s p e a g
Hello

I'm writing an flash-driver for the Atmel AT91SAM7S Family. I found no
usefull documentaion about the functions, that I should implement.

My device is totaly different to the 29Fblabla and so on Series... The
memory-layout is very simple.

Is it correct, that I only need to implement:

flash_program_buf(); as an funcion for copy n words from somere to the
flash,
flash_erase_block(); as an empty function (flash_program_buf(); will do all
nessesary erasing).
flash_query(); as an empty function, there is no flash-device whit vendor
codes...
flash_hwr_init(); as empty function, there is nothing to do.
flash_hwr_map_error();
flash_code_overlaps(); as copy from a nother flash_driver...

It is possible that this is all it needs? Or have I handle some other
things, like the size of the flash-area or the segmentation?

Currently the flash_program_buf(); function does all the work and eCos don't
need to know something about the flash-segmentation and so on...

Thanks Oliver Munz

Reply | Threaded
Open this post in threaded view
|

Re: New Flash-Driver for singleChipDevice

Andrew Lunn-2
On Thu, Dec 15, 2005 at 01:38:51AM +0100, oliver munz @ s p e a g wrote:

> Hello
>
> I'm writing an flash-driver for the Atmel AT91SAM7S Family. I found no
> usefull documentaion about the functions, that I should implement.
>
> My device is totaly different to the 29Fblabla and so on Series... The
> memory-layout is very simple.
>
> Is it correct, that I only need to implement:
>
> flash_program_buf(); as an funcion for copy n words from somere to the
> flash,
> flash_erase_block(); as an empty function (flash_program_buf(); will do all
> nessesary erasing).
No, This should do what it says, ie erase the
block. flash_program_buf() should not perform an erase. It is legal to
write to a block that is not erased.

> flash_query(); as an empty function, there is no flash-device whit vendor
> codes...

Don't the different members of the AT91SAMxxx have different amounts
of flash? So you should query the register which contains this
information and return it.

> flash_hwr_init(); as empty function, there is nothing to do.

You should look at the information returned by flash_query and decide
on how big the flash is. You also need to fill in the block size and
the number of blocks.

> flash_hwr_map_error();
> flash_code_overlaps(); as copy from a nother flash_driver...

You can copy flash_code_overlaps() but i expect the AT91 returns
different err codes than a typical Strata device. So you will probably
need to modify this flash_hwr_map_error.
 
> It is possible that this is all it needs? Or have I handle some other
> things, like the size of the flash-area or the segmentation?
>
> Currently the flash_program_buf(); function does all the work and eCos
> don't need to know something about the flash-segmentation and so on...

This will cause problems for RedBoot and jffs2. It wants to know this
information so it can lay out it structures correctly.

There is some documentation in the flashv2 branch. Attached is the
sgml file.


        Andrew

flash.sgml (29K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: New Flash-Driver for singleChipDevice

oliver munz @ s p e a g
Some more questions...

>> flash_query(); as an empty function, there is no flash-device whit vendor
>> codes...
>
> Don't the different members of the AT91SAMxxx have different amounts
> of flash? So you should query the register which contains this
> information and return it.

Why do I need flash_query(); when I write also the function
flash_hwr_init(); ? No module exept my driver knows the meaning of the
chip-ID-codes of the AT91SAMxxx... Is flash_query(); the trick to read from
a Flashrom from RAM? In my case I have to read the ID in an address outside
the flash-address-range.

>> flash_hwr_init(); as empty function, there is nothing to do.
>
> You should look at the information returned by flash_query and decide
> on how big the flash is. You also need to fill in the block size and
> the number of blocks.

That means I sould #define _FLASH_PRIVATE_ and fill the struct flash_info in
flash_hwr_init(); ? What is wrong in not using _FLASH_PRIVATE_ ?

>> flash_hwr_map_error();
>> flash_code_overlaps(); as copy from a nother flash_driver...
>
> You can copy flash_code_overlaps() but i expect the AT91 returns
> different err codes than a typical Strata device. So you will probably
> need to modify this flash_hwr_map_error.

If I understand flash_code_overlaps(); right, then it only verify, if the
linker-section .text will be modified. In this case I don't need any
err-code from any flash-rom...

And I don't see the need for flash_hwr_map_error(); My device has no
error-codes an all my functions will return the FLASH_ERRORS... defined in
<cyg/io/flash.h>...

>> It is possible that this is all it needs? Or have I handle some other
>> things, like the size of the flash-area or the segmentation?
>>
>> Currently the flash_program_buf(); function does all the work and eCos
>> don't need to know something about the flash-segmentation and so on...
>
> This will cause problems for RedBoot and jffs2. It wants to know this
> information so it can lay out it structures correctly.
>
> There is some documentation in the flashv2 branch. Attached is the
> sgml file.

Where is the flashv2 branch?

>        Andrew
>

Thanks Oli

Reply | Threaded
Open this post in threaded view
|

Re: New Flash-Driver for singleChipDevice

oliver munz @ s p e a g
In reply to this post by Andrew Lunn-2
The true reason for the "fis init"-crash... My device has 1024 sectors of
256byte's. And the fis-directory should be placed by default in the last
sector, and it should hold 8 entry's whit 256Byte :-) If I change the
directory-parameters to 64Bytes and 4 entrys, and desable the "Keep
Boot-Configuration in Flash", the "fis init" works fine...

Is it true that I can only use 256Bytes for the fis-directory and also only
256Bytes for aliases and so on???

Then it would be a good idea to change the flash-driver to emulate some
other segemt-sizes... maybe 2 or 4kBytes...

Is this true?

Thank Oli