From patchwork Fri Oct 9 01:03:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Wojtas X-Patchwork-Id: 7358531 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AB0A49F32B for ; Fri, 9 Oct 2015 00:59:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C63BF207D3 for ; Fri, 9 Oct 2015 00:59:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D80F1207B9 for ; Fri, 9 Oct 2015 00:59:18 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZkM0O-0008LS-8a; Fri, 09 Oct 2015 00:57:52 +0000 Received: from mail-lb0-f179.google.com ([209.85.217.179]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZkLzb-00085V-Fx for linux-arm-kernel@lists.infradead.org; Fri, 09 Oct 2015 00:57:04 +0000 Received: by lbos8 with SMTP id s8so64347937lbo.0 for ; Thu, 08 Oct 2015 17:56:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=d64x9AsZw80uM1zGpU3A24DRATlvmEyHHlQdOrUVpFY=; b=RQPbie6Dl6FMrhbzxpMhBbFVQoUCPFT436vvo1jKg7d86ftMmExkF7aXGWZ1FZSZqh QNoAAS5uG8Cpck8jTDruP0kv9rxuFrnm2H6wleR3CtLky8jH9hvA/b9VYZ8goxFKyd51 JJonJJk4wUzuCZrIvO4Lmcq0zcr+HCU8mOV8Gnm1EnNhK0A7WxSeYWU1WNS+87rcDPEd vfbCWHGAmLrvfZw9ZX5wjB1g2+8REHZ1V4F+RTOfJvPuP1CEQCarJ4VdMJrHJcdxIl2p PROiMprQPwIZHYONJj6bfQ48GEKrZB4FU/asTsMwEDJo/B7tYLhLQSSUn8swPeRfqjCM Y9Uw== X-Gm-Message-State: ALoCoQkRNXGNStrRUIXIGJ/kZwRSLDjErLeYwArzHhydf5i8UWzx4735EYfjn0zNFJ0VZWwisXgR X-Received: by 10.112.172.165 with SMTP id bd5mr5060630lbc.51.1444352201511; Thu, 08 Oct 2015 17:56:41 -0700 (PDT) Received: from enkidu.semihalf.local (cardhu.semihalf.com. [213.17.239.108]) by smtp.gmail.com with ESMTPSA id og8sm7668933lbc.5.2015.10.08.17.56.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Oct 2015 17:56:40 -0700 (PDT) From: Marcin Wojtas To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org Subject: [PATCH v2 1/5] mmc: sdhci-pxav3: enable proper resuming on Armada 38x SoC Date: Fri, 9 Oct 2015 03:03:51 +0200 Message-Id: <1444352635-21965-2-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1444352635-21965-1-git-send-email-mw@semihalf.com> References: <1444352635-21965-1-git-send-email-mw@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151008_175703_725283_73693E10 X-CRM114-Status: GOOD ( 17.13 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thomas.petazzoni@free-electrons.com, andrew@lunn.ch, ulf.hansson@linaro.org, jason@lakedaemon.net, tawfik@marvell.com, jaz@semihalf.com, nadavh@marvell.com, alior@marvell.com, gregory.clement@free-electrons.com, mw@semihalf.com, sebastian.hesselbarth@gmail.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When resuming from suspend on Armada 38x SoC MBus windows have to be re-configured and for that purpose mv_conf_mbus_windows function needed rework. MBus windows register base address obtaining was moved to armada_38x_quirks function in order to be kept in pxa global structure, because it is used during a resume. This commit fixes resuming from suspend by calling MBus windows configuration routine and therefore enabling proper DMA operation. Signed-off-by: Marcin Wojtas --- drivers/mmc/host/sdhci-pxav3.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c index f5edf9d..76b9a70 100644 --- a/drivers/mmc/host/sdhci-pxav3.c +++ b/drivers/mmc/host/sdhci-pxav3.c @@ -63,6 +63,7 @@ struct sdhci_pxa { struct clk *clk_io; u8 power_mode; void __iomem *sdio3_conf_reg; + void __iomem *mbus_win_regs; }; /* @@ -81,30 +82,16 @@ struct sdhci_pxa { #define SDIO3_CONF_CLK_INV BIT(0) #define SDIO3_CONF_SD_FB_CLK BIT(2) -static int mv_conf_mbus_windows(struct platform_device *pdev, +static int mv_conf_mbus_windows(struct device *dev, void __iomem *regs, const struct mbus_dram_target_info *dram) { int i; - void __iomem *regs; - struct resource *res; if (!dram) { - dev_err(&pdev->dev, "no mbus dram info\n"); - return -EINVAL; - } - - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); - if (!res) { - dev_err(&pdev->dev, "cannot get mbus registers\n"); + dev_err(dev, "no mbus dram info\n"); return -EINVAL; } - regs = ioremap(res->start, resource_size(res)); - if (!regs) { - dev_err(&pdev->dev, "cannot map mbus registers\n"); - return -ENOMEM; - } - for (i = 0; i < SDHCI_MAX_WIN_NUM; i++) { writel(0, regs + SDHCI_WINDOW_CTRL(i)); writel(0, regs + SDHCI_WINDOW_BASE(i)); @@ -122,8 +109,6 @@ static int mv_conf_mbus_windows(struct platform_device *pdev, writel(cs->base, regs + SDHCI_WINDOW_BASE(i)); } - iounmap(regs); - return 0; } @@ -135,6 +120,14 @@ static int armada_38x_quirks(struct platform_device *pdev, struct sdhci_pxa *pxa = pltfm_host->priv; struct resource *res; + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mbus"); + pxa->mbus_win_regs = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(pxa->mbus_win_regs)) { + dev_err(mmc_dev(host->mmc), + "failed to obtain MBus windows register base\n"); + return PTR_ERR(pxa->mbus_win_regs); + } + host->quirks &= ~SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN; host->quirks |= SDHCI_QUIRK_MISSING_CAPS; res = platform_get_resource_byname(pdev, IORESOURCE_MEM, @@ -403,7 +396,8 @@ static int sdhci_pxav3_probe(struct platform_device *pdev) ret = armada_38x_quirks(pdev, host); if (ret < 0) goto err_mbus_win; - ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info()); + ret = mv_conf_mbus_windows(&pdev->dev, pxa->mbus_win_regs, + mv_mbus_dram_info()); if (ret < 0) goto err_mbus_win; } @@ -520,6 +514,12 @@ static int sdhci_pxav3_resume(struct device *dev) { int ret; struct sdhci_host *host = dev_get_drvdata(dev); + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct sdhci_pxa *pxa = pltfm_host->priv; + + if (pxa->mbus_win_regs) + ret = mv_conf_mbus_windows(dev, pxa->mbus_win_regs, + mv_mbus_dram_info()); pm_runtime_get_sync(dev); ret = sdhci_resume_host(host);