From patchwork Mon Aug 25 03:01:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 4772271 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D04E3C0338 for ; Mon, 25 Aug 2014 03:01:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0588B2012B for ; Mon, 25 Aug 2014 03:01:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2F47420114 for ; Mon, 25 Aug 2014 03:01:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753893AbaHYDBd (ORCPT ); Sun, 24 Aug 2014 23:01:33 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:38145 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753826AbaHYDBd (ORCPT ); Sun, 24 Aug 2014 23:01:33 -0400 Received: by mail-pa0-f53.google.com with SMTP id rd3so19495316pab.26 for ; Sun, 24 Aug 2014 20:01:32 -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:mime-version:to:cc :in-reply-to:references:content-type; bh=oLjDnAJpsYqqJB+asHtF9kB6tFpaqdUZNBesbHBCA9o=; b=Vh06Xvb5mCGFaVE1LSj6BAN3K6xD30jCbGpIp4S0JF5SSBYfeaqVkyUlgb2ocOpBDm zpbaeKIetw/g9cMIlQ7cN6L3D1SHbXFjsh7W/c3VXT24bK/Tk+RpTcrXwzB9NHWwdqaK 0fJzfjE7uZ9Lha0K+tzM1JCrd9ziDMn5MhE5OqRxg4XYkua9blx0Cty+pil7zn9rOz4u bRD7l5b7HBuO1wIholijt2PwlypMCX0Td8hGPYkI3WuNaYY4e2IRvy5WOIygR5RttsZk KNsp9sJzWWQOG2f13GijUZSMefzFRQRSawpo1QN0F/r7ymSwREsVu1uRS7VOOB4dPy1P oLfg== X-Received: by 10.70.88.75 with SMTP id be11mr24832360pdb.69.1408935692755; Sun, 24 Aug 2014 20:01:32 -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 ya1sm35785863pbb.91.2014.08.24.20.01.30 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 24 Aug 2014 20:01:32 -0700 (PDT) Date: Sun, 24 Aug 2014 20:01:32 -0700 (PDT) Message-ID: <874mx1tgqe.wl%kuninori.morimoto.gx@gmail.com> From: Kuninori Morimoto Subject: [PATCH 5/9 v3] mmc: tmio: check ILL_FUNC instead of CBSY User-Agent: Wanderlust/2.14.0 Emacs/23.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") To: Simon , Chris Ball , Ulf Hansson Cc: Ian Molton , Morimoto , Magnus , Linux-SH , linux-mmc@vger.kernel.org In-Reply-To: <87bnr9tgwj.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> <87bnr9tgwj.wl%kuninori.morimoto.gx@gmail.com> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 --- v2 -> v3 - no change 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); }