From patchwork Fri Aug 22 08:40:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 4762251 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 99A969F37E for ; Fri, 22 Aug 2014 08:40:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D227E200DC for ; Fri, 22 Aug 2014 08:40:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 79DC320172 for ; Fri, 22 Aug 2014 08:40:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755257AbaHVIk1 (ORCPT ); Fri, 22 Aug 2014 04:40:27 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:32994 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755212AbaHVIk0 (ORCPT ); Fri, 22 Aug 2014 04:40:26 -0400 Received: by mail-pa0-f50.google.com with SMTP id et14so15892459pad.37 for ; Fri, 22 Aug 2014 01:40:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:message-id:from:subject:user-agent:to:cc:in-reply-to :references:mime-version:content-type; bh=letg1ukOSf/XGuMv6lerjwndHZh6Jzky9q6jBJzbMVM=; b=vD0wvxgfxIE7elon7ECaeKvAf7l5MCD+HfvJDfrJ2kCb5vpFQVb3q+i6G7YwbIgsUH URHM6I7PQAhlgYSy4Dt1vIDreWvVbMaROeaZxBIJE4WmeoRkILHK6uxOvDkrc++bwlpL 7hbzOn52Hedq9DeIbYORPbXt0eoRgn1Li26X2Nl8uuEus/MpebviylW2/zN1EEKPINW3 e3NjI728Y55B+ToXBHnVTuRiRbOcjQUf6A/bLWpiZlAccGhOQOCbms9RPxKzKNuZztoI wLmf6tgrXVivRdbMO1dG5HxNMN4iMlHyMKzLsCGe9Er6Q+udk6YNUb83JX9+n8eYwlct aehw== X-Received: by 10.66.190.167 with SMTP id gr7mr4448088pac.75.1408696825848; Fri, 22 Aug 2014 01:40:25 -0700 (PDT) Received: from remon.gmail.com (49.14.32.202.bf.2iij.net. [202.32.14.49]) by mx.google.com with ESMTPSA id qq1sm27892797pbc.71.2014.08.22.01.40.23 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 22 Aug 2014 01:40:25 -0700 (PDT) Date: Fri, 22 Aug 2014 01:40:25 -0700 (PDT) Message-ID: <87wqa06hoo.wl%kuninori.morimoto.gx@gmail.com> From: Kuninori Morimoto Subject: [PATCH 06/10 v2 resend] mmc: tmio: check ILL_FUNC instead of CBSY User-Agent: Wanderlust/2.14.0 Emacs/23.3 Mule/6.0 To: Simon , Chris Ball Cc: Ian Molton , Morimoto , Magnus , Linux-SH , linux-mmc@vger.kernel.org In-Reply-To: <8761hk7wgy.wl%kuninori.morimoto.gx@gmail.com> References: <87simtenpi.wl%kuninori.morimoto.gx@renesas.com> <87pphxe2q0.wl%kuninori.morimoto.gx@renesas.com> <53AD638C.5060907@renesas.com> <87egxehsec.wl%kuninori.morimoto.gx@gmail.com> <8761hk7wgy.wl%kuninori.morimoto.gx@gmail.com> MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Shinobu Uehara Some controllers need to check SD bus status when writing data. Then, it checks ILL_FUNC bit on SD_INFO2 register, and this method is controlled via TMIO_MMC_HAS_IDLE_WAIT flags. Same method is required on tmio_mmc_data_irq() which will be called after writing data. Current driver is checking CBSY bit for this purpose, but, some controllers doesn't have CBSY bit. This patch checks ILL_FUNC bit instead of CBSY bit if it has TMIO_MMC_HAS_IDLE_WAIT flags [Kuninori Morimoto: tidyuped for upstreaming] Tested-by: Nguyen Xuan Nui Tested-by: Hiep Cao Minh Signed-off-by: Shinobu Uehara Signed-off-by: Kuninori Morimoto --- drivers/mmc/host/tmio_mmc_pio.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c index e51a993..b19d0cd 100644 --- a/drivers/mmc/host/tmio_mmc_pio.c +++ b/drivers/mmc/host/tmio_mmc_pio.c @@ -475,6 +475,9 @@ static void tmio_mmc_data_irq(struct tmio_mmc_host *host) goto out; if (host->chan_tx && (data->flags & MMC_DATA_WRITE) && !host->force_pio) { + u32 status = sd_ctrl_read32(host, CTL_STATUS); + bool done = false; + /* * Has all data been written out yet? Testing on SuperH showed, * that in most cases the first interrupt comes already with the @@ -483,7 +486,15 @@ static void tmio_mmc_data_irq(struct tmio_mmc_host *host) * DATAEND interrupt with the BUSY bit set, in this cases * waiting for one more interrupt fixes the problem. */ - if (!(sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_CMD_BUSY)) { + if (host->pdata->flags & TMIO_MMC_HAS_IDLE_WAIT) { + if (status & TMIO_STAT_ILL_FUNC) + done = true; + } else { + if (!(status & TMIO_STAT_CMD_BUSY)) + done = true; + } + + if (done) { tmio_mmc_disable_mmc_irqs(host, TMIO_STAT_DATAEND); tasklet_schedule(&host->dma_complete); }