From: Marek Vasut Date: Tue, 10 Apr 2018 01:49:20 +0200 Subject: [U-Boot] [PATCH 3/5] mmc: matsushita-common: Wait for command completion In-Reply-To: <20180409234922.27072-1-marek.vasut+renesas@gmail.com> References: <20180409234922.27072-1-marek.vasut+renesas@gmail.com> Message-ID: <20180409234922.27072-3-marek.vasut+renesas@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Make sure to wait for the command to complete altogether, including the trailing 8 clock cycles. This prevents the driver for accidentally writing the CMD register too fast before the previous command fully completed. Signed-off-by: Marek Vasut Cc: Jaehoon Chung Cc: Masahiro Yamada --- drivers/mmc/matsushita-common.c | 2 ++ drivers/mmc/matsushita-common.h | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/mmc/matsushita-common.c b/drivers/mmc/matsushita-common.c index e552a09ea1..33224bb51b 100644 --- a/drivers/mmc/matsushita-common.c +++ b/drivers/mmc/matsushita-common.c @@ -498,6 +498,8 @@ int matsu_sd_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, return ret; } + matsu_sd_wait_for_irq(dev, MATSU_SD_INFO2, MATSU_SD_INFO2_SCLKDIVEN); + return ret; } diff --git a/drivers/mmc/matsushita-common.h b/drivers/mmc/matsushita-common.h index 3be91c310e..34631cb43e 100644 --- a/drivers/mmc/matsushita-common.h +++ b/drivers/mmc/matsushita-common.h @@ -38,6 +38,7 @@ #define MATSU_SD_INFO2 0x03c /* IRQ status 2 */ #define MATSU_SD_INFO2_ERR_ILA BIT(15) /* illegal access err */ #define MATSU_SD_INFO2_CBSY BIT(14) /* command busy */ +#define MATSU_SD_INFO2_SCLKDIVEN BIT(13) /* command setting reg ena */ #define MATSU_SD_INFO2_BWE BIT(9) /* write buffer ready */ #define MATSU_SD_INFO2_BRE BIT(8) /* read buffer ready */ #define MATSU_SD_INFO2_DAT0 BIT(7) /* SDDAT0 */ -- 2.16.2