From patchwork Fri Nov 24 16:24:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 119604 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2442948qgn; Fri, 24 Nov 2017 08:26:43 -0800 (PST) X-Google-Smtp-Source: AGs4zMYXqBSAqZw0VSZT3bHBnxZZGqrOeDOjwyNDQWNMan65nSn+Oo21xiu3uZ76Dsrqn8ksWjc5 X-Received: by 10.159.194.14 with SMTP id x14mr7939661pln.86.1511540803656; Fri, 24 Nov 2017 08:26:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511540803; cv=none; d=google.com; s=arc-20160816; b=FNKFaCKVczKOQZrHhNlhPpE8l62NSvt5MXsoF2tI0yqRalI1amDI6D7waV7VDUgfLc 207YPufNKOs2POUa/mcpIWTP7bIOn/ygiSVOC/7xAnrQOkwKD8yau8zSNYfuFRkIMzi+ yAGpufAU014ixKXw3wdsDWDjYScI/zGEPXlRj8nTe6gJtet6vrvxsowgi9ITv14StB3s gyE1pUO5VBQUmCoRIji35gKOdD/pa6rqQxN6ikUO2Q+yca7EnY8jhbMqu7AntjwbJuZS W5VUaSYBvIljF5v5ioz+q8u+GTBnr9qlg5NecJvZRc0kb1WBkhG/ddDVPlgZe+5c0UyM kMhA== 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=NXBakLUMP5QARemfOoyjhHvmfGedly+ClC9qg78sKUI=; b=c3J7TayGHREDkLOsarfmWO/EW7jt3YimlWLBCj0wqSp7wmOTszaSsAgQYFRQ50ukGZ GJo4IDmFV4UMsQPVMI+ZrDHqzQnc5OtiZ3C3cWnsi0HOITmINJogx7M4ZAc+9CcLhBfC cHA6FgXph0gakt1vu8jDYs82pTQCQ5bQwRf4H3SCnFihPDLEHNeqp01F3RmV+YcnlE/U 5mQF9TPXlooPedX8j1gle6tKnSEnOlZ8Rw2LlnDTpnJBS9qTBsk4ka4s851tWQE57Zij zjCYTyg3x6xtXNGObmK4plc96uVlIMGh6z76FoY7uBoDj6s1a58oMd3UOLFbrv9jfnuk 3VSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=AMqD0SK+; 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.43; Fri, 24 Nov 2017 08:26:43 -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=AMqD0SK+; 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 S1753846AbdKXQ0N (ORCPT + 28 others); Fri, 24 Nov 2017 11:26:13 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:61633 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752304AbdKXQ0I (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 vAOGP9W2007100; Sat, 25 Nov 2017 01:25:22 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com vAOGP9W2007100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1511540723; bh=NXBakLUMP5QARemfOoyjhHvmfGedly+ClC9qg78sKUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AMqD0SK+gfpeM5z5pGlj0jU3JKn1czF7LnWHGuJSqmmLUvBuZgOu0ZkZ+B6LMAT9b haSdWykuY0Omb5INKxoA5Q6mrCWbl5t2GK4xeZfBrRQ2pGqf2290/PN+m9dtR9YCqV 98D/+6leZAMVtcMFPgvwdVZbfkigCbWLTah0n42cukwl1tS0VSPYT8LYo3xoR7d8J8 y3tyhMNTA7TGrk2/pQGPsYNi60nNbfCt6nhJuho4AnWn03lz5nzfvCrcetKFf+6wex 8yybqiJy2zfsKeE2byrd4GH3DK8Budo7bQo7EMvA9TUWO1p1xkBP9KEElAYSmsDMo9 pzyqaM6GmGCgA== 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 16/22] mmc: tmio: fix never-detected card insertion bug Date: Sat, 25 Nov 2017 01:24:51 +0900 Message-Id: <1511540697-27387-17-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 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 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 v2: - Newly added drivers/mmc/host/tmio_mmc_core.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index b51bb06..7d169ed 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 */ @@ -1292,11 +1290,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); @@ -1383,6 +1383,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))