From patchwork Fri Jan 11 11:08:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Faiz Abbas X-Patchwork-Id: 155324 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp439293jaa; Fri, 11 Jan 2019 03:06:18 -0800 (PST) X-Google-Smtp-Source: ALg8bN6MP8xisKOF0rdPXR2JE5svH0Ao7usK4b45yEX98/AakRZ+LoiGL2sS3OzdrWuqHWHMW+3w X-Received: by 2002:a17:902:b40d:: with SMTP id x13mr14429448plr.237.1547204778295; Fri, 11 Jan 2019 03:06:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547204778; cv=none; d=google.com; s=arc-20160816; b=w54oKTcVZAa+QjzcpSWOu+B+HuAiZnmJiH/+xtONJFA6X7y9ar9JD5GFafEPF9oAEM WTQC7UHbqRs8VIn7EtaKXy0yfpP8JmtgFqo/V+9qW3zjOqecxTEGCwhFd3BdbtUpNfOU LTGH6S/9xN6tgbF4q/AgkuEnJzXnVMbAESYwVXq3W9VYW1OyQTAVIkz0KeEQ+G0NQSTH TUbo3wp3SmhFUbunuu8EdtjA1TjHGIeVR57xAqNyvP8M7hx8uHvL7Li0MfyC/uPRKPZH oSjPc8MOKP5J+uMjPZDrsUPdAJVVYuGbpEmKqk0aAYGkWgSKDksKXitDtdyRfKOeGzA0 5lXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wteOl5uvyjVk6GljbaTc8Q2ud1451fQf4mi1LazvlsQ=; b=DG3w0ZvbUQnOs1WwYCR9jtiFDqKfIJv2cX446XM0PM0D+SjVeqH6NmO/rXJUeSOKpb Ue67UdzgwDLpXJEqF17H15G4HW8DRXpvWOjgAzHPM/u5S9Ox5Z/KTVuQigLH4iS4khGi B20ZLnQunE7R4Rhr3SFMYLk8CO8Yk54ko7PjrUYZSjSuIr+F/4wVsMQBXiTFVSwVz7Ag UL501Ja5LCQ16tOw46mdfzc8+0lZpOR6OncjdRQLKtxnGHGmf5t41mHG+7C3Il8+y+r3 k/9dp5AvQa8lCJI4wA/7x3dgNy9j3WKj1nTmCml32JgsTjVd2UYKzF5VDRoaYd1RDWfX Wa3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Sh4bRYuz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y1si15801341pgy.174.2019.01.11.03.06.17; Fri, 11 Jan 2019 03:06:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Sh4bRYuz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732144AbfAKLGQ (ORCPT + 31 others); Fri, 11 Jan 2019 06:06:16 -0500 Received: from lelv0142.ext.ti.com ([198.47.23.249]:34568 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732130AbfAKLGP (ORCPT ); Fri, 11 Jan 2019 06:06:15 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x0BB69Pe113754; Fri, 11 Jan 2019 05:06:09 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1547204769; bh=wteOl5uvyjVk6GljbaTc8Q2ud1451fQf4mi1LazvlsQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Sh4bRYuz11FsU3Pp5rUZ0Z/N0FGCI7O8e0VIUU9QhUaogIh9BNLJCT6ZSdjXKdEbJ 1GIeGFL1s0AhG57TaTzT1wEh5wps71AM9VwXGQzOLugPmaCS51qzzibWqU0+TI7yW0 9c0jTNoJUUXSEFzJiONl9avej6d78SsvcUgsWUhs= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x0BB698T119264 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 11 Jan 2019 05:06:09 -0600 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Fri, 11 Jan 2019 05:06:09 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Fri, 11 Jan 2019 05:06:09 -0600 Received: from a0230074-OptiPlex-7010.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id x0BB5xEs024503; Fri, 11 Jan 2019 05:06:06 -0600 From: Faiz Abbas To: , , CC: , , , , , , Subject: [PATCH 2/7] mmc: sdhci-omap: Add using external dma Date: Fri, 11 Jan 2019 16:38:46 +0530 Message-ID: <20190111110851.6805-3-faiz_abbas@ti.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190111110851.6805-1-faiz_abbas@ti.com> References: <20190111110851.6805-1-faiz_abbas@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chunyan Zhang sdhci-omap can support both external dma controller via dmaengine framework as well as ADMA which standard SD host controller provides. Fixes by Faiz Abbas : 1. Switch to DMA slave mode when using external DMA 2. Add offset to mapbase Signed-off-by: Chunyan Zhang Signed-off-by: Faiz Abbas --- drivers/mmc/host/Kconfig | 1 + drivers/mmc/host/sdhci-omap.c | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) -- 2.19.2 diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index 333292e8ecdd..70e90b00cb37 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -979,6 +979,7 @@ config MMC_SDHCI_OMAP depends on MMC_SDHCI_PLTFM && OF select THERMAL select TI_SOC_THERMAL + select MMC_SDHCI_EXTERNAL_DMA if DMA_ENGINE help This selects the Secure Digital Host Controller Interface (SDHCI) support present in TI's DRA7 SOCs. The controller supports diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c index c11c18a9aacb..8a05e94fe612 100644 --- a/drivers/mmc/host/sdhci-omap.c +++ b/drivers/mmc/host/sdhci-omap.c @@ -696,7 +696,11 @@ static int sdhci_omap_enable_dma(struct sdhci_host *host) struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON); - reg |= CON_DMA_MASTER; + reg &= ~CON_DMA_MASTER; + /* Switch to DMA slave mode when using external DMA */ + if (!host->use_external_dma) + reg |= CON_DMA_MASTER; + sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg); return 0; @@ -1010,6 +1014,7 @@ static int sdhci_omap_probe(struct platform_device *pdev) const struct of_device_id *match; struct sdhci_omap_data *data; const struct soc_device_attribute *soc; + struct resource *regs; match = of_match_device(omap_sdhci_match, dev); if (!match) @@ -1022,6 +1027,10 @@ static int sdhci_omap_probe(struct platform_device *pdev) } offset = data->offset; + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!regs) + return -ENXIO; + host = sdhci_pltfm_init(pdev, &sdhci_omap_pdata, sizeof(*omap_host)); if (IS_ERR(host)) { @@ -1038,6 +1047,7 @@ static int sdhci_omap_probe(struct platform_device *pdev) omap_host->timing = MMC_TIMING_LEGACY; omap_host->flags = data->flags; host->ioaddr += offset; + host->mapbase = regs->start + offset; mmc = host->mmc; sdhci_get_of_property(pdev); @@ -1105,6 +1115,10 @@ static int sdhci_omap_probe(struct platform_device *pdev) host->mmc_host_ops.execute_tuning = sdhci_omap_execute_tuning; host->mmc_host_ops.enable_sdio_irq = sdhci_omap_enable_sdio_irq; + /* Switch to external DMA only if there is the "dmas" property */ + if (of_find_property(dev->of_node, "dmas", NULL)) + sdhci_switch_external_dma(host, true); + ret = sdhci_setup_host(host); if (ret) goto err_put_sync;