world leader in high performance signal processing
Trace: » bfin_sdh

Blackfin SD Host Driver

The ADSP-BF54x/BF51x/BF60x Blackfin processors provide an SDH interface (it's called RSI on BF51x and BF60x) for Multi-Media Cards (MMC), Secure Digital Memory Cards (SD Card), and Secure Digital Input/Output Cards (SDIO). All of these cards use similar interface protocols. The main difference between MMC and SD support is the initialization sequence. The main difference between SD card and SDIO support is the use of interrupt and read wait signals for SDIO.

For details on using SDIO with Blackfin SD Host, refer to WIFI over SDIO

Starting from 2009R1 release, SDHC (SD High Capacity) card is supported.

The BF518F-ezbrd provides 2GB eMMC flash memory chip. The bfin-sdh driver supports this eMMC flash.

Linux config

Kernel configuration:

    SCSI device support  --->
    <*> SCSI device support
    <*> SCSI disk support
<*> MMC/SD/SDIO card support  --->
  <*> MMC block device driver
  <*> Blackfin Secure Digital Host support
  [*]   Blackfin EZkit Missing SDH_CMD Pull Up Resistor Workaround

Please select option “Blackfin EZkit Missing SDH_CMD Pull Up Resistor Workaround” if you are using bf548-ezkit or bf518-ezbrd without such resistor. This option doesn't apply to bf609-ezkit.

On BF54x, the SD/MMC host controller shares the DMA channel with the NAND flash controller, so currently you'll have to disable the NAND flash drive in order to use the SDH. Or build them both as modules and only load one at a time.

On BF518F-ezbrd, please turn off SW15 in order to use SD/SDIO

Testing

SD/MMC card

Please refer to instructions here to enable File System support and use SD/MMC card.

BF60x RSI/MMC performance

  • System Setting
Board Version CCLK SCLK Kernel Version Toolchain Version SD Card
BF609-Ezkit-1.0 - Rev 0.0 500MHz 100MHz 3.3.0-ADI-2012R1-00579-gf724383-dirty gcc 4.3.5 (ADI-BF60x_2012R1-BETA2) Sandisk SD 1GB class 2
Test Case: Bonnie++ on Ext2
root:/> mkfs.ext2 /dev/mmcblk0p1
root:/> mount /dev/mmcblk0p1 /mnt/
root:/> bonnie++ -u root -d /mnt/
  • Result:
Using uid:0, gid:0.
Writing a byte at a time...done
Writing intelligently...done
Rewriting...done
Reading a byte at a time...done
Reading intelligently...done
start 'em...done...done...done...done...done...
Create files in sequential order...done.
Stat files in sequential order...done.
Delete files in sequential order...done.
Create files in random order...done.
Stat files in random order...done.
Delete files in random order...done.
Version  1.94       ------Sequential Output------ --Sequential Input- --Random-
Concurrency   1     -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
buildroot      300M    45  95  2085  12  1811  15   176  99  5571  22 105.4   7
Latency               650ms    2597ms     423ms   59541us   40786us   93414us
Version  1.94       ------Sequential Create------ --------Random Create--------
buildroot           -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16   203  96 18061 100  3645  59   202  96 24693  99   642  91
Latency             25055us     550us     813us   23823us     253us    4769us
1.93c,1.94,buildroot,1,1167609557,300M,,45,95,2085,12,1811,15,176,99,5571,22,105.4,7,16,,,,,203,96,18061,100,3645,59,202,96,24693,99,642,91,650ms,2597ms,423s
root:/> 

BF54x SD/MMC performance

  • System Setting
Board Version CCLK SCLK Kernel Version Toolchain Version SD Card
BF548Ezkit-1.4 - Rev 0.1 525MHz 131MHz 2.6.28-rc2-ADI-2009R1-pre-svn5938 gcc 4.1.2 (svn) Transend SDHC 8GB class 6
Test Case 1: Bonnie++ on Ext2
root:/> mkfs.ext2 /dev/mmcblk0p1
root:/> mount /dev/mmcblk0p1 /mnt/
root:/> bonnie++ -u root -d /mnt/
  • Result:
Version  1.94       ------Sequential Output------ --Sequential Input- --Random-
Concurrency   1     -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
blackfin       300M    37  99  1080   6   958   8    78  99  5095  26 166.1   9
Latency               227ms    6000ms    5668ms     112ms     667ms     751ms
Version  1.94       ------Sequential Create------ --------Random Create--------
blackfin            -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16   176  96  2550 100  1099  52   178  96  2694 100   446  70
Latency             64000us    4000us    4000us   47999us    4000us    7999us
  • Compared with result on Linux PC, using the same SD card (with a USB card reader):
root:/> mkfs.ext2 /dev/sdc1
root:/> mount /dev/sdc1 /mnt/
root:/> bonnie++ -u root -d /mnt/
Version  1.94       ------Sequential Output------ --Sequential Input- --Random-
Concurrency   1     -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
adam-desktop     2G   673  96 12603   2  7349   1  1312  99 18889   1  72.9   0
Latency             15833us    1028ms    1540ms   16366us     708ms     402ms
Version  1.94       ------Sequential Create------ --------Random Create--------
adam-desktop        -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16  2074  60 +++++ +++ 13069   9  2998  86 +++++ +++  6660  57
Latency              6164us    6353us    6568us    6345us      58us     475us
Test Case 2: Bonnie++ on FAT32
root:/> mkfs.vfat -F 32 /dev/mmcblk0p2
root:/> mount /dev/mmcblk0p2 /mnt/
root:/> bonnie++ -u root -d /mnt/
  • Result:
Version  1.94       ------Sequential Output------ --Sequential Input- --Random-
Concurrency   1     -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
blackfin       300M    31  99  1150   8  1004  10    79  99  4977  29 146.3   8
Latency               268ms    3732ms    2572ms     108ms     667ms   19147ms
Version  1.94       ------Sequential Create------ --------Random Create--------
blackfin            -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16     3  99     5 100    58  99     4  99     5 100     9  99
Latency               832ms     388ms   64000us     495ms     380ms     371ms

BF51x SD/MMC performance

  • System Setting
Board Version CCLK SCLK Kernel Version Toolchain Version SD Card
BF518F-EZKIT-0.1 - Rev 0.0 500MHz 125MHz 2.6.28-rc2-ADI-2009R1-pre-svn5938 gcc 4.1.2 (svn) Transend SDHC 8GB class 6
Test Case 1: Bonnie++ on Ext2
root:/> mkfs.ext2 /dev/mmcblk0p1
root:/> mount /dev/mmcblk0p1 /mnt/
root:/> bonnie++ -u root -d /mnt/
  • Result:
Version  1.94       ------Sequential Output------ --Sequential Input- --Random-                                                                 
Concurrency   1     -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--                                                                 
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP                                                                 
blackfin       300M    46  95  1128   5  1009   9   181  99  5470  28 100.2   6                                                                 
Latency               172ms    7307ms     648ms   48000us     496ms    9319ms                                                                   
Version  1.94       ------Sequential Create------ --------Random Create--------                                                                 
blackfin            -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--                                                                 
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP                                                                 
                 16   241  93  7515  99  1512  31   240  91  8047  99   595  63                                                                 
Latency               400ms    4000us    4000us   56000us    4000us    4000us