/
SPI

SPI

There are two SPI interfaces on conga-QMX6 modules:

Hardware name

Device name (linux)

Device name (u-boot)

Purpose

Remarks

Hardware name

Device name (linux)

Device name (u-boot)

Purpose

Remarks

ecspi1: spi@2008000

/dev/mtd<n>

0

exclusive use for onboard SPI flash

<n> is the flash partition number and in the range [0 .. 2]

ecspi3: spi@2010000

depends on device

not supported

Q7 SPI-interface

 

Q7 SPI interface

  • Supports two chip select lines on Q7-pin 200 (CS0#) and 202 (CS1#)

  • on conga-QEVAL: U4 can be equipped with an SPI flash chip

Onboard SPI interface

  1. Exclusive for SPI-NOR flash, see SPI NOR-Flash Organization for details:

SPI NOR-Flash Organization

Flash has a size of 4MiB, divided into three partitions:

Partition name

Device name

Address range

Size

Attributes

Purpose

Partition name

Device name

Address range

Size

Attributes

Purpose

boot

/dev/mtd0

0x0000 0000 - 0x00F FFFF

0x0010 0000

read/write

bootloader + environment

Environment: last 8KiB

failsafe

/dev/mtd1

0x0010 0000 - 0x003F BFFF

0x002F C000

read/write

user partition (free for customer)

3MiB minus 16k MFG data

reserved

/dev/mtd2

0x003F C000 - 0x003F FFFF

0x0000 4000

read only

MFG (manufacturing data)

Access the SPI flash from linux kernel

Verify flash detection:

root@cgtqmx6:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00100000 00001000 "bootloader"
mtd1: 002fc000 00001000 "user"
mtd2: 00004000 00001000 "reserved"

Check character and block devices used for different flash partitions:

root@cgtqmx6:~# ls -lad /dev/mtd*
crw-------    1 root     root       90,   0 Feb  7 06:40 /dev/mtd0
crw-------    1 root     root       90,   1 Feb  7 06:40 /dev/mtd0ro
crw-------    1 root     root       90,   2 Feb  7 06:40 /dev/mtd1
crw-------    1 root     root       90,   3 Feb  7 06:40 /dev/mtd1ro
crw-------    1 root     root       90,   4 Feb  7 06:40 /dev/mtd2
crw-------    1 root     root       90,   5 Feb  7 06:40 /dev/mtd2ro
brw-rw----    1 root     disk       31,   0 Feb  7 06:40 /dev/mtdblock0
brw-rw----    1 root     disk       31,   1 Feb  7 06:40 /dev/mtdblock1
brw-rw----    1 root     disk       31,   2 Feb  7 06:40 /dev/mtdblock2

Example: how to format user partition with JFF2 and mount it:

root@cgtqmx6:~# flash_erase -j /dev/mtd1 0 0

root@cgtqmx6:~# mount -t jffs2 /dev/mtdblock1 /mnt

 

Access the SPI flash from u-boot

Example: clear u-boot partition on SPI flash from u-boot command line:

=> sf probe
SF: Detected w25q64dw with page size 256 Bytes, erase size 4 KiB, total 8 MiB

=> sf erase 0 100000
SF: 1048576 bytes @ 0x0 Erased: OK

ATTENTION:

  • After clearing the uboot partition, the module won't boot any longer! Do a clean firmware update afterwards with uuu tool in recovery mode