From patchwork Mon Aug 15 05:51:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 1066752 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7F5peZx015400 for ; Mon, 15 Aug 2011 05:51:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752391Ab1HOFvj (ORCPT ); Mon, 15 Aug 2011 01:51:39 -0400 Received: from kirsty.vergenet.net ([202.4.237.240]:43003 "EHLO kirsty.vergenet.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752186Ab1HOFvi (ORCPT ); Mon, 15 Aug 2011 01:51:38 -0400 Received: from joe.akashicho.tokyo.vergenet.net (joe.akashicho.tokyo.vergenet.net [IPv6:2001:470:f44f:403:1ec1:deff:fe98:754d]) by kirsty.vergenet.net (Postfix) with ESMTP id ABC09245A5; Mon, 15 Aug 2011 15:51:35 +1000 (EST) Received: by joe.akashicho.tokyo.vergenet.net (Postfix, from userid 7100) id 88CF528A034; Mon, 15 Aug 2011 14:51:33 +0900 (JST) From: Simon Horman To: linux-mmc@vger.kernel.org, linux-sh@vger.kernel.org Cc: Chris Ball , Guennadi Liakhovetski , Magnus Damm , Simon Horman Subject: [PATCH 2/4] mmc: tmio, sdhi: Split card interrupts based on source Date: Mon, 15 Aug 2011 14:51:26 +0900 Message-Id: <1313387488-28175-3-git-send-email-horms@verge.net.au> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1313387488-28175-1-git-send-email-horms@verge.net.au> References: <1313387488-28175-1-git-send-email-horms@verge.net.au> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Mon, 15 Aug 2011 05:51:40 +0000 (UTC) SDHI hardware allows for two different card interrupt sources; one for access and one for detect. As preparation for wiring the sources up to separate interrupt handlers this patch splits the card interrupt handler in two. Cc: Guennadi Liakhovetski Cc: Magnus Damm Signed-off-by: Simon Horman --- drivers/mmc/host/tmio_mmc_pio.c | 34 ++++++++++++++++++++++++++-------- 1 files changed, 26 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c index e658cb4..3880750 100644 --- a/drivers/mmc/host/tmio_mmc_pio.c +++ b/drivers/mmc/host/tmio_mmc_pio.c @@ -543,17 +543,21 @@ out: spin_unlock(&host->lock); } -static void __tmio_mmc_card_irq(struct tmio_mmc_host *host) +static void tmio_mmc_card_irq_status(struct tmio_mmc_host *host, + int *ireg, int *irq_mask, int *status) { - struct mmc_host *mmc = host->mmc; - unsigned int ireg, irq_mask, status; + *status = sd_ctrl_read32(host, CTL_STATUS); + *irq_mask = sd_ctrl_read32(host, CTL_IRQ_MASK); + *ireg = *status & TMIO_MASK_IRQ & ~*irq_mask; - status = sd_ctrl_read32(host, CTL_STATUS); - irq_mask = sd_ctrl_read32(host, CTL_IRQ_MASK); - ireg = status & TMIO_MASK_IRQ & ~irq_mask; + pr_debug_status(*status); + pr_debug_status(*ireg); +} - pr_debug_status(status); - pr_debug_status(ireg); +static void __tmio_mmc_card_detect_irq(struct tmio_mmc_host *host, + int ireg, int irq_mask, int status) +{ + struct mmc_host *mmc = host->mmc; /* Card insert / remove attempts */ if (ireg & (TMIO_STAT_CARD_INSERT | TMIO_STAT_CARD_REMOVE)) { @@ -564,7 +568,11 @@ static void __tmio_mmc_card_irq(struct tmio_mmc_host *host) !work_pending(&mmc->detect.work)) mmc_detect_change(host->mmc, msecs_to_jiffies(100)); } +} +void __tmio_mmc_card_access_irq(struct tmio_mmc_host *host, + int ireg, int irq_mask, int status) +{ /* Command completion */ if (ireg & (TMIO_STAT_CMDRESPEND | TMIO_STAT_CMDTIMEOUT)) { tmio_mmc_ack_mmc_irqs(host, @@ -586,6 +594,16 @@ static void __tmio_mmc_card_irq(struct tmio_mmc_host *host) } } +static void __tmio_mmc_card_irq(struct tmio_mmc_host *host) +{ + unsigned int ireg, irq_mask, status; + + tmio_mmc_card_irq_status(host, &ireg, &irq_mask, &status); + + __tmio_mmc_card_detect_irq(host, ireg, irq_mask, status); + __tmio_mmc_card_access_irq(host, ireg, irq_mask, status); +} + static void __tmio_mmc_sdio_irq(struct tmio_mmc_host *host) { struct mmc_host *mmc = host->mmc;