Merge tag 'ti-v2020.07-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti
[oweals/u-boot.git] / drivers / mmc / sandbox_mmc.c
index 8a5d256c11516e9fe474cf5f9ab6a7606857d538..899952d773cdd063122cbb37382f5e8bf82c6231 100644 (file)
@@ -1,8 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (c) 2015 Google, Inc
  * Written by Simon Glass <sjg@chromium.org>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -12,8 +11,6 @@
 #include <mmc.h>
 #include <asm/test.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 struct sandbox_mmc_plat {
        struct mmc_config cfg;
        struct mmc mmc;
@@ -30,6 +27,7 @@ static int sandbox_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
 {
        switch (cmd->cmdidx) {
        case MMC_CMD_ALL_SEND_CID:
+               memset(cmd->response, '\0', sizeof(cmd->response));
                break;
        case SD_CMD_SEND_RELATIVE_ADDR:
                cmd->response[0] = 0 << 16; /* mmc->rca */
@@ -46,11 +44,14 @@ static int sandbox_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
        case MMC_CMD_SEND_CSD:
                cmd->response[0] = 0;
                cmd->response[1] = 10 << 16;    /* 1 << block_len */
+               cmd->response[2] = 0;
+               cmd->response[3] = 0;
                break;
        case SD_CMD_SWITCH_FUNC: {
                if (!data)
                        break;
                u32 *resp = (u32 *)data->dest;
+               resp[3] = 0;
                resp[7] = cpu_to_be32(SD_HIGHSPEED_BUSY);
                if ((cmd->cmdarg & 0xF) == UHS_SDR12_BUS_SPEED)
                        resp[4] = (cmd->cmdarg & 0xF) << 24;