[U-Boot] [PATCH v3] AT91: MCI: add SD/MMC driver using mmc framework

Brandon Stafford brandon at rascalmicro.com
Tue Dec 14 22:12:51 CET 2010


On 17.08.2010 07:05, Reinhard Meyer wrote:
> This patch adds SD/MMC support to AT91SAM9260/9XE/9G20
> using the generic MMC framework.
>
> Signed-off-by: Reinhard Meyer <u-b... at emk-elektronik.de>
--------------------------------------------------------
<snip>
--------------------------------------------------------
> +
> +This is a new approach to use Atmel MCI hardware with the
> +general MMC framework. Therefore it benefits from that
> +framework's abilities to handle SDHC Cards and the ability
> +to write blocks.
> +
> +- AT91SAM9XE512 (tested, will definitely work with XE128 and XE256)
> +- AT91SAM9260 (not tested, but MCI is to AT91SAM9XE)
> +- AT91SAM9G20 (not tested, should work)

I just tested this with U-boot 2010.09 on a custom AT91SAM9G20 board
that uses the same MMC connection on MCDA as the 9G20 EK. As Reinhard
recommends in README.atmel_mci, I applied an additional patch to
board/atmel/at91sam9260ek/at91sam9260ek.c and #defines to
include/configs/at91sam9260ek.h. The details of this are described in
README.atmel_mci and can be confirmed against this commit in my git
repository: https://github.com/rascalmicro/u-boot-rascal/commit/e00be423458ee5fa6764f17a21b2f8577158b198

With an old 2 GB SanDisk card I had from a Technologic Systems board,
it works as expected. I have not tested it with an SDHC card.

For reference, here's a transcript from U-boot:

    U-Boot> mmc list
    mci: 0
    U-Boot> mmc part 0
    mci: setting clock 258000 Hz, block size 512
    mci: setting clock 258000 Hz, block size 512
    mci: setting clock 258000 Hz, block size 512
    mci: setting clock 258000 Hz, block size 512
    mci: setting clock 22016000 Hz, block size 512

    Partition Map for MMC device 0  --   Partition Type: DOS

    Partition     Start Sector     Num Sectors     Type
        1		       256	   2621184	 c
        2		   2621440	      4096	da
        3		   2625536	      4096	da
        4		   2629632	   1048576	83
    U-Boot> mmc read 0 0 0 1

    MMC read: dev # 0, block # 0, count 1 ... mci: setting clock
258000 Hz, block size 512
    mci: setting clock 22016000 Hz, block size 512
    mci: setting clock 258000 Hz, block size 512
    mci: setting clock 258000 Hz, block size 512
    mci: setting clock 22016000 Hz, block size 512
    1 blocks read: OK
    U-Boot> fatls mmc 0:1
                binaries/
                sources/
                distributions/
                samples/
                workspace/
         3740   readme.txt
          116   technologic systems website.url
                cross-toolchains/
                devel-tools/
          507   runeclipse-win.bat
          517   runeclipse-win-diskc.bat

        4 file(s), 7 dir(s)

Thanks to Reinhard for the code.

Cheers,
Brandon Stafford
Rascal Micro


More information about the U-Boot mailing list