Hi Sascha

Thanks for your reply.

>  No information available:
>   MCI card not probed yet
> Parameters:
>            probe = 0
> sid1-noah:/ mci0.probe=1
> imx-esdhc@imx-esdhc0: timeout 1
> Cannot reset the SD/MMC card
> set parameter: Connection timed out
> sid1-noah:/
>
> Any ideas? What are possible causes of this?

Does the SD card work in the first stage loader? If yes, you could try
to remove the mux setup from barebox, so that you can be sure that you
do not misconfigure things that were already configured correctly.
I have no hardware handy to test the driver on a i.MX25, but Erics
Eukrea board has MMC support, so I believe the driver should work in
general.


I have sprinkled some printf's over the code and enabled DEBUG in the mci driver. It goes into timeout:

Board: SID1 NOAH
registered netconsole as cs1
imx-esdhc@mci0: registered as mci0
esdhc_init: enble cache snooping
esdhc_init: reset host controller
esdhc_init: controller available
esdhc_init: set clock
esdhc_init: disable BRR and BWR bits
esdhc_init: Put PROCTL reg back
esdhc_init: Set timeout to max value
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=0
esdhc_send_cmd: send transfer type=0
esdhc_send_cmd: wait on timeout
imx-esdhc@imx-esdhc0: timeout 1
mci_go_idle: send command returned with -110
mci@mci0: Activating IDLE state failed: -110
Cannot reset the SD/MMC card
ehci@ehci0: USB EHCI 1.00
cfi_flash@cfi_flash0: found cfi flash at a0000000, size 67108864
Malloc space: 0x83b00000 -> 0x83efffff (size  4 MB)
Stack space : 0x83af8000 -> 0x83b00000 (size 32 kB)
envfs: wrong magic on /dev/env0
no valid environment found on /dev/env0. Using default environment
running /env/bin/init...

Checking drivers/mci/imx-esdhc.c:

       /* Wait for the command to complete */
        ret = wait_on_timeout(100 * MSECOND,
                        esdhc_read32(&regs->irqstat) & IRQSTAT_CC);
        if (ret) {
                dev_err(host->dev, "timeout 1\n");
                return -ETIMEDOUT;
        }

One would suppose that 100msecs should be more than enough, considering the slow speed one would see. Could there be an issue with the dozen or so errata from Freescale with regard to SD card? What else could cause the card not to reply within the large timeout specified?

Funny enough, commenting the following IOMUX pad settings specific to the ESDHC:
 
       // MX25_PAD_SD1_CMD__SD1_CMD,
       // MX25_PAD_SD1_CLK__SD1_CLK,
       // MX25_PAD_SD1_DATA0__SD1_DATA0,
       // MX25_PAD_SD1_DATA1__SD1_DATA1,
       // MX25_PAD_SD1_DATA2__SD1_DATA2,
       // MX25_PAD_SD1_DATA3__SD1_DATA3,

shows promising results:

Board: SID1 NOAH
registered netconsole as cs1
imx-esdhc@mci0: registered as mci0
esdhc_init: enble cache snooping
esdhc_init: reset host controller
esdhc_init: controller available
esdhc_init: set clock
esdhc_init: disable BRR and BWR bits
esdhc_init: Put PROCTL reg back
esdhc_init: Set timeout to max value
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=0
esdhc_send_cmd: send transfer type=0
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
mci_go_idle: send command returned with 0
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=426
esdhc_send_cmd: send transfer type=135921664
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
mci@mci0: SD Card Rev. 2.00 or later detected
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=0
esdhc_send_cmd: send transfer type=924450816
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=1077280768
esdhc_send_cmd: send transfer type=687996928
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=0
esdhc_send_cmd: send transfer type=924450816
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=1077280768
esdhc_send_cmd: send transfer type=687996928
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=0
esdhc_send_cmd: send transfer type=924450816
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=1077280768
esdhc_send_cmd: send transfer type=687996928
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=0
esdhc_send_cmd: send transfer type=924450816
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=1077280768
esdhc_send_cmd: send transfer type=687996928
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=0
esdhc_send_cmd: send transfer type=924450816
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=1077280768
esdhc_send_cmd: send transfer type=687996928
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
mci@mci0: Put the Card in Identify Mode
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=0
esdhc_send_cmd: send transfer type=34144256
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
mci@mci0: Card's identification data is: 1B534D30-30303030-101ABB6A-9500AB00
mci@mci0: Get/Set relative address
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=0
esdhc_send_cmd: send transfer type=52035584
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
mci@mci0: Get card's specific data
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=131072
esdhc_send_cmd: send transfer type=151584768
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
mci@mci0: Card's specific data is: 007FFF32-5B5A83BA-F6DBDFFF-0E800000
mci@mci0: Transfer speed: 25000000
mci@mci0: Max. block length are: Write=1024, Read=1024 Bytes
mci@mci0: Capacity: 1910 MiB
mci@mci0: Limiting max. read block size down to 512
mci@mci0: Limiting max. write block size down to 512
mci@mci0: Read block length: 512, Write block length: 512
mci@mci0: Select the card, and put it into Transfer Mode
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=131072
esdhc_send_cmd: send transfer type=119209984
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
mci@mci0: Changing transfer frequency
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=131072
esdhc_send_cmd: send transfer type=924450816
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
mci@mci0: Trying to read the SCR (try 1 of 3)
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: setup data transfer
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=0
esdhc_send_cmd: send transfer type=859439121
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: setup data transfer
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=16777201
esdhc_send_cmd: send transfer type=104464401
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: setup data transfer
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=-2130706447
esdhc_send_cmd: send transfer type=104464401
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
mci@mci0: Prepare for bus width change
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=131072
esdhc_send_cmd: send transfer type=924450816
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
mci@mci0: Set SD bus width to 4 bit
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=2
esdhc_send_cmd: send transfer type=102367232
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=512
esdhc_send_cmd: send transfer type=270139392
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
mci@mci0: Card is up and running now, registering as a disk
mci@mci0: registered disk0
mci@mci0: mci_sd_read: Read 1 block(s), starting at 0
esdhc_send_cmd: wait at least 8 SD clock cycles
esdhc_send_cmd: setup data transfer
esdhc_send_cmd: figure out transfer arguments
esdhc_send_cmd: send command=0
esdhc_send_cmd: send transfer type=289013777
esdhc_send_cmd: wait on timeout
esdhc_send_cmd: wait for command to complete
mci@mci0: No partition table found
mci@mci0: SD Card successfully added
ehci@ehci0: USB EHCI 1.00
cfi_flash@cfi_flash0: found cfi flash at a0000000, size 67108864
Malloc space: 0x83b00000 -> 0x83efffff (size  4 MB)
Stack space : 0x83af8000 -> 0x83b00000 (size 32 kB)
envfs: wrong magic on /dev/env0
no valid environment found on /dev/env0. Using default environment
running /env/bin/init...
id1-noah:/ devinfo mci0
resources:
driver: mci

 Card:
  Attached is an SD Card (Version: 2.0)
  Capacity: 1910 MiB
   CID: 1B534D30-30303030-101ABB6A-9500AB00
   CSD: 007FFF32-5B5A83BA-F6DBDFFF-0E800000
  Max. transfer speed: 25000000 Hz
  Manufacturer ID: 1B
  OEM/Application ID: 534D
  Product name: '00000'
  Product revision: 1.0
  Serial no: 448490133
  Manufacturing date: 11.2010
no parameters available

What's going on here? I'll investigate this further, because in real life I have massive SD card write speed issues on my mx25 device on any kernel tested from 2.6.37 to 3.3.4 so far.

Best regards
Roberto