Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.development.system > #770

Re: mmc_send_app_op_cond in drivers/mmc/core/sd_ops.c

Newsgroups comp.os.linux.development.system
Date 2017-06-23 04:07 -0700
References <291efc45-0663-42f1-a1a5-836c08a86fbd@googlegroups.com>
Message-ID <aaeb615c-4174-430e-a76f-6ca9b652abab@googlegroups.com> (permalink)
Subject Re: mmc_send_app_op_cond in drivers/mmc/core/sd_ops.c
From manuscheung@gmail.com

Show all headers | View raw


On Friday, 23 June 2017 18:56:33 UTC+8, manus...@gmail.com  wrote:
> Hello,
> 
>    It looks like to me that the mmc driver does not implement ACMD41 correctly for SD initialization. The SD spec says that if response of ACMD41 returns busy state, the host shall re-issue ACMD41 until 1) card is ready or 2) one second is over.
> 
>    Below shows the function "mmc_send_app_op" which issues ACMD41. If response of first ACMD41 command returns busy state, it will exit the outer "for" loop immediately (see my comment). 
> 
>    This obviously does not follow the SD spec. Right?
> 
> 
> int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
> {
>    struct mmc_command cmd = {0};
>    int i, err = 0;
> 
>    ....
>    ....
>    for (i = 100; i; i--) {
>      err = mmc_wait_for_app_cmd(host, NULL, &cmd, MMC_CMD_RETRIES);
>      if (err)
>         break;
> 
>      /* if we're just probing, do a single pass */
>      if (ocr == 0)
>         break;
> 
>      /* otherwise wait until reset completes */
>      if (mmc_host_is_spi(host)) {
>        if (!(cmd.resp[0] & R1_SPI_IDLE))
>           break;
>      } else {
>        if (cmd.resp[0] & MMC_CARD_BUSY)
>           break;
>      }
> 
>      err = -ETIMEDOUT;
>      mmc_delay(10);
>    }
>    /* we already reach here if cmd.resp[0]=MMC_CARD_BUSY 
>       for the first ACMD41! */
>    ....  
>    ....
> }

Fix typo in the comment ...

   /* we already reach here if (cmd.resp[0] & MMC_CARD_BUSY) is nonzero
      for the first ACMD41! */

Back to comp.os.linux.development.system | Previous | NextPrevious in thread | Find similar


Thread

mmc_send_app_op_cond in drivers/mmc/core/sd_ops.c manuscheung@gmail.com - 2017-06-23 03:56 -0700
  Re: mmc_send_app_op_cond in drivers/mmc/core/sd_ops.c manuscheung@gmail.com - 2017-06-23 04:07 -0700

csiph-web