From patchwork Thu Jun 26 20:49:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 4432301 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A2A5B9F319 for ; Thu, 26 Jun 2014 20:54:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D172D20379 for ; Thu, 26 Jun 2014 20:54:32 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 094742018E for ; Thu, 26 Jun 2014 20:54:32 +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 1X0Gf5-0003aQ-5D; Thu, 26 Jun 2014 20:52:51 +0000 Received: from mail-we0-x22c.google.com ([2a00:1450:400c:c03::22c]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X0Gcw-0001qk-5v for linux-arm-kernel@lists.infradead.org; Thu, 26 Jun 2014 20:50:42 +0000 Received: by mail-we0-f172.google.com with SMTP id u57so4212369wes.3 for ; Thu, 26 Jun 2014 13:50:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1MkDpklI3VnMlFkBFpw1gvsoSWAmIcpSZIl7jrpyRhQ=; b=EaS7+XvTevWdmn6vgkzHyt4m7NWVmxfDin91PUxkYuE7HBnHFuWRiD3QQ0WW1EUKiO /+RhWVWYoeJ8SQzpLFzQbShO6hPwl5lpXHcGNCI7n75r1hYIMbazav8AqR1R2SzYzL4C +cMqRJSFJHWGDG5e5vB3yYR/khvKUnTKbD1H7jut/pAKGTMCsazUJ2AlX1hfoKz0LeSm EWvih0j4OyxSfTUaP1LGN2NLC1ELf+RKZ+88VWSVI3PSgqi4LYOrOt0Q48pUd2t+XfDg 6GuonexxHayKjF6licV6ttCDORBsIaelb/qjy/nlBf4E4fpRxtgdcD8A6LY082pMkQxL LkAQ== X-Received: by 10.194.71.81 with SMTP id s17mr21103075wju.10.1403815815597; Thu, 26 Jun 2014 13:50:15 -0700 (PDT) Received: from localhost (port-12740.pppoe.wtnet.de. [84.46.49.245]) by mx.google.com with ESMTPSA id ge17sm69776157wic.0.2014.06.26.13.50.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jun 2014 13:50:15 -0700 (PDT) From: Thierry Reding To: Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Stephen Warren , Arnd Bergmann , Will Deacon , Joerg Roedel Subject: [RFC 10/10] mmc: sdhci-tegra: Add IOMMU support Date: Thu, 26 Jun 2014 22:49:50 +0200 Message-Id: <1403815790-8548-11-git-send-email-thierry.reding@gmail.com> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1403815790-8548-1-git-send-email-thierry.reding@gmail.com> References: <1403815790-8548-1-git-send-email-thierry.reding@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140626_135038_417023_76E3A6DF X-CRM114-Status: GOOD ( 11.12 ) X-Spam-Score: -0.8 (/) Cc: Olav Haugan , devicetree@vger.kernel.org, Grant Grundler , Rhyland Klein , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Marc Zyngier , Allen Martin , Paul Walmsley , linux-tegra@vger.kernel.org, Cho KyongHo , Dave Martin , linux-arm-kernel@lists.infradead.org, Hiroshi Doyu X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=no 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 From: Thierry Reding Attach to the device's master interface of the IOMMU at .probe() time. IOMMU support becomes available via the DMA mapping API interoperation code, but this explicit attachment is necessary to ensure proper probe order. Signed-off-by: Thierry Reding --- drivers/mmc/host/sdhci-tegra.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 33100d10d176..b884614fa4e6 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -237,6 +238,11 @@ static int sdhci_tegra_probe(struct platform_device *pdev) match = of_match_device(sdhci_tegra_dt_match, &pdev->dev); if (!match) return -EINVAL; + + rc = iommu_attach(&pdev->dev); + if (rc < 0) + return rc; + soc_data = match->data; host = sdhci_pltfm_init(pdev, soc_data->pdata, 0); @@ -310,6 +316,8 @@ static int sdhci_tegra_remove(struct platform_device *pdev) clk_disable_unprepare(pltfm_host->clk); clk_put(pltfm_host->clk); + iommu_detach(&pdev->dev); + sdhci_pltfm_free(pdev); return 0;