
Hi Albin,
Thanks for all the help :).
After doing some research i found out that I the configuration I need is !CONFIG_ATMEL_MCI1 since I the interface I'm trying to use is MCI0. When I try it out it does seem like it's trying to read from it (it immediately returns with an -EIO if I remove the SD card) and I guess the problem is with the response.
In the for loop in sd_init_card() it should break out of the loop if either there is a return value for mmc_acmd() (which only happens when there's an error) or when (resp[0] & 0x80000000) which I guess is that we read something successfully. When I run "mmc init 0" it never breaks out of that loop. I'm guessing that the response should be something like 0x8XXXXXXXX, then. Am I right? The responses I'm getting are:
mmc: CMD55 0x0 (flags 0x1040) mmc: status 0x0c000025 mmc: response: 00000120 mmc: CMD41 0x100000 (flags 0x41) mmc: status 0x0c040025 mmc: response: 00ff8000
What does this number mean? Am I right in my assumption?
Thanks, Henry
On Tue, Mar 16, 2010 at 6:08 PM, Henry Súcart henry.sucart@gmail.comwrote:
I put the printf you asked for in sd_init_card, right after the for loop. Here's the output:
With #define CONFIG_ATMEL_MCI1 1
U-Boot> mmc init 0 mmc: setting clock 150000 Hz, block size 512
mmc: clock 150000 too low; setting CLKDIV to 255 mmc: CMD0 0x0 (flags 0x0) mmc: status 0x0c000025
mmc: CMD0 0x0 (flags 0x100) mmc: status 0x0c000025
mmc: CMD55 0x0 (flags 0x1040) mmc: status 0x0c000025 mmc: response: 00000000
HJS: MMCI_CR = 0 HJS: sd_init_card() mmc_acmd after for loop. ret: -19, resp[0] = 0x6B200020
mmc: CMD0 0x0 (flags 0x0) mmc: status 0x0c000025
mmc: CMD0 0x0 (flags 0x100) mmc: status 0x0c000025
mmc: CMD1 0x100000 (flags 0x841) mmc: status 0x0c000025 mmc: response: 00000000
...This keeps going for a while and at the end...
mmc: CMD1 0x100000 (flags 0x841) mmc: status 0x0c000025 mmc: response: 00000000 No MMC card found
With #define CONFIG_ATMEL_MCI1 0
U-Boot> mmc init 0 mmc: setting clock 150000 Hz, block size 512
mmc: clock 150000 too low; setting CLKDIV to 255 mmc: CMD0 0x0 (flags 0x0) mmc: status 0x0c000025
mmc: CMD0 0x0 (flags 0x100) mmc: status 0x0c000025
mmc: CMD55 0x0 (flags 0x1040) mmc: status 0x0c000025 mmc: response: 00000000
HJS: MMCI_CR = 0 HJS: sd_init_card() mmc_acmd after for loop. ret: -19, resp[0] = 0x6B200020
mmc: CMD0 0x0 (flags 0x0) mmc: status 0x0c000025
mmc: CMD0 0x0 (flags 0x100) mmc: status 0x0c000025
mmc: CMD1 0x100000 (flags 0x841) mmc: status 0x0c000025 mmc: response: 00000000 mmc: CMD1 0x100000 (flags 0x841) mmc: status 0x0c000025 mmc: response: 00000000 mmc: CMD1 0x100000 (flags 0x841) mmc: status 0x0c000025 mmc: response: 00000000 mmc: CMD1 0x100000 (flags 0x841) mmc: status 0x0c000025 mmc: response: 00000000 mmc: CMD1 0x100000 (flags 0x841) mmc: status 0x0c000025 mmc: response: 00000000
...This keeps going for a while and at the end...
mmc: CMD1 0x100000 (flags 0x841) mmc: status 0x0c000025 mmc: response: 00000000 No MMC card found
If i take out the #define CONFIG_ATMEL_MCI1
U-Boot> mmc init 0 mmc: setting clock 150000 Hz, block size 512
mmc: clock 150000 too low; setting CLKDIV to 255 mmc: CMD0 0x0 (flags 0x0) mmc: status 0x0c000025
mmc: CMD0 0x0 (flags 0x100) mmc: status 0x0c000025
mmc: CMD55 0x0 (flags 0x1040) mmc: status 0x0c000025 mmc: response: 00000120 mmc: CMD41 0x100000 (flags 0x41) mmc: status 0x0c040025 mmc: response: 00ff8000 mmc: CMD55 0x0 (flags 0x1040) mmc: status 0x0c000025 mmc: response: 00000120 mmc: CMD41 0x100000 (flags 0x41) mmc: status 0x0c040025 mmc: response: 00ff8000
... Goes on for a while...
HJS: MMCI_CR = 0 HJS: sd_init_card() mmc_acmd for loop ret: -110, resp[0] = 0x00FF8000
mmc: CMD0 0x0 (flags 0x0) mmc: status 0x0c000025
mmc: CMD0 0x0 (flags 0x100) mmc: status 0x0c000025
mmc: CMD1 0x100000 (flags 0x841) mmc: status 0x0c100025
mmc: command 1 failed (status: 0x0c100025) HJS: error_flags: 0x005B0000, status & error_flags: 0x00100000 HJS: mmc_init_card() ret = -5 HJS: mmc_init_card failed No MMC card found
In all of them I used the slot J6. I tried it with J5 too but it did the same thing.
On Tue, Mar 16, 2010 at 4:36 PM, Albin Tonnerre < albin.tonnerre@free-electrons.com> wrote:
On Tue, 16 Mar 2010 08:30 -0400, Henry Súcart wrote :
Here's the command I'm using and the output. I put a debugging statement
in
sd_init_card() after the for loop (HJS:).
U-Boot> mmc init 0 mmc: clock 150000 too low; setting CLKDIV to 255 HJS: sd_init_card() mmc_acmd for loop finished. ret = -19, resp[0] = 0x6B200020 No MMC card found
Err, well, that's weird. I have to admit I can't even guess whether it's trying to read the right slot. Could you please:
1/ add a #define DEBUG at the top of drivers/mmc/atmel_mci.c 2/ get the output of mmc init (0 or 1 doesn't matter) for both CONFIG_ATMEL_MCI1 and !CONFIG_ATMEL_MCI1 (with the SD card staying in the same slot, of course) 3/ In the process, add a debug printf in the mci driver displaying the value of MMCI_CR (you'd get that by calling mmci_readl(CR))
I'm sorry I can't help you further. Unfortunately I don't own such hardware, and this kind of thing is rather hard to debug remotely.
Regards,
Albin Tonnerre, Free Electrons Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com