Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp426537imu; Tue, 11 Dec 2018 01:14:19 -0800 (PST) X-Google-Smtp-Source: AFSGD/UtNoBV315sIu3Ghu7oD41qzuIY7aCxESCU2r1fjbqiG/tOgEpfCAkJZ6sSOcTZLUsHg48L X-Received: by 2002:a17:902:12f:: with SMTP id 44mr15501939plb.74.1544519659385; Tue, 11 Dec 2018 01:14:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544519659; cv=none; d=google.com; s=arc-20160816; b=BcfqTJZp5lfxhlZcdYyJEluTsa3cQbDHaovyjhYiX4w2BEC7ch4Rm82PYsvJmcli8p O9qmrSq1DTqd79YHaXRAv4oN8UpkriBKNHMADpoZYaoSMygeW1bIXFjUVOfm00GqqlLD epRXcY7Z0vQpwSriff/YJ1A0pFvco21kiMKWRubO++NGm1spuZKDUp3pxERGGFd8ucZ9 MStbiho9IS9SbHuVqlMbireBNMN9ErrwwtYfaANyOYlFMTTVKfjA4QW8BgclcOFcjTQv 81IDm6L9ojWa7LfA9siC48K0YhGOHO6biBW2gvyWnhjRKfk18w4OEQnIz9kxzDwuXuI/ mFoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=C8aXLhdbAkcSLAq4wUpP1AsonwJYLIIKjoAc4XvvsqE=; b=hcKV7RkOnc4jhDW6aKE5T3Aw+TwsAhnaHh+93bf+laA2sOJZL/wVK4vsnbsKkKktGy 9RvT4zuhzmkUaWLkVdQotK7rNMaqP3uS3YE1uUyb/oP1jD2yQsEaTD8OvvbzXT4vS9Y5 VOVCV3yEQFmyEJeO2ojP87sI3riOxqSF0h+rKZFjACM/BLZAHvwi+BhGFQkZ780LngSp E/Q4oCVcR4nAQTDZV+fsfPCZc5yhlUI2HONaU4lzHH8ZN3kDmOJ6KGdX1/w3NSm0euOg 2Gb7naL7Y2F/VwT0Aai5omSYebeFBz5FsVF/xygqvwLx4ex4QnHC9t/GVQ3Io6Rq8IRW esRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jxxNQwRf; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b8si11168537pgi.575.2018.12.11.01.14.04; Tue, 11 Dec 2018 01:14:19 -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=@linaro.org header.s=google header.b=jxxNQwRf; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726209AbeLKJNH (ORCPT + 99 others); Tue, 11 Dec 2018 04:13:07 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:42278 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726085AbeLKJNG (ORCPT ); Tue, 11 Dec 2018 04:13:06 -0500 Received: by mail-pf1-f194.google.com with SMTP id 64so6822555pfr.9 for ; Tue, 11 Dec 2018 01:13:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=C8aXLhdbAkcSLAq4wUpP1AsonwJYLIIKjoAc4XvvsqE=; b=jxxNQwRf4Z7VdT47DLCUWcCaBhOboriLEzwBMBZFlpmMzXE7Xxy7W5ZZ03NU9INxAn eu7r25WXNr/ZDry7yHvtQ8B+LkcZN9XZDCZaaK+n+n5JkxCKLQsHKXkFB7xD6I5c02uv RPNoeRV9vbCQ0apFisuPgszDCCREL61LCffKE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=C8aXLhdbAkcSLAq4wUpP1AsonwJYLIIKjoAc4XvvsqE=; b=OyadyH6CABZig1KgMXCKkIE8WzdY5GkfuvjxuGbZ8219QBqJcS88zlJuHrITDcSlbD OgO00/qxLgSNVLSj3U2t8Gvf6Te/GMSIBiQTGvZFjhdlezJ6IQC7aho31q4QxQgBuh8Q R8Ggf3iooPYwC+016jLj/hlqZSObXvhUGEVAYC/ab9iyQDsmhuFM5VZtUu6Mjj2XVgVO /2XCMTFK0Ii4wLk/EnNNNc+qse1WHNrBSmvKf8afTLtqWsxP5QkcHciGJMWxmmF2NSaR SvlyngxHBrLCpAew7QARWNjn91AnhsTSfDdQpgcYSWVVlZwth6Jn2G5zZM/4niifND// vHzQ== X-Gm-Message-State: AA+aEWY4eVd+M9VbA2XMl9uVcYSNedfW6Csl43dBUgLEXiNfFWG8O2fg pMyItt/B8SNt5+X5fUjnj7NdZw== X-Received: by 2002:a63:b81a:: with SMTP id p26mr14180703pge.433.1544519585359; Tue, 11 Dec 2018 01:13:05 -0800 (PST) Received: from ubt.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id a90sm27202214pfj.109.2018.12.11.01.12.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Dec 2018 01:13:04 -0800 (PST) From: Chunyan Zhang To: Ulf Hansson , Adrian Hunter , Faiz Abbas Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Mark Brown , Kishon Vijay Abraham I , Sekhar Nori , Chunyan Zhang Subject: [PATCH V4 0/3] Add support for using external dma in SDHCI Date: Tue, 11 Dec 2018 17:12:49 +0800 Message-Id: <1544519572-21921-1-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently the generic SDHCI code in the Linux kernel supports the SD standard DMA integrated into the host controller but does not have any support for external DMA controllers implemented using dmaengine meaning that custom code is needed for any systems that use a generic DMA controller with SDHCI which in practice means any SDHCI controller that doesn't have an integrated DMA controller so we should have this as a generic feature. There are already a number of controller specific drivers that have dmaengine code, and some could use sdhci.c actually, but needed to implement mmc_ops->request() in their specific driver for sending command with external dma using dmaengine framework, with this patchset, them will take advantage of the generic support. TI's omap controller is the case as an example. Any comments are very appreciated. Thanks, Chunyan Changes from v3 (https://lkml.org/lkml/2018/12/4/74): (The code only on patch 1/3 was revised since v3) * Moved the check for command data from sdhci_external_dma_setup() to sdhci_external_dma_prepare_data(); * Cut a copy of prepare_data() for external DMA instead of using sdhci_prepare_data() to avoid the host use ADMA rather than external DMA; In this way, if failed to setup external DMA, host can fall back to ADMA/SDMA/PIO which standard sd host controller supports. * Added dmaengine_terminate_sync() when finished transfers or some error occured; * Adjusted print message in __sdhci_add_host() for the case of using external DMA. Changes from v2 (https://lkml.org/lkml/2018/11/12/1936): * Remove CONFIG_EXTERNAL_DMA prompt and help graph; * Add checking for cmd->data; * Select MMC_SDHCI_EXTERNAL_DMA for MMC_SDHCI_OMAP; * Add checking if there's 'dmas' in device tree before decide using external dma. Changes from v1 (https://lkml.org/lkml/2018/11/5/110): (The code on patch 1/3 only was revised) * Address comments from Arnd: - Release channel when failed to request it unconditionally; - Skip warning message if get EPROBE_DEFER; * Address Andrian's comments: - Replace extdma with external_dma; - Add release dma resources in sdhci_cleanup_host() and sdhci_remove_host(); - Release dma resources once dmaengine_submit() failed. - Put rx/tx_chan in struct sdhci_host, and removed unused structure. * Fall back to the DMA/PIO which standard SDHCI supports, if sdhci_external_dma_setup() or sdhci_external_dma_init failed; Chunyan Zhang (3): mmc: sdhci: add support for using external DMA devices mmc: sdhci-omap: Add using external dma dt-bindings: sdhci-omap: Add example for using external dma .../devicetree/bindings/mmc/sdhci-omap.txt | 7 + drivers/mmc/host/Kconfig | 4 + drivers/mmc/host/sdhci-omap.c | 10 + drivers/mmc/host/sdhci.c | 250 ++++++++++++++++++++- drivers/mmc/host/sdhci.h | 8 + 5 files changed, 278 insertions(+), 1 deletion(-) -- 2.7.4