From patchwork Tue Aug 7 03:10:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sonic zhang X-Patchwork-Id: 1282791 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id D5B913FC8A for ; Tue, 7 Aug 2012 03:01:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932610Ab2HGDBL (ORCPT ); Mon, 6 Aug 2012 23:01:11 -0400 Received: from co1ehsobe005.messaging.microsoft.com ([216.32.180.188]:29236 "EHLO co1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932613Ab2HGDBJ (ORCPT ); Mon, 6 Aug 2012 23:01:09 -0400 Received: from mail198-co1-R.bigfish.com (10.243.78.239) by CO1EHSOBE011.bigfish.com (10.243.66.74) with Microsoft SMTP Server id 14.1.225.23; Tue, 7 Aug 2012 03:01:08 +0000 Received: from mail198-co1 (localhost [127.0.0.1]) by mail198-co1-R.bigfish.com (Postfix) with ESMTP id 2B262D80126; Tue, 7 Aug 2012 03:01:08 +0000 (UTC) X-Forefront-Antispam-Report: CIP:137.71.25.55; KIP:(null); UIP:(null); IPV:NLI; H:nwd2mta1.analog.com; RD:nwd2mail10.analog.com; EFVD:NLI X-SpamScore: 8 X-BigFish: VS8(zzzz1202hzz8275bhz2ei87h2a8h668h839hd24he5bhe96h107ahff4o) Received-SPF: neutral (mail198-co1: 137.71.25.55 is neither permitted nor denied by domain of gmail.com) client-ip=137.71.25.55; envelope-from=sonic.adi@gmail.com; helo=nwd2mta1.analog.com ; 1.analog.com ; X-FB-DOMAIN-IP-MATCH: fail Received: from mail198-co1 (localhost.localdomain [127.0.0.1]) by mail198-co1 (MessageSwitch) id 1344308466360415_13812; Tue, 7 Aug 2012 03:01:06 +0000 (UTC) Received: from CO1EHSMHS015.bigfish.com (unknown [10.243.78.226]) by mail198-co1.bigfish.com (Postfix) with ESMTP id 4C063240044; Tue, 7 Aug 2012 03:01:06 +0000 (UTC) Received: from nwd2mta1.analog.com (137.71.25.55) by CO1EHSMHS015.bigfish.com (10.243.66.25) with Microsoft SMTP Server (TLS) id 14.1.225.23; Tue, 7 Aug 2012 03:01:05 +0000 Received: from NWD2HUBCAS1.ad.analog.com (nwd2hubcas1.ad.analog.com [10.64.73.29]) by nwd2mta1.analog.com (8.13.8/8.13.8) with ESMTP id q772l5Bt004966 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Mon, 6 Aug 2012 22:47:05 -0400 Received: from zeus.spd.analog.com (10.64.82.11) by NWD2HUBCAS1.ad.analog.com (10.64.73.29) with Microsoft SMTP Server id 8.3.83.0; Mon, 6 Aug 2012 23:01:04 -0400 Received: from linux.site ([10.99.22.20]) by zeus.spd.analog.com (8.14.5/8.14.5) with ESMTP id q77312sd006521; Mon, 6 Aug 2012 23:01:03 -0400 Received: from localhost.localdomain (unknown [10.99.22.81]) by linux.site (Postfix) with ESMTP id 5C34042A557B; Mon, 6 Aug 2012 13:26:48 -0600 (MDT) From: Sonic Zhang To: Chris Ball CC: , Bob Liu , , Sonic Zhang Subject: [PATCH 4/4] mmc: bfin_sdh: Reset SD controller when resume from power saving mode. Date: Tue, 7 Aug 2012 11:10:15 +0800 Message-ID: <1344309015-13248-4-git-send-email-sonic.adi@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1344309015-13248-1-git-send-email-sonic.adi@gmail.com> References: <1344309015-13248-1-git-send-email-sonic.adi@gmail.com> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: Sonic Zhang Without reset, SD controller may stay in disable mode, SD card can't be detected when resume from power saving mode. Signed-off-by: Sonic Zhang --- drivers/mmc/host/bfin_sdh.c | 35 +++++++++++++++++++---------------- 1 files changed, 19 insertions(+), 16 deletions(-) diff --git a/drivers/mmc/host/bfin_sdh.c b/drivers/mmc/host/bfin_sdh.c index 57b7548..a95a09a 100644 --- a/drivers/mmc/host/bfin_sdh.c +++ b/drivers/mmc/host/bfin_sdh.c @@ -512,6 +512,23 @@ static irqreturn_t sdh_stat_irq(int irq, void *devid) return IRQ_RETVAL(handled); } +static void sdh_reset(void) +{ +#if defined(CONFIG_BF54x) + /* Secure Digital Host shares DMA with Nand controller */ + bfin_write_DMAC1_PERIMUX(bfin_read_DMAC1_PERIMUX() | 0x1); +#endif + + bfin_write_SDH_CFG(bfin_read_SDH_CFG() | CLKS_EN); + SSYNC(); + + /* Disable card inserting detection pin. set MMC_CAP_NEEDS_POLL, and + * mmc stack will do the detection. + */ + bfin_write_SDH_CFG((bfin_read_SDH_CFG() & 0x1F) | (PUP_SDDAT | PUP_SDDAT3)); + SSYNC(); +} + static int __devinit sdh_probe(struct platform_device *pdev) { struct mmc_host *mmc; @@ -588,19 +605,8 @@ static int __devinit sdh_probe(struct platform_device *pdev) dev_err(&pdev->dev, "unable to request peripheral pins\n"); goto out4; } -#if defined(CONFIG_BF54x) - /* Secure Digital Host shares DMA with Nand controller */ - bfin_write_DMAC1_PERIMUX(bfin_read_DMAC1_PERIMUX() | 0x1); -#endif - bfin_write_SDH_CFG(bfin_read_SDH_CFG() | CLKS_EN); - SSYNC(); - - /* Disable card inserting detection pin. set MMC_CAP_NEEDS_POLL, and - * mmc stack will do the detection. - */ - bfin_write_SDH_CFG((bfin_read_SDH_CFG() & 0x1F) | (PUP_SDDAT | PUP_SDDAT3)); - SSYNC(); + sdh_reset(); mmc_add_host(mmc); return 0; @@ -667,10 +673,7 @@ static int sdh_resume(struct platform_device *dev) return ret; } -#if defined(CONFIG_BF54x) - /* Secure Digital Host shares DMA with Nand controller */ - bfin_write_DMAC1_PERIMUX(bfin_read_DMAC1_PERIMUX() | 0x1); -#endif + sdh_reset(); if (mmc) ret = mmc_resume_host(mmc);