diff mbox series

[v3,11/18] sdcard: check the card is in correct state for APP CMD (CMD55)

Message ID 20180123033034.29493-12-f4bug@amsat.org
State New
Headers show
Series SDCard: bugfixes, support UHS-I (part 5) | expand

Commit Message

Philippe Mathieu-Daudé Jan. 23, 2018, 3:30 a.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/sd/sd.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Alistair Francis Feb. 1, 2018, 12:27 a.m. UTC | #1
On Mon, Jan 22, 2018 at 7:30 PM, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>

Alistair

> ---
>  hw/sd/sd.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/hw/sd/sd.c b/hw/sd/sd.c
> index bbf9496e8a..434d1fbc47 100644
> --- a/hw/sd/sd.c
> +++ b/hw/sd/sd.c
> @@ -1389,6 +1389,14 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
>
>      /* Application specific commands (Class 8) */
>      case 55:   /* CMD55:  APP_CMD */
> +        switch (sd->state) {
> +        case sd_ready_state:
> +        case sd_identification_state:
> +        case sd_inactive_state:
> +            return sd_illegal;
> +        default:
> +            break;
> +        }
>          if (!sd->spi) {
>              if (sd->rca != rca) {
>                  return sd_r0;
> --
> 2.15.1
>
>
diff mbox series

Patch

diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index bbf9496e8a..434d1fbc47 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -1389,6 +1389,14 @@  static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
 
     /* Application specific commands (Class 8) */
     case 55:	/* CMD55:  APP_CMD */
+        switch (sd->state) {
+        case sd_ready_state:
+        case sd_identification_state:
+        case sd_inactive_state:
+            return sd_illegal;
+        default:
+            break;
+        }
         if (!sd->spi) {
             if (sd->rca != rca) {
                 return sd_r0;