From: Ludovic BARRE <ludovic.barre@st.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@st.com>,
Gerald Baeza <gerald.baeza@st.com>,
Linux ARM <linux-arm-kernel@lists.infradead.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
<devicetree@vger.kernel.org>,
"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Subject: Re: [PATCH 01/19] mmc: mmci: regroup and define dma operations
Date: Wed, 11 Jul 2018 11:41:06 +0200 [thread overview]
Message-ID: <d93e6886-1dee-7915-459f-466a54d0c242@st.com> (raw)
In-Reply-To: <CAPDyKFpt5HUeUqaoS9icDodM+r64jB9vQ=zTecO0tuBv=TtOXg@mail.gmail.com>
On 07/05/2018 05:17 PM, Ulf Hansson wrote:
> On 12 June 2018 at 15:14, Ludovic Barre <ludovic.Barre@st.com> wrote:
>> From: Ludovic Barre <ludovic.barre@st.com>
>>
>> Prepare mmci driver to manage dma interface by new property.
>> This patch defines and regroups dma operations for mmci drivers.
>> mmci_dma_XX prototypes are added to call member of mmci_dma_ops
>> if not null. Based on legacy need, a mmci dma interface has been
>> defined with:
>> -mmci_dma_setup
>> -mmci_dma_release
>> -mmci_dma_pre_req
>> -mmci_dma_start
>> -mmci_dma_finalize
>> -mmci_dma_post_req
>> -mmci_dma_error
>> -mmci_dma_get_next_data
>
> As I suggested for one of the other patches, I would rather turn core
> mmci functions into library functions, which can be either invoked
> from variant callbacks or assigned directly to them.
>
> In other words, I would leave the functions that you move in this
> patch to stay in mmci.c. Although some needs to be re-factored and we
> also needs to make some of them available to be called from another
> file, hence the functions needs to be shared via mmci.h rather than
> being declared static.
In previous exchange mail "STM32MP1 SDMMC driver review"
we are said:
>>> -dma variant à should fit in Qualcomm implementation, reuse (rename)
>>> mmci_qcom_dml.c file and integrate ST dma in.
>>
>> stm32 sdmmc has an internal dma, no need to use dmaengine API;
>> So some modifications in mmci (pre/post request, mmci_dma_xx). perhaps
>> should be done with an ops or not.
>
>Yes.
>
>The Qualcomm variant is also using an internal DMA, hence I thought
>there may be something we could re-use, or at least have some new
>common ops for.
It's not crystal clear for me.
Do you always agree with a dma ops which allow to address different
DMA transfer:
-with dmaengine API
-sdmmc idma, without dmaengine API
-...
>
> Let me take a concrete example on how I would move forward, hopefully
> that explains it a bit better. Please see below.
>
> [...]
>
>> -/*
>> - * All the DMA operation mode stuff goes inside this ifdef.
>> - * This assumes that you have a generic DMA device interface,
>> - * no custom DMA interfaces are supported.
>> - */
>> -#ifdef CONFIG_DMA_ENGINE
>> -static void mmci_dma_setup(struct mmci_host *host)
>> -{
>> - const char *rxname, *txname;
>> - struct variant_data *variant = host->variant;
>> -
>> - host->dma_rx_channel = dma_request_slave_channel(mmc_dev(host->mmc), "rx");
>> - host->dma_tx_channel = dma_request_slave_channel(mmc_dev(host->mmc), "tx");
>> -
>> - /* initialize pre request cookie */
>> - host->next_data.cookie = 1;
>> -
>> - /*
>> - * If only an RX channel is specified, the driver will
>> - * attempt to use it bidirectionally, however if it is
>> - * is specified but cannot be located, DMA will be disabled.
>> - */
>> - if (host->dma_rx_channel && !host->dma_tx_channel)
>> - host->dma_tx_channel = host->dma_rx_channel;
>> -
>> - if (host->dma_rx_channel)
>> - rxname = dma_chan_name(host->dma_rx_channel);
>> - else
>> - rxname = "none";
>> -
>> - if (host->dma_tx_channel)
>> - txname = dma_chan_name(host->dma_tx_channel);
>> - else
>> - txname = "none";
>> -
>> - dev_info(mmc_dev(host->mmc), "DMA channels RX %s, TX %s\n",
>> - rxname, txname);
>> -
>> - /*
>> - * Limit the maximum segment size in any SG entry according to
>> - * the parameters of the DMA engine device.
>> - */
>> - if (host->dma_tx_channel) {
>> - struct device *dev = host->dma_tx_channel->device->dev;
>> - unsigned int max_seg_size = dma_get_max_seg_size(dev);
>> -
>> - if (max_seg_size < host->mmc->max_seg_size)
>> - host->mmc->max_seg_size = max_seg_size;
>> - }
>> - if (host->dma_rx_channel) {
>> - struct device *dev = host->dma_rx_channel->device->dev;
>> - unsigned int max_seg_size = dma_get_max_seg_size(dev);
>> -
>> - if (max_seg_size < host->mmc->max_seg_size)
>> - host->mmc->max_seg_size = max_seg_size;
>> - }
>
> Everything above shall be left as generic library function,
> mmci_dma_setup() and I would share it via mmci.h and thus change it
> from being static.
>
each interfaces mmci_dma_XXX have very different needs depending
dma_ops (legacy, sdmmc idma)
>> -
>> - if (variant->qcom_dml && host->dma_rx_channel && host->dma_tx_channel)
>> - if (dml_hw_init(host, host->mmc->parent->of_node))
>> - variant->qcom_dml = false;
>
> This piece of code, should be made specific to the qcom variant and
> managed though a "mmci_host_ops" callback. The corresponding code in
> that callback would then start by invoking mmci_dma_setup(), before it
> continues with the qcom specific operations.
>
> For legacy variants, the corresponding callback would be set directly
> to mmci_dma_setup() and called through the callback from mmci.c when
> needed. There is no need to have a separate file for DMA for the
> legacy variants, I think.
>
> [...]
>
> Kind regards
> Uffe
>
next prev parent reply other threads:[~2018-07-11 9:41 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-12 13:14 [PATCH 00/19] mmc: mmci: add stm32 sdmmc variant Ludovic Barre
2018-06-12 13:14 ` [PATCH 01/19] mmc: mmci: regroup and define dma operations Ludovic Barre
2018-07-05 15:17 ` Ulf Hansson
2018-07-11 9:41 ` Ludovic BARRE [this message]
2018-07-11 12:16 ` Ulf Hansson
2018-07-12 9:09 ` Ludovic BARRE
2018-06-12 13:14 ` [PATCH 02/19] mmc: mmci: merge qcom dml feature into mmci dma Ludovic Barre
2018-07-05 15:26 ` Ulf Hansson
2018-07-11 15:19 ` Ludovic BARRE
2018-07-13 11:17 ` Ulf Hansson
2018-07-13 13:08 ` Ludovic BARRE
2018-07-30 15:15 ` Ulf Hansson
2018-06-12 13:14 ` [PATCH 03/19] mmc: mmci: add datactrl block size variant property Ludovic Barre
2018-06-12 13:14 ` [PATCH 04/19] mmc: mmci: expand startbiterr to irqmask and error check Ludovic Barre
2018-06-12 13:14 ` [PATCH 05/19] mmc: mmci: allow to overwrite clock/power procedure to specific variant Ludovic Barre
2018-07-05 13:48 ` Ulf Hansson
2018-07-11 12:19 ` Ludovic BARRE
2018-07-11 12:38 ` Ulf Hansson
2018-06-12 13:14 ` [PATCH 06/19] mmc: mmci: add variant properties to define cpsm & cmdresp bits Ludovic Barre
2018-07-05 14:20 ` Ulf Hansson
2018-06-12 13:14 ` [PATCH 07/19] mmc: mmci: add variant property to define dpsm bit Ludovic Barre
2018-06-12 13:14 ` [PATCH 08/19] mmc: mmci: add variant property to define irq pio mask Ludovic Barre
2018-06-12 13:14 ` [PATCH 09/19] mmc: mmci: add variant property to write datactrl before command Ludovic Barre
2018-06-12 13:14 ` [PATCH 10/19] mmc: mmci: add variant property to allow remain data Ludovic Barre
2018-07-05 13:55 ` Ulf Hansson
2018-06-12 13:14 ` [PATCH 11/19] mmc: mmci: add variant property to check specific data constraint Ludovic Barre
2018-06-12 13:14 ` [PATCH 12/19] mmc: mmci: add variant property to request a reset Ludovic Barre
2018-06-25 21:23 ` Rob Herring
2018-06-12 13:14 ` [PATCH 13/19] mmc: mmci: send stop cmd if a data command fail Ludovic Barre
2018-07-04 13:37 ` Ulf Hansson
2018-07-11 8:57 ` Ludovic BARRE
2018-06-12 13:14 ` [PATCH 14/19] mmc: mmci: add clock divider for stm32 sdmmc Ludovic Barre
2018-06-12 13:14 ` [PATCH 15/19] mmc: mmci: add stm32 sdmmc registers Ludovic Barre
2018-06-12 13:14 ` [PATCH 16/19] mmc: mmci: add DT bindings for STM32 sdmmc Ludovic Barre
2018-06-25 21:47 ` Rob Herring
2018-06-12 13:14 ` [PATCH 17/19] mmc: mmci: add stm32 sdmmc idma support Ludovic Barre
2018-06-12 13:14 ` [PATCH 18/19] mmc: mmci: add specific clk/pwr procedure for stm32 sdmmc Ludovic Barre
2018-07-05 14:49 ` Ulf Hansson
2018-06-12 13:14 ` [PATCH 19/19] mmc: mmci: add stm32 sdmmc variant Ludovic Barre
2018-06-29 13:51 ` [PATCH 00/19] " Ludovic BARRE
2018-06-29 15:18 ` Ulf Hansson
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=d93e6886-1dee-7915-459f-466a54d0c242@st.com \
--to=ludovic.barre@st.com \
--cc=alexandre.torgue@st.com \
--cc=devicetree@vger.kernel.org \
--cc=gerald.baeza@st.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=mcoquelin.stm32@gmail.com \
--cc=robh+dt@kernel.org \
--cc=ulf.hansson@linaro.org \
/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®