From patchwork Mon Aug 25 12:25:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 35902 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f197.google.com (mail-pd0-f197.google.com [209.85.192.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 51E57203C0 for ; Mon, 25 Aug 2014 12:26:37 +0000 (UTC) Received: by mail-pd0-f197.google.com with SMTP id y10sf103678420pdj.0 for ; Mon, 25 Aug 2014 05:26:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=w2naejEwIncFzF31uYTfh/AksYZ70ZakXk2JkGIkV+Q=; b=YFgrr899Rs1NFabQkeINc4gapfe53X+oKNEIxSkHdcg4Bzm5gauAl0ux9MMmBKRbz9 9OZcSACeJxnfBWImBwCH4cdzdDyFe9MTwJ9Hvxmxy1NQk7gbLgo45Ky5aDf4xcgOBq/W o5UcPZ2RUxcdl4D1Cr7XUtO8jXHnf1nEgdqB99ZxEF+Orpe/5qeb++Yin4Tyk7ah4BVt MDuTTCC4SDKQc7sFEIJku11+QQS6SMnZruyLv5xOQmFVr+T8VB0ond0icakhM+kV0t21 VPUVU4OpJG+iJZ44+Rktc6B5TgP8SvwimPlfUq8Ot0qX/aZ1sW6qGjRZnSwJrtmS6Cd0 aPng== X-Gm-Message-State: ALoCoQnRMGvAAYCKjD20/caLhQ6cQ4fZAqe4pdupKcpP63NXGVXZUdfqB1goJrhfVLFyFeAYi9sy X-Received: by 10.68.190.130 with SMTP id gq2mr13985420pbc.3.1408969590804; Mon, 25 Aug 2014 05:26:30 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.81.113 with SMTP id e104ls2011094qgd.33.gmail; Mon, 25 Aug 2014 05:26:30 -0700 (PDT) X-Received: by 10.52.35.77 with SMTP id f13mr4326114vdj.68.1408969590700; Mon, 25 Aug 2014 05:26:30 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id li13si17208533vdb.94.2014.08.25.05.26.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Aug 2014 05:26:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id la4so15030078vcb.37 for ; Mon, 25 Aug 2014 05:26:30 -0700 (PDT) X-Received: by 10.52.94.108 with SMTP id db12mr15329914vdb.8.1408969590595; Mon, 25 Aug 2014 05:26:30 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp113253vcb; Mon, 25 Aug 2014 05:26:30 -0700 (PDT) X-Received: by 10.180.78.234 with SMTP id e10mr8929614wix.7.1408969589639; Mon, 25 Aug 2014 05:26:29 -0700 (PDT) Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com [209.85.212.171]) by mx.google.com with ESMTPS id mw4si74835wib.30.2014.08.25.05.26.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Aug 2014 05:26:29 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.212.171 as permitted sender) client-ip=209.85.212.171; Received: by mail-wi0-f171.google.com with SMTP id hi2so2444382wib.10 for ; Mon, 25 Aug 2014 05:26:29 -0700 (PDT) X-Received: by 10.180.186.230 with SMTP id fn6mr9910822wic.44.1408969589137; Mon, 25 Aug 2014 05:26:29 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id u5sm145337wia.17.2014.08.25.05.26.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Aug 2014 05:26:28 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ian Molton , Chris Ball Cc: Geert Uytterhoeven , Linux-sh list , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH 01/12] mmc: tmio: Keep host active while SDIO IRQ is enabled Date: Mon, 25 Aug 2014 14:25:53 +0200 Message-Id: <1408969564-6335-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1408969564-6335-1-git-send-email-ulf.hansson@linaro.org> References: <1408969564-6335-1-git-send-email-ulf.hansson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The host must be kept active to be able to serve SDIO IRQs, thus let's prevent it from going inactive while SDIO IRQ is enabled. Signed-off-by: Ulf Hansson --- drivers/mmc/host/tmio_mmc.h | 1 + drivers/mmc/host/tmio_mmc_pio.c | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h index 100ffe0..d6ceb1a 100644 --- a/drivers/mmc/host/tmio_mmc.h +++ b/drivers/mmc/host/tmio_mmc.h @@ -101,6 +101,7 @@ struct tmio_mmc_host { struct mutex ios_lock; /* protect set_ios() context */ bool native_hotplug; bool resuming; + bool sdio_irq_enabled; }; int tmio_mmc_host_probe(struct tmio_mmc_host **host, diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c index faf0924..5c2e5a3 100644 --- a/drivers/mmc/host/tmio_mmc_pio.c +++ b/drivers/mmc/host/tmio_mmc_pio.c @@ -129,15 +129,22 @@ static void tmio_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable) { struct tmio_mmc_host *host = mmc_priv(mmc); - if (enable) { + if (enable && !host->sdio_irq_enabled) { + /* Keep device active while SDIO irq is enabled */ + pm_runtime_get_sync(mmc_dev(mmc)); + host->sdio_irq_enabled = true; + host->sdio_irq_mask = TMIO_SDIO_MASK_ALL & ~TMIO_SDIO_STAT_IOIRQ; sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0001); sd_ctrl_write16(host, CTL_SDIO_IRQ_MASK, host->sdio_irq_mask); - } else { + } else if (!enable && host->sdio_irq_enabled) { host->sdio_irq_mask = TMIO_SDIO_MASK_ALL; sd_ctrl_write16(host, CTL_SDIO_IRQ_MASK, host->sdio_irq_mask); sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0000); + + host->sdio_irq_enabled = false; + pm_runtime_put(mmc_dev(mmc)); } } @@ -1074,8 +1081,12 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host, _host->sdcard_irq_mask &= ~irq_mask; - if (pdata->flags & TMIO_MMC_SDIO_IRQ) - tmio_mmc_enable_sdio_irq(mmc, 0); + _host->sdio_irq_enabled = false; + if (pdata->flags & TMIO_MMC_SDIO_IRQ) { + _host->sdio_irq_mask = TMIO_SDIO_MASK_ALL; + sd_ctrl_write16(_host, CTL_SDIO_IRQ_MASK, _host->sdio_irq_mask); + sd_ctrl_write16(_host, CTL_TRANSACTION_CTL, 0x0000); + } spin_lock_init(&_host->lock); mutex_init(&_host->ios_lock);