## General MTD FAQ

### Is a mtd device a block device or a char device ?

First off, an mtd is a "memory technology device", so it's just "mtd. An "mtd device" is a pleonasm.

Unix traditionally only knew block devices and character devices. Character devices were things like keyboards or mice, that you could read current data from, but couldn't be seeked and didn't have a size. Block devices had a fixed size and could be seeked. They also happened to be organized in blocks of multiple bytes, usually 512.

Flash doesn't match the description of either block or character devices. They behave similar to block device, but have differences. For example, block devices don't destinguish between write and erase operations. Therefore, a special device type to match flash characteristics was created: mtd.

So mtd is neither a block nor a char device. There are translations to use them, as if they were. But those translations are nowhere near the original, just like translated chinese poems.

### What are the point() and unpoint() functions used for ?

Mainly for NOR flash. As long as the flash is only read, it behaves just like normal memory. The read() function for NOR chips is essentially a memcpy(). For some purposes the extra memcpy() is a waste of time, so things can be optimized.

So the point() function does just that, it returns a pointer to the raw flash, so callers can operate directly on the flash.

But of course, things are a little more complicated than that. NOR flash chips can be in several different modes and only when in read mode will the above work. Therefore point() also locks the flash chip in addition to returning a pointer. And while locked, writes to the same flash chips have to wait. So callers have to call unpoint() soon after to release the chip again.