All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mitsyanko <i.mitsyanko@gmail.com>
To: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	qemu-devel@nongnu.org,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Subject: Re: [Qemu-devel] [PATCH arm-devs v3 1/1] sd/sd.c: Fix "inquiry" ACMD41
Date: Mon, 27 May 2013 22:20:18 +0400	[thread overview]
Message-ID: <CA+x0pt7NHJy_pkfY=pruvVoJz29GXTJX5XJ_3yKL0K2aoW_KcQ@mail.gmail.com> (raw)
In-Reply-To: <CAEgOgz6GvAQ0ZsOtMvj1zi8dfC7+5+SPeNDO3BqNy6MyoNyzaA@mail.gmail.com>

On 05/27/2013 06:41 AM, peter.crosthwaite@xilinx.com wrote:
> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>
> QEMU models two (of the three) ACMD41 has two modes, "inquiry" and
> "first". The selection logic for which of the two is incorrect - it
> compares != 0 for the entire argument value rather than only bits 23:0
> as per the spec. Fix.
>
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
> Changed since v2:
> Macroified magic number
> Added explanatory comment (PMM review)
> Changed since v1:
> Total rewrite
>
>   hw/sd/sd.c | 11 +++++++++--
>   1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/hw/sd/sd.c b/hw/sd/sd.c
> index 2e0ef3e..a10313b 100644
> --- a/hw/sd/sd.c
> +++ b/hw/sd/sd.c
> @@ -43,6 +43,8 @@ do { fprintf(stderr, "SD: " fmt , ## __VA_ARGS__); } while (0)
>   #define DPRINTF(fmt, ...) do {} while(0)
>   #endif
>
> +#define ACMD41_ENQUIRY_MASK 0x00ffffff
> +
>   typedef enum {
>       sd_r0 = 0,    /* no response */
>       sd_r1,        /* normal response command */
> @@ -1277,9 +1279,14 @@ static sd_rsp_type_t sd_app_command(SDState *sd,
>           }
>           switch (sd->state) {
>           case sd_idle_state:
> -            /* We accept any voltage.  10000 V is nothing.  */
> -            if (req.arg)
> +            /* We accept any voltage.  10000 V is nothing.
> +             *
> +             * We don't model init delay so just advance straight to ready state
> +             * unless its an enquiry ACMD41 (bits 23:0 == 0).
> +             */
> +            if (req.arg & ACMD41_ENQUIRY_MASK) {
>                   sd->state = sd_ready_state;
> +            }
>
>               return sd_r3;
>
>

Reviewed-by: Igor Mitsyanko <i.mitsyanko@gmail.com>


--
Best wishes,
Igor Mitsyanko
email: i.mitsyanko@gmail.com

  reply	other threads:[~2013-05-27 18:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-22 13:37 [Qemu-devel] [PATCH arm-devs v1 1/5] sd/sd.c: Fix "inquiry" ACMD41 Igor Mitsyanko
2013-05-22 23:42 ` Peter Crosthwaite
2013-05-23 10:31   ` Igor Mitsyanko
2013-05-24  5:07     ` Peter Crosthwaite
2013-05-27 18:20       ` Igor Mitsyanko [this message]
2013-05-27  2:41 [Qemu-devel] [PATCH arm-devs v3 1/1] " peter.crosthwaite

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+x0pt7NHJy_pkfY=pruvVoJz29GXTJX5XJ_3yKL0K2aoW_KcQ@mail.gmail.com' \
    --to=i.mitsyanko@gmail.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.