How to Find NOR Parameters

Using the Datasheet

If you are writing a driver or do not have a working Linux kernel for the board, then you should use the datasheet to find the parameters for your NOR flash. This section describes where to find the relevant information for building JFFS2 or UBI images using the datasheet for your device.

Flash Vendor

The flash vendor is typically on the chip, although it can be difficult to discern at times.

  • Atmel - Stylized "Atmel" Logo. Part numbers typically start with "AT".
  • Spansion - Stylized "Spansion" Logo. Part numbers typically begin with "S".
  • Intel - Large lowercase "i". Intel NOR flash parts are now owned by Numonyx.
  • Numonyx - Stylized "N".

Flash Model

Like the vendor, it is easiest to look at the board's BOM. It is also typically on the chip, although it may include additional numbers and letters that indicate a particular subset of the model, making it somewhat difficult to find the datasheet.

Size or Density

The datasheet for the given part is the best place to find the size of the NOR flash chip. It is typically called the chip's density, and will be expressed in either MibiBytes (1*2^20 bytes), Words (typically 2 Bytes, or 16 bits) or even as MBits (MiB * 8). We are unaware of any manufacturer that expresses them in powers of 10 (like hard drive manufacturers).

Some datasheets may correspond to multiple densities of the same family of devices. In those cases, there is typically a section of the datasheet that will explain how to read the model number to determine the density of the chip.

The density, as well as other size parameters, are typically expressed in terms of the size of the data and the out-of-band (OOB) region that accompany each page. The OOB size can be ignored when passing parameters to JFFS2 or UBI.

Physical Erase Block Size

The physical erase block size (or PEB) is the size of each erasable block of NOR, typically called a sector. This value can be found in the datasheet under the feature summary section. It will be expressed in bytes or words.

Typically, NOR flash may have multiple sizes of erase blocks. Typically, there are a few small sectors at the beginning or end of the flash. These are referred to as "Bottom Boot Block" and "Top Boot Block" NOR flashes, respectively. When determining erase block size, always use the largest sector size.

Logical Erase Block Size

The logical erase block size (LEB) is an UBIFS-only term, and is not entirely straightforward to figure out. UBIFS prepends a header to every block of a certain size, and aligns it with the page. It is related to physical eraseblock size, minimum input/output unit size, and sub-page size. The easiest way to find it is to attach the device to UBI and see the output, as described below.

Some typical values:

  • NOR flash with 1 byte min. I/O unit size: LEB size is PEB size minus 128


Page Size or Minimum I/O Size

Each device is divided into some number of pages. The page is the minimum block of data that can be read or programmed at a time. This corresponds to the minimum I/O size of the UBI subsystem.

For NOR flash, this value is almost always 1.

Bus Width

Bus width describes the number of data lines used to connect the flash chip to the memory controller, which is usually part of the SOC.

The chip's bus width can be found in the datasheet. Like density, a single datasheet may be used for chips of varying bus-widths, so you may need to find the section that describes how to decode the model number in order to determine the value. It is typically 16 bits.

You can also tell the bus width by looking at the schematic, although this is prone to error.

Using UBI

When a device is attached to UBI, the kernel will print a summary of the parameters of the chip. It can be found using either dmesg or ubiattach.

NOTE: You should use ubiformat to format the partition before doing this.

# ubiattach /dev/ubi_ctrl -m0                                                   
UBI: attaching mtd0 to ubi0                                                     
UBI: physical eraseblock size:   65536 bytes (64 KiB)                           
UBI: logical eraseblock size:    65408 bytes                                    
UBI: smallest flash I/O unit:    1                                              
UBI: VID header offset:          64 (aligned 64)                                
UBI: data offset:                128                                            
UBI: attached mtd0 to ubi0                                                      
UBI: MTD device name:            "NOR partition"                                
UBI: MTD device size:            8 MiB                                          
UBI: number of good PEBs:        128                                            
UBI: number of bad PEBs:         0                                              
UBI: max. allowed volumes:       128                                            
UBI: wear-leveling threshold:    4096                                           
UBI: number of internal volumes: 1                                              
UBI: number of user volumes:     0                                              
UBI: available PEBs:             124                                            
UBI: total number of reserved PEBs: 4                                           
UBI: number of PEBs reserved for bad PEB handling: 0                            
UBI: max/mean erase counter: 0/0                                                
UBI: background thread "ubi_bgt0d" started, PID 925                             
UBI device number 0, total 128 LEBs (8372224 bytes, 8.0 MiB), available 124 LEBs
 (8110592 bytes, 7.7 MiB), LEB size 65408 bytes (63.9 KiB)

The -m flag refers to the mtd partition, so the above example is the geometry of /dev/mtd0.

Using the Kernel

The kernel messages will provide some information about the NOR device. You can execute the dmesg command to see the results of the NOR driver's initialization:

physmap platform flash device: 00800000 at 10000000                             
physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank                      
 Amd/Fujitsu Extended Query Table at 0x0041                                     
number of CFI chips: 1                                                          
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.        
RedBoot partition parsing not available                                         
Using physmap partition information                                             
Creating 1 MTD partitions on "physmap-flash.0":                                 
0x00000000-0x00800000 : "NOR partition" 

Based on this, you can determine the partition scheme of the device, and bus width.

The proc subsystem in the Linux kernel will give you some information about the NOR flash, but typically not enough to get everything up and running.

The file /proc/mtd contains the basic information about all MTDs on your board:

# cat /proc/mtd
dev:    size   erasesize  name                                                  
mtd0: 00800000 00010000 "NOR partition"                                         
mtd1: 10000000 00020000 "NAND partition"                                        
mtd2: 00840000 00000420 "spi0.0-AT45DB642x" 

Size corresponds to the density (in bytes), and erasesize corresponds to the Physical Erase Block size (in Bytes).

Common NOR Parameters

Board Flash Vendor Flash Model Size Physical Erase Block Size Logical Erase Block Size Page Size (Min I/O Size) Bus width (Bits) Datasheet Notes
AMCC 440EPx Spansion S29GL512N 64 MiB 128 KiB 130944 bytes 1 Byte 16 S29GL256N -
at91cap9a-dk Atmel AT49BV642D 8 MiB 64 KiB 65408 bytes 1 Byte 16 AT49BV642D -
iq8134x MC/SC Numonyx/Intel 28F256P30T 32 MiB 128 KiB 130944 bytes 1 Byte 16 P30 Flash Memory -
Numonyx/Intel 28F128J3D-75 16 MiB 128 KiB 130944 bytes 1 Byte 8/16 J3 v.D Embedded Flash Memory -
kixrp435 Numonyx/Intel PC28F128P30T85 16 MiB 128 KiB 130944 bytes 1 Byte 16 P30 Flash Memory -
mpc8313e-rdb Spansion S29GL064A 90TFIR3 8 MiB 64 KiB 65408 bytes 1 Byte 16 S29GL064A -
- Spansion S29GL128P 16 MiB 128 KiB 130944 bytes 1 Byte 16 S29GL128A -
- Spansion S29GL256P 32 MiB 128 KiB 130944 bytes 1 Byte 16 S29GL256A -