From: Faiz Abbas <faiz_abbas@ti.com>
To: Chunyan Zhang <zhang.chunyan@linaro.org>,
Ulf Hansson <ulf.hansson@linaro.org>,
Adrian Hunter <adrian.hunter@intel.com>
Cc: <linux-mmc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Arnd Bergmann <arnd@arndb.de>, Mark Brown <broonie@kernel.org>,
Kishon Vijay Abraham I <kishon@ti.com>,
Chunyan Zhang <zhang.lyra@gmail.com>
Subject: Re: [PATCH 1/7] mmc: sdhci: add support for using external DMA devices
Date: Thu, 31 Jan 2019 18:02:03 +0530 [thread overview]
Message-ID: <708d8bb6-6c64-b63d-398f-19c7f784020c@ti.com> (raw)
In-Reply-To: <20190130110548.19151-1-zhang.chunyan@linaro.org>
Chunyan,
On 30/01/19 4:35 PM, Chunyan Zhang wrote:
> Some standard SD host controllers can support both external dma
> controllers as well as ADMA/SDMA in which the SD host controller
> acts as DMA master. TI's omap controller is the case as an example.
>
> Currently the generic SDHCI code supports ADMA/SDMA integrated in
> 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 an external DMA controller with SDHCI.
>
> Fixes by Faiz Abbas <faiz_abbas@ti.com>:
> 1. Map scatterlists before dmaengine_prep_slave_sg()
> 2. Use dma_async() functions inside of the send_command() path and
> synchronize once at the start of each request.
>
> Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
> Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
> ---
> Changes from the last version:
> * Moved sdhci_set_timeout() from _prepare_data() to its caller -
> sdhci_send_command();
> * Factor out a new function sdhci_reset_data() which deal with sanity
> checks for mmc_data and reset for host->data, these processes were
> in _prepare_data();
> * Factor out a new function sdhci_set_block_info() for configuring data
> blocks which were processing at bottom of _prepare_data();
> * Added a new tasklet and functions for handling external dma error case;
> * Removed sdhci_external_dma_cleanup() which is not used;
> * Added an empty sdhci_external_dma_channel definition for
> !IS_ENABLED(CONFIG_MMC_SDHCI_EXTERNAL_DMA);
> * Addressed some other comments from Adrian:
> - Removed check for MMC_SET_BLOCK_COUNT, left checking !cmd->data only
> which is enough.
There should have been a v2 in the patch description. It lets reviewers
know that they have seen this patch before and its not the same thing. I
would have preferred you had me test this before posting it to the
mailing list. Otherwise there should be a "not tested" in the description.
> ---
> drivers/mmc/host/Kconfig | 3 +
> drivers/mmc/host/sdhci.c | 333 +++++++++++++++++++++++++++++++++++----
> drivers/mmc/host/sdhci.h | 10 ++
> 3 files changed, 317 insertions(+), 29 deletions
[snip]
> +static void sdhci_external_dma_prepare_data(struct sdhci_host *host,
> + struct mmc_command *cmd)
> +{
> + struct mmc_data *data = cmd->data;
> + struct dma_chan *chan = sdhci_external_dma_channel(host, data);
chan is not being used in this function.
> +
> + if (!sdhci_external_dma_setup(host, cmd)) {
> + __sdhci_external_dma_prepare_data(host, cmd);
> } else {
> - sdhci_writew(host, data->blocks, SDHCI_BLOCK_COUNT);
> + sdhci_external_dma_release(host);
> + pr_err("%s: Cannot use external DMA, switch to the DMA/PIO which standard SDHCI provides.\n",
> + mmc_hostname(host->mmc));
> + sdhci_prepare_data(host, cmd);
> + }
> +}
> +
> +static void sdhci_external_dma_pre_transfer(struct sdhci_host *host,
> + struct mmc_command *cmd)
> +{
> + struct dma_chan *chan;
I think you wanted to initialize this one.
> +
> + if (!cmd->data)
> + return;
> +
> + chan = sdhci_external_dma_channel(host, cmd->data);
> + if (chan)
> + dma_async_issue_pending(chan);
> +}
> +
> +static bool sdhci_external_dma_request_done(struct sdhci_host *host)
> +{
> + struct mmc_request *mrq;
> + struct dma_chan *chan;
> + int i;
> +
> + spin_lock_irqsave(&host->lock, flags);
flags is not declared.
> +
> + for (i = 0; i < SDHCI_MAX_MRQS; i++) {
> + mrq = host->mrqs_done[i];
> + if (mrq)
> + break;
> }
> +
> + spin_unlock_irqrestore(&host->lock, flags);
> +
> + if (!mrq)
> + return true;
> +
> + sdhci_tasklet_finish(host);
This doesn't even build. sdhci_tasklet_finish is declared below this. In
the future, if you don't have a platform to test things on, at least
build and use checkpatch before posting it to the mailing list.
Should we even be calling a tasklet callback function directly?
Shouldn't we do a tasklet_schedule()?
Thanks,
Faiz
next prev parent reply other threads:[~2019-01-31 12:29 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-11 11:08 [PATCH 0/7] Port am335 and am437 devices to sdhci-omap Faiz Abbas
2019-01-11 11:08 ` [PATCH 1/7] mmc: sdhci: add support for using external DMA devices Faiz Abbas
2019-01-14 8:45 ` Adrian Hunter
2019-01-24 11:40 ` Adrian Hunter
2019-01-28 10:20 ` Chunyan Zhang
2019-01-28 10:43 ` Faiz Abbas
2019-01-28 11:46 ` Chunyan Zhang
2019-01-29 11:53 ` Faiz Abbas
2019-01-30 5:01 ` Chunyan Zhang
2019-01-30 11:05 ` Chunyan Zhang
2019-01-31 12:32 ` Faiz Abbas [this message]
2019-02-11 12:23 ` Faiz Abbas
2019-01-11 11:08 ` [PATCH 2/7] mmc: sdhci-omap: Add using external dma Faiz Abbas
2019-01-11 11:08 ` [PATCH 3/7] dt-bindings: sdhci-omap: Add example for " Faiz Abbas
2019-01-21 23:20 ` Rob Herring
2019-01-22 8:47 ` [PATCH] dt-bindings: sdhci-omap: Add properties " Chunyan Zhang
2019-01-22 10:20 ` Faiz Abbas
2019-01-23 2:44 ` Chunyan Zhang
2019-01-11 11:08 ` [PATCH 4/7] mmc: sdhci: Add quirk for disabling DTO during erase command Faiz Abbas
2019-01-24 12:08 ` Adrian Hunter
2019-01-28 11:19 ` Faiz Abbas
2019-01-11 11:08 ` [PATCH 5/7] mmc: sdhci-omap: Add DISABLE_DTO_FOR_ERASE Quirk Faiz Abbas
2019-01-11 11:08 ` [PATCH 6/7] dt-bindings: sdhci-omap: Add am335x and am437x specific bindings Faiz Abbas
2019-01-21 23:21 ` Rob Herring
2019-01-11 11:08 ` [PATCH 7/7] mmc: sdhci-omap: Add am335x and am437x specific compatibles Faiz Abbas
2019-01-24 9:44 ` [PATCH 0/7] Port am335 and am437 devices to sdhci-omap Faiz Abbas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=708d8bb6-6c64-b63d-398f-19c7f784020c@ti.com \
--to=faiz_abbas@ti.com \
--cc=adrian.hunter@intel.com \
--cc=arnd@arndb.de \
--cc=broonie@kernel.org \
--cc=kishon@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=zhang.chunyan@linaro.org \
--cc=zhang.lyra@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®