From patchwork Fri Nov 8 06:06:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 21418 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f71.google.com (mail-yh0-f71.google.com [209.85.213.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6E462244F2 for ; Fri, 8 Nov 2013 06:06:31 +0000 (UTC) Received: by mail-yh0-f71.google.com with SMTP id f64sf2485613yha.10 for ; Thu, 07 Nov 2013 22:06:31 -0800 (PST) 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=twsh1rekOxYC0dvvDaBHGk6ZwwqsAIIc2J6yrjc43EE=; b=CRg4Iwc0ziV5OtyG4rzOVahp17RwKeZJX2RFDbc5nijJEgf24l+0SWZqI98fjj3Lt7 leOVsakCRSEOBY63PUMIoDjFZu0mbpJh4TqFaKHvqBe84eNfhFTnhNRDzIpfB3zqM7R9 PdhyEFTwVKNZy1dpVlfsrSk/BOxOgSdazjNAIjdpo8r8DYYOfNxBQQ27FQ46poozy1Sw McNxaOyr5NRWNXhd8WYhVI2PYVUedZcB0NbXc4LPAHfDZnF9ZKMQSueHpmM55xT6py21 TFQQyPRiCM+7HoLOgp+srJqA8y0Xj5TitYgvqYT7P87Ws+1ArGMjd6WTa9mH2QrK6Btu ODpw== X-Gm-Message-State: ALoCoQkMDavINz5/q2tSYbhdxFp7VKz0H212d4ktKXP3j9uclmKJORp/4zmmI+PUHGUCk/B8Cpby X-Received: by 10.58.23.166 with SMTP id n6mr4295490vef.13.1383890791207; Thu, 07 Nov 2013 22:06:31 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.121.69 with SMTP id li5ls288667qeb.39.gmail; Thu, 07 Nov 2013 22:06:31 -0800 (PST) X-Received: by 10.52.164.16 with SMTP id ym16mr173893vdb.39.1383890791124; Thu, 07 Nov 2013 22:06:31 -0800 (PST) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id fx15si3277148vec.34.2013.11.07.22.06.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 07 Nov 2013 22:06:31 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id ik5so1110218vcb.30 for ; Thu, 07 Nov 2013 22:06:31 -0800 (PST) X-Received: by 10.52.230.102 with SMTP id sx6mr8582406vdc.15.1383890791038; Thu, 07 Nov 2013 22:06:31 -0800 (PST) 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.220.174.196 with SMTP id u4csp6966vcz; Thu, 7 Nov 2013 22:06:30 -0800 (PST) X-Received: by 10.152.8.18 with SMTP id n18mr9652280laa.24.1383890789988; Thu, 07 Nov 2013 22:06:29 -0800 (PST) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com [209.85.215.41]) by mx.google.com with ESMTPS id pm9si3087998lbc.164.2013.11.07.22.06.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 07 Nov 2013 22:06:29 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.41 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.215.41; Received: by mail-la0-f41.google.com with SMTP id ea20so1368931lab.14 for ; Thu, 07 Nov 2013 22:06:29 -0800 (PST) X-Received: by 10.152.140.193 with SMTP id ri1mr9442729lab.23.1383890789413; Thu, 07 Nov 2013 22:06:29 -0800 (PST) Received: from linaro-ulf.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id f4sm6860209lah.0.2013.11.07.22.06.27 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 07 Nov 2013 22:06:28 -0800 (PST) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Chris Ball Cc: Ulf Hansson , Guennadi Liakhovetski Subject: [PATCH 4/8] mmc: tmio: Keep host active while SDIO irq is enabled Date: Fri, 8 Nov 2013 07:06:12 +0100 Message-Id: <1383890776-6912-5-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1383890776-6912-1-git-send-email-ulf.hansson@linaro.org> References: <1383890776-6912-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=neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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 with SDIO irqs. We prevent it from being put into in-active while the SDIO irq is enabled by simply adding balanced calls to pm_runtime_get|put. Cc: Guennadi Liakhovetski 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 6c5b45a..c2c9546 100644 --- a/drivers/mmc/host/tmio_mmc.h +++ b/drivers/mmc/host/tmio_mmc.h @@ -102,6 +102,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 472e803..377157e 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)); } } @@ -1072,8 +1079,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);