From patchwork Fri Feb 15 19:20:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Faiz Abbas X-Patchwork-Id: 158534 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1056515jaa; Fri, 15 Feb 2019 11:17:56 -0800 (PST) X-Google-Smtp-Source: AHgI3IbAxm3F97c7DLSFC6MdgDF2CBWnqRlqz0n7f+CYafzbhpuZ6RAXrT9++7OK9bm4sbdcPoX3 X-Received: by 2002:a62:9359:: with SMTP id b86mr11314064pfe.161.1550258276379; Fri, 15 Feb 2019 11:17:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550258276; cv=none; d=google.com; s=arc-20160816; b=HSHY4xZL9vSi6OYMjxfunJCzqd3fB/FeQvZdmyVVQiGCmkRWoofNwLU6sm9TWXHmF+ aKbHaWYyFGV5xIzXEa2A71RsaJy3AGXIo4aDcoCaca6RsBGevuxN2wMWMFixJGDUYipk 8AR/ln9T4oDZ2SBvs4PNV0rFSdJphhyn2TQjvadIIoTxI99nW7wkF4wwMKiTaskGKxKX JQcpJD8WYt/FkYOqO2V7yOmF5F1+VPDrqdDjfaYkDa+PFoMXr4esvxK5RNiOV0azMF1Z 0wqp7rELxe2y2wqjFCXLr1nmTXEZ5zWPPAiap55QU7gretBuMR3Itj2FWO3xjYmIunPs PsTQ== 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=M/RL3HPRjK7bTA1EG63kiLoM0Bm8VyIGh9e1TXDeIvc=; b=n4rUclo9F6/SP1sFMeAJSPByhfzKOI1zGiBLuHjw0S1zGoOJmgm4Rw2+vM6OzIE+cE U19Fj8DdnZv2aAbTEX9PTjTM19ILFqre/17z3AhFzDiW3hTOEWRi+17QQTfkalfI/Rbc 05w2Hby9ZpSrOO8v/VdEpSkCenHtQu8hKIdp+2BGcBCFR8cYIMPwXjuoh3zXOVUDTYNz J862kP5Nu+u7SsDTZ3TnBD5wvuxya3qRfu+LztcBJr7S12woYY3pvivtUoXp3y4ZWbd/ 6RNk+3kchNDp7laJPT3Ds94R1/zL50jUvhtZo2mmXW4OZ/B1hR9sLe5kN1e1PC8oFdee vZQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=xBrsmXdJ; 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 m21si6460698pls.324.2019.02.15.11.17.55; Fri, 15 Feb 2019 11:17:56 -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=xBrsmXdJ; 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 S1732731AbfBOTRy (ORCPT + 32 others); Fri, 15 Feb 2019 14:17:54 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:35352 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726654AbfBOTRv (ORCPT ); Fri, 15 Feb 2019 14:17:51 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x1FJHjU0096901; Fri, 15 Feb 2019 13:17:45 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1550258265; bh=M/RL3HPRjK7bTA1EG63kiLoM0Bm8VyIGh9e1TXDeIvc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=xBrsmXdJpdFn6/wNdxAjGBo7JBgNtnQl4cCSkOmLUjU9bEhCZftjhTALEejwr7oit SsXwtQUA43mD4SfFxqI3N/bYFXWxfrzpqJx62UCxm/NbX6AK4XhXcNXg0VQiWlNost hb9VY90Ci8Dj5QpR2TsvbbindU0mBytVTDsLXc6g= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x1FJHjlA049226 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 15 Feb 2019 13:17:45 -0600 Received: from DLEE109.ent.ti.com (157.170.170.41) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Fri, 15 Feb 2019 13:17:44 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Fri, 15 Feb 2019 13:17:44 -0600 Received: from a0230074-OptiPlex-7010.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id x1FJHV0x025256; Fri, 15 Feb 2019 13:17:42 -0600 From: Faiz Abbas To: , , , CC: , , , , , , Subject: [PATCH v2 3/8] dt-bindings: sdhci-omap: Add properties for using external dma Date: Sat, 16 Feb 2019 00:50:28 +0530 Message-ID: <20190215192033.24203-4-faiz_abbas@ti.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190215192033.24203-1-faiz_abbas@ti.com> References: <20190215192033.24203-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. Signed-off-by: Chunyan Zhang Signed-off-by: Faiz Abbas --- Documentation/devicetree/bindings/mmc/sdhci-omap.txt | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.19.2 diff --git a/Documentation/devicetree/bindings/mmc/sdhci-omap.txt b/Documentation/devicetree/bindings/mmc/sdhci-omap.txt index 72c4dec7e1db..4485dbceb373 100644 --- a/Documentation/devicetree/bindings/mmc/sdhci-omap.txt +++ b/Documentation/devicetree/bindings/mmc/sdhci-omap.txt @@ -14,6 +14,11 @@ Required properties: "ddr_1_8v-rev11", "ddr_1_8v" or "ddr_3_3v", "hs200_1_8v-rev11", "hs200_1_8v", - pinctrl- : Pinctrl states as described in bindings/pinctrl/pinctrl-bindings.txt +- dmas: List of DMA specifiers with the controller specific format as described + in the generic DMA client binding. A tx and rx specifier is required. +- dma-names: List of DMA request names. These strings correspond 1:1 with the + DMA specifiers listed in dmas. The string naming is to be "tx" + and "rx" for TX and RX DMA requests, respectively. Example: mmc1: mmc@4809c000 { @@ -22,4 +27,6 @@ Example: ti,hwmods = "mmc1"; bus-width = <4>; vmmc-supply = <&vmmc>; /* phandle to regulator node */ + dmas = <&sdma 61 &sdma 62>; + dma-names = "tx", "rx"; }; From patchwork Fri Feb 15 19:20:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Faiz Abbas X-Patchwork-Id: 158535 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1056553jaa; Fri, 15 Feb 2019 11:18:00 -0800 (PST) X-Google-Smtp-Source: AHgI3IaP/k01KYn48UjAZgIJRkvLO15iNi+INEJQ7Bs/RtaZ118TzZvv4ZmMdarPx3/wp1ut6LcJ X-Received: by 2002:a62:568e:: with SMTP id h14mr11773196pfj.134.1550258280163; Fri, 15 Feb 2019 11:18:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550258280; cv=none; d=google.com; s=arc-20160816; b=Vn1Fs1PhkSINwFgR37WwJRS9snR9A5GtjYBNplAVA+VH2M6d8H6TWRuroF+jaK3iPW fmMVXkrGuUnEwEhXY28SBpxlvlTtHjUNeHHc0m0DmOrgSa4copWkjCPxPPzb0AimU7Xg fTAWbDIvjAbQQrFPc9oe7h6S/gkhO9Ke+a/HbGZWg2CPNEyuyVpp1EiOUwVQVxt0GPOU Z/riKDdYlyx9I/S0cnPROtJ9+8+JZul9e0oAZGKc+QnKKT6b8sG+FsrBLNaNCfg6X1c8 55XTOWRlGJOJFHlWygOnREcQZMBSQ3DHtC74/RB47f2dTyvKKDLzvBooH77/X6lWHwa8 94Ow== 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=cVPL4EPCxVAoyNM/VAl32mgqPwnZGwN/+OPZ2kzGYpg=; b=QRcPkRv91ocaRdQAxRZaB1OBVu1MrorDJEZY2jwr8PIIKamDx6KJfwOcfLCz7C2Vna +EIS++qdind6OySzLiIXJmvoKZ/TiVWW18j2PKL6v7x14tR8nltlp3kTYWSZvPPXMZa6 29RT2xQPq+ca3Jhxza5ekPDp/N5U6QKFKD/QwPazhBbn06GQG2AK7BLHzOwhqll2tuSQ dfhK96GufSOjJSX7uTbd6sd7TMo4dNqVYtqA4cKmwT0guJ4ROJSvm4a3XE7VQB8Nn9ic z3qU+40ktIfvW7pN9VWePAf4BvcG5mE2YQ2bytud0iDBR9GqMDfDDrJg9JhyStHEg195 9s2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=RZ8RBfje; 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 h35si6280957pgm.536.2019.02.15.11.17.59; Fri, 15 Feb 2019 11:18:00 -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=RZ8RBfje; 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 S2388217AbfBOTR5 (ORCPT + 32 others); Fri, 15 Feb 2019 14:17:57 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:47158 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733289AbfBOTRy (ORCPT ); Fri, 15 Feb 2019 14:17:54 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x1FJHmlQ130918; Fri, 15 Feb 2019 13:17:48 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1550258268; bh=cVPL4EPCxVAoyNM/VAl32mgqPwnZGwN/+OPZ2kzGYpg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=RZ8RBfjeisGK9x0Q74k3I7IOqcVV7B78wrv5th3Ap1Z4xpLY95L5TctFm7TePJ22S 3aLolHDgmImTuDL/gsbezlPO77yGKO2XWr6XUcOe5WezOf3WYD5ZAv7CIqfikKouBE qAUpOUnxrseNUJ1kQVShUXVMopAvu7HGlMLOVNQA= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x1FJHmWc049261 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 15 Feb 2019 13:17:48 -0600 Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Fri, 15 Feb 2019 13:17:48 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Fri, 15 Feb 2019 13:17:48 -0600 Received: from a0230074-OptiPlex-7010.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id x1FJHV10025256; Fri, 15 Feb 2019 13:17:45 -0600 From: Faiz Abbas To: , , , CC: , , , , , , Subject: [PATCH v2 4/8] mmc: sdhci-omap: Add using external dma Date: Sat, 16 Feb 2019 00:50:29 +0530 Message-ID: <20190215192033.24203-5-faiz_abbas@ti.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190215192033.24203-1-faiz_abbas@ti.com> References: <20190215192033.24203-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 f3b442528ed8..5d1189478ee0 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 imply 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;