From patchwork Wed Mar 23 13:49:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 655951 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2NDn3mK011660 for ; Wed, 23 Mar 2011 13:49:09 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755888Ab1CWNtI (ORCPT ); Wed, 23 Mar 2011 09:49:08 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:52645 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751109Ab1CWNtH (ORCPT ); Wed, 23 Mar 2011 09:49:07 -0400 Received: from axis700.grange (pD9EB90DE.dip0.t-ipconnect.de [217.235.144.222]) by mrelayeu.kundenserver.de (node=mrbap4) with ESMTP (Nemesis) id 0MDgic-1QEz5t2s62-00H9IT; Wed, 23 Mar 2011 14:49:03 +0100 Received: by axis700.grange (Postfix, from userid 1000) id 51E8A189B86; Wed, 23 Mar 2011 14:49:03 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id 4ED7B189B85; Wed, 23 Mar 2011 14:49:03 +0100 (CET) Date: Wed, 23 Mar 2011 14:49:03 +0100 (CET) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: linux-sh@vger.kernel.org cc: linux-mmc@vger.kernel.org, Chris Ball , Ian Molton Subject: [PATCH 1/4 v3] mmc: tmio: only access registers above 0xff, if available In-Reply-To: Message-ID: References: MIME-Version: 1.0 X-Provags-ID: V02:K0:8sBK1BXmy8jzDFFijioapq5hb8KrYEgg5/YWYsX0HWp fSRd2autGMUBWOEnaS9SrMTQMFHnyLzH54TIrX2ATEu/TEKNsc qcIRIjDoatiECjMpePkCTxCa50zudSh4Jo7gD1paXyeyUO1xyn Rrwbl2ZUD37UOPF2bAV/m9at5mqA45E/PcnDZt2hKbmIBGcGBw NR0P5rKUa6fzN1QX0KtnDZWMRm3Km1y8XSZRAJiQP8= Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 23 Mar 2011 13:49:10 +0000 (UTC) diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c index a7406e3..28e14c7 100644 --- a/drivers/mmc/host/tmio_mmc_pio.c +++ b/drivers/mmc/host/tmio_mmc_pio.c @@ -209,6 +209,7 @@ static void tmio_mmc_set_clock(struct tmio_mmc_host *host, int new_clock) static void tmio_mmc_clk_stop(struct tmio_mmc_host *host) { struct tmio_mmc_data *pdata = host->pdata; + struct resource *res = platform_get_resource(host->pdev, IORESOURCE_MEM, 0); /* * Testing on sh-mobile showed that SDIO IRQs are unmasked when @@ -218,8 +219,11 @@ static void tmio_mmc_clk_stop(struct tmio_mmc_host *host) */ if (pdata->flags & TMIO_MMC_SDIO_IRQ) disable_irq(host->irq); - sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0000); - msleep(10); + /* implicit BUG_ON(!res) */ + if (resource_size(res) > 0x100) { + sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0000); + msleep(10); + } if (pdata->flags & TMIO_MMC_SDIO_IRQ) { tmio_mmc_enable_sdio_irq(host->mmc, host->sdio_irq_enabled); enable_irq(host->irq); @@ -232,6 +236,7 @@ static void tmio_mmc_clk_stop(struct tmio_mmc_host *host) static void tmio_mmc_clk_start(struct tmio_mmc_host *host) { struct tmio_mmc_data *pdata = host->pdata; + struct resource *res = platform_get_resource(host->pdev, IORESOURCE_MEM, 0); sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, 0x0100 | sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL)); @@ -239,8 +244,11 @@ static void tmio_mmc_clk_start(struct tmio_mmc_host *host) /* see comment in tmio_mmc_clk_stop above */ if (pdata->flags & TMIO_MMC_SDIO_IRQ) disable_irq(host->irq); - sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0100); - msleep(10); + /* implicit BUG_ON(!res) */ + if (resource_size(res) > 0x100) { + sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0100); + msleep(10); + } if (pdata->flags & TMIO_MMC_SDIO_IRQ) { tmio_mmc_enable_sdio_irq(host->mmc, host->sdio_irq_enabled); enable_irq(host->irq); @@ -249,12 +257,17 @@ static void tmio_mmc_clk_start(struct tmio_mmc_host *host) static void tmio_mmc_reset(struct tmio_mmc_host *host) { + struct resource *res = platform_get_resource(host->pdev, IORESOURCE_MEM, 0); + /* FIXME - should we set stop clock reg here */ sd_ctrl_write16(host, CTL_RESET_SD, 0x0000); - sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0000); + /* implicit BUG_ON(!res) */ + if (resource_size(res) > 0x100) + sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0000); msleep(10); sd_ctrl_write16(host, CTL_RESET_SD, 0x0001); - sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0001); + if (resource_size(res) > 0x100) + sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0001); msleep(10); }