[U-Boot] "Writing to MMC(%d)... failed"

Przemyslaw Marczak
2015-02-27T13:16:41Z

Hi,

On 02/27/2015 12:59 AM, Nathan wrote:
> I think I've been able to narrow down, a bit, where the issue is coming from.
>
> "mmc_set_blocklen" led me to "mmc_send_cmd" which showed that there is
> the "CONFIG_MMC_TRACE" I could use.
>
> A notable difference between hardkernel's u-boot and mainline was the
> "uint flags;" was no longer in the "mmc_cmd" struct.
>
> I did see that this removal was noted as being a problem back in 2012:
> http://lists.denx.de/pipermail/u-boot/2012-September/133409.html
>
> The result from "saveenv":
>

This is too late for debug. The same result I can see when my card is
not inserted.

> Odroid # saveenv
>
>
> Saving Environment to MMC...
>
>
> Writing to MMC(0)... CMD_SEND:16
>
>
> ARG 0x00000200
>
>
> ret: -19
>
>
> MMC_RSP_R1,5,6,7 0x00000000
>
> I added the "printf" for "ret".
>

You should follow the card init sequence with the trace config, because
it fails at init. This is the trace output from init sequence of my SD card:

MMC: SAMSUNG SDHCI: 0, EXYNOS DWMMC: 1
CMD_SEND:0
ARG 0x00000000
MMC_RSP_NONE
CMD_SEND:8
ARG 0x000001AA
MMC_RSP_R1,5,6,7 0x000001AA
CMD_SEND:55
ARG 0x00000000
MMC_RSP_R1,5,6,7 0x00000120
CMD_SEND:41
ARG 0x40300000
MMC_RSP_R3,4 0x40FF8000
CMD_SEND:55
ARG 0x00000000
MMC_RSP_R1,5,6,7 0x00000120
CMD_SEND:41
ARG 0x40300000
MMC_RSP_R3,4 0x40FF8000
CMD_SEND:55
ARG 0x00000000
MMC_RSP_R1,5,6,7 0x00000120
CMD_SEND:41
ARG 0x40300000
MMC_RSP_R3,4 0xC0FF8000
CMD_SEND:2
ARG 0x00000000
MMC_RSP_R2 0x03534453
0x55303447
0x80273727
0x6900E700

DUMPING DATA
000 - 03 53 44 53
004 - 55 30 34 47
008 - 80 27 37 27
012 - 69 00 E7 00
CMD_SEND:3
ARG 0x00000000
MMC_RSP_R1,5,6,7 0xAAAA0520
CMD_SEND:9
ARG 0xAAAA0000
MMC_RSP_R2 0x400E0032
0x5B590000
0x1D8A7F80
0x0A404000

DUMPING DATA
000 - 40 0E 00 32
004 - 5B 59 00 00
008 - 1D 8A 7F 80
012 - 0A 40 40 00
CMD_SEND:13
ARG 0xAAAA0000
MMC_RSP_R1,5,6,7 0x00000700
CURR STATE:3
CMD_SEND:7
ARG 0xAAAA0000
MMC_RSP_R1,5,6,7 0x00000700
CMD_SEND:55
ARG 0xAAAA0000
MMC_RSP_R1,5,6,7 0x00000920
CMD_SEND:51
ARG 0x00000000
MMC_RSP_R1,5,6,7 0x00000920
CMD_SEND:6
ARG 0x00FFFFF1
MMC_RSP_R1,5,6,7 0x00000900
CMD_SEND:6
ARG 0x80FFFFF1
MMC_RSP_R1,5,6,7 0x00000900
CMD_SEND:55
ARG 0xAAAA0000
MMC_RSP_R1,5,6,7 0x00000920
CMD_SEND:6
ARG 0x00000002
MMC_RSP_R1,5,6,7 0x00000920
CMD_SEND:16
ARG 0x00000200
MMC_RSP_R1,5,6,7 0x00000900
CMD_SEND:17
ARG 0x00000000
MMC_RSP_R1,5,6,7 0x00000900
CMD_SEND:16
ARG 0x00000200
MMC_RSP_R1,5,6,7 0x00000900
CMD_SEND:17
ARG 0x00000000
MMC_RSP_R1,5,6,7 0x00000900
CMD_SEND:16
ARG 0x00000200
MMC_RSP_R1,5,6,7 0x00000900
CMD_SEND:18
ARG 0x00000A00
MMC_RSP_R1,5,6,7 0x00000900
CMD_SEND:12
ARG 0x00000000
MMC_RSP_R1b 0x00000900

I hope this will help you to solve this issue.

Best regards,
--
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com