AM335x MMC/SD Driver's Guide

From Texas Instruments Wiki
Jump to: navigation, search
TIBanner.png
AM335X MMC/SD Driver's Guide
Linux PSP

Introduction

AM335x has 3 instances MMC/SD/SDIO host controller, which provides an interface between microprocessor and either MMC, SD memory cards, or SDIO cards. The current version of the user guide talks about the MMC/SD controller.

The MMC/SD driver is implemented as a block driver on top of host controller as a HSMMC controller driver and supports SD, SD High Speed and SDHC cards. This driver only supports for 4 bit modes(no SPI mode, 1/8 Bit). Both DMA & polled mode of data transfer is supported.


MMC/SD Driver Architecture

Mmcsd Driver.png


Useful Links

  1. [MMCA Homepage]
  2. [SD ORG Homepage]


Acronyms & Definitions

Audio Driver: Acronyms
Acronym Definition
MMC Multimedia Card
HS-MMC High Speed MMC
SD Secure Digital
SDHC SD High Capacity
SDIO SD Input/Output


Driver Configuration

The default kernel configuration enables support for MMC/SD(built-in to kernel). OMAP MMC/SD driver is reused for AM335x.

The selection of MMC/SD/SDIO driver can be modified as follows: start Linux Kernel Configuration tool.

$ make CROSS_COMPILE=arm-arago-linux-gnueabi- ARCH=arm menuconfig
  • Select Device Drivers from the main menu.
...
...
Kernel Features  --->
Boot options  --->
CPU Power Management  --->
Floating point emulation  --->
Userspace binary formats  --->
Power management options  --->
[*] Networking support  --->
Device Drivers  --->
...
...


Building into Kernel

  • Select MMC/SD/SDIO card support from the menu.
...
...
[*] USB support  --->
<*> MMC/SD/SDIO card support  --->
< > Sony MemoryStick card support (EXPERIMENTAL)  --->
...
...
  • Select OMAP HS MMC driver
 [ ]   MMC debugging
 [*]   Assume MMC/SD cards are non-removable (DANGEROUS)
 [ ]   MMC host clock gating (EXPERIMENTAL)
       *** MMC/SD/SDIO Card Drivers ***
 <*> MMC block device driver                 
 (8)     Number of minors per block device                
 [*]     Use bounce buffer for simple hosts
 <*>   SDIO UART/GPS class support
 < >   MMC host test driver         
 ...
 < >   TI OMAP Multimedia Card Interface support       
 <*>   TI OMAP High Speed Multimedia Card Interface support
 ...


Building as Loadable Kernel Module

  • To build the above components as modules, press 'M' key on every config entries shown below to build them as module:
<M> MMC/SD/SDIO card support  --->
<M> MMC block device driver                 
<M> TI OMAP High Speed Multimedia Card Interface support
  • After doing module selection, exit and save the kernel configuration when prompted.
  • Now build the kernel and modules form Linux build host as
$ make CROSS_COMPILE=arm-arago-linux-gnueabi- ARCH=arm uImage
$ make CROSS_COMPILE=arm-arago-linux-gnueabi- ARCH=arm modules
  • Following modules will be built
mmc_core.ko
mmc_block.ko
omap_hsmmc.ko
  • Boot the newly built kernel and transfer the above mentioned .ko files to the filesystem
  • Navigate to the directory containing these modules and insert them form type the following commands in console to insert the modules in specified order:
# insmod mmc_core.ko
# insmod mmc_block.ko
# insmod omap_hsmmc.ko


  • If 'udev' is running and the SD card is already inserted, the devices nodes will be created and filesystem will be automatically mounted if exists on the card. Block device nodes(such as /dev/mmcblockp1, /dev/mmcblockp2) are created for user space access.