From patchwork Fri Nov 24 16:24:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 119605 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2443112qgn; Fri, 24 Nov 2017 08:26:53 -0800 (PST) X-Google-Smtp-Source: AGs4zMbHb92cHzLyOQ03HBM/mOLI2OShP5Bd3B/tBmcM2qWiagE2LKPdNthgo83/4Jn64mTHY4mu X-Received: by 10.99.39.198 with SMTP id n189mr27630563pgn.78.1511540813501; Fri, 24 Nov 2017 08:26:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511540813; cv=none; d=google.com; s=arc-20160816; b=zsFjMFreCxoj/nwAHG+RTPNElcjh/KNnm1FfyOimKtk3MxLnpP0Re0JiZAW/hjQ8gt 05vO2DIpKOp7emg8xrt+9GM0NuUIYH6srgDwimPdtEn5ZpPJkJyv2/VWlbrOlIIxie3p hEIDz+SX0oaxSlmP91USy3FbOF5Td/x7o6QOVGUgiT3tRDhzmMFMoL+4J5ooo27/ij6l IwpemTDrIMgeBi8Ob4Dc8p/vM4rz5Sp38inwQiBsyMWURRtxmYB6dTRHLTurMZwKzD6Z q4ZxqwhzgZ1EGFQMHZKwFRPfjw4hNrWtXuMhM6OtmpBXyRuhUgmei0AXCq3HVuIyQpGn GNIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=8C+zOhnbQeTYvpea7T5tGqAWNkgTREME6b/JsxyFNTQ=; b=R7+pPolVrLhNMFhelE2Px6wGO0tttZiwCatVpsEMtGLGLWLI5N0meypcw3UrWD/cEi dL2+4nd0rBArylTkAKNAOX9gNIDkCCnhm3//5lAjb6+EFlgLAPa8xQTk4L6GDGjjrWwN lalvnjtwDOibdb70XBOnsduWx7ymccpbMnkmmA4e9OLpmyB9VNqQdafh64i5+vtFvcs7 GEnOmbE+mVcjENzz5dqvMIUn8R0FMGz9ZB23yyISACdc+aJxAFe1bz4ZpunKAAB496CU +j5MfNoxj/nodd0c1oLIHsbVHCdZT8XDgSs9MUcPNUXFfw/49CJh51oIRwFYa0GrBLev Yvrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=u4TGr6fs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a2si19621426plt.229.2017.11.24.08.26.53; Fri, 24 Nov 2017 08:26:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=u4TGr6fs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753830AbdKXQ0L (ORCPT + 28 others); Fri, 24 Nov 2017 11:26:11 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:61628 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751983AbdKXQ0I (ORCPT ); Fri, 24 Nov 2017 11:26:08 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-11.nifty.com with ESMTP id vAOGP9W3007100; Sat, 25 Nov 2017 01:25:23 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com vAOGP9W3007100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1511540724; bh=8C+zOhnbQeTYvpea7T5tGqAWNkgTREME6b/JsxyFNTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u4TGr6fsJMVEyzotJiclYDMGgsBO+Y+XliUbzzw62IY0HaiqQT8U98Kzo1FVYxLtQ cB/Sepjy2QY0MZLjImYze58W7R8QmJwopqy6Zf7sAr3zWyoL042a3LLa1dw8lXQnY4 xrisL1AxVD97aNVqHJnUsQFLko8+3odjfIf8RNr69GYBkKOv8KKpAMDvHoOk42NXiN D7loL091kESR85dwAt3Cs7MSQUkHztSXbZI1H2Su1FmcD8UKb6j2zUI4G/3RU5xSIU bljgPMpi00nWRuYt3NnOL4Dunk+QwaIjEK3kjxF22rFBAr6AMtmzwoYbZREPXOD10+ CodV/apTPGgkA== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v2 17/22] mmc: tmio: move TMIO_MASK_{READOP, WRITEOP} handling to correct place Date: Sat, 25 Nov 2017 01:24:52 +0900 Message-Id: <1511540697-27387-18-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> References: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This driver was largely extended by Renesas, but actually used by several SoC vendors. The current code does not work for UniPhier SoCs at least. The DMA mode for UniPhier SoCs failed with the following error message: PIO IRQ in DMA mode! For UniPhier SoCs, the TMIO_MASK_{READOP,WRITEOP} are asserted in the DMA mode as well. In fact, the code is very strange. The TMIO_MASK_{READOP,WRITEOP} IRQs are set as follows: /* Unmask the IRQs we want to know about */ if (!_host->chan_rx) irq_mask |= TMIO_MASK_READOP; if (!_host->chan_tx) irq_mask |= TMIO_MASK_WRITEOP; At this point, _host->{chan_rx,chan_tx} are _always_ NULL because tmio_mmc_request_dma() is called after this code. Consequently, TMIO_MASK_{READOP,WRITEOP} are set whether DMA is used or not. tmio_mmc_cmd_irq() enables TMIO_MASK_{READOP,WRITEOP}, but never disables them. This does not take care of a case where ->force_pio is set, but unset later. After all, the correct place to handle those flags is just before starting the data transfer. Signed-off-by: Masahiro Yamada --- Changes in v2: - Newly added drivers/mmc/host/tmio_mmc_core.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 7d169ed..345e379 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -621,15 +621,19 @@ static void tmio_mmc_cmd_irq(struct tmio_mmc_host *host, unsigned int stat) */ if (host->data && (!cmd->error || cmd->error == -EILSEQ)) { if (host->data->flags & MMC_DATA_READ) { - if (host->force_pio || !host->chan_rx) + if (host->force_pio || !host->chan_rx) { tmio_mmc_enable_mmc_irqs(host, TMIO_MASK_READOP); - else + } else { + tmio_mmc_disable_mmc_irqs(host, TMIO_MASK_READOP); tasklet_schedule(&host->dma_issue); + } } else { - if (host->force_pio || !host->chan_tx) + if (host->force_pio || !host->chan_tx) { tmio_mmc_enable_mmc_irqs(host, TMIO_MASK_WRITEOP); - else + } else { + tmio_mmc_disable_mmc_irqs(host, TMIO_MASK_WRITEOP); tasklet_schedule(&host->dma_issue); + } } } else { schedule_work(&host->done); @@ -1285,12 +1289,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host, _host->sdcard_irq_mask = sd_ctrl_read16_and_16_as_32(_host, CTL_IRQ_MASK); tmio_mmc_disable_mmc_irqs(_host, TMIO_MASK_ALL); - /* Unmask the IRQs we want to know about */ - if (!_host->chan_rx) - irq_mask |= TMIO_MASK_READOP; - if (!_host->chan_tx) - irq_mask |= TMIO_MASK_WRITEOP; - _host->sdcard_irq_mask &= ~irq_mask; if (_host->native_hotplug)