- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to get MMC working with version 2010.06 of U-Boot.
There were several problems. The first one is that the structure of the directories is different. At http://www.nioswiki.com/dasuboot/u-boot_and_cyclone_ii-de2_boards explains that file mmc_spi.c must be copied to cpu/nios2. This is changed the last version to U-Boot u-boot\arch\nios2\cpu I changed in the Makefile:
COBJS = cpu.o interrupts.o sysid.o traps.o epcs.o
to
COBJS = cpu.o interrupts.o sysid.o traps.o epcs.o mmc_spi.o
The second problem was that the file mmc.h must be copie to include/asm-nios2/arch-nios2/ according the wiki. This is changed in the last version of U-Boot to u-boot\arch\nios2\include\asm Because of this I had to change the include files in the mmc_spi.c from: # include <common.h># include <nios2-io.h># include <asm/io.h># include <mmc.h>
to # include <common.h># include <nios2-io.h># include <asm/io.h># include <asm/mmc.h>
The API of MMC in u-boot changed as well and therefor I had to change the function:
int mmc_read(ulong addr, uchar *buff,int size)
into:
int mmc_read(struct mmc *mmc, u64 src, uchar *dst, int size)
The function:
int mmc_init(int verbose)
changed into:
int mmc_legacy_init(int verbose)
At this point the code compiled with no warning! But the driver crached with no error when I called "mmc init mmc0" After some research I found out that the problem was still in the mmc.h file. The marco (for example): # define SPI_TXDATA(val) writel( MMC_SPI_BASE + 4, (val))
is calling writel. The parameters to call this functions changed!! Orgineel (read old U-Boot): # define writel(addr,val)
asm volatile ("stwio %1, 0(%0)" : : "r" (addr), "r" (val))
New (read current u-boot): # define writel(val,addr)
asm volatile ("stwio %0, 0(%1)" : : "r" (val), "r" (addr))
/
Therefor a changed all the marcos with (addr) and (val) swapped (for example):
# define SPI_TXDATA(val) writel( MMC_SPI_BASE + 4, (val))
changed to: # define SPI_TXDATA(val) writel((val), MMC_SPI_BASE + 4)
I recompiled U-boot, the driver is not crashing anymore when I called "mmc init mmc0", but the output is: No MMC card found The function mmc_legacy_init is return -1. I located the problem at:
send_cmd(cmd0); /* GO_IDLE_STATE */
if (rcv_response(0, rsp, 0))
{
return -1;
}
At this piont I don't know how to get MMC to work. Has someone an idea?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have rewritten my first (initial) post!

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page