Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12692 Discussions

How to add second flash to MTD

Altera_Forum
Honored Contributor II
1,617 Views

I am using a board with 2 16 MB CFI flashes.  

Flash 1 at 0x0 and Flash at 0x02000000. 

 

uClinux detects flash 1 and does not detect flash 2. I am using microtronix map where i see, It sends data for mapping first flash only.  

 

How do I make uClinux detect and add my second flash?
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
631 Views

1. You may try concat the two chips into a virtual one. (But I didn't try any of them) 

Drivers--> Memory Technology Devices (MTD) --> 

[*] MTD concatenating support  

 

search "concat" in dir linux-2.6.x/drivers/mtd/maps, and you can find more examples, cevia.c. 

 

http://www.sysgo.com/fileadmin/user_upload.../mtd-concat.pdf (http://www.sysgo.com/fileadmin/user_upload/appnotes/mtd-concat.pdf

 

2. Or use them seperately. 

You will may use the second flash chip's address and size, ie, na_cfi_flash_1, to declare the second map_info. 

And define the second mtd_partition. 

Then add them after the first.
0 Kudos
Altera_Forum
Honored Contributor II
631 Views

Thank you Hippo. My idea is to have uClinux and FS in Flash1 which will be protected from any write with a jumper and JFFS2 on Flash 2 which will be writable. The system what I am working on runs 24X7 and should be crash free / Auto recoverable. To avoid corruption of the kernel or FS I am trying to do the above.  

 

How can I do this? I checked out the CFI driver in Microtronix dist. It is completely hardcoded for flash at 0x0. How can I solve my problem. I dont know if concat will help me do what i am planning. 

 

Please suggest.
0 Kudos
Altera_Forum
Honored Contributor II
631 Views

I thnik its better to use them separately]. Just specify the address of second chip in the map file. 

mtd cat is used if you want to have single file system spread on two chips, which is not what you want. 

[i have not used it yet] 

Should work.
0 Kudos
Altera_Forum
Honored Contributor II
631 Views

I looked into the MTD driver thoroughly. Its actually dumb. It does no use the CFI table to get the actual size and boundary of the flash. It blindly uses the macros defined. So i changed the memory map and placed all the flashes in sequence. Changed the flash size from 16 to 32 MB and it just works.  

 

Simple work around. 

 

Thanks for your support.
0 Kudos
Reply