Registering mtdinfo

The following steps are generic and apply to both NAND and NOR flashes. The basis of the registration is the function add_mtd_device() function, which adds the device to the mtd_table[] array. However in most of the cases you would not use this function directly because you want to create partitions on the chip.


Partitioning allows multiple partitions on a flash to be created and to be added into different slots in the mtd_table[] array. Thus the partitions will be exported as multiple devices to the application. The various partitions share the same functions for accessing the array. For example, you would want to divide the 4-MB flash into a 1-MB and 3-MB partition as shown in Figure 4.3.

The key to partitioning is the mtd_partition data structure. You would define an array of this data structure to export the partition.

struct mtd_partition partition_info[] = {

{ .name = "parti" , .offset = 0, .size= 1*1024*1024},

Flash Size 4 MB

Flash Size 4 MB

Was this article helpful?

0 0

Post a comment