AM335x MMC/SD Driver's Guide

= 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

Useful Links

 * 1) [MMCA Homepage]
 * 2) [SD ORG Homepage]

Acronyms &amp; Definitions
= 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 ---&gt; Boot options ---&gt; CPU Power Management ---&gt; Floating point emulation ---&gt; Userspace binary formats ---&gt; Power management options ---&gt; [*] Networking support ---&gt; Device Drivers ---&gt; ... ...

Building into Kernel

 * Select MMC/SD/SDIO card support from the menu.

... ... [*] USB support ---&gt; &lt;*&gt; MMC/SD/SDIO card support ---&gt; &lt; &gt; Sony MemoryStick card support (EXPERIMENTAL) ---&gt; ... ...


 * 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 *** '''&lt;*&gt; 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 '''&lt;*&gt;  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:

&lt;M&gt; MMC/SD/SDIO card support ---&gt; '''&lt;M&gt; MMC block device driver '''&lt;M&gt; 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:


 * 1) insmod mmc_core.ko
 * 2) insmod mmc_block.ko
 * 3) 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.