From patchwork Wed Jan 17 16:28:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 124832 Delivered-To: patch@linaro.org Received: by 10.46.62.1 with SMTP id l1csp103378lja; Wed, 17 Jan 2018 08:29:35 -0800 (PST) X-Google-Smtp-Source: ACJfBot87mUBSuzpAdW/ZbbEc12RVJRoA1s6ZooimLAfmc6fQn9JvkTtfCFAtiB1WQpZbwFddddX X-Received: by 10.84.242.68 with SMTP id c4mr38916942pll.414.1516206575223; Wed, 17 Jan 2018 08:29:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516206575; cv=none; d=google.com; s=arc-20160816; b=e+0d99SnsguNz7WoWFBuA/VXl+3MqaEsa28sHOUS2YPeqJupIJHsLvEvbL+uLDERxp W9i0S6WY9RGl4W6GAwYWlyfwxbuSPDLV6gV3RcSVovaN4IfQ0MPO5e2sExvWT/I3qvoI aUzoeYBItIOlqn0cQfhbHo3II3mRElUUJUWce98Y47wedLjwrXxsdAGTv+xQp68ym7xk VRjQ99XOUA9ua5SmlMZlMHcHQQrf1EbGvbOzxbVoFKdaNTJzAUj9+QhqVGN7qX5rgqyR hsXl0fD1NIO1CV1ZowRoP8qlhd7ad0EOYhkFE8RCCurSLUPIpV80UdSF/kiXXZ5uJeGY LH1A== 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=r4ZmCZDxlHlOo96b+S+ZUMmcTaYSQ2A7BfWV1AvMTI4=; b=sMd9LcE6aG6oSa5nPidS1LsXzMWYzQ79/IayKWsHmbKFUdPMC11jx9RLkpJ1wGPVUB Kg8gKWlpz71ctMJNAI+GAa/USgGLiKChr6CQN7O5wZ2vunuCooiwzKOhRjfFD+loZ9g5 +Lz4DIPMjMwlY8xmjpmCZYJsDoD7ZGEqMCkLF5zPwAsYtlr3MyQ4zh6S4JlC7D3InFet xWHDOKY0osYGHnJM5LcDrESWlScsPiPbZn6gfMIPySAuwnz+XKw2DNHX6+1BQn/WquPT qrmE31bGMbFKV9QkprAU1CZgVE35PDzg+Uc/aDSA8jahunBKR3boQoUtiRsDVrQzBgOz K1vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=daTMoMcJ; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-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 w4si3995573pgp.486.2018.01.17.08.29.35; Wed, 17 Jan 2018 08:29:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=daTMoMcJ; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753888AbeAQQ3d (ORCPT + 6 others); Wed, 17 Jan 2018 11:29:33 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:36664 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753762AbeAQQ3b (ORCPT ); Wed, 17 Jan 2018 11:29:31 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-08.nifty.com with ESMTP id w0HGSIKx014790; Thu, 18 Jan 2018 01:28:30 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w0HGSIKx014790 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1516206511; bh=dU3McduzXP/rbLl+hbKK4/rd/IunZM3/a+/UEQ1++QU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=daTMoMcJPomiR92ABGFE1vwVXjEeDkrXkV7mjvJitii6fdHAj5M19GEXlcWMNcoiR CW0j1qaGtMNMgz67EaNOlQ8Kv10o0Z9Yvggx3Mu9knO2aSnQUM9o8/rcCrBKQbF4XE OaQ3g3vNSZSKVRb51DliesJig7yHxd3thq1ktHTCSfXnkF6lSyfu4EAUy10djGj8yR bYc71BCiqvlRFdPRU0G6jH+zq8yLv6ugUsBgS6G2uarfb8vHvUsY97bQlKDcT1l5zn sncqzW+uNWAUt/3F+TUM4o5pQmFFJAhJGK79zl9XgPLZPQMYkM7wEPdwNEsuHBg4ur McVUImfGtvNTA== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Ulf Magnusson , Geert Uytterhoeven , Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v3 13/16] mmc: tmio: fix never-detected card insertion bug Date: Thu, 18 Jan 2018 01:28:13 +0900 Message-Id: <1516206496-16612-14-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516206496-16612-1-git-send-email-yamada.masahiro@socionext.com> References: <1516206496-16612-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org The TMIO mmc cannot detect the card insertion in native_hotplug mode if the driver is probed without a card inserted. The reason is obvious; all IRQs are disabled by tmio_mmc_host_probe(), as follows: tmio_mmc_disable_mmc_irqs(_host, TMIO_MASK_ALL); The card event IRQs are first enabled by tmio_mmc_start_command() as follows: if (!host->native_hotplug) irq_mask &= ~(TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); tmio_mmc_enable_mmc_irqs(host, irq_mask); If the driver is probed without a card, tmio_mmc_start_command() is never called in the first place. So, the card is never detected. The card event IRQs must be enabled in probe/resume functions. Signed-off-by: Masahiro Yamada --- Changes in v3: None Changes in v2: - Newly added drivers/mmc/host/tmio_mmc_core.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Wolfram Sang diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index b20d5c5..0e3dc8c 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -350,8 +350,6 @@ static int tmio_mmc_start_command(struct tmio_mmc_host *host, c |= TRANSFER_READ; } - if (!host->native_hotplug) - irq_mask &= ~(TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); tmio_mmc_enable_mmc_irqs(host, irq_mask); /* Fire off the command */ @@ -1294,11 +1292,13 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host) irq_mask |= TMIO_MASK_READOP; if (!_host->chan_tx) irq_mask |= TMIO_MASK_WRITEOP; - if (!_host->native_hotplug) - irq_mask &= ~(TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); _host->sdcard_irq_mask &= ~irq_mask; + if (_host->native_hotplug) + tmio_mmc_enable_mmc_irqs(_host, + TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); + spin_lock_init(&_host->lock); mutex_init(&_host->ios_lock); @@ -1382,6 +1382,10 @@ int tmio_mmc_host_runtime_resume(struct device *dev) if (host->clk_cache) tmio_mmc_set_clock(host, host->clk_cache); + if (host->native_hotplug) + tmio_mmc_enable_mmc_irqs(host, + TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); + tmio_mmc_enable_dma(host, true); if (tmio_mmc_can_retune(host) && host->select_tuning(host))