存储设备Flash和SD、TF、MMC、eMMC、UFS

1、raw flash vs FTL

raw flash devices: NAND, NOR, OneNAND, etc,其被作为MTD设备处理(既不是字符设备,也不是块设备)。

FTL device:Flash Translation layer device, MMC, eMMC, SD不仅包含flash,还包含控制器,其被作为块设备处理

FTL stands for "Flash Translation Layer" and it is software which emulates a block device on top of flash hardware. At early days FTL ran on the host computer. For example, old PCMCIA flash devices were essentially raw flash devices, and the PCMCIA standard defined the media storage format for them. So the host computer had to run the FTL software driver which implemented PCMCIA FTL. However, nowadays FTL is usually firmware, and it is run by the controller which is built into the storage device. For example, if you look inside an USB flash drive, you'll find there a NAND chip (or several of them), and a micro-controller, which runs FTL firmware. Some USB flash drives are known to have quite powerful ARM processors inside. Similarly, MMC, eMMC, SD, SSD, and other FTL devices have a built-in controller which runs FTL firmware.

All FTL devices have an interface which provides block I/O access. Well, the interfaces are different and they are defined by different specifications, e.g., MMC, eMMC, SD, USB mass storage, ATA, and so on. But all of them provide block-based access to the device. By block-based access we mean that whole device is represented as an linear array of (usually 512-byte) blocks. Each block may be read or written.

http://www.linux-mtd.infradead.org/doc/ubifs.html#L_raw_vs_ftl

2)常用的文件系统ext2、FAT等不能用于MTD设备上(raw flash),可运行于FTL device上。

3)mtd设备对应的设备文件为/dev/mtd,FTL设备对应的设备文件可为/dev/mtdblock。

There is an extremely simple FTL layer in Linux MTD subsystem - mtdblock. It emulates block devices over MTD devices. There is also an mtdblock_ro module which emulates read-only block devices. When you load this module, it creates a block device for each MTD device in the system. The block devices are then accessible via /dev/mtdblockX device nodes.

But in many cases using mtdblock is a very bad idea because what it basically does if you change any sector of your mtdblockX device, it reads the whole corresponding eraseblock into the memory, erases the eraseblock, changes the sector in RAM, and writes the whole eraseblock back. This is very straightforward. 

If you have a power failure when the eraseblock is being erased, you lose all the block device sectors in it. The flash will likely decay soon because you will wear few eraseblocks out - most probably those ones which contain FAT/bitmap/inode table/etc.

Unfortunately it is a rather difficult task to create a good FTL layer and nobody still managed to implement one for Linux. But now when we have UBI (see here) it is much easier to do it on top of UBI.

2、FTL

SD卡

SD卡是(secure digital memory card)安全数码卡,是一种基于半导体快闪记忆器的新一代记忆设备,是在MMC基础上发展起来的,增加了两个主要特色:

可以设置所存储的使用权限,防止数据被他人复制;第二是传输速度比2.11版mmc卡快。

特性:

1)可选通信协议:SD模式和SPI模式

2)可变时钟频率:0~25MHz

3)通信电压范围:2.0~3.6V

4)数据寿命:10万次编程/擦除

5)正向兼容MMC卡;

6)运行在25M的频率上,数据带宽是4位,因此最大传输速率是12.5MHz(12.5兆字节每秒)

TF卡

TF卡是(t-flash)又称micro SD,是采用SanDisk最新的NAND MLC技术以及控制器技术。

尺寸:15mm宽*11mm长*1mm厚。

MMC卡

MMC卡(MultiMediaCard)缩写,即多媒体卡,也是一种非易失性存储器件,体积小巧,容量大,耗电量低,传输速度快。

MMC共有7个pin,分为两种模式,分别为MMC模式和SPI模式。

尺寸:24mm*32mm*14mm

MMC卡时钟频率是20MHz,比SD卡少两个PIN,只有一位数据带宽,所以最大传输速率为2.5MHz。

eMMC

eMMC(embedded multi media card)为MMC协会所订立的、主要是针对手机或平板电脑等产品的内嵌式存储器标准规格。eMMC的一个明显优势是在封装中集成了一个控制器,它提供标准接口并管理内存,使得是手机厂商就能专注于产品开发的其他部分,并缩短向市场推出产品的时间,

eMMC=NAND flash+controller+standard interface

eMMC使用并行数据传输,且为半双工,不能同时读写。

目前主要的emmc厂商为三星:https://www.samsung.com/semiconductor/cn/estorage/emmc/

UFS

Universal Flash Storage,通用闪存存储。它有两个意思,一是指手机存储接口协议,类似SATA,PCIe/NVMe;二是使用该协议的存储设备。

UFS最新标准是UFS3.0,于2018年1月30日发布。它最大带宽可以达到2163MB/s!4倍SATA3.0的速度 (600MB/s),超过PCIe3.0x2的速度(2GB/s单向速度)。

不过,目前市面上的UFS产品还是UFS2.0/2.1,其最大带宽1081MB/s,也是秒杀一般的SSD。

UFS协议是JEDEC(www.jedec.org)组织制定的,三星、海力士、东芝等公司力捧。

UFS为什么能那么快?

首先,它在数据信号传输上,使用的是差分串行传输。这是UFS快的基础。所有的高速传输总线,如SATA,PCIe,SAS,都是串行差分信号。串行,可以使用更快的时钟(时钟信息可以嵌在数据流中);差分信号,即用两根信号线上的电平差表示0或者1。与单端信号传输相比,差分信号抗干扰能力强,能提供更宽的带宽(跑得更快)。

其次,UFS和PCIe一样,支持多通道数据传输,目前最多支持两个通道。多通道可以让UFS在成本、功耗和性能之间做取舍。

还有,它是全双工工作模式,就是读写可以并行。它的前辈eMMC是半双工,读写不能同时进行。

UFS主要厂家:三星https://www.samsung.com/semiconductor/cn/estorage/ufs/

 

参考:

1. SD、TF、MMC以及eMMC的区别https://jingyan.baidu.com/article/03b2f78cd810115ea237ae2d.html

2. eMMC总线协议 - 超详细原理讲解

3. 蛋蛋读UFS之一:UFS简介

4. UFS和EMMC的区别--原理学习

posted @ 2016-08-02 15:22  yuxi_o  阅读(2857)  评论(0编辑  收藏  举报