Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753751AbbBTAVe (ORCPT ); Thu, 19 Feb 2015 19:21:34 -0500 Received: from mail-ie0-f174.google.com ([209.85.223.174]:37764 "EHLO mail-ie0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753017AbbBTAVb (ORCPT ); Thu, 19 Feb 2015 19:21:31 -0500 MIME-Version: 1.0 In-Reply-To: <1423894668-8886-4-git-send-email-addy.ke@rock-chips.com> References: <1423828368-18456-1-git-send-email-addy.ke@rock-chips.com> <1423894668-8886-1-git-send-email-addy.ke@rock-chips.com> <1423894668-8886-4-git-send-email-addy.ke@rock-chips.com> Date: Thu, 19 Feb 2015 16:21:31 -0800 X-Google-Sender-Auth: sb140kKfOEncSMD_k52SzXCM_S0 Message-ID: Subject: Re: [PATCH v4 3/3] mmc: dw_mmc: Don't start command while data busy From: Doug Anderson To: Addy Ke Cc: Jaehoon Chung , Ulf Hansson , Olof Johansson , Alim Akhtar , Andrzej Hajda , =?UTF-8?Q?Heiko_St=C3=BCbner?= , Eddie Cai , lintao , Tao Huang , "linux-kernel@vger.kernel.org" , "linux-mmc@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "open list:ARM/Rockchip SoC..." , Javier Martinez Canillas Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1787 Lines: 48 Addy, On Fri, Feb 13, 2015 at 10:17 PM, Addy Ke wrote: > We should wait until unbusy before the next request. > But this does't need if the command is CMD13, which can access > SD Status register regardless of data busy. > > Signed-off-by: Addy Ke > --- > Changes in v4: > - CMD13 doesn't need wait until unbusy. > > drivers/mmc/host/dw_mmc.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c > index ac21863..692d97a 100644 > --- a/drivers/mmc/host/dw_mmc.c > +++ b/drivers/mmc/host/dw_mmc.c > @@ -1076,6 +1076,10 @@ static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq) > > WARN_ON(slot->mrq); > > + /* Wait until unbusy if the command isn't CMD13 */ > + if (mrq->cmd->opcode != MMC_SEND_STATUS) > + dw_mci_wait_busy(slot); > + I think you need to be more general. You really should be checking "cmd_flags & SDMMC_CMD_PRV_DAT_WAIT". That leverages dw_mmc's knowledge about whether it needs to wait. Right now you'll be waiting for CMD52 (SDIO) which I don't think is a good idea. It also seems like this would be better in dw_mci_start_command() so that we have the least chance of hitting the case. The downside is that you can't sleep there, though... Hrm. I updated a version of my take on this at . I'll put a timeout on it soon-ish. Any extra testing that folks can do would be appreciated... -Doug -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/