-
Notifications
You must be signed in to change notification settings - Fork 5
/
README
180 lines (157 loc) · 7 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
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 <erik@kryo.se>
================================================================================
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