All Projects → yarrick → turbomem

yarrick / turbomem

Licence: GPL-2.0 license
Incomplete Linux driver for Intel Turbo Memory Controller ("Robson") PCIe card

Programming Languages

c
50402 projects - #5 most used programming language
Makefile
30231 projects
turbomem - Linux driver for Intel(R) Turbo Memory Controller


This is the development of a reverse-engineered Linux driver for the Intel(R)
Turbo Memory Controller, a mini-PCIe board that contains NAND flash and a
controller chip. This driver will expose the flash memory to the Linux MTD
(Memory Technology Device) layer, which in turn can setup filesystems on top.

After detecting a compatible device, basic info is logged to dmesg:
turbomem 0000:04:00.0: Found Intel Turbo Memory Controller (rev 11)
turbomem 0000:04:00.0: Device characteristics: 13404, flash size: 2048 MB


Current status:
---------------
Erasing, writing and reading works, bad block handling is done.
Random failures can be seen with the mtd tests.
Device is mountable with ubifs, but data cannot be written/read back reliably.

How to format and mount:
------------------------
1. Install mtd-utils from http://www.linux-mtd.infradead.org/
2. Load MTD support
   # modprobe mtd
3. Load driver (creates /dev/mtd0)
   # insmod turbomem.ko
4. Format device for UBI (only needed first time)
   # ubiformat /dev/mtd0
5. Load UBI support
   # modprobe ubi
6. Attach UBI device to stack (creates /dev/ubi0)
   # ubiattach -p /dev/mtd0
7. Show info about UBI device (only needed first time)
   Get size of device for next step
     (Amount of available logical eraseblocks, bytes)
   # ubinfo /dev/ubi0
8. Create UBIFS volume on top of ubi0
   (creates /dev/ubi0_0, only needed first time)
   size = 2037456896 for 2GB. name is required but does not matter
   # ubimkvol -s <size> -N <name> /dev/ubi0
9. Mount UBIFS
   # mount -t ubifs /dev/ubi0_0 /mnt/turbomem
10. Now test reading/writing in your mounted directory

Notes:
------
* When module is loaded, eraseblocks 1-5 will be scanned for a bad block table.
  If none is found, all non-reserved eraseblocks will be erased to gather info
  on which blocks are bad. The data will be written twice at blocks 1-5.

* If you use both Linux and Windows on the computer with this card, uninstall
  the Turbo Memory driver in Windows before using this driver. Windows and
  Linux drivers use different bad block tables and will erase all flash.

* The supplied Vista driver requires certain SATA controller chips to install
  and work. Tests on one newer machine so far indicates the cards do not run
  if this chip is missing (card does not show in lspci). Maybe the option ROM
  disables the card in this case.

* This driver is developed using the 2GB version of the board.
  It does not work on 1GB boards, and can brick them when erasing to add bad
  block table. It has not been tested on 4GB boards.


Enjoy,
    Erik Ekman <[email protected]>

================================================================================

Example session:

# modprobe mtd
# insmod turbomem.ko
# mtdinfo /dev/mtd0
mtd0
Name:                           TurboMemory@0000:04:00.0
Type:                           nand
Eraseblock size:                262144 bytes, 256.0 KiB
Amount of eraseblocks:          8187 (2146172928 bytes, 2.0 GiB)
Minimum input/output unit size: 4096 bytes
Sub-page size:                  4096 bytes
Character device major/minor:   90:0
Bad blocks are allowed:         true
Device is writable:             true
# flash_erase  /dev/mtd0 0 10
Erasing 256 Kibyte @ 240000 -- 100 % complete
# nanddump /dev/mtd0 -l 8192 |hexdump -C
ECC failed: 0
ECC corrected: 0
Number of bad blocks: 0
Number of bbt blocks: 0
Block size 262144, page size 4096, OOB size 0
Dumping data starting at 0x00000000 and ending at 0x00002000...
00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00002000
# echo "faaaaao foo foo 22"|nandwrite -p  /dev/mtd0
Writing data to block 0 at offset 0x0
# nanddump /dev/mtd0 -l 8192 |hexdump -C
ECC failed: 0
ECC corrected: 0
Number of bad blocks: 0
Number of bbt blocks: 0
Block size 262144, page size 4096, OOB size 0
Dumping data starting at 0x00000000 and ending at 0x00002000...
00000000  66 61 61 61 61 61 6f 20  66 6f 6f 20 66 6f 6f 20  |faaaaao foo foo |
00000010  32 32 0a ff ff ff ff ff  ff ff ff ff ff ff ff ff  |22..............|
00000020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00002000
# nandtest -l 0x20000000 /dev/mtd0
ECC corrections: 0
ECC failures   : 0
Bad blocks     : 0
BBT blocks     : 0
Bad block at 0x111c0000
Bad block at 0x13140000
Bad block at 0x1d080000
1ffc0000: checking...
Finished pass 1 successfully
#

================================================================================

Debugfs interface:

* /turbomem/<pci-addr>/orom (read)
  Dump the embedded disk-filtering Option ROM
  Example:

# hexdump -C /sys/kernel/debug/turbomem/0000:04:00.0/orom
00000000  55 aa 18 e9 2a 29 3f 3f  3f 3f 3f 3f 3f 3f 3f 3f  |U...*)??????????|
00000010  3f 3f 3f 3f 3f 3f 3f b9  70 00 20 00 00 00 00 00  |???????.p. .....|
00000020  24 50 6e 50 01 02 00 00  00 d6 00 00 00 00 40 00  |$PnP..........@.|
00000030  4c 00 05 80 00 e4 00 00  00 00 00 00 00 00 00 00  |L...............|
00000040  49 6e 74 65 6c 20 43 6f  72 70 2e 00 49 6e 74 65  |Intel Corp..Inte|
00000050  6c 28 52 29 20 54 75 72  62 6f 20 4d 65 6d 6f 72  |l(R) Turbo Memor|
00000060  79 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |y...............|
00000070  50 43 49 52 86 80 4e 44  00 00 18 00 00 05 80 00  |PCIR..ND........|
00000080  18 00 ea 03 00 80 00 00  00 00 00 00 00 00 00 00  |................|
00000090  46 49 4c 54 2e 12 01 01  01 00 0a 00 01 00 ea 03  |FILT............|
.... and so on.

================================================================================

Speedtest results:

mtd_speedtest: MTD device: 0
mtd_speedtest: MTD device size 2146172928, eraseblock size 262144,
 page size 4096, count of eraseblocks 8187, pages per eraseblock 64, OOB size 0
mtd_test: scanning for bad eraseblocks
mtd_test: scanned 8187 eraseblocks, 17 are bad
mtd_speedtest: testing eraseblock write speed
mtd_speedtest: eraseblock write speed is 11881 KiB/s
mtd_speedtest: testing eraseblock read speed
mtd_speedtest: eraseblock read speed is 31137 KiB/s
mtd_speedtest: testing page write speed
mtd_speedtest: page write speed is 11920 KiB/s
mtd_speedtest: testing page read speed
mtd_speedtest: page read speed is 31045 KiB/s
mtd_speedtest: testing 2 page write speed
mtd_speedtest: 2 page write speed is 11929 KiB/s
mtd_speedtest: testing 2 page read speed
mtd_speedtest: 2 page read speed is 31072 KiB/s
mtd_speedtest: Testing erase speed
mtd_speedtest: erase speed is 494683 KiB/s
mtd_speedtest: Testing 2x multi-block erase speed
mtd_speedtest: 2x multi-block erase speed is 495034 KiB/s
mtd_speedtest: Testing 4x multi-block erase speed
mtd_speedtest: 4x multi-block erase speed is 494683 KiB/s
mtd_speedtest: Testing 8x multi-block erase speed
mtd_speedtest: 8x multi-block erase speed is 494566 KiB/s
mtd_speedtest: Testing 16x multi-block erase speed
mtd_speedtest: 16x multi-block erase speed is 495034 KiB/s
mtd_speedtest: Testing 32x multi-block erase speed
mtd_speedtest: 32x multi-block erase speed is 494683 KiB/s
mtd_speedtest: Testing 64x multi-block erase speed
mtd_speedtest: 64x multi-block erase speed is 495386 KiB/s
mtd_speedtest: finished

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].